// Per-state action registry. Maps a lead's current_state_name → the single // primary activity available on it: button label, modal title/width, and the // body to render. Bespoke steps render a hand-built *Body; generic steps fall // back to driven by the live schema (meta carries the uid). import type { ComponentType } from 'react'; import type { ModalWidth } from '../core/Modal'; import { ACTIVITY_META, type ActivityMeta } from '../../api/forms'; import type { ActivityBodyProps } from './types'; import { AssignBody } from './AssignBody'; import { RecommendBody } from './RecommendBody'; import { DocumentsBody } from './DocumentsBody'; import { UnderwritingBody } from './UnderwritingBody'; import { IssuePolicyBody } from './IssuePolicyBody'; export interface ActivityStep { /** Row button + modal title copy. */ buttonLabel: string; title: string; width: ModalWidth; /** Bespoke body — when set, rendered instead of the generic ActivityForm. */ Body?: ComponentType; /** Generic path — fed to . Carries the activity uid. */ meta?: ActivityMeta; } /** The one primary action per lifecycle state. Absent state = no primary action. */ export const STEP_BY_STATE: Record = { 'New Lead': { buttonLabel: 'Qualify', title: 'Qualify Lead', width: 'md', meta: ACTIVITY_META.qualify }, Qualified: { buttonLabel: 'Assign', title: 'Assign Lead', width: 'lg', Body: AssignBody }, Assigned: { buttonLabel: 'Log Contact', title: 'Log First Contact', width: 'md', meta: ACTIVITY_META.contact }, Contacted: { buttonLabel: 'Schedule', title: 'Schedule Meeting', width: 'md', meta: ACTIVITY_META.schedule }, 'Meeting Scheduled': { buttonLabel: 'Recommend', title: 'Recommend Product', width: 'xl', Body: RecommendBody }, 'Product Recommended': { buttonLabel: 'Collect Docs', title: 'Collect Documents', width: 'xl', Body: DocumentsBody }, 'Documents Collected': { buttonLabel: 'Assess', title: 'Assess Eligibility', width: 'md', meta: ACTIVITY_META.assess }, 'Eligibility Assessed': { buttonLabel: 'Underwrite', title: 'Submit Underwriting', width: 'lg', Body: UnderwritingBody }, Underwriting: { buttonLabel: 'Issue Policy', title: 'Issue Policy', width: 'lg', Body: IssuePolicyBody }, 'Policy Issued': { buttonLabel: 'Onboard', title: 'Onboard Customer', width: 'md', meta: ACTIVITY_META.onboard }, }; /** Secondary action — Disqualify, valid from any non-terminal pre-issuance state. */ export const DISQUALIFY_STEP: ActivityStep = { buttonLabel: 'Disqualify', title: 'Disqualify Lead', width: 'md', meta: ACTIVITY_META.disqualify, }; /** INIT action — Add Lead (Capture), submitted via /start (no instance yet). */ export const CAPTURE_STEP: ActivityStep = { buttonLabel: 'Add Lead', title: 'Capture Lead', width: 'lg', meta: ACTIVITY_META.capture, };