import { ISettings } from '../types'; export type CarouselType = 'uniform' | 'spotlight' | 'buy_box'; export const DEFAULT_CAROUSEL_TYPE: CarouselType = 'uniform'; /** * Resolve the effective carousel type using backwards-compatible defaults. * Legacy behaviour keeps the centered grow variant when the shop this look * display is set to product_list unless the new setting is explicitly provided. */ export const resolveCarouselType = (settings?: ISettings): CarouselType => { if (!settings) { return DEFAULT_CAROUSEL_TYPE; } if (settings.carousel_type) { return settings.carousel_type; } return settings.shop_this_look_display === 'product_list' ? 'spotlight' : DEFAULT_CAROUSEL_TYPE; }; export const isSpotlightCarousel = (settings?: ISettings): boolean => resolveCarouselType(settings) === 'spotlight';