refactor: 拆分模板配置契约与注册逻辑
This commit is contained in:
1 parent
7e1dd543fb
commit
d0902d6568
12 files changed
+1025
-945
No files matched your search
@@ -0,0 +1,139 @@
|
||||
import type { BrandTemplateKey } from "./template-keys.js";
|
||||
import type { BrandTemplateDefinition } from "./brand-contracts.js";
|
||||
|
||||
export const brandTemplates = {
|
||||
personal: {
|
||||
key: "personal",
|
||||
version: "1.0.0",
|
||||
name: "个人品牌",
|
||||
description: "围绕定位、信任、作品与合作建立个人品牌。",
|
||||
serviceCategories: ["consulting", "collaboration", "custom"],
|
||||
trustContentTypes: [
|
||||
"profile",
|
||||
"experience",
|
||||
"credential",
|
||||
"portfolio",
|
||||
"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 },
|
||||
],
|
||||
fields: [
|
||||
{ scope: "profile", key: "name", label: "品牌名称", type: "text", required: true },
|
||||
{ scope: "profile", key: "tagline", label: "一句话定位", type: "text", required: true },
|
||||
{ scope: "profile", key: "audience", label: "服务对象", type: "textarea", required: true },
|
||||
{
|
||||
scope: "profile",
|
||||
key: "valueProposition",
|
||||
label: "提供的价值",
|
||||
type: "textarea",
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
scope: "profile",
|
||||
key: "trustProof",
|
||||
label: "信任证明入口",
|
||||
type: "textarea",
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
capabilities: ["offerings", "inquiry"],
|
||||
},
|
||||
food: {
|
||||
key: "food",
|
||||
version: "1.0.0",
|
||||
name: "餐饮模板",
|
||||
description: "适用于餐饮服务与套餐预约的行业模板。",
|
||||
serviceCategories: ["food-package", "private-chef", "custom"],
|
||||
trustContentTypes: [
|
||||
"profile",
|
||||
"experience",
|
||||
"credential",
|
||||
"portfolio",
|
||||
"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 },
|
||||
],
|
||||
fields: [
|
||||
{ scope: "profile", key: "name", label: "品牌名称", type: "text", required: true },
|
||||
{ scope: "profile", key: "tagline", label: "一句话定位", type: "text", required: true },
|
||||
{ scope: "profile", key: "audience", label: "服务对象", type: "textarea", required: true },
|
||||
{
|
||||
scope: "profile",
|
||||
key: "valueProposition",
|
||||
label: "提供的价值",
|
||||
type: "textarea",
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
scope: "profile",
|
||||
key: "trustProof",
|
||||
label: "信任证明入口",
|
||||
type: "textarea",
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
capabilities: ["offerings", "inquiry", "booking"],
|
||||
},
|
||||
doors: {
|
||||
key: "doors",
|
||||
version: "1.0.0",
|
||||
name: "高端门窗模板",
|
||||
description: "适用于别墅门、院门、室内门与定制门窗服务的行业模板。",
|
||||
serviceCategories: ["entrance-door", "garden-door", "interior-door", "custom"],
|
||||
trustContentTypes: [
|
||||
"profile",
|
||||
"experience",
|
||||
"credential",
|
||||
"portfolio",
|
||||
"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 },
|
||||
],
|
||||
fields: [
|
||||
{ scope: "profile", key: "name", label: "品牌名称", type: "text", required: true },
|
||||
{ scope: "profile", key: "tagline", label: "一句话定位", type: "text", required: true },
|
||||
{ scope: "profile", key: "audience", label: "服务对象", type: "textarea", required: true },
|
||||
{
|
||||
scope: "profile",
|
||||
key: "valueProposition",
|
||||
label: "提供的价值",
|
||||
type: "textarea",
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
scope: "profile",
|
||||
key: "trustProof",
|
||||
label: "信任证明入口",
|
||||
type: "textarea",
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
capabilities: ["offerings", "inquiry"],
|
||||
},
|
||||
} 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;
|
||||
}
|
||||
Reference in new issue
Block a user