Remove StatsMixin
This commit is contained in:
committed by
M. Shull
parent
baf21dcaf4
commit
ca1dc6fe59
@@ -194,8 +194,18 @@ function wrapInLink(content, params, id, totalSent) {
|
||||
);
|
||||
}
|
||||
|
||||
const StatisticsMixin = {
|
||||
renderStatistics: function renderStatistics(newsletter, isSent, currentTime) {
|
||||
const addStatsCTALink = (params) => {
|
||||
if (window.mailpoet_premium_active) {
|
||||
return params;
|
||||
}
|
||||
const newParams = params;
|
||||
newParams.link = 'admin.php?page=mailpoet-premium';
|
||||
newParams.externalLink = true;
|
||||
newParams.onClick = trackStatsCTAClicked;
|
||||
return newParams;
|
||||
};
|
||||
|
||||
export const renderStatistics = (newsletter, isSent, currentTime) => {
|
||||
let sent = isSent;
|
||||
if (sent === undefined) {
|
||||
// condition for standard and post notification listings
|
||||
@@ -210,7 +220,7 @@ const StatisticsMixin = {
|
||||
}
|
||||
|
||||
let params = {};
|
||||
Hooks.addFilter('mailpoet_newsletters_listing_stats_before', 'mailpoet', StatisticsMixin.addStatsCTALink);
|
||||
Hooks.addFilter('mailpoet_newsletters_listing_stats_before', 'mailpoet', addStatsCTALink);
|
||||
params = Hooks.applyFilters('mailpoet_newsletters_listing_stats_before', params, newsletter);
|
||||
|
||||
// welcome emails provide explicit total_sent value
|
||||
@@ -383,8 +393,9 @@ const StatisticsMixin = {
|
||||
{afterContent}
|
||||
</div>
|
||||
);
|
||||
},
|
||||
addStatsCTAAction: function addStatsCTAAction(actions) {
|
||||
};
|
||||
|
||||
export const addStatsCTAAction = (actions) => {
|
||||
if (window.mailpoet_premium_active) {
|
||||
return actions;
|
||||
}
|
||||
@@ -404,17 +415,6 @@ const StatisticsMixin = {
|
||||
},
|
||||
});
|
||||
return actions;
|
||||
},
|
||||
addStatsCTALink: function addStatsCTALink(params) {
|
||||
if (window.mailpoet_premium_active) {
|
||||
return params;
|
||||
}
|
||||
const newParams = params;
|
||||
newParams.link = 'admin.php?page=mailpoet-premium';
|
||||
newParams.externalLink = true;
|
||||
newParams.onClick = trackStatsCTAClicked;
|
||||
return newParams;
|
||||
},
|
||||
};
|
||||
|
||||
export const checkMailerStatus = (state) => {
|
||||
@@ -465,5 +465,3 @@ export const checkCronStatus = (state) => {
|
||||
jQuery('[data-id="mailpoet_cron_error"]')[0]
|
||||
);
|
||||
};
|
||||
|
||||
export { StatisticsMixin };
|
||||
|
@@ -13,7 +13,8 @@ import FeatureAnnouncement from 'announcements/feature_announcement.jsx';
|
||||
|
||||
import {
|
||||
renderQueueStatus,
|
||||
StatisticsMixin,
|
||||
renderStatistics,
|
||||
addStatsCTAAction,
|
||||
checkCronStatus,
|
||||
checkMailerStatus,
|
||||
} from 'newsletters/listings/mixins.jsx';
|
||||
@@ -57,7 +58,7 @@ let newsletterActions = [
|
||||
},
|
||||
];
|
||||
|
||||
Hooks.addFilter('mailpoet_newsletters_listings_notification_history_actions', 'mailpoet', StatisticsMixin.addStatsCTAAction);
|
||||
Hooks.addFilter('mailpoet_newsletters_listings_notification_history_actions', 'mailpoet', addStatsCTAAction);
|
||||
newsletterActions = Hooks.applyFilters('mailpoet_newsletters_listings_notification_history_actions', newsletterActions);
|
||||
|
||||
const NewsletterListNotificationHistory = createReactClass({ // eslint-disable-line react/prefer-es6-class, max-len
|
||||
@@ -70,8 +71,6 @@ const NewsletterListNotificationHistory = createReactClass({ // eslint-disable-l
|
||||
}).isRequired,
|
||||
},
|
||||
|
||||
mixins: [StatisticsMixin],
|
||||
|
||||
renderItem: function renderItem(newsletter, actions, meta) {
|
||||
const rowClasses = classNames(
|
||||
'manage-column',
|
||||
@@ -103,7 +102,7 @@ const NewsletterListNotificationHistory = createReactClass({ // eslint-disable-l
|
||||
</td>
|
||||
{ (mailpoetTrackingEnabled === true) ? (
|
||||
<td className="column" data-colname={MailPoet.I18n.t('statistics')}>
|
||||
{ this.renderStatistics(newsletter, undefined, meta.current_time) }
|
||||
{ renderStatistics(newsletter, undefined, meta.current_time) }
|
||||
</td>
|
||||
) : null }
|
||||
<td className="column-date" data-colname={MailPoet.I18n.t('sentOn')}>
|
||||
|
@@ -13,7 +13,8 @@ import FeatureAnnouncement from 'announcements/feature_announcement.jsx';
|
||||
|
||||
import {
|
||||
renderQueueStatus,
|
||||
StatisticsMixin,
|
||||
renderStatistics,
|
||||
addStatsCTAAction,
|
||||
checkCronStatus,
|
||||
checkMailerStatus,
|
||||
} from 'newsletters/listings/mixins.jsx';
|
||||
@@ -169,7 +170,7 @@ let newsletterActions = [
|
||||
},
|
||||
];
|
||||
|
||||
Hooks.addFilter('mailpoet_newsletters_listings_standard_actions', 'mailpoet', StatisticsMixin.addStatsCTAAction);
|
||||
Hooks.addFilter('mailpoet_newsletters_listings_standard_actions', 'mailpoet', addStatsCTAAction);
|
||||
newsletterActions = Hooks.applyFilters('mailpoet_newsletters_listings_standard_actions', newsletterActions);
|
||||
|
||||
const NewsletterListStandard = createReactClass({ // eslint-disable-line react/prefer-es6-class
|
||||
@@ -182,8 +183,6 @@ const NewsletterListStandard = createReactClass({ // eslint-disable-line react/p
|
||||
}).isRequired,
|
||||
},
|
||||
|
||||
mixins: [StatisticsMixin],
|
||||
|
||||
renderItem: function renderItem(newsletter, actions, meta) {
|
||||
const rowClasses = classNames(
|
||||
'manage-column',
|
||||
@@ -215,7 +214,7 @@ const NewsletterListStandard = createReactClass({ // eslint-disable-line react/p
|
||||
</td>
|
||||
{ (mailpoetTrackingEnabled === true) ? (
|
||||
<td className="column" data-colname={MailPoet.I18n.t('statistics')}>
|
||||
{ this.renderStatistics(newsletter, undefined, meta.current_time) }
|
||||
{ renderStatistics(newsletter, undefined, meta.current_time) }
|
||||
</td>
|
||||
) : null }
|
||||
<td className="column-date" data-colname={MailPoet.I18n.t('sentOn')}>
|
||||
|
@@ -9,7 +9,8 @@ import ListingHeading from 'newsletters/listings/heading.jsx';
|
||||
import FeatureAnnouncement from 'announcements/feature_announcement.jsx';
|
||||
|
||||
import {
|
||||
StatisticsMixin,
|
||||
renderStatistics,
|
||||
addStatsCTAAction,
|
||||
checkCronStatus,
|
||||
checkMailerStatus,
|
||||
} from 'newsletters/listings/mixins.jsx';
|
||||
@@ -154,7 +155,7 @@ let newsletterActions = [
|
||||
},
|
||||
];
|
||||
|
||||
Hooks.addFilter('mailpoet_newsletters_listings_welcome_notification_actions', 'mailpoet', StatisticsMixin.addStatsCTAAction);
|
||||
Hooks.addFilter('mailpoet_newsletters_listings_welcome_notification_actions', 'mailpoet', addStatsCTAAction);
|
||||
newsletterActions = Hooks.applyFilters('mailpoet_newsletters_listings_welcome_notification_actions', newsletterActions);
|
||||
|
||||
const NewsletterListWelcome = createReactClass({ // eslint-disable-line react/prefer-es6-class
|
||||
@@ -167,8 +168,6 @@ const NewsletterListWelcome = createReactClass({ // eslint-disable-line react/pr
|
||||
}).isRequired,
|
||||
},
|
||||
|
||||
mixins: [StatisticsMixin],
|
||||
|
||||
updateStatus: function updateStatus(e) {
|
||||
// make the event persist so that we can still override the selected value
|
||||
// in the ajax callback
|
||||
@@ -333,7 +332,7 @@ const NewsletterListWelcome = createReactClass({ // eslint-disable-line react/pr
|
||||
</td>
|
||||
{ (mailpoetTrackingEnabled === true) ? (
|
||||
<td className="column" data-colname={MailPoet.I18n.t('statistics')}>
|
||||
{ this.renderStatistics(
|
||||
{ renderStatistics(
|
||||
newsletter,
|
||||
newsletter.total_sent > 0 && newsletter.statistics
|
||||
) }
|
||||
|
Reference in New Issue
Block a user