Ship 23 transactional templates, shared brand tokens/logo, preview UI, render API, CHANGELOG, and docs for Ecom/Admin/B2B consumers. Co-authored-by: Cursor <cursoragent@cursor.com>
47 lines
1.7 KiB
TypeScript
47 lines
1.7 KiB
TypeScript
import { Heading, Section, Text } from '@react-email/components';
|
|
import { EmailLayout } from './components/EmailLayout';
|
|
import { Button } from './components/Button';
|
|
import { StatusBanner } from './components/StatusBanner';
|
|
import { styles } from './components/styles';
|
|
import { tCommon } from './i18n/common';
|
|
import { tTemplate } from './i18n/templates';
|
|
import { resolveLocale, type Locale } from './i18n/types';
|
|
import { interpolate } from './utils/interpolate';
|
|
import { theme } from './theme';
|
|
|
|
export interface StatementReadyEmailProps {
|
|
locale?: Locale;
|
|
userName?: string;
|
|
orgName?: string;
|
|
periodLabel?: string;
|
|
amountDue?: string;
|
|
ctaUrl?: string;
|
|
}
|
|
|
|
export const StatementReadyEmail = ({
|
|
locale,
|
|
userName = 'Helen Tadesse',
|
|
orgName = 'Yaltopia Tech',
|
|
periodLabel = 'July 2026',
|
|
amountDue = 'ETB 184,200',
|
|
ctaUrl = `${theme.brand.website}/b2b/statements`,
|
|
}: StatementReadyEmailProps) => {
|
|
const l = resolveLocale(locale);
|
|
const t = tTemplate('statement-ready', l);
|
|
const common = tCommon(l);
|
|
return (
|
|
<EmailLayout preview={interpolate(t.preview, { periodLabel })} locale={l}>
|
|
<StatusBanner tone="info">{interpolate(t.banner, { amountDue })}</StatusBanner>
|
|
<Heading style={styles.heading}>{t.heading}</Heading>
|
|
<Text style={styles.text}>{interpolate(t.body1, { userName, orgName, periodLabel })}</Text>
|
|
<Section style={styles.buttonSection}>
|
|
<Button href={ctaUrl}>{t.cta}</Button>
|
|
</Section>
|
|
<Text style={styles.muted}>{common.regards}<br />{common.team}</Text>
|
|
</EmailLayout>
|
|
);
|
|
};
|
|
|
|
StatementReadyEmail.PreviewProps = { locale: 'en' } as StatementReadyEmailProps;
|
|
export default StatementReadyEmail;
|