Commit Graph

78 Commits

Author SHA1 Message Date
5ccfa9bca8 refactor: patients page icon-only actions, remove Patients from CC agent nav
- Replace text buttons with icon-only (eye, SMS, WhatsApp, call)
- Remove Patients tab from CC agent sidebar (CC works with leads, not patients)
- Fix icon wrapper prop forwarding cleanup

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 12:24:54 +05:30
631acf63dc fix: pass data-icon prop through FontAwesome icon wrappers
Replaced all bare `FC<{ className?: string }>` and `FC<HTMLAttributes<...>>`
wrappers that only forwarded `className` with `faIcon()` from
`src/lib/icon-wrapper.ts`, ensuring props like `data-icon` needed by the
Button component's CSS selector `*:data-icon:size-5` are correctly forwarded.
Also widened `NavItemBaseProps.icon` and `NavItemType.icon` prop types to
`FC<Record<string, any>>` to stay compatible with `faIcon()` return type.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-21 11:19:46 +05:30
2ace6efae5 refactor: clean up duplicate imports from icon migration
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 11:09:17 +05:30
6f40b82579 refactor: migrate all icons from Untitled UI to FontAwesome Pro Duotone
Replace all @untitledui/icons imports across 55 files with equivalent
@fortawesome/pro-duotone-svg-icons icons, using FontAwesomeIcon wrappers
(FC<{ className?: string }>) for prop-based usage and inline replacements
for direct JSX usage. Drops unsupported Untitled UI-specific props
(strokeWidth, numeric size). TypeScript compiles clean with no errors.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-21 11:07:19 +05:30
3064eeb444 feat: CC agent features, live call assist, worklist redesign, brand tokens
CC Agent:
- Call transfer (CONFERENCE + KICK_CALL) with inline transfer dialog
- Recording pause/resume during active calls
- Missed calls API (Ozonetel abandonCalls)
- Call history API (Ozonetel fetchCDRDetails)

Live Call Assist:
- Deepgram Nova STT via raw WebSocket
- OpenAI suggestions every 10s with lead context
- LiveTranscript component in sidebar during calls
- Browser audio capture from remote WebRTC stream

Worklist:
- Redesigned table: clickable phones, context menu (Call/SMS/WhatsApp)
- Last interaction sub-line, source column, improved SLA
- Filtered out rows without phone numbers
- New missed call notifications

Brand:
- Logo on login page
- Blue scale rebuilt from logo blue rgb(32, 96, 160)
- FontAwesome duotone CSS variables set globally
- Profile menu icons switched to duotone

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 10:36:10 +05:30
99bca1e008 feat: telephony overhaul + appointment availability + Force Ready
Telephony:
- Track UCID from SIP headers and ManualDial response
- Submit disposition to Ozonetel via Set Disposition API (ends ACW)
- Fix outboundPending flag lifecycle to prevent inbound poisoning
- Fix render order: post-call UI takes priority over active state
- Pre-select disposition when appointment booked during call

Appointment form:
- Convert from slideout to inline collapsible below call card
- Fetch real doctors from platform, filter by department
- Show time slot availability grid (booked slots greyed + strikethrough)
- Double-check availability before booking
- Support edit and cancel existing appointments

UI:
- Add Force Ready button to profile menu (logout+login to clear ACW)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 20:24:58 +05:30
f13decefc4 chore: remove SIP caller ID debug logging
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 18:39:37 +05:30
5d3b564356 fix: reset outboundPending on call end to prevent inbound poisoning
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 18:39:33 +05:30
3a5bbc3f2a feat: send disposition to sidecar with UCID for Ozonetel ACW release
- Store UCID from outbound dial API response in sipCallUcidAtom
- Replace direct createCall GraphQL mutation with sidecar /api/ozonetel/dispose
- Remove agent-ready call from handleReset (no longer needed)
- Clear UCID on dial error and call reset

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 18:38:19 +05:30
d6ef2b70d8 feat: track UCID from SIP headers for Ozonetel disposition
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 18:33:46 +05:30
e7c5c13e83 feat: switch outbound to direct SIP call from browser
Instead of Kookoo outbound → IVR → dial back to SIP (broken bridge),
make the call directly from JsSIP in the browser. The SIP INVITE goes
through Ozonetel's SIP server to the PSTN. No intermediary needed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 06:52:24 +05:30
d25207e49e docs: update next session — Kookoo dial to SIP extension is the blocker
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 06:40:25 +05:30
f454f2e682 fix: outbound call — End Call label, force active state after auto-answer
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 21:33:40 +05:30
26b9d93f32 feat: outbound call UI — immediate call card, auto-answer SIP bridge
- ClickToCallButton sets callState='ringing-out' immediately on click
- ActiveCallCard shows "Calling..." state for outbound
- SIP manager auto-answers incoming SIP when outbound is pending (Kookoo bridge)
- CallPrepCard shows lead context while dialing
- On error, resets state cleanly

