@stacksjs/email 0.56.35 → 0.57.2

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.
@@ -0,0 +1,3 @@
1
+ import type { EmailOptions } from '@stacksjs/types';
2
+ import { ResultAsync } from '@stacksjs/error-handling';
3
+ export declare function send(options: EmailOptions, provider: any, providerName: string, css?: string): Promise<ResultAsync<any, Error>>;
@@ -0,0 +1,30 @@
1
+ import { italic } from "@stacksjs/cli";
2
+ import { log } from "@stacksjs/logging";
3
+ import { ResultAsync } from "@stacksjs/error-handling";
4
+ import * as Maizzle from "@maizzle/framework";
5
+ import * as maizzleConfig from "../utils/config.mjs";
6
+ import { config } from "../tailwind.config.mjs";
7
+ export async function send(options, provider, providerName, css) {
8
+ const template = `
9
+ <extends src="./core/notifications/src/utils/template.html">
10
+ <block name="template">
11
+ ${options.html}
12
+ </block>
13
+ </extends>`;
14
+ await Maizzle.render(
15
+ template,
16
+ {
17
+ tailwind: {
18
+ config,
19
+ css,
20
+ maizzle: maizzleConfig
21
+ }
22
+ }
23
+ ).then(({ html }) => {
24
+ options.html = html;
25
+ }).catch((error) => log.error(`Failed to render email template using provider: ${italic(providerName)}.`, error));
26
+ return ResultAsync.fromPromise(
27
+ provider.sendMessage(options),
28
+ () => new Error(`Failed to send message using provider: ${italic(providerName)}`)
29
+ );
30
+ }
@@ -0,0 +1,4 @@
1
+ import type { EmailOptions } from '@stacksjs/types';
2
+ import type { ResultAsync } from '@stacksjs/error-handling';
3
+ declare function send(options: EmailOptions, css?: string): Promise<ResultAsync<any, Error>>;
4
+ export { send as Send, send };
@@ -0,0 +1,17 @@
1
+ import { EmailJsProvider } from "@novu/emailjs";
2
+ import { notification } from "@stacksjs/config";
3
+ import { send as sendEmail } from "../actions/send.mjs";
4
+ const env = notification.email;
5
+ const service = notification.email?.drivers.emailjs;
6
+ const provider = new EmailJsProvider({
7
+ from: env?.from.address || "",
8
+ host: service?.host || "",
9
+ user: service?.user,
10
+ password: service?.password,
11
+ port: service?.port || 587,
12
+ secure: service?.secure
13
+ });
14
+ async function send(options, css) {
15
+ return sendEmail(options, provider, "EmailJS", css);
16
+ }
17
+ export { send as Send, send };
@@ -0,0 +1,9 @@
1
+ export * as sendgrid from './sendgrid';
2
+ export * as mailgun from './mailgun';
3
+ export * as mailjet from './mailjet';
4
+ export * as mandrill from './mandrill';
5
+ export * as netcore from './netcore';
6
+ export * as nodemailer from './nodemailer';
7
+ export * as postmark from './postmark';
8
+ export * as ses from './ses';
9
+ export * as emailjs from './emailjs';
@@ -0,0 +1,9 @@
1
+ export * as sendgrid from "./sendgrid.mjs";
2
+ export * as mailgun from "./mailgun.mjs";
3
+ export * as mailjet from "./mailjet.mjs";
4
+ export * as mandrill from "./mandrill.mjs";
5
+ export * as netcore from "./netcore.mjs";
6
+ export * as nodemailer from "./nodemailer.mjs";
7
+ export * as postmark from "./postmark.mjs";
8
+ export * as ses from "./ses.mjs";
9
+ export * as emailjs from "./emailjs.mjs";
@@ -0,0 +1,4 @@
1
+ import type { EmailOptions } from '@stacksjs/types';
2
+ import type { ResultAsync } from '@stacksjs/error-handling';
3
+ declare function send(options: EmailOptions, css?: string): Promise<ResultAsync<any, Error>>;
4
+ export { send as Send, send };
@@ -0,0 +1,15 @@
1
+ import { MailgunEmailProvider } from "@novu/mailgun";
2
+ import { notification } from "@stacksjs/config";
3
+ import { send as sendEmail } from "../actions/send.mjs";
4
+ const env = notification.email;
5
+ const service = notification.email?.drivers.mailgun;
6
+ const provider = new MailgunEmailProvider({
7
+ apiKey: service?.key || "",
8
+ domain: service?.domain || "",
9
+ username: service?.username || "",
10
+ from: env?.from.address || ""
11
+ });
12
+ async function send(options, css) {
13
+ return sendEmail(options, provider, "Mailgun", css);
14
+ }
15
+ export { send as Send, send };
@@ -0,0 +1,4 @@
1
+ import type { EmailOptions } from '@stacksjs/types';
2
+ import type { ResultAsync } from '@stacksjs/error-handling';
3
+ declare function send(options: EmailOptions, css?: string): Promise<ResultAsync<any, Error>>;
4
+ export { send as Send, send };
@@ -0,0 +1,16 @@
1
+ import { MailjetEmailProvider } from "@novu/mailjet";
2
+ import { notification } from "@stacksjs/config";
3
+ import { send as sendEmail } from "../actions/send.mjs";
4
+ const env = notification.email;
5
+ const service = notification.email?.drivers.mailjet;
6
+ const provider = new MailjetEmailProvider({
7
+ apiKey: service?.key || "",
8
+ apiSecret: service?.secret || "",
9
+ from: env?.from.address || "",
10
+ senderName: env?.from.name || ""
11
+ // look into what exactly this stands for
12
+ });
13
+ async function send(options, css) {
14
+ return sendEmail(options, provider, "Mailjet", css);
15
+ }
16
+ export { send as Send, send };
@@ -0,0 +1,4 @@
1
+ import type { EmailOptions } from '@stacksjs/types';
2
+ import type { ResultAsync } from '@stacksjs/error-handling';
3
+ declare function send(options: EmailOptions, css?: string): Promise<ResultAsync<any, Error>>;
4
+ export { send as Send, send };
@@ -0,0 +1,13 @@
1
+ import { MandrillProvider } from "@novu/mandrill";
2
+ import { notification } from "@stacksjs/config";
3
+ import { send as sendEmail } from "../actions/send.mjs";
4
+ const env = notification.email;
5
+ const service = notification.email?.drivers.mandrill;
6
+ const provider = new MandrillProvider({
7
+ apiKey: service?.key || "",
8
+ from: env?.from.address || ""
9
+ });
10
+ async function send(options, css) {
11
+ return sendEmail(options, provider, "Mandrill", css);
12
+ }
13
+ export { send as Send, send };
@@ -0,0 +1,4 @@
1
+ import type { EmailOptions } from '@stacksjs/types';
2
+ import type { ResultAsync } from '@stacksjs/error-handling';
3
+ declare function send(options: EmailOptions, css?: string): Promise<ResultAsync<any, Error>>;
4
+ export { send as Send, send };
@@ -0,0 +1,13 @@
1
+ import { NetCoreProvider } from "@novu/netcore";
2
+ import { notification } from "@stacksjs/config";
3
+ import { send as sendEmail } from "../actions/send.mjs";
4
+ const env = notification.email;
5
+ const service = notification.email?.drivers.netcore;
6
+ const provider = new NetCoreProvider({
7
+ apiKey: service?.key || "",
8
+ from: env?.from.address || ""
9
+ });
10
+ async function send(options, css) {
11
+ return sendEmail(options, provider, "Netcore", css);
12
+ }
13
+ export { send as Send, send };
@@ -0,0 +1,4 @@
1
+ import type { EmailOptions } from '@stacksjs/types';
2
+ import type { ResultAsync } from '@stacksjs/error-handling';
3
+ declare function send(options: EmailOptions, css?: string): Promise<ResultAsync<any, Error>>;
4
+ export { send as Send, send };
@@ -0,0 +1,17 @@
1
+ import { NodemailerProvider } from "@novu/nodemailer";
2
+ import { notification } from "@stacksjs/config";
3
+ import { send as sendEmail } from "../actions/send.mjs";
4
+ const env = notification.email;
5
+ const service = notification.email?.drivers.nodemailer;
6
+ const provider = new NodemailerProvider({
7
+ from: env?.from.address || "",
8
+ host: service?.host || "",
9
+ user: service?.user,
10
+ password: service?.password,
11
+ port: service?.port || 587,
12
+ secure: service?.secure
13
+ });
14
+ async function send(options, css) {
15
+ return sendEmail(options, provider, "Nodemailer", css);
16
+ }
17
+ export { send as Send, send };
@@ -0,0 +1,4 @@
1
+ import type { EmailOptions } from '@stacksjs/types';
2
+ import type { ResultAsync } from '@stacksjs/error-handling';
3
+ declare function send(options: EmailOptions, css?: string): Promise<ResultAsync<any, Error>>;
4
+ export { send as Send, send };
@@ -0,0 +1,13 @@
1
+ import { PostmarkEmailProvider } from "@novu/postmark";
2
+ import { notification } from "@stacksjs/config";
3
+ import { send as sendEmail } from "../actions/send.mjs";
4
+ const env = notification.email;
5
+ const service = notification.email?.drivers.postmark;
6
+ const provider = new PostmarkEmailProvider({
7
+ apiKey: service?.key || "",
8
+ from: env?.from.address || ""
9
+ });
10
+ async function send(options, css) {
11
+ return sendEmail(options, provider, "Postmark", css);
12
+ }
13
+ export { send as Send, send };
@@ -0,0 +1,4 @@
1
+ import type { EmailOptions } from '@stacksjs/types';
2
+ import type { ResultAsync } from '@stacksjs/error-handling';
3
+ declare function send(options: EmailOptions, css?: string): Promise<ResultAsync<any, Error>>;
4
+ export { send as Send, send };
@@ -0,0 +1,14 @@
1
+ import { SendgridEmailProvider } from "@novu/sendgrid";
2
+ import { notification } from "@stacksjs/config";
3
+ import { send as sendEmail } from "../actions/send.mjs";
4
+ const env = notification.email;
5
+ const service = notification.email?.drivers.sendgrid;
6
+ const driver = new SendgridEmailProvider({
7
+ apiKey: service?.key || "",
8
+ from: env?.from.address || "",
9
+ senderName: service?.senderName || ""
10
+ });
11
+ async function send(options, css) {
12
+ return sendEmail(options, driver, "Sendgrid", css);
13
+ }
14
+ export { send as Send, send };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
package/dist/index.d.ts CHANGED
@@ -1,82 +1 @@
1
- import { EmailOptions } from '@stacksjs/types';
2
- import { ResultAsync } from '@stacksjs/error-handling';
3
-
4
- declare function send$7(options: EmailOptions, css?: string): Promise<ResultAsync<any, Error>>;
5
-
6
- declare namespace sendgrid {
7
- export {
8
- send$7 as Send,
9
- send$7 as send,
10
- };
11
- }
12
-
13
- declare function send$6(options: EmailOptions, css?: string): Promise<ResultAsync<any, Error>>;
14
-
15
- declare namespace mailgun {
16
- export {
17
- send$6 as Send,
18
- send$6 as send,
19
- };
20
- }
21
-
22
- declare function send$5(options: EmailOptions, css?: string): Promise<ResultAsync<any, Error>>;
23
-
24
- declare namespace mailjet {
25
- export {
26
- send$5 as Send,
27
- send$5 as send,
28
- };
29
- }
30
-
31
- declare function send$4(options: EmailOptions, css?: string): Promise<ResultAsync<any, Error>>;
32
-
33
- declare namespace mandrill {
34
- export {
35
- send$4 as Send,
36
- send$4 as send,
37
- };
38
- }
39
-
40
- declare function send$3(options: EmailOptions, css?: string): Promise<ResultAsync<any, Error>>;
41
-
42
- declare namespace netcore {
43
- export {
44
- send$3 as Send,
45
- send$3 as send,
46
- };
47
- }
48
-
49
- declare function send$2(options: EmailOptions, css?: string): Promise<ResultAsync<any, Error>>;
50
-
51
- declare namespace nodemailer {
52
- export {
53
- send$2 as Send,
54
- send$2 as send,
55
- };
56
- }
57
-
58
- declare function send$1(options: EmailOptions, css?: string): Promise<ResultAsync<any, Error>>;
59
-
60
- declare namespace postmark {
61
- export {
62
- send$1 as Send,
63
- send$1 as send,
64
- };
65
- }
66
-
67
- declare namespace ses {
68
- export {
69
- };
70
- }
71
-
72
- declare function send(options: EmailOptions, css?: string): Promise<ResultAsync<any, Error>>;
73
-
74
- declare const emailjs_send: typeof send;
75
- declare namespace emailjs {
76
- export {
77
- send as Send,
78
- emailjs_send as send,
79
- };
80
- }
81
-
82
- export { emailjs, mailgun, mailjet, mandrill, netcore, nodemailer, postmark, sendgrid, ses };
1
+ export * from './drivers';
package/dist/index.mjs CHANGED
@@ -1,233 +1 @@
1
- import { SendgridEmailProvider } from '@novu/sendgrid';
2
- import { notification } from '@stacksjs/config';
3
- import { italic } from '@stacksjs/cli';
4
- import { log } from '@stacksjs/logging';
5
- import { ResultAsync } from '@stacksjs/error-handling';
6
- import * as Maizzle from '@maizzle/framework';
7
- import { MailgunEmailProvider } from '@novu/mailgun';
8
- import { MailjetEmailProvider } from '@novu/mailjet';
9
- import { MandrillProvider } from '@novu/mandrill';
10
- import { NetCoreProvider } from '@novu/netcore';
11
- import { NodemailerProvider } from '@novu/nodemailer';
12
- import { PostmarkEmailProvider } from '@novu/postmark';
13
- import { EmailJsProvider } from '@novu/emailjs';
14
-
15
- const email = notification.email;
16
- const config$1 = {
17
- email
18
- };
19
-
20
- const maizzleConfig = {
21
- __proto__: null,
22
- default: config$1,
23
- email: email
24
- };
25
-
26
- const config = {
27
- // ...email?.build,
28
- theme: {
29
- screens: {
30
- sm: "480px",
31
- md: "768px",
32
- lg: "976px",
33
- xl: "1440px"
34
- },
35
- colors: {
36
- "blue": "#1fb6ff",
37
- "purple": "#7e5bef",
38
- "pink": "#ff49db",
39
- "orange": "#ff7849",
40
- "green": "#13ce66",
41
- "yellow": "#ffc82c",
42
- "gray-dark": "#273444",
43
- "gray": "#8492a6",
44
- "gray-light": "#d3dce6"
45
- },
46
- fontFamily: {
47
- sans: ["Graphik", "sans-serif"],
48
- serif: ["Merriweather", "serif"]
49
- },
50
- extend: {
51
- spacing: {
52
- 128: "32rem",
53
- 144: "36rem"
54
- },
55
- borderRadius: {
56
- "4xl": "2rem"
57
- }
58
- }
59
- }
60
- };
61
-
62
- async function send$8(options, provider, providerName, css) {
63
- const template = `
64
- <extends src="./core/notifications/src/utils/template.html">
65
- <block name="template">
66
- ${options.html}
67
- </block>
68
- </extends>`;
69
- await Maizzle.render(
70
- template,
71
- {
72
- tailwind: {
73
- config,
74
- css,
75
- maizzle: maizzleConfig
76
- }
77
- }
78
- ).then(({ html }) => {
79
- options.html = html;
80
- }).catch((error) => log.error(`Failed to render email template using provider: ${italic(providerName)}.`, error));
81
- return ResultAsync.fromPromise(
82
- provider.sendMessage(options),
83
- () => new Error(`Failed to send message using provider: ${italic(providerName)}`)
84
- );
85
- }
86
-
87
- const env$7 = notification.email;
88
- const service$7 = notification.email?.drivers.sendgrid;
89
- const driver = new SendgridEmailProvider({
90
- apiKey: service$7?.key || "",
91
- from: env$7?.from.address || "",
92
- senderName: service$7?.senderName || ""
93
- });
94
- async function send$7(options, css) {
95
- return send$8(options, driver, "Sendgrid", css);
96
- }
97
-
98
- const sendgrid = {
99
- __proto__: null,
100
- Send: send$7,
101
- send: send$7
102
- };
103
-
104
- const env$6 = notification.email;
105
- const service$6 = notification.email?.drivers.mailgun;
106
- const provider$6 = new MailgunEmailProvider({
107
- apiKey: service$6?.key || "",
108
- domain: service$6?.domain || "",
109
- username: service$6?.username || "",
110
- from: env$6?.from.address || ""
111
- });
112
- async function send$6(options, css) {
113
- return send$8(options, provider$6, "Mailgun", css);
114
- }
115
-
116
- const mailgun = {
117
- __proto__: null,
118
- Send: send$6,
119
- send: send$6
120
- };
121
-
122
- const env$5 = notification.email;
123
- const service$5 = notification.email?.drivers.mailjet;
124
- const provider$5 = new MailjetEmailProvider({
125
- apiKey: service$5?.key || "",
126
- apiSecret: service$5?.secret || "",
127
- from: env$5?.from.address || "",
128
- senderName: env$5?.from.name || ""
129
- // look into what exactly this stands for
130
- });
131
- async function send$5(options, css) {
132
- return send$8(options, provider$5, "Mailjet", css);
133
- }
134
-
135
- const mailjet = {
136
- __proto__: null,
137
- Send: send$5,
138
- send: send$5
139
- };
140
-
141
- const env$4 = notification.email;
142
- const service$4 = notification.email?.drivers.mandrill;
143
- const provider$4 = new MandrillProvider({
144
- apiKey: service$4?.key || "",
145
- from: env$4?.from.address || ""
146
- });
147
- async function send$4(options, css) {
148
- return send$8(options, provider$4, "Mandrill", css);
149
- }
150
-
151
- const mandrill = {
152
- __proto__: null,
153
- Send: send$4,
154
- send: send$4
155
- };
156
-
157
- const env$3 = notification.email;
158
- const service$3 = notification.email?.drivers.netcore;
159
- const provider$3 = new NetCoreProvider({
160
- apiKey: service$3?.key || "",
161
- from: env$3?.from.address || ""
162
- });
163
- async function send$3(options, css) {
164
- return send$8(options, provider$3, "Netcore", css);
165
- }
166
-
167
- const netcore = {
168
- __proto__: null,
169
- Send: send$3,
170
- send: send$3
171
- };
172
-
173
- const env$2 = notification.email;
174
- const service$2 = notification.email?.drivers.nodemailer;
175
- const provider$2 = new NodemailerProvider({
176
- from: env$2?.from.address || "",
177
- host: service$2?.host || "",
178
- user: service$2?.user,
179
- password: service$2?.password,
180
- port: service$2?.port || 587,
181
- secure: service$2?.secure
182
- });
183
- async function send$2(options, css) {
184
- return send$8(options, provider$2, "Nodemailer", css);
185
- }
186
-
187
- const nodemailer = {
188
- __proto__: null,
189
- Send: send$2,
190
- send: send$2
191
- };
192
-
193
- const env$1 = notification.email;
194
- const service$1 = notification.email?.drivers.postmark;
195
- const provider$1 = new PostmarkEmailProvider({
196
- apiKey: service$1?.key || "",
197
- from: env$1?.from.address || ""
198
- });
199
- async function send$1(options, css) {
200
- return send$8(options, provider$1, "Postmark", css);
201
- }
202
-
203
- const postmark = {
204
- __proto__: null,
205
- Send: send$1,
206
- send: send$1
207
- };
208
-
209
- const ses = {
210
- __proto__: null
211
- };
212
-
213
- const env = notification.email;
214
- const service = notification.email?.drivers.emailjs;
215
- const provider = new EmailJsProvider({
216
- from: env?.from.address || "",
217
- host: service?.host || "",
218
- user: service?.user,
219
- password: service?.password,
220
- port: service?.port || 587,
221
- secure: service?.secure
222
- });
223
- async function send(options, css) {
224
- return send$8(options, provider, "EmailJS", css);
225
- }
226
-
227
- const emailjs = {
228
- __proto__: null,
229
- Send: send,
230
- send: send
231
- };
232
-
233
- export { emailjs, mailgun, mailjet, mandrill, netcore, nodemailer, postmark, sendgrid, ses };
1
+ export * from "./drivers/index.mjs";
@@ -0,0 +1,34 @@
1
+ export declare const config: {
2
+ theme: {
3
+ screens: {
4
+ sm: string;
5
+ md: string;
6
+ lg: string;
7
+ xl: string;
8
+ };
9
+ colors: {
10
+ blue: string;
11
+ purple: string;
12
+ pink: string;
13
+ orange: string;
14
+ green: string;
15
+ yellow: string;
16
+ 'gray-dark': string;
17
+ gray: string;
18
+ 'gray-light': string;
19
+ };
20
+ fontFamily: {
21
+ sans: string[];
22
+ serif: string[];
23
+ };
24
+ extend: {
25
+ spacing: {
26
+ 128: string;
27
+ 144: string;
28
+ };
29
+ borderRadius: {
30
+ '4xl': string;
31
+ };
32
+ };
33
+ };
34
+ };
@@ -0,0 +1,35 @@
1
+ export const config = {
2
+ // ...email?.build,
3
+ theme: {
4
+ screens: {
5
+ sm: "480px",
6
+ md: "768px",
7
+ lg: "976px",
8
+ xl: "1440px"
9
+ },
10
+ colors: {
11
+ "blue": "#1fb6ff",
12
+ "purple": "#7e5bef",
13
+ "pink": "#ff49db",
14
+ "orange": "#ff7849",
15
+ "green": "#13ce66",
16
+ "yellow": "#ffc82c",
17
+ "gray-dark": "#273444",
18
+ "gray": "#8492a6",
19
+ "gray-light": "#d3dce6"
20
+ },
21
+ fontFamily: {
22
+ sans: ["Graphik", "sans-serif"],
23
+ serif: ["Merriweather", "serif"]
24
+ },
25
+ extend: {
26
+ spacing: {
27
+ 128: "32rem",
28
+ 144: "36rem"
29
+ },
30
+ borderRadius: {
31
+ "4xl": "2rem"
32
+ }
33
+ }
34
+ }
35
+ };
@@ -0,0 +1,5 @@
1
+ export declare const email: any;
2
+ declare const _default: {
3
+ email: any;
4
+ };
5
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import { notification } from "@stacksjs/config";
2
+ export const email = notification.email;
3
+ export default {
4
+ email
5
+ };
@@ -0,0 +1,8 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ </head>
5
+ <body>
6
+ Testing...
7
+ <block name="template"></block>
8
+ </body>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/email",
3
3
  "type": "module",
