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
+25 -10
View File
@@ -32,16 +32,31 @@ const FAV_SPECIALS = {
const DEFAULT_FAV_SLUGS = ['inbox', 'unread', 'large', 'old', 'readlater'];
const SMART_FOLDERS = [
{ slug: 'automated', icon: '🤖', label: 'Automated', countKey: 'automated' },
{ slug: 'noreply', icon: '🔇', label: 'No-Reply', countKey: 'noreply' },
{ slug: 'shopping', icon: '🛍️', label: 'Online Shopping', countKey: 'shopping' },
{ slug: 'gaming', icon: '🎮', label: 'Gaming', countKey: 'gaming' },
{ slug: 'finance', icon: '💳', label: 'Finance & Insurance', countKey: 'finance' },
{ slug: 'sales', icon: '🏷️', label: 'Seasonal Sales', countKey: 'sales' },
{ slug: 'ridesharing', icon: '🚗', label: 'Ride Sharing', countKey: 'ridesharing' },
{ slug: 'food', icon: '🍕', label: 'Food Delivery', countKey: 'food' },
{ slug: 'social', icon: '📱', label: 'Social Notifications',countKey: 'social' },
{ slug: 'wellness', icon: '🏃', label: 'Wellness & Sport', countKey: 'wellness' },
{ slug: 'automated', icon: '🤖', label: 'Automated', countKey: 'automated' },
{ slug: 'noreply', icon: '🔇', label: 'No-Reply', countKey: 'noreply' },
{ slug: 'shopping', icon: '🛍️', label: 'Online Shopping', countKey: 'shopping' },
{ slug: 'gaming', icon: '🎮', label: 'Gaming', countKey: 'gaming' },
{ slug: 'finance', icon: '💳', label: 'Finance & Insurance', countKey: 'finance' },
{ slug: 'sales', icon: '🏷️', label: 'Seasonal Sales', countKey: 'sales' },
{ slug: 'ridesharing', icon: '🚗', label: 'Ride Sharing', countKey: 'ridesharing' },
{ slug: 'food', icon: '🍕', label: 'Food Delivery', countKey: 'food' },
{ slug: 'social', icon: '📱', label: 'Social Notifications', countKey: 'social' },
{ slug: 'wellness', icon: '🏃', label: 'Wellness & Sport', countKey: 'wellness' },
// New categories
{ slug: 'travel', icon: '✈️', label: 'Travel', countKey: 'travel' },
{ slug: 'subscriptions',icon: '🔄', label: 'Subscriptions & SaaS', countKey: 'subscriptions' },
{ slug: 'parcels', icon: '📦', label: 'Parcels & Delivery', countKey: 'parcels' },
{ slug: 'recruitment', icon: '💼', label: 'Recruitment & Jobs', countKey: 'recruitment' },
{ slug: 'events', icon: '🎟️', label: 'Events & Tickets', countKey: 'events' },
{ slug: 'security', icon: '🔐', label: 'Security & Alerts', countKey: 'security' },
{ slug: 'healthcare', icon: '🏥', label: 'Healthcare', countKey: 'healthcare' },
{ slug: 'education', icon: '🎓', label: 'Education', countKey: 'education' },
{ slug: 'news', icon: '📰', label: 'News & Media', countKey: 'news' },
{ slug: 'property', icon: '🏠', label: 'Property & Utilities', countKey: 'property' },
{ slug: 'charity', icon: '❤️', label: 'Charities', countKey: 'charity' },
{ slug: 'government', icon: '🏛️', label: 'Government', countKey: 'government' },
{ slug: 'crypto', icon: '📈', label: 'Crypto & Investing', countKey: 'crypto' },
{ slug: 'family', icon: '👨‍👩‍👧', label: 'Family & School', countKey: 'family' },
];
// ── Helpers ───────────────────────────────────────────────────────────────────