|
|
@@ -26,7 +26,7 @@ import { isDevModeOptions, resolveTransportSettings } from './common';
|
|
|
import { EMAIL_PLUGIN_OPTIONS, loggerCtx } from './constants';
|
|
|
import { DevMailbox } from './dev-mailbox';
|
|
|
import { EmailProcessor } from './email-processor';
|
|
|
-import { EmailEventHandler, EmailEventHandlerWithAsyncData } from './event-handler';
|
|
|
+import { EmailEventHandler, EmailEventHandlerWithAsyncData } from './handler/event-handler';
|
|
|
import { FileBasedTemplateLoader } from './template-loader';
|
|
|
import {
|
|
|
EmailPluginDevModeOptions,
|
|
|
@@ -46,13 +46,13 @@ import {
|
|
|
* Vendure has an internal events system (see {@link EventBus}) that allows plugins to subscribe to events. The EmailPlugin is configured with {@link EmailEventHandler}s
|
|
|
* that listen for a specific event and when it is published, the handler defines which template to use to generate the resulting email.
|
|
|
*
|
|
|
- * The plugin comes with a set of default handlers for the following events:
|
|
|
+ * The plugin comes with a set of default handler for the following events:
|
|
|
* - Order confirmation
|
|
|
* - New customer email address verification
|
|
|
* - Password reset request
|
|
|
* - Email address change request
|
|
|
*
|
|
|
- * You can also create your own handlers and register them with the plugin - see the {@link EmailEventHandler} docs for more details.
|
|
|
+ * You can also create your own handler and register them with the plugin - see the {@link EmailEventHandler} docs for more details.
|
|
|
*
|
|
|
* ## Installation
|
|
|
*
|
|
|
@@ -70,7 +70,7 @@ import {
|
|
|
* // Add an instance of the plugin to the plugins array
|
|
|
* plugins: [
|
|
|
* EmailPlugin.init({
|
|
|
- * handlers: defaultEmailHandlers,
|
|
|
+ * handler: defaultEmailHandlers,
|
|
|
* templatePath: path.join(__dirname, 'static/email/templates'),
|
|
|
* transport: {
|
|
|
* type: 'smtp',
|
|
|
@@ -135,21 +135,21 @@ import {
|
|
|
* * `formatMoney`: Formats an amount of money (which are always stored as integers in Vendure) as a decimal, e.g. `123` => `1.23`
|
|
|
* * `formatDate`: Formats a Date value with the [dateformat](https://www.npmjs.com/package/dateformat) package.
|
|
|
*
|
|
|
- * ## Extending the default email handlers
|
|
|
+ * ## Extending the default email handler
|
|
|
*
|
|
|
- * The `defaultEmailHandlers` array defines the default handlers such as for handling new account registration, order confirmation, password reset
|
|
|
+ * The `defaultEmailHandlers` array defines the default handler such as for handling new account registration, order confirmation, password reset
|
|
|
* etc. These defaults can be extended by adding custom templates for languages other than the default, or even completely new types of emails
|
|
|
* which respond to any of the available [VendureEvents](/reference/typescript-api/events/).
|
|
|
*
|
|
|
- * A good way to learn how to create your own email handlers is to take a look at the
|
|
|
- * [source code of the default handlers](https://github.com/vendure-ecommerce/vendure/blob/master/packages/email-plugin/src/default-email-handlers.ts).
|
|
|
- * New handlers are defined in exactly the same way.
|
|
|
+ * A good way to learn how to create your own email handler is to take a look at the
|
|
|
+ * [source code of the default handler](https://github.com/vendure-ecommerce/vendure/blob/master/packages/email-plugin/src/default-email-handlers.ts).
|
|
|
+ * New handler are defined in exactly the same way.
|
|
|
*
|
|
|
- * It is also possible to modify the default handlers:
|
|
|
+ * It is also possible to modify the default handler:
|
|
|
*
|
|
|
* ```ts
|
|
|
* // Rather than importing `defaultEmailHandlers`, you can
|
|
|
- * // import the handlers individually
|
|
|
+ * // import the handler individually
|
|
|
* import {
|
|
|
* orderConfirmationHandler,
|
|
|
* emailVerificationHandler,
|
|
|
@@ -176,10 +176,10 @@ import {
|
|
|
* customer: event.data.customer,
|
|
|
* }));
|
|
|
*
|
|
|
- * // Then you pass the handlers to the EmailPlugin init method
|
|
|
+ * // Then you pass the handler to the EmailPlugin init method
|
|
|
* // individually
|
|
|
* EmailPlugin.init({
|
|
|
- * handlers: [
|
|
|
+ * handler: [
|
|
|
* myOrderConfirmationHandler,
|
|
|
* myPasswordResetHandler,
|
|
|
* emailVerificationHandler,
|
|
|
@@ -203,7 +203,7 @@ import {
|
|
|
* const config: VendureConfig = {
|
|
|
* plugins: [
|
|
|
* EmailPlugin.init({
|
|
|
- * handlers: defaultEmailHandlers,
|
|
|
+ * handler: defaultEmailHandlers,
|
|
|
* templatePath: path.join(__dirname, 'static/email/templates'),
|
|
|
* transport: (injector, ctx) => {
|
|
|
* if (ctx) {
|
|
|
@@ -231,7 +231,7 @@ import {
|
|
|
* EmailPlugin.init({
|
|
|
* devMode: true,
|
|
|
* route: 'mailbox',
|
|
|
- * handlers: defaultEmailHandlers,
|
|
|
+ * handler: defaultEmailHandlers,
|
|
|
* templatePath: path.join(__dirname, 'vendure/email/templates'),
|
|
|
* outputPath: path.join(__dirname, 'test-emails'),
|
|
|
* })
|