From 590344f7933ac3ac8903ef6103060c08b2130a51 Mon Sep 17 00:00:00 2001
From: Ephraim Atta-Duncan
Date: Mon, 19 Jun 2023 21:33:04 +0000
Subject: [PATCH] feat(template): add initial signing invite email template
---
packages/lib/mail/template.tsx | 115 ++++++++++++++++++
packages/lib/package.json | 9 +-
.../lib/server-only/document/send-document.ts | 6 +-
3 files changed, 124 insertions(+), 6 deletions(-)
create mode 100644 packages/lib/mail/template.tsx
diff --git a/packages/lib/mail/template.tsx b/packages/lib/mail/template.tsx
new file mode 100644
index 000000000..837f75aaf
--- /dev/null
+++ b/packages/lib/mail/template.tsx
@@ -0,0 +1,115 @@
+import * as React from 'react';
+
+import {
+ Body,
+ Button,
+ Container,
+ Head,
+ Heading,
+ Html,
+ Img,
+ Link,
+ Preview,
+ Section,
+ Tailwind,
+ Text,
+ render,
+} from '@react-email/components';
+
+interface DocumensoSigningInviteEmailProps {
+ username?: string;
+ userImage?: string;
+ invitedByUsername?: string;
+ invitedByEmail?: string;
+ teamName?: string;
+ teamImage?: string;
+ signingLink?: string;
+ inviteFromIp?: string;
+ inviteFromLocation?: string;
+}
+
+export const DocumensoSigningInviteEmail = ({
+ signingLink = 'https://documenso.com',
+}: DocumensoSigningInviteEmailProps) => {
+ return (
+
+
+ Sign Document
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Thilo Konzok has invited you to sign “Document.pdf”
+
+
+ Continue by signing the document.
+
+
+
+
+
+
+
+
+ Thilo Konzok{' '}
+ (thilo@konzok.com)
+
+
+ Hi,
+
+ Please sign the attached document. Magna magna adipisicing dolore minim et aliquip
+ ipsum esse ut nulla ad sint irure.
+
- Thilo
+
+
+
+ This document was sent using{' '}
+
+ Documenso.
+
+
+
+
+ Documenso
+
+ 2261 Market Street, #5211, San Francisco, CA 94114, USA
+
+
+
+
+
+
+
+ );
+};
+
+export default DocumensoSigningInviteEmail;
+
+export const emailHtml = render();
+export const emailText = render(, {
+ plainText: true,
+});
diff --git a/packages/lib/package.json b/packages/lib/package.json
index 202a37fe0..5146d460d 100644
--- a/packages/lib/package.json
+++ b/packages/lib/package.json
@@ -10,17 +10,18 @@
"universal/",
"next-auth/"
],
- "scripts": {
- },
+ "scripts": {},
"dependencies": {
"@documenso/prisma": "*",
- "@pdf-lib/fontkit": "^1.1.1",
"@next-auth/prisma-adapter": "^1.0.6",
+ "@pdf-lib/fontkit": "^1.1.1",
+ "@react-email/components": "^0.0.7",
+ "@react-email/render": "^0.0.7",
"@upstash/redis": "^1.20.6",
"bcrypt": "^5.1.0",
- "pdf-lib": "^1.17.1",
"next": "13.4.1",
"next-auth": "^4.22.1",
+ "pdf-lib": "^1.17.1",
"stripe": "^12.7.0"
},
"devDependencies": {
diff --git a/packages/lib/server-only/document/send-document.ts b/packages/lib/server-only/document/send-document.ts
index 512b48e0c..12109f17b 100644
--- a/packages/lib/server-only/document/send-document.ts
+++ b/packages/lib/server-only/document/send-document.ts
@@ -1,6 +1,8 @@
import nodemailer from 'nodemailer';
import nodemailerSendgrid from 'nodemailer-sendgrid';
+import { emailHtml, emailText } from '../../mail/template';
+
export const sendMail = async ({ email }: { email: string }) => {
let transporter;
@@ -33,7 +35,7 @@ export const sendMail = async ({ email }: { email: string }) => {
from: 'Documenso ',
to: email,
subject: 'Welcome to Documenso!',
- text: 'Welcome to Documenso!',
- html: 'Welcome to Documenso!
',
+ text: emailText,
+ html: emailHtml,
});
};