Add template category Re-engagement Emails

[MAILPOET-3764]
This commit is contained in:
Jan Lysý
2021-10-26 14:02:11 +02:00
committed by Veljko V
parent cd35b2f72d
commit db0763af8e
2 changed files with 18 additions and 0 deletions

View File

@@ -75,6 +75,8 @@ class NewsletterTemplates extends React.Component {
}
componentDidMount() {
this.addReEngagementCategory();
MailPoet.Ajax.get({
api_version: window.mailpoet_api_version,
endpoint: 'newsletterTemplates',
@@ -104,6 +106,21 @@ class NewsletterTemplates extends React.Component {
});
}
// We want temporarily to allow re-engagement emails only when the feature is active
addReEngagementCategory() {
if (this.context.features.isSupported('re-engagement-email')) {
const notificationIndex = templatesCategories.map((category) => category.name).indexOf('notification');
const categoriesTmp = templatesCategories.splice(notificationIndex + 1);
templatesCategories.push(
{
name: 're_engagement',
label: MailPoet.I18n.t('tabReEngagementTitle'),
},
...categoriesTmp
);
}
}
addTemplate(template) {
const categoriesNames = templatesCategories.map((category) => category.name);
let categories;