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
@@ -167,16 +167,31 @@ public class AnalyticsService : IAnalyticsService
var smartFolders = new Dictionary<string, int>
{
["automated"] = Cat(EmailCategory.Notification),
["finance"] = Cat(EmailCategory.Finance),
["social"] = Cat(EmailCategory.Social),
["shopping"] = Cat(EmailCategory.Shopping) + Cat(EmailCategory.Promotional),
["noreply"] = Cat(EmailCategory.Notification),
["gaming"] = Cat(EmailCategory.Gaming),
["sales"] = Cat(EmailCategory.SeasonalSales),
["ridesharing"] = Cat(EmailCategory.RideSharing),
["food"] = Cat(EmailCategory.FoodDelivery),
["wellness"] = Cat(EmailCategory.Wellness),
["automated"] = Cat(EmailCategory.Notification),
["finance"] = Cat(EmailCategory.Finance),
["social"] = Cat(EmailCategory.Social),
["shopping"] = Cat(EmailCategory.Shopping) + Cat(EmailCategory.Promotional),
["noreply"] = Cat(EmailCategory.Notification),
["gaming"] = Cat(EmailCategory.Gaming),
["sales"] = Cat(EmailCategory.SeasonalSales),
["ridesharing"] = Cat(EmailCategory.RideSharing),
["food"] = Cat(EmailCategory.FoodDelivery),
["wellness"] = Cat(EmailCategory.Wellness),
// New categories
["travel"] = Cat(EmailCategory.Travel),
["subscriptions"] = Cat(EmailCategory.Subscriptions),
["parcels"] = Cat(EmailCategory.Parcels),
["recruitment"] = Cat(EmailCategory.Recruitment),
["events"] = Cat(EmailCategory.Events),
["security"] = Cat(EmailCategory.SecurityAlerts),
["healthcare"] = Cat(EmailCategory.Healthcare),
["education"] = Cat(EmailCategory.Education),
["news"] = Cat(EmailCategory.NewsMedia),
["property"] = Cat(EmailCategory.PropertyUtilities),
["charity"] = Cat(EmailCategory.Charity),
["government"] = Cat(EmailCategory.Government),
["crypto"] = Cat(EmailCategory.CryptoInvesting),
["family"] = Cat(EmailCategory.FamilySchool),
};
return new SidebarCountsDto(inbox, allMail, unread, starred, sent, drafts, trash, spam, large, old, smartFolders);