/** * Detects DHL-Paket shippers (M_Shipper.M_ShipperCfg_ID identifier = 'DHL'), * i.e. the shippers whose labels go through the DHL Parcel DE API and that can * deliver to a DHL Packstation. "DHL Express" / "DHL Amazon FBA" have no DHL * config and are deliberately NOT matched. * * Same shape as useFbaShipper: the shipper dropdown loads lazily and a saved * order only carries {id, identifier}, so the config can't be read from either * reliably. The (tiny) active shipper list is loaded once via the generic * filter endpoint and cached across navigations through useLookup. */ export const useDhlShipper = () => { const { data } = useLookup('/api/filters/m_shipper/' + encodeURIComponent('IsActive eq true')) const dhlShipperIds = computed(() => new Set(((data.value as any)?.records || []) .filter((r: any) => String(r?.M_ShipperCfg_ID?.identifier || '').toUpperCase() === 'DHL') .map((r: any) => String(r.id)))) const isDhlShipper = (id: any) => !!id && dhlShipperIds.value.has(String(id)) return { isDhlShipper, dhlShipperIds } }