1 import { z } from 'zod';
3 import { RELEASE_CATEGORIES } from '@proton/shared/lib/constants';
5 import { zDefaultProtocolChanged, zIsDefaultProtocol } from './DefaultProtocol';
7 const zReleaseCategory = z.nativeEnum(RELEASE_CATEGORIES);
9 const zDailyStatsDimensions = z.object({
10 releaseCategory: zReleaseCategory,
11 isDefaultMailto: zIsDefaultProtocol,
12 isDefaultMailtoChanged: zDefaultProtocolChanged,
14 export type DailyStatsDimensions = z.infer<typeof zDailyStatsDimensions>;
16 const zDailyStatsValues = z.object({
17 mailtoClicks: z.number(),
18 switchViewMailToCalendar: z.number(),
19 switchViewCalendarToMail: z.number(),
20 userLogin: z.number(),
21 userLogout: z.number(),
23 export type DailyStatsValues = z.infer<typeof zDailyStatsValues>;
25 const zDailyStatsStored = zDailyStatsDimensions.merge(zDailyStatsValues).extend({ lastReport: z.number() });
26 export type DailyStatsStored = z.infer<typeof zDailyStatsStored>;
28 export const zDailyStatsReport = z.object({
29 dimensions: zDailyStatsDimensions,
30 values: zDailyStatsValues,
32 export type DailyStatsReport = z.infer<typeof zDailyStatsReport>;