import React, { useState, useEffect, useRef } from 'react'; import { createRoot } from 'react-dom/client'; import { createClient } from '@supabase/supabase-js'; const appId = typeof __app_id !== 'undefined' ? __app_id : 'provistahub-assistant-v12'; const supabaseUrl = 'https://xbphycmjfnznmhykkgpc.supabase.co'; const supabaseAnonKey = 'sb_publishable_dngYToeCF-HF3PshcFl9Og_funVC0ph'; let supabase = null; try { supabase = createClient(supabaseUrl, supabaseAnonKey); } catch (e) {} const TENANT = { name: "ProVista Hub", primary: "#00ff88", secondary: "#05150a", logoUrl: "https://provistahub.com/favicon.ico", phone: "+91 8084843501", email: "support@provistahub.com", whatsapp: "918084843501" }; const Icons = { Brand: ({ className }) => (
Logo { e.target.src = `https://ui-avatars.com/api/?name=PV&background=000&color=00ff88`; }} />
), Send: () => , Back: () => , Mic: () => , Clip: () => , Trash: () => }; const Typewriter = ({ text, onComplete }) => { const [display, setDisplay] = useState(''); useEffect(() => { let i = 0; const interval = setInterval(() => { if (i < text.length) { setDisplay(text.substring(0, i + 3)); i += 3; } else { setDisplay(text); clearInterval(interval); if (onComplete) onComplete(); } }, 15); return () => clearInterval(interval); }, [text]); return
{display}_
; }; function App() { const [isOpen, setIsOpen] = useState(false); const [messages, setMessages] = useState([]); const [input, setInput] = useState(''); const scrollRef = useRef(null); const quickSuggestions = ["SYSTEM_STATUS", "PROTOCOLS", "PRICING_MATRIX", "ACCESS_SERVICES"]; useEffect(() => { if (isOpen && messages.length === 0) { resetChat(); } }, [isOpen]); useEffect(() => { scrollRef.current?.scrollIntoView({ behavior: "smooth" }); }, [messages]); const resetChat = () => { setMessages([{ role: 'ai', text: `> NEURAL LINK ESTABLISHED.\n> I am the Vista AI Core.\n> Ready to engineer your next success story. Input command...`, actions: ['EXPLORE_SERVICES', 'INITIATE_CONTACT'], typed: true }]); }; const handleSend = (text = input) => { if (!text.trim()) return; setMessages(prev => [...prev, { role: 'user', text, typed: true }]); setInput(''); setTimeout(() => { setMessages(prev => [...prev, { role: 'ai', text: "> COMMAND RECEIVED. Our human engineers will contact you shortly to execute the protocol.", typed: false }]); }, 1000); }; return (
{isOpen && (

Vista_Core //

{messages.map((msg, i) => (
{msg.role === 'ai' && !msg.typed ? setMessages(prev => prev.map((m, idx) => idx === i ? {...m, typed: true} : m))} /> :
{msg.text}
} {msg.actions?.map((a, idx) => )}
))}
{quickSuggestions.map((s, idx) => ( ))}
setInput(e.target.value)} onKeyPress={(e) => e.key === 'Enter' && handleSend()} placeholder="Input command..." className="w-full bg-[#05100a] border border-gray-700 rounded pl-3 pr-3 py-2.5 text-xs text-white font-mono outline-none focus:border-[#00ff88] transition-all" />
)}
); } const root = createRoot(document.getElementById('root')); root.render();