Merge branch "main"

This commit is contained in:
Mythie
2024-11-08 22:56:22 +11:00
parent 3ca5e47ed4
commit 80c0468df2
121 changed files with 5668 additions and 1393 deletions

View File

@ -1,5 +1,6 @@
import { I18nProvider } from '@lingui/react';
import type { RenderOptions } from '@documenso/email/render';
import { render } from '@documenso/email/render';
import { getI18nInstance } from '../client-only/providers/i18n.server';
@ -11,14 +12,13 @@ import {
export const renderEmailWithI18N = async (
component: React.ReactElement,
options?: {
plainText?: boolean;
options?: RenderOptions & {
// eslint-disable-next-line @typescript-eslint/ban-types
lang?: SupportedLanguageCodes | (string & {});
},
) => {
try {
const providedLang = options?.lang;
const { lang: providedLang, ...otherOptions } = options ?? {};
const lang = isValidLanguageCode(providedLang) ? providedLang : APP_I18N_OPTIONS.sourceLang;
@ -26,9 +26,7 @@ export const renderEmailWithI18N = async (
i18n.activate(lang);
return render(<I18nProvider i18n={i18n}>{component}</I18nProvider>, {
plainText: options?.plainText,
});
return render(<I18nProvider i18n={i18n}>{component}</I18nProvider>, otherOptions);
} catch (err) {
console.error(err);
throw new Error('Failed to render email');