feat(edit): 编辑页上报ozon 开发

This commit is contained in:
R524809
2026-09-30 15:57:54 +08:00
parent 0a303414d8
commit 45871584b3
48 changed files with 3700 additions and 887 deletions
+48 -4
View File
@@ -178,6 +178,45 @@ export type ProductPublishPreflight = {
refresh_runs: ProductCatalogRefreshRun[];
};
export type ProductPublishItemStatus = 'queued' | 'submitting' | 'polling' | 'imported' | 'failed' | 'skipped' | 'reconciling';
export type ProductPublishJob = {
id: string;
profile_id: string;
store_id: string;
status: 'queued' | 'running' | 'succeeded' | 'partially_succeeded' | 'failed' | 'reconciling';
item_count: number;
created_at: string;
completed_at: string | null;
items: Array<{
id: string;
variant_id: string;
display_name: string | null;
offer_id: string;
status: ProductPublishItemStatus;
platform_product_id: string | null;
errors: Array<{ code: string; field?: string; message: string }>;
}>;
};
/** 发布快照只保存确定的素材身份,私有下载凭证在 Worker 提交前生成。 */
export type OzonPublishItemSnapshot = {
offer_id: string;
name: string;
description_category_id: number;
type_id: number;
price: string;
old_price?: string;
currency_code: string;
depth: number;
width: number;
height: number;
dimension_unit: 'mm';
weight: number;
weight_unit: 'g';
attributes: Array<{ id: number; complex_id: number; values: Array<{ value: string; dictionary_value_id?: number }> }>;
media: Array<{ asset_id: string; checksum_sha256: string; bucket: string; object_key: string; storage_provider: string; content_type: string }>;
};
/** 商品编辑入口与完整读模型;真正的发布 job DTO 仍在后续纵向任务中定义。 */
export type ProductEditorContext = {
collection_item_id: string;
@@ -218,6 +257,7 @@ export type ProductEditorSnapshot = {
currency_code: string;
}>;
title: string | null;
title_mode: 'common' | 'variant';
description: string | null;
tags: string[];
category: {
@@ -479,7 +519,7 @@ export const productPublishPreflightRequestSchema = z
variant_ids: z
.array(uuid)
.min(1)
.max(100)
.max(50)
.refine((ids) => new Set(ids).size === ids.length, 'SKU 不能重复'),
})
.strict();
@@ -488,6 +528,9 @@ export type ProductPublishPreflightRequest = z.infer<
typeof productPublishPreflightRequestSchema
>;
export const createProductPublishJobRequestSchema = productPublishPreflightRequestSchema;
export type CreateProductPublishJobRequest = ProductPublishPreflightRequest;
/** 商品、发布配置与 SKU(含报价确认意图)原子保存。 */
export const saveProductEditorDraftRequestSchema = z
.object({
@@ -517,7 +560,8 @@ export const saveProductEditorDraftRequestSchema = z
.object({
target_store_id: uuid,
fulfillment: z.enum(['rfbs', 'fbs', 'fbo', 'fbp', 'unknown']),
title: nullableText(1_000),
title: nullableText(500),
title_mode: z.enum(['common', 'variant']).optional(),
description: nullableText(100_000),
tags: z.array(z.string().trim().min(1).max(100)).max(30),
platform_product_category_id: uuid.nullable().optional(),
@@ -557,14 +601,14 @@ export const saveProductEditorDraftRequestSchema = z
.string()
.regex(/^\d+(\.\d{1,2})?$/)
.nullable(),
title: nullableText(1_000).optional(),
title: nullableText(500).optional(),
tags: z
.array(z.string().trim().min(1).max(100))
.max(30),
description: nullableText(100_000),
physical_spec: variantPhysicalSpec,
package_spec: variantPackageSpec,
offer_id: nullableText(500),
offer_id: nullableText(50),
media_asset_ids: z
.array(uuid)
.max(30)