@matthesketh/utopia-email 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +58 -0
- package/dist/adapters/resend.cjs +88 -0
- package/dist/adapters/resend.d.cts +10 -0
- package/dist/adapters/resend.d.ts +10 -0
- package/dist/adapters/resend.js +53 -0
- package/dist/adapters/sendgrid.cjs +101 -0
- package/dist/adapters/sendgrid.d.cts +10 -0
- package/dist/adapters/sendgrid.d.ts +10 -0
- package/dist/adapters/sendgrid.js +66 -0
- package/dist/adapters/smtp.cjs +93 -0
- package/dist/adapters/smtp.d.cts +10 -0
- package/dist/adapters/smtp.d.ts +10 -0
- package/dist/adapters/smtp.js +58 -0
- package/dist/index.cjs +776 -0
- package/dist/index.d.cts +135 -0
- package/dist/index.d.ts +135 -0
- package/dist/index.js +774 -0
- package/dist/types-C3uNsSmw.d.cts +75 -0
- package/dist/types-C3uNsSmw.d.ts +75 -0
- package/package.json +86 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { R as RenderEmailOptions, a as RenderEmailResult, E as EmailAdapter, M as MailerSendOptions, b as EmailResult } from './types-C3uNsSmw.cjs';
|
|
2
|
+
export { c as EmailAttachment, d as EmailMessage, e as ResendConfig, S as SendGridConfig, f as SmtpConfig } from './types-C3uNsSmw.cjs';
|
|
3
|
+
import * as _matthesketh_utopia_server from '@matthesketh/utopia-server';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Render a UtopiaJS component as a complete email document.
|
|
7
|
+
*
|
|
8
|
+
* Pipeline:
|
|
9
|
+
* 1. renderToString(component, props) → { html: bodyHtml, css }
|
|
10
|
+
* 2. inlineCSS(bodyHtml, css) → bodyHtml with style="" attrs
|
|
11
|
+
* 3. wrapEmailDocument(...) → full HTML document
|
|
12
|
+
* 4. htmlToText(fullHtml) → plain text fallback
|
|
13
|
+
* 5. Return { html, text, subject? }
|
|
14
|
+
*/
|
|
15
|
+
declare function renderEmail(component: any, props?: Record<string, any>, options?: RenderEmailOptions): RenderEmailResult;
|
|
16
|
+
|
|
17
|
+
interface Mailer {
|
|
18
|
+
send(options: MailerSendOptions): Promise<EmailResult>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Create a mailer instance with the given adapter.
|
|
22
|
+
*
|
|
23
|
+
* Usage:
|
|
24
|
+
* ```ts
|
|
25
|
+
* const mailer = createMailer(smtpAdapter({ host: '...', port: 587 }));
|
|
26
|
+
* await mailer.send({
|
|
27
|
+
* to: 'user@example.com',
|
|
28
|
+
* from: 'noreply@example.com',
|
|
29
|
+
* subject: 'Welcome!',
|
|
30
|
+
* component: WelcomeEmail,
|
|
31
|
+
* props: { name: 'Alice' },
|
|
32
|
+
* });
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
declare function createMailer(adapter: EmailAdapter): Mailer;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Inline CSS declarations into HTML `style=""` attributes.
|
|
39
|
+
*
|
|
40
|
+
* @param html - Well-formed HTML string from serializeVNode()
|
|
41
|
+
* @param css - CSS string (scoped styles from component)
|
|
42
|
+
* @returns - HTML with inline styles applied
|
|
43
|
+
*/
|
|
44
|
+
declare function inlineCSS(html: string, css: string): string;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Convert HTML to plain text suitable as an email fallback.
|
|
48
|
+
*/
|
|
49
|
+
declare function htmlToText(html: string): string;
|
|
50
|
+
|
|
51
|
+
declare const EmailLayout: {
|
|
52
|
+
setup: (props: Record<string, any>) => {
|
|
53
|
+
width: any;
|
|
54
|
+
backgroundColor: any;
|
|
55
|
+
fontFamily: any;
|
|
56
|
+
};
|
|
57
|
+
render: (ctx: any) => _matthesketh_utopia_server.VElement;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
declare const EmailButton: {
|
|
61
|
+
setup: (props: Record<string, any>) => {
|
|
62
|
+
href: any;
|
|
63
|
+
text: any;
|
|
64
|
+
color: any;
|
|
65
|
+
textColor: any;
|
|
66
|
+
borderRadius: any;
|
|
67
|
+
};
|
|
68
|
+
render: (ctx: any) => _matthesketh_utopia_server.VElement;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
declare const EmailCard: {
|
|
72
|
+
setup: (props: Record<string, any>) => {
|
|
73
|
+
backgroundColor: any;
|
|
74
|
+
padding: any;
|
|
75
|
+
borderRadius: any;
|
|
76
|
+
borderColor: any;
|
|
77
|
+
};
|
|
78
|
+
render: (ctx: any) => _matthesketh_utopia_server.VElement;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
declare const EmailDivider: {
|
|
82
|
+
setup: (props: Record<string, any>) => {
|
|
83
|
+
color: any;
|
|
84
|
+
width: any;
|
|
85
|
+
height: any;
|
|
86
|
+
};
|
|
87
|
+
render: (ctx: any) => _matthesketh_utopia_server.VElement;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
declare const EmailHeading: {
|
|
91
|
+
setup: (props: Record<string, any>) => {
|
|
92
|
+
level: number;
|
|
93
|
+
color: any;
|
|
94
|
+
align: any;
|
|
95
|
+
};
|
|
96
|
+
render: (ctx: any) => _matthesketh_utopia_server.VElement;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
declare const EmailText: {
|
|
100
|
+
setup: (props: Record<string, any>) => {
|
|
101
|
+
color: any;
|
|
102
|
+
fontSize: any;
|
|
103
|
+
lineHeight: any;
|
|
104
|
+
align: any;
|
|
105
|
+
};
|
|
106
|
+
render: (ctx: any) => _matthesketh_utopia_server.VElement;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
declare const EmailImage: {
|
|
110
|
+
setup: (props: Record<string, any>) => {
|
|
111
|
+
src: any;
|
|
112
|
+
alt: any;
|
|
113
|
+
width: any;
|
|
114
|
+
height: any;
|
|
115
|
+
align: any;
|
|
116
|
+
};
|
|
117
|
+
render: (ctx: any) => _matthesketh_utopia_server.VElement;
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
declare const EmailColumns: {
|
|
121
|
+
setup: (props: Record<string, any>) => {
|
|
122
|
+
columns: any;
|
|
123
|
+
gap: any;
|
|
124
|
+
};
|
|
125
|
+
render: (ctx: any) => _matthesketh_utopia_server.VElement;
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
declare const EmailSpacer: {
|
|
129
|
+
setup: (props: Record<string, any>) => {
|
|
130
|
+
height: any;
|
|
131
|
+
};
|
|
132
|
+
render: (ctx: any) => _matthesketh_utopia_server.VElement;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
export { EmailAdapter, EmailButton, EmailCard, EmailColumns, EmailDivider, EmailHeading, EmailImage, EmailLayout, EmailResult, EmailSpacer, EmailText, MailerSendOptions, RenderEmailOptions, RenderEmailResult, createMailer, htmlToText, inlineCSS, renderEmail };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { R as RenderEmailOptions, a as RenderEmailResult, E as EmailAdapter, M as MailerSendOptions, b as EmailResult } from './types-C3uNsSmw.js';
|
|
2
|
+
export { c as EmailAttachment, d as EmailMessage, e as ResendConfig, S as SendGridConfig, f as SmtpConfig } from './types-C3uNsSmw.js';
|
|
3
|
+
import * as _matthesketh_utopia_server from '@matthesketh/utopia-server';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Render a UtopiaJS component as a complete email document.
|
|
7
|
+
*
|
|
8
|
+
* Pipeline:
|
|
9
|
+
* 1. renderToString(component, props) → { html: bodyHtml, css }
|
|
10
|
+
* 2. inlineCSS(bodyHtml, css) → bodyHtml with style="" attrs
|
|
11
|
+
* 3. wrapEmailDocument(...) → full HTML document
|
|
12
|
+
* 4. htmlToText(fullHtml) → plain text fallback
|
|
13
|
+
* 5. Return { html, text, subject? }
|
|
14
|
+
*/
|
|
15
|
+
declare function renderEmail(component: any, props?: Record<string, any>, options?: RenderEmailOptions): RenderEmailResult;
|
|
16
|
+
|
|
17
|
+
interface Mailer {
|
|
18
|
+
send(options: MailerSendOptions): Promise<EmailResult>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Create a mailer instance with the given adapter.
|
|
22
|
+
*
|
|
23
|
+
* Usage:
|
|
24
|
+
* ```ts
|
|
25
|
+
* const mailer = createMailer(smtpAdapter({ host: '...', port: 587 }));
|
|
26
|
+
* await mailer.send({
|
|
27
|
+
* to: 'user@example.com',
|
|
28
|
+
* from: 'noreply@example.com',
|
|
29
|
+
* subject: 'Welcome!',
|
|
30
|
+
* component: WelcomeEmail,
|
|
31
|
+
* props: { name: 'Alice' },
|
|
32
|
+
* });
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
declare function createMailer(adapter: EmailAdapter): Mailer;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Inline CSS declarations into HTML `style=""` attributes.
|
|
39
|
+
*
|
|
40
|
+
* @param html - Well-formed HTML string from serializeVNode()
|
|
41
|
+
* @param css - CSS string (scoped styles from component)
|
|
42
|
+
* @returns - HTML with inline styles applied
|
|
43
|
+
*/
|
|
44
|
+
declare function inlineCSS(html: string, css: string): string;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Convert HTML to plain text suitable as an email fallback.
|
|
48
|
+
*/
|
|
49
|
+
declare function htmlToText(html: string): string;
|
|
50
|
+
|
|
51
|
+
declare const EmailLayout: {
|
|
52
|
+
setup: (props: Record<string, any>) => {
|
|
53
|
+
width: any;
|
|
54
|
+
backgroundColor: any;
|
|
55
|
+
fontFamily: any;
|
|
56
|
+
};
|
|
57
|
+
render: (ctx: any) => _matthesketh_utopia_server.VElement;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
declare const EmailButton: {
|
|
61
|
+
setup: (props: Record<string, any>) => {
|
|
62
|
+
href: any;
|
|
63
|
+
text: any;
|
|
64
|
+
color: any;
|
|
65
|
+
textColor: any;
|
|
66
|
+
borderRadius: any;
|
|
67
|
+
};
|
|
68
|
+
render: (ctx: any) => _matthesketh_utopia_server.VElement;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
declare const EmailCard: {
|
|
72
|
+
setup: (props: Record<string, any>) => {
|
|
73
|
+
backgroundColor: any;
|
|
74
|
+
padding: any;
|
|
75
|
+
borderRadius: any;
|
|
76
|
+
borderColor: any;
|
|
77
|
+
};
|
|
78
|
+
render: (ctx: any) => _matthesketh_utopia_server.VElement;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
declare const EmailDivider: {
|
|
82
|
+
setup: (props: Record<string, any>) => {
|
|
83
|
+
color: any;
|
|
84
|
+
width: any;
|
|
85
|
+
height: any;
|
|
86
|
+
};
|
|
87
|
+
render: (ctx: any) => _matthesketh_utopia_server.VElement;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
declare const EmailHeading: {
|
|
91
|
+
setup: (props: Record<string, any>) => {
|
|
92
|
+
level: number;
|
|
93
|
+
color: any;
|
|
94
|
+
align: any;
|
|
95
|
+
};
|
|
96
|
+
render: (ctx: any) => _matthesketh_utopia_server.VElement;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
declare const EmailText: {
|
|
100
|
+
setup: (props: Record<string, any>) => {
|
|
101
|
+
color: any;
|
|
102
|
+
fontSize: any;
|
|
103
|
+
lineHeight: any;
|
|
104
|
+
align: any;
|
|
105
|
+
};
|
|
106
|
+
render: (ctx: any) => _matthesketh_utopia_server.VElement;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
declare const EmailImage: {
|
|
110
|
+
setup: (props: Record<string, any>) => {
|
|
111
|
+
src: any;
|
|
112
|
+
alt: any;
|
|
113
|
+
width: any;
|
|
114
|
+
height: any;
|
|
115
|
+
align: any;
|
|
116
|
+
};
|
|
117
|
+
render: (ctx: any) => _matthesketh_utopia_server.VElement;
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
declare const EmailColumns: {
|
|
121
|
+
setup: (props: Record<string, any>) => {
|
|
122
|
+
columns: any;
|
|
123
|
+
gap: any;
|
|
124
|
+
};
|
|
125
|
+
render: (ctx: any) => _matthesketh_utopia_server.VElement;
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
declare const EmailSpacer: {
|
|
129
|
+
setup: (props: Record<string, any>) => {
|
|
130
|
+
height: any;
|
|
131
|
+
};
|
|
132
|
+
render: (ctx: any) => _matthesketh_utopia_server.VElement;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
export { EmailAdapter, EmailButton, EmailCard, EmailColumns, EmailDivider, EmailHeading, EmailImage, EmailLayout, EmailResult, EmailSpacer, EmailText, MailerSendOptions, RenderEmailOptions, RenderEmailResult, createMailer, htmlToText, inlineCSS, renderEmail };
|