// DemoChat.jsx — auto-looping demo: assistente IA (ConstructHub). // O utilizador pergunta pelas faturas em atraso; o assistente responde com // dados reais e oferece uma ação — enviar lembretes — que o cursor executa. (function () { const STR = { pt: { windowTitle: 'Assistente ConstructHub', badgeLocal: 'Privado por padrão', question: 'Que faturas estão em atraso?', answerPre: 'Tem ', answerStrong: '2 faturas em atraso', answerMid: ', num total de ', answerPost: ':', btnRemind: 'Enviar lembretes', btnBilling: 'Ver faturação', remindedOk: 'Lembretes enviados aos 2 clientes', placeholder: 'Pergunte ao assistente…', toast: '2 lembretes enviados por email', invoices: [ { num: 'FT 2026/0061', client: 'Construções Santa Cruz', value: '€ 4.980,00', days: '12 dias' }, { num: 'FT 2026/0044', client: 'Obras do Mar', value: '€ 2.450,00', days: '5 dias' }, ], }, en: { windowTitle: 'ConstructHub Assistant', badgeLocal: 'Private by default', question: 'Which invoices are overdue?', answerPre: 'You have ', answerStrong: '2 overdue invoices', answerMid: ', totaling ', answerPost: ':', btnRemind: 'Send reminders', btnBilling: 'View invoicing', remindedOk: 'Reminders sent to 2 clients', placeholder: 'Ask the assistant…', toast: '2 reminders sent by email', invoices: [ { num: 'FT 2026/0061', client: 'Construções Santa Cruz', value: '€ 4.980,00', days: '12 days' }, { num: 'FT 2026/0044', client: 'Obras do Mar', value: '€ 2.450,00', days: '5 days' }, ], }, es: { windowTitle: 'Asistente ConstructHub', badgeLocal: 'Privado por defecto', question: '¿Qué facturas están vencidas?', answerPre: 'Tiene ', answerStrong: '2 facturas vencidas', answerMid: ', por un total de ', answerPost: ':', btnRemind: 'Enviar recordatorios', btnBilling: 'Ver facturación', remindedOk: 'Recordatorios enviados a los 2 clientes', placeholder: 'Pregunte al asistente…', toast: '2 recordatorios enviados por correo', invoices: [ { num: 'FT 2026/0061', client: 'Construções Santa Cruz', value: '€ 4.980,00', days: '12 días' }, { num: 'FT 2026/0044', client: 'Obras do Mar', value: '€ 2.450,00', days: '5 días' }, ], }, }; function DemoChat() { const lang = (window.__DEMO_LANG === 'en' || window.__DEMO_LANG === 'es') ? window.__DEMO_LANG : 'pt'; const s = STR[lang]; const D = 10500; const t = window.useDemoLoop(D, 9000); const { dkTyped, dkCursor } = window; const { DemoCaret, DemoCursor, DemoToast, MiniWindow, DemoStage } = window; const question = s.question; const typedQ = dkTyped(question, t, 600, 2400); const typing = t >= 600 && t < 2400; const sent = t >= 3000; const thinking = t >= 3200 && t < 4400; const answer = t >= 4400; const rowOn = [t >= 5000, t >= 5400]; const chips = t >= 6000; const reminded = t >= 7300; const toast = t >= 7800 && t < 10200; const cur = dkCursor(t, [ { at: 0, x: 540, y: 390, hidden: true }, { at: 2000, x: 540, y: 390 }, { at: 2200, x: 482, y: 328 }, { at: 5800, x: 122, y: 240 }, { at: 8200, x: 540, y: 390, hidden: true }, ], [2800, 7100]); return ( {s.badgeLocal} }>
{sent && (
{question}
)} {thinking && (
)} {answer && (
{s.answerPre}{s.answerStrong}{s.answerMid}€ 7.430,00{s.answerPost}
{s.invoices.map((f, i) => (
{f.num} {f.client} {f.value} {f.days}
))}
{chips && !reminded && (
)} {reminded && (
{s.remindedOk}
)}
)}
{!sent && typedQ} {!sent && !typedQ && !typing && {s.placeholder}} {sent && {s.placeholder}}
); } window.DemoChat = DemoChat; })();