Marks WooCommerce group as beta

This commit is contained in:
Vlad
2018-05-21 12:00:07 -04:00
parent 20dbc3c74b
commit fff6c966d8
5 changed files with 5 additions and 150 deletions

View File

@ -48,6 +48,8 @@ const NewsletterTypes = React.createClass({
return _.map(window.mailpoet_automatic_emails, (automaticEmail) => {
const email = automaticEmail;
const onClick = _.partial(this.setupNewsletter, automaticEmail.slug);
email.title = (email.beta) ?
`${email.title} (${MailPoet.I18n.t('beta')})` : email.title;
email.action = (() => (
<div>
<a

View File

@ -39,7 +39,7 @@ class AutomaticEmailEvent extends React.PureComponent {
</div>
<div className="mailpoet_description">
<div className="title_and_badge">
<h3>{event.title} {event.soon ? `(${MailPoet.I18n.t('soon').toLowerCase()})` : ''}</h3>
<h3>{event.title} {event.soon ? `(${MailPoet.I18n.t('soon')})` : ''}</h3>
{event.badge ? (
<span className={`mailpoet_badge mailpoet_badge_${event.badge.style}`}>
{event.badge.text}

View File

@ -42,7 +42,7 @@ class AutomaticEmailEventsList extends React.Component {
return (
<div>
<h1>
{heading} ({MailPoet.I18n.t('beta').toLowerCase()})
{heading}
</h1>
<AutomaticEmailsBreadcrumb step="events" />

View File

@ -1,148 +0,0 @@
import React from 'react';
import MailPoet from 'mailpoet';
import Breadcrumb from 'newsletters/breadcrumb.jsx';
const WooCommerceAutomaticEmail = React.createClass({
contextTypes: {
router: React.PropTypes.object.isRequired,
},
setupNewsletter: function setupNewsletter(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 createNewsletter(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,
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 render() {
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 (
<div>
<h1>{MailPoet.I18n.t('wooCommerceSelectEventHeading')}</h1>
<Breadcrumb step="events" steps={steps} />
<ul className="mailpoet_boxes woocommerce clearfix">
{types.map(type => (
<li key={type.id} data-type={type.id}>
<div>
<div className="mailpoet_thumbnail">
{type.thumbnailImage ? <img src={type.thumbnailImage} alt="" /> : null}
</div>
<div className="mailpoet_description">
<div className="title_and_badge">
<h3>{type.title} {type.soon ? `(${MailPoet.I18n.t('wooCommerceEventTitleSoon')})` : ''}</h3>
{type.badge ? <span className={`mailpoet_badge mailpoet_badge_${type.badge.style}`}>{type.badge.text}</span> : ''}
</div>
<p>{type.description}</p>
</div>
<div className="mailpoet_actions">
<a href="?page=mailpoet-premium" target="_blank">
{MailPoet.I18n.t('wooCommercePremiumFeatureLink')}
</a>
</div>
</div>
</li>
), this)}
</ul>
</div>
);
},
});
module.exports = WooCommerceAutomaticEmail;

View File

@ -584,6 +584,7 @@ class Menu {
$data['automatic_emails'] = array(
array(
'slug' => 'woocommerce',
'beta' => true,
'premium' => true,
'title' => __('WooCommerce', 'mailpoet'),
'description' => __('Automatically send an email when there is a new WooCommerce product, order and some other action takes place.', 'mailpoet'),