Skip to content

Commit e7d7a4f

Browse files
committed
server/types: add email types
1 parent 4010232 commit e7d7a4f

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed

server/types/email.ts

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/** Rendered mail data for the mailer service, without the 'from' property, which will be automatically added */
2+
export interface RenderedMailerData {
3+
to: string;
4+
subject: string;
5+
html?: string;
6+
}
7+
8+
// -------- EMAIL OPTIONS --------
9+
/** Options to generate the account consolidation email */
10+
export interface AccountConsolidationEmailOptions {
11+
body: {
12+
domain: string;
13+
username: string;
14+
email: string;
15+
};
16+
to: string;
17+
}
18+
/** Options to generate the reset password email */
19+
export interface ResetPasswordEmailOptions {
20+
body: {
21+
domain: string;
22+
link: string;
23+
};
24+
to: string;
25+
}
26+
/** Options to generate the confirm email email */
27+
export interface ConfirmEmailEmailOptions {
28+
body: {
29+
domain: string;
30+
link: string;
31+
};
32+
to: string;
33+
}
34+
35+
// -------- EMAIL RENDERING TEMPLATES --------
36+
/** Base template for emails */
37+
export interface BaseEmailTemplate {
38+
domain: string;
39+
headingText: string;
40+
greetingText: string;
41+
messageText: string;
42+
directLinkText: string;
43+
noteText: string;
44+
meta: {
45+
keywords: string;
46+
description: string;
47+
};
48+
}
49+
/** Template for an email with a primary button, which contains text and a link */
50+
export interface EmailWithPrimaryButtonTemplate extends BaseEmailTemplate {
51+
link: string;
52+
buttonText: string;
53+
}
54+
/** Template for rendering the account consolidation email */
55+
export interface AccountConsolidationEmailTemplate extends BaseEmailTemplate {
56+
username: string;
57+
email: string;
58+
message2Text: string;
59+
resetPasswordLink: string;
60+
resetPasswordText: string;
61+
}
62+
/** Template for rendering the confirm email email */
63+
export type ConfirmEmailEmailTemplate = EmailWithPrimaryButtonTemplate;
64+
/** Template for rendering the reset password email */
65+
export type ResetPasswordEmailTemplate = EmailWithPrimaryButtonTemplate;

server/types/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './email';

0 commit comments

Comments
 (0)