/** The affiliate provider a link belongs to, read from its host; undefined for a host no provider is known for. */
export function providerFromHref(href: string | undefined): string | undefined {
  const host = /^https?:\/\/([^/?#:]+)/i.exec(href ?? '')?.[1]?.toLowerCase();
  if (!host) return undefined;
  return host === 'booking.com' || host.endsWith('.booking.com') ? 'booking' : undefined;
}
