From e2c4cc7ad2736028547837848a58e86f9b7e8eb3 Mon Sep 17 00:00:00 2001 From: Luke Vella Date: Wed, 17 Jan 2024 10:33:30 +0700 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Remove=20use=20of=20contex?= =?UTF-8?q?t=20from=20email=20package=20(#981)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web/src/utils/emails.ts | 1 + packages/emails/src/send-email.tsx | 16 ++++++++-------- .../src/templates/components/email-context.tsx | 16 +--------------- .../src/templates/components/email-layout.tsx | 6 ++++-- .../templates/components/notification-email.tsx | 7 +++++-- .../templates/components/styled-components.tsx | 6 +++--- packages/emails/src/templates/finalized-host.tsx | 5 ++++- .../src/templates/finalized-participant.tsx | 5 ++++- packages/emails/src/templates/login.tsx | 12 +++++++----- packages/emails/src/templates/new-comment.tsx | 2 ++ .../templates/new-participant-confirmation.tsx | 10 +++++++--- .../emails/src/templates/new-participant.tsx | 2 ++ packages/emails/src/templates/new-poll.tsx | 7 +++++-- packages/emails/src/templates/register.tsx | 8 ++++++-- 14 files changed, 59 insertions(+), 44 deletions(-) diff --git a/apps/web/src/utils/emails.ts b/apps/web/src/utils/emails.ts index 504043f7af6..ebed1f8f311 100644 --- a/apps/web/src/utils/emails.ts +++ b/apps/web/src/utils/emails.ts @@ -21,5 +21,6 @@ export const emailClient = new EmailClient({ context: { logoUrl: absoluteUrl("/logo.png"), baseUrl: absoluteUrl(""), + domain: absoluteUrl("").replace(/(^\w+:|^)\/\//, ""), }, }); diff --git a/packages/emails/src/send-email.tsx b/packages/emails/src/send-email.tsx index 5f8de65a847..510fd1eb1a9 100644 --- a/packages/emails/src/send-email.tsx +++ b/packages/emails/src/send-email.tsx @@ -13,8 +13,9 @@ type Templates = typeof templates; type TemplateName = keyof typeof templates; -type TemplateProps = React.ComponentProps< - TemplateComponent +type TemplateProps = Omit< + React.ComponentProps>, + "ctx" >; type TemplateComponent = Templates[T]; @@ -79,12 +80,11 @@ export class EmailClient { ) { const Template = templates[templateName] as TemplateComponent; const html = render( - -