Utility functions for managing vendor media assets including logos, images, and videos with support for multiple API response formats and Supabase storage URL handling. ## Key Components ### Interfaces - `VendorMedia` - Media item structure with type and URL - `VendorWithMedia` - Vendor entity with various media field formats ### Core Functions - `getVendorLogo()` - Extracts logo URL with fallback priority (logo_url → logo → vendor_media) - `getVendorImage()` - Gets main image from vendor_media array - `getVendorVideo()` - Gets video URL from vendor_media array - `getVendorMediaByType()` - Returns all media URLs of specified type - `getVendorMediaGrouped()` - Groups all media by type (logos, images, videos) ### Utility Functions - `addVendorMedia()` - Adds new media item to vendor - `removeVendorMedia()` - Removes media by URL - `hasVendorMedia()` - Checks if vendor has media of specific type - `getVendorMediaCount()` - Returns media count statistics by type ## Usage Example ```typescript import { getVendorLogo, getVendorMediaGrouped, hasVendorMedia } from './vendor-media-stub'; const vendor = { id: 1, title: "Acme Corp", logo_url: "storage/logos/acme.png", vendor_media: [ { media_type: 'image', media_url: 'storage/images/office.jpg' }, { media_type: 'video', media_url: 'storage/videos/demo.mp4' } ] }; // Get logo with automatic fallback handling const logoUrl = getVendorLogo(vendor); // Group all media by type const mediaGroups = getVendorMediaGrouped(vendor); console.log(mediaGroups.images); // ['fixed-storage-url/images/office.jpg'] // Check if vendor has specific media type const hasVideo = hasVendorMedia(vendor, 'video'); // true ```