Fix new code

This commit is contained in:
Pavel Dohnal
2019-01-29 12:35:41 +01:00
parent 3128da45b3
commit 6ffac49364
11 changed files with 1748 additions and 1741 deletions

View File

@ -45,29 +45,29 @@ class ConfirmAlert extends React.Component {
return (this.state.show
&& (
<div className="mailpoet_modal_overlay">
<div className="mailpoet_popup" tabIndex="-1">
<div className="mailpoet_popup_wrapper">
<button className="mailpoet_modal_close" onClick={this.onClose} type="button" />
{title
<div className="mailpoet_modal_overlay">
<div className="mailpoet_popup" tabIndex="-1">
<div className="mailpoet_popup_wrapper">
<button className="mailpoet_modal_close" onClick={this.onClose} type="button" />
{title
&& (
<div className="mailpoet_popup_title">
<h2>{title}</h2>
</div>
<div className="mailpoet_popup_title">
<h2>{title}</h2>
</div>
)
}
<div className="mailpoet_popup_body clearfix">
<p className="mailpoet_hp_email_label">{message}</p>
<button className="button button-secondary" onClick={this.onClose} type="button">
{cancelLabel}
</button>
<button className="button button-primary" onClick={this.onConfirm} type="submit">
{confirmLabel}
</button>
}
<div className="mailpoet_popup_body clearfix">
<p className="mailpoet_hp_email_label">{message}</p>
<button className="button button-secondary" onClick={this.onClose} type="button">
{cancelLabel}
</button>
<button className="button button-primary" onClick={this.onConfirm} type="submit">
{confirmLabel}
</button>
</div>
</div>
</div>
</div>
</div>
)
);
}

View File

@ -56,29 +56,31 @@ const SenderEmailAddressWarning = ({ emailAddress }) => {
const emailAddressDomain = emailAddress.split('@').pop().toLowerCase();
if (badDomains.indexOf(emailAddressDomain) > -1) {
const userHostDomain = window.location.hostname.replace('www.', '');
return (<React.Fragment>
<p className="sender_email_address_warning">{MailPoet.I18n.t('senderEmailAddressWarning1')}</p>
<p className="sender_email_address_warning">
{ReactStringReplace(
MailPoet.I18n.t('senderEmailAddressWarning2'),
/(%suggested|%originalSender|<em>.*<\/em>)/,
(match) => {
if (match === '%suggested') return `info@${userHostDomain}`;
if (match === '%originalSender') return <em key="sender-email">{ emailAddress }</em>;
return <em key="reply-to">{match.replace(/<\/?em>/g, '')}</em>;
}
)}
</p>
<p className="sender_email_address_warning">
<a
href="https://kb.mailpoet.com/article/259-your-from-address-cannot-be-yahoo-com-gmail-com-outlook-com"
target="_blank"
rel="noopener noreferrer"
>
{MailPoet.I18n.t('senderEmailAddressWarning3')}
</a>
</p>
</React.Fragment>);
return (
<React.Fragment>
<p className="sender_email_address_warning">{MailPoet.I18n.t('senderEmailAddressWarning1')}</p>
<p className="sender_email_address_warning">
{ReactStringReplace(
MailPoet.I18n.t('senderEmailAddressWarning2'),
/(%suggested|%originalSender|<em>.*<\/em>)/,
(match) => {
if (match === '%suggested') return `info@${userHostDomain}`;
if (match === '%originalSender') return <em key="sender-email">{ emailAddress }</em>;
return <em key="reply-to">{match.replace(/<\/?em>/g, '')}</em>;
}
)}
</p>
<p className="sender_email_address_warning">
<a
href="https://kb.mailpoet.com/article/259-your-from-address-cannot-be-yahoo-com-gmail-com-outlook-com"
target="_blank"
rel="noopener noreferrer"
>
{MailPoet.I18n.t('senderEmailAddressWarning3')}
</a>
</p>
</React.Fragment>
);
}
return null;
};

View File

@ -44,8 +44,8 @@ class ListingItem extends React.Component {
<th className="mailpoet-check-column" scope="row">
<label className="screen-reader-text" htmlFor={`listing-row-checkbox-${this.props.item.id}`}>
{
`Select ${this.props.item[this.props.columns[0].name]}`
}
`Select ${this.props.item[this.props.columns[0].name]}`
}
</label>
<input
type="checkbox"

View File

