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 MailPoet from 'mailpoet';
|
||||
|
||||
const MethodMailChimp = ({ setInputValid }) => {
|
||||
const MethodMailChimp = ({ setInputValid, setInputInvalid, onValueChange }) => {
|
||||
const [key, setKey] = useState('');
|
||||
|
||||
return (
|
||||
<>
|
||||
<label htmlFor="paste_input" className="import_method_paste">
|
||||
<div>
|
||||
MethodMailChimp
|
||||
<span className="import_heading">{MailPoet.I18n.t('methodMailChimpLabel')}</span>
|
||||
</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 = {
|
||||
setInputValid: PropTypes.func,
|
||||
setInputInvalid: PropTypes.func,
|
||||
onValueChange: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
MethodMailChimp.defaultProps = {
|
||||
setInputValid: () => {},
|
||||
setInputInvalid: () => {},
|
||||
};
|
||||
|
||||
export default MethodMailChimp;
|
||||
|
@@ -26,7 +26,7 @@
|
||||
importData = {},
|
||||
mailpoetColumnsSelect2 = <%= subscriberFieldsSelect2|raw %>,
|
||||
mailpoetColumns = <%= subscriberFields|raw %>,
|
||||
mailpoetSegments = <%= segments|raw %>
|
||||
mailpoetSegments = <%= segments|raw %>;
|
||||
<% set newUser = (is_new_user == true) ? 'true' : 'false' %>
|
||||
var mailpoet_is_new_user = <%= newUser %>;
|
||||
</script>
|
||||
@@ -97,6 +97,8 @@
|
||||
'methodPaste': __('Paste the data into a text box'),
|
||||
'methodUpload': __('Upload a file'),
|
||||
'methodMailChimp': __('Import from MailChimp'),
|
||||
'methodMailChimpLabel': __('Enter your MailChimp API key'),
|
||||
'methodMailChimpVerify': __('Verify'),
|
||||
'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].'),
|
||||
'methodSelectionHead': __('How would you like to import subscribers?')
|
||||
|
Reference in New Issue
Block a user