canonical / identity-platform-admin-ui

Admin UI for the Canonical identity broker and identity provider solution
Other
6 stars 4 forks source link

WD-15023 - chore: set up MJML #420

Closed huwshimi closed 2 months ago

huwshimi commented 2 months ago

Changes

Set up MJML email template builder (note: no templates have been added yet).

https://warthogs.atlassian.net/browse/WD-15023

huwshimi commented 2 months ago

I was left with the impression we were using backend templates with .gotpl

what did I miss?how are we going to operate with the templates from a backend perspective, or is the frontend doing the hard work and hitting the email endpoint with all the info it needs (risky if we pass the authentication code or password)?

The backend loads the templates e.g. https://github.com/canonical/identity-platform-admin-ui/blob/main/internal/mail/html/user-invite.html. However, we need a way to generate those templates, which we'll do using MJML (HTML emails use an HTML style from circa 2000 e.g. inline styles etc. and MJML streamlines generating the code and making it compatible with the various mail clients etc.)

shipperizer commented 2 months ago

I was left with the impression we were using backend templates with .gotpl what did I miss?how are we going to operate with the templates from a backend perspective, or is the frontend doing the hard work and hitting the email endpoint with all the info it needs (risky if we pass the authentication code or password)?

The backend loads the templates e.g. https://github.com/canonical/identity-platform-admin-ui/blob/main/internal/mail/html/user-invite.html. However, we need a way to generate those templates, which we'll do using MJML (HTML emails use an HTML style from circa 2000 e.g. inline styles etc. and MJML streamlines generating the code and making it compatible with the various mail clients etc.)

i m confused, need to see the whole thing working

BarcoMasile commented 2 months ago

I was left with the impression we were using backend templates with .gotpl what did I miss?how are we going to operate with the templates from a backend perspective, or is the frontend doing the hard work and hitting the email endpoint with all the info it needs (risky if we pass the authentication code or password)?

The backend loads the templates e.g. https://github.com/canonical/identity-platform-admin-ui/blob/main/internal/mail/html/user-invite.html. However, we need a way to generate those templates, which we'll do using MJML (HTML emails use an HTML style from circa 2000 e.g. inline styles etc. and MJML streamlines generating the code and making it compatible with the various mail clients etc.)

@huwshimi @shipperizer To clarify: yes we use backend templates from the go standard library. If @huwshimi prefers to do it with MJML it's fine, but I'd ask you to please put this somewhere else in the UI folder (and handle that subfolder as you wish), and refactor the Makefile to make sure that only the minified html (generated via this tool) ends up in the templates folder. This way only the minified html produced by MJML ends up in the backend build. Also, make sure the 3 go template variables are present after MJML generates the html. Is that ok for you?

huwshimi commented 2 months ago

@BarcoMasile I've moved these files to the UI dir.