Supplier shipping/country metadata.
The currently selected supplier class names.
The set of shipping scopes at least one selected supplier can fulfill.
fulfillableShippingRanges(
{ A: { country: 'US', shipping: 'domestic' } },
['A'],
); // => Set { 'local', 'domestic' }
export function fulfillableShippingRanges(
meta: SupplierMetaMap,
suppliers: readonly string[],
): Set<ShippingRange> {
const fulfillable = new Set<ShippingRange>();
for (const option of SHIPPING_OPTIONS) {
const reachable = suppliers.some((key) => {
const entry = meta[key];
return entry !== undefined && shippingCovers(entry.shipping, option);
});
if (reachable) fulfillable.add(option);
}
return fulfillable;
}
The shipping-type options the given suppliers can fulfill: every scope at or below the broadest selected supplier's scope (per the shippingCovers hierarchy). Used to decide which shipping options stay selectable — an option no selected supplier can fulfill is disabled. Empty in ⇒ empty out (no supplier constraint).