feat: automações de tickets e testes de regressão

This commit is contained in:
esdrasrenan 2025-12-13 10:30:29 -03:00
parent 9f1a6a7401
commit 8ab510bfe9
18 changed files with 2221 additions and 20 deletions

View file

@ -2,6 +2,8 @@
import dynamic from "next/dynamic"
import { api } from "@/convex/_generated/api"
import { useAuth } from "@/lib/auth-client"
import { isAgentOrAdmin } from "@/lib/authz"
// Verifica se a API do liveChat existe
function checkLiveChatApiExists() {
@ -19,6 +21,11 @@ const ChatWidget = dynamic(
)
export function ChatWidgetProvider() {
const { role, isLoading } = useAuth()
if (isLoading) return null
if (!isAgentOrAdmin(role)) return null
// Nao renderiza se a API nao existir (Convex nao sincronizado)
if (!checkLiveChatApiExists()) {
return null