4
- "version": "0.56.35",
4
+ "version": "0.57.2",
5
5
  "packageManager": "pnpm@8.6.5",
6
6
  "description": "The Stacks Email integration. Painlessly create & manage your inboxes, templates, and send emails.",
7
7
  "author": "Chris Breuer",
@@ -59,19 +59,19 @@
59
59
  "@novu/sendgrid": "^0.16.2",
60
60
  "@novu/ses": "^0.16.2",
61
61
  "@novu/stateless": "^0.16.2",
62
- "@stacksjs/cli": "0.56.35",
63
- "@stacksjs/config": "0.56.35",
64
- "@stacksjs/error-handling": "0.56.35",
65
- "@stacksjs/types": "0.56.35"
62
+ "@stacksjs/cli": "0.57.2",
63
+ "@stacksjs/config": "0.57.2",
64
+ "@stacksjs/error-handling": "0.57.2",
65
+ "@stacksjs/types": "0.57.2"
66
66
  },
67
67
  "dependencies": {
68
- "@stacksjs/cli": "0.56.35",
69
- "@stacksjs/error-handling": "0.56.35",
70
- "@stacksjs/logging": "0.56.35"
68
+ "@stacksjs/cli": "0.57.2",
69
+ "@stacksjs/error-handling": "0.57.2",
70
+ "@stacksjs/logging": "0.57.2"
71
71
  },
72
72
  "devDependencies": {
73
- "@stacksjs/development": "0.56.35",
74
- "@stacksjs/types": "0.56.35"
73
+ "@stacksjs/development": "0.57.2",
74
+ "@stacksjs/types": "0.57.2"
75
75
  },
76
76
  "scripts": {
77
77
  "build": "unbuild",