Display the last engagement on the subscribers stats page
[MAILPOET-3770]
This commit is contained in:
@ -19,6 +19,7 @@ export type StatsType = {
|
||||
machine_open: number;
|
||||
click: number;
|
||||
engagement_score: number;
|
||||
last_engagement?: string;
|
||||
woocommerce: {
|
||||
currency: string;
|
||||
value: number;
|
||||
@ -65,6 +66,13 @@ export const SubscriberStats: React.FunctionComponent = () => {
|
||||
return (
|
||||
<div className="mailpoet-subscriber-stats">
|
||||
<Heading email={stats.email} />
|
||||
<p>
|
||||
{MailPoet.I18n.t('lastEngagement')}
|
||||
{': '}
|
||||
{
|
||||
stats.last_engagement ? MailPoet.Date.format(stats.last_engagement) : MailPoet.I18n.t('never')
|
||||
}
|
||||
</p>
|
||||
<div className="mailpoet-subscriber-stats-summary-grid">
|
||||
<Summary
|
||||
click={stats.click}
|
||||
|
@ -48,6 +48,10 @@ class SubscriberStats extends APIEndpoint {
|
||||
'click' => $statistics->getClickCount(),
|
||||
'engagement_score' => $subscriber->getEngagementScore(),
|
||||
];
|
||||
$lastEngagement = $subscriber->getLastEngagementAt();
|
||||
if ($lastEngagement instanceof \DateTimeInterface) {
|
||||
$response['last_engagement'] = $lastEngagement->format('Y-m-d H:i:s');
|
||||
}
|
||||
$woocommerce = $statistics->getWooCommerceRevenue();
|
||||
if ($woocommerce instanceof WooCommerceRevenue) {
|
||||
$response['woocommerce'] = $woocommerce->asArray();
|
||||
|
@ -56,6 +56,8 @@
|
||||
'moveToTrash': __('Move to trash'),
|
||||
'deletePermanently': __('Delete Permanently'),
|
||||
'showMoreDetails': __('Show more details'),
|
||||
'lastEngagement': __('Last engagement'),
|
||||
'never': _x('never', 'when was the last time the subscriber engaged with the website?'),
|
||||
|
||||
'previousPage': __('Previous page'),
|
||||
'firstPage': __('First page'),
|
||||
|
Reference in New Issue
Block a user