Prevents welcome emails from being created

Adds filter to modify available email types
This commit is contained in:
Vlad
2017-05-15 21:36:52 -04:00
committed by stoletniy
parent 028de860a2
commit ce3eb06924
2 changed files with 61 additions and 59 deletions

View File

@@ -2,12 +2,14 @@ define(
[ [
'react', 'react',
'mailpoet', 'mailpoet',
'wp-js-hooks',
'react-router', 'react-router',
'newsletters/breadcrumb.jsx' 'newsletters/breadcrumb.jsx'
], ],
function( function(
React, React,
MailPoet, MailPoet,
Hooks,
Router, Router,
Breadcrumb Breadcrumb
) { ) {
@@ -41,6 +43,47 @@ define(
}); });
}, },
render: function() { render: function() {
var types = [
{
'id': 'standard',
'title': MailPoet.I18n.t('regularNewsletterTypeTitle'),
'description': MailPoet.I18n.t('regularNewsletterTypeDescription'),
'action': function() {
return (
<a className="button button-primary" onClick={ this.createNewsletter.bind(null, 'standard') }>
{MailPoet.I18n.t('create')}
</a>
)
}.bind(this)()
},
{
'id': 'welcome',
'title': MailPoet.I18n.t('welcomeNewsletterTypeTitle'),
'description': MailPoet.I18n.t('welcomeNewsletterTypeDescription'),
'action': function() {
return (
<div>
Premium feature text (TBD)
</div>
)
}()
},
{
'id': 'notification',
'title': MailPoet.I18n.t('postNotificationNewsletterTypeTitle'),
'description': MailPoet.I18n.t('postNotificationNewsletterTypeDescription'),
'action': function() {
return (
<a className="button button-primary" onClick={ this.createNewsletter.bind(null, 'standard') }>
{MailPoet.I18n.t('setUp')}
</a>
)
}.bind(this)()
}
];
types = Hooks.applyFilters('mailpoet_newsletters_types', types);
return ( return (
<div> <div>
<h1>{MailPoet.I18n.t('pickCampaignType')}</h1> <h1>{MailPoet.I18n.t('pickCampaignType')}</h1>
@@ -48,65 +91,24 @@ define(
<Breadcrumb step="type" /> <Breadcrumb step="type" />
<ul className="mailpoet_boxes clearfix"> <ul className="mailpoet_boxes clearfix">
<li data-type="standard"> {types.map(function(type, index) {
return (
<li key={index} data-type={type.id}>
<div>
<div className="mailpoet_thumbnail"></div> <div className="mailpoet_thumbnail"></div>
<div className="mailpoet_description"> <div className="mailpoet_description">
<h3>{MailPoet.I18n.t('regularNewsletterTypeTitle')}</h3> <h3>{type.title}</h3>
<p> <p>{type.description}</p>
{MailPoet.I18n.t('regularNewsletterTypeDescription')}
</p>
</div> </div>
<div className="mailpoet_actions"> <div className="mailpoet_actions">
<a {type.action}
className="button button-primary" </div>
onClick={ this.createNewsletter.bind(null, 'standard') }
>
{MailPoet.I18n.t('create')}
</a>
</div>
</li>
<li data-type="welcome">
<div className="mailpoet_thumbnail"></div>
<div className="mailpoet_description">
<h3>{MailPoet.I18n.t('welcomeNewsletterTypeTitle')}</h3>
<p>
{MailPoet.I18n.t('welcomeNewsletterTypeDescription')}
</p>
</div>
<div className="mailpoet_actions">
<a
className="button button-primary"
onClick={ this.setupNewsletter.bind(null, 'welcome') }
>
{MailPoet.I18n.t('setUp')}
</a>
</div>
</li>
<li data-type="notification">
<div className="mailpoet_thumbnail"></div>
<div className="mailpoet_description">
<h3>{MailPoet.I18n.t('postNotificationNewsletterTypeTitle')}</h3>
<p>
{MailPoet.I18n.t('postNotificationsNewsletterTypeDescription')}
</p>
</div>
<div className="mailpoet_actions">
<a
className="button button-primary"
onClick={ this.setupNewsletter.bind(null, 'notification') }
>
{MailPoet.I18n.t('setUp')}
</a>
</div> </div>
</li> </li>
)
}, this)}
</ul> </ul>
</div> </div>
); );

View File

@@ -123,7 +123,7 @@
'welcomeNewsletterTypeDescription': __('Automatically send an email (or series of emails) to new subscribers or WordPress users. Send a day, a week, or a month after they sign up.'), 'welcomeNewsletterTypeDescription': __('Automatically send an email (or series of emails) to new subscribers or WordPress users. Send a day, a week, or a month after they sign up.'),
'setUp': __('Set up'), 'setUp': __('Set up'),
'postNotificationNewsletterTypeTitle': __('Latest Post Notifications'), 'postNotificationNewsletterTypeTitle': __('Latest Post Notifications'),
'postNotificationsNewsletterTypeDescription': __('Let MailPoet email your subscribers with your latest content. You can send daily, weekly, monthly, or even immediately after publication.'), 'postNotificationNewsletterTypeDescription': __('Let MailPoet email your subscribers with your latest content. You can send daily, weekly, monthly, or even immediately after publication.'),
'selectFrequency': __('Select a frequency'), 'selectFrequency': __('Select a frequency'),
'postNotificationSubjectLineTip': __("Insert [newsletter:total] to show number of posts, [newsletter:post_title] to show the latest post's title & [newsletter:number] to display the issue number."), 'postNotificationSubjectLineTip': __("Insert [newsletter:total] to show number of posts, [newsletter:post_title] to show the latest post's title & [newsletter:number] to display the issue number."),
'activate': __('Activate'), 'activate': __('Activate'),