import { RpcMethod } from './commonTypes'; export type OverviewKPIService_GetOverviewKPI = RpcMethod; export type OverviewKPIService_GetAudienceFunnel = RpcMethod; export type OverviewKPIService_GetReachByPlatform = RpcMethod; export type OverviewKPIService_GetActiveTrend = RpcMethod; export type OverviewKPIService_GetRetentionCurve = RpcMethod; export type OverviewKPIService_GetBaseChange = RpcMethod; export type OverviewKPIService_GetUserMessageMetrics = RpcMethod; /** * OverviewKPIService serves the user-level Overview tab. Every method reads the * pre-aggregated daily tables only, never the raw actions log. */ export interface OverviewKPIService { /** GetOverviewKPI returns the KPI ribbon for a snapshot day. */ GetOverviewKPI: OverviewKPIService_GetOverviewKPI; /** GetAudienceFunnel returns the audience funnel for a snapshot day. */ GetAudienceFunnel: OverviewKPIService_GetAudienceFunnel; /** GetReachByPlatform returns reachable users split by platform. */ GetReachByPlatform: OverviewKPIService_GetReachByPlatform; /** GetActiveTrend returns the daily DAU and rolling-30 MAU series. */ GetActiveTrend: OverviewKPIService_GetActiveTrend; /** GetRetentionCurve returns the D1/D7/D30 curve of one cohort. */ GetRetentionCurve: OverviewKPIService_GetRetentionCurve; /** GetBaseChange returns how the push device base moved over a period. */ GetBaseChange: OverviewKPIService_GetBaseChange; /** GetUserMessageMetrics returns the Performance numbers counted in users. */ GetUserMessageMetrics: OverviewKPIService_GetUserMessageMetrics; } export type GetOverviewKPIRequest = { applicationCode: string; /** snapshot day, only year-month-day are used */ day: Date; /** period of the reachable growth, in days */ growthPeriodDays: number; }; export type GetOverviewKPIResponse = { /** day the numbers belong to */ day: Date; /** users with at least one device that has push permission and a valid token */ reachable: number; /** reachable change over growth_period_days, in percent, rounded to two decimals */ netReachableGrowthPercent: number; /** unique users who opened the application that day */ dau: number; /** unique users who opened the application within the rolling 30 days */ mau30: number; /** dau over mau_30, in percent, rounded to two decimals */ stickinessPercent: number; /** users reached by push, email, SMS or WhatsApp in the rolling 30 days */ unifiedMau30: number; /** rolling-30 numbers are absent until the raw log covers the whole window */ windowMetricsAvailable: boolean; /** growth needs a second snapshot, so it is absent on the first days */ netReachableGrowthAvailable: boolean; }; export type GetAudienceFunnelRequest = { applicationCode: string; day: Date; }; export type GetAudienceFunnelResponse = { day: Date; /** all users of the application */ totalUsers: number; /** users with at least one push device, with or without a token */ usersWithPushDevice: number; /** users with at least one push device holding a valid token */ subscribers: number; /** users with push permission and a valid token */ reachable: number; /** reachable users active within the window */ activeReachable: number; /** window of the active_reachable step, in days */ activeReachableWindowDays: number; reachableActivePercent: number; /** reachable, but no application open within the active_reachable window */ reachableDormant: number; reachableDormantPercent: number; /** token present, system permission revoked */ permissionOff: number; permissionOffPercent: number; /** has a push device but no token at all */ neverOptedIn: number; neverOptedInPercent: number; }; export type GetReachByPlatformRequest = { applicationCode: string; day: Date; }; export type GetReachByPlatformResponse_Platform = { platformId: number; reachable: number; }; export type GetReachByPlatformResponse = { day: Date; /** * a user counts in every platform where they have a reachable device, so the * sum over platforms may exceed the total */ platforms: GetReachByPlatformResponse_Platform[]; }; export type GetActiveTrendRequest = { applicationCode: string; dayFrom: Date; dayTo: Date; }; export type GetActiveTrendResponse_Point = { day: Date; dau: number; /** unique users who opened the application within the rolling 30 days */ mau30: number; /** users with push permission and a valid token on that day, a snapshot */ reachable: number; }; export type GetActiveTrendResponse = { /** * one point per day; the values are approximate distinct counts and must not * be summed or merged across points */ points: GetActiveTrendResponse_Point[]; }; export type GetRetentionCurveRequest = { applicationCode: string; /** day the cohort registered on */ cohortDate: Date; }; export type GetRetentionCurveResponse_Point = { dayN: number; cohortSize: number; retained: number; /** retained over cohort_size, in percent, rounded to two decimals */ retentionPercent: number; }; export type GetRetentionCurveResponse = { cohortDate: Date; points: GetRetentionCurveResponse_Point[]; }; export type GetBaseChangeRequest = { applicationCode: string; dayFrom: Date; dayTo: Date; }; export type GetBaseChangeResponse = { /** * Both bases are measured snapshots of the day named beside them, never the * sum of the flows: the flows do not add up to the difference by themselves. */ baseStartDay: Date; baseStart: number; baseEndDay: Date; baseEnd: number; /** devices registered over the period, push platforms only */ newRegistrations: number; /** devices whose token a provider reported invalid, gateway responses only */ expiredTokens: number; /** false when no snapshot exists for either end of the period */ baseAvailable: boolean; /** devices the nightly inactivity cleanup took the push token off */ autoCleanup: number; /** * day the flows are counted from: the backup trail keeps 60 days, so an older * day_from is clamped and the three flows describe this shorter window */ flowsFromDay: Date; }; export type GetMAUOverviewRequest = { /** applications to sum over; ids of other accounts are ignored */ applicationIds: number[]; /** snapshot day, only year-month-day are used */ day: Date; }; export type GetMAUOverviewResponse = { day: Date; /** * sum of the per-application 30-day audience; a user active in two * applications of the account is counted in each of them */ mau30: number; /** same sum for the unified count: opens plus delivered email, SMS and WhatsApp */ unifiedMau30: number; /** same sum restricted to users holding a valid push token */ activeWithToken30: number; }; export type GetUserMessageMetricsRequest = { applicationCode: string; dayFrom: Date; dayTo: Date; }; /** * the same tiles with every user counted once over the whole period instead * of once a day; a sum of daily counts is not a headcount */ export type GetUserMessageMetricsResponse_Unique = { sends: number; deliveries: number; errors: number; opens: number; deliveryRatePercent: number; }; export type GetUserMessageMetricsResponse_Platform = { platformId: number; sends: number; deliveries: number; errors: number; deliveryRatePercent: number; opens: number; unique: GetUserMessageMetricsResponse_Unique; }; export type GetUserMessageMetricsResponse = { /** users the gateway was asked for: the ones it took plus the ones it refused */ sends: number; /** users the gateway took, confirmed by the device or not */ deliveries: number; /** users whose send the gateway refused */ errors: number; /** deliveries over sends, in percent, rounded to two decimals */ deliveryRatePercent: number; /** * a user reached on two platforms is counted in each, so the rows do not sum * to the totals above */ platforms: GetUserMessageMetricsResponse_Platform[]; /** * first day the mart holds for this application; an earlier day_from asks for * numbers that were never written and can no longer be rebuilt */ firstWrittenDay: Date; /** false when the mart has nothing for this application at all */ dataAvailable: boolean; /** * opens of the period, counted on the day of the open rather than of the * send, so opens and sends of one period do not reconcile */ opens: number; unique: GetUserMessageMetricsResponse_Unique; };