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

@ -4,7 +4,8 @@ import tls from "tls"
import { action } from "./_generated/server"
import { v } from "convex/values"
import { buildBaseUrl, renderSimpleNotificationEmail } from "./emailTemplates"
import { renderSimpleNotificationEmailHtml } from "./reactEmail"
import { buildBaseUrl } from "./url"
function b64(input: string) {
return Buffer.from(input, "utf8").toString("base64")
@ -99,7 +100,7 @@ export const sendPublicCommentEmail = action({
const baseUrl = buildBaseUrl()
const url = `${baseUrl}/portal/tickets/${ticketId}`
const mailSubject = `Atualização no chamado #${reference}: ${subject}`
const html = renderSimpleNotificationEmail({
const html = await renderSimpleNotificationEmailHtml({
title: `Nova atualização no seu chamado #${reference}`,
message: `Um novo comentário foi adicionado ao chamado “${subject}”. Clique abaixo para visualizar e responder pelo portal.`,
ctaLabel: "Abrir e responder",
@ -126,7 +127,7 @@ export const sendResolvedEmail = action({
const baseUrl = buildBaseUrl()
const url = `${baseUrl}/portal/tickets/${ticketId}`
const mailSubject = `Seu chamado #${reference} foi encerrado`
const html = renderSimpleNotificationEmail({
const html = await renderSimpleNotificationEmailHtml({
title: `Chamado #${reference} encerrado`,
message: `O chamado “${subject}” foi marcado como concluído. Caso necessário, você pode responder pelo portal para reabrir dentro do prazo.`,
ctaLabel: "Ver detalhes",