Create mailchimp component in react
[MAILPOET-1808]
This commit is contained in:
@@ -1,21 +1,39 @@
|
|||||||
import React from 'react';
|
import React, { useState } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import MailPoet from 'mailpoet';
|
import MailPoet from 'mailpoet';
|
||||||
|
|
||||||
const MethodMailChimp = ({ setInputValid }) => {
|
const MethodMailChimp = ({ setInputValid, setInputInvalid, onValueChange }) => {
|
||||||
|
const [key, setKey] = useState('');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<>
|
||||||
|
<label htmlFor="paste_input" className="import_method_paste">
|
||||||
<div>
|
<div>
|
||||||
MethodMailChimp
|
<span className="import_heading">{MailPoet.I18n.t('methodMailChimpLabel')}</span>
|
||||||
</div>
|
</div>
|
||||||
|
<input
|
||||||
|
id="paste_input"
|
||||||
|
type="text"
|
||||||
|
onChange={setKey}
|
||||||
|
/>
|
||||||
|
<button className="button" type="button">
|
||||||
|
{MailPoet.I18n.t('methodMailChimpVerify')}
|
||||||
|
</button>
|
||||||
|
<span className="mailpoet_mailchimp-key-status"></span>
|
||||||
|
</label>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
MethodMailChimp.propTypes = {
|
MethodMailChimp.propTypes = {
|
||||||
setInputValid: PropTypes.func,
|
setInputValid: PropTypes.func,
|
||||||
|
setInputInvalid: PropTypes.func,
|
||||||
|
onValueChange: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
MethodMailChimp.defaultProps = {
|
MethodMailChimp.defaultProps = {
|
||||||
setInputValid: () => {},
|
setInputValid: () => {},
|
||||||
|
setInputInvalid: () => {},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default MethodMailChimp;
|
export default MethodMailChimp;
|
||||||
|
@@ -26,7 +26,7 @@
|
|||||||
importData = {},
|
importData = {},
|
||||||
mailpoetColumnsSelect2 = <%= subscriberFieldsSelect2|raw %>,
|
mailpoetColumnsSelect2 = <%= subscriberFieldsSelect2|raw %>,
|
||||||
mailpoetColumns = <%= subscriberFields|raw %>,
|
mailpoetColumns = <%= subscriberFields|raw %>,
|
||||||
mailpoetSegments = <%= segments|raw %>
|
mailpoetSegments = <%= segments|raw %>;
|
||||||
<% set newUser = (is_new_user == true) ? 'true' : 'false' %>
|
<% set newUser = (is_new_user == true) ? 'true' : 'false' %>
|
||||||
var mailpoet_is_new_user = <%= newUser %>;
|
var mailpoet_is_new_user = <%= newUser %>;
|
||||||
</script>
|
</script>
|
||||||
@@ -97,6 +97,8 @@
|
|||||||
'methodPaste': __('Paste the data into a text box'),
|
'methodPaste': __('Paste the data into a text box'),
|
||||||
'methodUpload': __('Upload a file'),
|
'methodUpload': __('Upload a file'),
|
||||||
'methodMailChimp': __('Import from MailChimp'),
|
'methodMailChimp': __('Import from MailChimp'),
|
||||||
|
'methodMailChimpLabel': __('Enter your MailChimp API key'),
|
||||||
|
'methodMailChimpVerify': __('Verify'),
|
||||||
'pasteLabel': __('Copy and paste your subscribers from Excel/Spreadsheets'),
|
'pasteLabel': __('Copy and paste your subscribers from Excel/Spreadsheets'),
|
||||||
'pasteDescription': __('This file needs to be formatted in a CSV style (comma-separated-values.) Look at some [link]examples on our support site[/link].'),
|
'pasteDescription': __('This file needs to be formatted in a CSV style (comma-separated-values.) Look at some [link]examples on our support site[/link].'),
|
||||||
'methodSelectionHead': __('How would you like to import subscribers?')
|
'methodSelectionHead': __('How would you like to import subscribers?')
|
||||||
|
Reference in New Issue
Block a user