"use client" import type { FlowChallenge } from "@/lib/auth/flow-api" export type StageRendererProps = { challenge: FlowChallenge | null values: Record fieldErrors: Record submitting: boolean onChange: (key: string, value: string) => void onSubmit: (payload: Record) => void | Promise } export type StageRenderer = React.ComponentType export function readPrimaryAction(challenge: FlowChallenge | null): string { const action = challenge?.primary_action return typeof action === "string" && action.trim() ? action : "Continuer" } export function isKnownFlowComponent(component: string): boolean { return component in FLOW_STAGE_REGISTRY || LEGACY_KNOWN_COMPONENTS.has(component) } const LEGACY_KNOWN_COMPONENTS = new Set([ "ak-stage-prompt", "ak-stage-identification", "ak-stage-email", "ak-stage-authenticator-validate", "ak-stage-password", "ak-stage-user-login", "ak-stage-authenticator-webauthn", "ak-stage-source", "ak-stage-captcha", "xak-flow-redirect", "xak-flow-frame", "ak-stage-access-denied", ]) /** Registry for Phase 3 stages. */ export const FLOW_STAGE_REGISTRY: Record = {}