/* BeautyChatDemo — animowany agent AI rezerwacji 24/7 (motyw ciemny).
Odgrywa rozmowę o umówieniu wizyty, kończy kartą rezerwacji. Pętla. */
function BcSparkle() {
return (
);
}
// scenariusz rozmowy (1:1 ze zrzutu). type: user | bot | card
const BC_MESSAGES = [
{ from: "user", node: "Dzień dobry, chciałabym umówić się na modelowanie ust." },
{ from: "bot", think: 1600, node: "Dzień dobry! 💛 Jasne, pomogę z rezerwacją. Jaki termin Cię interesuje?" },
{ from: "user", node: "Najbliższy, najlepiej po południu." },
{ from: "bot", think: 1800, node: "Mam dostępne terminy: wtorek 17:00, środa 18:30, piątek 16:15. Który wybierasz?" },
{ from: "user", node: "Środa 18:30" },
{ from: "bot", think: 1500, node: "Super! Rezerwuję wizytę na środę 18:30. Kliknij poniżej, aby potwierdzić." },
{ from: "card", think: 1300 },
];
function BcCard() {
return (
Modelowanie ust
Środa, 10 czerwca 2026
godz. 18:30
Lume Clinic Warszawa
Potwierdź wizytę
);
}
function BeautyChatDemo() {
const reduceMotion = typeof window !== "undefined" &&
window.matchMedia && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
const [count, setCount] = React.useState(reduceMotion ? BC_MESSAGES.length : 0);
const [typing, setTyping] = React.useState(false);
const bodyRef = React.useRef(null);
React.useEffect(() => {
if (reduceMotion) return;
let cancelled = false;
const timers = [];
const wait = (ms) => new Promise((res) => timers.push(setTimeout(res, ms)));
async function run() {
while (!cancelled) {
setCount(0); setTyping(false);
await wait(900);
for (let i = 0; i < BC_MESSAGES.length && !cancelled; i++) {
const m = BC_MESSAGES[i];
if (m.from === "user") {
await wait(i === 0 ? 500 : 1100);
if (cancelled) break;
} else {
setTyping(true);
await wait(1500);
if (cancelled) break;
setTyping(false);
}
setCount(i + 1);
await wait(1700); // pauza na spokojne przeczytanie wiadomości (~3s/wiadomość)
if (cancelled) break;
}
await wait(4800); // pauza przed restartem
}
}
run();
return () => { cancelled = true; timers.forEach(clearTimeout); };
}, [reduceMotion]);
React.useEffect(() => {
const el = bodyRef.current;
if (el) el.scrollTop = el.scrollHeight;
}, [count, typing]);
const shown = BC_MESSAGES.slice(0, count);
return (
Asystent AI
Rezerwacja online 24/7
{shown.map((m, i) => {
if (m.from === "card") return
;
return (
{m.from === "bot" &&
}
{m.node}
);
})}
{typing && (
)}
Wersja demo — wysyłanie wiadomości wyłączone
);
}