Skip to content

Commit

Permalink
feat(email-plugin): Expose template vars to template loader (#2243)
Browse files Browse the repository at this point in the history
Closes #2242
  • Loading branch information
StampixSMO authored Jun 28, 2023
1 parent 3353c6e commit 78ea016
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ and return the template as a string.
import { EmailPlugin, TemplateLoader } from '@vendure/email-plugin';

class MyTemplateLoader implements TemplateLoader {
loadTemplate(injector, ctx, { type, templateName }){
loadTemplate(injector, ctx, { type, templateName, templateVars }){
return myCustomTemplateFunction(ctx);
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/email-plugin/src/email-processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export class EmailProcessor {
{
templateName: data.templateFile,
type: data.type,
templateVars: data.templateVars,
},
);
const generated = this.generator.generate(data.from, data.subject, bodySource, data.templateVars);
Expand Down
1 change: 1 addition & 0 deletions packages/email-plugin/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ export interface EmailTemplateConfig {
export interface LoadTemplateInput {
type: string;
templateName: string;
templateVars: any;
}

export interface Partial {
Expand Down

0 comments on commit 78ea016

Please sign in to comment.