@vendure/email-plugin 2.0.0-next.2 → 2.0.0-next.21

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/lib/index.d.ts CHANGED
@@ -7,3 +7,5 @@ export * from './src/noop-email-generator';
7
7
  export * from './src/plugin';
8
8
  export * from './src/template-loader';
9
9
  export * from './src/types';
10
+ export * from './src/email-generator';
11
+ export * from './src/email-sender';
package/lib/index.js CHANGED
@@ -19,4 +19,6 @@ __exportStar(require("./src/noop-email-generator"), exports);
19
19
  __exportStar(require("./src/plugin"), exports);
20
20
  __exportStar(require("./src/template-loader"), exports);
21
21
  __exportStar(require("./src/types"), exports);
22
+ __exportStar(require("./src/email-generator"), exports);
23
+ __exportStar(require("./src/email-sender"), exports);
22
24
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+DAA6C;AAC7C,gEAA8C;AAC9C,sDAAoC;AACpC,uDAAqC;AACrC,kEAAgD;AAChD,6DAA2C;AAC3C,+CAA6B;AAC7B,wDAAsC;AACtC,8CAA4B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+DAA6C;AAC7C,gEAA8C;AAC9C,sDAAoC;AACpC,uDAAqC;AACrC,kEAAgD;AAChD,6DAA2C;AAC3C,+CAA6B;AAC7B,wDAAsC;AACtC,8CAA4B;AAC5B,wDAAsC;AACtC,qDAAmC"}
@@ -1 +1 @@
1
- {"version":3,"file":"dev-mailbox.js","sourceRoot":"","sources":["../../src/dev-mailbox.ts"],"names":[],"mappings":";;;;;;AACA,wCAAwD;AACxD,sDAA0C;AAC1C,wDAA0B;AAE1B,gDAAwB;AAKxB;;GAEG;AACH,MAAa,UAAU;IAMnB,KAAK,CAAC,OAAkC;QACpC,MAAM,EAAE,UAA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oB,CAAC,YAA0B;QACnD,OAAO,IAAI,qBAAc,CAAC;YACtB,YAAY;YACZ,OAAO,EAAE,OAAO;YAChB,OAAO,EAAE,EAAS;YAClB,YAAY,EAAE,KAAK;YACnB,qBAAqB,EAAE,IAAI;YAC3B,OAAO,EAAE,IAAI,cAAO,EAAE;SACzB,CAAC,CAAC;IACP,CAAC;CACJ;AA/GD,gCA+GC"}
@@ -0,0 +1,25 @@
1
+ import { InjectableStrategy, VendureEvent } from '@vendure/core';
2
+ import { EmailDetails, EmailPluginOptions } from './types';
3
+ /**
4
+ * @description
5
+ * An EmailGenerator generates the subject and body details of an email.
6
+ *
7
+ * @docsCategory EmailPlugin
8
+ * @docsPage EmailGenerator
9
+ * @docsWeight 0
10
+ */
11
+ export interface EmailGenerator<T extends string = any, E extends VendureEvent = any> extends InjectableStrategy {
12
+ /**
13
+ * @description
14
+ * Any necessary setup can be performed here.
15
+ */
16
+ onInit?(options: EmailPluginOptions): void | Promise<void>;
17
+ /**
18
+ * @description
19
+ * Given a subject and body from an email template, this method generates the final
20
+ * interpolated email text.
21
+ */
22
+ generate(from: string, subject: string, body: string, templateVars: {
23
+ [key: string]: any;
24
+ }): Pick<EmailDetails, 'from' | 'subject' | 'body'>;
25
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=email-generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"email-generator.js","sourceRoot":"","sources":["../../src/email-generator.ts"],"names":[],"mappings":""}
@@ -1,5 +1,7 @@
1
+ import { EmailGenerator } from './email-generator';
2
+ import { EmailSender } from './email-sender';
1
3
  import { TemplateLoader } from './template-loader';
2
- import { EmailGenerator, EmailPluginOptions, EmailSender, EmailTransportOptions, IntermediateEmailDetails } from './types';
4
+ import { EmailPluginOptions, EmailTransportOptions, IntermediateEmailDetails } from './types';
3
5
  /**
4
6
  * This class combines the template loading, generation, and email sending - the actual "work" of
5
7
  * the EmailPlugin. It is arranged this way primarily to accommodate easier testing, so that the
@@ -1 +1 @@
1
- {"version":3,"file":"email-processor.js","sourceRoot":"","sources":["../../src/email-processor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,2CAAoD;AACpD,wCAA4D;AAC5D,wDAA0B;AAE1B,yDAA4D;AAC5D,qCAA4C;AAC5C,2CAA8D;AAC9D,2EAAsE;AACtE,uEAAkE;AAClE,uDAAmD;AAUnD;;;;GAIG;AAEH,IAAa,cAAc,GAA3B,MAAa,cAAc;IAMvB,YAAoD,OAA2B;QAA3B,YAAO,GAAP,OAAO,CAAoB;IAAG,CAAC;IAEnF,KAAK,CAAC,IAAI;QACN,IAAI,CAAC,cAAc,GAAG,IAAI,gCAAc,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QACpE,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,+CAAqB,EAAE,CAAC;QACrG,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,cAAc;YACxC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc;YAC7B,CAAC,CAAC,IAAI,mDAAuB,EAAE,CAAC;QACpC,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE;YACvB,MAAM,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;SAClE;QACD,IAAI,IAAA,yBAAgB,EAAC,IAAI,CAAC,OAAO,CAAC,EAAE;YAChC,IAAI,CAAC,SAAS,GAAG;gBACb,IAAI,EAAE,MAAM;gBACZ,GAAG,EAAE,KAAK;gBACV,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU;aACtC,CAAC;SACL;aAAM;YACH,IAAI,CAAC,IAAI,CAAC,OAAO,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S,CAAC,CAAC;YAC1D,OAAO,IAAI,CAAC;SACf;QAAC,OAAO,GAAY,EAAE;YACnB,IAAI,GAAG,YAAY,KAAK,EAAE;gBACtB,aAAM,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,qBAAS,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;aACnD;iBAAM;gBACH,aAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,qBAAS,CAAC,CAAC;aACxC;YACD,MAAM,GAAG,CAAC;SACb;IACL,CAAC;CACJ,CAAA;AAnEY,cAAc;IAD1B,IAAA,mBAAU,GAAE;IAOI,WAAA,IAAA,eAAM,EAAC,gCAAoB,CAAC,CAAA;;GANhC,cAAc,CAmE1B;AAnEY,wCAAc"}
@@ -0,0 +1,45 @@
1
+ import { InjectableStrategy } from '@vendure/core';
2
+ import { EmailDetails, EmailTransportOptions } from './types';
3
+ /**
4
+ * @description
5
+ * An EmailSender is responsible for sending the email, e.g. via an SMTP connection
6
+ * or using some other mail-sending API. By default, the EmailPlugin uses the
7
+ * {@link NodemailerEmailSender}, but it is also possible to supply a custom implementation:
8
+ *
9
+ * @example
10
+ * ```TypeScript
11
+ * const sgMail = require('\@sendgrid/mail');
12
+ *
13
+ * sgMail.setApiKey(process.env.SENDGRID_API_KEY);
14
+ *
15
+ * class SendgridEmailSender implements EmailSender {
16
+ * async send(email: EmailDetails) {
17
+ * await sgMail.send({
18
+ * to: email.recipient,
19
+ * from: email.from,
20
+ * subject: email.subject,
21
+ * html: email.body,
22
+ * });
23
+ * }
24
+ * }
25
+ *
26
+ * const config: VendureConfig = {
27
+ * logger: new DefaultLogger({ level: LogLevel.Debug })
28
+ * // ...
29
+ * plugins: [
30
+ * EmailPlugin.init({
31
+ * // ... template, handlers config omitted
32
+ * transport: { type: 'none' },
33
+ * emailSender: new SendgridEmailSender(),
34
+ * }),
35
+ * ],
36
+ * };
37
+ * ```
38
+ *
39
+ * @docsCategory EmailPlugin
40
+ * @docsPage EmailSender
41
+ * @docsWeight 0
42
+ */
43
+ export interface EmailSender extends InjectableStrategy {
44
+ send: (email: EmailDetails, options: EmailTransportOptions) => void | Promise<void>;
45
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=email-sender.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"email-sender.js","sourceRoot":"","sources":["../../src/email-sender.ts"],"names":[],"mappings":""}
@@ -1,3 +1,4 @@
1
+ import { LanguageCode } from '@vendure/common/lib/generated-types';
1
2
  import { Type } from '@vendure/common/lib/shared-types';
