@vendure/email-plugin 2.2.0-next.0 → 2.2.0-next.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/README.md +1 -1
- package/lib/src/default-email-handlers.d.ts +6 -0
- package/lib/src/default-email-handlers.js +6 -0
- package/lib/src/default-email-handlers.js.map +1 -1
- package/lib/src/plugin.d.ts +11 -12
- package/lib/src/plugin.js +11 -12
- package/lib/src/plugin.js.map +1 -1
- package/lib/src/template-loader.d.ts +6 -1
- package/lib/src/template-loader.js +7 -2
- package/lib/src/template-loader.js.map +1 -1
- package/lib/src/types.d.ts +6 -3
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -4,4 +4,4 @@ The `EmailPlugin` generates and sends emails based on Vendure server events.
|
|
|
4
4
|
|
|
5
5
|
`npm install @vendure/email-plugin`
|
|
6
6
|
|
|
7
|
-
For documentation, see [docs.vendure.io/
|
|
7
|
+
For documentation, see [docs.vendure.io/reference/core-plugins/email-plugin/](https://docs.vendure.io/reference/core-plugins/email-plugin/)
|
|
@@ -16,11 +16,17 @@ export declare const defaultEmailHandlers: Array<EmailEventHandler<any, any>>;
|
|
|
16
16
|
* applicable in this context. So we need to do it manually.
|
|
17
17
|
*
|
|
18
18
|
* **Note: Mutates the Order object**
|
|
19
|
+
*
|
|
20
|
+
* @docsCategory core plugins/EmailPlugin
|
|
21
|
+
* @docsPage Email utils
|
|
19
22
|
*/
|
|
20
23
|
export declare function transformOrderLineAssetUrls(ctx: RequestContext, order: Order, injector: Injector): Order;
|
|
21
24
|
/**
|
|
22
25
|
* @description
|
|
23
26
|
* Ensures that the ShippingLines are hydrated so that we can use the
|
|
24
27
|
* `shippingMethod.name` property in the email template.
|
|
28
|
+
*
|
|
29
|
+
* @docsCategory core plugins/EmailPlugin
|
|
30
|
+
* @docsPage Email utils
|
|
25
31
|
*/
|
|
26
32
|
export declare function hydrateShippingLines(ctx: RequestContext, order: Order, injector: Injector): Promise<ShippingLine[]>;
|
|
@@ -65,6 +65,9 @@ exports.defaultEmailHandlers = [
|
|
|
65
65
|
* applicable in this context. So we need to do it manually.
|
|
66
66
|
*
|
|
67
67
|
* **Note: Mutates the Order object**
|
|
68
|
+
*
|
|
69
|
+
* @docsCategory core plugins/EmailPlugin
|
|
70
|
+
* @docsPage Email utils
|
|
68
71
|
*/
|
|
69
72
|
function transformOrderLineAssetUrls(ctx, order, injector) {
|
|
70
73
|
const { assetStorageStrategy } = injector.get(core_1.ConfigService).assetOptions;
|
|
@@ -83,6 +86,9 @@ exports.transformOrderLineAssetUrls = transformOrderLineAssetUrls;
|
|
|
83
86
|
* @description
|
|
84
87
|
* Ensures that the ShippingLines are hydrated so that we can use the
|
|
85
88
|
* `shippingMethod.name` property in the email template.
|
|
89
|
+
*
|
|
90
|
+
* @docsCategory core plugins/EmailPlugin
|
|
91
|
+
* @docsPage Email utils
|
|
86
92
|
*/
|
|
87
93
|
async function hydrateShippingLines(ctx, order, injector) {
|
|
88
94
|
const shippingLines = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default-email-handlers.js","sourceRoot":"","sources":["../../src/default-email-handlers.ts"],"names":[],"mappings":";;;AAAA,6DAA6D;AAC7D,wCAauB;AAIvB,qDAAsD;AACtD,+CAKuB;AAEV,QAAA,wBAAwB,GAAG,IAAI,mCAAkB,CAAC,oBAAoB,CAAC;KAC/E,EAAE,CAAC,gCAAyB,CAAC;KAC7B,MAAM,CACH,KAAK,CAAC,EAAE,CACJ,KAAK,CAAC,OAAO,KAAK,gBAAgB,IAAI,KAAK,CAAC,SAAS,KAAK,WAAW,IAAI,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CACtG;KACA,QAAQ,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE;IACpC,2BAA2B,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC9D,MAAM,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C5B;KACJ;IACD,OAAO,aAAa,CAAC;AACzB,CAAC;AAjBD,oDAiBC"}
|
package/lib/src/plugin.d.ts
CHANGED
|
@@ -9,9 +9,8 @@ import { EmailPluginDevModeOptions, EmailPluginOptions, InitializedEmailPluginOp
|
|
|
9
9
|
* email generator to generate the email body and [Nodemailer](https://nodemailer.com/about/) to send the emails.
|
|
10
10
|
*
|
|
11
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
|
-
*
|
|
14
|
-
* the resulting email.
|
|
12
|
+
* Vendure has an internal events system (see {@link EventBus}) that allows plugins to subscribe to events. The EmailPlugin is configured with {@link EmailEventHandler}s
|
|
13
|
+
* that listen for a specific event and when it is published, the handler defines which template to use to generate the resulting email.
|
|
15
14
|
*
|
|
16
15
|
* The plugin comes with a set of default handlers for the following events:
|
|
17
16
|
* - Order confirmation
|
|
@@ -79,7 +78,7 @@ import { EmailPluginDevModeOptions, EmailPluginOptions, InitializedEmailPluginOp
|
|
|
79
78
|
*
|
|
80
79
|
* Dynamic data such as the recipient's name or order items are specified using [Handlebars syntax](https://handlebarsjs.com/):
|
|
81
80
|
*
|
|
82
|
-
* ```
|
|
81
|
+
* ```html
|
|
83
82
|
* <p>Dear {{ order.customer.firstName }} {{ order.customer.lastName }},</p>
|
|
84
83
|
*
|
|
85
84
|
* <p>Thank you for your order!</p>
|
|
@@ -127,12 +126,12 @@ import { EmailPluginDevModeOptions, EmailPluginOptions, InitializedEmailPluginOp
|
|
|
127
126
|
*
|
|
128
127
|
* // This allows you to then customize each handler to your needs.
|
|
129
128
|
* // For example, let's set a new subject line to the order confirmation:
|
|
130
|
-
* orderConfirmationHandler
|
|
129
|
+
* const myOrderConfirmationHandler = orderConfirmationHandler
|
|
131
130
|
* .setSubject(`We received your order!`);
|
|
132
131
|
*
|
|
133
132
|
* // Another example: loading additional data and setting new
|
|
134
133
|
* // template variables.
|
|
135
|
-
* passwordResetHandler
|
|
134
|
+
* const myPasswordResetHandler = passwordResetHandler
|
|
136
135
|
* .loadData(async ({ event, injector }) => {
|
|
137
136
|
* const customerService = injector.get(CustomerService);
|
|
138
137
|
* const customer = await customerService.findOneByUserId(event.ctx, event.user.id);
|
|
@@ -147,9 +146,9 @@ import { EmailPluginDevModeOptions, EmailPluginOptions, InitializedEmailPluginOp
|
|
|
147
146
|
* // individually
|
|
148
147
|
* EmailPlugin.init({
|
|
149
148
|
* handlers: [
|
|
150
|
-
*
|
|
149
|
+
* myOrderConfirmationHandler,
|
|
150
|
+
* myPasswordResetHandler,
|
|
151
151
|
* emailVerificationHandler,
|
|
152
|
-
* passwordResetHandler,
|
|
153
152
|
* emailAddressChangeHandler,
|
|
154
153
|
* ],
|
|
155
154
|
* // ...
|
|
@@ -177,10 +176,10 @@ import { EmailPluginDevModeOptions, EmailPluginOptions, InitializedEmailPluginOp
|
|
|
177
176
|
* return injector.get(MyTransportService).getSettings(ctx);
|
|
178
177
|
* } else {
|
|
179
178
|
* return {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
179
|
+
* type: 'smtp',
|
|
180
|
+
* host: 'smtp.example.com',
|
|
181
|
+
* // ... etc.
|
|
182
|
+
* }
|
|
184
183
|
* }
|
|
185
184
|
* }
|
|
186
185
|
* }),
|
package/lib/src/plugin.js
CHANGED
|
@@ -28,9 +28,8 @@ const template_loader_1 = require("./template-loader");
|
|
|
28
28
|
* email generator to generate the email body and [Nodemailer](https://nodemailer.com/about/) to send the emails.
|
|
29
29
|
*
|
|
30
30
|
* ## High-level description
|
|
31
|
-
* Vendure has an internal events system (see {@link EventBus}) that allows plugins to subscribe to events. The EmailPlugin is configured with
|
|
32
|
-
*
|
|
33
|
-
* the resulting email.
|
|
31
|
+
* Vendure has an internal events system (see {@link EventBus}) that allows plugins to subscribe to events. The EmailPlugin is configured with {@link EmailEventHandler}s
|
|
32
|
+
* that listen for a specific event and when it is published, the handler defines which template to use to generate the resulting email.
|
|
34
33
|
*
|
|
35
34
|
* The plugin comes with a set of default handlers for the following events:
|
|
36
35
|
* - Order confirmation
|
|
@@ -98,7 +97,7 @@ const template_loader_1 = require("./template-loader");
|
|
|
98
97
|
*
|
|
99
98
|
* Dynamic data such as the recipient's name or order items are specified using [Handlebars syntax](https://handlebarsjs.com/):
|
|
100
99
|
*
|
|
101
|
-
* ```
|
|
100
|
+
* ```html
|
|
102
101
|
* <p>Dear {{ order.customer.firstName }} {{ order.customer.lastName }},</p>
|
|
103
102
|
*
|
|
104
103
|
* <p>Thank you for your order!</p>
|
|
@@ -146,12 +145,12 @@ const template_loader_1 = require("./template-loader");
|
|
|
146
145
|
*
|
|
147
146
|
* // This allows you to then customize each handler to your needs.
|
|
148
147
|
* // For example, let's set a new subject line to the order confirmation:
|
|
149
|
-
* orderConfirmationHandler
|
|
148
|
+
* const myOrderConfirmationHandler = orderConfirmationHandler
|
|
150
149
|
* .setSubject(`We received your order!`);
|
|
151
150
|
*
|
|
152
151
|
* // Another example: loading additional data and setting new
|
|
153
152
|
* // template variables.
|
|
154
|
-
* passwordResetHandler
|
|
153
|
+
* const myPasswordResetHandler = passwordResetHandler
|
|
155
154
|
* .loadData(async ({ event, injector }) => {
|
|
156
155
|
* const customerService = injector.get(CustomerService);
|
|
157
156
|
* const customer = await customerService.findOneByUserId(event.ctx, event.user.id);
|
|
@@ -166,9 +165,9 @@ const template_loader_1 = require("./template-loader");
|
|
|
166
165
|
* // individually
|
|
167
166
|
* EmailPlugin.init({
|
|
168
167
|
* handlers: [
|
|
169
|
-
*
|
|
168
|
+
* myOrderConfirmationHandler,
|
|
169
|
+
* myPasswordResetHandler,
|
|
170
170
|
* emailVerificationHandler,
|
|
171
|
-
* passwordResetHandler,
|
|
172
171
|
* emailAddressChangeHandler,
|
|
173
172
|
* ],
|
|
174
173
|
* // ...
|
|
@@ -196,10 +195,10 @@ const template_loader_1 = require("./template-loader");
|
|
|
196
195
|
* return injector.get(MyTransportService).getSettings(ctx);
|
|
197
196
|
* } else {
|
|
198
197
|
* return {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
198
|
+
* type: 'smtp',
|
|
199
|
+
* host: 'smtp.example.com',
|
|
200
|
+
* // ... etc.
|
|
201
|
+
* }
|
|
203
202
|
* }
|
|
204
203
|
* }
|
|
205
204
|
* }),
|
package/lib/src/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../src/plugin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAMwB;AACxB,uCAAyC;AACzC,wCAauB;AAGvB,qCAAsE;AACtE,2CAA8D;AAC9D,+CAA2C;AAC3C,uDAAmD;AAEnD,uDAA4D;AAU5D
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../src/plugin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAMwB;AACxB,uCAAyC;AACzC,wCAauB;AAGvB,qCAAsE;AACtE,2CAA8D;AAC9D,+CAA2C;AAC3C,uDAAmD;AAEnD,uDAA4D;AAU5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2OG;AAMI,IAAM,WAAW,mBAAjB,MAAM,WAAW;IAMpB,gBAAgB;IAChB,YACY,QAAkB,EAClB,SAAoB,EACpB,cAA8B,EAC9B,eAAgC,EAChC,cAA8B,EACA,OAAsC;QALpE,aAAQ,GAAR,QAAQ,CAAU;QAClB,cAAS,GAAT,SAAS,CAAW;QACpB,mBAAc,GAAd,cAAc,CAAgB;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9C,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,MAAM,CAC/B,KAAY,EACZ,aAAW,CAAC,OAAO,CAAC,kBAAkB,EACtC,QAAQ,CACX,CAAC;YACF,IAAI,CAAC,MAAM,EAAE;gBACT,OAAO;aACV;YACD,IAAI,IAAI,CAAC,QAAQ,EAAE;gBACf,MAAM,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;aACnD;iBAAM,IAAI,IAAI,CAAC,gBAAgB,EAAE;gBAC9B,MAAM,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;aAC/C;SACJ;QAAC,OAAO,CAAM,EAAE;YACb,aAAM,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,qBAAS,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;SAC/C;IACL,CAAC;CACJ,CAAA;AAzHY,WAAW;IALvB,IAAA,oBAAa,EAAC;QACX,OAAO,EAAE,CAAC,yBAAkB,CAAC;QAC7B,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,gCAAoB,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,aAAW,CAAC,OAAO,EAAE,EAAE,gCAAc,CAAC;QACrG,aAAa,EAAE,QAAQ;KAC1B,CAAC;IAcO,WAAA,IAAA,eAAM,EAAC,gCAAoB,CAAC,CAAA;qCALX,eAAQ;QACP,gBAAS;QACJ,gCAAc;QACb,sBAAe;QAChB,qBAAc;GAZjC,WAAW,CAyHvB;AAzHY,kCAAW"}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { Injector, RequestContext } from '@vendure/core';
|
|
2
2
|
import { LoadTemplateInput, Partial, TemplateLoader } from './types';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* @description
|
|
5
|
+
* Loads email templates from the local file system. This is the default
|
|
6
|
+
* loader used by the EmailPlugin.
|
|
7
|
+
*
|
|
8
|
+
* @docsCategory core plugins/EmailPlugin
|
|
9
|
+
* @docsPage TemplateLoader
|
|
5
10
|
*/
|
|
6
11
|
export declare class FileBasedTemplateLoader implements TemplateLoader {
|
|
7
12
|
private templatePath;
|
|
@@ -7,7 +7,12 @@ exports.FileBasedTemplateLoader = void 0;
|
|
|
7
7
|
const promises_1 = __importDefault(require("fs/promises"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* @description
|
|
11
|
+
* Loads email templates from the local file system. This is the default
|
|
12
|
+
* loader used by the EmailPlugin.
|
|
13
|
+
*
|
|
14
|
+
* @docsCategory core plugins/EmailPlugin
|
|
15
|
+
* @docsPage TemplateLoader
|
|
11
16
|
*/
|
|
12
17
|
class FileBasedTemplateLoader {
|
|
13
18
|
constructor(templatePath) {
|
|
@@ -23,7 +28,7 @@ class FileBasedTemplateLoader {
|
|
|
23
28
|
return Promise.all(partialsFiles.map(async (file) => {
|
|
24
29
|
return {
|
|
25
30
|
name: path_1.default.basename(file, '.hbs'),
|
|
26
|
-
content: await promises_1.default.readFile(path_1.default.join(partialsPath, file), 'utf-8')
|
|
31
|
+
content: await promises_1.default.readFile(path_1.default.join(partialsPath, file), 'utf-8'),
|
|
27
32
|
};
|
|
28
33
|
}));
|
|
29
34
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template-loader.js","sourceRoot":"","sources":["../../src/template-loader.ts"],"names":[],"mappings":";;;;;;AACA,2DAA6B;AAC7B,gDAAwB;
|
|
1
|
+
{"version":3,"file":"template-loader.js","sourceRoot":"","sources":["../../src/template-loader.ts"],"names":[],"mappings":";;;;;;AACA,2DAA6B;AAC7B,gDAAwB;AAIxB;;;;;;;GAOG;AACH,MAAa,uBAAuB;IAChC,YAAoB,YAAoB;QAApB,iBAAY,GAAZ,YAAY,CAAQ;IAAG,CAAC;IAE5C,KAAK,CAAC,YAAY,CACd,SAAmB,EACnB,IAAoB,EACpB,EAAE,IAAI,EAAE,YAAY,EAAqB;QAEzC,MAAM,YAAY,GAAG,cAAI,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;QACtE,OAAO,kBAAE,CAAC,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IAC9C,CAAC;IAED,KAAK,CAAC,YAAY;QACd,MAAM,YAAY,GAAG,cAAI,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;QAC9D,MAAM,aAAa,GAAG,MAAM,kBAAE,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QACrD,OAAO,OAAO,CAAC,GAAG,CACd,aAAa,CAAC,GAAG,CAAC,KAAK,EAAC,IAAI,EAAC,EAAE;YAC3B,OAAO;gBACH,IAAI,EAAE,cAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBACjC,OAAO,EAAE,MAAM,kBAAE,CAAC,QAAQ,CAAC,cAAI,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,EAAE,OAAO,CAAC;aACrE,CAAC;QACN,CAAC,CAAC,CACL,CAAC;IACN,CAAC;CACJ;AAxBD,0DAwBC"}
|
package/lib/src/types.d.ts
CHANGED
|
@@ -340,7 +340,7 @@ export interface Partial {
|
|
|
340
340
|
}
|
|
341
341
|
/**
|
|
342
342
|
* @description
|
|
343
|
-
*
|
|
343
|
+
* Loads email templates based on the given request context, type and template name
|
|
344
344
|
* and return the template as a string.
|
|
345
345
|
*
|
|
346
346
|
* @example
|
|
@@ -362,16 +362,19 @@ export interface Partial {
|
|
|
362
362
|
* ```
|
|
363
363
|
*
|
|
364
364
|
* @docsCategory core plugins/EmailPlugin
|
|
365
|
-
* @docsPage
|
|
365
|
+
* @docsPage TemplateLoader
|
|
366
|
+
* @docsWeight 0
|
|
366
367
|
*/
|
|
367
368
|
export interface TemplateLoader {
|
|
368
369
|
/**
|
|
370
|
+
* @description
|
|
369
371
|
* Load template and return it's content as a string
|
|
370
372
|
*/
|
|
371
373
|
loadTemplate(injector: Injector, ctx: RequestContext, input: LoadTemplateInput): Promise<string>;
|
|
372
374
|
/**
|
|
375
|
+
* @description
|
|
373
376
|
* Load partials and return their contents.
|
|
374
|
-
* This method is only called during
|
|
377
|
+
* This method is only called during initialization, i.e. during server startup.
|
|
375
378
|
*/
|
|
376
379
|
loadPartials?(): Promise<Partial[]>;
|
|
377
380
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vendure/email-plugin",
|
|
3
|
-
"version": "2.2.0-next.
|
|
3
|
+
"version": "2.2.0-next.1",
|
|
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.2.0-next.
|
|
39
|
-
"@vendure/core": "2.2.0-next.
|
|
38
|
+
"@vendure/common": "2.2.0-next.1",
|
|
39
|
+
"@vendure/core": "2.2.0-next.1",
|
|
40
40
|
"rimraf": "^3.0.2",
|
|
41
41
|
"typescript": "4.9.5"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "558d9fc1be780beed364221e83421bfb2942aa66"
|
|
44
44
|
}
|