Add reply-to field to wizard
[MAILPOET-1573]
This commit is contained in:
@@ -43,6 +43,18 @@ const WelcomeWizardSenderStep = props => (
|
|||||||
onChange={e => props.update_sender({ address: e.target.value })}
|
onChange={e => props.update_sender({ address: e.target.value })}
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
|
<label htmlFor="replyToAddress">
|
||||||
|
{MailPoet.I18n.t('replyToAddress')}:
|
||||||
|
<input
|
||||||
|
name="replyToAddress"
|
||||||
|
type="text"
|
||||||
|
placeholder="john@doe.com"
|
||||||
|
value={props.reply_to ? props.reply_to.address : ''}
|
||||||
|
data-parsley-required
|
||||||
|
data-parsley-type="email"
|
||||||
|
onChange={e => props.update_reply_to({ address: e.target.value })}
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
<SenderEmailAddressWarning emailAddress={props.sender.address} />
|
<SenderEmailAddressWarning emailAddress={props.sender.address} />
|
||||||
<input className="button button-primary" type="submit" value={MailPoet.I18n.t('next')} />
|
<input className="button button-primary" type="submit" value={MailPoet.I18n.t('next')} />
|
||||||
<a onClick={props.finish} href="#finish" className="sender_form_small">{MailPoet.I18n.t('noThanksSkip')}</a>
|
<a onClick={props.finish} href="#finish" className="sender_form_small">{MailPoet.I18n.t('noThanksSkip')}</a>
|
||||||
@@ -55,14 +67,19 @@ WelcomeWizardSenderStep.propTypes = {
|
|||||||
loading: PropTypes.bool.isRequired,
|
loading: PropTypes.bool.isRequired,
|
||||||
update_sender: PropTypes.func.isRequired,
|
update_sender: PropTypes.func.isRequired,
|
||||||
submit_sender: PropTypes.func.isRequired,
|
submit_sender: PropTypes.func.isRequired,
|
||||||
|
update_reply_to: PropTypes.func.isRequired,
|
||||||
sender: PropTypes.shape({
|
sender: PropTypes.shape({
|
||||||
name: PropTypes.string,
|
name: PropTypes.string,
|
||||||
address: PropTypes.string,
|
address: PropTypes.string,
|
||||||
}),
|
}),
|
||||||
|
reply_to: PropTypes.shape({
|
||||||
|
address: PropTypes.string,
|
||||||
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
WelcomeWizardSenderStep.defaultProps = {
|
WelcomeWizardSenderStep.defaultProps = {
|
||||||
sender: null,
|
sender: null,
|
||||||
|
reply_to: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default WelcomeWizardSenderStep;
|
export default WelcomeWizardSenderStep;
|
||||||
|
@@ -17,12 +17,14 @@ class WelcomeWizardStepsController extends React.Component {
|
|||||||
shouldSetSender: !window.is_mp2_migration_complete,
|
shouldSetSender: !window.is_mp2_migration_complete,
|
||||||
loading: false,
|
loading: false,
|
||||||
sender: window.sender_data,
|
sender: window.sender_data,
|
||||||
|
replyTo: window.reply_to_data,
|
||||||
};
|
};
|
||||||
|
|
||||||
this.finishWizard = this.finishWizard.bind(this);
|
this.finishWizard = this.finishWizard.bind(this);
|
||||||
this.updateSettings = this.updateSettings.bind(this);
|
this.updateSettings = this.updateSettings.bind(this);
|
||||||
this.activateTracking = this.activateTracking.bind(this);
|
this.activateTracking = this.activateTracking.bind(this);
|
||||||
this.updateSender = this.updateSender.bind(this);
|
this.updateSender = this.updateSender.bind(this);
|
||||||
|
this.updateReplyTo = this.updateReplyTo.bind(this);
|
||||||
this.submitSender = this.submitSender.bind(this);
|
this.submitSender = this.submitSender.bind(this);
|
||||||
this.showWooCommerceStepOrFinish = this.showWooCommerceStepOrFinish.bind(this);
|
this.showWooCommerceStepOrFinish = this.showWooCommerceStepOrFinish.bind(this);
|
||||||
this.componentDidUpdate();
|
this.componentDidUpdate();
|
||||||
@@ -79,8 +81,17 @@ class WelcomeWizardStepsController extends React.Component {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateReplyTo(data) {
|
||||||
|
this.setState({
|
||||||
|
replyTo: Object.assign({}, this.state.replyTo, data),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
submitSender() {
|
submitSender() {
|
||||||
this.updateSettings({ sender: this.state.sender }).then(() => (this.props.history.push('/steps/2')));
|
this.updateSettings({
|
||||||
|
sender: this.state.sender,
|
||||||
|
reply_to: this.state.replyTo,
|
||||||
|
}).then(() => (this.props.history.push('/steps/2')));
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
@@ -96,9 +107,11 @@ class WelcomeWizardStepsController extends React.Component {
|
|||||||
<WelcomeWizardSenderStep
|
<WelcomeWizardSenderStep
|
||||||
update_sender={this.updateSender}
|
update_sender={this.updateSender}
|
||||||
submit_sender={this.submitSender}
|
submit_sender={this.submitSender}
|
||||||
|
update_reply_to={this.updateReplyTo}
|
||||||
finish={this.finishWizard}
|
finish={this.finishWizard}
|
||||||
loading={this.state.loading}
|
loading={this.state.loading}
|
||||||
sender={this.state.sender}
|
sender={this.state.sender}
|
||||||
|
reply_to={this.state.replyTo}
|
||||||
/> : null
|
/> : null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -343,7 +343,8 @@ class Menu {
|
|||||||
'is_mp2_migration_complete' => (bool)Setting::getValue('mailpoet_migration_complete'),
|
'is_mp2_migration_complete' => (bool)Setting::getValue('mailpoet_migration_complete'),
|
||||||
'is_woocommerce_active' => class_exists('WooCommerce'),
|
'is_woocommerce_active' => class_exists('WooCommerce'),
|
||||||
'finish_wizard_url' => admin_url('admin.php?page=' . self::MAIN_PAGE_SLUG),
|
'finish_wizard_url' => admin_url('admin.php?page=' . self::MAIN_PAGE_SLUG),
|
||||||
'sender' => Setting::getValue('sender')
|
'sender' => Setting::getValue('sender'),
|
||||||
|
'reply_to' => Setting::getValue('reply_to'),
|
||||||
];
|
];
|
||||||
$this->displayPage('welcome_wizard.html', $data);
|
$this->displayPage('welcome_wizard.html', $data);
|
||||||
}
|
}
|
||||||
|
@@ -9,6 +9,7 @@
|
|||||||
var is_woocommerce_active = <%= json_encode(is_woocommerce_active) %>;
|
var is_woocommerce_active = <%= json_encode(is_woocommerce_active) %>;
|
||||||
var finish_wizard_url = '<%= finish_wizard_url %>';
|
var finish_wizard_url = '<%= finish_wizard_url %>';
|
||||||
var sender_data = <%= json_encode(sender) %>;
|
var sender_data = <%= json_encode(sender) %>;
|
||||||
|
var reply_to_data = <%= json_encode(reply_to) %>;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div id="welcome_wizard_container"></div>
|
<div id="welcome_wizard_container"></div>
|
||||||
@@ -37,6 +38,7 @@
|
|||||||
'allowAndFinish': _x('Allow & Finish', 'A label on a button'),
|
'allowAndFinish': _x('Allow & Finish', 'A label on a button'),
|
||||||
'allowAndContinue': _x('Allow & Continue', 'A label on a button'),
|
'allowAndContinue': _x('Allow & Continue', 'A label on a button'),
|
||||||
'senderAddress': _x('From Address', 'A form field label'),
|
'senderAddress': _x('From Address', 'A form field label'),
|
||||||
|
'replyToAddress': _x('Reply-to Address', 'A form field label'),
|
||||||
'senderName': _x('From Name', 'A form field label'),
|
'senderName': _x('From Name', 'A form field label'),
|
||||||
'next': _x('Next', 'A label on a button'),
|
'next': _x('Next', 'A label on a button'),
|
||||||
'gotIt': _x('Got it!', 'A label on a button'),
|
'gotIt': _x('Got it!', 'A label on a button'),
|
||||||
|
Reference in New Issue
Block a user