feat: add 14 new smart folder categories (locale-agnostic)

New EmailCategory enum values: Travel, Subscriptions, Parcels,
Recruitment, Events, SecurityAlerts, Healthcare, Education,
NewsMedia, PropertyUtilities, Charity, Government, CryptoInvesting,
FamilySchool.

HeuristicClassifier: locale-agnostic rules using global brand
domains + TLD patterns (.gov.*, .edu, .ac.*) + English subject
keywords — works for international users without relying on
country-specific domains (e.g. gov.uk).

Priority order ensures SecurityAlerts and Government take
precedence over Finance, and Travel/RideSharing/FoodDelivery
fire before Finance to prevent receipt mis-classification.

AnalyticsService: maps all 14 new slugs to category counts.
client.js: folderToRequest() handles all 14 new slugs.
Layout.jsx: SMART_FOLDERS extended with icons and labels.
widgets.jsx: CAT_SLUG updated for dashboard drillthrough.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
cesnimda
2026-06-30 20:44:21 +02:00
parent 95dc835651
commit 21606c5f91
6 changed files with 596 additions and 75 deletions
+28 -14
View File
@@ -105,20 +105,34 @@ const DOW = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
// Maps EmailCategory enum name → folder slug or search query
const CAT_SLUG = {
Finance: '/app/folder/finance',
Social: '/app/folder/social',
Notification: '/app/folder/automated',
Promotional: '/app/folder/shopping',
Shopping: '/app/folder/shopping',
Gaming: '/app/folder/gaming',
RideSharing: '/app/folder/ridesharing',
FoodDelivery: '/app/folder/food',
SeasonalSales:'/app/folder/sales',
Wellness: '/app/folder/wellness',
Spam: '/app/folder/spam',
Newsletter: '/app/search?q=newsletter',
Personal: '/app/search?q=is:unread',
Unknown: '/app/folder/allmail',
Finance: '/app/folder/finance',
Social: '/app/folder/social',
Notification: '/app/folder/automated',
Promotional: '/app/folder/shopping',
Shopping: '/app/folder/shopping',
Gaming: '/app/folder/gaming',
RideSharing: '/app/folder/ridesharing',
FoodDelivery: '/app/folder/food',
SeasonalSales: '/app/folder/sales',
Wellness: '/app/folder/wellness',
Travel: '/app/folder/travel',
Subscriptions: '/app/folder/subscriptions',
Parcels: '/app/folder/parcels',
Recruitment: '/app/folder/recruitment',
Events: '/app/folder/events',
SecurityAlerts: '/app/folder/security',
Healthcare: '/app/folder/healthcare',
Education: '/app/folder/education',
NewsMedia: '/app/folder/news',
PropertyUtilities:'/app/folder/property',
Charity: '/app/folder/charity',
Government: '/app/folder/government',
CryptoInvesting: '/app/folder/crypto',
FamilySchool: '/app/folder/family',
Spam: '/app/folder/spam',
Newsletter: '/app/search?q=newsletter',
Personal: '/app/search?q=is:unread',
Unknown: '/app/folder/allmail',
};
export function CategoryHeatmapWidget() {