interface Product { id?: string; product_id?: string; title: string; name?: string; handle?: string; description?: string; price: number; original_price?: number; currency?: string; stock?: number; quantity?: number; sku?: string; status?: 'active' | 'inactive' | 'draft' | 'archived'; category_id?: string; images?: string[]; videos?: Array<{ media_id: string; position?: number; variants?: Record; }>; weight?: number; length?: number; width?: number; height?: number; hs_code?: string; country_of_origin?: string; requires_shipping?: boolean; created_at?: string; updated_at?: string; } interface Order { id?: string; order_id?: string; customer_name?: string; customer_email?: string; total?: number; amount?: number; currency?: string; status?: 'pending' | 'paid' | 'processing' | 'shipped' | 'delivered' | 'completed' | 'cancelled' | 'refunded'; shipping_address?: string; tracking_number?: string; carrier?: string; shipping_carrier?: string; tracking_url?: string; stripe_payment_intent_id?: string; items?: OrderItem[]; created_at?: string; updated_at?: string; shipped_at?: string; selected_courier_id?: string; label_url?: string; label_state?: 'not_created' | 'pending' | 'generating' | 'generated' | 'printed' | 'failed' | 'technical_failed' | 'reported' | 'voided' | 'void_failed'; shipping_mode_used?: 'free' | 'easyship' | 'fixed'; cancelled_at?: string; cancelled_by?: 'customer' | 'merchant' | 'system'; cancellation_reason?: string; } interface OrderItem { product_id: string; product_name?: string; name?: string; quantity: number; price: number; } interface InventoryItem { product_id: string; product_name?: string; name?: string; stock: number; quantity?: number; updated_at?: string; } interface Merchant { id?: string; merchant_id?: string; name: string; slug?: string; email?: string; description?: string; logo_url?: string; logo_media_id?: string; default_currency?: string; google_ads_customer_id?: string; primary_color?: string; created_at?: string; updated_at?: string; } interface ShippingZone { id?: string; zone_id?: string; name: string; priority?: number; is_default?: boolean; countries: string[] | Array<{ code: string; name?: string; }>; rates?: ShippingRate[]; created_at?: string; updated_at?: string; } interface ShippingZoneListItem { id: string; name: string; priority: number; is_default: boolean; is_active: boolean; country_count: number; rate_count: number; created_at: string; } interface ShippingRate { id?: string; rate_id?: string; zone_id?: string; name?: string; rate_type?: 'flat_rate' | 'free'; base_cost?: number | string; additional_item_cost?: number | string; min_order_amount?: number | string; min_weight?: number; max_weight?: number; price?: number; currency?: string; priority?: number; created_at?: string; updated_at?: string; } interface Variant { id?: string; variant_id?: string; product_id: string; sku?: string; price?: number; stock?: number; status?: 'active' | 'inactive' | 'draft' | 'archived'; attributes?: Record; images?: string[]; created_at?: string; updated_at?: string; } interface HomepageSection { id?: string; type: 'banner' | 'collections' | 'collection_products' | 'featured'; title: string; description?: string; position?: number; handle?: string; settings?: Record; translations?: HomepageSectionTranslation[]; created_at?: string; updated_at?: string; } interface HomepageSectionTranslation { language_code: string; title?: string; description?: string; } interface MoveInput { section_id: string; new_position: number; } interface SectionCreateRequest { type: 'banner' | 'collections' | 'collection_products' | 'featured'; title?: string; translations?: Record; settings?: Record; } interface SectionUpdateRequest { title?: string; settings?: Record; } interface SectionListResponse { sections: HomepageSection[]; } interface HomepageConfig { id?: string; version?: number; sections_count?: number; sections?: HomepageSection[]; page_settings?: Record; created_at?: string; updated_at?: string; } interface HomepageTemplate { key: string; name: string; description?: string; sections: Array<{ type: string; title: string; settings?: Record; }>; } interface HomepageTemplatesResponse { templates: HomepageTemplate[]; } interface SectionReorderResponse { sections: HomepageSection[]; } interface BannerImagesUpdateRequest { images: string[]; } interface CollectionsUpdateRequest { collection_slugs: string[]; } interface FeaturedTargetUpdateRequest { target_type: 'collection' | 'product'; target_handle: string; } interface TranslationUpdateRequest { title?: string; description?: string; } interface TranslationListResponse { translations: HomepageSectionTranslation[]; } interface Collection { id?: string; slug: string; name: string; description?: string; handle?: string; image_url?: string; product_count?: number; display_order?: number; meta_title?: string; meta_description?: string; created_at?: string; updated_at?: string; } interface CollectionCreateRequest { slug: string; name: string; description?: string; image_url?: string; display_order?: number; meta_title?: string; meta_description?: string; } interface CollectionUpdateRequest { slug?: string; name?: string; description?: string; image_url?: string; cover_media_id?: string; display_order?: number; meta_title?: string; meta_description?: string; } interface CollectionListResponse { collections: Collection[]; total?: number; limit?: number; offset?: number; } interface CollectionResponse { collection: Collection; } interface CollectionProductsRequest { product_ids: string[]; } interface CollectionProductsResponse { products: Product[]; total?: number; } interface Tag { name: string; product_count?: number; created_at?: string; } type OperationType = 'override' | 'new' | 'hidden'; type ProductSectionType = 'collapsible' | 'static'; type SectionSource = 'system' | 'merchant' | 'product'; interface MerchantSectionCustomization { id: string; merchant_id: string; handle: string; operation_type: OperationType; type: ProductSectionType; position: number; content: string; tab_group: string | null; created_at: string; updated_at: string; } interface ProductSectionOverride { id: string; product_id: string; handle: string; operation_type: OperationType; type: ProductSectionType; position: number; content: string; tab_group: string | null; created_at: string; updated_at: string; } interface ProductSectionTranslation { language_code: string; title: string; content: string; } interface ResolvedSection { handle: string; source: SectionSource; source_id: string | null; operation_type: OperationType | null; type: ProductSectionType; position: number; tab_group: string | null; is_hidden: boolean; content: string; translations: Record; } interface ResolvedSectionsResponse { sections: ResolvedSection[]; available_languages: string[]; } interface ProductSectionCreateRequest { handle: string; operation_type: OperationType; type?: ProductSectionType; position?: number; content?: string; tab_group?: string | null; inherit_translations?: boolean | null; } interface ProductSectionUpdateRequest { type?: ProductSectionType; position?: number; content?: string; tab_group?: string | null; } interface ProductSectionReorderRequest { tab_group?: string | null; sections: Array<{ handle: string; position: number; }>; } interface TagListResponse { tags: Tag[]; total?: number; } interface TagResponse { tag: Tag; } interface TagStatsResponse { name: string; product_count: number; created_at?: string; } interface Review { id: string; product_id: string; product_name?: string; order_id?: string; customer_id?: string; customer_name?: string; reviewer_name?: string; reviewer_email?: string; rating: number; title?: string; content?: string; media_ids?: string[]; moderation_status: 'pending' | 'approved' | 'rejected'; is_featured: boolean; is_ai_generated?: boolean; is_verified_purchase: boolean; helpful_count: number; not_helpful_count: number; merchant_response?: string; merchant_response_at?: string; is_edited?: boolean; edited_at?: string; created_at: string; updated_at?: string; } interface ReviewStats { total_reviews: number; average_rating: number; rating_distribution: Record; with_media_count: number; with_reply_count: number; featured_count: number; verified_count?: number; } interface ReviewReport { id: string; review_id: string; reporter_id?: string; reason: string; description?: string; status: 'pending' | 'reviewed' | 'dismissed'; created_at: string; } interface ReviewListParams { product_id?: string; status?: 'pending' | 'approved' | 'rejected'; rating?: number; has_media?: boolean; has_reply?: boolean; featured?: boolean; verified?: boolean; sort_by?: 'newest' | 'oldest' | 'highest_rating' | 'lowest_rating' | 'most_helpful'; is_ai_generated?: boolean; limit?: number; offset?: number; } interface ReviewBatchResult { success_count: number; failed_count: number; errors?: Array<{ id: string; error: string; }>; } interface ReviewSettings { auto_approve: boolean; require_purchase: boolean; allow_anonymous: boolean; review_window_days: number; allow_images: boolean; allow_videos: boolean; max_images: number; allow_edit: boolean; edit_window_days: number; } interface ReviewSettingsUpdate { auto_approve?: boolean; require_purchase?: boolean; allow_anonymous?: boolean; review_window_days?: number; allow_images?: boolean; allow_videos?: boolean; max_images?: number; allow_edit?: boolean; edit_window_days?: number; } declare class CommerceApiClient { private client; constructor(); /** * 重新初始化客户端(当 API URL 改变时调用) */ reinitialize(): void; products: { /** * 创建商品 */ create: (data: Partial) => Promise; /** * 商品列表 */ list: (params?: { per_page?: number; page?: number; status?: string; category_id?: string; search?: string; collection?: string; tags?: string; sort_by?: "name" | "price" | "stock_quantity" | "created_at" | "updated_at" | "status"; sort_order?: "asc" | "desc"; include_variants?: boolean; masters_only?: boolean; }) => Promise<{ products: Product[]; total: number; total_count?: number; has_next?: boolean; }>; /** * 商品详情 */ get: (productId: string) => Promise; /** * 更新商品 */ update: (productId: string, data: Partial) => Promise; /** * 删除商品(软删除) */ delete: (productId: string) => Promise; /** * 添加商品图片(两步流程) * 1. 先上传图片到存储获取 media_id * 2. 再关联 media_id 到商品 */ addImages: (productId: string, imagePaths: string[]) => Promise; /** * 添加商品图片(通过 URL) * 直接用图片 URL 关联到商品(后端会下载) */ addImageUrls: (productId: string, imageUrls: string[]) => Promise; /** * 添加商品图片(通过 Media ID) * 直接用 media_id 关联到商品(从 upload 命令获取) */ addImagesByMediaIds: (productId: string, mediaIds: string[]) => Promise; /** * 移除商品图片 */ removeImages: (productId: string, mediaIds: string[]) => Promise; /** * 重排商品图片 * moves: [{ media_id: 'xxx', new_position: 1 }, ...] (1-based) */ reorderImages: (productId: string, moves: Array<{ media_id: string; new_position: number; }>) => Promise; /** * 添加商品视频(通过 URL) * 后端会下载视频并进行转码处理 */ addVideoUrls: (productId: string, videoUrls: string[]) => Promise; /** * 添加商品视频(通过 Media ID) * 直接用 media_id 关联到商品 */ addVideosByMediaIds: (productId: string, mediaIds: string[]) => Promise; /** * 移除商品视频 */ removeVideos: (productId: string, mediaIds: string[]) => Promise; /** * 重排商品视频 * moves: [{ media_id: 'xxx', new_position: 1 }, ...] (1-based) */ reorderVideos: (productId: string, moves: Array<{ media_id: string; new_position: number; }>) => Promise; }; customFields: { /** * List custom fields for a product */ list: (productId: string) => Promise; /** * Create a custom field for a product */ create: (productId: string, data: { name: string; label?: string; field_type: string; required?: boolean; placeholder?: string; max_length?: number; allowed_file_types?: string[]; max_file_size_mb?: number; position?: number; }) => Promise; /** * Update a custom field */ update: (productId: string, fieldId: string, data: Record) => Promise; /** * Delete a custom field */ delete: (productId: string, fieldId: string) => Promise; }; orders: { /** * 商户订单列表 */ list: (params?: { limit?: number; offset?: number; status?: string; start_date?: string; end_date?: string; search?: string; sort_by?: "created_at" | "amount_total" | "order_number" | "status" | "updated_at" | "customer_email" | "customer_name"; sort_order?: "asc" | "desc"; }) => Promise<{ orders: Order[]; total: number; }>; /** * 订单详情 */ get: (orderId: string) => Promise; /** * 标记订单已发货 */ ship: (orderId: string, data: { tracking_number?: string; carrier?: string; tracking_url?: string; note?: string; create_easyship_shipment?: boolean; courier_id?: string; }) => Promise; /** * 完成订单 */ complete: (orderId: string) => Promise; /** * 取消订单 */ cancel: (orderId: string, reason?: string) => Promise; /** * 标记已送达 */ markDelivered: (orderId: string) => Promise; /** * 更新物流状态 (手动物流) * @param orderId 订单 ID * @param status 新状态: in_transit, out_for_delivery, failed, returned * @param note 可选备注 * @param trackingNumber 可选更新物流单号 * @param carrier 可选更新快递公司 */ updateShippingStatus: (orderId: string, data: { status: "in_transit" | "out_for_delivery" | "failed" | "returned"; note?: string; tracking_number?: string; carrier?: string; }) => Promise; /** * 获取订单物流状态历史 */ getShippingHistory: (orderId: string) => Promise; /** * 刷新面单信息(从 Easyship 同步 label_url, label_state) */ refreshLabel: (orderId: string) => Promise; }; inventory: { /** * 获取低库存商品 */ getLowStock: (threshold?: number) => Promise; /** * 调整商品库存 */ updateStock: (productId: string, quantity: number, reason?: string) => Promise; /** * 查看库存变更历史 */ getHistory: (productId: string) => Promise; /** * 预留库存(购物车功能) */ reserveStock: (productId: string, quantity: number) => Promise; }; merchant: { /** * 获取当前商户信息 */ getProfile: () => Promise; /** * 更新商户资料 */ updateProfile: (data: Partial) => Promise; /** * 初始化 OAuth 用户的商户资料 */ setupProfile: (data: Partial) => Promise; }; shipping: { /** * 获取物流模式配置 */ getMode: () => Promise<{ shipping_mode: "free" | "fixed" | "dynamic"; free_shipping_days_min?: number; free_shipping_days_max?: number; }>; /** * 更新物流模式配置 */ updateMode: (mode: "free" | "fixed" | "dynamic", freeDaysMin?: number, freeDaysMax?: number) => Promise; /** * 获取支持的国家列表 (公开端点) */ getCountries: (merchantId: string) => Promise; }; easyship: { /** * 创建 Easyship 发货单 * 为订单生成物流标签和跟踪号 */ createShipment: (orderId: string) => Promise; /** * @deprecated Use tracking.getByOrderId() instead */ track: (orderId: string) => Promise; /** * 验证配送地址 */ validateAddress: (data: { line_1: string; line_2?: string; city: string; state?: string; postal_code: string; country_alpha2: string; contact_name?: string; contact_phone?: string; contact_email?: string; }) => Promise; /** * 获取可用快递列表 */ getCouriers: (country?: string) => Promise; /** * 获取 Easyship 发货地址 */ getOrigin: () => Promise; /** * 更新 Easyship 发货地址 */ updateOrigin: (data: { origin_country_alpha2: string; origin_city: string; origin_state?: string; origin_postal_code: string; origin_line_1: string; origin_line_2?: string; contact_name: string; contact_phone: string; contact_email?: string; company_name?: string; }) => Promise; /** * 验证发货地址 */ validateOrigin: (data: { line_1: string; line_2?: string; city: string; state?: string; postal_code: string; country_alpha2: string; contact_name?: string; contact_phone?: string; contact_email?: string; delivery_instructions?: string; }) => Promise; }; tracking: { /** * 通过订单 ID 获取统一物流跟踪信息 */ getByOrderId: (orderId: string) => Promise; }; shippingFixed: { /** * 获取固定运费全局配置 */ getConfig: () => Promise; /** * 更新全局配置 */ updateConfig: (data: any) => Promise; /** * 计算订单运费 */ calculate: (data: { destination_country: string; postal_code?: string; weight: number; items?: any[]; merchant_id?: string; }) => Promise<{ shipping_cost: number; currency: string; }>; /** * 获取运费区域列表 */ listZones: () => Promise; /** * 创建运费区域 */ createZone: (data: { name: string; countries: Array<{ code: string; }> | string[]; rates?: Array<{ min_weight: number; max_weight?: number; price: number; currency?: string; }>; }) => Promise; /** * 获取运费区域详情 */ getZone: (zoneId: string) => Promise; /** * 更新运费区域 */ updateZone: (zoneId: string, data: Partial) => Promise; /** * 删除运费区域 */ deleteZone: (zoneId: string) => Promise; /** * 获取区域运费费率 */ listRates: (zoneId: string) => Promise; /** * 创建运费费率 */ createRate: (zoneId: string, data: Partial) => Promise; /** * 更新运费费率 */ updateRate: (zoneId: string, rateId: string, data: Partial) => Promise; /** * 删除运费费率 */ deleteRate: (zoneId: string, rateId: string) => Promise; }; conversations: { /** * 创建对话 */ create: (data: { participants: Array<{ role: string; customer_id?: string; customer_email?: string; customer_phone?: string; customer_name?: string; merchant_id?: string; }>; initial_message?: string; }) => Promise; /** * 获取对话列表 */ list: (params?: { page?: number; per_page?: number; status?: string; }) => Promise; /** * 获取对话详情 */ get: (conversationId: string) => Promise; /** * 更新对话状态 */ update: (conversationId: string, data: { status?: string; }) => Promise; /** * 发送消息 */ sendMessage: (conversationId: string, data: { content: string; message_type?: string; metadata?: any; }) => Promise; /** * 获取消息列表 */ getMessages: (conversationId: string, params?: { limit?: number; before?: string; }) => Promise; /** * 标记消息已读 */ markRead: (conversationId: string) => Promise; /** * 获取对话上下文 */ getContext: (conversationId: string) => Promise; }; variants: { /** * 获取商品变体列表 */ list: (productId: string) => Promise; /** * 搜索商品变体 * 通过属性(颜色、尺寸等)搜索变体 */ search: (productId: string, params?: { color?: string; size?: string; }) => Promise; /** * 创建商品变体 */ create: (productId: string, data: Partial) => Promise; /** * 获取变体详情 */ get: (productId: string, variantId: string) => Promise; /** * 更新变体 */ update: (productId: string, variantId: string, data: Partial) => Promise; /** * 删除变体 */ delete: (productId: string, variantId: string) => Promise; /** * 添加变体图片(两步流程) * 1. 先上传图片到存储获取 media_id * 2. 再关联 media_id 到变体 */ addImages: (masterId: string, variantId: string, imagePaths: string[]) => Promise; /** * 添加变体图片(通过 Media ID) * 直接用 media_id 关联到变体(从 upload 命令获取) */ addImagesByMediaIds: (masterId: string, variantId: string, mediaIds: string[]) => Promise; /** * 添加变体图片(通过 URL) * 直接用图片 URL 关联到变体(后端会下载) */ addImageUrls: (masterId: string, variantId: string, imageUrls: string[]) => Promise; }; refunds: { /** * 创建退款 */ create: (data: { payment_intent_id: string; amount: number; reason?: string; }) => Promise; /** * 获取退款详情 */ get: (refundId: string) => Promise; }; upload: { /** * 上传图片 */ uploadImage: (imagePath: string) => Promise<{ url: string; media_id?: string; }>; /** * 上传视频(同步,最大100MB) */ uploadVideo: (videoPath: string) => Promise<{ url: string; thumbnail_url?: string; media_id?: string; }>; /** * 异步上传视频(最大500MB) * 返回 media_id 和 job_id,需要轮询状态 */ uploadVideoAsync: (videoPath: string) => Promise<{ media_id: string; job_id: string; status: string; status_url: string; }>; /** * 获取视频处理状态 */ getVideoStatus: (mediaId: string) => Promise<{ media_id: string; job_id?: string; status: "pending" | "processing" | "completed" | "failed"; progress?: number; error?: string; variants?: Record; }>; /** * 上传文件 */ uploadFile: (filePath: string) => Promise<{ file_url: string; file_name: string; file_size: number; content_type: string; uploaded_at: string; expires_at: string; }>; }; media: { /** * 获取视频处理状态 */ getVideoStatus: (mediaId: string) => Promise<{ media_id: string; job_id?: string; status: "pending" | "processing" | "completed" | "failed"; progress?: number; error?: string; variants?: Record; }>; }; transfers: { list: () => Promise; summary: () => Promise; }; i18n: { /** * 获取支持的语言列表 */ listLanguages: (activeOnly?: boolean) => Promise; productTranslations: { list: (productId: string) => Promise; get: (productId: string, languageCode: string) => Promise; create: (productId: string, data: any) => Promise; update: (productId: string, languageCode: string, data: any) => Promise; delete: (productId: string, languageCode: string) => Promise; }; collectionTranslations: { list: (collectionId: string) => Promise; get: (collectionId: string, languageCode: string) => Promise; create: (collectionId: string, data: any) => Promise; update: (collectionId: string, languageCode: string, data: any) => Promise; delete: (collectionId: string, languageCode: string) => Promise; }; merchantTranslations: { list: () => Promise; get: (languageCode: string) => Promise; create: (data: any) => Promise; update: (languageCode: string, data: any) => Promise; delete: (languageCode: string) => Promise; }; }; homepage: { sections: { /** * 列出所有 sections */ list: () => Promise; /** * 创建 section */ create: (data: SectionCreateRequest) => Promise; /** * 获取单个 section */ get: (id: string, expand?: string) => Promise; /** * 更新 section */ update: (id: string, data: SectionUpdateRequest) => Promise; /** * 删除 section */ delete: (id: string) => Promise; /** * 重排序 sections */ reorder: (moves: MoveInput[]) => Promise; }; settings: { /** * 更新 Banner 图片 */ updateImages: (id: string, images: Array<{ url?: string; media_id?: string; mobile_url?: string; mobile_media_id?: string; alt: string; action_type: string; action_value: string | null; }>) => Promise; /** * 更新单张 Banner 图片(PATCH) */ patchImage: (id: string, imageIndex: number, patch: { url?: string; mobile_url?: string | null; alt?: string; action_type?: string; action_value?: string | null; }) => Promise; /** * 更新 Collections 列表 */ updateCollections: (id: string, collection_slugs: string[]) => Promise; /** * 更新 Collection Products 目标集合 */ updateCollectionSlug: (id: string, collection_slug: string) => Promise; /** * 更新 Featured 目标 */ updateTarget: (id: string, target_type: "collection" | "product", target_handle: string) => Promise; /** * 通用设置补丁 */ patch: (id: string, settings: Record) => Promise; }; translations: { /** * 列出所有翻译 */ list: (sectionId: string) => Promise; /** * 创建或更新翻译 (upsert) */ set: (sectionId: string, lang: string, data: TranslationUpdateRequest) => Promise; /** * 删除翻译 */ delete: (sectionId: string, lang: string) => Promise; }; /** * 获取当前活动的首页配置 */ getConfig: () => Promise; /** * 切换到预定义模板 */ switchTemplate: (templateKey: string) => Promise; /** * 获取所有可用模板 (公开端点,无需认证) */ listTemplates: () => Promise; /** * 删除首页配置 */ deleteConfig: (configId: string) => Promise; /** * 更新页面级设置(背景图片、叠加层等) */ updatePageSettings: (data: Record) => Promise>; }; collections: { /** * 列出所有 collections */ list: (params?: { limit?: number; offset?: number; }) => Promise; /** * 创建 collection */ create: (data: CollectionCreateRequest) => Promise; /** * 获取单个 collection */ get: (id: string) => Promise; /** * 更新 collection */ update: (id: string, data: CollectionUpdateRequest) => Promise; /** * 删除 collection */ delete: (id: string) => Promise; /** * 添加商品到 collection */ addProducts: (id: string, productIds: string[]) => Promise; /** * 从 collection 移除商品 * Note: Backend API 不支持批量删除,需要对每个产品发送单独的 DELETE 请求 */ removeProducts: (id: string, productIds: string[]) => Promise; /** * 列出 collection 中的商品 */ listProducts: (id: string, params?: { limit?: number; offset?: number; }) => Promise; }; tags: { /** * 列出所有 tags */ list: () => Promise; /** * 创建 tag */ create: (name: string) => Promise; /** * 删除 tag */ delete: (name: string) => Promise; /** * 获取 tag 统计信息 */ stats: (name: string) => Promise; }; productSections: { merchant: { /** * 列出商户自定义 */ list: () => Promise; /** * 列出合并后的完整视图 */ listResolved: () => Promise; /** * 创建商户级自定义 */ create: (data: ProductSectionCreateRequest) => Promise; /** * 更新商户级自定义 */ update: (handle: string, data: ProductSectionUpdateRequest) => Promise; /** * 删除商户级自定义 */ delete: (handle: string) => Promise; /** * 隐藏区块 */ hide: (handle: string) => Promise; /** * 批量排序 */ reorder: (data: ProductSectionReorderRequest) => Promise; translations: { /** * 列出翻译 */ list: (handle: string) => Promise; /** * 设置翻译(创建或更新) */ set: (handle: string, lang: string, data: { title: string; content: string; }) => Promise; /** * 删除翻译 */ delete: (handle: string, lang: string) => Promise; }; }; product: { /** * 列出商品级覆盖 */ list: (productId: string) => Promise; /** * 列出合并后的完整视图 */ listResolved: (productId: string) => Promise; /** * 创建商品级覆盖 */ create: (productId: string, data: ProductSectionCreateRequest) => Promise; /** * 更新商品级覆盖 */ update: (productId: string, handle: string, data: ProductSectionUpdateRequest) => Promise; /** * 删除商品级覆盖 */ delete: (productId: string, handle: string) => Promise; /** * 隐藏区块(商品级) */ hide: (productId: string, handle: string) => Promise; /** * 批量排序(商品级) */ reorder: (productId: string, data: ProductSectionReorderRequest) => Promise; translations: { /** * 列出翻译 */ list: (productId: string, handle: string) => Promise; /** * 设置翻译(创建或更新) */ set: (productId: string, handle: string, lang: string, data: { title: string; content: string; }) => Promise; /** * 删除翻译 */ delete: (productId: string, handle: string, lang: string) => Promise; }; }; }; reviews: { /** * 商家创建评价(单条) */ create: (data: { product_id: string; rating: number; title?: string; content?: string; customer_name?: string; is_ai_generated?: boolean; is_verified_purchase?: boolean; language_code?: string; }) => Promise; /** * 批量生成评价 */ generate: (data: { product_id: string; reviews: Array<{ rating: number; title?: string; content?: string; customer_name?: string; is_verified_purchase?: boolean; }>; spread_days?: number; is_ai_generated?: boolean; language_code?: string; }) => Promise<{ success: boolean; created_count: number; reviews: Review[]; }>; /** * 评价列表 */ list: (params?: ReviewListParams) => Promise<{ reviews: Review[]; total: number; }>; /** * 评价详情 */ get: (reviewId: string) => Promise; /** * 店铺评价统计 */ stats: () => Promise; /** * 更新评价(审核状态、精选) */ update: (reviewId: string, data: { moderation_status?: "pending" | "approved" | "rejected"; is_featured?: boolean; }) => Promise; /** * 删除评价 */ delete: (reviewId: string) => Promise; /** * 商家回复 */ respond: (reviewId: string, content: string) => Promise; /** * 删除商家回复 */ deleteResponse: (reviewId: string) => Promise; /** * 批量操作 */ batch: (reviewIds: string[], action: "approve" | "reject" | "delete") => Promise; /** * 举报列表 */ listReports: (params?: { status?: "pending" | "reviewed" | "dismissed"; }) => Promise<{ reports: ReviewReport[]; total: number; }>; /** * 处理举报 */ handleReport: (reportId: string, status: "reviewed" | "dismissed") => Promise; /** * 获取评价设置 */ getSettings: () => Promise; /** * 更新评价设置 */ updateSettings: (data: ReviewSettingsUpdate) => Promise; }; shopAbout: { get: () => Promise; update: (updates: Record) => Promise; translations: { get: (lang: string) => Promise; set: (lang: string, translation: Record) => Promise; }; }; shopPolicy: { list: () => Promise; get: (policyType: string) => Promise; set: (policyType: string, policy: { title: string; content: string; }) => Promise; translations: { get: (policyType: string, lang: string) => Promise; set: (policyType: string, lang: string, translation: Record) => Promise; }; }; } export declare const commerceApi: CommerceApiClient; export type { Product, Order, OrderItem, InventoryItem, Merchant, ShippingZone, ShippingRate, Variant, HomepageSection, HomepageSectionTranslation, MoveInput, SectionCreateRequest, SectionUpdateRequest, SectionListResponse, SectionReorderResponse, BannerImagesUpdateRequest, CollectionsUpdateRequest, FeaturedTargetUpdateRequest, TranslationUpdateRequest, TranslationListResponse, Collection, CollectionCreateRequest, CollectionUpdateRequest, CollectionListResponse, CollectionResponse, CollectionProductsRequest, CollectionProductsResponse, Tag, TagListResponse, TagResponse, TagStatsResponse, OperationType, ProductSectionType, SectionSource, MerchantSectionCustomization, ProductSectionOverride, ProductSectionTranslation, ResolvedSection, ResolvedSectionsResponse, ProductSectionCreateRequest, ProductSectionUpdateRequest, ProductSectionReorderRequest, Review, ReviewStats, ReviewReport, ReviewListParams, ReviewBatchResult, ReviewSettings, ReviewSettingsUpdate, }; //# sourceMappingURL=commerce.d.ts.map