Display a notice for transactional emails opt-in

[MAILPOET-2724]
This commit is contained in:
Pavel Dohnal
2020-03-19 14:40:34 +01:00
committed by Veljko V
parent 6f4ad78536
commit d102362e34
3 changed files with 63 additions and 0 deletions

View File

@@ -17,6 +17,7 @@ import {
} from 'newsletters/listings/utils.jsx'; } from 'newsletters/listings/utils.jsx';
import NewsletterTypes from 'newsletters/types.jsx'; import NewsletterTypes from 'newsletters/types.jsx';
import SubscribersLimitNotice from 'notices/subscribers_limit_notice.jsx'; import SubscribersLimitNotice from 'notices/subscribers_limit_notice.jsx';
import TransactionalEmailsProposeOptInNotice from 'notices/transactional_emails_propose_opt_in_notice';
import { GlobalContext } from 'context/index.jsx'; import { GlobalContext } from 'context/index.jsx';
const mailpoetTrackingEnabled = (!!(window.mailpoet_tracking_enabled)); const mailpoetTrackingEnabled = (!!(window.mailpoet_tracking_enabled));
@@ -231,6 +232,11 @@ class NewsletterListStandard extends React.Component {
<FeatureAnnouncement hasNews={window.mailpoet_feature_announcement_has_news} /> <FeatureAnnouncement hasNews={window.mailpoet_feature_announcement_has_news} />
<SubscribersLimitNotice /> <SubscribersLimitNotice />
<TransactionalEmailsProposeOptInNotice
mailpoetInstalledDaysAgo={window.mailpoet_installed_days_ago}
sendTransactionalEmails={window.mailpoet_send_transactional_emails}
mtaMethod={window.mailpoet_mta_method}
/>
<ListingTabs tab="standard" /> <ListingTabs tab="standard" />

View File

@@ -0,0 +1,51 @@
import React from 'react';
import Notice from 'notices/notice';
import MailPoet from 'mailpoet';
type Props = {
mailpoetInstalledDaysAgo: number,
sendTransactionalEmails: boolean,
mtaMethod: string,
}
const TransactionalEmailsProposeOptInNotice = ({
mailpoetInstalledDaysAgo,
sendTransactionalEmails,
mtaMethod,
}: Props) => {
const enable = () => {};
const onClose = () => {};
if (mailpoetInstalledDaysAgo < 30) return null;
if (sendTransactionalEmails) return null;
if (mtaMethod === 'PHPMail') return null;
return (
<Notice type="success" timeout={false} onClose={onClose}>
<h3>{MailPoet.I18n.t('transactionalEmailNoticeTitle')}</h3>
<p>
{MailPoet.I18n.t('transactionalEmailNoticeBody')}
{' '}
<a
href="https://kb.mailpoet.com/article/292-choose-how-to-send-your-wordpress-websites-emails"
target="_blank"
rel="noopener noreferrer"
>
{MailPoet.I18n.t('transactionalEmailNoticeBodyReadMore')}
</a>
</p>
<p>
<button
type="button"
className="button"
onClick={enable}
>
{MailPoet.I18n.t('transactionalEmailNoticeCTA')}
</button>
</p>
</Notice>
);
};
export default TransactionalEmailsProposeOptInNotice;

View File

@@ -52,6 +52,8 @@
var mailpoet_editor_javascript_url = '<%= getJavascriptScriptUrl("newsletter_editor.js") %>'; var mailpoet_editor_javascript_url = '<%= getJavascriptScriptUrl("newsletter_editor.js") %>';
var mailpoet_subscribers_count = <%= subscriber_count %>; var mailpoet_subscribers_count = <%= subscriber_count %>;
var mailpoet_newsletters_count = <%= newsletters_count %>; var mailpoet_newsletters_count = <%= newsletters_count %>;
var mailpoet_send_transactional_emails = <%= json_encode(settings.send_transactional_emails == '1') %>;
var settings = <%= json_encode(settings) %>;
<% if not(premium_plugin_active) %> <% if not(premium_plugin_active) %>
var mailpoet_free_premium_subscribers_limit = <%= free_premium_subscribers_limit %>; var mailpoet_free_premium_subscribers_limit = <%= free_premium_subscribers_limit %>;
@@ -318,6 +320,10 @@
'backToPostNotifications': __('Back to Post notifications'), 'backToPostNotifications': __('Back to Post notifications'),
'noSubscribers': __('No subscribers!'), 'noSubscribers': __('No subscribers!'),
'transactionalEmailNoticeTitle': __('Good news! MailPoet can now send your websites emails too'),
'transactionalEmailNoticeBody': __('All of your WordPress and WooCommerce emails are sent with your hosting company, unless you have an SMTP plugin. Would you like such emails to be delivered with MailPoets active sending method for better deliverability?'),
'transactionalEmailNoticeBodyReadMore': _x('Read more.', 'This is a link that leads to more information about transactional emails'),
'transactionalEmailNoticeCTA': _x('Enable', 'Button, after clicking it we will enable transactional emails'),
'mailerSendErrorNotice': __('Sending has been paused due to a technical issue with %$1s'), 'mailerSendErrorNotice': __('Sending has been paused due to a technical issue with %$1s'),
'mailerSendErrorCheckConfiguration': __('Please check your sending method configuration, you may need to consult with your hosting company.'), 'mailerSendErrorCheckConfiguration': __('Please check your sending method configuration, you may need to consult with your hosting company.'),
'mailerSendErrorUseSendingService': __('The easy alternative is to <b>send emails with MailPoet Sending Service</b> instead, like thousands of other users do.'), 'mailerSendErrorUseSendingService': __('The easy alternative is to <b>send emails with MailPoet Sending Service</b> instead, like thousands of other users do.'),