Supplier shipping/country metadata.
The currently selected supplier class names.
The set of country codes those suppliers reside in.
countriesForSuppliers(
{ A: { country: 'US', shipping: 'domestic' }, B: { country: 'DE', shipping: 'international' } },
['B'],
); // => Set { 'DE' }
export function countriesForSuppliers(
meta: SupplierMetaMap,
suppliers: readonly string[],
): Set<CountryCode> {
const countries = new Set<CountryCode>();
for (const key of suppliers) {
const entry = meta[key];
if (entry) countries.add(entry.country);
}
return countries;
}
The distinct home countries of the given suppliers. Used to decide which country options are still reachable: a country no selected supplier resides in can be disabled. Empty in ⇒ empty out (no supplier constraint).