KO
베타 번역

@core / email

1.0.0 ▾
인증됨MIT
GitHub

타입이 지정된 React Email 템플릿의 트랜잭션 이메일: Resend, SMTP, 개발 시 콘솔

코드파일 9개컨텍스트약 544토큰검사 통과

.genpmignore 적용 후 주입될 정확한 트리입니다. 고정 대상:

src/lib/email/templates/receipt.ts읽기 전용 · 3e2976e
import { Heading, Section, Text } from '@react-email/components';
import { createElement as h } from 'react';
import { Layout, muted, text } from './layout.js';

export type ReceiptProps = {
  number: string;
  /** Importes en unidades menores (céntimos) para no perder precisión. */
  items: Array<{ description: string; amount: number }>;
  currency: string;
  date: Date;
};

const money = (minor: number, currency: string) =>
  new Intl.NumberFormat('en', { style: 'currency', currency }).format(minor / 100);

export const receipt = {
  subject: (p: ReceiptProps) => `Receipt ${p.number}`,
  render: (p: ReceiptProps) => {
    const total = p.items.reduce((n, i) => n + i.amount, 0);
    return h(
      Layout,
      { preview: `Receipt ${p.number} · ${money(total, p.currency)}` },
      h(Heading, { as: 'h1' }, `Receipt ${p.number}`),
      h(Text, { style: muted }, p.date.toISOString().slice(0, 10)),
      ...p.items.map((i) => h(Section, { key: i.description }, h(Text, { style: text }, `${i.description} — ${money(i.amount, p.currency)}`))),
      h(Text, { style: { ...text, fontWeight: 700 } }, `Total ${money(total, p.currency)}`),
    );
  },
};

@core/email 신고

패키지를 신고하려면 GitHub로 로그인하세요.