Rename method and variables for clarity
[MAILPOET-2624]
This commit is contained in:
committed by
Jack Kitterhing
parent
5d59f53834
commit
d2494469c0
@ -4,12 +4,12 @@ import Notice from 'notices/notice.jsx';
|
|||||||
|
|
||||||
const SubscribersLimitNotice = () => {
|
const SubscribersLimitNotice = () => {
|
||||||
if (!window.mailpoet_subscribers_limit_reached) return null;
|
if (!window.mailpoet_subscribers_limit_reached) return null;
|
||||||
const hasKey = window.mailpoet_has_api_key;
|
const hasValidApiKey = window.mailpoet_has_valid_api_key;
|
||||||
const title = MailPoet.I18n.t('subscribersLimitNoticeTitle')
|
const title = MailPoet.I18n.t('subscribersLimitNoticeTitle')
|
||||||
.replace('[subscribersLimit]', window.mailpoet_subscribers_limit);
|
.replace('[subscribersLimit]', window.mailpoet_subscribers_limit);
|
||||||
const youReachedTheLimit = MailPoet.I18n.t(hasKey ? 'yourPlanLimit' : 'freeVersionLimit')
|
const youReachedTheLimit = MailPoet.I18n.t(hasValidApiKey ? 'yourPlanLimit' : 'freeVersionLimit')
|
||||||
.replace('[subscribersLimit]', window.mailpoet_subscribers_limit);
|
.replace('[subscribersLimit]', window.mailpoet_subscribers_limit);
|
||||||
const upgradeLink = hasKey
|
const upgradeLink = hasValidApiKey
|
||||||
? 'https://account.mailpoet.com/upgrade'
|
? 'https://account.mailpoet.com/upgrade'
|
||||||
: `https://account.mailpoet.com/?s=${window.mailpoet_subscribers_count + 1}`;
|
: `https://account.mailpoet.com/?s=${window.mailpoet_subscribers_count + 1}`;
|
||||||
const refreshSubscribers = async () => {
|
const refreshSubscribers = async () => {
|
||||||
@ -38,7 +38,7 @@ const SubscribersLimitNotice = () => {
|
|||||||
>
|
>
|
||||||
{MailPoet.I18n.t('upgradeNow')}
|
{MailPoet.I18n.t('upgradeNow')}
|
||||||
</a>
|
</a>
|
||||||
{hasKey && (
|
{hasValidApiKey && (
|
||||||
<>
|
<>
|
||||||
{' '}
|
{' '}
|
||||||
<button
|
<button
|
||||||
|
@ -97,7 +97,7 @@ class Newsletters {
|
|||||||
$data['installed_days_ago'] = (int)$installedAtDateTime->diff(new \DateTime())->format('%a');
|
$data['installed_days_ago'] = (int)$installedAtDateTime->diff(new \DateTime())->format('%a');
|
||||||
$data['subscribers_limit'] = $this->subscribers_feature->getSubscribersLimit();
|
$data['subscribers_limit'] = $this->subscribers_feature->getSubscribersLimit();
|
||||||
$data['subscribers_limit_reached'] = $this->subscribers_feature->check();
|
$data['subscribers_limit_reached'] = $this->subscribers_feature->check();
|
||||||
$data['has_api_key'] = $this->subscribers_feature->hasAPIKey();
|
$data['has_valid_api_key'] = $this->subscribers_feature->hasValidApiKey();
|
||||||
|
|
||||||
$date_time = new DateTime();
|
$date_time = new DateTime();
|
||||||
$data['current_date'] = $date_time->getCurrentDate(DateTime::DEFAULT_DATE_FORMAT);
|
$data['current_date'] = $date_time->getCurrentDate(DateTime::DEFAULT_DATE_FORMAT);
|
||||||
|
@ -128,7 +128,7 @@ class Worker {
|
|||||||
$unsubscribed = ($statistics->getUnsubscribeCount() * 100) / $statistics->getTotalSentCount();
|
$unsubscribed = ($statistics->getUnsubscribeCount() * 100) / $statistics->getTotalSentCount();
|
||||||
$subject = $newsletter->getLatestQueue()->getNewsletterRenderedSubject();
|
$subject = $newsletter->getLatestQueue()->getNewsletterRenderedSubject();
|
||||||
$subscribers_count = $this->subscribers_repository->getTotalSubscribers();
|
$subscribers_count = $this->subscribers_repository->getTotalSubscribers();
|
||||||
$has_key = $this->subscribers_feature->hasAPIKey();
|
$has_valid_api_key = $this->subscribers_feature->hasValidApiKey();
|
||||||
$context = [
|
$context = [
|
||||||
'subject' => $subject,
|
'subject' => $subject,
|
||||||
'preheader' => sprintf(_x(
|
'preheader' => sprintf(_x(
|
||||||
@ -143,9 +143,9 @@ class Worker {
|
|||||||
'clicked' => $clicked,
|
'clicked' => $clicked,
|
||||||
'opened' => $opened,
|
'opened' => $opened,
|
||||||
'subscribersLimitReached' => $this->subscribers_feature->check(),
|
'subscribersLimitReached' => $this->subscribers_feature->check(),
|
||||||
'hasKey' => $has_key,
|
'hasValidApiKey' => $has_valid_api_key,
|
||||||
'subscribersLimit' => $this->subscribers_feature->getSubscribersLimit(),
|
'subscribersLimit' => $this->subscribers_feature->getSubscribersLimit(),
|
||||||
'upgradeNowLink' => $has_key ? 'https://account.mailpoet.com/upgrade' : 'https://account.mailpoet.com/?s=' . ($subscribers_count + 1),
|
'upgradeNowLink' => $has_valid_api_key ? 'https://account.mailpoet.com/upgrade' : 'https://account.mailpoet.com/?s=' . ($subscribers_count + 1),
|
||||||
];
|
];
|
||||||
if ($link) {
|
if ($link) {
|
||||||
$context['topLinkClicks'] = $link->getTotalClicksCount();
|
$context['topLinkClicks'] = $link->getTotalClicksCount();
|
||||||
|
@ -33,12 +33,12 @@ class Subscribers {
|
|||||||
return $subscribers_count > $limit;
|
return $subscribers_count > $limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function hasAPIKey() {
|
public function hasValidApiKey() {
|
||||||
return $this->hasValidMssKey() || $this->hasValidPremiumKey();
|
return $this->hasValidMssKey() || $this->hasValidPremiumKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getSubscribersLimit() {
|
public function getSubscribersLimit() {
|
||||||
if (!$this->hasAPIKey()) {
|
if (!$this->hasValidApiKey()) {
|
||||||
return $this->getFreeSubscribersLimit();
|
return $this->getFreeSubscribersLimit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
<% if subscribersLimitReached %>
|
<% if subscribersLimitReached %>
|
||||||
<%= __('Congratulations, you now have more than [subscribersLimit] subscribers!')|replace({'[subscribersLimit]': subscribersLimit}) %>
|
<%= __('Congratulations, you now have more than [subscribersLimit] subscribers!')|replace({'[subscribersLimit]': subscribersLimit}) %>
|
||||||
|
|
||||||
<% if hasKey %>
|
<% if hasValidApiKey %>
|
||||||
<%= __('Your plan is limited to [subscribersLimit] subscribers.')|replace({'[subscribersLimit]': subscribersLimit}) %>
|
<%= __('Your plan is limited to [subscribersLimit] subscribers.')|replace({'[subscribersLimit]': subscribersLimit}) %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= __('Our free version is limited to [subscribersLimit] subscribers.')|replace({'[subscribersLimit]': subscribersLimit}) %>
|
<%= __('Our free version is limited to [subscribersLimit] subscribers.')|replace({'[subscribersLimit]': subscribersLimit}) %>
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
var mailpoet_display_nps_poll = <%= (sent_newsletters_count > 0 and settings.display_nps_poll) ? 'true' : 'false' %>;
|
var mailpoet_display_nps_poll = <%= (sent_newsletters_count > 0 and settings.display_nps_poll) ? 'true' : 'false' %>;
|
||||||
var mailpoet_subscribers_limit = <%= subscribers_limit ? subscribers_limit : 'false' %>;
|
var mailpoet_subscribers_limit = <%= subscribers_limit ? subscribers_limit : 'false' %>;
|
||||||
var mailpoet_subscribers_limit_reached = <%= subscribers_limit_reached ? 'true' : 'false' %>;
|
var mailpoet_subscribers_limit_reached = <%= subscribers_limit_reached ? 'true' : 'false' %>;
|
||||||
var mailpoet_has_api_key = <%= has_api_key ? 'true' : 'false' %>;
|
var mailpoet_has_valid_api_key = <%= has_valid_api_key ? 'true' : 'false' %>;
|
||||||
var mailpoet_segments = <%= json_encode(segments) %>;
|
var mailpoet_segments = <%= json_encode(segments) %>;
|
||||||
var mailpoet_show_congratulate_after_first_newsletter = <%= show_congratulate_after_first_newsletter %>;
|
var mailpoet_show_congratulate_after_first_newsletter = <%= show_congratulate_after_first_newsletter %>;
|
||||||
var mailpoet_installed_days_ago = <%= installed_days_ago %>;
|
var mailpoet_installed_days_ago = <%= installed_days_ago %>;
|
||||||
|
Reference in New Issue
Block a user