feat(MED-48): add synlab analysis package email

This commit is contained in:
2025-07-24 07:59:17 +03:00
parent 2db67b7f20
commit 8633ac4bce
9 changed files with 162 additions and 2 deletions

View File

@@ -0,0 +1,97 @@
import {
Body,
Head,
Html,
Preview,
Tailwind,
Text,
render,
} from '@react-email/components';
import { BodyStyle } from '../components/body-style';
import { EmailContent } from '../components/content';
import { EmailHeader } from '../components/header';
import { EmailHeading } from '../components/heading';
import { EmailWrapper } from '../components/wrapper';
import { initializeEmailI18n } from '../lib/i18n';
import CommonFooter from '../components/common-footer';
interface Props {
analysisPackageName: string;
language?: string;
personName: string;
partnerLocationName: string;
}
export async function renderSynlabAnalysisPackageEmail(props: Props) {
const namespace = 'synlab-email';
const { t } = await initializeEmailI18n({
language: props.language,
namespace: [namespace, 'common'],
});
const previewText = t(`${namespace}:previewText`);
const subject = t(`${namespace}:subject`);
const heading = t(`${namespace}:heading`, {
analysisPackageName: props.analysisPackageName,
});
const hello = t(`${namespace}:hello`, {
personName: props.personName,
});
const lines = [
t(`${namespace}:lines1`, {
analysisPackageName: props.analysisPackageName,
partnerLocationName: props.partnerLocationName,
}),
t(`${namespace}:lines2`),
t(`${namespace}:lines3`),
t(`${namespace}:lines4`),
t(`${namespace}:lines5`),
t(`${namespace}:lines6`),
];
const html = await render(
<Html>
<Head>
<BodyStyle />
</Head>
<Preview>{previewText}</Preview>
<Tailwind>
<Body>
<EmailWrapper>
<EmailHeader>
<EmailHeading>{heading}</EmailHeading>
</EmailHeader>
<EmailContent>
<Text className="text-[16px] leading-[24px] text-[#242424]">
{hello}
</Text>
{lines.map((line, index) => (
<Text
key={index}
className="text-[16px] leading-[24px] text-[#242424]"
dangerouslySetInnerHTML={{ __html: line }}
/>
))}
<CommonFooter t={t} />
</EmailContent>
</EmailWrapper>
</Body>
</Tailwind>
</Html>,
);
return {
html,
subject,
};
}