"use client" import { Button } from "./ui/button" import { getVendorLogo, VendorWithMedia } from "../utils/vendor-media-stub" import Image from "../embed-shims/next-image" import { getProxiedImageUrl } from "../utils/image-proxy-stub" interface VendorDisplayButtonProps { vendor: VendorWithMedia onClick?: (vendorSlug: string) => void variant?: 'default' | 'compact' externalUrl?: string } export function VendorDisplayButton({ vendor, onClick, variant = 'default', externalUrl }: VendorDisplayButtonProps) { const handleClick = () => { if (externalUrl && vendor.slug) { // `externalUrl` is the caller-resolved platform base URL (the openmsp SSOT via // getPlatformProductionUrl, scheme-normalized). The old `process.env.NEXT_PUBLIC_OPENMSP_URL` // override is gone — it's stored scheme-less, which made this a relative window.open(). window.open(`${externalUrl}/vendor/${vendor.slug}`, '_blank', 'noopener,noreferrer') } else if (onClick && vendor.slug) { onClick(vendor.slug) } } // Compact variant for flamingo-teaser if (variant === 'compact') { const logoUrl = getVendorLogo(vendor) return ( {logoUrl ? ( ) : ( {vendor.title.charAt(0).toUpperCase()} )} {vendor.title} ) } // Default variant return ( {getVendorLogo(vendor) ? ( ) : ( {vendor.title.charAt(0)} )} {vendor.title} ) }