import { Body, Button, Column, Container, Head, Heading, Hr, Html, Img, Link, Preview, Row, Section, Tailwind, Text, render, } from '@react-email/components'; 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 = render( {previewText} {heading} {hello} {props.teamLogo && (
)}
{t(`${namespace}:copyPasteLink`)}{' '} {props.link}
{t(`${namespace}:invitationIntendedFor`, { invitedUserEmail: props.invitedUserEmail, })}
, ); return { html, subject, }; }