From a84caaa31e47c05ed828446d8d1c27b7cb71c9d8 Mon Sep 17 00:00:00 2001 From: fahed Date: Thu, 26 Mar 2026 15:03:10 +0300 Subject: [PATCH] feat: add product-to-museum and channel mapping config Co-Authored-By: Claude Opus 4.6 (1M context) --- src/config/museumMapping.ts | 38 +++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/config/museumMapping.ts diff --git a/src/config/museumMapping.ts b/src/config/museumMapping.ts new file mode 100644 index 0000000..e5e4c57 --- /dev/null +++ b/src/config/museumMapping.ts @@ -0,0 +1,38 @@ +// Definitive mapping of ERP product descriptions to museum names. +// Priority order matters — first match wins (handles combo tickets). + +const MUSEUM_KEYWORDS: [string, string[]][] = [ + ['Revelation Exhibition', ['Revelation', 'الوحي']], + ['Creation Story Museum', ['Creation Story', 'قصة الخلق']], + ['Holy Quraan Museum', ['Holy Quraan', 'القرآن الكريم']], + ['Trail To Hira Cave', ['Trail To Hira', 'غار حراء']], + ['Makkah Greets Us', ['Makkah Greets']], + ['VIP Experience', ['VIP Experience']], +]; + +export const MUSEUM_NAMES = MUSEUM_KEYWORDS.map(([name]) => name); + +export function getMuseumFromProduct(productDescription: string): string { + const desc = productDescription.trim(); + for (const [museum, keywords] of MUSEUM_KEYWORDS) { + for (const kw of keywords) { + if (desc.includes(kw)) return museum; + } + } + return 'Other'; +} + +export const CHANNEL_LABELS: Record = { + 'B2C': 'HiHala Website/App', + 'B2B': 'B2B', + 'POS': 'POS', + 'Safiyyah POS': 'Safiyyah POS', + 'Standalone': 'Standalone', + 'Mobile': 'Mobile', + 'Viva': 'Viva', + 'IT': 'IT', +}; + +export function getChannelLabel(operatingAreaName: string): string { + return CHANNEL_LABELS[operatingAreaName] || operatingAreaName; +}