2
3
  import { Injector } from '@vendure/core';
3
4
  import { EmailEventListener } from './event-listener';
@@ -22,11 +23,17 @@ import { EmailTemplateConfig, EventWithAsyncData, EventWithContext, Intermediate
22
23
  * This example creates a handler which listens for the `OrderStateTransitionEvent` and if the Order has
23
24
  * transitioned to the `'PaymentSettled'` state, it will generate and send an email.
24
25
  *
26
+ * The string argument passed into the `EmailEventListener` constructor is used to identify the handler, and
27
+ * also to locate the directory of the email template files. So in the example above, there should be a directory
28
+ * `<app root>/static/email/templates/order-confirmation` which contains a Handlebars template named `body.hbs`.
29
+ *
25
30
  * ## Handling other languages
26
31
  *
27
32
  * By default, the handler will respond to all events on all channels and use the same subject ("Order confirmation for #12345" above)
28
33
  * and body template. Where the server is intended to support multiple languages, the `.addTemplate()` method may be used
29
- * to defined the subject and body template for specific language and channel combinations.
34
+ * to define the subject and body template for specific language and channel combinations.
35
+ *
36
+ * The language is determined by looking at the `languageCode` property of the event's `ctx` ({@link RequestContext}) object.
30
37
  *
31
38
  * @example
32
39
  * ```ts
@@ -39,12 +46,79 @@ import { EmailTemplateConfig, EventWithAsyncData, EventWithContext, Intermediate
39
46
  * })
40
47
  * ```
41
48
  *
49
+ * ## Defining a custom handler
50
+ *
51
+ * Let's say you have a plugin which defines a new event type, `QuoteRequestedEvent`. In your plugin you have defined a mutation
52
+ * which is executed when the customer requests a quote in your storefront, and in your resolver, you use the {@link EventBus} to publish a
53
+ * new `QuoteRequestedEvent`.
54
+ *
55
+ * You now want to email the customer with their quote. Here are the steps you would take to set this up:
56
+ *
57
+ * ### 1. Create a new handler
58
+ *
59
+ * ```TypeScript
60
+ * import { EmailEventListener } from `\@vendure/email-plugin`;
61
+ * import { QuoteRequestedEvent } from `./events`;
62
+ *
63
+ * const quoteRequestedHandler = new EmailEventListener('quote-requested')
64
+ * .on(QuoteRequestedEvent)
65
+ * .setRecipient(event => event.customer.emailAddress)
66
+ * .setSubject(`Here's the quote you requested`)
67
+ * .setTemplateVars(event => ({ details: event.details }));
68
+ * ```
69
+ *
70
+ * ### 2. Create the email template
71
+ *
72
+ * Next you need to make sure there is a template defined at `<app root>/static/email/templates/quote-requested/body.hbs`. The template
73
+ * would look something like this:
74
+ *
75
+ * ```handlebars
76
+ * {{> header title="Here's the quote you requested" }}
77
+ *
78
+ * <mj-section background-color="#fafafa">
79
+ * <mj-column>
80
+ * <mj-text color="#525252">
81
+ * Thank you for your interest in our products! Here's the details
82
+ * of the quote you recently requested:
83
+ * </mj-text>
84
+ *
85
+ * <--! your custom email layout goes here -->
86
+ * </mj-column>
87
+ * </mj-section>
88
+ *
89
+ *
90
+ * {{> footer }}
91
+ * ```
92
+ *
93
+ * You can find pre-made templates on the [MJML website](https://mjml.io/templates/).
94
+ *
95
+ * ### 3. Register the handler
96
+ *
97
+ * Finally, you need to register the handler with the EmailPlugin:
98
+ *
99
+ * ```TypeScript {hl_lines=[8]}
100
+ * import { defaultEmailHandlers, EmailPlugin } from '\@vendure/email-plugin';
101
+ * import { quoteRequestedHandler } from './plugins/quote-plugin';
102
+ *
103
+ * const config: VendureConfig = {
104
+ * // Add an instance of the plugin to the plugins array
105
+ * plugins: [
106
+ * EmailPlugin.init({
107
+ * handlers: [...defaultEmailHandlers, quoteRequestedHandler],
108
+ * templatePath: path.join(__dirname, 'vendure/email/templates'),
109
+ * // ... etc
110
+ * }),
111
+ * ],
112
+ * };
113
+ * ```
114
+ *
42
115
  * @docsCategory EmailPlugin
43
116
  */
44
117
  export declare class EmailEventHandler<T extends string = string, Event extends EventWithContext = EventWithContext> {
45
118
  listener: EmailEventListener<T>;
46
119
  event: Type<Event>;
47
120
  private setRecipientFn;
121
+ private setLanguageCodeFn;
48
122
  private setTemplateVarsFn;
49
123
  private setAttachmentsFn?;
50
124
  private setOptionalAddressFieldsFn?;
@@ -74,6 +148,13 @@ export declare class EmailEventHandler<T extends string = string, Event extends
74
148
  * Or a comma-separated list of addresses: `'foobar@example.com, "Ноде Майлер" <bar@example.com>'`
75
149
  */
76
150
  setRecipient(setRecipientFn: (event: Event) => string): EmailEventHandler<T, Event>;
151
+ /**
152
+ * @description
153
+ * A function which allows to override the language of the email. If not defined, the language from the context will be used.
154
+ *
155
+ * @since 1.8.0
156
+ */
157
+ setLanguageCode(setLanguageCodeFn: (event: Event) => LanguageCode | undefined): EmailEventHandler<T, Event>;
77
158
  /**
78
159
  * @description
79
160
  * A function which returns an object hash of variables which will be made available to the Handlebars template
@@ -24,11 +24,17 @@ const constants_1 = require("./constants");
24
24
  * This example creates a handler which listens for the `OrderStateTransitionEvent` and if the Order has
25
25
  * transitioned to the `'PaymentSettled'` state, it will generate and send an email.
26
26
  *
27
+ * The string argument passed into the `EmailEventListener` constructor is used to identify the handler, and
28
+ * also to locate the directory of the email template files. So in the example above, there should be a directory
29
+ * `<app root>/static/email/templates/order-confirmation` which contains a Handlebars template named `body.hbs`.
30
+ *
27
31
  * ## Handling other languages
28
32
  *
29
33
  * By default, the handler will respond to all events on all channels and use the same subject ("Order confirmation for #12345" above)
30
34
  * and body template. Where the server is intended to support multiple languages, the `.addTemplate()` method may be used
31
- * to defined the subject and body template for specific language and channel combinations.
35
+ * to define the subject and body template for specific language and channel combinations.
36
+ *
37
+ * The language is determined by looking at the `languageCode` property of the event's `ctx` ({@link RequestContext}) object.
32
38
  *
33
39
  * @example
34
40
  * ```ts
@@ -41,6 +47,72 @@ const constants_1 = require("./constants");
41
47
  * })
