: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
refactor(surveys): extract guided wizard stepper and layout into lib (#81433)
Arno Hillen4114ca43d7c7
diff --git a/frontend/src/lib/components/GuidedWizard/GuidedWizardPanel.tsx b/frontend/src/lib/components/GuidedWizard/GuidedWizardPanel.tsxnew file mode 100644index 000000000000..7439cf8745dc--- /dev/null+++ b/frontend/src/lib/components/GuidedWizard/GuidedWizardPanel.tsx@@ -0,0 +1,12 @@+import { ReactNode } from 'react'++import { cn } from 'lib/utils/css-classes'++interface GuidedWizardPanelProps {+ children: ReactNode+ className?: string+}++export function GuidedWizardPanel({ children, className }: GuidedWizardPanelProps): JSX.Element {+ return <div className={cn('rounded-lg border border-border bg-surface-primary p-3', className)}>{children}</div>+}diff --git a/frontend/src/lib/components/GuidedWizard/GuidedWizardSection.tsx b/frontend/src/lib/components/GuidedWizard/GuidedWizardSection.tsxnew file mode 100644index 000000000000..9443101b9f24--- /dev/null+++ b/frontend/src/lib/components/GuidedWizard/GuidedWizardSection.tsx@@ -0,0 +1,45 @@+import { ReactNode } from 'react'++import { cn } from 'lib/utils/css-classes'++interface GuidedWizardSectionProps {+ title: ReactNode+ description?: ReactNode+ children?: ReactNode+ className?: string+ headerClassName?: string+ contentClassName?: string+ titleClassName?: string+ descriptionClassName?: string+ badge?: ReactNode+ actions?: ReactNode+}++export function GuidedWizardSection({+ title,+ description,+ children,+ className,+ headerClassName,+ contentClassName,+ titleClassName,+ descriptionClassName,+ badge,+ actions,+}: GuidedWizardSectionProps): JSX.Element {+ return (+ <section className={cn('space-y-3', className)}>+ <div className={cn('space-y-1', headerClassName)}>+ <div className="flex items-center justify-between gap-4">+ <div className="flex min-w-0 items-center gap-2">+ <h2 className={cn('m-0 text-xl font-semibold', titleClassName)}>{title}</h2>+ {badge}+ </div>+ {actions}+ </div>+ {description ? <p className={cn('m-0 text-secondary', descriptionClassName)}>{description}</p> : null}+ </div>+ {children ? <div className={contentClassName}>{children}</div> : null}+ </section>+ )+}diff --git a/frontend/src/lib/components/GuidedWizard/GuidedWizardStepLayout.tsx b/frontend/src/lib/components/GuidedWizard/GuidedWizardStepLayout.tsxnew file mode 100644index 000000000000..5485a74f6663--- /dev/null+++ b/frontend/src/lib/components/GuidedWizard/GuidedWizardStepLayout.tsx@@ -0,0 +1,12 @@+import { ReactNode } from 'react'++import { cn } from 'lib/utils/css-classes'++interface GuidedWizardStepLayoutProps {+ children: ReactNode+ className?: string+}++export function GuidedWizardStepLayout({ children, className }: GuidedWizardStepLayoutProps): JSX.Element {+ return <div className={cn('space-y-5', className)}>{children}</div>+}diff --git a/frontend/src/lib/components/GuidedWizard/GuidedWizardStepper.test.tsx b/frontend/src/lib/components/GuidedWizard/GuidedWizardStepper.test.tsxnew file mode 100644index 000000000000..92c0ff4e2a8c--- /dev/null+++ b/frontend/src/lib/components/GuidedWizard/GuidedWizardStepper.test.tsx@@ -0,0 +1,89 @@+import '@testing-library/jest-dom'++import { cleanup, fireEvent, render, screen } from '@testing-library/react'++import { GuidedWizardStep, GuidedWizardStepper } from './GuidedWizardStepper'++type TestStep = 'intro' | 'first' | 'second' | 'third' | 'done'++const STEPS: GuidedWizardStep<TestStep>[] = [+ { step: 'first', label: 'First' },+ { step: 'second', label: 'Second' },+ { step: 'third', label: 'Third', optional: true },+]++describe('GuidedWizardStepper', () => {+ afterEach(cleanup)++ it('renders all steps, marking completed and current ones', () => {+ render(<GuidedWizardStepper steps={STEPS} currentStep="second" />)++ expect(screen.getByText('First')).toBeInTheDocument()+ expect(screen.getByText('Second')).toBeInTheDocument()+ expect(screen.getByText('Third')).toBeInTheDocument()+ expect(screen.getByText('optional')).toBeInTheDocument()++ // Completed steps show a checkmark instead of their number, upcoming steps keep theirs+ expect(screen.queryByText('1')).not.toBeInTheDocument()+ expect(screen.getByText('3')).toBeInTheDocument()+ expect(screen.getByText('Second').closest('button')).toHaveAttribute('aria-current', 'step')+ expect(screen.getByText('First').closest('button')).not.toHaveAttribute('aria-current')++ // Without an onStepClick handler the steps aren't navigable+ expect(screen.getByText('Third').closest('button')).toHaveAttribute('aria-disabled', 'true')+ })++ it.each([+ ['before the steps (e.g. a template picker)', 'intro', 'start', ['1', '2', '3']],+ ['after the steps (e.g. a success screen)', 'done', 'end', []],+ ] as [string, TestStep, 'start' | 'end', string[]][])(+ 'sorts an unlisted current step %s',+ (_description, currentStep, unlistedStepPosition, visibleNumbers) => {+ render(+ <GuidedWizardStepper+ steps={STEPS}+ currentStep={currentStep}+ unlistedStepPosition={unlistedStepPosition}+ />+ )++ // A step number is shown while upcoming and replaced by a checkmark once completed+ for (const number of ['1', '2', '3']) {+ if (visibleNumbers.includes(number)) {+ expect(screen.getByText(number)).toBeInTheDocument()+ } else {+ expect(screen.queryByText(number)).not.toBeInTheDocument()+ }+ }+ }+ )++ it('calls onStepClick with the clicked step', () => {+ const onStepClick = jest.fn()+ render(<GuidedWizardStepper steps={STEPS} currentStep="second" onStepClick={onStepClick} />)++ fireEvent.click(screen.getByText('Third'))+ expect(onStepClick).toHaveBeenCalledWith('third')+ })++ it('blocks forward navigation but allows going back when the current step has errors', () => {+ const onStepClick = jest.fn()+ render(+ <GuidedWizardStepper+ steps={STEPS}+ currentStep="second"+ onStepClick={onStepClick}+ stepErrors={{ second: ['Something is wrong'] }}+ />+ )++ // Blocked steps use aria-disabled, so the click reaches the handler and exercises its guard+ const forwardButton = screen.getByText('Third').closest('button')+ expect(forwardButton).toHaveAttribute('aria-disabled', 'true')+ fireEvent.click(forwardButton!)+ expect(onStepClick).not.toHaveBeenCalled()++ fireEvent.click(screen.getByText('First'))+ expect(onStepClick).toHaveBeenCalledWith('first')+ })+})diff --git a/frontend/src/scenes/surveys/wizard/WizardStepper.tsx b/frontend/src/lib/components/GuidedWizard/GuidedWizardStepper.tsxsimilarity index 58%rename from frontend/src/scenes/surveys/wizard/WizardStepper.tsxrename to frontend/src/lib/components/GuidedWizard/GuidedWizardStepper.tsxindex 96625a86764d..cc5a391faf83 100644--- a/frontend/src/scenes/surveys/wizard/WizardStepper.tsx+++ b/frontend/src/lib/components/GuidedWizard/GuidedWizardStepper.tsx@@ -3,75 +3,73 @@ import { Tooltip } from '@posthog/lemon-ui'import { cn } from 'lib/utils/css-classes'-import { WizardStep } from './surveyWizardLogic'--interface Step {- key: WizardStep+export interface GuidedWizardStep<Step extends string = string> {+ step: Steplabel: stringoptional?: boolean}-const STEPS: Step[] = [- { key: 'questions', label: 'Questions' },- { key: 'where', label: 'Targeting' },- { key: 'when', label: 'Triggers' },- { key: 'appearance', label: 'Customize', optional: true },-]--const STEP_ORDER: Record<WizardStep, number> = {- template: -1,- questions: 0,- where: 1,- when: 2,- appearance: 3,- success: 4,-}--interface WizardStepperProps {- currentStep: WizardStep- onStepClick: (step: WizardStep) => void- stepErrors?: Partial<Record<WizardStep, string[]>>+export interface GuidedWizardStepperProps<Step extends string> {+ steps: GuidedWizardStep<Step>[]+ currentStep: Step+ /**+ * Where a currentStep that isn't in steps sorts: 'start' leaves every step upcoming (e.g. a+ * template picker shown before the wizard), 'end' marks every step completed (e.g. a success+ * screen shown after it). Defaults to 'start'.+ */+ unlistedStepPosition?: 'start' | 'end'+ onStepClick?: (step: Step) => void+ stepErrors?: Partial<Record<Step, string[]>>+ 'aria-label'?: string}-export function WizardStepper({ currentStep, onStepClick, stepErrors = {} }: WizardStepperProps): JSX.Element {- const currentOrder = STEP_ORDER[currentStep]+export function GuidedWizardStepper<Step extends string>({+ steps,+ currentStep,+ unlistedStepPosition = 'start',+ onStepClick,+ stepErrors = {},+ 'aria-label': ariaLabel = 'Wizard progress',+}: GuidedWizardStepperProps<Step>): JSX.Element {+ const currentStepIndex = steps.findIndex(({ step }) => step === currentStep)+ const currentOrder = currentStepIndex >= 0 ? currentStepIndex : unlistedStepPosition === 'end' ? steps.length : -1const currentStepHasErrors = (stepErrors[currentStep]?.length ?? 0) > 0+ const isInteractive = !!onStepClick- const handleStepClick = (step: WizardStep): void => {+ const handleStepClick = (step: Step, targetOrder: number): void => {// Block navigation if current step has errors (except going back)- const targetOrder = STEP_ORDER[step]if (currentStepHasErrors && targetOrder > currentOrder) {return // Don't navigate forward when current step has errors}- onStepClick(step)+ onStepClick?.(step)}return (- <nav className="flex items-center" aria-label="Survey wizard progress">- {STEPS.map((step, index) => {- const stepOrder = STEP_ORDER[step.key]- const isCompleted = currentOrder > stepOrder- const isCurrent = currentStep === step.key- const hasErrors = (stepErrors[step.key]?.length ?? 0) > 0- const isBlocked = currentStepHasErrors && stepOrder > currentOrder+ <nav className="flex items-center" aria-label={ariaLabel}>+ {steps.map((step, index) => {+ const isCompleted = currentOrder > index+ const isCurrent = currentStep === step.step+ const hasErrors = (stepErrors[step.step]?.length ?? 0) > 0+ const isBlocked = isInteractive && currentStepHasErrors && index > currentOrderconst button = (<buttontype="button"- onClick={() => handleStepClick(step.key)}- disabled={isBlocked}+ onClick={() => handleStepClick(step.step, index)}+ // aria-disabled instead of disabled so the button keeps pointer events (the blocked tooltip needs hover) and its tab-order slot+ aria-disabled={isBlocked || !isInteractive}className={cn('group flex items-center gap-1.5 px-2 py-1 rounded','transition-all duration-150','focus:outline-none focus-visible:ring-1 focus-visible:ring-accent',- isBlocked- ? 'opacity-50 cursor-not-allowed'- : 'hover:bg-fill-button-tertiary-hover active:scale-[0.98]'+ isBlocked && 'opacity-50 cursor-not-allowed',+ !isBlocked && isInteractive && 'hover:bg-fill-button-tertiary-hover active:scale-[0.98]',+ !isInteractive && 'cursor-default')}aria-current={isCurrent ? 'step' : undefined}>- {/* Indicator */}- {hasErrors && isCurrent ? (+ {/* Indicator: errors outrank the completed checkmark, current or not */}+ {hasErrors ? (<IconWarning className="size-5 text-warning" />) : isCompleted ? (<IconCheckCircle className="size-5 text-success" />@@ -105,13 +103,13 @@ export function WizardStepper({ currentStep, onStepClick, stepErrors = {} }: Wiz)return (- <div key={step.key} className="flex items-center">+ <div key={step.step} className="flex items-center">{/* Connector */}{index > 0 && (<divclassName={cn('w-6 h-px transition-colors duration-150',- hasErrors && isCurrent+ hasErrors? 'bg-warning': isCompleted || isCurrent? 'bg-success'diff --git a/frontend/src/scenes/surveys/wizard/SurveyAudienceFilters.tsx b/frontend/src/scenes/surveys/wizard/SurveyAudienceFilters.tsxindex d860ffb11880..f6965fc1fdf4 100644--- a/frontend/src/scenes/surveys/wizard/SurveyAudienceFilters.tsx+++ b/frontend/src/scenes/surveys/wizard/SurveyAudienceFilters.tsx@@ -3,6 +3,8 @@ import { useEffect, useState } from 'react'import { LemonButton, LemonInput } from '@posthog/lemon-ui'+import { GuidedWizardPanel } from 'lib/components/GuidedWizard/GuidedWizardPanel'+import { GuidedWizardSection } from 'lib/components/GuidedWizard/GuidedWizardSection'import { PropertyFilters } from 'lib/components/PropertyFilters/PropertyFilters'import { TaxonomicFilterGroupType } from 'lib/components/TaxonomicFilter/types'import { LemonRadio } from 'lib/lemon-ui/LemonRadio'@@ -18,7 +20,6 @@ import {getSurveyTargetingFilters,isSimpleSurveyAudienceTargeting,} from '../utils'-import { WizardPanel, WizardSection } from './WizardLayout'function buildSimpleAudienceFilters(properties: AnyPropertyFilter[], rolloutPercentage: number): FeatureFlagFilters {return {@@ -111,7 +112,7 @@ export function SurveyAudienceFilters({ onOpenFullEditor }: { onOpenFullEditor?:const headerSummary = getSurveyAudienceSummaryValue(survey) || (audienceMode === 'all' ? 'Everyone' : null)return (- <WizardSection+ <GuidedWizardSectiontitle="Who should see this?"description="Narrow this survey to people or cohorts, and control how broadly it rolls out."className="space-y-2.5"@@ -125,13 +126,13 @@ export function SurveyAudienceFilters({ onOpenFullEditor }: { onOpenFullEditor?:>{hasAdvancedTargeting ? (<div className="space-y-2.5">- <WizardPanel>+ <GuidedWizardPanel><div className="text-sm font-medium text-primary">Advanced audience targeting</div><div className="mt-1 text-xs text-secondary">This survey already uses targeting rules that are more advanced than the guided editorsupports.</div>- </WizardPanel>+ </GuidedWizardPanel><div className="flex items-center justify-between gap-3"><p className="m-0 text-xs text-muted">Use the full editor to review or change these rules.</p>{onOpenFullEditor && (@@ -163,7 +164,7 @@ export function SurveyAudienceFilters({ onOpenFullEditor }: { onOpenFullEditor?:{audienceMode === 'specific' && (<div className="ml-6 space-y-2.5">- <WizardPanel>+ <GuidedWizardPanel><div className="text-xs font-medium uppercase tracking-wide text-muted-alt">Rollout</div>@@ -196,9 +197,9 @@ export function SurveyAudienceFilters({ onOpenFullEditor }: { onOpenFullEditor?:suffix={<span>%</span>}/></div>- </WizardPanel>+ </GuidedWizardPanel>- <WizardPanel>+ <GuidedWizardPanel><div className="text-xs font-medium uppercase tracking-wide text-muted-alt">Audience rules</div>@@ -221,7 +222,7 @@ export function SurveyAudienceFilters({ onOpenFullEditor }: { onOpenFullEditor?:openOnInsert/></div>- </WizardPanel>+ </GuidedWizardPanel><div className="flex items-center justify-between gap-3"><p className="m-0 text-xs text-muted">@@ -237,6 +238,6 @@ export function SurveyAudienceFilters({ onOpenFullEditor }: { onOpenFullEditor?:)}</div>)}- </WizardSection>+ </GuidedWizardSection>)}diff --git a/frontend/src/scenes/surveys/wizard/SurveyWizard.tsx b/frontend/src/scenes/surveys/wizard/SurveyWizard.tsxindex c584b4398a8d..bc2fd65a5113 100644--- a/frontend/src/scenes/surveys/wizard/SurveyWizard.tsx+++ b/frontend/src/scenes/surveys/wizard/SurveyWizard.tsx@@ -8,6 +8,7 @@ import { IconArrowLeft, IconChevronLeft, IconChevronRight } from '@posthog/iconsimport { LemonButton, LemonDialog } from '@posthog/lemon-ui'import { EditableField } from 'lib/components/EditableField/EditableField'+import { GuidedWizardStep, GuidedWizardStepper } from 'lib/components/GuidedWizard/GuidedWizardStepper'import { FEATURE_FLAGS } from 'lib/constants'import { LemonSkeleton } from 'lib/lemon-ui/LemonSkeleton'import { featureFlagLogic as enabledFeaturesLogic } from 'lib/logic/featureFlagLogic'@@ -36,8 +37,14 @@ import { SuccessStep } from './steps/SuccessStep'import { TemplateStep } from './steps/TemplateStep'import { WhenStep } from './steps/WhenStep'import { WhereStep } from './steps/WhereStep'-import { SurveyWizardLogicProps, surveyWizardLogic } from './surveyWizardLogic'-import { WizardStepper } from './WizardStepper'+import { SurveyWizardLogicProps, WizardStep, surveyWizardLogic } from './surveyWizardLogic'++const SURVEY_WIZARD_STEPS: GuidedWizardStep<WizardStep>[] = [+ { step: 'questions', label: 'Questions' },+ { step: 'where', label: 'Targeting' },+ { step: 'when', label: 'Triggers' },+ { step: 'appearance', label: 'Customize', optional: true },+]export const scene: SceneExport<SurveyWizardLogicProps> = {component: SurveyWizardComponent,@@ -389,7 +396,15 @@ function SurveyWizard({ id }: SurveyWizardLogicProps): JSX.Element {</div><SurveyPublicContentNotice /><div className="flex justify-center">- <WizardStepper currentStep={currentStep} onStepClick={setStep} stepErrors={stepValidationErrors} />+ <GuidedWizardStepper+ steps={SURVEY_WIZARD_STEPS}+ currentStep={currentStep}+ // 'template' sorts before the first step, 'success' marks every step completed+ unlistedStepPosition={currentStep === 'success' ? 'end' : 'start'}+ onStepClick={setStep}+ stepErrors={stepValidationErrors}+ aria-label="Survey wizard progress"+ /></div></div>)diff --git a/frontend/src/scenes/surveys/wizard/WizardLayout.tsx b/frontend/src/scenes/surveys/wizard/WizardLayout.tsxdeleted file mode 100644index 008be5f89805..000000000000--- a/frontend/src/scenes/surveys/wizard/WizardLayout.tsx+++ /dev/null@@ -1,97 +0,0 @@-import { ReactNode } from 'react'--import { cn } from 'lib/utils/css-classes'--interface WizardStepLayoutProps {- children: ReactNode- className?: string-}--export function WizardStepLayout({ children, className }: WizardStepLayoutProps): JSX.Element {- return <div className={cn('space-y-5', className)}>{children}</div>-}--interface WizardSectionProps {- title: ReactNode- description?: ReactNode- children?: ReactNode- className?: string- headerClassName?: string- contentClassName?: string- titleClassName?: string- descriptionClassName?: string- badge?: ReactNode- actions?: ReactNode-}--export function WizardSection({- title,- description,- children,- className,- headerClassName,- contentClassName,- titleClassName,- descriptionClassName,- badge,- actions,-}: WizardSectionProps): JSX.Element {- return (- <section className={cn('space-y-3', className)}>- <div className={cn('space-y-1', headerClassName)}>- <div className="flex items-center justify-between gap-4">- <div className="flex min-w-0 items-center gap-2">- <h2 className={cn('m-0 text-xl font-semibold', titleClassName)}>{title}</h2>- {badge}- </div>- {actions}- </div>- {description ? <p className={cn('m-0 text-secondary', descriptionClassName)}>{description}</p> : null}- </div>- {children ? <div className={contentClassName}>{children}</div> : null}- </section>- )-}--interface WizardPanelProps {- children: ReactNode- className?: string-}--export function WizardPanel({ children, className }: WizardPanelProps): JSX.Element {- return <div className={cn('rounded-lg border border-border bg-surface-primary p-3', className)}>{children}</div>-}--interface WizardDividerSectionProps {- title?: ReactNode- description?: ReactNode- children: ReactNode- className?: string- contentClassName?: string- titleClassName?: string- descriptionClassName?: string-}--export function WizardDividerSection({- title,- description,- children,- className,- contentClassName,- titleClassName,- descriptionClassName,-}: WizardDividerSectionProps): JSX.Element {- return (- <section className={cn('border-t border-border pt-5', className)}>- {(title || description) && (- <div className="space-y-1">- {title ? <h2 className={cn('m-0 text-xl font-semibold', titleClassName)}>{title}</h2> : null}- {description ? (- <p className={cn('m-0 text-secondary', descriptionClassName)}>{description}</p>- ) : null}- </div>- )}- <div className={cn(title || description ? 'mt-4' : undefined, contentClassName)}>{children}</div>- </section>- )-}diff --git a/frontend/src/scenes/surveys/wizard/steps/AppearanceStep.tsx b/frontend/src/scenes/surveys/wizard/steps/AppearanceStep.tsxindex 4e8102ffe04e..bebb722b1ed3 100644--- a/frontend/src/scenes/surveys/wizard/steps/AppearanceStep.tsx+++ b/frontend/src/scenes/surveys/wizard/steps/AppearanceStep.tsx@@ -6,6 +6,7 @@ import { useState } from 'react'import { IconChevronLeft, IconChevronRight } from '@posthog/icons'import { LemonButton, LemonCheckbox, LemonInput, LemonSelect, LemonSwitch } from '@posthog/lemon-ui'+import { GuidedWizardSection } from 'lib/components/GuidedWizard/GuidedWizardSection'import { PayGateMini } from 'lib/components/PayGateMini/PayGateMini'import { upgradeModalLogic } from 'lib/components/UpgradeModal/upgradeModalLogic'import { LemonCollapse } from 'lib/lemon-ui/LemonCollapse'@@ -33,7 +34,6 @@ import { surveyLogic } from '../../surveyLogic'import { surveysLogic } from '../../surveysLogic'import { ColorInput } from '../ColorInput'import { SurveyThemeSelector } from '../SurveyThemeSelector'-import { WizardSection } from '../WizardLayout'export function AppearanceStep(): JSX.Element {const { survey, hasBranchingLogic } = useValues(surveyLogic)@@ -78,7 +78,7 @@ export function AppearanceStep(): JSX.Element {<div className="grid grid-cols-1 gap-5 lg:grid-cols-3">{/* Left: Controls */}<div className="space-y-3.5 lg:col-span-2">- <WizardSection+ <GuidedWizardSectiontitle="How should it look?"description="Customize colors and styling. You can use CSS variables (e.g. var(--brand-color)) for dynamic theming."descriptionClassName="text-sm"@@ -99,7 +99,7 @@ export function AppearanceStep(): JSX.Element {/>{/* Color customization */}- <WizardSection title="Fine-tune colors" titleClassName="text-sm font-medium">+ <GuidedWizardSection title="Fine-tune colors" titleClassName="text-sm font-medium"><div className="grid grid-cols-2 gap-x-4 gap-y-2"><LemonField.Pure label="Background" className="gap-1"><ColorInput@@ -155,7 +155,7 @@ export function AppearanceStep(): JSX.Element {</>)}</div>- </WizardSection>+ </GuidedWizardSection>{/* Branding */}<LemonCheckbox@@ -173,7 +173,7 @@ export function AppearanceStep(): JSX.Element {/>{/* Question behavior */}- <WizardSection title="Behavior" titleClassName="text-sm font-medium">+ <GuidedWizardSection title="Behavior" titleClassName="text-sm font-medium"><SurveyBehaviorOptionssurvey={survey}onAppearanceChange={onAppearanceChange}@@ -181,7 +181,7 @@ export function AppearanceStep(): JSX.Element {deleteBranchingLogic={deleteBranchingLogic}onTranslationsChange={(translations) => setSurveyValue('translations', translations)}/>- </WizardSection>+ </GuidedWizardSection>{/* Advanced options */}<LemonCollapsediff --git a/frontend/src/scenes/surveys/wizard/steps/QuestionsStep.tsx b/frontend/src/scenes/surveys/wizard/steps/QuestionsStep.tsxindex 25bc3ad41176..64193bdfd1d1 100644--- a/frontend/src/scenes/surveys/wizard/steps/QuestionsStep.tsx+++ b/frontend/src/scenes/surveys/wizard/steps/QuestionsStep.tsx@@ -10,6 +10,8 @@ import { IconEmoji, IconPlusSmall, IconRevert, IconTrash } from '@posthog/icons'import { LemonButton, LemonCheckbox, LemonInput, LemonSegmentedButton, LemonSwitch, LemonTag } from '@posthog/lemon-ui'import { EditableField } from 'lib/components/EditableField/EditableField'+import { GuidedWizardSection } from 'lib/components/GuidedWizard/GuidedWizardSection'+import { GuidedWizardStepLayout } from 'lib/components/GuidedWizard/GuidedWizardStepLayout'import { FEATURE_FLAGS } from 'lib/constants'import { SortableDragIcon } from 'lib/lemon-ui/icons'import { featureFlagLogic as enabledFeaturesLogic } from 'lib/logic/featureFlagLogic'@@ -31,7 +33,6 @@ import { splitChoicesOnPaste } from '../../utils'import { AddQuestionButton } from '../AddQuestionButton'import { QuestionTypeChip } from '../QuestionTypeChip'import { surveyWizardLogic } from '../surveyWizardLogic'-import { WizardSection, WizardStepLayout } from '../WizardLayout'import { TranslationsSection } from './TranslationsSection'const MAX_CHOICES = 10@@ -583,8 +584,8 @@ export function QuestionsStep({ editingLanguage, setEditingLanguage }: Questionsconst activeQuestion = activeIndex !== null ? questions[activeIndex] : nullreturn (- <WizardStepLayout>- <WizardSection+ <GuidedWizardStepLayout>+ <GuidedWizardSectiontitle="Your survey questions"description="Click any question to edit it"descriptionClassName="text-sm"@@ -644,6 +645,6 @@ export function QuestionsStep({ editingLanguage, setEditingLanguage }: Questions{surveyTranslationsEnabled ? (<TranslationsSection editingLanguage={editingLanguage} setEditingLanguage={setEditingLanguage} />) : null}- </WizardStepLayout>+ </GuidedWizardStepLayout>)}diff --git a/frontend/src/scenes/surveys/wizard/steps/TranslationsSection.tsx b/frontend/src/scenes/surveys/wizard/steps/TranslationsSection.tsxindex d66dce0bd4b7..6b73710e8d71 100644--- a/frontend/src/scenes/surveys/wizard/steps/TranslationsSection.tsx+++ b/frontend/src/scenes/surveys/wizard/steps/TranslationsSection.tsx@@ -3,13 +3,15 @@ import { useActions, useValues } from 'kea'import { IconSparkles, IconTrash } from '@posthog/icons'import { LemonButton, LemonDialog, LemonInputSelect, LemonTag } from '@posthog/lemon-ui'+import { GuidedWizardPanel } from 'lib/components/GuidedWizard/GuidedWizardPanel'+import { GuidedWizardSection } from 'lib/components/GuidedWizard/GuidedWizardSection'+import { BaseLanguagePicker } from '../../BaseLanguagePicker'import { COMMON_LANGUAGES, getSurveyLanguageLabel, getSurveyLanguageName } from '../../language'import { LegacyTranslationKeysPanel } from '../../LegacyTranslationKeysPanel'import { surveyLogic } from '../../surveyLogic'import { SurveyTranslationFields } from '../../SurveyTranslationFields'import { useSurveyTranslationsForm } from '../../useSurveyTranslationsForm'-import { WizardPanel, WizardSection } from '../WizardLayout'function getLanguageLabel(language: string): string {return (@@ -47,8 +49,8 @@ export function TranslationsSection({ editingLanguage, setEditingLanguage }: Tra!!activeLanguage && aiGeneratedTranslationFields.some((path) => path.includes(`.${activeLanguage}.`))return (- <WizardSection title="Translations">- <WizardPanel className="space-y-4">+ <GuidedWizardSection title="Translations">+ <GuidedWizardPanel className="space-y-4"><div className="flex flex-wrap items-baseline gap-x-3 gap-y-1"><h4 className="m-0 text-sm font-semibold uppercase tracking-wide text-muted">Original language</h4><span className="text-sm">@@ -172,7 +174,7 @@ export function TranslationsSection({ editingLanguage, setEditingLanguage }: Tra<SurveyTranslationFields activeLanguage={activeLanguage} /></div>) : null}- </WizardPanel>- </WizardSection>+ </GuidedWizardPanel>+ </GuidedWizardSection>)}diff --git a/frontend/src/scenes/surveys/wizard/steps/WhenStep.tsx b/frontend/src/scenes/surveys/wizard/steps/WhenStep.tsxindex 1b59c8b23bd3..ef66a85846f9 100644--- a/frontend/src/scenes/surveys/wizard/steps/WhenStep.tsx+++ b/frontend/src/scenes/surveys/wizard/steps/WhenStep.tsx@@ -3,6 +3,9 @@ import { useActions, useValues } from 'kea'import { IconInfo, IconX } from '@posthog/icons'import { LemonButton, LemonCheckbox, LemonInput, LemonSegmentedButton, LemonSnack } from '@posthog/lemon-ui'+import { GuidedWizardPanel } from 'lib/components/GuidedWizard/GuidedWizardPanel'+import { GuidedWizardSection } from 'lib/components/GuidedWizard/GuidedWizardSection'+import { GuidedWizardStepLayout } from 'lib/components/GuidedWizard/GuidedWizardStepLayout'import { PropertyFilters } from 'lib/components/PropertyFilters/PropertyFilters'import { TaxonomicFilterGroupType } from 'lib/components/TaxonomicFilter/types'import { LemonRadio } from 'lib/lemon-ui/LemonRadio'@@ -27,7 +30,6 @@ import {} from '../../SurveyEventTrigger'import { surveyLogic } from '../../surveyLogic'import { surveyWizardLogic } from '../surveyWizardLogic'-import { WizardPanel, WizardSection, WizardStepLayout } from '../WizardLayout'const DEFAULT_ITERATION_COUNT = 10const MIN_ITERATION_COUNT = 2@@ -193,8 +195,8 @@ export function WhenStep(): JSX.Element {}return (- <WizardStepLayout>- <WizardSection+ <GuidedWizardStepLayout>+ <GuidedWizardSectiontitle="When should this appear?"description="Choose when to show this survey to your users"descriptionClassName="text-sm"@@ -227,7 +229,7 @@ export function WhenStep(): JSX.Element {const propertyFilterCount = getEventPropertyFilterCount(event.propertyFilters)return (- <WizardPanel key={event.name} className="bg-bg-light">+ <GuidedWizardPanel key={event.name} className="bg-bg-light"><div className="flex items-start justify-between gap-3 mb-3"><div className="space-y-1"><div className="flex flex-wrap items-center gap-2">@@ -267,7 +269,7 @@ export function WhenStep(): JSX.Element {Only primitive types are supported here. Array and object properties areexcluded.</div>- </WizardPanel>+ </GuidedWizardPanel>)})}</div>@@ -294,9 +296,9 @@ export function WhenStep(): JSX.Element {/><span className="text-secondary">seconds before showing it.</span></div>- </WizardSection>+ </GuidedWizardSection>- <WizardSection+ <GuidedWizardSectiontitle="How often should this survey show?"description="How many times this survey repeats, and how often. Repeats count from the launch date, so all users become eligible again at the same time."descriptionClassName="text-sm"@@ -379,7 +381,7 @@ export function WhenStep(): JSX.Element {/><span className="text-secondary">completed responses.</span></div>- </WizardSection>- </WizardStepLayout>+ </GuidedWizardSection>+ </GuidedWizardStepLayout>)}diff --git a/frontend/src/scenes/surveys/wizard/steps/WhereStep.tsx b/frontend/src/scenes/surveys/wizard/steps/WhereStep.tsxindex 5032559ca074..860afbd1f017 100644--- a/frontend/src/scenes/surveys/wizard/steps/WhereStep.tsx+++ b/frontend/src/scenes/surveys/wizard/steps/WhereStep.tsx@@ -6,6 +6,8 @@ import { IconTrash } from '@posthog/icons'import { LemonButton, LemonInputSelect, LemonSegmentedButton } from '@posthog/lemon-ui'import { FlagSelector } from 'lib/components/FlagSelector'+import { GuidedWizardSection } from 'lib/components/GuidedWizard/GuidedWizardSection'+import { GuidedWizardStepLayout } from 'lib/components/GuidedWizard/GuidedWizardStepLayout'import { ANY_VARIANT, variantOptions } from 'lib/components/IngestionControls/triggers/FlagTrigger/VariantSelector'import { LemonRadio } from 'lib/lemon-ui/LemonRadio'import { formatRE2Error } from 'lib/utils/regexp'@@ -17,7 +19,6 @@ import { PropertyDefinitionType, SurveyDisplayConditions, SurveyMatchType } fromimport { SurveyUrlAudienceEstimate } from '../../components/SurveyUrlAudienceEstimate'import { surveyLogic } from '../../surveyLogic'import { SurveyAudienceFilters } from '../SurveyAudienceFilters'-import { WizardSection, WizardStepLayout } from '../WizardLayout'const DEVICE_OPTIONS = ['Desktop', 'Mobile', 'Tablet']@@ -156,8 +157,11 @@ export function WhereStep({ onOpenFullEditor }: { onOpenFullEditor?: () => void}return (- <WizardStepLayout className="space-y-6">- <WizardSection title="Where should this appear?" description="Choose which pages will show this survey">+ <GuidedWizardStepLayout className="space-y-6">+ <GuidedWizardSection+ title="Where should this appear?"+ description="Choose which pages will show this survey"+ ><LemonRadiovalue={targetingMode}onChange={setTargetingMode}@@ -234,11 +238,11 @@ export function WhereStep({ onOpenFullEditor }: { onOpenFullEditor?: () => void)}</div>)}- </WizardSection>+ </GuidedWizardSection><SurveyAudienceFilters onOpenFullEditor={onOpenFullEditor} />- <WizardSection+ <GuidedWizardSectiontitle="Which devices should this appear on?"description="Choose whether this survey should show on desktop, mobile, tablet, or any combination.">@@ -261,9 +265,9 @@ export function WhereStep({ onOpenFullEditor }: { onOpenFullEditor?: () => void<p className="text-xs text-muted mt-1.5">Leave all unselected to show the survey on every device type.</p>- </WizardSection>+ </GuidedWizardSection>- <WizardSection+ <GuidedWizardSectiontitle="Feature flag targeting"description="Optionally limit this survey to users who have a specific feature flag enabled.">@@ -307,7 +311,7 @@ export function WhereStep({ onOpenFullEditor }: { onOpenFullEditor?: () => void</div>)}</div>- </WizardSection>- </WizardStepLayout>+ </GuidedWizardSection>+ </GuidedWizardStepLayout>)}