Flow: Click Call → UI shows call card → Kookoo dials customer →
customer answers → SIP bridges → auto-answer → active call → disposition

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 21:29:26 +05:30
1d395a8c36 docs: next session plan — outbound call UI, caching, remaining polish
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 21:24:00 +05:30
dd3b049253 fix: add isRowHeader to all tables — fixes React error #520 in production
All Table.Head components need at least one isRowHeader prop set.
Fixed in: worklist, agent-table, settings, patients, call-history, agent-detail.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 21:09:56 +05:30
a88cbecfbf fix: unused notes param in disposition handler
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 18:07:24 +05:30
edd2aa689d feat: post-call workflow — disposition, appointment booking, follow-up creation
ActiveCallCard now handles the full post-call flow:
- Call ends → Disposition form appears (6 options + notes)
- "Appointment Booked" → Opens appointment booking slideout
- "Follow-up Needed" → Auto-creates follow-up in platform
- Other dispositions → Logs call and returns to worklist
- "Book Appt" button available during active call too
- Creates Call record in platform on disposition submit
- Removed auto-reset to idle (ActiveCallCard manages lifecycle)
- "Back to Worklist" resets SIP state via Jotai atoms

Also fixes:
- All 7 GraphQL queries corrected (LINKS subfields, field renames)
- Campaign edit button moved to bottom-right
- Avg Response Time uses Math.abs for seed data edge case

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 17:24:46 +05:30
f341433c8f fix: all 7 GraphQL queries — correct field names and LINKS/PHONES subfields
Leads: landingPage → { primaryLinkUrl }, remove duplicateOfLeadId
Ads: adFormat → format, destinationUrl/previewUrl → { primaryLinkUrl }
FollowUps: remove non-existent callId field
LeadActivities: durationSeconds → durationSec
All transforms updated to match query changes

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 16:53:40 +05:30
941b51731f fix: cleanup unused imports, restore campaigns, fix settings pagination syntax
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 16:42:04 +05:30
567f9f2d72 feat: agent detail page, campaign edit slideout, integration config, auth persistence
Agent Detail (/agent/:id):
- Individual agent performance page with KPI cards + call log table
- Clickable agent names in dashboard table link to detail view
- Back button to Team Dashboard

Campaign Edit Slideout:
- Edit button on each campaign card
- Slideout with name, status, budget, dates
- Saves via updateCampaign GraphQL mutation

Integration Config Slideout:
- Configure button on each integration card
- Per-integration form fields (Ozonetel, WhatsApp, Facebook, etc.)
- Copy webhook URL, OAuth placeholder buttons

Auth Persistence:
- User data persisted to localStorage on login
- Session restored on page refresh — no more logout on F5
- Stale tokens cleaned up automatically

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 16:32:58 +05:30
bb004744f4 feat: polish all pages — tooltips, sticky headers, roles, search, AI prompts
Dashboard KPI:
- Fix 1534m → 25h 34m (formatMinutes helper)
- Add info icon tooltips on all KPI and metric cards
- Pass role="admin" to AI panel for manager-specific prompts

Settings:
- Add search + pagination to employee table
- Infer roles from email convention (platform roles API returns null via API key)

AI Assistant:
- Role-specific quick prompts: manager sees "Agent performance", "Missed risks"
- Agent sees "Doctor availability", "Treatment packages"

Sticky headers:
- Add overflow-hidden to campaigns and all-leads pages

Misc:
- Fix free-brands-svg-icons → pro-duotone in integrations
- Remove Follow-ups from CC agent sidebar
- Remove global search from TopBar

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 16:23:10 +05:30
c776782af6 fix: replace free-brands-svg-icons with pro-duotone in integrations page
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 16:03:14 +05:30
d9d98bce9c feat: dashboard restructure, integrations, settings, UI fixes
Dashboard:
- Split into components (kpi-cards, agent-table, missed-queue)
- Add collapsible AI panel on right (same pattern as Call Desk)
- Add tabs: Agent Performance | Missed Queue | Campaigns
- Date range filter in header

Integrations page:
- Ozonetel (connected), WhatsApp, Facebook, Google, Instagram, Website, Email
- Status badges, config details, webhook URL with copy button

