@@ -196,6 +196,23 @@ func RenderTrustCenterDocumentAccessRejected(
|
||||
return fmt.Sprintf(subjectTrustCenterDocumentAccessRejected, organizationName), textBody, htmlBody, err
|
||||
}
|
||||
|
||||
func RenderMagicLink(baseURL, fullName, magicLinkUrl string, tokenDuration time.Duration) (subject string, textBody string, htmlBody *string, err error) {
|
||||
data := struct {
|
||||
FullName string
|
||||
MagicLinkUrl string
|
||||
LogoURL string
|
||||
DurationInMinutes int
|
||||
}{
|
||||
FullName: fullName,
|
||||
MagicLinkUrl: magicLinkUrl,
|
||||
LogoURL: baseURL + logoURLPath,
|
||||
DurationInMinutes: int(tokenDuration.Minutes()),
|
||||
}
|
||||
|
||||
textBody, htmlBody, err = renderEmail(trustCenterAccessTextTemplate, trustCenterAccessHTMLTemplate, data)
|
||||
return subjectTrustCenterAccess, textBody, htmlBody, err
|
||||
}
|
||||
|
||||
func renderEmail(textTemplate *texttemplate.Template, htmlTemplate *htmltemplate.Template, data any) (textBody string, htmlBody *string, err error) {
|
||||
var textBuf bytes.Buffer
|
||||
if err := textTemplate.Execute(&textBuf, data); err != nil {
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import { render } from '@react-email/components';
|
||||
import { copyFile, mkdir, writeFile } from 'node:fs/promises';
|
||||
import { dirname, join } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import * as React from 'react';
|
||||
import { render } from "@react-email/components";
|
||||
import { copyFile, mkdir, writeFile } from "node:fs/promises";
|
||||
import { dirname, join } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import * as React from "react";
|
||||
|
||||
import ConfirmEmail from '../src/ConfirmEmail';
|
||||
import DocumentExport from '../src/DocumentExport';
|
||||
import DocumentSigning from '../src/DocumentSigning';
|
||||
import FrameworkExport from '../src/FrameworkExport';
|
||||
import Invitation from '../src/Invitation';
|
||||
import PasswordReset from '../src/PasswordReset';
|
||||
import TrustCenterAccess from '../src/TrustCenterAccess';
|
||||
import TrustCenterDocumentAccessRejected from '../src/TrustCenterDocumentAccessRejected';
|
||||
import ConfirmEmail from "../src/ConfirmEmail";
|
||||
import DocumentExport from "../src/DocumentExport";
|
||||
import DocumentSigning from "../src/DocumentSigning";
|
||||
import FrameworkExport from "../src/FrameworkExport";
|
||||
import Invitation from "../src/Invitation";
|
||||
import PasswordReset from "../src/PasswordReset";
|
||||
import TrustCenterAccess from "../src/TrustCenterAccess";
|
||||
import TrustCenterDocumentAccessRejected from "../src/TrustCenterDocumentAccessRejected";
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = dirname(__filename);
|
||||
@@ -23,42 +23,46 @@ type TemplateConfig = {
|
||||
|
||||
const templates: TemplateConfig[] = [
|
||||
{
|
||||
name: 'confirm-email',
|
||||
render: () => ConfirmEmail()
|
||||
name: "confirm-email",
|
||||
render: () => ConfirmEmail(),
|
||||
},
|
||||
{
|
||||
name: 'password-reset',
|
||||
render: () => PasswordReset()
|
||||
name: "password-reset",
|
||||
render: () => PasswordReset(),
|
||||
},
|
||||
{
|
||||
name: 'invitation',
|
||||
render: () => Invitation()
|
||||
name: "invitation",
|
||||
render: () => Invitation(),
|
||||
},
|
||||
{
|
||||
name: 'document-signing',
|
||||
render: () => DocumentSigning()
|
||||
name: "document-signing",
|
||||
render: () => DocumentSigning(),
|
||||
},
|
||||
{
|
||||
name: 'document-export',
|
||||
render: () => DocumentExport()
|
||||
name: "document-export",
|
||||
render: () => DocumentExport(),
|
||||
},
|
||||
{
|
||||
name: 'framework-export',
|
||||
render: () => FrameworkExport()
|
||||
name: "framework-export",
|
||||
render: () => FrameworkExport(),
|
||||
},
|
||||
{
|
||||
name: 'trust-center-access',
|
||||
render: () => TrustCenterAccess()
|
||||
name: "trust-center-access",
|
||||
render: () => TrustCenterAccess(),
|
||||
},
|
||||
{
|
||||
name: 'trust-center-document-access-rejected',
|
||||
render: () => TrustCenterDocumentAccessRejected()
|
||||
name: "trust-center-document-access-rejected",
|
||||
render: () => TrustCenterDocumentAccessRejected(),
|
||||
},
|
||||
{
|
||||
name: "magic-link",
|
||||
render: () => TrustCenterAccess(),
|
||||
},
|
||||
];
|
||||
|
||||
async function build() {
|
||||
const outputDir = join(__dirname, '..', 'dist');
|
||||
const templatesDir = join(__dirname, '..', 'templates');
|
||||
const outputDir = join(__dirname, "..", "dist");
|
||||
const templatesDir = join(__dirname, "..", "templates");
|
||||
await mkdir(outputDir, { recursive: true });
|
||||
|
||||
for (const template of templates) {
|
||||
@@ -74,6 +78,6 @@ async function build() {
|
||||
}
|
||||
|
||||
build().catch((err) => {
|
||||
console.error('Failed to build email templates:', err);
|
||||
console.error("Failed to build email templates:", err);
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
28
packages/emails/src/MagicLink.tsx
Normal file
28
packages/emails/src/MagicLink.tsx
Normal file
@@ -0,0 +1,28 @@
|
||||
import { Button, Section, Text } from "@react-email/components";
|
||||
import * as React from "react";
|
||||
import EmailLayout, {
|
||||
bodyText,
|
||||
button,
|
||||
buttonContainer,
|
||||
footerText,
|
||||
} from "./components/EmailLayout";
|
||||
|
||||
export const MagicLink = () => {
|
||||
return (
|
||||
<EmailLayout subject="Probo Magic Link">
|
||||
<Text style={bodyText}>Please use this link to connect to Probo:</Text>
|
||||
|
||||
<Section style={buttonContainer}>
|
||||
<Button style={button} href={"{{.MagicLinkURL}}"}>
|
||||
Connect to Probo
|
||||
</Button>
|
||||
</Section>
|
||||
|
||||
<Text style={footerText}>
|
||||
This link will expire in {"{{.DurationInMinutes}}"} minutes.
|
||||
</Text>
|
||||
</EmailLayout>
|
||||
);
|
||||
};
|
||||
|
||||
export default MagicLink;
|
||||
@@ -1,22 +1,31 @@
|
||||
import { Button, Section, Text } from '@react-email/components';
|
||||
import * as React from 'react';
|
||||
import EmailLayout, { bodyText, button, buttonContainer, footerText } from './components/EmailLayout';
|
||||
import { Button, Section, Text } from "@react-email/components";
|
||||
import * as React from "react";
|
||||
import EmailLayout, {
|
||||
bodyText,
|
||||
button,
|
||||
buttonContainer,
|
||||
footerText,
|
||||
} from "./components/EmailLayout";
|
||||
|
||||
export const TrustCenterAccess = () => {
|
||||
return (
|
||||
<EmailLayout subject={`Trust Center Access Invitation - ${'{{.OrganizationName}}'}`} organizationName={'{{.OrganizationName}}'}>
|
||||
<EmailLayout
|
||||
subject={`Trust Center Access Invitation - ${"{{.OrganizationName}}"}`}
|
||||
>
|
||||
<Text style={bodyText}>
|
||||
You have been granted access to <strong>{'{{.OrganizationName}}'}</strong>'s Trust Center! Click the button below to access it:
|
||||
You have been granted access to{" "}
|
||||
<strong>{"{{.OrganizationName}}"}</strong>'s Trust Center! Click the
|
||||
button below to access it:
|
||||
</Text>
|
||||
|
||||
<Section style={buttonContainer}>
|
||||
<Button style={button} href={'{{.AccessUrl}}'}>
|
||||
<Button style={button} href={"{{.AccessUrl}}"}>
|
||||
Access Trust Center
|
||||
</Button>
|
||||
</Section>
|
||||
|
||||
<Text style={footerText}>
|
||||
This link will expire in {'{{.DurationInDays}}'} days.
|
||||
This link will expire in {"{{.DurationInDays}}"} days.
|
||||
</Text>
|
||||
</EmailLayout>
|
||||
);
|
||||
|
||||
11
packages/emails/templates/magic-link.txt
Normal file
11
packages/emails/templates/magic-link.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
Probo
|
||||
|
||||
Hi {{.FullName}},
|
||||
|
||||
Please use this link to connect to Probo:
|
||||
|
||||
{{.MagicLinkURL}}
|
||||
|
||||
This link will expire in {{.DurationInMinutes}} minutes.
|
||||
|
||||
Probo Inc, 490 Post St, STE 640, San Francisco, CA, 94102, US
|
||||
@@ -1,3 +1,3 @@
|
||||
module.exports = {
|
||||
tabWidth: 2,
|
||||
tabWidth: 2,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user