Display sender warning on send page
[MAILPOET-1573]
This commit is contained in:
@@ -49,7 +49,7 @@ const badDomains = [
|
|||||||
'yahoo.com.mx', 'live.com.mx', 'hotmail.es', 'hotmail.com.mx', 'prodigy.net.mx',
|
'yahoo.com.mx', 'live.com.mx', 'hotmail.es', 'hotmail.com.mx', 'prodigy.net.mx',
|
||||||
|
|
||||||
/* Domains used in Brazil */
|
/* Domains used in Brazil */
|
||||||
'yahoo.com.br', 'hotmail.com.br', 'outlook.com.br', 'uol.com.br', 'bol.com.br', 'terra.com.br', 'ig.com.br', 'itelefonica.com.br', 'r7.com', 'zipmail.com.br', 'globo.com', 'globomail.com', 'oi.com.br'
|
'yahoo.com.br', 'hotmail.com.br', 'outlook.com.br', 'uol.com.br', 'bol.com.br', 'terra.com.br', 'ig.com.br', 'itelefonica.com.br', 'r7.com', 'zipmail.com.br', 'globo.com', 'globomail.com', 'oi.com.br',
|
||||||
];
|
];
|
||||||
|
|
||||||
const SenderEmailAddressWarning = ({ emailAddress }) => {
|
const SenderEmailAddressWarning = ({ emailAddress }) => {
|
||||||
|
46
assets/js/src/newsletters/send/sender_address_field.jsx
Normal file
46
assets/js/src/newsletters/send/sender_address_field.jsx
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import FormFieldText from 'form/fields/text.jsx';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import SenderEmailAddressWarning from 'common/sender_email_address_warning.jsx';
|
||||||
|
|
||||||
|
class SenderField extends React.Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = {
|
||||||
|
emailAddress: props.item.sender_address,
|
||||||
|
};
|
||||||
|
this.onChange = this.onChange.bind(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
onChange(event) {
|
||||||
|
this.setState({ emailAddress: event.target.value });
|
||||||
|
this.props.onValueChange(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return (<React.Fragment>
|
||||||
|
<FormFieldText
|
||||||
|
{...this.props}
|
||||||
|
onValueChange={this.onChange}
|
||||||
|
/>
|
||||||
|
<div className="regular-text">
|
||||||
|
<SenderEmailAddressWarning emailAddress={this.state.emailAddress} />
|
||||||
|
</div>
|
||||||
|
</React.Fragment>);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SenderField.propTypes = {
|
||||||
|
item: PropTypes.shape({
|
||||||
|
sender_address: PropTypes.string.isRequired,
|
||||||
|
}).isRequired,
|
||||||
|
onValueChange: PropTypes.func,
|
||||||
|
};
|
||||||
|
|
||||||
|
SenderField.defaultProps = {
|
||||||
|
onValueChange: function onValueChange() {
|
||||||
|
// no-op
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default SenderField;
|
@@ -5,6 +5,7 @@ import Hooks from 'wp-js-hooks';
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
|
||||||
import DateTime from 'newsletters/send/date_time.jsx';
|
import DateTime from 'newsletters/send/date_time.jsx';
|
||||||
|
import SenderField from 'newsletters/send/sender_address_field.jsx';
|
||||||
|
|
||||||
const currentTime = window.mailpoet_current_time || '00:00';
|
const currentTime = window.mailpoet_current_time || '00:00';
|
||||||
const defaultDateTime = `${window.mailpoet_current_date} 00:00:00`;
|
const defaultDateTime = `${window.mailpoet_current_date} 00:00:00`;
|
||||||
@@ -156,7 +157,8 @@ let fields = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'sender_address',
|
name: 'sender_address',
|
||||||
type: 'text',
|
type: 'reactComponent',
|
||||||
|
component: SenderField,
|
||||||
placeholder: MailPoet.I18n.t('senderAddressPlaceholder'),
|
placeholder: MailPoet.I18n.t('senderAddressPlaceholder'),
|
||||||
validation: {
|
validation: {
|
||||||
'data-parsley-required': true,
|
'data-parsley-required': true,
|
||||||
|
@@ -3,7 +3,7 @@ import React from 'react';
|
|||||||
import MailPoet from 'mailpoet';
|
import MailPoet from 'mailpoet';
|
||||||
import jQuery from 'jquery';
|
import jQuery from 'jquery';
|
||||||
|
|
||||||
import SenderEmailAddressWarning from 'common/sender_email_address_warning.jsx'
|
import SenderEmailAddressWarning from 'common/sender_email_address_warning.jsx';
|
||||||
|
|
||||||
const WelcomeWizardSenderStep = props => (
|
const WelcomeWizardSenderStep = props => (
|
||||||
<div className="mailpoet_welcome_wizard_step_content mailpoet_welcome_wizard_centered_column">
|
<div className="mailpoet_welcome_wizard_step_content mailpoet_welcome_wizard_centered_column">
|
||||||
|
@@ -67,8 +67,8 @@ jQuery('.toplevel_page_mailpoet-newsletters.menu-top-last')
|
|||||||
<%= localize({
|
<%= localize({
|
||||||
'ajaxFailedErrorMessage': __('An error has happened while performing a request, the server has responded with response code %d'),
|
'ajaxFailedErrorMessage': __('An error has happened while performing a request, the server has responded with response code %d'),
|
||||||
'senderEmailAddressWarning1': _x('You might not reach the inbox of your subscribers if you use this email address.', 'In the last step, before sending a newsletter. URL: ?page=mailpoet-newsletters#/send/2'),
|
'senderEmailAddressWarning1': _x('You might not reach the inbox of your subscribers if you use this email address.', 'In the last step, before sending a newsletter. URL: ?page=mailpoet-newsletters#/send/2'),
|
||||||
'senderEmailAddressWarning2': _x('Use an address like info@%userDomain for the Sender and put %originalSender in the the <em>Reply-to</em> field below.', 'In the last step, before sending a newsletter. URL: ?page=mailpoet-newsletters#/send/2'),
|
'senderEmailAddressWarning2': _x('Use an address like s%userDomain for the Sender and put %originalSender in the the <em>Reply-to</em> field below.', 'In the last step, before sending a newsletter. URL: ?page=mailpoet-newsletters#/send/2'),
|
||||||
'senderEmailAddressWarning3': _x('Read more.'),
|
'senderEmailAddressWarning3': __('Read more.'),
|
||||||
}) %>
|
}) %>
|
||||||
<% block translations %><% endblock %>
|
<% block translations %><% endblock %>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user