import { config } from '../../config.js' /** * Webshop-Schalter (Funktionsschluessel 'shop'): SHOP_ENABLED = off (Vorgabe) | pilot | on. * Liest config.shop bei jedem Aufruf. Bei off laufen keine Shop-Jobs und keine Shop-Abfragen. */ /** 'off' | 'pilot' | 'on'; alles andere (leer, unbekannt) gilt als off. */ export function shopModus() { const mode = config.shop.mode return mode === 'pilot' || mode === 'on' ? mode : 'off' } /** * Darf dieser Kunde den Webshop nutzen? pilot = nur Adressen aus SHOP_PILOT_EMAILS ('*' = alle; eine leere * Liste laesst niemanden durch); on = alle Kunden; off = niemand. */ export function shopFuerKunde(email) { const modus = shopModus() if (modus === 'off') return false if (modus === 'on') return true const erlaubt = config.shop.pilotEmails if (erlaubt.includes('*')) return true const adresse = String(email || '').trim().toLowerCase() return adresse !== '' && erlaubt.includes(adresse) } /** * Verlangt die Aktivierung durch das Team (WOMS, ohne Bestellung) die Zustimmung des Kunden in Textform (AVV Webshop, * Vorbemerkung Abs. 2)? Wie beim Terminplaner (termineTextformNoetig): nur im Modus on und nur, wenn die Adresse des Kunden nicht * in SHOP_PILOT_EMAILS steht. '*' ist keine Pilotadresse und befreit niemanden. In off und pilot sprechen Mitarbeiter und Kunde * direkt miteinander (Pilotbetrieb). */ export function shopTextformNoetig(email) { if (shopModus() !== 'on') return false const adresse = String(email || '').trim().toLowerCase() if (adresse === '' || adresse === '*') return true return !config.shop.pilotEmails.includes(adresse) }