diff --git a/server/emails/mailer.tsx b/server/emails/mailer.tsx index 1c9186654..ab303792d 100644 --- a/server/emails/mailer.tsx +++ b/server/emails/mailer.tsx @@ -56,6 +56,64 @@ export class Mailer { } } + template = ({ + title, + bodyContent, + headCSS = "", + bgColor = "#FFFFFF", + lang, + dir = "ltr" /* https://www.w3.org/TR/html4/struct/dirlang.html#blocklevel-bidi */, + }: Oy.CustomTemplateRenderOptions) => { + if (!title) { + throw new Error("`title` is a required option for `renderTemplate`"); + } else if (!bodyContent) { + throw new Error( + "`bodyContent` is a required option for `renderTemplate`" + ); + } + + // the template below is a slightly modified form of https://github.com/revivek/oy/blob/master/src/utils/HTML4.js + return ` + + +
+ + + + +- +
diff --git a/server/emails/templates/CommentCreatedEmail.tsx b/server/emails/templates/CommentCreatedEmail.tsx index e7a0f99d8..2642fb847 100644 --- a/server/emails/templates/CommentCreatedEmail.tsx +++ b/server/emails/templates/CommentCreatedEmail.tsx @@ -147,17 +147,20 @@ Open Thread: ${teamUrl}${document.url}?commentId=${commentId} unsubscribeUrl, body, }: Props) { - const link = `${teamUrl}${document.url}?commentId=${commentId}&ref=notification-email`; + const threadLink = `${teamUrl}${document.url}?commentId=${commentId}&ref=notification-email`; return ( -{actorName} {isReply ? "replied to a thread in" : "commented on"}{" "} - {document.title}{" "} + {document.title}{" "} {collection.name ? `in the ${collection.name} collection` : ""}.
{body && ( @@ -170,7 +173,7 @@ Open Thread: ${teamUrl}${document.url}?commentId=${commentId} > )}- +
diff --git a/server/emails/templates/CommentMentionedEmail.tsx b/server/emails/templates/CommentMentionedEmail.tsx index 10b4ac1e5..526bef481 100644 --- a/server/emails/templates/CommentMentionedEmail.tsx +++ b/server/emails/templates/CommentMentionedEmail.tsx @@ -130,17 +130,20 @@ Open Thread: ${teamUrl}${document.url}?commentId=${commentId} unsubscribeUrl, body, }: Props) { - const link = `${teamUrl}${document.url}?commentId=${commentId}&ref=notification-email`; + const threadLink = `${teamUrl}${document.url}?commentId=${commentId}&ref=notification-email`; return ( -{actorName} mentioned you in a comment on{" "} - {document.title}{" "} + {document.title}{" "} {collection.name ? `in the ${collection.name} collection` : ""}.
{body && ( @@ -153,7 +156,7 @@ Open Thread: ${teamUrl}${document.url}?commentId=${commentId} > )}- +
diff --git a/server/emails/templates/ConfirmUserDeleteEmail.tsx b/server/emails/templates/ConfirmUserDeleteEmail.tsx index 6aa467227..9e38d40c5 100644 --- a/server/emails/templates/ConfirmUserDeleteEmail.tsx +++ b/server/emails/templates/ConfirmUserDeleteEmail.tsx @@ -38,7 +38,7 @@ Code: ${deleteConfirmationCode} protected render({ deleteConfirmationCode }: Props) { return ( -{actorName} mentioned you in the document{" "} - {document.title}. + {document.title}.
- +
{actorName} {eventName} the document{" "} - {document.title}, in the {collection.name}{" "} - collection. + {document.title}, in the{" "} + {collection.name} collection.
{body && ( <> @@ -170,7 +173,7 @@ Open Document: ${teamUrl}${document.url} > )}- +
diff --git a/server/emails/templates/ExportFailureEmail.tsx b/server/emails/templates/ExportFailureEmail.tsx index 037786f2b..0d011071f 100644 --- a/server/emails/templates/ExportFailureEmail.tsx +++ b/server/emails/templates/ExportFailureEmail.tsx @@ -55,25 +55,23 @@ section to try again – if the problem persists please contact support. } protected render({ teamUrl, unsubscribeUrl }: Props & BeforeSendProps) { + const exportLink = `${teamUrl}/settings/export`; + return ( -Sorry, your requested data export has failed, please visit the{" "} - + admin section . to try again – if the problem persists please contact support.
- +
diff --git a/server/emails/templates/ExportSuccessEmail.tsx b/server/emails/templates/ExportSuccessEmail.tsx index fbf7886f5..ccd543bcf 100644 --- a/server/emails/templates/ExportSuccessEmail.tsx +++ b/server/emails/templates/ExportSuccessEmail.tsx @@ -57,8 +57,13 @@ Your requested data export is complete, the exported files are also available in } protected render({ id, teamUrl, unsubscribeUrl }: Props & BeforeSendProps) { + const downloadLink = `${teamUrl}/api/fileOperations.redirect?id=${id}`; + return ( -- +
diff --git a/server/emails/templates/InviteAcceptedEmail.tsx b/server/emails/templates/InviteAcceptedEmail.tsx index 20b769cac..69c7287f2 100644 --- a/server/emails/templates/InviteAcceptedEmail.tsx +++ b/server/emails/templates/InviteAcceptedEmail.tsx @@ -60,7 +60,7 @@ Open ${env.APP_NAME}: ${teamUrl} unsubscribeUrl, }: Props & BeforeSendProps) { return ( -- +
diff --git a/server/emails/templates/InviteReminderEmail.tsx b/server/emails/templates/InviteReminderEmail.tsx index c509391b9..c01ccf7ee 100644 --- a/server/emails/templates/InviteReminderEmail.tsx +++ b/server/emails/templates/InviteReminderEmail.tsx @@ -52,8 +52,9 @@ If you haven't signed up yet, you can do so here: ${teamUrl} } protected render({ teamName, actorName, actorEmail, teamUrl }: Props) { + const inviteLink = `${teamUrl}?ref=invite-reminder-email`; return ( -If you haven't signed up yet, you can do so here:
- +
diff --git a/server/emails/templates/SigninEmail.tsx b/server/emails/templates/SigninEmail.tsx index 453e525ac..f3be4b8d2 100644 --- a/server/emails/templates/SigninEmail.tsx +++ b/server/emails/templates/SigninEmail.tsx @@ -46,7 +46,10 @@ signin page at: ${teamUrl} } return ( -- +
diff --git a/server/emails/templates/WelcomeEmail.tsx b/server/emails/templates/WelcomeEmail.tsx index d65d472a3..f8eb428c7 100644 --- a/server/emails/templates/WelcomeEmail.tsx +++ b/server/emails/templates/WelcomeEmail.tsx @@ -44,8 +44,10 @@ ${teamUrl}/home } protected render({ teamUrl }: Props) { + const welcomLink = `${teamUrl}/home?ref=welcome-email`; + return ( -- +
diff --git a/server/emails/templates/components/EmailLayout.tsx b/server/emails/templates/components/EmailLayout.tsx index ff3c68ba6..b72c2c041 100644 --- a/server/emails/templates/components/EmailLayout.tsx +++ b/server/emails/templates/components/EmailLayout.tsx @@ -2,15 +2,72 @@ import { Table, TBody, TR, TD } from "oy-vey"; import * as React from "react"; import theme from "@shared/styles/theme"; -const EmailLayout: React.FC = ({ children }) => ( -| {children} | -
+
+ {previewText}
+
+
|
+