@ -4,10 +4,9 @@ define('modal', ['mailpoet', 'jquery'],
'use strict';
var MailPoet = mp;
var closeModalImage =
'<svg viewBox="0 0 23 23" xmlns="http://www.w3.org/2000/svg">' +
'<path d="M21.454 1.546L1.546 21.454M1.546 1.546L21.454 21.454" stroke-width="3" stroke-linecap="round" />' +
'</svg>';
var closeModalImage = '<svg viewBox="0 0 23 23" xmlns="http://www.w3.org/2000/svg">'
+ '<path d="M21.454 1.546L1.546 21.454M1.546 1.546L21.454 21.454" stroke-width="3" stroke-linecap="round" />'
+ '</svg>';
/** *************************************************************************
MailPoet Modal:
@ -85,27 +84,27 @@ define('modal', ['mailpoet', 'jquery'],
options: {},
templates: {
overlay: '<div id="mailpoet_modal_overlay" class="mailpoet_modal_overlay" style="display:none;"></div>',
popup: '<div id="mailpoet_popup" class="mailpoet_popup" tabindex="-1">' +
'<div class="mailpoet_popup_wrapper">' +
'<a href="javascript:;" id="mailpoet_modal_close" class="mailpoet_modal_close">' + closeModalImage + '</a>' +
'<div id="mailpoet_popup_title" class="mailpoet_popup_title"><h2></h2></div>' +
'<div class="mailpoet_popup_body clearfix"></div>' +
'</div>' +
'</div>',
loading: '<div id="mailpoet_loading" class="mailpoet_loading" style="display:none;">' +
'<div id="mailpoet_modal_loading_1" class="mailpoet_modal_loading mailpoet_modal_loading_1"></div>' +
'<div id="mailpoet_modal_loading_2" class="mailpoet_modal_loading mailpoet_modal_loading_2"></div>' +
'<div id="mailpoet_modal_loading_3" class="mailpoet_modal_loading mailpoet_modal_loading_3"></div>' +
'</div>',
panel: '<div id="mailpoet_panel" class="mailpoet_panel">' +
'<a href="javascript:;" id="mailpoet_modal_close" class="mailpoet_modal_close">' + closeModalImage + '</a>' +
'<div class="mailpoet_panel_wrapper" tabindex="-1">' +
'<div class="mailpoet_panel_body clearfix"></div>' +
'</div>' +
'</div>',
subpanel: '<div class="mailpoet_panel_wrapper" tabindex="-1">' +
'<div class="mailpoet_panel_body clearfix"></div>' +
'</div>'
popup: '<div id="mailpoet_popup" class="mailpoet_popup" tabindex="-1">'
+ '<div class="mailpoet_popup_wrapper">'
+ '<a href="javascript:;" id="mailpoet_modal_close" class="mailpoet_modal_close">' + closeModalImage + '</a>'
+ '<div id="mailpoet_popup_title" class="mailpoet_popup_title"><h2></h2></div>'
+ '<div class="mailpoet_popup_body clearfix"></div>'
+ '</div>'
+ '</div>',
loading: '<div id="mailpoet_loading" class="mailpoet_loading" style="display:none;">'
+ '<div id="mailpoet_modal_loading_1" class="mailpoet_modal_loading mailpoet_modal_loading_1"></div>'
+ '<div id="mailpoet_modal_loading_2" class="mailpoet_modal_loading mailpoet_modal_loading_2"></div>'
+ '<div id="mailpoet_modal_loading_3" class="mailpoet_modal_loading mailpoet_modal_loading_3"></div>'
+ '</div>',
panel: '<div id="mailpoet_panel" class="mailpoet_panel">'
+ '<a href="javascript:;" id="mailpoet_modal_close" class="mailpoet_modal_close">' + closeModalImage + '</a>'
+ '<div class="mailpoet_panel_wrapper" tabindex="-1">'
+ '<div class="mailpoet_panel_body clearfix"></div>'
+ '</div>'
+ '</div>',
subpanel: '<div class="mailpoet_panel_wrapper" tabindex="-1">'
+ '<div class="mailpoet_panel_body clearfix"></div>'
+ '</div>'
},
getContentContainer: function () {
return jQuery('.mailpoet_' + this.options.type + '_body');

View File

@ -29,13 +29,13 @@ function Success(props) {
<img src={props.illustrationImageUrl} alt="" width="750" height="250" />
{showSuccessDeliveryPoll
&& (
<div
className="typeform-widget"
data-url="https://mailpoet.typeform.com/to/ciWID6"
data-transparency="100"
data-hide-headers="true"
data-hide-footer="true"
/>
<div
className="typeform-widget"
data-url="https://mailpoet.typeform.com/to/ciWID6"
data-transparency="100"
data-hide-headers="true"
data-hide-footer="true"
/>
)
}
<button type="button" className="button" onClick={props.successClicked}>{MailPoet.I18n.t('close')}</button>

View File

@ -18,15 +18,17 @@ class SenderField extends React.Component {
}
render() {
return (<React.Fragment>
<FormFieldText
{...this.props}
onValueChange={this.onChange}
/>
<div className="regular-text">
<SenderEmailAddressWarning emailAddress={this.state.emailAddress} />
</div>
</React.Fragment>);
return (
<React.Fragment>
<FormFieldText
{...this.props}
onValueChange={this.onChange}
/>
<div className="regular-text">
<SenderEmailAddressWarning emailAddress={this.state.emailAddress} />
</div>
</React.Fragment>
);
}
}

View File

@ -35,7 +35,7 @@ class AutomaticEmailEvent extends React.PureComponent {
className="button button-primary"
disabled={disabled}
onClick={onClick}
role="button"
role="presentation"
data-automation-id={`create_${event.slug}`}
onKeyDown={(keyEvent) => {
if ((['keydown', 'keypress'].includes(keyEvent.type) && ['Enter', ' '].includes(keyEvent.key))

View File

@ -23,51 +23,53 @@ class DefaultSender extends React.Component {
}
render() {
return (<React.Fragment>
<p>
<label htmlFor="settings[from_name]">{MailPoet.I18n.t('from')}</label>
<input
type="text"
id="settings[from_name]"
data-automation-id="settings-page-from-name-field"
name="sender[name]"
value={this.state.senderName}
onChange={partial(this.onChange, 'senderName')}
placeholder={MailPoet.I18n.t('yourName')}
/>
<input
type="email"
id="settings[from_email]"
data-automation-id="settings-page-from-email-field"
name="sender[address]"
value={this.state.senderAddress}
onChange={partial(this.onChange, 'senderAddress')}
placeholder="from@mydomain.com"
/>
</p>
<p>
<label htmlFor="settings[reply_name]">{MailPoet.I18n.t('replyTo')}</label>
<input
type="text"
id="settings[reply_name]"
name="reply_to[name]"
value={this.state.replyToName}
onChange={partial(this.onChange, 'replyToName')}
placeholder={MailPoet.I18n.t('yourName')}
/>
<input
type="email"
id="settings[reply_email]"
name="reply_to[address]"
value={this.state.replyToAddress}
onChange={partial(this.onChange, 'replyToAddress')}
placeholder="reply_to@mydomain.com"
/>
</p>
<div className="regular-text">
<SenderEmailAddressWarning emailAddress={this.state.senderAddress} />
</div>
</React.Fragment>);
return (
<React.Fragment>
<p>
<label htmlFor="settings[from_name]">{MailPoet.I18n.t('from')}</label>
<input
type="text"
id="settings[from_name]"
data-automation-id="settings-page-from-name-field"
name="sender[name]"
value={this.state.senderName}
onChange={partial(this.onChange, 'senderName')}
placeholder={MailPoet.I18n.t('yourName')}
/>
<input
type="email"
id="settings[from_email]"
name="sender[address]"
data-automation-id="settings-page-from-email-field"
value={this.state.senderAddress}
onChange={partial(this.onChange, 'senderAddress')}
placeholder="from@mydomain.com"
/>
</p>
<p>
<label htmlFor="settings[reply_name]">{MailPoet.I18n.t('replyTo')}</label>
<input
type="text"
id="settings[reply_name]"
name="reply_to[name]"
value={this.state.replyToName}
onChange={partial(this.onChange, 'replyToName')}
placeholder={MailPoet.I18n.t('yourName')}
/>
<input
type="email"
id="settings[reply_email]"
name="reply_to[address]"
value={this.state.replyToAddress}
onChange={partial(this.onChange, 'replyToAddress')}
placeholder="reply_to@mydomain.com"
/>
</p>
<div className="regular-text">
<SenderEmailAddressWarning emailAddress={this.state.senderAddress} />
</div>
</React.Fragment>
);
}
}

View File

@ -46,7 +46,8 @@ const WelcomeWizardSenderStep = props => (
/>
</label>
<label htmlFor="replyToAddress">
{MailPoet.I18n.t('replyToAddress')}:
{MailPoet.I18n.t('replyToAddress')}
:
<input
name="replyToAddress"
type="text"

View File

@ -80,9 +80,9 @@ class WelcomeWizardStepsController extends React.Component {
}
updateReplyTo(data) {
this.setState({
replyTo: Object.assign({}, this.state.replyTo, data),
});
this.setState(prevState => ({
sender: Object.assign({}, prevState.replyTo, data),
}));
}
submitSender() {

3215
package-lock.json generated

File diff suppressed because it is too large Load Diff