Swap React.PropTypes to using standalone prop-types package
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import React from 'react';
|
||||
|
||||
const KeyValueTable = props => (
|
||||
@@ -13,13 +14,13 @@ const KeyValueTable = props => (
|
||||
);
|
||||
|
||||
KeyValueTable.propTypes = {
|
||||
max_width: React.PropTypes.string,
|
||||
rows: React.PropTypes.arrayOf(React.PropTypes.shape({
|
||||
key: React.PropTypes.string.isRequired,
|
||||
value: React.PropTypes.oneOfType([
|
||||
React.PropTypes.string,
|
||||
React.PropTypes.number,
|
||||
React.PropTypes.element,
|
||||
max_width: PropTypes.string,
|
||||
rows: PropTypes.arrayOf(PropTypes.shape({
|
||||
key: PropTypes.string.isRequired,
|
||||
value: PropTypes.oneOfType([
|
||||
PropTypes.string,
|
||||
PropTypes.number,
|
||||
PropTypes.element,
|
||||
]).isRequired,
|
||||
})).isRequired,
|
||||
};
|
||||
|
@@ -1,3 +1,4 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import React from 'react';
|
||||
import MailPoet from 'mailpoet';
|
||||
|
||||
@@ -10,10 +11,10 @@ const PrintBoolean = props => (
|
||||
);
|
||||
|
||||
PrintBoolean.propTypes = {
|
||||
truthy: React.PropTypes.string,
|
||||
falsy: React.PropTypes.string,
|
||||
unknown: React.PropTypes.string,
|
||||
children: React.PropTypes.bool,
|
||||
truthy: PropTypes.string,
|
||||
falsy: PropTypes.string,
|
||||
unknown: PropTypes.string,
|
||||
children: PropTypes.bool,
|
||||
};
|
||||
|
||||
PrintBoolean.defaultProps = {
|
||||
|
@@ -1,3 +1,4 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import React from 'react';
|
||||
|
||||
const SteppedProgressBar = (props) => {
|
||||
@@ -20,8 +21,8 @@ const SteppedProgressBar = (props) => {
|
||||
};
|
||||
|
||||
SteppedProgressBar.propTypes = {
|
||||
steps_count: React.PropTypes.number.isRequired,
|
||||
step: React.PropTypes.number.isRequired,
|
||||
steps_count: PropTypes.number.isRequired,
|
||||
step: PropTypes.number.isRequired,
|
||||
};
|
||||
|
||||
module.exports = SteppedProgressBar;
|
||||
|
@@ -7,7 +7,7 @@ import PropTypes from 'prop-types';
|
||||
|
||||
class Form extends React.Component {
|
||||
static contextTypes = {
|
||||
router: React.PropTypes.object.isRequired,
|
||||
router: PropTypes.object.isRequired,
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
|
@@ -1,3 +1,4 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import React from 'react';
|
||||
import ReactTooltip from 'react-tooltip';
|
||||
import ReactHtmlParser from 'react-html-parser';
|
||||
@@ -47,10 +48,10 @@ function Tooltip(props) {
|
||||
}
|
||||
|
||||
Tooltip.propTypes = {
|
||||
tooltipId: React.PropTypes.string,
|
||||
tooltip: React.PropTypes.node.isRequired,
|
||||
place: React.PropTypes.string,
|
||||
className: React.PropTypes.string,
|
||||
tooltipId: PropTypes.string,
|
||||
tooltip: PropTypes.node.isRequired,
|
||||
place: PropTypes.string,
|
||||
className: PropTypes.string,
|
||||
};
|
||||
|
||||
Tooltip.defaultProps = {
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import MailPoet from 'mailpoet';
|
||||
import PropTypes from 'prop-types';
|
||||
import React from 'react';
|
||||
import KeyValueTable from 'common/key_value_table.jsx';
|
||||
import PrintBoolean from 'common/print_boolean.jsx';
|
||||
@@ -46,12 +47,12 @@ const CronStatus = (props) => {
|
||||
};
|
||||
|
||||
CronStatus.propTypes = {
|
||||
status_data: React.PropTypes.shape({
|
||||
accessible: React.PropTypes.bool,
|
||||
status: React.PropTypes.string,
|
||||
updated_at: React.PropTypes.number,
|
||||
run_accessed_at: React.PropTypes.number,
|
||||
run_completed_at: React.PropTypes.number,
|
||||
status_data: PropTypes.shape({
|
||||
accessible: PropTypes.bool,
|
||||
status: PropTypes.string,
|
||||
updated_at: PropTypes.number,
|
||||
run_accessed_at: PropTypes.number,
|
||||
run_completed_at: PropTypes.number,
|
||||
}).isRequired,
|
||||
};
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import MailPoet from 'mailpoet';
|
||||
import PropTypes from 'prop-types';
|
||||
import React from 'react';
|
||||
import KeyValueTable from 'common/key_value_table.jsx';
|
||||
import TasksList from './tasks_list/tasks_list.jsx';
|
||||
@@ -58,23 +59,23 @@ const QueueStatus = (props) => {
|
||||
};
|
||||
|
||||
QueueStatus.propTypes = {
|
||||
status_data: React.PropTypes.shape({
|
||||
status: React.PropTypes.string,
|
||||
started: React.PropTypes.number,
|
||||
sent: React.PropTypes.number,
|
||||
retry_attempt: React.PropTypes.number,
|
||||
retry_at: React.PropTypes.number,
|
||||
error: React.PropTypes.shape({
|
||||
operation: React.PropTypes.string,
|
||||
error_message: React.PropTypes.string,
|
||||
status_data: PropTypes.shape({
|
||||
status: PropTypes.string,
|
||||
started: PropTypes.number,
|
||||
sent: PropTypes.number,
|
||||
retry_attempt: PropTypes.number,
|
||||
retry_at: PropTypes.number,
|
||||
error: PropTypes.shape({
|
||||
operation: PropTypes.string,
|
||||
error_message: PropTypes.string,
|
||||
}),
|
||||
tasksStatusCounts: React.PropTypes.shape({
|
||||
completed: React.PropTypes.number.isRequired,
|
||||
running: React.PropTypes.number.isRequired,
|
||||
paused: React.PropTypes.number.isRequired,
|
||||
scheduled: React.PropTypes.number.isRequired,
|
||||
tasksStatusCounts: PropTypes.shape({
|
||||
completed: PropTypes.number.isRequired,
|
||||
running: PropTypes.number.isRequired,
|
||||
paused: PropTypes.number.isRequired,
|
||||
scheduled: PropTypes.number.isRequired,
|
||||
}).isRequired,
|
||||
latestTasks: React.PropTypes.arrayOf(TasksListDataRow.propTypes.task).isRequired,
|
||||
latestTasks: PropTypes.arrayOf(TasksListDataRow.propTypes.task).isRequired,
|
||||
}).isRequired,
|
||||
};
|
||||
|
||||
|
@@ -1,3 +1,4 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import React from 'react';
|
||||
import { Link } from 'react-router';
|
||||
import classNames from 'classnames';
|
||||
@@ -44,7 +45,7 @@ function Tabs(props) {
|
||||
);
|
||||
}
|
||||
|
||||
Tabs.propTypes = { tab: React.PropTypes.string };
|
||||
Tabs.propTypes = { tab: PropTypes.string };
|
||||
Tabs.defaultProps = { tab: 'knowledgeBase' };
|
||||
|
||||
module.exports = Tabs;
|
||||
|
@@ -1,3 +1,4 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import React from 'react';
|
||||
import MailPoet from 'mailpoet';
|
||||
import TaskListDataRow from './tasks_list_data_row.jsx';
|
||||
@@ -30,8 +31,8 @@ const TasksList = (props) => {
|
||||
};
|
||||
|
||||
TasksList.propTypes = {
|
||||
show_scheduled_at: React.PropTypes.bool,
|
||||
tasks: React.PropTypes.arrayOf(TaskListDataRow.propTypes.task).isRequired,
|
||||
show_scheduled_at: PropTypes.bool,
|
||||
tasks: PropTypes.arrayOf(TaskListDataRow.propTypes.task).isRequired,
|
||||
};
|
||||
|
||||
TasksList.defaultProps = {
|
||||
|
@@ -1,3 +1,4 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import React from 'react';
|
||||
import MailPoet from 'mailpoet';
|
||||
|
||||
@@ -36,19 +37,19 @@ const TasksListDataRow = props => (
|
||||
);
|
||||
|
||||
TasksListDataRow.propTypes = {
|
||||
show_scheduled_at: React.PropTypes.bool,
|
||||
task: React.PropTypes.shape({
|
||||
id: React.PropTypes.number.isRequired,
|
||||
type: React.PropTypes.string.isRequired,
|
||||
priority: React.PropTypes.number.isRequired,
|
||||
updated_at: React.PropTypes.number.isRequired,
|
||||
scheduled_at: React.PropTypes.number,
|
||||
status: React.PropTypes.string,
|
||||
newsletter: React.PropTypes.shape({
|
||||
newsletter_id: React.PropTypes.number.isRequired,
|
||||
queue_id: React.PropTypes.number.isRequired,
|
||||
preview_url: React.PropTypes.string.isRequired,
|
||||
subject: React.PropTypes.string,
|
||||
show_scheduled_at: PropTypes.bool,
|
||||
task: PropTypes.shape({
|
||||
id: PropTypes.number.isRequired,
|
||||
type: PropTypes.string.isRequired,
|
||||
priority: PropTypes.number.isRequired,
|
||||
updated_at: PropTypes.number.isRequired,
|
||||
scheduled_at: PropTypes.number,
|
||||
status: PropTypes.string,
|
||||
newsletter: PropTypes.shape({
|
||||
newsletter_id: PropTypes.number.isRequired,
|
||||
queue_id: PropTypes.number.isRequired,
|
||||
preview_url: PropTypes.string.isRequired,
|
||||
subject: PropTypes.string,
|
||||
}),
|
||||
}).isRequired,
|
||||
};
|
||||
|
@@ -1,3 +1,4 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import React from 'react';
|
||||
import MailPoet from 'mailpoet';
|
||||
|
||||
@@ -13,7 +14,7 @@ const TasksListLabelsRow = props => (
|
||||
);
|
||||
|
||||
TasksListLabelsRow.propTypes = {
|
||||
show_scheduled_at: React.PropTypes.bool,
|
||||
show_scheduled_at: PropTypes.bool,
|
||||
};
|
||||
|
||||
TasksListLabelsRow.defaultProps = {
|
||||
|
@@ -1,3 +1,4 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import React from 'react';
|
||||
import MailPoet from 'mailpoet';
|
||||
import InAppAnnouncementDot from './in_app_announcement_dot.jsx';
|
||||
@@ -78,11 +79,11 @@ const validateBooleanWithWindowDependency = (props, propName, componentName, win
|
||||
};
|
||||
|
||||
InAppAnnouncement.propTypes = {
|
||||
width: React.PropTypes.string,
|
||||
height: React.PropTypes.string,
|
||||
className: React.PropTypes.string,
|
||||
children: React.PropTypes.element.isRequired,
|
||||
validUntil: React.PropTypes.instanceOf(Date),
|
||||
width: PropTypes.string,
|
||||
height: PropTypes.string,
|
||||
className: PropTypes.string,
|
||||
children: PropTypes.element.isRequired,
|
||||
validUntil: PropTypes.instanceOf(Date),
|
||||
showToNewUser: (props, propName, componentName) => (
|
||||
validateBooleanWithWindowDependency(props, propName, componentName, 'mailpoet_is_new_user')
|
||||
),
|
||||
|
@@ -1,3 +1,4 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import React from 'react';
|
||||
import ReactDOMServer from 'react-dom/server';
|
||||
import classNames from 'classnames';
|
||||
@@ -20,11 +21,11 @@ const InAppAnnouncementDot = props => (
|
||||
);
|
||||
|
||||
InAppAnnouncementDot.propTypes = {
|
||||
children: React.PropTypes.element.isRequired,
|
||||
width: React.PropTypes.string,
|
||||
height: React.PropTypes.string,
|
||||
className: React.PropTypes.string,
|
||||
onUserTrigger: React.PropTypes.func,
|
||||
children: PropTypes.element.isRequired,
|
||||
width: PropTypes.string,
|
||||
height: PropTypes.string,
|
||||
className: PropTypes.string,
|
||||
onUserTrigger: PropTypes.func,
|
||||
};
|
||||
|
||||
InAppAnnouncementDot.defaultProps = {
|
||||
|
@@ -48,7 +48,7 @@ const Listing = createReactClass({ // eslint-disable-line react/prefer-es6-class
|
||||
/* eslint-enable react/require-default-props */
|
||||
|
||||
contextTypes: {
|
||||
router: React.PropTypes.object.isRequired,
|
||||
router: PropTypes.object.isRequired,
|
||||
},
|
||||
|
||||
getDefaultProps: () => ({
|
||||
|
@@ -1,3 +1,4 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import React from 'react';
|
||||
import MailPoet from 'mailpoet';
|
||||
import InAppAnnouncement from 'in_app_announcements/in_app_announcement.jsx';
|
||||
@@ -19,8 +20,8 @@ const BackgroundImageAnnouncement = props => (
|
||||
);
|
||||
|
||||
BackgroundImageAnnouncement.propTypes = {
|
||||
username: React.PropTypes.string.isRequired,
|
||||
videoUrl: React.PropTypes.string.isRequired,
|
||||
username: PropTypes.string.isRequired,
|
||||
videoUrl: PropTypes.string.isRequired,
|
||||
};
|
||||
|
||||
module.exports = BackgroundImageAnnouncement;
|
||||
|
@@ -23,7 +23,7 @@ const NewsletterSend = createReactClass({ // eslint-disable-line react/prefer-es
|
||||
},
|
||||
|
||||
contextTypes: {
|
||||
router: React.PropTypes.object.isRequired,
|
||||
router: PropTypes.object.isRequired,
|
||||
},
|
||||
|
||||
getInitialState: function getInitialState() {
|
||||
|
@@ -1,3 +1,4 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import React from 'react';
|
||||
import MailPoet from 'mailpoet';
|
||||
import Breadcrumb from 'newsletters/breadcrumb.jsx';
|
||||
@@ -7,7 +8,7 @@ import 'react-router';
|
||||
|
||||
class NewsletterTypes extends React.Component {
|
||||
static contextTypes = {
|
||||
router: React.PropTypes.object.isRequired,
|
||||
router: PropTypes.object.isRequired,
|
||||
};
|
||||
|
||||
setupNewsletter = (type) => {
|
||||
|
@@ -1,3 +1,4 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import React from 'react';
|
||||
import MailPoet from 'mailpoet';
|
||||
import Breadcrumb from 'newsletters/breadcrumb.jsx';
|
||||
@@ -12,7 +13,7 @@ const field = {
|
||||
|
||||
class NewsletterNotification extends React.Component {
|
||||
static contextTypes = {
|
||||
router: React.PropTypes.object.isRequired,
|
||||
router: PropTypes.object.isRequired,
|
||||
};
|
||||
|
||||
state = {
|
||||
|
@@ -1,10 +1,11 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import React from 'react';
|
||||
import MailPoet from 'mailpoet';
|
||||
import Breadcrumb from 'newsletters/breadcrumb.jsx';
|
||||
|
||||
class NewsletterStandard extends React.Component {
|
||||
static contextTypes = {
|
||||
router: React.PropTypes.object.isRequired,
|
||||
router: PropTypes.object.isRequired,
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
|
@@ -50,7 +50,7 @@ const afterTimeTypeField = {
|
||||
|
||||
class WelcomeScheduling extends React.Component {
|
||||
static contextTypes = {
|
||||
router: React.PropTypes.object.isRequired,
|
||||
router: PropTypes.object.isRequired,
|
||||
};
|
||||
|
||||
getCurrentValue = () => this.props.item[this.props.field.name] || {};
|
||||
|
@@ -1,3 +1,4 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import React from 'react';
|
||||
import SteppedProgressBar from '../common/stepped_progess_bar.jsx';
|
||||
|
||||
@@ -13,9 +14,9 @@ const WelcomeWizardHeader = props => (
|
||||
);
|
||||
|
||||
WelcomeWizardHeader.propTypes = {
|
||||
current_step: React.PropTypes.number.isRequired,
|
||||
steps_count: React.PropTypes.number.isRequired,
|
||||
logo_src: React.PropTypes.string.isRequired,
|
||||
current_step: PropTypes.number.isRequired,
|
||||
steps_count: PropTypes.number.isRequired,
|
||||
logo_src: PropTypes.string.isRequired,
|
||||
};
|
||||
|
||||
module.exports = WelcomeWizardHeader;
|
||||
|
@@ -1,3 +1,4 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import React from 'react';
|
||||
import MailPoet from 'mailpoet';
|
||||
import ReactStringReplace from 'react-string-replace';
|
||||
@@ -62,7 +63,7 @@ const WelcomeWizardHelpInfoStep = props => (
|
||||
module.exports = WelcomeWizardHelpInfoStep;
|
||||
|
||||
WelcomeWizardHelpInfoStep.propTypes = {
|
||||
next: React.PropTypes.func.isRequired,
|
||||
next: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
module.exports = WelcomeWizardHelpInfoStep;
|
||||
|
@@ -1,3 +1,4 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import React from 'react';
|
||||
import MailPoet from 'mailpoet';
|
||||
|
||||
@@ -12,7 +13,7 @@ const WelcomeWizardMigratedUserStep = props => (
|
||||
);
|
||||
|
||||
WelcomeWizardMigratedUserStep.propTypes = {
|
||||
next: React.PropTypes.func.isRequired,
|
||||
next: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
module.exports = WelcomeWizardMigratedUserStep;
|
||||
|
@@ -1,3 +1,4 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import React from 'react';
|
||||
import MailPoet from 'mailpoet';
|
||||
import jQuery from 'jquery';
|
||||
@@ -47,13 +48,13 @@ const WelcomeWizardSenderStep = props => (
|
||||
);
|
||||
|
||||
WelcomeWizardSenderStep.propTypes = {
|
||||
finish: React.PropTypes.func.isRequired,
|
||||
loading: React.PropTypes.bool.isRequired,
|
||||
update_sender: React.PropTypes.func.isRequired,
|
||||
submit_sender: React.PropTypes.func.isRequired,
|
||||
sender: React.PropTypes.shape({
|
||||
name: React.PropTypes.string,
|
||||
address: React.PropTypes.string,
|
||||
finish: PropTypes.func.isRequired,
|
||||
loading: PropTypes.bool.isRequired,
|
||||
update_sender: PropTypes.func.isRequired,
|
||||
submit_sender: PropTypes.func.isRequired,
|
||||
sender: PropTypes.shape({
|
||||
name: PropTypes.string,
|
||||
address: PropTypes.string,
|
||||
}),
|
||||
};
|
||||
|
||||
|
@@ -1,3 +1,4 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import React from 'react';
|
||||
import MailPoet from 'mailpoet';
|
||||
import ReactStringReplace from 'react-string-replace';
|
||||
@@ -48,8 +49,8 @@ const WelcomeWizardUsageTrackingStep = props => (
|
||||
module.exports = WelcomeWizardUsageTrackingStep;
|
||||
|
||||
WelcomeWizardUsageTrackingStep.propTypes = {
|
||||
allow_action: React.PropTypes.func.isRequired,
|
||||
allow_text: React.PropTypes.string.isRequired,
|
||||
skip_action: React.PropTypes.func.isRequired,
|
||||
loading: React.PropTypes.bool.isRequired,
|
||||
allow_action: PropTypes.func.isRequired,
|
||||
allow_text: PropTypes.string.isRequired,
|
||||
skip_action: PropTypes.func.isRequired,
|
||||
loading: PropTypes.bool.isRequired,
|
||||
};
|
||||
|
@@ -1,3 +1,4 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import React from 'react';
|
||||
import MailPoet from 'mailpoet';
|
||||
|
||||
@@ -35,7 +36,7 @@ const WelcomeWizardWooCommerceStep = props => (
|
||||
module.exports = WelcomeWizardWooCommerceStep;
|
||||
|
||||
WelcomeWizardWooCommerceStep.propTypes = {
|
||||
next: React.PropTypes.func.isRequired,
|
||||
screenshot_src: React.PropTypes.string.isRequired,
|
||||
loading: React.PropTypes.bool.isRequired,
|
||||
next: PropTypes.func.isRequired,
|
||||
screenshot_src: PropTypes.string.isRequired,
|
||||
loading: PropTypes.bool.isRequired,
|
||||
};
|
||||
|
@@ -1,3 +1,4 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import React from 'react';
|
||||
import MailPoet from 'mailpoet';
|
||||
import WelcomeWizardHeader from './header.jsx';
|
||||
@@ -136,11 +137,11 @@ class WelcomeWizardStepsController extends React.Component {
|
||||
}
|
||||
|
||||
WelcomeWizardStepsController.propTypes = {
|
||||
params: React.PropTypes.shape({
|
||||
step: React.PropTypes.string.isRequired,
|
||||
params: PropTypes.shape({
|
||||
step: PropTypes.string.isRequired,
|
||||
}).isRequired,
|
||||
router: React.PropTypes.shape({
|
||||
push: React.PropTypes.func.isRequired,
|
||||
router: PropTypes.shape({
|
||||
push: PropTypes.func.isRequired,
|
||||
}).isRequired,
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user