feat(email): adota React Email em notificações e automações

This commit is contained in:
esdrasrenan 2025-12-13 13:11:41 -03:00
parent 58a1ed6b36
commit 4306b0504d
18 changed files with 940 additions and 337 deletions

View file

@ -0,0 +1,35 @@
export function getEmailAssetUrl(path: string) {
const normalizedPath = path.startsWith("/") ? path : `/${path}`
const baseUrl = process.env.NEXT_PUBLIC_APP_URL || process.env.APP_BASE_URL || ""
if (baseUrl) return `${baseUrl}${normalizedPath}`
return `/static${normalizedPath}`
}
export function formatStatus(statusRaw: string) {
const status = statusRaw.trim().toUpperCase()
const labels: Record<string, string> = {
PENDING: "Pendente",
AWAITING_ATTENDANCE: "Em andamento",
PAUSED: "Pausado",
RESOLVED: "Resolvido",
}
return labels[status] ?? statusRaw
}
export function formatPriority(priorityRaw: string) {
const priority = priorityRaw.trim().toUpperCase()
const labels: Record<string, string> = {
LOW: "Baixa",
MEDIUM: "Média",
HIGH: "Alta",
URGENT: "Urgente",
}
return labels[priority] ?? priorityRaw
}
export function normalizeTextToParagraphs(text: string): string[] {
const trimmed = text.replace(/\r\n/g, "\n").trim()
if (!trimmed) return []
return trimmed.split(/\n{2,}/g).map((p) => p.trim()).filter(Boolean)
}