import type { BadgeProps } from '../../components/badge.js'; /** * 按钮功能类型 */ export type ButtonFunctionType = 'buyNow' | 'addCart' | 'learnMore'; /** * 语义化类名 */ export type ImageOverlayShelfSemanticName = 'root' | 'title' | 'description' | 'productCard' | 'productImage' | 'productContent' | 'tagsContainer' | 'productTitle' | 'productDescription' | 'priceContainer' | 'productPrice' | 'originalPrice' | 'buttonGroup' | 'secondaryButton' | 'primaryButton'; /** * 文案配置接口 */ export interface CopyConfig { /** 售罄文案 */ outOfStockLabel?: string; } /** * 图片裁切位置 */ export type ImageObjectPosition = 'center' | 'top' | 'bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'; /** * 产品卡片数据接口 */ export interface ProductCardData { /** SKU */ sku: string; /** 产品名称 */ name: string; /** 产品图片 */ image: string; /** 产品 handle */ handle: string; /** Shopify ID */ shopify_id?: string; /** 自定义名称 */ custom_name?: string; /** 自定义描述 */ custom_description?: string; custom_image?: string; /** 产品描述 */ description?: string; /** 产品链接 */ listingLink?: string; /** 原价 */ originalPrice?: string; /** 现价 */ price: string; /** 是否可售 */ availableForSale: boolean; /** 主题 light/dark */ custom_theme?: 'light' | 'dark'; /** 背景图裁切位置 */ imageObjectPosition?: ImageObjectPosition; /** 标签列表 */ tags?: Array<{ label: string; variant: BadgeProps['variant']; promotionalType?: BadgeProps['promotionalType']; } | React.ReactNode>; } /** * ProductCard Props 接口 */ export interface ProductCardProps { /** 产品数据 */ product: ProductCardData; /** 样式类名 */ className?: string; /** 是否展示标签 */ showTags?: boolean; /** 是否展示原价(删除线价格) */ showOriginalPrice?: boolean; /** 点击了解更多回调 */ onLearnMore?: (product: ProductCardData) => void; /** 点击立即购买回调 */ onShopNow?: (product: ProductCardData) => void; /** 点击加入购物车回调 */ onAddToCart?: (product: ProductCardData) => void; /** 点击产品图片回调 */ onProductImageClick?: (product: ProductCardData) => void; /** 语义化类名 */ classNames?: Partial>; /** 了解更多按钮文本 */ secondaryButtonText?: string; /** 了解更多按钮功能 */ secondaryButtonFun?: ButtonFunctionType; /** 立即购买按钮文本 */ primaryButtonText?: string; /** 立即购买按钮功能 */ primaryButtonFun?: ButtonFunctionType; /** 文案配置 */ copy?: CopyConfig; }