diff --git a/api/nest-cli.json b/api/nest-cli.json index 17ba0936..245d2952 100644 --- a/api/nest-cli.json +++ b/api/nest-cli.json @@ -4,6 +4,9 @@ "sourceRoot": "src", "compilerOptions": { "deleteOutDir": true, - "assets": [{ "include": "config/i18n/**/*", "watchAssets": true }] + "assets": [ + { "include": "config/i18n/**/*", "watchAssets": true }, + { "include": "templates/**/*.mjml", "watchAssets": true } + ] } } diff --git a/api/patches/@nestjs-modules+mailer+1.11.2.patch b/api/patches/@nestjs-modules+mailer+1.11.2.patch index b346b9f8..f100ec72 100644 --- a/api/patches/@nestjs-modules+mailer+1.11.2.patch +++ b/api/patches/@nestjs-modules+mailer+1.11.2.patch @@ -1,3 +1,30 @@ +diff --git a/node_modules/@nestjs-modules/mailer/dist/adapters/mjml.adapter.js b/node_modules/@nestjs-modules/mailer/dist/adapters/mjml.adapter.js +index 5eb7a4a..afaaaa9 100644 +--- a/node_modules/@nestjs-modules/mailer/dist/adapters/mjml.adapter.js ++++ b/node_modules/@nestjs-modules/mailer/dist/adapters/mjml.adapter.js +@@ -26,8 +26,20 @@ class MjmlAdapter { + compile(mail, callback, mailerOptions) { + var _a; + (_a = this === null || this === void 0 ? void 0 : this.engine) === null || _a === void 0 ? void 0 : _a.compile(mail, () => { +- mail.data.html = mjml2html(mail.data.html).html; +- callback(); ++ Promise.resolve(mail.data.html).then((html) => { ++ Promise.resolve(mjml2html(html)).then((result) => { ++ mail.data.html = result.html; ++ callback(); ++ }).catch((err) => { ++ console.error('@nestjs-modules/mailer: Unable to convert mjml to html', err) ++ mail.data.html = ''; ++ callback(); ++ }) ++ }).catch((err) => { ++ console.error('@nestjs-modules/mailer: Unable to compiling mjml', err) ++ mail.data.html = ''; ++ callback(); ++ }) + }, mailerOptions); + } + } diff --git a/node_modules/@nestjs-modules/mailer/dist/mailer.service.js b/node_modules/@nestjs-modules/mailer/dist/mailer.service.js index 016055b..d534240 100644 --- a/node_modules/@nestjs-modules/mailer/dist/mailer.service.js diff --git a/api/src/app.module.ts b/api/src/app.module.ts index 4712d01d..3c4692a1 100644 --- a/api/src/app.module.ts +++ b/api/src/app.module.ts @@ -72,7 +72,7 @@ const i18nOptions: I18nOptions = { }), template: { adapter: new MjmlAdapter('ejs', { inlineCssEnabled: false }), - dir: './src/templates', + dir: path.join(process.cwd(), 'dist', 'templates'), options: { context: { appName: config.parameters.appName, diff --git a/api/src/templates/account_confirmation.mjml b/api/src/templates/account_confirmation.mjml index cf10ff87..07230f9d 100644 --- a/api/src/templates/account_confirmation.mjml +++ b/api/src/templates/account_confirmation.mjml @@ -2,8 +2,8 @@ - - + + <%= t('hi') %> <%= first_name %>, @@ -17,7 +17,7 @@ <%= t('confirm') %> diff --git a/api/src/templates/invitation.mjml b/api/src/templates/invitation.mjml index e608bc0d..515a4899 100644 --- a/api/src/templates/invitation.mjml +++ b/api/src/templates/invitation.mjml @@ -2,8 +2,8 @@ - - + + <%= t('welcome') %>, @@ -19,7 +19,7 @@ <%= t('join') %> diff --git a/api/src/templates/password_reset.mjml b/api/src/templates/password_reset.mjml index 34975029..015425ae 100644 --- a/api/src/templates/password_reset.mjml +++ b/api/src/templates/password_reset.mjml @@ -2,8 +2,8 @@ - - + + <%= t('hi') %> <%= first_name %>, @@ -16,7 +16,7 @@ <%= t('reset') %>