refactor(types): consolidate AnalyticsData into src/types/analytics.ts

Three structurally-distinct `interface AnalyticsData {…}` declarations
shared a name across `src/app/page.tsx` (dashboard), `src/app/insights/
page.tsx` (insights mother), and `src/components/onboarding/
getting-started-checklist.tsx` (checklist). The collision made the
shapes un-discoverable from any one site and forced every iOS-contract
addition to land in three places.

Hoist all three into `src/types/analytics.ts` as named exports:
`DashboardAnalyticsData`, `InsightsAnalyticsData`, `ChecklistAnalytics
Data`. Each call site re-imports its shape under the original alias to
keep downstream code readable; the slim `SubPageAnalyticsData` that was
already there stays put. We deliberately keep the four shapes distinct
(rather than collapsing to one with everything optional) so call sites
can't cross-read fields they shouldn't reach for — closes v1.4.39 org-
audit recommendation #2.
This commit is contained in:
Marc-André Bombeck committed 2026-05-21 17:12:38 +02:00
1 parent a62b94983b
commit dc66dfcfdc
4 files changed
+148 -98

No files matched your search

@@ -70,9 +70,9 @@ const ITEM_LABEL_KEYS: Record<
},
};
interface AnalyticsData {
summaries?: Record<string, { count?: number } | undefined>;
}
// v1.4.41 W-ORG — shared shape lives in `src/types/analytics.ts` as
// `ChecklistAnalyticsData`; aliased back to the local name.
import type { ChecklistAnalyticsData as AnalyticsData } from "@/types/analytics";
interface WithingsStatus {
connected?: boolean;