Add score to stats page
[MAILPOET-3525]
This commit is contained in:
@ -17,6 +17,7 @@ export type StatsType = {
|
|||||||
total_sent: number;
|
total_sent: number;
|
||||||
open: number;
|
open: number;
|
||||||
click: number;
|
click: number;
|
||||||
|
engagement_score: number;
|
||||||
woocommerce: {
|
woocommerce: {
|
||||||
currency: string;
|
currency: string;
|
||||||
value: number;
|
value: number;
|
||||||
@ -68,6 +69,10 @@ export const SubscriberStats: React.FunctionComponent = () => {
|
|||||||
click={stats.click}
|
click={stats.click}
|
||||||
open={stats.open}
|
open={stats.open}
|
||||||
totalSent={stats.total_sent}
|
totalSent={stats.total_sent}
|
||||||
|
subscriber={{
|
||||||
|
id: match.params.id,
|
||||||
|
engagement_score: stats.engagement_score,
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
{stats.woocommerce && (
|
{stats.woocommerce && (
|
||||||
<WoocommerceRevenues
|
<WoocommerceRevenues
|
||||||
|
@ -1,14 +1,24 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import MailPoet from 'mailpoet';
|
import MailPoet from 'mailpoet';
|
||||||
import Tag from 'common/tag/tag';
|
import Tag from 'common/tag/tag';
|
||||||
|
import { ListingsEngagementScore } from '../listings_engagement_score';
|
||||||
|
|
||||||
export type PropTypes = {
|
export type PropTypes = {
|
||||||
totalSent: number;
|
totalSent: number;
|
||||||
open: number;
|
open: number;
|
||||||
click: number;
|
click: number;
|
||||||
|
subscriber: {
|
||||||
|
id: string;
|
||||||
|
engagement_score?: number;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ({ totalSent, open, click }: PropTypes): JSX.Element => {
|
export default ({
|
||||||
|
totalSent,
|
||||||
|
open,
|
||||||
|
click,
|
||||||
|
subscriber,
|
||||||
|
}: PropTypes): JSX.Element => {
|
||||||
let openPercent = 0;
|
let openPercent = 0;
|
||||||
let clickPercent = 0;
|
let clickPercent = 0;
|
||||||
let notOpenPercent = 0;
|
let notOpenPercent = 0;
|
||||||
@ -71,6 +81,15 @@ export default ({ totalSent, open, click }: PropTypes): JSX.Element => {
|
|||||||
)}
|
)}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>{MailPoet.I18n.t('statisticsColumn')}</td>
|
||||||
|
<td>
|
||||||
|
<div className="mailpoet-listing-stats">
|
||||||
|
<ListingsEngagementScore subscriber={subscriber} />
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td />
|
||||||
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
@ -45,6 +45,7 @@ class SubscriberStats extends APIEndpoint {
|
|||||||
'total_sent' => $statistics->getTotalSentCount(),
|
'total_sent' => $statistics->getTotalSentCount(),
|
||||||
'open' => $statistics->getOpenCount(),
|
'open' => $statistics->getOpenCount(),
|
||||||
'click' => $statistics->getClickCount(),
|
'click' => $statistics->getClickCount(),
|
||||||
|
'engagement_score' => $subscriber->getEngagementScore(),
|
||||||
];
|
];
|
||||||
$woocommerce = $statistics->getWooCommerceRevenue();
|
$woocommerce = $statistics->getWooCommerceRevenue();
|
||||||
if ($woocommerce instanceof WooCommerceRevenue) {
|
if ($woocommerce instanceof WooCommerceRevenue) {
|
||||||
|
Reference in New Issue
Block a user