refactor!: rewrite Analytics to TypeScript (#122)

* refactor: migrate all analytics’ classes to TypeScript

Also, add AnalyticsShortsCarouselCard and AnalyticsRoot.
This commit is contained in:
LuanRT
2022-07-29 05:39:34 -03:00
committed by GitHub
parent 5a99190136
commit adae925367
15 changed files with 221 additions and 72 deletions

View File

@@ -0,0 +1,18 @@
import DataModelSection from './DataModelSection';
import { YTNode } from '../../helpers';
class AnalyticsMainAppKeyMetrics extends YTNode {
static type = 'AnalyticsMainAppKeyMetrics';
period: string;
sections: DataModelSection[];
constructor(data: any) {
super();
this.period = data.cardData.periodLabel;
const metrics_data = data.cardData.sections[0].analyticsKeyMetricsData;
this.sections = metrics_data.dataModel.sections.map((section: any) => new DataModelSection(section));
}
}
export default AnalyticsMainAppKeyMetrics;