mirror of
https://dev.azure.com/globalhealthx/EMR/_git/helix-engage-server
synced 2026-04-12 02:18:18 +00:00
feat: widget chat with generative UI, branch selection, captcha gate, lead dedup
- Streaming AI chat via Vercel AI SDK v6 UI message stream — tool-based
generative UI (pick_branch, list_departments, show_clinic_timings,
show_doctors, show_doctor_slots, suggest_booking). Typing indicator,
markdown suppressed, text parts hidden when widgets are rendered.
- Centralized Preact store (store.tsx) for visitor, leadId, captchaToken,
bookingPrefill, doctors roster, branches, selectedBranch — replaces prop
drilling across chat/book/contact tabs.
- Cloudflare Turnstile captcha gate rendered via light-DOM portal so it
renders correctly inside the shadow DOM (Turnstile CSS doesn't cross
shadow boundaries).
- Lead dedup helper (findOrCreateLeadByPhone, 24h phone window) shared
across chat-start / book / contact so one visitor == one lead. Booking
upgrades existing lead status NEW → APPOINTMENT_SET via updateLeadStatus.
- Pre-chat name+phone form captures the visitor; chat transcript logged
to leadActivity records after each stream.
- Booking wizard gains a branch step 0 (skipped for single-branch
hospitals); departments + doctors filtered by selectedBranch. Chat slot
picks prefill the booking details step and lock the branch.
- Window-level captcha gate, modal maximize mode, header badge showing
selected branch, widget font inherits from host page (fix :host { all:
initial } override).
- 23 FA Pro 7.1 duotone icons bundled — medical departments, nav, actions,
hospital/location-dot for branch context.
- main.ts: resolve public/ from process.cwd() so widget.js serves in both
dev and prod. tsconfig: exclude widget-src/public/data from server tsc.
- captcha.guard: switch from reCAPTCHA v3 to Cloudflare Turnstile verify.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
15
widget-src/src/icon-span.tsx
Normal file
15
widget-src/src/icon-span.tsx
Normal file
@@ -0,0 +1,15 @@
|
||||
import { icon, type IconName } from './icons';
|
||||
|
||||
type IconSpanProps = {
|
||||
name: IconName;
|
||||
size?: number;
|
||||
color?: string;
|
||||
class?: string;
|
||||
};
|
||||
|
||||
// Safe: the SVG strings in icons.ts are hard-coded FontAwesome Pro paths bundled at
|
||||
// compile time. No user input flows through here — nothing to sanitize.
|
||||
export const IconSpan = ({ name, size = 16, color = 'currentColor', class: className }: IconSpanProps) => {
|
||||
const html = icon(name, size, color);
|
||||
return <span class={className} dangerouslySetInnerHTML={{ __html: html }} />;
|
||||
};
|
||||
Reference in New Issue
Block a user