diff --git a/src/api/config.js b/src/api/config.js index e97c960..49bd7b2 100644 --- a/src/api/config.js +++ b/src/api/config.js @@ -375,6 +375,26 @@ export function fieldApplies(fieldId, lead) { */ export function phaseOf(stage, lead) { if (!stage || !lead) return stage + + // Quote Presented has the same shape as Document Pending: the state holds + // still while the situation underneath it changes completely. + // + // Before the customer answers, the lead is genuinely with them and nothing + // is running. After they accept, KYC and the underwriting screen run inside + // the SAME state — the lead does not move until underwriting clears — so a + // page saying "waiting for the customer to reply" sat directly above a panel + // saying "accepted by the customer, KYC and underwriting are running". Both + // were rendered from the same instant; only one was true. + if (stage.uid === 'zk-state-quoted' && lead.acceptance_ref && !lead.uw_outcome) { + return { + ...stage, + kind: 'auto', + doing: lead.kyc_outcome ? 'Screening the risk for underwriting' : 'Verifying KYC', + by: 'KYC & Evidence', + after: 'customer accepted', + } + } + if (stage.uid === 'zk-state-docs' && lead.documents_status === 'complete') { return { ...stage, @@ -476,6 +496,15 @@ export function nudgeFor(stage, lead) { return null } + case 'zk-state-quoted': { + // Only after an acceptance — before that nothing is running and there is + // nothing to wake; the lead is with the customer. + if (!lead.acceptance_ref) return null + if (!lead.kyc_outcome) return { uid: 'zk-act-kyc', label: 'Run KYC again', by: 'KYC & Evidence' } + if (!lead.uw_outcome) return { uid: 'zk-act-uw-screen', label: 'Run the underwriting screen', by: 'KYC & Evidence' } + return null + } + case 'zk-state-issued': return { uid: 'zk-act-onboard', label: 'Close the file', by: 'Engage' } diff --git a/src/screens/Lead.jsx b/src/screens/Lead.jsx index 56cce39..30fa34c 100644 --- a/src/screens/Lead.jsx +++ b/src/screens/Lead.jsx @@ -536,7 +536,10 @@ export default function Lead() { : blocked ? 'The chain has stopped. The fix is above.' : accepted && stage?.uid === 'zk-state-quoted' - ? `Accepted by the customer${row.accepted_at ? ' on ' + row.accepted_at : ''}${row.acceptance_ref === 'whatsapp' ? ', over WhatsApp' : ''}. KYC and underwriting are running.` + /* What is RUNNING is the strip's job now, so this + records only the fact — otherwise the two lines + said the same thing twice, one above the other. */ + ? `Accepted by the customer${row.accepted_at ? ' on ' + row.accepted_at : ''}${row.acceptance_ref === 'whatsapp' ? ', over WhatsApp' : ''}. Nothing is waiting on you.` : `Nothing is waiting on you — ${stage?.by ?? 'someone else'} has this one.`}