-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: email template editor #9
Conversation
* feat: allow dynamic events * ci: enable dev publishing to gh pr * ci: rename * ci: branch names * ci: set registry * ci: fix registry * ci: try passing registry-url * docs: add docs about dynamic events * build: bump version to 4.7.0 * feat: v1 implementation of editor flow * chore: editing subject * chore: stylize the template editor * chore: add migration to create object * chore: get list of events and templates dynamically: * chore: start implementing merge tags * chore: add soft-delete attribute to model * chore: remove view * chore: unset notification event before soft remove * chore: add ability to delete email templates * feat: full create, delete, restore | permanent delete * style: oxlint --fix * chore: finish styling trash * ci: tweak publish * build: bump version
Sorry totally missed this PR. Will look into it tomorrow. |
@Fullstak-nl have you had a chance to play with this? I'm going to start refactoring things and cleaning them up in the hopes I can get this merged in. Let me know if you run into any sharp edges with any of what I've written |
Just had time to test and verify. Thanks for all the hard work. Looks like it works right away. If you have the time/energy to document it a bit more that would be awesome. But I don't mind to do it myself. |
@Fullstak-nl thanks for merging and releasing! I can confirm that I've migrated one of my projects to use the v5 alpha and am very happy with how things are working. I still have a few things I think could be improved. Let me know if you'd like me to make GH issues around these items or if you're happy to just leave them documented here until I have time to get to them: Merge TagsUnlayer supports the idea of "merge tags" in the template editor. These should include all the variables that Medusa supplies to a template, and I do have some of those variables already mapped out, but the full mapping is far from complete. I found it hard to pinpoint exactly what variables would be provided to a given event template. Template Creation Name ValidationRight now, when you create a new template, the UI will show an error if you use a name that is already defined. It does not take into account names of templates in the trash, but it should. The templates in the trash are still in the DB (to preserve templates, which can be really complex), so trying to save one with the same name results in a DB error that is not currently surfaced. Test Email SendingI'm not sure about the best way to approach this, Unlayer provides a plugin to do it, but that requires users to pass in a project ID and user ID with hashes to get it working. IMO it may be simpler to add another button to the top-bar to send a test email. Layout CreationPostmark supports the idea of template layouts, building that into this plugin would make it significantly easier for creators to manage multiple templates that should all look alike. Surfacing Uploaded ImagesWhen users upload images of products to Medusa, those images should be available in the template editor UI. Unfortunately, I think this is the most complicated thing on this list. Unlayer supports adding another tab to the UI, but that is marked as a "premium feature" https://docs.unlayer.com/docs/tabs#create-a-custom-tab Display Saving StateLike most realtime editors, the template editing page should show something like "saving..." somewhere when the page is saving. Best, |
Sorry for the ULTRA late reply! I'm also looking into merging Medusa-documents maybe even hook into their template item somehow to combine the features. |
Here is my v1 implementation of email template editing!
Let me know what your thoughts are on the approach, if you like the way this is heading then I can take another pass at it and do a bit more refactoring / documenting before we merge this into your mainline.
At this point, the full flow should work. You should be able to create email templates, connect them to events, move them to the trash, and restore them back or permanently delete them. Database guards prevent duplicate aliases from existing, ensure that only one template fires from one event at a time (excluding unset), and does on-the-fly computation of the alias field such that it is compatible with postmark.
I know this is a big change, some diffs were caused by a slight change to the publish step, which now uses
dist
, and others are related to fixes thatoxlint
could perform automatically on the codebase.