UNPKG

@tmlmobilidade/emails

Version:
38 lines (37 loc) 2.93 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; /* * */ import { Anchor } from '../components/Anchor/index.js'; import { DebugCode } from '../components/DebugCode/index.js'; import { Greeting } from '../components/Greeting/index.js'; import { MainButton } from '../components/MainButton/index.js'; import { Paragraph } from '../components/Paragraph/index.js'; import { Span } from '../components/Span/index.js'; import { Wrapper } from '../components/Wrapper/index.js'; import { emailProvider } from '../email.provider.js'; import { render } from 'react-email'; /* * */ export const sucessfulGtfsValidationSubject = 'Validação GTFS realizada com sucesso'; /* * */ export default function SucessfulGtfsValidationTemplate({ firstName, gtfsValidationId, gtfsValidationUrl, totalWarnings = 0 }) { return (_jsxs(Wrapper, { previewMessage: "Valida\u00E7\u00E3o GTFS realizada com sucesso", children: [_jsx(Greeting, { text: `${firstName},` }), _jsx(Paragraph, { bold: true, color: "success", children: "N\u00E3o foram encontrados erros no GTFS que enviaste para valida\u00E7\u00E3o." }), totalWarnings === 1 && (_jsxs(Paragraph, { children: ["No entanto, foi encontrado", _jsxs(Span, { color: "warning", spaceAfter: true, spaceBefore: true, weight: "bold", children: [totalWarnings, ' ', "aviso"] }), "que deve ser corrigido o mais breve poss\u00EDvel, pois pode passar a ser considerado erro formal no futuro."] })), totalWarnings > 1 && (_jsxs(Paragraph, { children: ["No entanto, foram encontrados", _jsxs(Span, { color: "warning", spaceAfter: true, spaceBefore: true, weight: "bold", children: [totalWarnings, ' ', "avisos"] }), "que devem ser corrigidos o mais breve poss\u00EDvel, pois podem passar a ser considerados erros formais no futuro."] })), _jsxs(Paragraph, { children: ["Se tiveres d\u00FAvidas sobre alguma regra", _jsx(Anchor, { href: "https://go.tmlmobilidade.pt/reference", spaceAfter: true, spaceBefore: true, text: "explora a documenta\u00E7\u00E3o" }), "ou entra em contacto connosco."] }), _jsx(Paragraph, { children: "A valida\u00E7\u00E3o pode agora ser aprovada para plano." }), _jsx(MainButton, { href: gtfsValidationUrl, label: "Ver resumo da valida\u00E7\u00E3o" }), _jsx(DebugCode, { label: "GTFS Validation ID", value: gtfsValidationId })] })); } ; /* * */ SucessfulGtfsValidationTemplate.PreviewProps = { firstName: 'Josué', gtfsValidationId: 'TUH16N', gtfsValidationUrl: 'https://go.tmlmobilidade.pt/gtfs-validations/TUH16N', totalWarnings: 0, }; /* * */ export const renderSucessfulGtfsValidationTemplate = async (props) => { return await render(_jsx(SucessfulGtfsValidationTemplate, { ...props })); }; /* * */ export const sendSucessfulGtfsValidationEmail = async ({ data, to }) => { await emailProvider.send({ html: await renderSucessfulGtfsValidationTemplate(data), subject: sucessfulGtfsValidationSubject, to: to, }); };