Use total count of subscribers

[MAILPOET-2832]
This commit is contained in:
Pavel Dohnal
2020-04-28 13:34:04 +02:00
committed by Veljko V
parent a0358b354b
commit d5dc7b31fb
6 changed files with 9 additions and 7 deletions

View File

@@ -3,17 +3,17 @@ import MailPoet from 'mailpoet';
import HelpTooltip from 'help-tooltip.jsx'; import HelpTooltip from 'help-tooltip.jsx';
type Props = { type Props = {
subscribersLimit: number | false, subscribersInPlan: number | false,
hasValidApiKey: boolean, hasValidApiKey: boolean,
}; };
const SubscribersLimit = ({ subscribersLimit, hasValidApiKey }: Props) => { const SubscribersLimit = ({ subscribersInPlan, hasValidApiKey }: Props) => {
if (!subscribersLimit) return null; if (!subscribersInPlan) return null;
if (!hasValidApiKey) return null; if (!hasValidApiKey) return null;
return ( return (
<h3> <h3>
{MailPoet.I18n.t('subscribersInPlan') {MailPoet.I18n.t('subscribersInPlan')
.replace('%$1d', subscribersLimit.toLocaleString())} .replace('%$1d', subscribersInPlan.toLocaleString())}
{' '} {' '}
<HelpTooltip <HelpTooltip
tooltip={MailPoet.I18n.t('subscribersInPlanTooltip')} tooltip={MailPoet.I18n.t('subscribersInPlanTooltip')}

View File

@@ -127,7 +127,7 @@ function DynamicSegmentList(props) {
</h1> </h1>
<SubscribersLimit <SubscribersLimit
subscribersLimit={window.mailpoet_subscribers_limit} subscribersInPlan={window.mailpoet_subscribers_in_plan_count}
hasValidApiKey={window.mailpoet_has_valid_api_key} hasValidApiKey={window.mailpoet_has_valid_api_key}
/> />

View File

@@ -304,7 +304,7 @@ class SegmentList extends React.Component {
</h1> </h1>
<SubscribersLimit <SubscribersLimit
subscribersLimit={window.mailpoet_subscribers_limit} subscribersInPlan={window.mailpoet_subscribers_in_plan_count}
hasValidApiKey={window.mailpoet_has_valid_api_key} hasValidApiKey={window.mailpoet_has_valid_api_key}
/> />

View File

@@ -378,7 +378,7 @@ class SubscriberList extends React.Component {
</h1> </h1>
<SubscribersLimit <SubscribersLimit
subscribersLimit={window.mailpoet_subscribers_limit} subscribersInPlan={window.mailpoet_subscribers_in_plan_count}
hasValidApiKey={window.mailpoet_has_valid_api_key} hasValidApiKey={window.mailpoet_has_valid_api_key}
/> />

View File

@@ -29,6 +29,7 @@
return product; return product;
}); });
var is_woocommerce_active = <%= json_encode(is_woocommerce_active) %>; var is_woocommerce_active = <%= json_encode(is_woocommerce_active) %>;
var mailpoet_subscribers_in_plan_count = <%= subscriber_count %>;
</script> </script>
<% endblock %> <% endblock %>

View File

@@ -24,6 +24,7 @@
var mailpoet_has_valid_api_key = <%= has_valid_api_key ? 'true' : 'false' %>; var mailpoet_has_valid_api_key = <%= has_valid_api_key ? 'true' : 'false' %>;
var mailpoet_mss_key_invalid = <%= mss_key_invalid ? 'true' : 'false' %>; var mailpoet_mss_key_invalid = <%= mss_key_invalid ? 'true' : 'false' %>;
var mailpoet_subscribers_count = <%= subscriber_count %>; var mailpoet_subscribers_count = <%= subscriber_count %>;
var mailpoet_subscribers_in_plan_count = <%= subscriber_count %>;
</script> </script>
<% endblock %> <% endblock %>