52 lines
1.5 KiB
TypeScript
52 lines
1.5 KiB
TypeScript
import { TransactionalScaffold } from "./shared.js";
|
|
import type { MailBrand } from "../_layout/theme.js";
|
|
|
|
/**
|
|
* Welcome transactional email — sent after account activation. Also
|
|
* doubles as the post-checkout "account-setup" variant via overridable
|
|
* subject/title/intro/actionLabel props (see EmailTemplates wrapper).
|
|
*/
|
|
export interface WelcomeEmailProps {
|
|
readonly brand: MailBrand;
|
|
readonly recipientName?: string;
|
|
readonly actionUrl: string;
|
|
readonly subject?: string;
|
|
readonly eyebrow?: string;
|
|
readonly title?: string;
|
|
readonly intro?: string;
|
|
readonly actionLabel?: string;
|
|
readonly unsubscribeUrl?: string;
|
|
readonly signoffThanks?: string;
|
|
}
|
|
|
|
export function WelcomeEmail({
|
|
brand,
|
|
recipientName,
|
|
actionUrl,
|
|
subject,
|
|
eyebrow,
|
|
title,
|
|
intro,
|
|
actionLabel,
|
|
unsubscribeUrl,
|
|
signoffThanks,
|
|
}: WelcomeEmailProps) {
|
|
const resolvedSubject =
|
|
subject ?? (recipientName ? `Welcome to ${brand.productName}, ${recipientName}!` : `Welcome to ${brand.productName}!`);
|
|
const resolvedTitle = title ?? (recipientName ? `Welcome, ${recipientName}!` : "Welcome!");
|
|
const resolvedIntro = intro ?? `Thanks for trying ${brand.productName}.`;
|
|
return (
|
|
<TransactionalScaffold
|
|
brand={brand}
|
|
subject={resolvedSubject}
|
|
eyebrow={eyebrow ?? "Welcome"}
|
|
title={resolvedTitle}
|
|
intro={resolvedIntro}
|
|
actionUrl={actionUrl}
|
|
actionLabel={actionLabel ?? "Click here to log in"}
|
|
unsubscribeUrl={unsubscribeUrl}
|
|
signoffThanks={signoffThanks}
|
|
/>
|
|
);
|
|
}
|