/* ======================================================================== screen-assistant.jsx, Wonderful Assistant rep console (DARK) New model: Marcus is NOT on the call. Hala handles conversations autonomously and only escalates discrete actions for human approval. This screen is an APPROVAL QUEUE, not a live transcript. ======================================================================== */ const HOLD_INITIAL_SEC = 14 * 60 + 42; function fmtMmSs(totalSec) { const s = Math.max(0, Math.floor(totalSec || 0)); const mm = String(Math.floor(s / 60)).padStart(2, "0"); const ss = String(s % 60).padStart(2, "0"); return `${mm}:${ss}`; } function ScreenAssistant({ active }) { const turns = window.DEMO_SCRIPT.assistant; const lukas = window.DEMO_SCRIPT.passenger; const rep = window.DEMO_SCRIPT.rep; const ek = window.DEMO_SCRIPT.original_flight; const opt = window.DEMO_SCRIPT.options[0]; // EK203 const { shown, typing } = window.useChatPlayback(turns, { sceneActive: active, paused: false, speed: 1.0, }); // Approval is HUMAN-DRIVEN. The script delivers the card; the click drives the rest. const seen = new Set(shown.map(t => t.who)); const cardArrived = seen.has("approval-card-arrive"); const [approved, setApproved] = useState(false); const [completed, setCompleted] = useState(false); const [holdRemainingSec, setHoldRemainingSec] = useState(HOLD_INITIAL_SEC); // Reset on scene change so re-entering the scene shows the unapproved card. useEffect(() => { if (!active) { setApproved(false); setCompleted(false); setHoldRemainingSec(HOLD_INITIAL_SEC); } }, [active]); // Seat hold countdown: starts when the approval card is on-screen; stops on Approve or at 00:00. useEffect(() => { if (!active || !cardArrived || approved) return; const id = setInterval(() => { setHoldRemainingSec((prev) => (prev <= 1 ? 0 : prev - 1)); }, 1000); return () => clearInterval(id); }, [active, cardArrived, approved]); // After approve click, run the downstream actions tick. useEffect(() => { if (!approved) return; const t = setTimeout(() => setCompleted(true), 1400); return () => clearTimeout(t); }, [approved]); const decided = approved; const approvedFire = approved; const holdExpired = !approved && holdRemainingSec <= 0; const badgeIsNeutral = (!holdExpired && !approved) || approved || completed; const badgeLabel = completed ? "Seat locked · committed" : approved ? "Committing rebook…" : holdExpired ? "Hold expired" : "Seat held · awaiting commit"; return (
Emirates · Disruption Desk
Powered by Wonderful
Cases
Approvals
Knowledge
Reports
Queue · 3 pending Case #EK-DSPT-89412
{rep.name}
{/* ============== LEFT COLUMN, CUSTOMER DNA ============== */}
Customer Skywards Silver
{lukas.name}/
{lukas.name}
Skywards Silver · since {lukas.member_since}
{lukas.bookings}
Bookings
{lukas.ltv}
Lifetime value
9/10
NPS · Mar
DXB JFK 6 trips · top route
Identity
Email {lukas.email}
PNR {lukas.pnr}
Languages {lukas.languages}
Travel profile
Last 12mo {lukas.bookings_recent} bookings · DXB-JFK heavy
Meal Vegetarian · long-haul
Seat 23A · window · forward cabin
Booking · Today
Cancelled {window.DEMO_DATES.TODAY}
{ek.depart}
{ek.from}
{ek.code}
cancelled
{ek.arrive || "19:55"}
{ek.to}
Rebooking confirming now
{opt.depart_time}
{opt.from}
{opt.id}
14h 15m · direct
{opt.arrive_time}+1
{opt.to}
Seat 23A · window VGML meal Arrives {opt.arrive_date} {opt.arrive_time}
From the chat 14 turns
What Lukas told Hala
  • Why this trip Sister's wedding · Brooklyn · 11:00 tomorrow. Lukas is giving the speech, needs rest before.
  • Preference Keep seat 23A, direct flight, vegetarian meal.
  • How it closed Calm and sorted on the call. Expects confirmation across all three channels.
{/* ============== MIDDLE, APPROVAL QUEUE ============== */}
Approvals queue
Rebook commit · Lukas Weber
Voice agent · Hala · Rebook request · review & commit · SLA 60s · {decided ? "closed in 9s" : "awaiting review"}
Now Lukas Weber · commit rebook
+12s A. Bah · partner-airline reroute
+34s M. Khan · refund > AED 8k
Hala · voice agent
Submitted for review · case EK-DSPT-89412
{badgeLabel}
Conversation summary

Lukas Weber (Skywards Silver, PNR {lukas.pnr}) was on EK202 to JFK, cancelled this morning due to a thunderstorm. He's flying to his sister's wedding in Brooklyn at 11:00 tomorrow, he's giving the speech. Hala walked him through options on chat then voice, answered his policy questions on entitlements and disruption coverage, and Lukas confirmed EK203 direct tonight at 22:40. Seat 23A is on a 15-minute hold. He's expecting your sign-off.

What Hala did on the call
Verified identity · answered policy questions · held seat 23A
Quoted cancellation policy (free same-cabin rebook) and disruption coverage (hotel/meal vouchers if EK203 also cancels). Seat 23A on a 15-minute soft hold in ResConnect.
Hala-only actions
What needs your approval
Commit rebook EK202 → EK203 & confirm to Lukas across channels
One click: writes the booking change in ResConnect, locks seat 23A + VGML meal, sends email + SMS + WhatsApp confirmations to Lukas, closes the case in Genesys.
Hala cannot commit · needs human sign-off
Hold expires {!approved ? ( <> {fmtMmSs(holdRemainingSec)} {holdRemainingSec > 0 ? " remaining on seat 23A" : " · hold expired on seat 23A"} ) : completed ? ( <>Seat 23A locked in ResConnect ) : ( <>Hold cleared · committing seat 23A… )}
Customer expects Push notification «under a minute»
Fare delta AED 0 · within disruption policy §4.2
{!decided && ( <> )} {decided && (
Approved by {rep.name}
{completed ? "Rebook committed · push sent to Lukas · case closed" : "Committing rebook · sending push…"}
)}
{/* ============== RIGHT, DECISION CONTEXT ============== */}
Decision context
Wonderful · grounded in policy + history
Everything below is sourced. Nothing here is a guess.
{/* COMPLIANCE CHECKLIST */}
Compliance check EK disruption · §4.2
Pre-flight checks before you commit
  • Identity PNR + email verified on call
  • Eligibility Cancelled by EK · free same-cabin rebook
  • Seat 23A {!approved ? (holdRemainingSec > 0 ? <>On hold · expires in {fmtMmSs(holdRemainingSec)} : <>Hold expired · seat not guaranteed without commit) : completed ? <>Locked · seat 23A confirmed : <>Committing lock on seat 23A…} {!approved && holdRemainingSec <= 0 ? "!" : "✓"}
  • Fare delta AED 0 · no out-of-policy charge
  • Customer consent "Go ahead and lock it in" · 01:08
{/* POLICY Q&A, what Hala answered on the call, grounded */}
Policy answers Knowledge base · cited live
Lukas's two questions, Hala's grounded answers
"Will I lose my fare, miles, or seat?"
No. Free same-cabin rebook · miles preserved · seat & meal carry across.
Source · EK disruption policy §4.2 · involuntary rerouting
"If EK203 also cancels, am I covered?"
Yes. Hotel + meal vouchers if cancelled >4h from departure · auto-reaccommodate next service.
Source · EK disruption policy §6.1 · duty of care
{/* CUSTOMER HISTORY */}
Customer Skywards · DXB-JFK
Lukas Weber · in good standing
Skywards Silver since {lukas.member_since}, {lukas.bookings_recent} segments in the last 12mo, NPS 9/10 in March. Lifetime value {lukas.ltv}. No open complaints, no fraud flags.
{/* IF APPROVED */}
{approvedFire && ( Genesys )} {approvedFire ? "executing" : "on approval"} {approvedFire ? "committed by " + rep.name : "fires the moment you approve"}
Downstream actions
1
ResConnect · commit rebook EK202 → EK203
Locks seat 23A · VGML meal · Skywards miles preserved
{approvedFire ? "✓" : "·"}
2
Confirmation across email · SMS · WhatsApp
EK203 · 22:40 DXB → 04:55 JFK · seat 23A · sent the moment you commit
{approvedFire ? "✓" : "·"}
3
Genesys · case marked resolved
Outcome: rebooked, no compensation, audit log written
{approvedFire ? "✓" : "·"}
Genesys flow #DSPT-rebook-v3 audit log
{/* GUARDRAIL */}
🛡 Guardrail policy · live
Why this came to you
Hala can verify identity, answer policy questions, hold seats, set meals, and apologise on her own. She cannot commit rebooks, send confirmations, or close cases without a human sign-off. You drive every booking write.
); } window.ScreenAssistant = ScreenAssistant;