2022-03-22 18:37:17 +03:00
|
|
|
import Component from '@glimmer/component';
|
2022-03-23 18:38:16 +03:00
|
|
|
import {action} from '@ember/object';
|
|
|
|
import {inject as service} from '@ember/service';
|
2022-03-22 18:37:17 +03:00
|
|
|
|
2022-04-12 15:09:00 +03:00
|
|
|
export default class Email extends Component {
|
2022-03-23 18:38:16 +03:00
|
|
|
@service dashboardStats;
|
|
|
|
|
|
|
|
/**
|
2022-03-31 10:33:18 +03:00
|
|
|
* Call this method when you need to fetch new data from the server.
|
2022-03-23 18:38:16 +03:00
|
|
|
*/
|
|
|
|
@action
|
|
|
|
loadCharts() {
|
|
|
|
// The dashboard stats service will take care or reusing and limiting API-requests between charts
|
|
|
|
this.dashboardStats.loadNewsletterSubscribers();
|
|
|
|
this.dashboardStats.loadEmailsSent();
|
|
|
|
}
|
|
|
|
|
2022-03-22 18:37:17 +03:00
|
|
|
get dataSubscribers() {
|
2022-03-23 18:38:16 +03:00
|
|
|
// @todo: show paid, free, total together
|
2022-03-28 14:19:56 +03:00
|
|
|
return this.dashboardStats.newsletterSubscribers ?? {
|
|
|
|
total: 0,
|
|
|
|
free: 0,
|
|
|
|
paid: 0
|
|
|
|
};
|
2022-03-22 18:37:17 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
get dataEmailsSent() {
|
2022-03-23 18:38:16 +03:00
|
|
|
return this.dashboardStats.emailsSent30d ?? 0;
|
|
|
|
}
|
2022-03-22 18:37:17 +03:00
|
|
|
}
|