UNPKG

@pinelab/vendure-plugin-metrics

Version:

Vendure plugin measuring and visualizing e-commerce metrics

27 lines (26 loc) 1.01 kB
import { AdvancedMetricSeries } from '../ui/generated/graphql'; interface EntitiesPerMonth<T> { monthNr: number; year: number; date: Date; entities: T[]; } export type DataPointsPerLegend = Map<string, number[]>; export declare function getMonthName(monthNr: number): string; /** * Categorize loaded entities per month */ export declare function groupEntitiesPerMonth<T, K extends keyof T>(entities: T[], sortableField: K, from: Date, to: Date): EntitiesPerMonth<T>[]; /** * Get entities from a list for given month and year */ export declare function getEntitiesForMonth<T, K extends keyof T>(entities: T[], date: Date, dateFilterField: K): T[]; /** * Map the data points per month map to the AdvancedMetricSeries array. * * E.g. `'product1', [10, 20, 30]` becomes * `[{ name: 'product1', values: [10, 20, 30] }]` * This is used to display the data in the chart. */ export declare function mapToSeries(dataPointsPerMonth: DataPointsPerLegend): AdvancedMetricSeries[]; export {};