From ce3eb06924e8c0f89f66e8b807e9a7c1c72b2d02 Mon Sep 17 00:00:00 2001 From: Vlad Date: Mon, 15 May 2017 21:36:52 -0400 Subject: [PATCH] Prevents welcome emails from being created Adds filter to modify available email types --- assets/js/src/newsletters/types.jsx | 118 ++++++++++++++-------------- views/newsletters.html | 2 +- 2 files changed, 61 insertions(+), 59 deletions(-) diff --git a/assets/js/src/newsletters/types.jsx b/assets/js/src/newsletters/types.jsx index dca520ac69..91aef404b0 100644 --- a/assets/js/src/newsletters/types.jsx +++ b/assets/js/src/newsletters/types.jsx @@ -2,12 +2,14 @@ define( [ 'react', 'mailpoet', + 'wp-js-hooks', 'react-router', 'newsletters/breadcrumb.jsx' ], function( React, MailPoet, + Hooks, Router, Breadcrumb ) { @@ -41,6 +43,47 @@ define( }); }, render: function() { + var types = [ + { + 'id': 'standard', + 'title': MailPoet.I18n.t('regularNewsletterTypeTitle'), + 'description': MailPoet.I18n.t('regularNewsletterTypeDescription'), + 'action': function() { + return ( + + {MailPoet.I18n.t('create')} + + ) + }.bind(this)() + }, + { + 'id': 'welcome', + 'title': MailPoet.I18n.t('welcomeNewsletterTypeTitle'), + 'description': MailPoet.I18n.t('welcomeNewsletterTypeDescription'), + 'action': function() { + return ( +
+ Premium feature text (TBD) +
+ ) + }() + }, + { + 'id': 'notification', + 'title': MailPoet.I18n.t('postNotificationNewsletterTypeTitle'), + 'description': MailPoet.I18n.t('postNotificationNewsletterTypeDescription'), + 'action': function() { + return ( + + {MailPoet.I18n.t('setUp')} + + ) + }.bind(this)() + } + ]; + + types = Hooks.applyFilters('mailpoet_newsletters_types', types); + return (

{MailPoet.I18n.t('pickCampaignType')}

@@ -48,65 +91,24 @@ define(
    -
  • -
    + {types.map(function(type, index) { + return ( +
  • +
    +
    -
    -

    {MailPoet.I18n.t('regularNewsletterTypeTitle')}

    -

    - {MailPoet.I18n.t('regularNewsletterTypeDescription')} -

    -
    +
    +

    {type.title}

    +

    {type.description}

    +
    - -
  • - -
  • -
    - -
    -

    {MailPoet.I18n.t('welcomeNewsletterTypeTitle')}

    -

    - {MailPoet.I18n.t('welcomeNewsletterTypeDescription')} -

    -
    - - -
  • - -
  • -
    - -
    -

    {MailPoet.I18n.t('postNotificationNewsletterTypeTitle')}

    -

    - {MailPoet.I18n.t('postNotificationsNewsletterTypeDescription')} -

    -
    - - -
  • +
    + {type.action} +
    +
+ + ) + }, this)} ); @@ -115,4 +117,4 @@ define( return NewsletterTypes; } -); +); \ No newline at end of file diff --git a/views/newsletters.html b/views/newsletters.html index 0ed3ca06ca..5052ea131c 100644 --- a/views/newsletters.html +++ b/views/newsletters.html @@ -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.'), 'setUp': __('Set up'), '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'), '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'),