import { ChatWidget } from "./ChatWidget"

export function ChatApp() {
  // Obter ticketId da URL
  const params = new URLSearchParams(window.location.search)
  const ticketId = params.get("ticketId")

  if (!ticketId) {
    return (
      <div className="flex h-screen flex-col items-center justify-center bg-white p-4">
        <p className="text-sm text-red-600">Erro: ticketId não fornecido</p>
      </div>
    )
  }

  return <ChatWidget ticketId={ticketId} />
}

export { ChatWidget }
export * from "./types"