Settings page:
- Employee table from workspaceMembers GraphQL query
- Name, email, roles, status, reset password action

Fixes:
- Fix CALLS_QUERY: callerNumber needs { primaryPhoneNumber }, recordingUrl → recording { primaryLinkUrl }
- Remove duplicate AI Assistant header
- Remove Follow-ups from CC agent sidebar (already in worklist tabs)
- Remove global search from TopBar (decorative, unused)
- Slim down TopBar height
- Fix search/table gap in worklist
- Add brand border to active nav item

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 15:58:31 +05:30
94f4a18035 fix: call desk layout — collapsible context panel, worklist/calls tabs, phone numbers
- Context panel now collapsible via toggle button (sidebar icon in status bar)
- Fixed width 400px when open, full-width worklist when closed
- Worklist and Today's Calls as separate tabs instead of stacked
- Fix missed calls callerNumber transform (PHONES composite → array)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 13:13:19 +05:30
cd9e7af688 fix: remove unused imports in reports + team-dashboard, deploy all data pages
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 12:30:14 +05:30
4c6cae9d65 feat: build all data pages — worklist table, call history, patients, dashboard, reports
Worklist (call-desk):
- Upgrade to Untitled UI Table with columns: Priority, Patient, Phone, Type, SLA, Actions
- Filter tabs: All Tasks / Missed Calls / Callbacks / Follow-ups with counts
- Search by name or phone
- SLA timer color-coded: green <15m, amber <30m, red >30m

Call History:
- Full table: Type (direction icon), Patient (matched from leads), Phone, Duration, Outcome, Agent, Recording (play/pause), Time
- Search + All/Inbound/Outbound/Missed filter
- Recording playback via native <audio>

Patients:
- New page with table: Patient (avatar+name+age), Contact, Type, Gender, Status, Actions
- Search + status filter
- Call + View Details actions
- Added patients to DataProvider + transforms + queries
- Route /patients added, sidebar nav updated for cc-agent + executive

Supervisor Dashboard:
- KPI cards: Total Calls, Inbound, Outbound, Missed
- Performance metrics: Avg Response Time, Callback Time, Conversion %
- Agent performance table with per-agent stats
- Missed Call Queue
- AI Assistant section
- Day/Week/Month filter

Reports:
- ECharts bar chart: Call Volume Trend (7-day, Inbound vs Outbound)
- ECharts donut chart: Call Outcomes (Booked, Follow-up, Info, Missed)
- KPI cards with trend indicators (+/-%)
- Route /reports, sidebar Analytics → /reports

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 12:26:13 +05:30
c3b1bfe18e feat: install table + echarts, webhook handler for call records
- Install Untitled UI table component
- Install Apache ECharts (echarts + echarts-for-react)
- Build webhook handler: POST /webhooks/ozonetel/missed-call
  - Parses Ozonetel call event payload
  - Creates Call record in platform
  - Matches caller to Lead by phone number
  - Creates LeadActivity on the lead
  - Updates lead contact timestamps
