feat: 建立版本化模板注册表

This commit is contained in:
que01 committed 2026-09-20 17:37:57 +08:00
1 parent 3524a6f322
commit a3434ce2b9
3 files changed
+55 -6

No files matched your search

+42 -2
View File
@@ -1,16 +1,31 @@
export const configPackageName = "personal-brand-config";
export type BrandTemplateKey = "personal" | "food";
export type BrandTemplateModuleType = "identity" | "trust" | "offering" | "inquiry" | "contact";
export interface BrandTemplateModuleDefinition {
key: string;
type: BrandTemplateModuleType;
title: string;
required: boolean;
}
export interface BrandTemplateDefinition {
key: BrandTemplateKey;
version: string;
name: string;
description: string;
serviceCategories: string[];
trustContentTypes: string[];
modules: BrandTemplateModuleDefinition[];
capabilities: string[];
}
export const brandTemplates: Record<BrandTemplateKey, BrandTemplateDefinition> = {
export const brandTemplates = {
personal: {
key: "personal",
version: "1.0.0",
name: "个人品牌",
description: "围绕定位、信任、作品与合作建立个人品牌。",
serviceCategories: ["consulting", "collaboration", "custom"],
@@ -22,9 +37,18 @@ export const brandTemplates: Record<BrandTemplateKey, BrandTemplateDefinition> =
"process",
"testimonial",
],
modules: [
{ key: "identity", type: "identity", title: "品牌身份", required: true },
{ key: "trust", type: "trust", title: "信任内容", required: true },
{ key: "offerings", type: "offering", title: "业务提供项", required: true },
{ key: "inquiry", type: "inquiry", title: "联系与咨询", required: true },
{ key: "contact", type: "contact", title: "品牌表达", required: true },
],
capabilities: ["offerings", "inquiry"],
},
food: {
key: "food",
version: "1.0.0",
name: "餐饮模板",
description: "适用于餐饮服务与套餐预约的行业模板。",
serviceCategories: ["food-package", "private-chef", "custom"],
@@ -36,5 +60,21 @@ export const brandTemplates: Record<BrandTemplateKey, BrandTemplateDefinition> =
"process",
"testimonial",
],
modules: [
{ key: "identity", type: "identity", title: "品牌身份", required: true },
{ key: "trust", type: "trust", title: "信任内容", required: true },
{ key: "offerings", type: "offering", title: "菜单与服务", required: true },
{ key: "inquiry", type: "inquiry", title: "预约与咨询", required: true },
{ key: "contact", type: "contact", title: "品牌表达", required: true },
],
capabilities: ["offerings", "inquiry", "booking"],
},
};
} satisfies Record<BrandTemplateKey, BrandTemplateDefinition>;
export function isBrandTemplateKey(value: string): value is BrandTemplateKey {
return Object.prototype.hasOwnProperty.call(brandTemplates, value);
}
export function getBrandTemplate(key: string): BrandTemplateDefinition | undefined {
return isBrandTemplateKey(key) ? brandTemplates[key] : undefined;
}