: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
fix(replay-vision): papercuts and enable saving draft for wizard (#77363)
Hayne Ryu61994fa14297
diff --git a/frontend/src/scenes/onboarding/shared/utils.tsx b/frontend/src/scenes/onboarding/shared/utils.tsxindex d0627e9d79df..33d6487e7102 100644--- a/frontend/src/scenes/onboarding/shared/utils.tsx+++ b/frontend/src/scenes/onboarding/shared/utils.tsx@@ -14,6 +14,7 @@ import {IconDatabase,IconDecisionTree,IconDownload,+ IconEye,IconGear,IconGraph,IconLive,@@ -61,6 +62,7 @@ const ICON_MAP: Record<string, React.ComponentType<{ className?: string; color?:IconDatabase,IconDecisionTree,IconDownload,+ IconEye,IconGear,IconGraph,IconLive,diff --git a/products/replay_vision/frontend/replay_scanners/ScannerEditorScene.tsx b/products/replay_vision/frontend/replay_scanners/ScannerEditorScene.tsxindex 30b9a0681ba0..65e80b1c8a4d 100644--- a/products/replay_vision/frontend/replay_scanners/ScannerEditorScene.tsx+++ b/products/replay_vision/frontend/replay_scanners/ScannerEditorScene.tsx@@ -360,49 +360,60 @@ function EditorFooter({const stepIndex = visibleSteps.indexOf(step)const prevStep = stepIndex > 0 ? visibleSteps[stepIndex - 1] : nullconst nextStep = stepIndex < visibleSteps.length - 1 ? visibleSteps[stepIndex + 1] : null- // A broken duration filter (scans nothing) blocks the save — surface it as a disabled reason so the- // button explains itself instead of silently doing nothing. RBAC takes priority: it's the more- // fundamental blocker, and this must match the backend's create/update requirement exactly — a- // disabled-looking button that the backend would still accept (or vice versa) is a real bug here.- const saveDisabledReason = getReplayVisionEditDisabledReason(scanner?.user_access_level) ?? durationValidationError+ // A broken duration filter blocks the save, but only from the triggers step onward: gating an+ // earlier step's button on it blocks the wizard with a reason nothing on screen explains. RBAC+ // takes priority and must match the backend's create/update requirement exactly.+ const ownsDurationFilter = step === 'triggers' || step === 'self_driving'+ const durationError = ownsDurationFilter ? durationValidationError : null+ const saveDisabledReason = getReplayVisionEditDisabledReason(scanner?.user_access_level) ?? durationErrorreturn (- <div className="flex items-center justify-between">- {/* First form step of a new scanner goes back to the template picker; a mid-flow step goes to the- previous visible step; editing's first step (configure, no template) has no back. */}- {isNew && step === 'configure' ? (- <LemonButton type="tertiary" to={urls.replayVisionTemplates()} data-attr="vision-editor-back">- Back to templates- </LemonButton>- ) : prevStep ? (- <LemonButton type="tertiary" to={scannerStepUrl(prevStep, scannerId)} data-attr="vision-editor-back">- Back- </LemonButton>+ <div className="flex flex-col gap-2">+ {/* On self-driving the duration field isn't on screen, so a tooltip alone isn't enough. */}+ {step === 'self_driving' && durationError ? (+ <div className="text-danger text-sm">{durationError}</div>) : null}- {nextStep ? (- <LemonButton- type="primary"- loading={isSubmitting}- disabledReason={saveDisabledReason}- onClick={onAdvance}- className="ml-auto"- data-attr="vision-editor-next"- >- Next: {STEP_LABELS[nextStep]}- </LemonButton>- ) : (- <LemonButton- type="primary"- loading={isSubmitting}- disabledReason={saveDisabledReason}- onClick={onSave}- className="ml-auto"- data-attr="vision-editor-save"- data-ph-capture-attribute-scanner-type={scanner?.scanner_type}- >- {isNew ? 'Create scanner' : 'Save changes'}- </LemonButton>- )}+ <div className="flex items-center justify-between">+ {/* First form step of a new scanner goes back to the template picker; a mid-flow step goes to the+ previous visible step; editing's first step (configure, no template) has no back. */}+ {isNew && step === 'configure' ? (+ <LemonButton type="tertiary" to={urls.replayVisionTemplates()} data-attr="vision-editor-back">+ Back to templates+ </LemonButton>+ ) : prevStep ? (+ <LemonButton+ type="tertiary"+ to={scannerStepUrl(prevStep, scannerId)}+ data-attr="vision-editor-back"+ >+ Back+ </LemonButton>+ ) : null}+ {nextStep ? (+ <LemonButton+ type="primary"+ loading={isSubmitting}+ disabledReason={saveDisabledReason}+ onClick={onAdvance}+ className="ml-auto"+ data-attr="vision-editor-next"+ >+ Next: {STEP_LABELS[nextStep]}+ </LemonButton>+ ) : (+ <LemonButton+ type="primary"+ loading={isSubmitting}+ disabledReason={saveDisabledReason}+ onClick={onSave}+ className="ml-auto"+ data-attr="vision-editor-save"+ data-ph-capture-attribute-scanner-type={scanner?.scanner_type}+ >+ {isNew ? 'Create scanner' : 'Save changes'}+ </LemonButton>+ )}+ </div></div>)}diff --git a/products/replay_vision/frontend/replay_scanners/ScannerEditorStepper.tsx b/products/replay_vision/frontend/replay_scanners/ScannerEditorStepper.tsxindex dafffc26a576..1af9a785fada 100644--- a/products/replay_vision/frontend/replay_scanners/ScannerEditorStepper.tsx+++ b/products/replay_vision/frontend/replay_scanners/ScannerEditorStepper.tsx@@ -1,5 +1,6 @@import { IconCheckCircle, IconWarning } from '@posthog/icons'+import { Tooltip } from 'lib/lemon-ui/Tooltip'import { cn } from 'lib/utils/css-classes'import { SCANNER_EDITOR_STEP_ORDER, ScannerEditorStep } from './scannerEditorSceneLogic'@@ -41,7 +42,7 @@ export function ScannerEditorStepper({<divclassName={cn('w-6 h-px transition-colors duration-150',- hasErrors && isCurrent+ hasErrors? 'bg-warning': isCompleted || isCurrent? 'bg-success'@@ -60,8 +61,11 @@ export function ScannerEditorStepper({)}aria-current={isCurrent ? 'step' : undefined}>- {hasErrors && isCurrent ? (- <IconWarning className="size-5 text-warning" />+ {/* Errors outrank the completed checkmark. */}+ {hasErrors ? (+ <Tooltip title="This step has errors to fix">+ <IconWarning className="size-5 text-warning" />+ </Tooltip>) : isCompleted ? (<IconCheckCircle className="size-5 text-success" />) : (diff --git a/products/replay_vision/frontend/replay_scanners/replayScannerLogic.test.ts b/products/replay_vision/frontend/replay_scanners/replayScannerLogic.test.tsindex d2304b9c3caa..8b41925fb3c8 100644--- a/products/replay_vision/frontend/replay_scanners/replayScannerLogic.test.ts+++ b/products/replay_vision/frontend/replay_scanners/replayScannerLogic.test.ts@@ -1,6 +1,7 @@import { router } from 'kea-router'import { expectLogic } from 'kea-test-utils'+import { teamLogic } from 'scenes/teamLogic'import { urls } from 'scenes/urls'import { useMocks } from '~/mocks/jest'@@ -15,10 +16,16 @@ import {replayScannerLogic,shouldGuardScannerNavigation,} from './replayScannerLogic'+import { readScannerDraft } from './scannerDraft'+import { scannerEditorSceneLogic } from './scannerEditorSceneLogic'import { observationsDrilldownSearchParams } from './scannerOverviewLogic'import { defaultScannerTemplates } from './scannerTemplates'import { ClassifierScanner, ReplayScanner, ScorerScanner } from './types'+jest.mock('lib/forms/scrollToFormError', () => ({+ scrollToFormError: jest.fn(),+}))+describe('replayScannerLogic', () => {let logic: ReturnType<typeof replayScannerLogic.build>let observeSpy: jest.Mock@@ -48,13 +55,19 @@ describe('replayScannerLogic', () => {'/api/projects/:team/vision/scanners/suggest_tags/': suggestSpy,},})+ // The draft layer persists form edits to localStorage; without a reset, one test's edits+ // restore into the next test's freshly mounted wizard.+ localStorage.clear()initKeaTests()logic = replayScannerLogic({ id: 'new' })logic.mount()+ // The submit handler reads the wizard step from scannerEditorSceneLogic, so mount it too.+ scannerEditorSceneLogic.mount()})afterEach(() => {logic?.unmount()+ scannerEditorSceneLogic.unmount()})describe('form defaults', () => {@@ -247,6 +260,51 @@ describe('replayScannerLogic', () => {expect(createSpy).not.toHaveBeenCalled()expect(router.values.location.pathname).toContain('/replay-vision/new/triggers')})++ it('advances from the step the editor scene reports, even when the URL matches no step', async () => {+ router.actions.push('/replay-vision/new/not-a-step')+ scannerEditorSceneLogic.actions.setStep('configure')+ logic.actions.setScannerValues({ name: 'Test scanner', scanner_config: { prompt: 'Q?' } })+ logic.actions.setSubmitIntent('advance')+ await expectLogic(logic, () => logic.actions.submitScanner()).toFinishAllListeners()+ expect(router.values.location.pathname).toContain('/replay-vision/new/triggers')+ })++ it('routes a rejected submit to the step that renders the errored fields', async () => {+ // Defaults leave name and prompt empty, both configure-owned.+ router.actions.push('/replay-vision/new/triggers')+ logic.actions.setSubmitIntent('advance')+ await expectLogic(logic, () => logic.actions.submitScanner()).toFinishAllListeners()+ expect(createSpy).not.toHaveBeenCalled()+ expect(router.values.location.pathname).toContain('/replay-vision/new/configure')+ })+ })++ describe('new scanner draft', () => {+ beforeEach(() => {+ teamLogic.mount()+ })++ it('restores drafted values when the wizard remounts, keeping the unsaved-changes guard armed', async () => {+ logic.actions.setScannerValues({ name: 'Half done', scanner_config: { prompt: 'Find rage clicks' } })+ logic.unmount()+ logic = replayScannerLogic({ id: 'new' })+ logic.mount()+ await expectLogic(logic).toFinishAllListeners()+ expect(logic.values.scanner?.name).toBe('Half done')+ expect(logic.values.hasUnsavedChanges).toBe(true)+ })++ it.each([+ ['scannerSaved', () => logic.actions.scannerSaved(logic.values.scanner!)],+ ['resetScanner', () => logic.actions.resetScanner()],+ ])('clears the draft on %s', async (_label, act) => {+ const teamId = teamLogic.values.currentTeamId!+ logic.actions.setScannerValues({ name: 'Drafted' })+ expect(readScannerDraft(teamId)?.name).toBe('Drafted')+ act()+ expect(readScannerDraft(teamId)).toBeNull()+ })})describe('validation errors', () => {@@ -610,6 +668,7 @@ describe('replayScannerLogic', () => {const configure = urls.replayVisionScannerConfigure(scannerId)const triggers = urls.replayVisionScannerTriggers(scannerId)const template = urls.replayVisionScannerTemplate(scannerId)+ const selfDriving = urls.replayVisionScannerSelfDriving(scannerId)const detail = urls.replayVision(scannerId)const base = { hasUnsavedChanges: true, isSubmitting: false, scannerId, currentPathname: configure }@@ -631,6 +690,18 @@ describe('replayScannerLogic', () => {{ ...base, nextPathname: urls.replayVisionScannerConfigure('other-id') },true,],+ ['out from the self-driving step', { ...base, currentPathname: selfDriving, nextPathname: detail }, true],+ // The router stores pathnames with the `/project/:id` prefix; `urls.*` are unprefixed.+ [+ 'out to settings from a project-prefixed URL',+ { ...base, currentPathname: `/project/123${triggers}`, nextPathname: '/settings/environment' },+ true,+ ],+ [+ 'between steps with project-prefixed URLs',+ { ...base, currentPathname: `/project/123${configure}`, nextPathname: `/project/123${triggers}` },+ false,+ ],])('%s', (_label, params, expected) => {expect(shouldGuardScannerNavigation(params)).toBe(expected)})diff --git a/products/replay_vision/frontend/replay_scanners/replayScannerLogic.ts b/products/replay_vision/frontend/replay_scanners/replayScannerLogic.tsindex a01d6f1863f8..f24c9e31f0a8 100644--- a/products/replay_vision/frontend/replay_scanners/replayScannerLogic.ts+++ b/products/replay_vision/frontend/replay_scanners/replayScannerLogic.ts@@ -17,8 +17,10 @@ import { loaders } from 'kea-loaders'import { actionToUrl, beforeUnload, router, urlToAction } from 'kea-router'import { CombinedLocation } from 'kea-router/lib/utils'+import { scrollToFormError } from 'lib/forms/scrollToFormError'import { lemonToast } from 'lib/lemon-ui/LemonToast'import { copyToClipboard } from 'lib/utils/copyToClipboard'+import { removeProjectIdIfPresent } from 'lib/utils/kea-router'import { objectsEqual } from 'lib/utils/objects'import { recordingsQueryToUniversalFilters } from 'scenes/session-recordings/filters/recordingsQueryConversions'import { teamLogic } from 'scenes/teamLogic'@@ -51,7 +53,13 @@ import { refreshVisionQuota } from '../logics/visionQuotaLogic'import { observationClipboardText } from '../utils/observation'import { type UrlSorting, parseCsvParam, parseSortParam, serializeSortParam } from '../utils/urlParams'import { clampDurationFilter, durationFilterError } from './durationBounds'-import { SCANNER_EDITOR_STEPS, scannerEditorSceneLogic, scannerStepUrl } from './scannerEditorSceneLogic'+import { clearScannerDraft, readScannerDraft, writeScannerDraft } from './scannerDraft'+import {+ SCANNER_EDITOR_STEPS,+ firstErroredScannerStep,+ scannerEditorSceneLogic,+ scannerStepUrl,+} from './scannerEditorSceneLogic'import type { ObservationStatusStats } from './scannerStats'import { availableTagsFromStats, daysFromDateRange, deriveObservationStatusStats } from './scannerStats'import { findScannerTemplate, newScanner } from './scannerTemplates'@@ -658,14 +666,10 @@ export const replayScannerLogic = kea<replayScannerLogicType>([},submit: async (scanner: ReplayScanner) => {// Advance to the next visible step instead of persisting, when the footer asked to (intent- // 'advance') or a new scanner submitted mid-wizard via Enter on any non-final step. The step- // order and self-driving visibility live in the editor scene, so read visibleSteps from there;- // findMounted keeps this usable in isolation (tests), falling back to the full order.+ // 'advance') or a new scanner submitted mid-wizard via Enter on any non-final step.const steps = scannerEditorSceneLogic.findMounted()?.values.visibleSteps ?? SCANNER_EDITOR_STEPS- const currentStep = steps.find((step) =>- router.values.location.pathname.endsWith(scannerStepUrl(step, props.id))- )- const nextStep = currentStep ? steps[steps.indexOf(currentStep) + 1] : undefined+ const currentStep = scannerEditorSceneLogic.findMounted()?.values.step ?? 'configure'+ const nextStep = steps[steps.indexOf(currentStep) + 1]if (nextStep && (values.submitIntent === 'advance' || values.isNew)) {actions.setSubmitIntent('save')router.actions.push(scannerStepUrl(nextStep, props.id))@@ -1131,18 +1135,55 @@ export const replayScannerLogic = kea<replayScannerLogicType>([actions.loadObservations(background)actions.loadObservationStats()}+ const persistDraft = (): void => {+ if (props.id !== 'new') {+ return+ }+ const teamId = teamLogic.findMounted()?.values.currentTeamId+ if (!teamId || !values.scanner || !values.originalScanner) {+ return+ }+ if (objectsEqual(values.scanner, values.originalScanner)) {+ return+ }+ writeScannerDraft(teamId, values.scanner)+ }return {+ // kea-forms' exact rejection for failed client-side validation. API failures toast in submit's catch.+ submitScannerFailure: async ({ error }) => {+ if (error?.message !== 'Validation Failed') {+ return+ }+ const erroredStep = firstErroredScannerStep(values.scannerValidationErrors)+ const currentStep = scannerEditorSceneLogic.findMounted()?.values.step+ if (erroredStep && erroredStep !== currentStep) {+ router.actions.push(scannerStepUrl(erroredStep, props.id))+ }+ // Yield so the step change renders before scrollToFormError looks for `.Field--error`.+ await Promise.resolve()+ scrollToFormError({+ fallbackErrorMessage: 'Some scanner settings are invalid. Check each step for errors.',+ })+ },+loadScanner: async () => {if (props.id === 'new') {- const templateKey = currentTemplateKey()- if (templateKey && !findScannerTemplate(templateKey)) {- // Strip an unknown template key so the URL matches the from-scratch flow the user actually gets.+ const teamId = teamLogic.findMounted()?.values.currentTeamId+ const draft = teamId ? readScannerDraft(teamId) : null+ const urlTemplateKey = currentTemplateKey()+ // A draft outranks the template param (it carries its own type and config), and an+ // unknown template falls back to the from-scratch flow. Both present as custom, so+ // strip the param so the URL matches what the user actually gets.+ const templateKey =+ !draft && urlTemplateKey && findScannerTemplate(urlTemplateKey) ? urlTemplateKey : null+ if (urlTemplateKey && !templateKey) {const { template: _drop, ...rest } = router.values.searchParamsrouter.actions.replace(router.values.location.pathname, rest)- actions.loadScannerSuccess(newScanner(null))- return}actions.loadScannerSuccess(newScanner(templateKey))+ if (draft) {+ actions.setScannerValues(draft)+ }return}const teamId = teamLogic.values.currentTeamId@@ -1211,12 +1252,27 @@ export const replayScannerLogic = kea<replayScannerLogicType>([},// kea-forms fires setScannerValue(s) per field change — debounced so drags don't fire a request per tick.- setScannerValue: () => actions.requestScannerEstimate(),- setScannerValues: () => actions.requestScannerEstimate(),+ setScannerValue: () => {+ actions.requestScannerEstimate()+ persistDraft()+ },+ setScannerValues: () => {+ actions.requestScannerEstimate()+ persistDraft()+ },+ // resetScanner is every "start fresh" moment: template pick, type switch, discard on leave.+ resetScanner: () => {+ if (props.id === 'new') {+ clearScannerDraft()+ }+ },scannerSaved: () => {actions.requestScannerEstimate()// Saving recomputes the persisted estimate, which shifts the org-wide fleet sum.refreshVisionQuota()+ if (props.id === 'new') {+ clearScannerDraft()+ }},requestScannerEstimate: () => {@@ -1574,12 +1630,13 @@ const TABLE_URL_PARAM_KEYS = [/** Observation-filter params the scanner page reads from the URL; links into the Observations tab build from these keys. */export type ObservationsUrlParams = Partial<Record<(typeof TABLE_URL_PARAM_KEYS)[number], string>>-/** The three step URLs of a scanner's editor wizard. */+/** The step URLs of a scanner's editor wizard. */function scannerEditorPaths(scannerId: string): string[] {return [urls.replayVisionScannerTemplate(scannerId),urls.replayVisionScannerConfigure(scannerId),urls.replayVisionScannerTriggers(scannerId),+ urls.replayVisionScannerSelfDriving(scannerId),]}@@ -1600,11 +1657,13 @@ export function shouldGuardScannerNavigation(params: {if (!hasUnsavedChanges || isSubmitting) {return false}+ // The router's stored pathname carries the `/project/:id` prefix, while `urls.*` never do,+ // so both sides must be normalized before comparing or the guard never engages.const editorPaths = scannerEditorPaths(scannerId)- if (!editorPaths.includes(currentPathname)) {+ if (!editorPaths.includes(removeProjectIdIfPresent(currentPathname))) {return false}- if (nextPathname && editorPaths.includes(nextPathname)) {+ if (nextPathname && editorPaths.includes(removeProjectIdIfPresent(nextPathname))) {return false}return truediff --git a/products/replay_vision/frontend/replay_scanners/scannerDraft.test.ts b/products/replay_vision/frontend/replay_scanners/scannerDraft.test.tsnew file mode 100644index 000000000000..27a5973cc18c--- /dev/null+++ b/products/replay_vision/frontend/replay_scanners/scannerDraft.test.ts@@ -0,0 +1,30 @@+import { readScannerDraft, writeScannerDraft } from './scannerDraft'+import { newScanner } from './scannerTemplates'++const STORAGE_KEY = 'replay-vision.new-scanner-draft'++describe('scannerDraft', () => {+ beforeEach(() => {+ localStorage.clear()+ })++ it.each([+ ['returns the draft for the same team', 1, (draft: any) => draft, true],+ ['rejects a draft from another team', 2, (draft: any) => draft, false],+ [+ 'rejects a stale draft',+ 1,+ (draft: any) => ({ ...draft, savedAt: Date.now() - 8 * 24 * 60 * 60 * 1000 }),+ false,+ ],+ ['rejects a different schema version', 1, (draft: any) => ({ ...draft, version: 999 }), false],+ ['rejects unparseable storage', 1, () => 'not json', false],+ ])('%s', (_label, readTeamId, tamper, expectRestored) => {+ const scanner = { ...newScanner(null), name: 'Drafted scanner' }+ writeScannerDraft(1, scanner)+ const stored = JSON.parse(localStorage.getItem(STORAGE_KEY)!)+ const tampered = tamper(stored)+ localStorage.setItem(STORAGE_KEY, typeof tampered === 'string' ? tampered : JSON.stringify(tampered))+ expect(readScannerDraft(readTeamId)?.name ?? null).toBe(expectRestored ? 'Drafted scanner' : null)+ })+})diff --git a/products/replay_vision/frontend/replay_scanners/scannerDraft.ts b/products/replay_vision/frontend/replay_scanners/scannerDraft.tsnew file mode 100644index 000000000000..00175750f2ae--- /dev/null+++ b/products/replay_vision/frontend/replay_scanners/scannerDraft.ts@@ -0,0 +1,51 @@+import { ReplayScanner } from './types'++const DRAFT_STORAGE_KEY = 'replay-vision.new-scanner-draft'+const DRAFT_VERSION = 1+const DRAFT_MAX_AGE_MS = 7 * 24 * 60 * 60 * 1000++interface StoredScannerDraft {+ version: number+ teamId: number+ savedAt: number+ scanner: ReplayScanner+}++export function writeScannerDraft(teamId: number, scanner: ReplayScanner): void {+ const draft: StoredScannerDraft = { version: DRAFT_VERSION, teamId, savedAt: Date.now(), scanner }+ try {+ localStorage.setItem(DRAFT_STORAGE_KEY, JSON.stringify(draft))+ } catch {+ // Storage unavailable or full: losing the draft only means the wizard starts fresh.+ }+}++export function readScannerDraft(teamId: number): ReplayScanner | null {+ try {+ const raw = localStorage.getItem(DRAFT_STORAGE_KEY)+ if (!raw) {+ return null+ }+ const draft: StoredScannerDraft = JSON.parse(raw)+ if (+ draft.version !== DRAFT_VERSION ||+ draft.teamId !== teamId ||+ typeof draft.savedAt !== 'number' ||+ Date.now() - draft.savedAt > DRAFT_MAX_AGE_MS ||+ !draft.scanner+ ) {+ return null+ }+ return draft.scanner+ } catch {+ return null+ }+}++export function clearScannerDraft(): void {+ try {+ localStorage.removeItem(DRAFT_STORAGE_KEY)+ } catch {+ // Nothing to clean up if storage is unavailable.+ }+}diff --git a/products/replay_vision/frontend/replay_scanners/scannerEditorSceneLogic.ts b/products/replay_vision/frontend/replay_scanners/scannerEditorSceneLogic.tsindex 65bd8465d6c3..8e7ec61773db 100644--- a/products/replay_vision/frontend/replay_scanners/scannerEditorSceneLogic.ts+++ b/products/replay_vision/frontend/replay_scanners/scannerEditorSceneLogic.ts@@ -14,6 +14,21 @@ export const SCANNER_EDITOR_STEP_ORDER: Record<ScannerEditorStep, number> = {self_driving: 3,}+/** Earliest step rendering an errored form field; must match which step component mounts which fields. */+export function firstErroredScannerStep(errors: {+ name?: unknown+ scanner_config?: unknown+ sampling_rate?: unknown+}): ScannerEditorStep | null {+ if (errors.name || errors.scanner_config) {+ return 'configure'+ }+ if (errors.sampling_rate) {+ return 'triggers'+ }+ return null+}+export function scannerStepUrl(step: ScannerEditorStep, scannerId: string): string {switch (step) {case 'template':