diff --git a/assets/css/src/box.styl b/assets/css/src/box.styl
index 5202d0b5ac..78c97a39b8 100644
--- a/assets/css/src/box.styl
+++ b/assets/css/src/box.styl
@@ -71,15 +71,17 @@ $box-description-font-size = $box-description-line-height
.mailpoet_boxes .mailpoet_description
float:left
- width: 245px
+ width: 258px
max-height: $box-description-height
padding-bottom: 0
overflow: hidden
+ word-wrap: break-word
+ overflow-wrap: break-word
h3
margin: 0 0 $box-description-space-between-heading-and-paragraph 0
overflow: hidden
- max-width: 210px
+ max-width: 223px
line-height: $box-heading-line-height
font-size: $box-heading-font-size
@@ -117,6 +119,20 @@ $box-description-font-size = $box-description-line-height
[data-type="standard"] .mailpoet_thumbnail
background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20version%3D%221.1%22%20id%3D%22Layer_1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20x%3D%220px%22%20y%3D%220px%22%20viewBox%3D%220%200%2070%2070%22%20enable-background%3D%22new%200%200%2070%2070%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpath%20fill%3D%22%23ffffff%22%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M62.751%2C65.368L43.923%2C50.955l18.832-14.377l-5.395-4.118v-3.479l5.983%2C4.568%20v3.479l0.166%2C26.269C63.51%2C64.089%2C63.198%2C64.783%2C62.751%2C65.368z%20M31.433%2C49.5l-15.955-12v-30c0-1.657%2C1.339-3%2C2.992-3h33.905%20c1.652%2C0%2C2.992%2C1.343%2C2.992%2C3v30l-15.955%2C12H31.433z%20M18.469%2C35.5H33.5v-2H18.469V35.5z%20M18.469%2C31.5H33.5v-2H18.469V31.5z%20M18.469%2C27.5H33.5v-2H18.469V27.5z%20M38.406%2C7.5H18.469v14h19.937V7.5z%20M52.375%2C7.5H40.408v2h11.967V7.5z%20M52.375%2C11.5H40.408v2%20h11.967V11.5z%20M52.375%2C15.5H40.408v2h11.967V15.5z%20M52.375%2C19.5H40.408v2h11.967V19.5z%20M52.375%2C25.5H37.5v2h14.875V25.5z%20M52.375%2C29.5H37.5v2h14.875V29.5z%20M52.375%2C33.5H37.5v2h14.875V33.5z%20M26.14%2C17.192L28.442%2C9.5l3.277%2C6.571l1.71-2.571l2.992%2C6%20h-2.992h-3.989h-0.997H25.45h-4.986l3.989-4L26.14%2C17.192z%20M22.469%2C12.5h-1c-0.552%2C0-1-0.448-1-1v-1c0-0.552%2C0.448-1%2C1-1h1%20c0.552%2C0%2C1%2C0.448%2C1%2C1v1C23.469%2C12.052%2C23.021%2C12.5%2C22.469%2C12.5z%20M26.795%2C50.955L8.05%2C65.305c-0.419-0.574-0.55-1.41-0.55-2.174%20V37.015l-0.015%2C0.011v-3.479l5.998-4.579v3.479L8.017%2C36.62L26.795%2C50.955z%20M29.137%2C52.659v-0.157h12.462v0.144l0.047-0.036%20L59.73%2C66.5H10.989l18.084-13.889L29.137%2C52.659z%22%2F%3E%3C%2Fsvg%3E%0A")
+[data-type="woocommerce"] .mailpoet_thumbnail
+ background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjUwMCIgaGVpZ2h0PSIxNDk0IiB2aWV3Qm94PSIwIDAgMjU2IDE1MyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJ4TWlkWU1pZCI+PHBhdGggZD0iTTIzLjc1OSAwaDIwOC4zNzhDMjQ1LjMyNSAwIDI1NiAxMC42NzUgMjU2IDIzLjg2M3Y3OS41NDFjMCAxMy4xODgtMTAuNjc1IDIzLjg2My0yMy44NjMgMjMuODYzSDE1Ny40MWwxMC4yNTcgMjUuMTE4LTQ1LjEwOS0yNS4xMThIMjMuODYzYy0xMy4xODcgMC0yMy44NjItMTAuNjc1LTIzLjg2Mi0yMy44NjNWMjMuODYzQy0uMTA0IDEwLjc4IDEwL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2LjY1LTEyLjA3Mi0xLjk3Ny0uNDE2LTMuODUtLjYyNC01LjYyLS42MjQtOS45OSAwLTE4LjEwNyA1LjIwMy0yNC40NTUgMTUuNjEtNS40MTEgOC44NDUtOC4xMTcgMTguNjI3LTguMTE3IDI5LjM0NiAwIDguMDEzIDEuNjY1IDE0Ljg4MSA0Ljk5NSAyMC42MDUgMy43NDYgNi41NTYgOS4yNjIgMTAuNTEgMTYuNjUgMTIuMDcxIDEuOTc4LjQxNyAzLjg1LjYyNSA1LjYyLjYyNSAxMC4wOTQgMCAxOC4yMTEtNS4yMDMgMjQuNDU1LTE1LjYxIDUuNDEyLTguOTUgOC4xMTctMTguNzMyIDguMTE3LTI5LjQ1IDAtOC4xMTctMS42NjUtMTQuODgyLTQuOTk1LTIwLjUwMXptLTEzLjIxNiAyOC44MjZjLTEuNDU3IDYuODY4LTQuMDU5IDExLjk2Ny03LjkwOSAxNS40MDEtMy4wMTggMi43MDYtNS44MjggMy44NS04LjQzIDMuMzMtMi40OTctLjUyLTQuNTc4LTIuNzA1LTYuMTQtNi43NjQtMS4yNDgtMy4yMjYtMS44NzItNi40NTItMS44NzItOS40NyAwLTIuNjAxLjIwOC01LjIwMy43MjgtNy41OTYuOTM3LTQuMjY3IDIuNzA2LTguNDMgNS41MTYtMTIuMzg0IDMuNDM0LTUuMSA3LjA3Ni03LjE4IDEwLjgyMi02LjQ1MiAyLjQ5OC41MiA0LjU4IDIuNzA2IDYuMTQgNi43NjQgMS4yNSAzLjIyNiAxLjg3MyA2LjQ1MiAxLjg3MyA5LjQ3LjEwNSAyLjcwNi0uMjA4IDUuMzA3LS43MjggNy43eiIgZmlsbD0iI0ZGRiIvPjwvc3ZnPg==')
+
.mailpoet_boxes_preview
margin: -10px
padding: 10px 20px
+
+.mailpoet_boxes
+ .title_and_badge
+ display: flex
+ flex-direction: row
+ justify-content: space-between
+
+ .mailpoet_badge
+ margin: 0 0 0 10px
+ padding: 0 6px 0 6px
+ max-height: 21px
\ No newline at end of file
diff --git a/assets/css/src/listing/newsletters.styl b/assets/css/src/listing/newsletters.styl
index 10c2f8e86f..e8b68970ae 100644
--- a/assets/css/src/listing/newsletters.styl
+++ b/assets/css/src/listing/newsletters.styl
@@ -41,13 +41,13 @@ $green-badge-color = #55bd56
vertical-align: middle
white-space: nowrap
- &_excellent
+ &_excellent, &_teal
background: $excellent-badge-color
- &_good
+ &_good, &_yellow
background: $good-badge-color
- &_bad
+ &_bad, &_red
background: $bad-badge-color
&_green
diff --git a/assets/js/src/newsletters/newsletters.jsx b/assets/js/src/newsletters/newsletters.jsx
index 7eeea9dcfe..ecfb5d1923 100644
--- a/assets/js/src/newsletters/newsletters.jsx
+++ b/assets/js/src/newsletters/newsletters.jsx
@@ -3,14 +3,14 @@ import ReactDOM from 'react-dom';
import { Router, Route, IndexRedirect, useRouterHistory } from 'react-router';
import { createHashHistory } from 'history';
import Hooks from 'wp-js-hooks';
+import _ from 'underscore';
import NewsletterTypes from 'newsletters/types.jsx';
import NewsletterTemplates from 'newsletters/templates.jsx';
import NewsletterSend from 'newsletters/send.jsx';
-
import NewsletterTypeStandard from 'newsletters/types/standard.jsx';
import NewsletterTypeNotification from 'newsletters/types/notification/notification.jsx';
-
+import AutomaticEmailsEventsList from 'newsletters/types/automatic_emails/events_list.jsx';
import NewsletterListStandard from 'newsletters/listings/standard.jsx';
import NewsletterListWelcome from 'newsletters/listings/welcome.jsx';
import NewsletterListNotification from 'newsletters/listings/notification.jsx';
@@ -26,33 +26,82 @@ const App = React.createClass({
const container = document.getElementById('newsletters_container');
+const getAutomaticEmailsRoutes = () => {
+ if (!window.mailpoet_automatic_emails) return null;
+
+ return _.map(window.mailpoet_automatic_emails, automaticEmail => ({
+ path: `new/${automaticEmail.id}`,
+ name: automaticEmail.id,
+ component: AutomaticEmailsEventsList,
+ data: {
+ automaticEmail: automaticEmail,
+ },
+ }));
+};
+
if (container) {
- let extraRoutes = [];
- extraRoutes = Hooks.applyFilters('mailpoet_newsletters_before_router', extraRoutes);
+ let routes = [
+ /* Listings */
+ {
+ path: 'standard(/)**',
+ params: { tab: 'standard' },
+ component: NewsletterListStandard,
+ },
+ {
+ path: 'welcome(/)**',
+ component: NewsletterListWelcome,
+ },
+ {
+ path: 'notification/history/:parent_id(/)**',
+ component: NewsletterListNotificationHistory,
+ },
+ {
+ path: 'notification(/)**',
+ component: NewsletterListNotification,
+ },
+ /* Newsletter: type selection */
+ {
+ path: 'new',
+ component: NewsletterTypes,
+ },
+ /* New newsletter: types */
+ {
+ path: 'new/standard',
+ component: NewsletterTypeStandard,
+ },
+ {
+ path: 'new/notification',
+ component: NewsletterTypeNotification,
+ },
+ /* Template selection */
+ {
+ name: 'template',
+ path: 'template/:id',
+ component: NewsletterTemplates,
+ },
+ /* Sending options */
+ {
+ path: 'send/:id',
+ component: NewsletterSend,
+ },
+ ];
+
+ routes = Hooks.applyFilters('mailpoet_newsletters_before_router', [...routes, ...getAutomaticEmailsRoutes()]);
const mailpoetListing = ReactDOM.render((
- {/* Listings */}
-
-
-
-
- {/* Newsletter: type selection */}
-
- {/* New newsletter: types */}
-
-
- {/* Template selection */}
-
- {/* Sending options */}
-
- {/* Extra routes */}
- {extraRoutes.map(rt =>
-
- )}
+ {routes.map(route => (
+
+ ))}
), container);
diff --git a/assets/js/src/newsletters/types.jsx b/assets/js/src/newsletters/types.jsx
index 4c7cc38414..0bc675526a 100644
--- a/assets/js/src/newsletters/types.jsx
+++ b/assets/js/src/newsletters/types.jsx
@@ -5,13 +5,15 @@ define(
'wp-js-hooks',
'react-router',
'newsletters/breadcrumb.jsx',
+ 'underscore',
],
(
React,
MailPoet,
Hooks,
Router,
- Breadcrumb
+ Breadcrumb,
+ _
) => {
const NewsletterTypes = React.createClass({
contextTypes: {
@@ -50,8 +52,29 @@ define(
}
});
},
+ getAutomaticEmails: function () {
+ if (!window.mailpoet_automatic_emails) return [];
+
+ return _.map(window.mailpoet_automatic_emails, (automaticEmail) => {
+ const email = automaticEmail;
+ const disabled = !email.events;
+
+ email.action = (() => (
+
diff --git a/assets/js/src/newsletters/types/automatic_emails/breadcrumb.jsx b/assets/js/src/newsletters/types/automatic_emails/breadcrumb.jsx
new file mode 100644
index 0000000000..6a4a247c1f
--- /dev/null
+++ b/assets/js/src/newsletters/types/automatic_emails/breadcrumb.jsx
@@ -0,0 +1,41 @@
+import Breadcrumb from 'newsletters/breadcrumb.jsx';
+import React from 'react';
+import MailPoet from 'mailpoet';
+
+class AutomaticEmailsBreadcrumb extends React.Component {
+ render() {
+ const steps = [
+ {
+ name: 'type',
+ label: MailPoet.I18n.t('selectType'),
+ link: '/new',
+ },
+ {
+ name: 'events',
+ label: MailPoet.I18n.t('events'),
+ },
+ {
+ name: 'conditions',
+ label: MailPoet.I18n.t('conditions'),
+ },
+ {
+ name: 'template',
+ label: MailPoet.I18n.t('template'),
+ },
+ {
+ name: 'editor',
+ label: MailPoet.I18n.t('designer'),
+ },
+ {
+ name: 'send',
+ label: MailPoet.I18n.t('send'),
+ },
+ ];
+
+ return (
+
+ );
+ }
+}
+
+module.exports = AutomaticEmailsBreadcrumb;
diff --git a/assets/js/src/newsletters/types/automatic_emails/events_list.jsx b/assets/js/src/newsletters/types/automatic_emails/events_list.jsx
new file mode 100644
index 0000000000..f68f4a07e9
--- /dev/null
+++ b/assets/js/src/newsletters/types/automatic_emails/events_list.jsx
@@ -0,0 +1,93 @@
+import React from 'react';
+import AutomaticEmailsBreadcrumb from 'newsletters/types/automatic_emails/breadcrumb.jsx';
+import MailPoet from 'mailpoet';
+import _ from 'underscore';
+
+class AutomaticEmailsEventsList extends React.Component {
+ constructor(props) {
+ super(props);
+ this.automaticEmail = this.props.route.data.automaticEmail;
+ this.automaticEmailEvents = this.automaticEmail.events;
+ this.eventsConfigurator = this.eventsConfigurator.bind(this);
+ }
+
+ eventsConfigurator(eventId) {
+ this.props.router.push(`new/${this.automaticEmail.id}/${eventId}/conditions`);
+ }
+
+ displayEvents() {
+ const events = _.map(this.automaticEmailEvents, (event, index) => {
+ let action;
+
+ if (this.automaticEmail.premium) {
+ action = (
+
+ {MailPoet.I18n.t('premiumFeatureLink')}
+
+ );
+ } else {
+ const disabled = event.soon;
+
+ action = (
+
+ {event.actionButtonTitle || MailPoet.I18n.t('setUp')}
+
+ );
+ }
+
+ return (
+
+
+
+ {event.thumbnailImage ?

: null}
+
+
+
+
{event.title} {event.soon ? `(${MailPoet.I18n.t('soon').toLowerCase()})` : ''}
+ {event.badge ? (
+
+ {event.badge.text}
+
+ ) : ''
+ }
+
+
{event.description}
+
+
+ {action}
+
+
+
+ );
+ });
+
+ return (
+
+ );
+ }
+
+ render() {
+ const heading = MailPoet.I18n.t('selectAutomaticEmailsEventsHeading')
+ .replace('%1s', this.automaticEmail.title);
+
+ return (
+
+
+ {heading} ({MailPoet.I18n.t('beta').toLowerCase()})
+
+
+
+
+ {this.displayEvents()}
+
+ );
+ }
+}
+
+module.exports = AutomaticEmailsEventsList;
diff --git a/assets/js/src/newsletters/types/woocommerce.jsx b/assets/js/src/newsletters/types/woocommerce.jsx
new file mode 100644
index 0000000000..c2d19f4d1e
--- /dev/null
+++ b/assets/js/src/newsletters/types/woocommerce.jsx
@@ -0,0 +1,161 @@
+define(
+ [
+ 'react',
+ 'mailpoet',
+ 'wp-js-hooks',
+ 'react-router',
+ 'newsletters/breadcrumb.jsx',
+ ],
+ (
+ React,
+ MailPoet,
+ Hooks,
+ Router,
+ Breadcrumb
+ ) => {
+ const WooCommerceAutomaticEmail = React.createClass({
+ contextTypes: {
+ router: React.PropTypes.object.isRequired,
+ },
+ setupNewsletter: function (type) {
+ if (type !== undefined) {
+ this.context.router.push(`/new/${type}`);
+ MailPoet.trackEvent('Emails > Type selected', {
+ 'MailPoet Free version': window.mailpoet_version,
+ 'Email type': type,
+ });
+ }
+ },
+ createNewsletter: function (type) {
+ MailPoet.trackEvent('Emails > Type selected', {
+ 'MailPoet Free version': window.mailpoet_version,
+ 'Email type': type,
+ });
+ MailPoet.Ajax.post({
+ api_version: window.mailpoet_api_version,
+ endpoint: 'newsletters',
+ action: 'create',
+ data: {
+ type: type,
+ subject: MailPoet.I18n.t('draftNewsletterTitle'),
+ },
+ }).done((response) => {
+ this.context.router.push(`/template/${response.data.id}`);
+ }).fail((response) => {
+ if (response.errors.length > 0) {
+ MailPoet.Notice.error(
+ response.errors.map(error => error.message),
+ { scroll: true }
+ );
+ }
+ });
+ },
+ render: function () {
+ const types = [
+ {
+ id: 'woocommerce',
+ title: MailPoet.I18n.t('wooCommerceEventAbandonedCartTitle'),
+ description: MailPoet.I18n.t('wooCommerceEventAbandonedCartDescription'),
+ badge: {
+ text: MailPoet.I18n.t('wooCommerceEventAbandonedCartBadge'),
+ style: 'red',
+ },
+ },
+ {
+ id: 'woocommerce',
+ title: MailPoet.I18n.t('wooCommerceEventFirstPurchaseTitle'),
+ description: MailPoet.I18n.t('wooCommerceEventFirstPurchaseDescription'),
+ badge: {
+ text: MailPoet.I18n.t('wooCommerceEventFirstPurchaseBadge'),
+ style: 'yellow',
+ },
+ },
+ {
+ id: 'woocommerce',
+ title: MailPoet.I18n.t('wooCommerceEventPurchasedProductTitle'),
+ description: MailPoet.I18n.t('wooCommerceEventPurchasedProductDescription'),
+ },
+ {
+ id: 'woocommerce',
+ title: MailPoet.I18n.t('wooCommerceEventPurchasedInCategoryTitle'),
+ description: MailPoet.I18n.t('wooCommerceEventPurchasedInCategoryDescription'),
+ soon: true,
+ },
+ {
+ id: 'woocommerce',
+ title: MailPoet.I18n.t('wooCommerceEventBigSpenderTitle'),
+ description: MailPoet.I18n.t('wooCommerceEventBigSpenderDescription'),
+ soon: true,
+ badge: {
+ text: MailPoet.I18n.t('wooCommerceEventSmartToHaveBadge'),
+ style: 'teal',
+ },
+ },
+ ];
+
+ const steps = [
+ {
+ name: 'type',
+ label: MailPoet.I18n.t('selectType'),
+ link: '/new',
+ },
+ {
+ name: 'events',
+ label: MailPoet.I18n.t('wooCommerceBreadcrumbsEvents'),
+ },
+ {
+ name: 'conditions',
+ label: MailPoet.I18n.t('wooCommerceBreadcrumbsConditions'),
+ },
+ {
+ name: 'template',
+ label: MailPoet.I18n.t('template'),
+ },
+ {
+ name: 'editor',
+ label: MailPoet.I18n.t('designer'),
+ },
+ {
+ name: 'send',
+ label: MailPoet.I18n.t('send'),
+ },
+ ];
+
+ return (
+
+
{MailPoet.I18n.t('wooCommerceSelectEventHeading')}
+
+
+
+
+ {types.map((type, index) => (
+ -
+
+
+ {type.thumbnailImage ?

: null}
+
+
+
+
{type.title} {type.soon ? `(${MailPoet.I18n.t('wooCommerceEventTitleSoon')})` : ''}
+ {type.badge ? {type.badge.text} : ''}
+
+
{type.description}
+
+
+
+
+
+ ), this)}
+
+
+ );
+ },
+ });
+
+ return WooCommerceAutomaticEmail;
+ }
+);
diff --git a/lib/Config/Menu.php b/lib/Config/Menu.php
index 6534ab17f5..74c4a9933b 100644
--- a/lib/Config/Menu.php
+++ b/lib/Config/Menu.php
@@ -573,6 +573,56 @@ class Menu {
$data['tracking_enabled'] = Setting::getValue('tracking.enabled');
$data['premium_plugin_active'] = License::getLicense();
+ $data['automatic_emails'] = array(
+ array(
+ 'id' => 'woocommerce',
+ 'premium' => true,
+ 'title' => __('WooCommerce Automatic Emails', 'mailpoet'),
+ 'description' => __("Put your store's email marketing on autopilot.", 'mailpoet'),
+ 'events' => array(
+ array(
+ 'id' => 'woocommerce',
+ 'title' => __('Abandoned Shopping Cart', 'mailpoet'),
+ 'description' => __('Send an email to logged-in visitors who have items in their shopping carts but left your website without checking out. Can convert up to 5% of abandoned carts.', 'mailpoet'),
+ 'badge' => array(
+ 'text' => __('Must-have', 'mailpoet'),
+ 'style' => 'red'
+ )
+ ),
+ array(
+ 'id' => 'woocommerce',
+ 'title' => __('First Purchase', 'mailpoet'),
+ 'description' => __('Send an email automatically to customers who have purchased for the first time.', 'mailpoet'),
+ 'badge' => array(
+ 'text' => __('Recommended', 'mailpoet'),
+ 'style' => 'yellow'
+ )
+ ),
+ array(
+ 'id' => 'woocommerce',
+ 'title' => __('Purchased This Product', 'mailpoet'),
+ 'description' => __('Let MailPoet send an email to customers who purchase a specific product.', 'mailpoet'),
+ ),
+ array(
+ 'id' => 'woocommerce',
+ 'title' => __('Purchased In This Category', 'mailpoet'),
+ 'description' => __('Let MailPoet send an email to customers who purchase a product from a specific category.', 'mailpoet'),
+ 'soon' => true
+ ),
+ array(
+ 'id' => 'woocommerce',
+ 'title' => __('Big Spender', 'mailpoet'),
+ 'description' => __('Let MailPoet send an email to customers who have spent a certain amount to thank them, possibly with a coupon.', 'mailpoet'),
+ 'soon' => true,
+ 'badge' => array(
+ 'text' => __('Smart to have', 'mailpoet'),
+ 'style' => 'teal'
+ )
+ )
+ )
+ )
+ );
+
wp_enqueue_script('jquery-ui');
wp_enqueue_script('jquery-ui-datepicker');
diff --git a/views/newsletters.html b/views/newsletters.html
index de28b3177c..b4cc597b8f 100644
--- a/views/newsletters.html
+++ b/views/newsletters.html
@@ -16,6 +16,7 @@
var mailpoet_date_storage_format = "Y-m-d";
var mailpoet_tracking_enabled = <%= json_encode(tracking_enabled) %>;
var mailpoet_premium_active = <%= json_encode(premium_plugin_active) %>;
+ var mailpoet_automatic_emails = <%= json_encode(automatic_emails) %>;
<% endblock %>
@@ -55,6 +56,8 @@
'numberOfItemsMultiple': __('%$1d items'),
'selectType': __('Select type'),
+ 'events': __('Events'),
+ 'conditions': _x('Conditions', 'Configuration options for automatic email events'),
'template': __('Template'),
'designer': __('Designer'),
'send': __('Send'),
@@ -125,7 +128,7 @@
'create': __('Create'),
'welcomeNewsletterTypeTitle': __('Welcome Email'),
'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.'),
- 'getPremiumVersion': __('Get premium version!'),
+ 'premiumFeatureLink': __('This is a Premium feature'),
'setUp': __('Set up'),
'postNotificationNewsletterTypeTitle': __('Latest Post Notifications'),
'postNotificationNewsletterTypeDescription': __('Let MailPoet email your subscribers with your latest content. You can send daily, weekly, monthly, or even immediately after publication.'),
@@ -272,7 +275,10 @@
'sample': _x('Sample', 'Sample newsletters templates category'),
'noTemplates': __('This category does not contain any template yet!'),
- 'errorWhileTakingScreenshot': __('An error occured while saving the template in "Recently sent"')
+ 'soon': __('Soon'),
+ 'beta': __('Beta'),
+ 'errorWhileTakingScreenshot': __('An error occured while saving the template in "Recently sent"'),
+ 'selectAutomaticEmailsEventsHeading': __('Select %1s events'),
}) %>
<% endblock %>
diff --git a/webpack.config.js b/webpack.config.js
index c0245ec09b..2eccd90c36 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -129,6 +129,14 @@ var baseConfig = {
include: path.resolve(__dirname, 'assets/js/src/newsletters/breadcrumb.jsx'),
loader: 'expose-loader?' + globalPrefix + '.NewsletterCreationBreadcrumb!babel-loader',
},
+ {
+ include: path.resolve(__dirname, 'assets/js/src/newsletters/types/automatic_emails/events_list.jsx'),
+ loader: 'expose-loader?' + globalPrefix + '.AutomaticEmailsEventsList!babel-loader',
+ },
+ {
+ include: path.resolve(__dirname, 'assets/js/src/newsletters/types/automatic_emails/breadcrumb.jsx'),
+ loader: 'expose-loader?' + globalPrefix + '.AutomaticEmailsBreadcrumb!babel-loader',
+ },
{
include: /Blob.js$/,
loader: 'exports-loader?window.Blob',
@@ -185,6 +193,8 @@ var adminConfig = {
'form/form.jsx',
'newsletters/badges/stats.jsx',
'newsletters/breadcrumb.jsx',
+ 'newsletters/types/automatic_emails/events_list.jsx',
+ 'newsletters/types/automatic_emails/breadcrumb.jsx',
'newsletters/types/welcome/scheduling.jsx',
'history',
],