42
48
  * ```
43
49
  *
50
+ * ## Defining a custom handler
51
+ *
52
+ * Let's say you have a plugin which defines a new event type, `QuoteRequestedEvent`. In your plugin you have defined a mutation
53
+ * which is executed when the customer requests a quote in your storefront, and in your resolver, you use the {@link EventBus} to publish a
54
+ * new `QuoteRequestedEvent`.
55
+ *
56
+ * You now want to email the customer with their quote. Here are the steps you would take to set this up:
57
+ *
58
+ * ### 1. Create a new handler
59
+ *
60
+ * ```TypeScript
61
+ * import { EmailEventListener } from `\@vendure/email-plugin`;
62
+ * import { QuoteRequestedEvent } from `./events`;
63
+ *
64
+ * const quoteRequestedHandler = new EmailEventListener('quote-requested')
65
+ * .on(QuoteRequestedEvent)
66
+ * .setRecipient(event => event.customer.emailAddress)
67
+ * .setSubject(`Here's the quote you requested`)
68
+ * .setTemplateVars(event => ({ details: event.details }));
69
+ * ```
70
+ *
71
+ * ### 2. Create the email template
72
+ *
73
+ * Next you need to make sure there is a template defined at `<app root>/static/email/templates/quote-requested/body.hbs`. The template
74
+ * would look something like this:
75
+ *
76
+ * ```handlebars
77
+ * {{> header title="Here's the quote you requested" }}
78
+ *
79
+ * <mj-section background-color="#fafafa">
80
+ * <mj-column>
81
+ * <mj-text color="#525252">
82
+ * Thank you for your interest in our products! Here's the details
83
+ * of the quote you recently requested:
84
+ * </mj-text>
85
+ *
86
+ * <--! your custom email layout goes here -->
87
+ * </mj-column>
88
+ * </mj-section>
89
+ *
90
+ *
91
+ * {{> footer }}
92
+ * ```
93
+ *
94
+ * You can find pre-made templates on the [MJML website](https://mjml.io/templates/).
95
+ *
96
+ * ### 3. Register the handler
97
+ *
98
+ * Finally, you need to register the handler with the EmailPlugin:
99
+ *
100
+ * ```TypeScript {hl_lines=[8]}
101
+ * import { defaultEmailHandlers, EmailPlugin } from '\@vendure/email-plugin';
102
+ * import { quoteRequestedHandler } from './plugins/quote-plugin';
103
+ *
104
+ * const config: VendureConfig = {
105
+ * // Add an instance of the plugin to the plugins array
106
+ * plugins: [
107
+ * EmailPlugin.init({
108
+ * handlers: [...defaultEmailHandlers, quoteRequestedHandler],
109
+ * templatePath: path.join(__dirname, 'vendure/email/templates'),
110
+ * // ... etc
111
+ * }),
112
+ * ],
113
+ * };
114
+ * ```
115
+ *
44
116
  * @docsCategory EmailPlugin
45
117
  */
46
118
  class EmailEventHandler {
@@ -79,6 +151,16 @@ class EmailEventHandler {
79
151
  this.setRecipientFn = setRecipientFn;
80
152
  return this;
81
153
  }
154
+ /**
155
+ * @description
156
+ * A function which allows to override the language of the email. If not defined, the language from the context will be used.
157
+ *
158
+ * @since 1.8.0
159
+ */
160
+ setLanguageCode(setLanguageCodeFn) {
161
+ this.setLanguageCodeFn = setLanguageCodeFn;
162
+ return this;
163
+ }
82
164
  /**
83
165
  * @description
84
166
  * A function which returns an object hash of variables which will be made available to the Handlebars template
@@ -198,7 +280,7 @@ class EmailEventHandler {
198
280
  * @internal
199
281
  */
200
282
  async handle(event, globals = {}, injector) {
201
- var _a, _b, _c, _d;
283
+ var _a, _b, _c, _d, _e;
202
284
  for (const filterFn of this.filterFns) {
203
285
  if (!filterFn(event)) {
204
286
  return;
@@ -230,7 +312,8 @@ class EmailEventHandler {
230
312
  `Remember to call ".setFrom()" when setting up the EmailEventHandler for ${this.type}`);
231
313
  }
232
314
  const { ctx } = event;
233
- const configuration = this.getBestConfiguration(ctx.channel.code, ctx.languageCode);
315
+ const languageCode = ((_a = this.setLanguageCodeFn) === null || _a === void 0 ? void 0 : _a.call(this, event)) || ctx.languageCode;
316
+ const configuration = this.getBestConfiguration(ctx.channel.code, languageCode);
234
317
  const subject = configuration ? configuration.subject : this.defaultSubject;
235
318
  if (subject == null) {
236
319
  throw new Error(`No subject field has been defined. ` +
@@ -240,13 +323,13 @@ class EmailEventHandler {
240
323
  const templateVars = this.setTemplateVarsFn ? this.setTemplateVarsFn(event, globals) : {};
241
324
  let attachmentsArray = [];
242
325
  try {
243
- attachmentsArray = (_b = (await ((_a = this.setAttachmentsFn) === null || _a === void 0 ? void 0 : _a.call(this, event)))) !== null && _b !== void 0 ? _b : [];
326
+ attachmentsArray = (_c = (await ((_b = this.setAttachmentsFn) === null || _b === void 0 ? void 0 : _b.call(this, event)))) !== null && _c !== void 0 ? _c : [];
244
327
  }
245
328
  catch (e) {
246
329
  core_1.Logger.error(e, constants_1.loggerCtx, e.stack);
247
330
  }
248
331
  const attachments = await (0, attachment_utils_1.serializeAttachments)(attachmentsArray);
249
- const optionalAddressFields = (_d = (await ((_c = this.setOptionalAddressFieldsFn) === null || _c === void 0 ? void 0 : _c.call(this, event)))) !== null && _d !== void 0 ? _d : {};
332
+ const optionalAddressFields = (_e = (await ((_d = this.setOptionalAddressFieldsFn) === null || _d === void 0 ? void 0 : _d.call(this, event)))) !== null && _e !== void 0 ? _e : {};
250
333
  return Object.assign({ type: this.type, recipient, from: this.from, templateVars: Object.assign(Object.assign({}, globals), templateVars), subject, templateFile: configuration ? configuration.templateFile : 'body.hbs', attachments }, optionalAddressFields);
251
334
  }
252
335
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"event-handler.js","sourceRoot":"","sources":["../../src/event-handler.ts"],"names":[],"mappings":";;;AAEA,wCAAiD;AAEjD,yDAA0D;AAC1D,2CAAwC;AAcxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,MAAa,iBAAiB;IAe1B,YAAmB,QAA+B,EAAS,KAAkB;QAA1D,aAAQ,GAAR,QAAQ,CAAuB;QAAS,UAAK,GAAL,KAAK,CAAa;QAVrE,cAAS,GAAqC,EAAE,CAAC;QACjD,mBAAc,GAA0B,EAAE,CAAC;IAS6B,CAAC;IAEjF,gBAAgB;IAChB,IAAI,IAAI;QACJ,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;IAC9B,CAAC;IAED,gBAAgB;IAChB,IAAI,SAAS;QACT,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,QAAmC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EACP,YAAY,EAAE,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC,UAAU,EACrE,WAAW,IACR,qBAAqB,EAC1B;IACN,CAAC;IAED;;;;OAIG;IACH,YAAY,CAAC,KAAkC;QAC3C,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;QACxB,OAAO,IAAI,CAAC;IAChB,CAAC;IAEO,oBAAoB,CACxB,WAAmB,EACnB,YAA0B;QAE1B,IAAI,IAAI,CAAC,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE;YAClC,OAAO;SACV;QACD,MAAM,UAAU,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;YAC5C,OAAO,CACH,CAAC,CAAC,CAAC,WAAW,KAAK,WAAW,IAAI,CAAC,CAAC,WAAW,KAAK,SAAS,CAAC;gBAC9D,CAAC,CAAC,YAAY,KAAK,YAAY,CAClC,CAAC;QACN,CAAC,CAAC,CAAC;QACH,IAAI,UAAU,EAAE;YACZ,OAAO,UAAU,CAAC;SACrB;QACD,MAAM,YAAY,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,CACzC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,KAAK,WAAW,IAAI,CAAC,CAAC,YAAY,KAAK,SAAS,CACrE,CAAC;QACF,IAAI,YAAY,EAAE;YACd,OAAO,YAAY,CAAC;SACvB;QACD,OAAO;IACX,CAAC;CACJ;AAtSD,8CAsSC;AAED;;;;;;GAMG;AACH,MAAa,8BAKX,SAAQ,iBAA2B;IACjC,YACW,WAAyC,EAChD,QAA+B,EAC/B,KAAuB;QAEvB,KAAK,CAAC,QAAQ,EAAE,KAAY,CAAC,CAAC;QAJvB,gBAAW,GAAX,WAAW,CAA8B;IAKpD,CAAC;CACJ;AAbD,wEAaC"}
@@ -1,4 +1,5 @@
1
- import { EmailGenerator, EmailPluginDevModeOptions, EmailPluginOptions } from './types';
1
+ import { EmailGenerator } from './email-generator';
2
+ import { EmailPluginDevModeOptions, EmailPluginOptions } from './types';
2
3
  /**
3
4
  * @description
4
5
  * Uses Handlebars (https://handlebarsjs.com/) to output MJML (https://mjml.io) which is then
@@ -1 +1 @@
1
- {"version":3,"file":"handlebars-mjml-generator.js","sourceRoot":"","sources":["../../src/handlebars-mjml-generator.ts"],"names":[],"mappings":";;;;;;AAAA,4DAAoC;AACpC,wDAA0B;AAC1B,4DAAoC;AACpC,gDAA6B;AAC7B,gDAAwB;AAIxB;;;;;;;GAOG;AACH,MAAa,uBAAuB;IAChC,MAAM,CAAC,OAAuD;QAC1D,MAAM,YAAY,GAAG,cAAI,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;QACjE,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;QACpC,IAAI,CAAC,eAAe,EAAE,CAAC;IAC3B,CAAC;IAED,QAAQ,CAAC,IAAY,EAAE,OAAe,EAAE,QAAgB,EAAE,YAAiB;QACvE,MAAM,YAAY,GAAG,oBAAU,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;QAClE,MAAM,eAAe,GAAG,oBAAU,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACpD,MAAM,gBAAgB,GAAG,oBAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QACtD,0EAA0E;QAC1E,kHAAkH;QAClH,yEAAyE;QACzE,kEAAkE;QAClE,MAAM,eAAe,GAAmB,EAAE,6BAA6B,EAAE,IAAI,EAAE,CAAC;QAChF,MAAM,UAAU,GAAG,YAAY,CAAC,YAAY,EAAE,EAAE,6BAA6B,EAAE,IAAI,EAAE,CAAC,CAAC;QACvF,MAAM,aAAa,GAAG,eAAe,CAAC,YAAY,EAAE,EAAE,6BAA6B,EAAE,IAAI,EAAE,CAAC,CAAC;QAC7F,MAAM,IAAI,GAAG,gBAAgB,CAAC,YAAY,EAAE,EAAE,6BAA6B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D,CAAC;IAEO,gBAAgB,CAAC,YAAoB;QACzC,MAAM,aAAa,GAAG,kBAAE,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;QACnD,KAAK,MAAM,WAAW,IAAI,aAAa,EAAE;YACrC,MAAM,cAAc,GAAG,kBAAE,CAAC,YAAY,CAAC,cAAI,CAAC,IAAI,CAAC,YAAY,EAAE,WAAW,CAAC,EAAE,OAAO,CAAC,CAAC;YACtF,oBAAU,CAAC,eAAe,CAAC,cAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC,EAAE,cAAc,CAAC,CAAC;SAClF;IACL,CAAC;IAEO,eAAe;QACnB,oBAAU,CAAC,cAAc,CAAC,YAAY,EAAE,CAAC,IAAsB,EAAE,MAAuB,EAAE,EAAE;YACxF,IAAI,CAAC,IAAI,EAAE;gBACP,OAAO,IAAI,CAAC;aACf;YACD,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;gBAC5B,MAAM,GAAG,SAAS,CAAC;aACtB;YACD,OAAO,IAAA,oBAAU,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;QAEH,oBAAU,CAAC,cAAc,CAAC,aAAa,EAAE,CAAC,MAAe,EAAE,EAAE;YACzD,IAAI,MAAM,IAAI,IAAI,EAAE;gBAChB,OAAO,MAAM,CAAC;aACjB;YACD,OAAO,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AAjDD,0DAiDC"}
@@ -1,6 +1,7 @@
1
1
  /// <reference types="node" />
2
2
  import { Stream } from 'stream';
3
- import { EmailDetails, EmailSender, EmailTransportOptions } from './types';
3
+ import { EmailSender } from './email-sender';
4
+ import { EmailDetails, EmailTransportOptions } from './types';
4
5
  export declare type StreamTransportInfo = {
5
6
  envelope: {
6
7
  from: string;
@@ -1 +1 @@
1
- {"version":3,"file":"nodemailer-email-sender.js","s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C,WAAW,CAAC,MAAM,CAAC,EAAE,qBAAS,CAAC,CAAC;YACnD,CAAC;YACD,IAAI,CAAC,GAAG,MAAW;gBACf,aAAM,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,qBAAS,CAAC,CAAC;YAChD,CAAC;YACD,IAAI,CAAC,GAAG,MAAW;gBACf,aAAM,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,qBAAS,CAAC,CAAC;YAChD,CAAC;YACD,KAAK,CAAC,GAAG,MAAW;gBAChB,aAAM,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,qBAAS,CAAC,CAAC;YACjD,CAAC;YACD,KAAK,CAAC,GAAG,MAAW;gBAChB,aAAM,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,qBAAS,CAAC,CAAC;YACjD,CAAC;SACJ,CAAC;IACN,CAAC;CACJ;AAlID,sDAkIC"}
@@ -1,4 +1,4 @@
1
- import { EmailGenerator } from './types';
1
+ import { EmailGenerator } from './email-generator';
2
2
  /**
3
3
  * Simply passes through the subject and template content without modification.
4
4
  */
@@ -1,13 +1,26 @@
1
- import { MiddlewareConsumer, NestModule, OnApplicationBootstrap } from '@nestjs/common';
1
+ import { MiddlewareConsumer, NestModule, OnApplicationBootstrap, OnApplicationShutdown } from '@nestjs/common';
2
2
  import { ModuleRef } from '@nestjs/core';
3
3
  import { EventBus, JobQueueService, ProcessContext, Type } from '@vendure/core';
4
4
  import { EmailProcessor } from './email-processor';
5
5
  import { EmailPluginDevModeOptions, EmailPluginOptions } from './types';
6
6
  /**
7
7
  * @description
8
- * The EmailPlugin creates and sends transactional emails based on Vendure events. By default it uses an [MJML](https://mjml.io/)-based
8
+ * The EmailPlugin creates and sends transactional emails based on Vendure events. By default, it uses an [MJML](https://mjml.io/)-based
9
9
  * email generator to generate the email body and [Nodemailer](https://nodemailer.com/about/) to send the emails.
10
10
  *
11
+ * ## High-level description
12
+ * Vendure has an internal events system (see {@link EventBus}) that allows plugins to subscribe to events. The EmailPlugin is configured with
13
+ * {@link EmailEventHandler}s that listen for a specific event and when it is published, the handler defines which template to use to generate
14
+ * the resulting email.
15
+ *
16
+ * The plugin comes with a set of default handlers for the following events:
17
+ * - Order confirmation
18
+ * - New customer email address verification
19
+ * - Password reset request
20
+ * - Email address change request
21
+ *
22
+ * You can also create your own handlers and register them with the plugin - see the {@link EmailEventHandler} docs for more details.
23
+ *
11
24
  * ## Installation
12
25
  *
13
26
  * `yarn add \@vendure/email-plugin`
@@ -25,7 +38,7 @@ import { EmailPluginDevModeOptions, EmailPluginOptions } from './types';
25
38
  * plugins: [
26
39
  * EmailPlugin.init({
27
40
  * handlers: defaultEmailHandlers,
28
- * templatePath: path.join(__dirname, 'vendure/email/templates'),
41
+ * templatePath: path.join(__dirname, 'static/email/templates'),
29
42
  * transport: {
30
43
  * type: 'smtp',
31
44
  * host: 'smtp.example.com',
@@ -42,7 +55,7 @@ import { EmailPluginDevModeOptions, EmailPluginOptions } from './types';
42
55
  *
43
56
  * ## Email templates
44
57
  *
45
- * In the example above, the plugin has been configured to look in `<app-root>/vendure/email/templates`
58
+ * In the example above, the plugin has been configured to look in `<app-root>/static/email/templates`
46
59
  * for the email template files. If you used `\@vendure/create` to create your application, the templates will have
47
60
  * been copied to that location during setup.
48
61
  *
@@ -85,8 +98,57 @@ import { EmailPluginDevModeOptions, EmailPluginOptions } from './types';
85
98
  *
86
99
  * The `defaultEmailHandlers` array defines the default handlers such as for handling new account registration, order confirmation, password reset
87
100
  * etc. These defaults can be extended by adding custom templates for languages other than the default, or even completely new types of emails
88
- * which respond to any of the available [VendureEvents](/docs/typescript-api/events/). See the {@link EmailEventHandler} documentation for
89
- * details on how to do so.
101
+ * which respond to any of the available [VendureEvents](/docs/typescript-api/events/).
102
+ *
103
+ * A good way to learn how to create your own email handlers is to take a look at the
104
+ * [source code of the default handlers](https://github.com/vendure-ecommerce/vendure/blob/master/packages/email-plugin/src/default-email-handlers.ts).
105
+ * New handlers are defined in exactly the same way.
106
+ *
107
+ * It is also possible to modify the default handlers:
108
+ *
109
+ * ```TypeScript
110
+ * // Rather than importing `defaultEmailHandlers`, you can
111
+ * // import the handlers individually
112
+ * import {
113
+ * orderConfirmationHandler,
114
+ * emailVerificationHandler,
115
+ * passwordResetHandler,
116
+ * emailAddressChangeHandler,
117
+ * } from '\@vendure/email-plugin';
118
+ * import { CustomerService } from '\@vendure/core';
119
+ *
120
+ * // This allows you to then customize each handler to your needs.
121
+ * // For example, let's set a new subject line to the order confirmation:
122
+ * orderConfirmationHandler
123
+ * .setSubject(`We received your order!`);
124
+ *
125
+ * // Another example: loading additional data and setting new
126
+ * // template variables.
127
+ * passwordResetHandler
128
+ * .loadData(async ({ event, injector }) => {
129
+ * const customerService = injector.get(CustomerService);
130
+ * const customer = await customerService.findOneByUserId(event.ctx, event.user.id);
131
+ * return { customer };
132
+ * })
133
+ * .setTemplateVars(event => ({
134
+ * passwordResetToken: event.user.getNativeAuthenticationMethod().passwordResetToken,
135
+ * customer: event.data.customer,
136
+ * }));
137
+ *
138
+ * // Then you pass the handlers to the EmailPlugin init method
139
+ * // individually
140
+ * EmailPlugin.init({
141
+ * handlers: [
142
+ * orderConfirmationHandler,
143
+ * emailVerificationHandler,
144
+ * passwordResetHandler,
145
+ * emailAddressChangeHandler,
146
+ * ],
147
+ * // ...
148
+ * }),
149
+ * ```
150
+ *
151
+ * For all available methods of extending a handler, see the {@link EmailEventHandler} documentation.
90
152
  *
91
153
  * ## Dev mode
92
154
  *
@@ -94,7 +156,7 @@ import { EmailPluginDevModeOptions, EmailPluginOptions } from './types';
94
156
  * file transport (See {@link FileTransportOptions}) and outputs emails as rendered HTML files in the directory specified by the
95
157
  * `outputPath` property.
96
158
  *
97
- * ```ts
159
+ * ```TypeScript
98
160
  * EmailPlugin.init({
99
161
  * devMode: true,
100
162
  * route: 'mailbox',
@@ -140,25 +202,29 @@ import { EmailPluginDevModeOptions, EmailPluginOptions } from './types';
140
202
  *
141
203
  * @docsCategory EmailPlugin
142
204
  */
143
- export declare class EmailPlugin implements OnApplicationBootstrap, NestModule {
205
+ export declare class EmailPlugin implements OnApplicationBootstrap, OnApplicationShutdown, NestModule {
144
206
  private eventBus;
145
207
  private moduleRef;
146
208
  private emailProcessor;
147
209
  private jobQueueService;
148
210
  private processContext;
211
+ private options;
149
212
  private static options;
150
213
  private devMailbox;
151
214
  private jobQueue;
152
215
  private testingProcessor;
153
216
  /** @internal */
154
- constructor(eventBus: EventBus, moduleRef: ModuleRef, emailProcessor: EmailProcessor, jobQueueService: JobQueueService, processContext: ProcessContext);
217
+ constructor(eventBus: EventBus, moduleRef: ModuleRef, emailProcessor: EmailProcessor, jobQueueService: JobQueueService, processContext: ProcessContext, options: EmailPluginOptions);
155
218
  /**
156
219
  * Set the plugin options.
157
220
  */
158
221
  static init(options: EmailPluginOptions | EmailPluginDevModeOptions): Type<EmailPlugin>;
159
222
  /** @internal */
160
223
  onApplicationBootstrap(): Promise<void>;
224
+ onApplicationShutdown(): Promise<void>;
161
225
  configure(consumer: MiddlewareConsumer): void;
226
+ private initInjectableStrategies;
227
+ private destroyInjectableStrategies;
162
228
  private setupEventSubscribers;
163
229
  private handleEvent;
164
230
  }
package/lib/src/plugin.js CHANGED
@@ -8,20 +8,37 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
8
8
  var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
11
14
  var EmailPlugin_1;
12
15
  Object.defineProperty(exports, "__esModule", { value: true });
13
16
  exports.EmailPlugin = void 0;
17
+ const common_1 = require("@nestjs/common");
14
18
  const core_1 = require("@nestjs/core");
15
19
  const core_2 = require("@vendure/core");
16
- const common_1 = require("./common");
20
+ const common_2 = require("./common");
17
21
  const constants_1 = require("./constants");
18
22
  const dev_mailbox_1 = require("./dev-mailbox");
19
23
  const email_processor_1 = require("./email-processor");
20
24
  /**
21
25
  * @description
22
- * The EmailPlugin creates and sends transactional emails based on Vendure events. By default it uses an [MJML](https://mjml.io/)-based
26
+ * The EmailPlugin creates and sends transactional emails based on Vendure events. By default, it uses an [MJML](https://mjml.io/)-based
23
27
  * email generator to generate the email body and [Nodemailer](https://nodemailer.com/about/) to send the emails.
24
28
  *
29
+ * ## High-level description
30
+ * Vendure has an internal events system (see {@link EventBus}) that allows plugins to subscribe to events. The EmailPlugin is configured with
31
+ * {@link EmailEventHandler}s that listen for a specific event and when it is published, the handler defines which template to use to generate
32
+ * the resulting email.
33
+ *
34
+ * The plugin comes with a set of default handlers for the following events:
35
+ * - Order confirmation
36
+ * - New customer email address verification
37
+ * - Password reset request
38
+ * - Email address change request
39
+ *
40
+ * You can also create your own handlers and register them with the plugin - see the {@link EmailEventHandler} docs for more details.
41
+ *
25
42
  * ## Installation
26
43
  *
27
44
  * `yarn add \@vendure/email-plugin`
@@ -39,7 +56,7 @@ const email_processor_1 = require("./email-processor");
39
56
  * plugins: [
40
57
  * EmailPlugin.init({
41
58
  * handlers: defaultEmailHandlers,
42
- * templatePath: path.join(__dirname, 'vendure/email/templates'),
59
+ * templatePath: path.join(__dirname, 'static/email/templates'),
43
60
  * transport: {
44
61
  * type: 'smtp',
45
62
  * host: 'smtp.example.com',
@@ -56,7 +73,7 @@ const email_processor_1 = require("./email-processor");
56
73
  *
57
74
  * ## Email templates
58
75
  *
59
- * In the example above, the plugin has been configured to look in `<app-root>/vendure/email/templates`
76
+ * In the example above, the plugin has been configured to look in `<app-root>/static/email/templates`
60
77
  * for the email template files. If you used `\@vendure/create` to create your application, the templates will have
61
78
  * been copied to that location during setup.
62
79
  *
@@ -99,8 +116,57 @@ const email_processor_1 = require("./email-processor");
99
116
  *
100
117
  * The `defaultEmailHandlers` array defines the default handlers such as for handling new account registration, order confirmation, password reset
101
118
  * etc. These defaults can be extended by adding custom templates for languages other than the default, or even completely new types of emails
102
- * which respond to any of the available [VendureEvents](/docs/typescript-api/events/). See the {@link EmailEventHandler} documentation for
103
- * details on how to do so.
119
+ * which respond to any of the available [VendureEvents](/docs/typescript-api/events/).
120
+ *
121
+ * A good way to learn how to create your own email handlers is to take a look at the
122
+ * [source code of the default handlers](https://github.com/vendure-ecommerce/vendure/blob/master/packages/email-plugin/src/default-email-handlers.ts).
123
+ * New handlers are defined in exactly the same way.
124
+ *
125
+ * It is also possible to modify the default handlers:
126
+ *
127
+ * ```TypeScript
128
+ * // Rather than importing `defaultEmailHandlers`, you can
129
+ * // import the handlers individually
130
+ * import {
131
+ * orderConfirmationHandler,
132
+ * emailVerificationHandler,
133
+ * passwordResetHandler,
134
+ * emailAddressChangeHandler,
135
+ * } from '\@vendure/email-plugin';
136
+ * import { CustomerService } from '\@vendure/core';
137
+ *
138
+ * // This allows you to then customize each handler to your needs.
139
+ * // For example, let's set a new subject line to the order confirmation:
140
+ * orderConfirmationHandler
141
+ * .setSubject(`We received your order!`);
142
+ *
143
+ * // Another example: loading additional data and setting new
144
+ * // template variables.
145
+ * passwordResetHandler
146
+ * .loadData(async ({ event, injector }) => {
147
+ * const customerService = injector.get(CustomerService);
148
+ * const customer = await customerService.findOneByUserId(event.ctx, event.user.id);
149
+ * return { customer };
150
+ * })
151
+ * .setTemplateVars(event => ({
152
+ * passwordResetToken: event.user.getNativeAuthenticationMethod().passwordResetToken,
153
+ * customer: event.data.customer,
154
+ * }));
155
+ *
156
+ * // Then you pass the handlers to the EmailPlugin init method
157
+ * // individually
158
+ * EmailPlugin.init({
159
+ * handlers: [
160
+ * orderConfirmationHandler,
161
+ * emailVerificationHandler,
162
+ * passwordResetHandler,
163
+ * emailAddressChangeHandler,
164
+ * ],
165
+ * // ...
166
+ * }),
167
+ * ```
168
+ *
169
+ * For all available methods of extending a handler, see the {@link EmailEventHandler} documentation.
104
170
  *
105
171
  * ## Dev mode
106
172
  *
@@ -108,7 +174,7 @@ const email_processor_1 = require("./email-processor");
108
174
  * file transport (See {@link FileTransportOptions}) and outputs emails as rendered HTML files in the directory specified by the
109
175
  * `outputPath` property.
110
176
  *
111
- * ```ts
177
+ * ```TypeScript
112
178
  * EmailPlugin.init({
113
179
  * devMode: true,
114
180
  * route: 'mailbox',
@@ -156,12 +222,13 @@ const email_processor_1 = require("./email-processor");
156
222
  */
157
223
  let EmailPlugin = EmailPlugin_1 = class EmailPlugin {
158
224
  /** @internal */
159
- constructor(eventBus, moduleRef, emailProcessor, jobQueueService, processContext) {
225
+ constructor(eventBus, moduleRef, emailProcessor, jobQueueService, processContext, options) {
160
226
  this.eventBus = eventBus;
161
227
  this.moduleRef = moduleRef;
162
228
  this.emailProcessor = emailProcessor;
163
229
  this.jobQueueService = jobQueueService;
164
230
  this.processContext = processContext;
231
+ this.options = options;
165
232
  }
166
233
  /**
167
234
  * Set the plugin options.
@@ -172,12 +239,12 @@ let EmailPlugin = EmailPlugin_1 = class EmailPlugin {
172
239
  }
173
240
  /** @internal */
174
241
  async onApplicationBootstrap() {
175
- const options = EmailPlugin_1.options;
242
+ await this.initInjectableStrategies();
176
243
  await this.setupEventSubscribers();
177
- if (!(0, common_1.isDevModeOptions)(options) && options.transport.type === 'testing') {
244
+ if (!(0, common_2.isDevModeOptions)(this.options) && this.options.transport.type === 'testing') {
178
245
  // When running tests, we don't want to go through the JobQueue system,
179
246
  // so we just call the email sending logic directly.
180
- this.testingProcessor = new email_processor_1.EmailProcessor(options);
247
+ this.testingProcessor = new email_processor_1.EmailProcessor(this.options);
181
248
  await this.testingProcessor.init();
182
249
  }
183
250
  else {
@@ -190,14 +257,35 @@ let EmailPlugin = EmailPlugin_1 = class EmailPlugin {
190
257
  });
191
258
  }
192
259
  }
260
+ async onApplicationShutdown() {
261
+ await this.destroyInjectableStrategies();
262
+ }
193
263
  configure(consumer) {
194
- const options = EmailPlugin_1.options;
195
- if ((0, common_1.isDevModeOptions)(options) && this.processContext.isServer) {
264
+ if ((0, common_2.isDevModeOptions)(this.options) && this.processContext.isServer) {
196
265
  core_2.Logger.info('Creating dev mailbox middleware', constants_1.loggerCtx);
197
266
  this.devMailbox = new dev_mailbox_1.DevMailbox();
198
- consumer.apply(this.devMailbox.serve(options)).forRoutes(options.route);
267
+ consumer.apply(this.devMailbox.serve(this.options)).forRoutes(this.options.route);
199
268
  this.devMailbox.handleMockEvent((handler, event) => this.handleEvent(handler, event));
200
- (0, core_2.registerPluginStartupMessage)('Dev mailbox', options.route);
269
+ (0, core_2.registerPluginStartupMessage)('Dev mailbox', this.options.route);
270
+ }
271
+ }
272
+ async initInjectableStrategies() {
273
+ var _a, _b;
274
+ const injector = new core_2.Injector(this.moduleRef);
275
+ if (typeof ((_a = this.options.emailGenerator) === null || _a === void 0 ? void 0 : _a.init) === 'function') {
276
+ await this.options.emailGenerator.init(injector);
277
+ }
278
+ if (typeof ((_b = this.options.emailSender) === null || _b === void 0 ? void 0 : _b.init) === 'function') {
279
+ await this.options.emailSender.init(injector);
280
+ }
281
+ }
282
+ async destroyInjectableStrategies() {
283
+ var _a, _b;
284
+ if (typeof ((_a = this.options.emailGenerator) === null || _a === void 0 ? void 0 : _a.destroy) === 'function') {
285
+ await this.options.emailGenerator.destroy();
286
+ }
287
+ if (typeof ((_b = this.options.emailSender) === null || _b === void 0 ? void 0 : _b.destroy) === 'function') {
288
+ await this.options.emailSender.destroy();
201
289
  }
202
290
  }
203
291
  async setupEventSubscribers() {
@@ -233,11 +321,12 @@ EmailPlugin = EmailPlugin_1 = __decorate([
233
321
  imports: [core_2.PluginCommonModule],
234
322
  providers: [{ provide: constants_1.EMAIL_PLUGIN_OPTIONS, useFactory: () => EmailPlugin_1.options }, email_processor_1.EmailProcessor],
235
323
  }),
324
+ __param(5, (0, common_1.Inject)(constants_1.EMAIL_PLUGIN_OPTIONS)),
236
325
  __metadata("design:paramtypes", [core_2.EventBus,
237
326
  core_1.ModuleRef,
238
327
  email_processor_1.EmailProcessor,
239
328
  core_2.JobQueueService,
240
- core_2.ProcessContext])
329
+ core_2.ProcessContext, Object])
241
330
  ], EmailPlugin);
242
331
  exports.EmailPlugin = EmailPlugin;
243
332
  //# sourceMappingURL=plugin.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../src/plugin.ts"],"names":[],"mappings":";;;;;;;;;;;;;AACA,uCAAyC;AACzC,wCAWuB;AAEvB,qCAA4C;AAC5C,2CAA8D;AAC9D,+CAA2C;AAC3C,uDAAmD;AASnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwIG;AAKH,IAAa,WAAW,mBAAxB,MAAa,WAAW;IAMpB,gBAAgB;IAChB,YACY,QAAkB,EAClB,SAAoB,EACpB,cAA8B,EAC9B,eAAgC,EAChC,cAA8B;QAJ9B,aAAQ,GAAR,QAAQ,CAAU;QAClB,cAAS,GAAT,SAAS,CAAW;QACpB,mBAAc,GAAd,cAAc,CAAgB;QAC9B,oBAAe,GAAf,eAAe,CAAiB;QAChC,mBAAc,GAAd,cAAc,CAAgB;IACvC,CAAC;IAEJ;;OAEG;IACH,MAAM,CAAC,IAAI,CAAC,OAAuD;QAC/D,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,OAAO,aAAW,CAAC;IACvB,CAAC;IAED,gBAAgB;IAChB,KAAK,CAAC,sBAAsB;QACxB,MAAM,OAAO,GAAG,aAAW,CAAC,OAAO,CAAC;QAEpC,MAAM,IAAI,CAAC,qBAAqB,EAAE,CAAC;QACnC,IAAI,CAAC,IAAA,yBAAgB,EAAC,OAAO,CAAC,IAAI,OAAO,CAAC,SAAS,CAAC,IAAI,KAAK,SAAS,EAAE;YACpE,uEAAuE;YACvE,oDAAoD;YACpD,IAAI,CAAC,gBAAgB,GAAG,IAAI,gCAAc,CAA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
2
2
  import { Omit } from '@vendure/common/lib/omit';
3
3
  import { Injector, RequestContext, VendureEvent } from '@vendure/core';
4
4
  import { Attachment } from 'nodemailer/lib/mailer';
5
+ import SMTPTransport from 'nodemailer/lib/smtp-transport';
6
+ import { EmailGenerator } from './email-generator';
7
+ import { EmailSender } from './email-sender';
5
8
  import { EmailEventHandler } from './event-handler';
6
9
  /**
7
10
  * @description
@@ -50,7 +53,7 @@ export interface EmailPluginOptions {
50
53
  * An array of {@link EmailEventHandler}s which define which Vendure events will trigger
51
54
  * emails, and how those emails are generated.
52
55
  */
53
- handlers: EmailEventHandler[];
56
+ handlers: Array<EmailEventHandler<string, any>>;
54
57
  /**
55
58
  * @description
56
59
  * An object containing variables which are made available to all templates. For example,
@@ -97,19 +100,6 @@ export interface EmailPluginDevModeOptions extends Omit<EmailPluginOptions, 'tra
97
100
  */
98
101
  route: string;
99
102
  }
100
- /**
101
- * @description
102
- * The credentials used for sending email via SMTP
103
- *
104
- * @docsCategory EmailPlugin
105
- * @docsPage Email Plugin Types
106
- */
107
- export interface SMTPCredentials {
108
- /** @description The username */
109
- user: string;
110
- /** @description The password */
111
- pass: string;
112
- }
113
103
  /**
114
104
  * @description
115
105
  * A union of all the possible transport options for sending emails.
@@ -120,58 +110,13 @@ export interface SMTPCredentials {
120
110
  export declare type EmailTransportOptions = SMTPTransportOptions | SendmailTransportOptions | FileTransportOptions | NoopTransportOptions | TestingTransportOptions;
121
111
  /**
122
112
  * @description
123
- * A subset of the SMTP transport options of [Nodemailer](https://nodemailer.com/smtp/)
113
+ * The SMTP transport options of [Nodemailer](https://nodemailer.com/smtp/)
124
114
  *
125
115
  * @docsCategory EmailPlugin
126
116
  * @docsPage Transport Options
127
117
  */
128
- export interface SMTPTransportOptions {
118
+ export interface SMTPTransportOptions extends SMTPTransport.Options {
129
119
  type: 'smtp';
130
- /**
131
- * @description
132
- * the hostname or IP address to connect to (defaults to ‘localhost’)
133
- */
134
- host: string;
135
- /**
136
- * @description
137
- * The port to connect to (defaults to 25 or 465)
138
- */
139
- port: number;
140
- /**
141
- * @description
142
- * Defines authentication data
143
- */
144
- auth: SMTPCredentials;
145
- /**
146
- * @description
147
- * Defines if the connection should use SSL (if true) or not (if false)
148
- */
149
- secure?: boolean;
150
- /**
151
- * @description
152
- * Turns off STARTTLS support if true
153
- */
154
- ignoreTLS?: boolean;
155
- /**
156
- * @description
157
- * Forces the client to use STARTTLS. Returns an error if upgrading the connection is not possible or fails.
158
- */
159
- requireTLS?: boolean;
160
- /**
161
- * @description
162
- * Optional hostname of the client, used for identifying to the server
163
- */
164
- name?: string;
165
- /**
166
- * @description
167
- * The local interface to bind to for network connections
168
- */
169
- localAddress?: string;
170
- /**
171
- * @description
172
- * Defines preferred authentication method, e.g. ‘PLAIN’
173
- */
174
- authMethod?: string;
175
120
  /**
176
121
  * @description
177
122
  * If true, uses the configured {@link VendureLogger} to log messages from Nodemailer as it interacts with
@@ -180,20 +125,6 @@ export interface SMTPTransportOptions {
180
125
  * @default false
181
126
  */
182
127
  logging?: boolean;
183
- /**
184
- * @description
185
- * If set to true, then logs SMTP traffic without message content.
186
- *
187
- * @default false
188
- */
189
- transactionLog?: boolean;
190
- /**
191
- * @description
192
- * If set to true, then logs SMTP traffic and message content, otherwise logs only transaction events.
193
- *
194
- * @default false
195
- */
196
- debug?: boolean;
197
128
  }
198
129
  /**
199
130
  * @description
@@ -266,72 +197,6 @@ export interface TestingTransportOptions {
266
197
  */
267
198
  onSend: (details: EmailDetails) => void;
268
199
  }
269
- /**
270
- * @description
271
- * An EmailSender is responsible for sending the email, e.g. via an SMTP connection
272
- * or using some other mail-sending API. By default, the EmailPlugin uses the
273
- * {@link NodemailerEmailSender}, but it is also possible to supply a custom implementation:
274
- *
275
- * @example
276
- * ```TypeScript
277
- * const sgMail = require('\@sendgrid/mail');
278
- *
279
- * sgMail.setApiKey(process.env.SENDGRID_API_KEY);
280
- *
281
- * class SendgridEmailSender implements EmailSender {
282
- * async send(email: EmailDetails) {
283
- * await sgMail.send({
284
- * to: email.recipient,
285
- * from: email.from,
286
- * subject: email.subject,
287
- * html: email.body,
288
- * });
289
- * }
290
- * }
291
- *
292
- * const config: VendureConfig = {
293
- * logger: new DefaultLogger({ level: LogLevel.Debug })
294
- * // ...
295
- * plugins: [
296
- * EmailPlugin.init({
297
- * // ... template, handlers config omitted
298
- * transport: { type: 'none' },
299
- * emailSender: new SendgridEmailSender(),
300
- * }),
301
- * ],
302
- * };
303
- * ```
304
- *
305
- * @docsCategory EmailPlugin
306
- * @docsPage EmailSender
307
- * @docsWeight 0
308
- */
309
- export interface EmailSender {
310
- send: (email: EmailDetails, options: EmailTransportOptions) => void | Promise<void>;
311
- }
312
- /**
313
- * @description
314
- * An EmailGenerator generates the subject and body details of an email.
315
- *
316
- * @docsCategory EmailPlugin
317
- * @docsPage EmailGenerator
318
- * @docsWeight 0
319
- */
320
- export interface EmailGenerator<T extends string = any, E extends VendureEvent = any> {
321
- /**
322
- * @description
323
- * Any necessary setup can be performed here.
324
- */
325
- onInit?(options: EmailPluginOptions): void | Promise<void>;
326
- /**
327
- * @description
328
- * Given a subject and body from an email template, this method generates the final
329
- * interpolated email text.
330
- */
331
- generate(from: string, subject: string, body: string, templateVars: {
332
- [key: string]: any;
333
- }): Pick<EmailDetails, 'from' | 'subject' | 'body'>;
334
- }
335
200
  /**
336
201
  * @description
337
202
  * A function used to load async data for use by an {@link EmailEventHandler}.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vendure/email-plugin",
3
- "version": "2.0.0-next.2",
3
+ "version": "2.0.0-next.21",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -35,10 +35,10 @@
35
35
  "@types/fs-extra": "^9.0.1",
36
36
  "@types/handlebars": "^4.1.0",
37
37
  "@types/mjml": "^4.0.4",
38
- "@vendure/common": "^2.0.0-next.2",
39
- "@vendure/core": "^2.0.0-next.2",
38
+ "@vendure/common": "^2.0.0-next.21",
39
+ "@vendure/core": "^2.0.0-next.21",
40
40
  "rimraf": "^3.0.2",
41
41
  "typescript": "4.5.5"
42
42
  },
43
- "gitHead": "f43f66b38d5f884c3a2605388b9352162996065c"
43
+ "gitHead": "a1f3cffd598a0c634f86934b70e7c551c3817860"
44
44
  }