better-svelte-email 1.0.0-beta.1 → 1.0.0-beta.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.
@@ -58,10 +58,12 @@ export declare const getEmailComponent: (emailPath: string, file: string) => Pro
58
58
  * }
59
59
  * });
60
60
  *
61
- * export const actions = createEmail(renderer);
61
+ * export const actions = createEmail({ renderer });
62
62
  * ```
63
63
  */
64
- export declare const createEmail: (renderer?: Renderer) => {
64
+ export declare const createEmail: (options?: {
65
+ renderer?: Renderer;
66
+ }) => {
65
67
  'create-email': (event: RequestEvent) => Promise<{
66
68
  status: number;
67
69
  body: {
@@ -122,7 +124,15 @@ export declare const SendEmailFunction: ({ from, to, subject, html }: {
122
124
  * ```
123
125
  */
124
126
  export declare const sendEmail: ({ customSendEmailFunction, resendApiKey, renderer }?: {
125
- customSendEmailFunction?: typeof SendEmailFunction;
127
+ customSendEmailFunction?: (email: {
128
+ from: string;
129
+ to: string;
130
+ subject: string;
131
+ html: string;
132
+ }) => Promise<{
133
+ success: boolean;
134
+ error?: any;
135
+ }>;
126
136
  renderer?: Renderer;
127
137
  resendApiKey?: string;
128
138
  }) => {
@@ -107,10 +107,11 @@ const getEmailSource = async (emailPath, file) => {
107
107
  * }
108
108
  * });
109
109
  *
110
- * export const actions = createEmail(renderer);
110
+ * export const actions = createEmail({ renderer });
111
111
  * ```
112
112
  */
113
- export const createEmail = (renderer = new Renderer()) => {
113
+ export const createEmail = (options = {}) => {
114
+ const { renderer = new Renderer() } = options;
114
115
  return {
115
116
  'create-email': async (event) => {
116
117
  try {
@@ -214,7 +215,7 @@ export const sendEmail = ({ customSendEmailFunction, resendApiKey, renderer = ne
214
215
  sent = await defaultSendEmailFunction(email, resendApiKey);
215
216
  }
216
217
  else if (customSendEmailFunction) {
217
- sent = await customSendEmailFunction(email, resendApiKey);
218
+ sent = await customSendEmailFunction(email);
218
219
  }
219
220
  else if (!customSendEmailFunction && !resendApiKey) {
220
221
  const error = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "better-svelte-email",
3
- "version": "1.0.0-beta.1",
3
+ "version": "1.0.0-beta.2",
4
4
  "author": "Konixy",
5
5
  "repository": {
6
6
  "type": "git",