import { TransactionalScaffold } from "./shared.js"; import { InfoBox } from "../_layout/InfoBox.js"; import type { MailBrand } from "../_layout/theme.js"; /** * InvoiceSentEmail — notifies a customer that a invoice PDF * has been issued. CTA points to the hosted-invoice URL so the user * can download the PDF without authenticating. */ export interface InvoiceSentEmailProps { readonly brand: MailBrand; readonly recipientName?: string; readonly invoiceNumber: string; readonly amountFormatted: string; readonly issueDate: string; readonly dueDate?: string; readonly actionUrl: string; readonly unsubscribeUrl?: string; readonly subject?: string; readonly eyebrow?: string; readonly titleText?: string; readonly intro?: string; readonly actionLabel?: string; readonly fieldLabels?: { readonly invoiceNumber?: string; readonly amount?: string; readonly issued?: string; readonly due?: string; }; readonly signoffThanks?: string; } export function InvoiceSentEmail({ brand, recipientName, invoiceNumber, amountFormatted, issueDate, dueDate, actionUrl, unsubscribeUrl, subject, eyebrow, titleText, intro, actionLabel, fieldLabels, signoffThanks, }: InvoiceSentEmailProps) { const resolvedSubject = subject ?? `Invoice ${invoiceNumber} from ${brand.productName}`; const resolvedTitle = titleText ?? (recipientName ? `Hello, ${recipientName}!` : "Your invoice is ready"); const resolvedIntro = intro ?? `Your invoice ${invoiceNumber} for ${amountFormatted} is now available.`; return ( {fieldLabels?.invoiceNumber ?? "Invoice number:"} {invoiceNumber}
{fieldLabels?.amount ?? "Amount:"} {amountFormatted}
{fieldLabels?.issued ?? "Issued:"} {issueDate} {dueDate ? ( <>
{fieldLabels?.due ?? "Due:"} {dueDate} ) : null}
); }