export async function getStats(): Promise<SupplierStatsData> {
// Flush any pending increments first
await flushToStorage();
try {
return await getAllSupplierStats();
} catch (error) {
logger.warn(`Failed to read supplier stats: ${getErrorMessage(error)}`, { error });
return {};
}
}
Read all stats from IndexedDB, returning the SupplierStatsData shape:
{ [dateKey]: { [supplier]: SupplierDayStats } }. Recording runs in every build; only the stats UI is gated (dev builds, or advanced mode).