import * as React from 'react'; import type { Theme } from '../../types/props'; /** * 免费赠品接口 */ export interface FreeGift { /** 赠品ID */ id: string; /** 赠品图片URL */ image: string; /** 赠品名称 */ name: string; /** 原价 */ originalPrice: string; /** 现价(通常为Free) */ currentPrice: string; /** 数量 */ quantity: number; /** 变体ID */ variantId: string; /** SKU */ sku: string; /** 句柄 */ handle: string; /** 赠品tag */ tag?: string; } /** * 带选择状态的免费赠品接口 */ export interface FreeGiftWithSelection extends FreeGift { /** 是否已选中 */ selected?: boolean; } /** * 产品标签接口 */ export interface ProductTag { /** 标签文本 */ label: string; /** 标签样式变体 */ variant: 'outline' | 'fill' | 'promotional'; /** 促销类型(仅当 variant 为 'promotional' 时有效) */ promotionalType?: 'plus-member' | 'regular-member' | 'regular-discount' | 'time-limited-discount'; } export type BuyOneGetOneShelfRootSemanticName = 'root' | 'title' | 'description' | 'content'; export type BuyOneGetOneShelfProductCardSemanticName = 'productCard' | 'productCardImage' | 'productCardTitle' | 'productCardDescription' | 'productCardPrice' | 'productCardGiftsContainer' | 'productCardBtnGroup'; export type BuyOneGetOneShelfSemanticName = BuyOneGetOneShelfRootSemanticName | BuyOneGetOneShelfProductCardSemanticName; /** * 响应式图片接口 */ export interface ResponsiveImage { id: number; baseUrl?: string; url: string; thumbnailURL?: string; filename?: string; mimeType?: string; width?: number; height?: number; } /** * 响应式图片集合接口 */ export interface ResponsiveImages { laptop?: ResponsiveImage; mobile?: ResponsiveImage; tablet?: ResponsiveImage; desktop?: ResponsiveImage; lgDesktop?: ResponsiveImage; } /** * 产品基础数据接口 */ export interface BaseProductData { sku: string; name: string; image: string; value: string; handle: string; shopify_id: string; } export interface WithGiftData { /** * 赠品 */ gifts: FreeGift[]; /** * 赠品类型 1-> 赠送其中一个赠品, 2 -> 赠送所有赠品 */ gift_type: 1 | 2; } /** * 纯产品数据接口(不包含赠品信息) */ export interface PureProductData extends BaseProductData { /** 产品描述 */ description?: string; /** 当前价格 */ currentPrice?: string; /** 原价 */ originalPrice?: string; /** 了解更多按钮文本 */ learnMoreText?: string; /** 立即购买按钮文本 */ shopNowText?: string; /** 赠品标签文本 */ freeGiftLabel?: string; /** 产品标签 */ tags?: ProductTag[]; /** 赠品选择模式 */ giftSelectionMode?: 'single' | 'multiple'; availableForSale: boolean; } export interface ProductData extends BaseProductData, WithGiftData { /** 产品描述 */ description?: string; /** 当前价格 */ currentPrice?: string; /** 原价 */ originalPrice?: string; /** 了解更多按钮文本 */ learnMoreText?: string; /** 立即购买按钮文本 */ shopNowText?: string; /** 赠品标签文本 */ freeGiftLabel?: string; /** 赠品选择模式 */ giftSelectionMode?: 'single' | 'multiple'; } export type ProductCardData = ProductData; /** * 文案配置接口 */ export interface CopyConfig { shopNowText: string; freeGiftLabel: string; learnMoreText: string; freeGiftHeading: string; } /** * 买赠项目接口 */ export interface BogoItem { id: string; data: ProductData[]; images: ResponsiveImages; shopNowFun: string; shopNowText: string; learnMoreText: string; } /** * BuyOneGetOneShelf 业务组件数据接口 - 新格式 */ export interface BuyOneGetOneShelfData { copy: CopyConfig; theme: string; title: string; subtitle: string; bogoItems: BogoItem[]; } export interface BuyOneGetOneShelfProps extends React.HTMLAttributes { /** 标题 */ title?: string; /** 副标题 */ subtitle?: string; theme?: Theme; /** 子组件 */ children: React.ReactNode; /** Root 组件的自定义类名 */ classNames?: Partial>; } export interface BuyOneGetOneShelfCardProps extends Omit, 'onClick'> { /** 产品数据 */ productData: BaseProductData & { description?: string; currentPrice?: string; originalPrice?: string; learnMoreText?: string; shopNowText?: string; freeGiftLabel?: string; }; /** 赠品列表 */ gifts?: FreeGift[]; /** 赠品类型 1-> 赠送其中一个赠品, 2 -> 赠送所有赠品 */ giftType?: 1 | 2; /** 场景图片 */ sceneImages?: ResponsiveImages; /** 布局模式(通常由父组件自动决定) */ layout?: 'horizontal' | 'vertical'; /** ProductCard 组件的自定义类名 */ classNames?: Partial>; /** 产品点击回调 */ onProductClick?: (product: ProductCardData) => void; /** Learn More 点击回调 */ onLearnMore?: (product: ProductCardData, selectedGifts: FreeGift[]) => void; /** Shop Now 点击回调 */ onShopNow?: (product: ProductCardData, selectedGifts: FreeGift[]) => void; /** 赠品点击回调 */ onGiftClick?: (gift: FreeGift, selectedGifts: FreeGift[]) => void; /** 赠品选择变化回调 */ onGiftSelectionChange?: (selectedGifts: FreeGift[], product: ProductCardData) => void; } export interface BuyOneGetOneShelfLegacyProps extends React.HTMLAttributes { /** 业务数据 */ data: BuyOneGetOneShelfData; /** 产品卡片点击事件 */ onProductClick?: (product: ProductCardData) => void; /** Learn More按钮点击事件 */ onLearnMore?: (product: ProductCardData, selectedGifts: FreeGift[]) => void; /** Shop Now按钮点击事件 */ onShopNow?: (product: ProductCardData, selectedGifts: FreeGift[]) => void; onAddToCart?: (product: ProductCardData) => void; /** 赠品点击事件 */ onGiftClick?: (gift: FreeGift, selectedGifts: FreeGift[]) => void; /** 赠品选择变化事件 */ onGiftSelectionChange?: (selectedGifts: FreeGift[], product: ProductCardData) => void; classNames?: Partial>; }