- Fix table component import paths (@/src/ → @/)
- Make seed scripts configurable for remote deployment

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 12:08:25 +05:30
44bd221108 feat: deploy to Hostinger VPS, switch to global_healthx Ozonetel account
- Add helix.svg and PNG favicon (generated via nano-banana)
- Update page title to "Helix Engage" with proper meta tags
- Make seed scripts configurable via SEED_GQL/SEED_ORIGIN env vars
- Support remote workspace member IDs in seed-data.ts
- Dynamic doctor-to-clinic linking in seed-new-entities.ts (fetch IDs from platform)
- Remove deprecated branchClinic field from seed data
- Fix TypeScript errors: callNotes null vs undefined, Lead type casting

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 10:27:25 +05:30
526ad18159 feat: call desk redesign — 2-panel layout, collapsible sidebar, inline AI, ringtone
- Collapsible sidebar with Jotai atom (icon-only mode, persisted to localStorage)
- 2-panel call desk: worklist (60%) + context panel (40%) with AI + Lead 360 tabs
- Inline AI call prep card — known lead summary or unknown caller script
- Active call card with compact Answer/Decline buttons
- Worklist panel with human-readable labels, priority badges, click-to-select
- Context panel auto-switches to Lead 360 when lead selected or call incoming
- Browser ringtone via Web Audio API on incoming calls
- Sonner + Untitled UI IconNotification for toast system
- apiClient pattern: centralized post/get/graphql with auto-toast on errors
- Remove duplicate avatar from top bar, hide floating widget on call desk
- Fix Link routing in collapsed sidebar (was using <a> causing full page reload)
- Fix GraphQL field names: adStatus→status, platformUrl needs subfield selection
- Silent mode for DataProvider queries to prevent toast spam

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 18:33:36 +05:30
61901eb8fb feat: wire frontend to platform data, migrate to Jotai + Vercel AI SDK
- Replace mock DataProvider with real GraphQL queries through sidecar
- Add queries.ts and transforms.ts for platform field name mapping
- Migrate SIP state from React Context to Jotai atoms (React 19 compat)
- Add singleton SIP manager to survive StrictMode remounts
- Remove hardcoded Olivia/Sienna accounts from nav menu
- Add password eye toggle, remember me checkbox, forgot password link
- Fix worklist hook to transform platform field names
- Add seed scripts for clinics, health packages, lab tests
- Update test harness for new doctor→clinic relation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 16:44:45 +05:30
e01a4d7747 feat: add AI flow test script — validates auth, lead lookup, patient, doctor, appointments, calls, activities as Rekha 2026-03-18 14:46:19 +05:30
f5c8766f68 feat: complete seeder — 5 doctors linked to workspace members, appointments linked to doctor entities, all agent names match real users 2026-03-18 14:34:58 +05:30
f9231ab126 feat: complete data seeder — 5 patient stories with linked campaigns, patients, leads, appointments, calls, activities, follow-ups 2026-03-18 12:42:43 +05:30
06fc842d98 feat: add platform data seeder with 5 patient stories — campaigns, leads, appointments, calls, activities, follow-ups 2026-03-18 12:35:12 +05:30
b72464a7ec feat: add AI assistant chat panel for call center agents
Wire a tabbed sidebar (Stats | AI Assistant) into the call desk page,
replacing the static DailyStats-only sidebar. The AI chat panel sends
queries to the sidecar POST /api/ai/chat endpoint and renders
responses in a chat-style UI with quick-ask buttons, caller context
banner, typing indicator, and basic markdown formatting.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 11:27:44 +05:30
bb48d07e61 feat: add worklist with missed calls, follow-ups, and leads sections 2026-03-18 11:26:16 +05:30
ffcaa79410 feat: add Patient 360 page, global search, appointment form — all using FontAwesome Pro duotone icons 2026-03-18 11:19:16 +05:30
937605c883 feat: add Patient 360 page and global search component
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 11:13:40 +05:30
9690ac416e feat: add appointment booking form slide-out during calls, wired to platform createAppointment mutation 2026-03-18 11:07:15 +05:30
66ad398b81 feat: wire real auth — login returns user profile with role from platform, remove mock users and role selector tabs 2026-03-18 10:42:54 +05:30
832fa31597 feat: wire call logging to platform — disposition creates Call record, updates Lead status, logs LeadActivity 2026-03-18 09:11:15 +05:30
d846d97377 refactor: remove demo mode — all auth goes through sidecar, call desk is live-only 2026-03-18 08:45:42 +05:30
125aeae41c fix: prevent duplicate SIP registration (module-level guard), extract real caller number from X-CALLERNO header 2026-03-18 08:33:45 +05:30
dfc4a0cd44 fix: move Ozonetel agent login to sidecar auth flow — frontend only handles SIP, sidecar handles REST login 2026-03-18 07:43:29 +05:30
4193b7545a feat: add API client, wire login page to sidecar auth with demo mode fallback 2026-03-18 07:22:19 +05:30
aff383cb6d fix: session reset after call end, add reject/decline for incoming calls, extract caller ID from SIP headers (P-Asserted-Identity, Remote-Party-ID) 2026-03-17 21:31:53 +05:30
36b3a5d34d feat: Ozonetel SIP integration — agent login, SIP registration, inbound call flow working
Known issues to fix:
- Must refresh page after each call (SIP session not resetting to idle properly)
- Decline/reject call not working
- Caller ID shows DID instead of original caller (Ozonetel IVR config issue with call:cid)
- Socket.IO reconnect noise in console (sidecar not running)
2026-03-17 21:20:32 +05:30
d54d54f5f3 fix: prevent StrictMode double-mount from killing SIP WebSocket connection 2026-03-17 20:08:22 +05:30
b2cc3d7012 feat: add floating call widget with SIP controls, click-to-call, and SIP provider
Introduce a shared SipProvider context so all components use the same SIP
connection. Add a floating CallWidget (idle pill, ringing, active with
disposition, ended states) visible for CC agents on every page. Add a
ClickToCallButton for the worklist. Wire SIP status badge and worklist
into the call-desk page.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 18:08:46 +05:30