import { Body, Column, Head, Hr, Html, Img, Link, Preview, Row, Section, Tailwind, Text, render, } from '@react-email/components'; import { BodyStyle } from '../components/body-style'; import { EmailContent } from '../components/content'; import { CtaButton } from '../components/cta-button'; import { EmailFooter } from '../components/footer'; import { EmailHeader } from '../components/header'; import { EmailHeading } from '../components/heading'; import { EmailWrapper } from '../components/wrapper'; import { initializeEmailI18n } from '../lib/i18n'; interface Props { teamName: string; teamLogo?: string; inviter: string | undefined; invitedUserEmail: string; link: string; productName: string; language?: string; } export async function renderInviteEmail(props: Props) { const namespace = 'invite-email'; const { t } = await initializeEmailI18n({ language: props.language, namespace, }); const previewText = `Join ${props.invitedUserEmail} on ${props.productName}`; const subject = t(`${namespace}:subject`); const heading = t(`${namespace}:heading`, { teamName: props.teamName, productName: props.productName, }); const hello = t(`${namespace}:hello`, { invitedUserEmail: props.invitedUserEmail, }); const mainText = t(`${namespace}:mainText`, { inviter: props.inviter, teamName: props.teamName, productName: props.productName, }); const joinTeam = t(`${namespace}:joinTeam`, { teamName: props.teamName, }); const html = await render( {previewText} {heading} {hello} {props.teamLogo && (
)}
{joinTeam}
{t(`${namespace}:copyPasteLink`)}{' '} {props.link}
{t(`${namespace}:invitationIntendedFor`, { invitedUserEmail: props.invitedUserEmail, })}
{props.productName}
, ); return { html, subject, }; }