feat(menu-app): the QR menu and the order app in the guest's language (contract C-2 names, platform-v2 step 6.4)

The site now sends names / descriptions {el, en} per product, quick option and category
(falling back to the text as typed). The menu app maps them onto its en / gr switch (byLang);
the order app localises its menu by the guest's language (localizeMenu, tested). The menu app
also reads 6.3's allergens object (what a product contains).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-18 10:46:59 +02:00
co-authored by Claude Opus 5.5
parent e0158b2c72
commit 9f9b882806
4 changed files with 48 additions and 5 deletions
@@ -74,18 +74,25 @@ function resolveImageUrl(url) {
// pushed before S.2 had digital_price.
const QR_POINT = 'qr_table'
// The menu in the guest's language (plan step 6.4): the venue sends `names` / `descriptions` per
// menu language (el, en), already falling back to the text as typed; this app's codes are en / gr.
const byLang = (texts, base) => (texts ? { en: texts.en || base, gr: texts.el || base } : base)
// Allergens (6.3) come as {key: "contains" | "may_contain"}; this page lists what it contains.
const allergenKeys = a => (Array.isArray(a) ? a : Object.keys(a || {}).filter(k => a[k] === 'contains'))
function normaliseProduct(p, catId) {
return {
...p,
digital_price: undefined, digital_discount: undefined,
id: String(p.id),
cat: catId,
name: p.digital_name || p.name || '',
desc: p.digital_description || p.description || '',
name: byLang(p.names, p.digital_name || p.name || ''),
desc: byLang(p.descriptions, p.digital_description || p.description || ''),
price: p.prices ? (p.prices[QR_POINT] ?? 0) : (p.digital_price ?? p.base_price ?? 0),
badge: p.digital_badge || p.badge || null,
tags: p.digital_tags || p.tags || [],
allergens: p.allergens || [],
allergens: allergenKeys(p.allergens),
ingredients: p.ingredients || null,
discountPct: 0,
image_url: resolveImageUrl(p.digital_image_url || p.image_url || null),
@@ -98,6 +105,7 @@ function normaliseCategories(rawCats) {
const id = cat.id ? String(cat.id) : `cat-${idx}`
return {
...cat,
name: byLang(cat.names, cat.name),
id,
hue: cat.hue ?? CATEGORY_HUES[idx % CATEGORY_HUES.length],
GlyphIcon: GLYPH_BY_ID[id] ?? GLYPH_FALLBACK[idx % GLYPH_FALLBACK.length],