import type { PlatformCreationTypeId } from '../../packages/shared/src/contracts/playTypes'; import { requestJson } from './apiClient'; export const DEFAULT_UNIFIED_CREATION_MUD_POINT_COST = 10; /** 后端下发的单个创作类型入口配置,前端只据此展示和分流。 */ export type CreationEntryTypeConfig = { id: PlatformCreationTypeId; title: string; subtitle: string; badge: string; imageSrc: string; visible: boolean; open: boolean; sortOrder: number; categoryId: string; categoryLabel: string; categorySortOrder: number; updatedAtMicros: number; unifiedCreationSpec?: UnifiedCreationSpec | null; }; /** 统一创作工作台字段契约,用于表单型玩法的最小输入描述。 */ export type UnifiedCreationField = { id: string; kind: 'text' | 'select' | 'image' | 'audio'; label: string; required: boolean; }; /** 统一创作工作台契约,把入口类型映射到工作台、生成页和结果页阶段。 */ export type UnifiedCreationSpec = { playId: PlatformCreationTypeId; title: string; mudPointCost?: number | null; workspaceStage: string; generationStage: string; resultStage: string; fields: UnifiedCreationField[]; }; /** 创作入口公告位配置,HTML 模式仅用于沙箱预览,结构化字段保留旧数据兼容。 */ export type CreationEntryEventBannerConfig = { title: string; description: string; coverImageSrc: string; prizePoolMudPoints: number; startsAtText: string; endsAtText: string; renderMode?: 'structured' | 'html'; htmlCode?: string | null; }; /** 创作入口页完整配置;前端只展示后端事实源,不内置入口默认值。 */ export type CreationEntryConfig = { startCard: { title: string; description: string; idleBadge: string; busyBadge: string; }; typeModal: { title: string; description: string; }; /** 旧单条公告位兼容字段,新代码优先读取 eventBanners。 */ eventBanner: CreationEntryEventBannerConfig; /** 底部加号创作入口页的多公告轮播配置。 */ eventBanners?: CreationEntryEventBannerConfig[]; creationTypes: CreationEntryTypeConfig[]; }; /** 拉取底部加号创作入口配置;所有入口和公告都以后端事实源为准。 */ export async function fetchCreationEntryConfig(): Promise { return requestJson( '/api/creation-entry/config', { method: 'GET' }, '读取创作入口配置失败', ); }