/** * Detects Amazon-FBA shippers (M_Shipper.isAmazonFba = 'Y'). * * Needed independently of the shipper dropdown: on a saved order the shipper * arrives as {id, identifier} only, and SelectBox options load lazily on click — * so the FBA flag can't be read from either reliably. This loads the (tiny) set * of FBA shipper ids once via the generic filter endpoint and caches it across * navigations through useLookup. */ export const useFbaShipper = () => { const { data } = useLookup('/api/filters/m_shipper/' + encodeURIComponent('isAmazonFba eq true')) const fbaShipperIds = computed(() => new Set(((data.value as any)?.records || []).map((r: any) => String(r.id)))) const isFbaShipper = (id: any) => !!id && fbaShipperIds.value.has(String(id)) return { isFbaShipper, fbaShipperIds } }