diff --git a/src/api/config.js b/src/api/config.js index ede5219..9c62cb0 100644 --- a/src/api/config.js +++ b/src/api/config.js @@ -52,6 +52,11 @@ export const STAGES = [ // policy nobody paid for. It gets its own band on the overview so the role // that owns it does not have to find it in a list of things mostly handled // by somebody else. + // WHERE THE AI PUTS DOWN WHAT IT CANNOT HONESTLY FINISH. An AI employee has + // no way to raise a ticket and no way to send a message; the only move it + // has for "a person should take this" is Flag for Review, and it lands here + // with the reason it wrote. Nothing is running on these leads. + { uid: 'zk-state-review', name: 'Needs a Person', kind: 'needs', need: 'Flagged by the AI', by: 'operations' }, { uid: 'zk-state-payment', name: 'Payment Pending', kind: 'needs', need: 'Premium confirmation', by: 'operations', approval: 'ops_admin', approvalLabel: 'Premium awaiting your confirmation', approvalNote: 'Cover cannot start until the premium is received — section 64VB. Only operations can confirm it.' }, { uid: 'zk-state-issued', name: 'Policy Issued', kind: 'auto', doing: 'Closing the file', by: 'Engage AI' }, // Nurture. There is no scheduler yet, so Resume Outreach is a button and it @@ -160,6 +165,10 @@ const STATE_ACTIVITIES = { { uid: 'zk-act-uw-decline', label: 'Decline the risk', by: 'you', role: 'do' }, { uid: 'zk-act-uw-prepare', label: 'Prepare Referral', by: 'Referral AI', role: 'force' }, ], + 'zk-state-review': [ + { uid: 'zk-act-review-resume', label: 'Send back to the workflow', by: 'you', role: 'do' }, + { uid: 'zk-act-review-refer', label: 'Send to underwriting', by: 'you', role: 'do' }, + ], 'zk-state-payment': [ { uid: 'zk-act-realise', label: 'Confirm premium received', by: 'you', role: 'do' }, // Not offered: the chase is a SCHEDULED activity now (86), booked 24h diff --git a/src/screens/Lead.jsx b/src/screens/Lead.jsx index f42f71e..655ff00 100644 --- a/src/screens/Lead.jsx +++ b/src/screens/Lead.jsx @@ -45,8 +45,22 @@ const MONEY = new Set(['quoted_premium','quoted_od_premium','quoted_tp_premium', 'sme_burglary_si','sme_ee_si','sme_bi_gross_profit','sme_claims_36m_amount','sme_stock_si']) /** Field groups, in the order the lead was actually worked. */ +/* What the AI said stopped it, turned into a sentence an operator can act on. + Keyed by the stored value so an unknown one degrades to the generic line. */ +const BLOCKER = { + missing_evidence: 'It says the evidence it needed was not there.', + contradictory_data: 'It says the evidence it had contradicts itself.', + tool_failed: 'It says a lookup or a tool it depends on failed.', + outside_my_remit: 'It says the judgement is a person\u2019s to make, not its own.', + other: 'It could not complete its step.', +} + const GROUPS = [ ['Source', ['lead_ref','product_line','source_channel','partner_code','partner_branch','rm_or_agent_id','consent_artefact']], + // First, because when a lead is flagged this is the only thing anyone opens + // it to read. Empty on every lead that was never flagged, and an empty group + // does not render. + ['Flagged for review', ['review_blocker','review_reason','review_return','review_note']], ['Customer', ['customer_name','entity_name','mobile','email','pan','gstin','udyam_no']], ['Intake', ['lead_score','attribution_status','attribution_reason','dedupe_match_ref','eligibility_outcome','eligibility_reason']], ['Contact', ['contact_outcome','outreach_window','contact_notes','call_transcript']], @@ -430,6 +444,31 @@ export default function Lead() { ) : null} + ) : stage?.uid === 'zk-state-review' ? ( + /* THE AI PUT THIS DOWN. It could not finish its step honestly and said + so in the workflow, which is the only way it has of reaching a person. + Its own words lead, because deciding where the lead resumes is a + judgement made on them. */ +
“{row.review_reason}”
: null} ++ {BLOCKER[row.review_blocker] ?? 'It could not complete its step.'}{' '} + Nothing is running on this lead. Read the trail, fix what is missing, then send it + back to the workflow at the right step — or hand it to an underwriter. +
+