feat: 分离模板演示数据并校验预览资源
This commit is contained in:
1 parent
6edde5a8d6
commit
b60174885e
31 files changed
+1785
-69
No files matched your search
@@ -133,6 +133,25 @@ export interface TemplatePackagePreview {
|
||||
missingSampleSlots: string[];
|
||||
};
|
||||
workspace: RuntimeWorkspace;
|
||||
preview: {
|
||||
assetFiles: Record<string, { sha256: string; dataUrl: string }>;
|
||||
fixtureSource: "previewFixture" | "legacy-sampleContent";
|
||||
safety: { submissions: "disabled"; customerRecords: "disabled"; contactActions: "disabled" };
|
||||
diagnostics: Array<{ code: string; severity: "warning"; message: string }>;
|
||||
pages: Array<{
|
||||
key: string;
|
||||
modules: Array<{ key: string; title: string; bindings: string[] }>;
|
||||
}>;
|
||||
assets: Array<{
|
||||
key: string;
|
||||
label: string;
|
||||
binding: string;
|
||||
required: boolean;
|
||||
populated: number;
|
||||
total: number;
|
||||
status: "missing" | "unverified" | "ready";
|
||||
}>;
|
||||
};
|
||||
}
|
||||
|
||||
export interface TemplatePackageList {
|
||||
|
||||
@@ -1516,7 +1516,7 @@ export const generatedTemplatePackageRegistry: readonly TemplatePackageManifest[
|
||||
},
|
||||
{
|
||||
packageKey: "atelier-solopreneur",
|
||||
version: "1.1.0",
|
||||
version: "1.2.0",
|
||||
displayName: "独立工坊 · 品牌小程序",
|
||||
defaultBrandSlug: "atelier-studio",
|
||||
runtimeContract: "1.0",
|
||||
@@ -3352,6 +3352,462 @@ export const generatedTemplatePackageRegistry: readonly TemplatePackageManifest[
|
||||
},
|
||||
},
|
||||
pages: ["pages/index/index", "pages/services/index", "pages/bookings/index"],
|
||||
previewFixture: {
|
||||
personal: {
|
||||
schemaVersion: "1",
|
||||
brand: {
|
||||
name: "独立工坊 · 演示品牌",
|
||||
tagline: "把专业经验变成值得信任的个人品牌",
|
||||
description:
|
||||
"为独立主理人提供品牌定位、产品设计与小程序开发支持。这些内容仅用于演示模板。",
|
||||
hours: "工作日 10:00–18:00",
|
||||
address: "远程协作 · 全国",
|
||||
deliveryNote: "演示内容不接受真实咨询。",
|
||||
},
|
||||
content: {
|
||||
templateKey: "personal",
|
||||
inquiryFormName: "品牌小程序需求意向单",
|
||||
offerings: [
|
||||
{
|
||||
kind: "service",
|
||||
name: "校园餐饮品牌",
|
||||
summary: "敏捷菜单 + 品牌展示 + 咨询承接",
|
||||
categoryKey: "portfolio",
|
||||
coverUrl: "/assets/cases/campus.jpg",
|
||||
priceText: "按需求确认范围与报价",
|
||||
config: {
|
||||
spaceType: "餐饮品牌展示与咨询承接",
|
||||
series: "试点架构原型",
|
||||
keywords: ["模板演示", "可持续运营", "后台配置"],
|
||||
details: {
|
||||
background:
|
||||
"校园餐饮品牌需要让访客快速了解餐品、营业安排与预订方式。本案例是用于验证系统结构的试点模板,不代表真实客户项目。",
|
||||
designConcept:
|
||||
"以品牌介绍建立第一印象,通过菜单与服务说明帮助访客了解供给,再通过咨询表单承接具体需求。",
|
||||
crafts: [
|
||||
"品牌介绍与餐品内容由后台维护",
|
||||
"草稿预览与发布分离,确认后更新公开内容",
|
||||
"咨询表单收集需求,支持后续人工跟进",
|
||||
],
|
||||
materialsList: [
|
||||
{
|
||||
name: "品牌展示",
|
||||
spec: "首页、主理人介绍与信任内容",
|
||||
},
|
||||
{
|
||||
name: "餐品管理",
|
||||
spec: "列表、详情与封面配置",
|
||||
},
|
||||
{
|
||||
name: "需求承接",
|
||||
spec: "咨询表单与跟进记录",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
kind: "service",
|
||||
name: "个人编辑型品牌",
|
||||
summary: "案例沉淀 + 专业表达 + 合作咨询",
|
||||
categoryKey: "portfolio",
|
||||
coverUrl: "/assets/cases/editorial.jpg",
|
||||
priceText: "按需求确认范围与报价",
|
||||
config: {
|
||||
spaceType: "个人品牌作品展示与合作咨询",
|
||||
series: "试点架构原型",
|
||||
keywords: ["模板演示", "可持续运营", "后台配置"],
|
||||
details: {
|
||||
background:
|
||||
"个人品牌需要将定位、代表作品与合作方式组织成清晰的了解路径。本案例展示编辑型模板的结构,不构成客户合作背书。",
|
||||
designConcept:
|
||||
"围绕专业表达与作品沉淀组织页面,让访客先了解品牌与工作方式,再浏览案例细节并提出合作需求。",
|
||||
crafts: [
|
||||
"个人定位、作品与流程可持续更新",
|
||||
"案例详情展示背景、构建思路与交付要点",
|
||||
"通过咨询入口衔接后续需求沟通",
|
||||
],
|
||||
materialsList: [
|
||||
{
|
||||
name: "专业表达",
|
||||
spec: "定位、简介与品牌理念",
|
||||
},
|
||||
{
|
||||
name: "作品沉淀",
|
||||
spec: "案例列表、详情与图片",
|
||||
},
|
||||
{
|
||||
name: "合作沟通",
|
||||
spec: "合作说明、咨询表单与跟进记录",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
trustContent: [
|
||||
{
|
||||
type: "credential",
|
||||
title: "系统基础与合作边界",
|
||||
content:
|
||||
"当前已实现两套试点模板、网页内容管理、草稿预览与发布、咨询承接能力。具体交付页面、上线材料、费用、排期与后续支持范围,需要在需求沟通后确认。",
|
||||
},
|
||||
],
|
||||
fields: [
|
||||
{
|
||||
key: "name",
|
||||
label: "称呼 / 品牌名称",
|
||||
type: "text",
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
key: "industry",
|
||||
label: "你的主营领域",
|
||||
type: "radio",
|
||||
required: true,
|
||||
options: [
|
||||
{
|
||||
label: "独立设计 / 建筑",
|
||||
value: "独立设计 / 建筑",
|
||||
},
|
||||
{
|
||||
label: "摄影 / 视觉艺术",
|
||||
value: "摄影 / 视觉艺术",
|
||||
},
|
||||
{
|
||||
label: "独立商业咨询",
|
||||
value: "独立商业咨询",
|
||||
},
|
||||
{
|
||||
label: "教练 / 身心疗愈",
|
||||
value: "教练 / 身心疗愈",
|
||||
},
|
||||
{
|
||||
label: "个人 IP / 创作者",
|
||||
value: "个人 IP / 创作者",
|
||||
},
|
||||
{
|
||||
label: "精品品牌 / 实体",
|
||||
value: "精品品牌 / 实体",
|
||||
},
|
||||
{
|
||||
label: "其他",
|
||||
value: "其他",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
key: "needs",
|
||||
label: "目前主要诉求与现状",
|
||||
type: "textarea",
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
key: "timeline",
|
||||
label: "预期启动排期",
|
||||
type: "radio",
|
||||
required: false,
|
||||
options: [
|
||||
{
|
||||
label: "本月内",
|
||||
value: "本月内",
|
||||
},
|
||||
{
|
||||
label: "下月起",
|
||||
value: "下月起",
|
||||
},
|
||||
{
|
||||
label: "先期评估",
|
||||
value: "先期评估",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
key: "contact",
|
||||
label: "联系方式(微信 / 电话)",
|
||||
type: "text",
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
capabilityKey: "inquiry",
|
||||
brandConfig: {
|
||||
visualPresentation: {
|
||||
home: {
|
||||
eyebrow: "独立开发者 · 品牌小程序构建",
|
||||
title: "把个人品牌做成\n可持续运营的小程序",
|
||||
subtitle:
|
||||
"不只是做一个展示页面,而是为你搭建专业展示、内容运营与长期承接咨询的小程序系统。",
|
||||
primaryAction: "预约咨询 / 聊聊需求",
|
||||
secondaryAction: "查看服务架构",
|
||||
featuresTitle: "差异化构建逻辑",
|
||||
featuresEnglish: "Bespoke System",
|
||||
casesTitle: "试点架构原型",
|
||||
casesSubtitle: "验证模板 · 点击进入结构解析",
|
||||
caseAction: "查看详情架构 →",
|
||||
audienceTitle: "专属服务群体",
|
||||
audienceEnglish: "Target Creators",
|
||||
ctaTitle: "开启你的品牌小程序",
|
||||
ctaSubtitle: "从策略梳理到上线的一站式交付",
|
||||
ctaAction: "立即沟通",
|
||||
},
|
||||
offerings: {
|
||||
eyebrow: "完整独立交付 · 匠心构建",
|
||||
title: "全链路服务与透明协作",
|
||||
subtitle: "站在产品与长期运营的角度设计,专注交付可持续更新的个人品牌数字资产。",
|
||||
deliverablesTitle: "交付体系",
|
||||
deliverablesEnglish: "7 Deliverables",
|
||||
processTitle: "协作流程",
|
||||
processEnglish: "5 Phases · 节点透明可溯",
|
||||
proofTitle: "信任基石",
|
||||
proofEnglish: "Why bespoke",
|
||||
ctaTitle: "对流程有疑问?直接聊聊",
|
||||
ctaSubtitle: "一起梳理当前的品牌数字化需求,评估适合的结构与启动时间。",
|
||||
ctaAction: "预约需求沟通",
|
||||
},
|
||||
profile: {
|
||||
eyebrow: "个人中心 · 状态与沟通",
|
||||
title: "我的",
|
||||
subtitle: "查看咨询记录、发起新咨询,或直接联系主理人。",
|
||||
inquiryAction: "新增咨询",
|
||||
timeHint: "约 3 分钟",
|
||||
wechatLabel: "微信直聊",
|
||||
copyAction: "复制微信",
|
||||
contactHint: "尚未配置微信号,可先填写意向单",
|
||||
promise: "先梳理可行性与时间节点,再确认合作范围",
|
||||
recordsAction: "查看咨询记录 →",
|
||||
faqTitle: "常见疑问解答",
|
||||
faqSubtitle: "把透明与确定性放在第一位,说明合作的常见顾虑与流程。",
|
||||
footerQuote: "Bespoke digital architecture for clear minds.",
|
||||
footerNote: "用心打磨每一处体验 · 期待与你的灵感交汇",
|
||||
recordsTitle: "我的咨询记录",
|
||||
recordsDescription: "查看提交过的意向和主理人回复状态。",
|
||||
},
|
||||
inquiry: {
|
||||
eyebrow: "Atelier Note · 品牌意向梳理",
|
||||
title: "品牌意向梳理 · 3 分钟完成",
|
||||
subtitle: "用于需求梳理与排期评估,请填写当前业务、目标用户与主要诉求。",
|
||||
submitLabel: "提交意向 · 预约沟通",
|
||||
privacyTitle: "信息使用说明",
|
||||
privacyNote:
|
||||
"你提交的信息仅用于本次需求评估与后续联系。请勿填写密码、证件号码等敏感信息。",
|
||||
followupHint: "提交后可在咨询记录中查看状态,具体响应时间以主理人确认为准。",
|
||||
note: "填写的信息仅用于需求沟通与排期评估。",
|
||||
},
|
||||
success: {
|
||||
eyebrow: "已提交",
|
||||
title: "意向已送达工坊",
|
||||
intro: "已收到你的需求清单,将结合业务情况评估可行性,并通过你留下的联系方式沟通。",
|
||||
recordsAction: "查看咨询记录",
|
||||
homeAction: "返回首页",
|
||||
},
|
||||
records: {
|
||||
title: "我的品牌咨询",
|
||||
createAction: "填写新需求",
|
||||
emptyTitle: "还没有咨询记录",
|
||||
emptyDescription: "提交品牌需求后,可以在这里查看后续跟进状态。",
|
||||
emptyAction: "填写品牌需求",
|
||||
},
|
||||
detail: {
|
||||
priceLabel: "合作方式",
|
||||
spaceLabel: "适用场景",
|
||||
backgroundTitle: "案例与业务背景",
|
||||
conceptTitle: "构建思路",
|
||||
craftsTitle: "交付要点",
|
||||
materialsTitle: "能力构成",
|
||||
inquiryAction: "聊聊类似需求",
|
||||
inquiryHint: "具体范围与报价在需求确认后提供。",
|
||||
},
|
||||
},
|
||||
atelier: {
|
||||
badges: [
|
||||
{
|
||||
title: "完整可交付小程序",
|
||||
},
|
||||
{
|
||||
title: "支持后台随时更新",
|
||||
},
|
||||
{
|
||||
title: "支持长期演进",
|
||||
},
|
||||
],
|
||||
features: [
|
||||
{
|
||||
tag: "敏捷控制台",
|
||||
title: "不是静态页面,而是可持续更新的系统",
|
||||
description:
|
||||
"拥有独立管理后台,案例作品、核心业务与介绍随时增删修改,让日常更新回归内容本身。",
|
||||
},
|
||||
{
|
||||
tag: "信任转化",
|
||||
title: "先梳理定位与信任结构",
|
||||
description:
|
||||
"优先厘清客户的了解路径与业务背书,从第一屏价值表达,到高意向咨询的承接。",
|
||||
},
|
||||
{
|
||||
tag: "陪伴演进",
|
||||
title: "交付之后,支持长期迭代",
|
||||
description: "从上线协助到阶段性功能扩展,让品牌载体伴随业务持续成长。",
|
||||
},
|
||||
],
|
||||
audiences: [
|
||||
{
|
||||
symbol: "◎",
|
||||
title: "摄影师",
|
||||
description: "样片沉淀",
|
||||
},
|
||||
{
|
||||
symbol: "◇",
|
||||
title: "咨询顾问",
|
||||
description: "信任转化",
|
||||
},
|
||||
{
|
||||
symbol: "✎",
|
||||
title: "独立设计",
|
||||
description: "作品展呈",
|
||||
},
|
||||
{
|
||||
symbol: "↗",
|
||||
title: "教练疗愈",
|
||||
description: "需求预约",
|
||||
},
|
||||
{
|
||||
symbol: "▤",
|
||||
title: "IP 创作者",
|
||||
description: "私域载体",
|
||||
},
|
||||
{
|
||||
symbol: "⌂",
|
||||
title: "小微实体",
|
||||
description: "产品看板",
|
||||
},
|
||||
],
|
||||
deliverables: [
|
||||
{
|
||||
title: "品牌定位梳理",
|
||||
tag: "清晰聚焦",
|
||||
description: "提炼核心专长与目标客户画像,明确小程序核心诉求与转化路径。",
|
||||
},
|
||||
{
|
||||
title: "页面结构设计",
|
||||
tag: "信任动线",
|
||||
description: "梳理信息架构与信任动线,建立递进式了解路径。",
|
||||
},
|
||||
{
|
||||
title: "小程序视觉设计",
|
||||
tag: "克制美学",
|
||||
description: "结合微信使用习惯设计界面,用精致排版强化专业辨识度。",
|
||||
},
|
||||
{
|
||||
title: "内容字段规划",
|
||||
tag: "结构资产",
|
||||
description: "规范案例、服务与常见问题字段,让内容持续沉淀。",
|
||||
},
|
||||
{
|
||||
title: "后台管理配置",
|
||||
tag: "自主维护",
|
||||
description: "通过网页后台修改内容、上传图片,保存为草稿,确认后发布。",
|
||||
},
|
||||
{
|
||||
title: "发布上线协助",
|
||||
tag: "上线协作",
|
||||
description: "协助准备微信主体与类目材料、配置和提审,审核结果以微信平台为准。",
|
||||
},
|
||||
{
|
||||
title: "后续运营支持",
|
||||
tag: "长期支持",
|
||||
description: "提供操作说明与迭代建议,具体支持范围在合作时确认。",
|
||||
},
|
||||
],
|
||||
process: [
|
||||
{
|
||||
title: "需求沟通",
|
||||
description: "交流专业背景、获客渠道与核心需求,评估可行性与排期。",
|
||||
},
|
||||
{
|
||||
title: "品牌结构梳理",
|
||||
description: "提炼品牌关键词与信息架构,统一页面目标。",
|
||||
},
|
||||
{
|
||||
title: "界面设计确认",
|
||||
description: "确认原型、视觉、排版与交互细节。",
|
||||
},
|
||||
{
|
||||
title: "内容配置与上线",
|
||||
description: "录入案例与服务资料,联调、提审并协助发布。",
|
||||
},
|
||||
{
|
||||
title: "长期演进迭代",
|
||||
description: "根据反馈完善内容,按约定范围迭代功能。",
|
||||
},
|
||||
],
|
||||
proofs: [
|
||||
{
|
||||
title: "已有系统基础",
|
||||
description: "两套试点模板验证展示、配置与咨询链路。",
|
||||
},
|
||||
{
|
||||
title: "支持后台管理",
|
||||
description: "内容由品牌自行维护,草稿确认后再发布。",
|
||||
},
|
||||
{
|
||||
title: "模块化扩展",
|
||||
description: "复用稳定的系统能力,按需求扩展页面与服务。",
|
||||
},
|
||||
{
|
||||
title: "定位先于视觉",
|
||||
description: "先说明你是谁、为谁服务、为什么值得信任。",
|
||||
},
|
||||
{
|
||||
title: "直接沟通与持续支持",
|
||||
description: "独立主理人直接对接,合作边界与后续支持提前确认。",
|
||||
},
|
||||
],
|
||||
faqs: [
|
||||
{
|
||||
title: "还没整理好品牌文案,可以开始吗?",
|
||||
description:
|
||||
"可以先沟通。第一阶段一起梳理定位、核心业务与已有素材,再确定需要补齐的内容。",
|
||||
},
|
||||
{
|
||||
title: "后续内容可以自己修改吗?",
|
||||
description:
|
||||
"可以通过网页管理后台维护简介、案例、服务与表单。保存先形成草稿,确认并发布后,公开小程序才更新。",
|
||||
},
|
||||
{
|
||||
title: "可以先做轻量版本验证吗?",
|
||||
description:
|
||||
"可以。优先用展示、服务介绍与意向咨询等核心页面验证需求,再依据反馈扩展。",
|
||||
},
|
||||
{
|
||||
title: "设计和上线怎么配合?",
|
||||
description:
|
||||
"需求对齐、结构梳理、视觉确认、内容配置与上线分阶段推进。微信认证与审核由平台决定,所需材料和分工提前确认。",
|
||||
},
|
||||
],
|
||||
identity: {
|
||||
status: "当前可接新项目",
|
||||
experience: "10 年",
|
||||
tags: [
|
||||
{
|
||||
title: "大屏可视化",
|
||||
},
|
||||
{
|
||||
title: "小程序",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
founder: "林予 · 示例主理人",
|
||||
title: "产品设计 / 全栈开发",
|
||||
},
|
||||
},
|
||||
safety: {
|
||||
submissions: "disabled",
|
||||
customerRecords: "disabled",
|
||||
contactActions: "disabled",
|
||||
},
|
||||
},
|
||||
},
|
||||
visualTemplateKey: "atelier-solopreneur",
|
||||
},
|
||||
{
|
||||
@@ -4904,4 +5360,4 @@ export const generatedTemplatePackageRegistry: readonly TemplatePackageManifest[
|
||||
},
|
||||
];
|
||||
export const generatedTemplatePackageRegistryHash =
|
||||
"6a2736b95fc446c4a9c8a106d8d4726f393992fefcfe9a8a27e8509fdca8c5a9";
|
||||
"409bf2553c819c916ba1036eed103cae7b707f88b7b396fd566dc77c02b1ec03";
|
||||
@@ -3,6 +3,26 @@ import type { CapabilityKey } from "./template-keys.js";
|
||||
import type { VisualTemplateKey } from "./template-keys.js";
|
||||
import type { TemplateSampleContent } from "./template-sample-content.js";
|
||||
|
||||
export interface TemplatePreviewFixture {
|
||||
schemaVersion: "1";
|
||||
brand: {
|
||||
name: string;
|
||||
tagline: string;
|
||||
description: string;
|
||||
avatarUrl?: string;
|
||||
coverUrl?: string;
|
||||
hours?: string;
|
||||
address?: string;
|
||||
deliveryNote?: string;
|
||||
};
|
||||
content: TemplateSampleContent;
|
||||
safety: {
|
||||
submissions: "disabled";
|
||||
customerRecords: "disabled";
|
||||
contactActions: "disabled";
|
||||
};
|
||||
}
|
||||
|
||||
export interface TemplatePackageManifest {
|
||||
packageKey: string;
|
||||
version: string;
|
||||
@@ -127,4 +147,5 @@ export interface TemplatePackageManifest {
|
||||
}[];
|
||||
overrides?: readonly string[];
|
||||
sampleContent?: Partial<Record<BrandTemplateKey, TemplateSampleContent>>;
|
||||
previewFixture?: Partial<Record<BrandTemplateKey, TemplatePreviewFixture>>;
|
||||
}
|
||||
@@ -40,7 +40,7 @@ export const visualTemplates: Record<VisualTemplateKey, VisualTemplateDefinition
|
||||
},
|
||||
"atelier-solopreneur": {
|
||||
key: "atelier-solopreneur",
|
||||
version: "1.1.0",
|
||||
version: "1.2.0",
|
||||
name: "独立工坊 · 品牌小程序",
|
||||
description: "展示品牌小程序服务、试点案例与合作流程,承接需求咨询。",
|
||||
supportedIndustryTemplates: ["personal"],
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# 独立工坊 · 品牌小程序
|
||||
|
||||
`atelier-solopreneur@1.1.0` 是用于宣传个人品牌小程序构建服务的独立模板,适配 `personal` 行业。视觉参考为用户提供的 Stitch 首页、服务、咨询和意向单设计;采用浅灰底、深蓝主色和编辑式排版。
|
||||
`atelier-solopreneur@1.2.0` 是用于宣传个人品牌小程序构建服务的独立模板,适配 `personal` 行业。视觉参考为用户提供的 Stitch 首页、服务、咨询和意向单设计;采用浅灰底、深蓝主色和编辑式排版。
|
||||
|
||||
## 内容与使用
|
||||
|
||||
@@ -39,3 +39,5 @@ pnpm template:dev atelier-solopreneur --brand atelier-studio
|
||||
咨询字段共 5 项:称呼 / 品牌名称、主营领域、需求现状、预期排期、联系方式。表单选项使用共享 Inquiry 的可选 chips 样式,默认行为不变。
|
||||
|
||||
验收状态见 `docs/atelier-template-acceptance.md`。H5 验收不替代微信开发者工具、真机登录、合法域名和安全区验证。
|
||||
|
||||
独立管理预览使用 `previewFixture.personal`,品牌起始内容仍使用 `sampleContent.personal`。两者独立维护,预览身份不会写入品牌或通过示例导入覆盖品牌信息。
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@personal-brand/template-atelier-solopreneur",
|
||||
"version": "1.1.0",
|
||||
"version": "1.2.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"files": [
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"packageKey": "atelier-solopreneur",
|
||||
"version": "1.1.0",
|
||||
"version": "1.2.0",
|
||||
"displayName": "独立工坊 · 品牌小程序",
|
||||
"defaultBrandSlug": "atelier-studio",
|
||||
"runtimeContract": "1.0",
|
||||
@@ -1822,5 +1822,447 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"pages": ["pages/index/index", "pages/services/index", "pages/bookings/index"]
|
||||
"pages": ["pages/index/index", "pages/services/index", "pages/bookings/index"],
|
||||
"previewFixture": {
|
||||
"personal": {
|
||||
"schemaVersion": "1",
|
||||
"brand": {
|
||||
"name": "独立工坊 · 演示品牌",
|
||||
"tagline": "把专业经验变成值得信任的个人品牌",
|
||||
"description": "为独立主理人提供品牌定位、产品设计与小程序开发支持。这些内容仅用于演示模板。",
|
||||
"hours": "工作日 10:00–18:00",
|
||||
"address": "远程协作 · 全国",
|
||||
"deliveryNote": "演示内容不接受真实咨询。"
|
||||
},
|
||||
"content": {
|
||||
"templateKey": "personal",
|
||||
"inquiryFormName": "品牌小程序需求意向单",
|
||||
"offerings": [
|
||||
{
|
||||
"kind": "service",
|
||||
"name": "校园餐饮品牌",
|
||||
"summary": "敏捷菜单 + 品牌展示 + 咨询承接",
|
||||
"categoryKey": "portfolio",
|
||||
"coverUrl": "/assets/cases/campus.jpg",
|
||||
"priceText": "按需求确认范围与报价",
|
||||
"config": {
|
||||
"spaceType": "餐饮品牌展示与咨询承接",
|
||||
"series": "试点架构原型",
|
||||
"keywords": ["模板演示", "可持续运营", "后台配置"],
|
||||
"details": {
|
||||
"background": "校园餐饮品牌需要让访客快速了解餐品、营业安排与预订方式。本案例是用于验证系统结构的试点模板,不代表真实客户项目。",
|
||||
"designConcept": "以品牌介绍建立第一印象,通过菜单与服务说明帮助访客了解供给,再通过咨询表单承接具体需求。",
|
||||
"crafts": [
|
||||
"品牌介绍与餐品内容由后台维护",
|
||||
"草稿预览与发布分离,确认后更新公开内容",
|
||||
"咨询表单收集需求,支持后续人工跟进"
|
||||
],
|
||||
"materialsList": [
|
||||
{
|
||||
"name": "品牌展示",
|
||||
"spec": "首页、主理人介绍与信任内容"
|
||||
},
|
||||
{
|
||||
"name": "餐品管理",
|
||||
"spec": "列表、详情与封面配置"
|
||||
},
|
||||
{
|
||||
"name": "需求承接",
|
||||
"spec": "咨询表单与跟进记录"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"kind": "service",
|
||||
"name": "个人编辑型品牌",
|
||||
"summary": "案例沉淀 + 专业表达 + 合作咨询",
|
||||
"categoryKey": "portfolio",
|
||||
"coverUrl": "/assets/cases/editorial.jpg",
|
||||
"priceText": "按需求确认范围与报价",
|
||||
"config": {
|
||||
"spaceType": "个人品牌作品展示与合作咨询",
|
||||
"series": "试点架构原型",
|
||||
"keywords": ["模板演示", "可持续运营", "后台配置"],
|
||||
"details": {
|
||||
"background": "个人品牌需要将定位、代表作品与合作方式组织成清晰的了解路径。本案例展示编辑型模板的结构,不构成客户合作背书。",
|
||||
"designConcept": "围绕专业表达与作品沉淀组织页面,让访客先了解品牌与工作方式,再浏览案例细节并提出合作需求。",
|
||||
"crafts": [
|
||||
"个人定位、作品与流程可持续更新",
|
||||
"案例详情展示背景、构建思路与交付要点",
|
||||
"通过咨询入口衔接后续需求沟通"
|
||||
],
|
||||
"materialsList": [
|
||||
{
|
||||
"name": "专业表达",
|
||||
"spec": "定位、简介与品牌理念"
|
||||
},
|
||||
{
|
||||
"name": "作品沉淀",
|
||||
"spec": "案例列表、详情与图片"
|
||||
},
|
||||
{
|
||||
"name": "合作沟通",
|
||||
"spec": "合作说明、咨询表单与跟进记录"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"trustContent": [
|
||||
{
|
||||
"type": "credential",
|
||||
"title": "系统基础与合作边界",
|
||||
"content": "当前已实现两套试点模板、网页内容管理、草稿预览与发布、咨询承接能力。具体交付页面、上线材料、费用、排期与后续支持范围,需要在需求沟通后确认。"
|
||||
}
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"key": "name",
|
||||
"label": "称呼 / 品牌名称",
|
||||
"type": "text",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"key": "industry",
|
||||
"label": "你的主营领域",
|
||||
"type": "radio",
|
||||
"required": true,
|
||||
"options": [
|
||||
{
|
||||
"label": "独立设计 / 建筑",
|
||||
"value": "独立设计 / 建筑"
|
||||
},
|
||||
{
|
||||
"label": "摄影 / 视觉艺术",
|
||||
"value": "摄影 / 视觉艺术"
|
||||
},
|
||||
{
|
||||
"label": "独立商业咨询",
|
||||
"value": "独立商业咨询"
|
||||
},
|
||||
{
|
||||
"label": "教练 / 身心疗愈",
|
||||
"value": "教练 / 身心疗愈"
|
||||
},
|
||||
{
|
||||
"label": "个人 IP / 创作者",
|
||||
"value": "个人 IP / 创作者"
|
||||
},
|
||||
{
|
||||
"label": "精品品牌 / 实体",
|
||||
"value": "精品品牌 / 实体"
|
||||
},
|
||||
{
|
||||
"label": "其他",
|
||||
"value": "其他"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "needs",
|
||||
"label": "目前主要诉求与现状",
|
||||
"type": "textarea",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"key": "timeline",
|
||||
"label": "预期启动排期",
|
||||
"type": "radio",
|
||||
"required": false,
|
||||
"options": [
|
||||
{
|
||||
"label": "本月内",
|
||||
"value": "本月内"
|
||||
},
|
||||
{
|
||||
"label": "下月起",
|
||||
"value": "下月起"
|
||||
},
|
||||
{
|
||||
"label": "先期评估",
|
||||
"value": "先期评估"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "contact",
|
||||
"label": "联系方式(微信 / 电话)",
|
||||
"type": "text",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"capabilityKey": "inquiry",
|
||||
"brandConfig": {
|
||||
"visualPresentation": {
|
||||
"home": {
|
||||
"eyebrow": "独立开发者 · 品牌小程序构建",
|
||||
"title": "把个人品牌做成\n可持续运营的小程序",
|
||||
"subtitle": "不只是做一个展示页面,而是为你搭建专业展示、内容运营与长期承接咨询的小程序系统。",
|
||||
"primaryAction": "预约咨询 / 聊聊需求",
|
||||
"secondaryAction": "查看服务架构",
|
||||
"featuresTitle": "差异化构建逻辑",
|
||||
"featuresEnglish": "Bespoke System",
|
||||
"casesTitle": "试点架构原型",
|
||||
"casesSubtitle": "验证模板 · 点击进入结构解析",
|
||||
"caseAction": "查看详情架构 →",
|
||||
"audienceTitle": "专属服务群体",
|
||||
"audienceEnglish": "Target Creators",
|
||||
"ctaTitle": "开启你的品牌小程序",
|
||||
"ctaSubtitle": "从策略梳理到上线的一站式交付",
|
||||
"ctaAction": "立即沟通"
|
||||
},
|
||||
"offerings": {
|
||||
"eyebrow": "完整独立交付 · 匠心构建",
|
||||
"title": "全链路服务与透明协作",
|
||||
"subtitle": "站在产品与长期运营的角度设计,专注交付可持续更新的个人品牌数字资产。",
|
||||
"deliverablesTitle": "交付体系",
|
||||
"deliverablesEnglish": "7 Deliverables",
|
||||
"processTitle": "协作流程",
|
||||
"processEnglish": "5 Phases · 节点透明可溯",
|
||||
"proofTitle": "信任基石",
|
||||
"proofEnglish": "Why bespoke",
|
||||
"ctaTitle": "对流程有疑问?直接聊聊",
|
||||
"ctaSubtitle": "一起梳理当前的品牌数字化需求,评估适合的结构与启动时间。",
|
||||
"ctaAction": "预约需求沟通"
|
||||
},
|
||||
"profile": {
|
||||
"eyebrow": "个人中心 · 状态与沟通",
|
||||
"title": "我的",
|
||||
"subtitle": "查看咨询记录、发起新咨询,或直接联系主理人。",
|
||||
"inquiryAction": "新增咨询",
|
||||
"timeHint": "约 3 分钟",
|
||||
"wechatLabel": "微信直聊",
|
||||
"copyAction": "复制微信",
|
||||
"contactHint": "尚未配置微信号,可先填写意向单",
|
||||
"promise": "先梳理可行性与时间节点,再确认合作范围",
|
||||
"recordsAction": "查看咨询记录 →",
|
||||
"faqTitle": "常见疑问解答",
|
||||
"faqSubtitle": "把透明与确定性放在第一位,说明合作的常见顾虑与流程。",
|
||||
"footerQuote": "Bespoke digital architecture for clear minds.",
|
||||
"footerNote": "用心打磨每一处体验 · 期待与你的灵感交汇",
|
||||
"recordsTitle": "我的咨询记录",
|
||||
"recordsDescription": "查看提交过的意向和主理人回复状态。"
|
||||
},
|
||||
"inquiry": {
|
||||
"eyebrow": "Atelier Note · 品牌意向梳理",
|
||||
"title": "品牌意向梳理 · 3 分钟完成",
|
||||
"subtitle": "用于需求梳理与排期评估,请填写当前业务、目标用户与主要诉求。",
|
||||
"submitLabel": "提交意向 · 预约沟通",
|
||||
"privacyTitle": "信息使用说明",
|
||||
"privacyNote": "你提交的信息仅用于本次需求评估与后续联系。请勿填写密码、证件号码等敏感信息。",
|
||||
"followupHint": "提交后可在咨询记录中查看状态,具体响应时间以主理人确认为准。",
|
||||
"note": "填写的信息仅用于需求沟通与排期评估。"
|
||||
},
|
||||
"success": {
|
||||
"eyebrow": "已提交",
|
||||
"title": "意向已送达工坊",
|
||||
"intro": "已收到你的需求清单,将结合业务情况评估可行性,并通过你留下的联系方式沟通。",
|
||||
"recordsAction": "查看咨询记录",
|
||||
"homeAction": "返回首页"
|
||||
},
|
||||
"records": {
|
||||
"title": "我的品牌咨询",
|
||||
"createAction": "填写新需求",
|
||||
"emptyTitle": "还没有咨询记录",
|
||||
"emptyDescription": "提交品牌需求后,可以在这里查看后续跟进状态。",
|
||||
"emptyAction": "填写品牌需求"
|
||||
},
|
||||
"detail": {
|
||||
"priceLabel": "合作方式",
|
||||
"spaceLabel": "适用场景",
|
||||
"backgroundTitle": "案例与业务背景",
|
||||
"conceptTitle": "构建思路",
|
||||
"craftsTitle": "交付要点",
|
||||
"materialsTitle": "能力构成",
|
||||
"inquiryAction": "聊聊类似需求",
|
||||
"inquiryHint": "具体范围与报价在需求确认后提供。"
|
||||
}
|
||||
},
|
||||
"atelier": {
|
||||
"badges": [
|
||||
{
|
||||
"title": "完整可交付小程序"
|
||||
},
|
||||
{
|
||||
"title": "支持后台随时更新"
|
||||
},
|
||||
{
|
||||
"title": "支持长期演进"
|
||||
}
|
||||
],
|
||||
"features": [
|
||||
{
|
||||
"tag": "敏捷控制台",
|
||||
"title": "不是静态页面,而是可持续更新的系统",
|
||||
"description": "拥有独立管理后台,案例作品、核心业务与介绍随时增删修改,让日常更新回归内容本身。"
|
||||
},
|
||||
{
|
||||
"tag": "信任转化",
|
||||
"title": "先梳理定位与信任结构",
|
||||
"description": "优先厘清客户的了解路径与业务背书,从第一屏价值表达,到高意向咨询的承接。"
|
||||
},
|
||||
{
|
||||
"tag": "陪伴演进",
|
||||
"title": "交付之后,支持长期迭代",
|
||||
"description": "从上线协助到阶段性功能扩展,让品牌载体伴随业务持续成长。"
|
||||
}
|
||||
],
|
||||
"audiences": [
|
||||
{
|
||||
"symbol": "◎",
|
||||
"title": "摄影师",
|
||||
"description": "样片沉淀"
|
||||
},
|
||||
{
|
||||
"symbol": "◇",
|
||||
"title": "咨询顾问",
|
||||
"description": "信任转化"
|
||||
},
|
||||
{
|
||||
"symbol": "✎",
|
||||
"title": "独立设计",
|
||||
"description": "作品展呈"
|
||||
},
|
||||
{
|
||||
"symbol": "↗",
|
||||
"title": "教练疗愈",
|
||||
"description": "需求预约"
|
||||
},
|
||||
{
|
||||
"symbol": "▤",
|
||||
"title": "IP 创作者",
|
||||
"description": "私域载体"
|
||||
},
|
||||
{
|
||||
"symbol": "⌂",
|
||||
"title": "小微实体",
|
||||
"description": "产品看板"
|
||||
}
|
||||
],
|
||||
"deliverables": [
|
||||
{
|
||||
"title": "品牌定位梳理",
|
||||
"tag": "清晰聚焦",
|
||||
"description": "提炼核心专长与目标客户画像,明确小程序核心诉求与转化路径。"
|
||||
},
|
||||
{
|
||||
"title": "页面结构设计",
|
||||
"tag": "信任动线",
|
||||
"description": "梳理信息架构与信任动线,建立递进式了解路径。"
|
||||
},
|
||||
{
|
||||
"title": "小程序视觉设计",
|
||||
"tag": "克制美学",
|
||||
"description": "结合微信使用习惯设计界面,用精致排版强化专业辨识度。"
|
||||
},
|
||||
{
|
||||
"title": "内容字段规划",
|
||||
"tag": "结构资产",
|
||||
"description": "规范案例、服务与常见问题字段,让内容持续沉淀。"
|
||||
},
|
||||
{
|
||||
"title": "后台管理配置",
|
||||
"tag": "自主维护",
|
||||
"description": "通过网页后台修改内容、上传图片,保存为草稿,确认后发布。"
|
||||
},
|
||||
{
|
||||
"title": "发布上线协助",
|
||||
"tag": "上线协作",
|
||||
"description": "协助准备微信主体与类目材料、配置和提审,审核结果以微信平台为准。"
|
||||
},
|
||||
{
|
||||
"title": "后续运营支持",
|
||||
"tag": "长期支持",
|
||||
"description": "提供操作说明与迭代建议,具体支持范围在合作时确认。"
|
||||
}
|
||||
],
|
||||
"process": [
|
||||
{
|
||||
"title": "需求沟通",
|
||||
"description": "交流专业背景、获客渠道与核心需求,评估可行性与排期。"
|
||||
},
|
||||
{
|
||||
"title": "品牌结构梳理",
|
||||
"description": "提炼品牌关键词与信息架构,统一页面目标。"
|
||||
},
|
||||
{
|
||||
"title": "界面设计确认",
|
||||
"description": "确认原型、视觉、排版与交互细节。"
|
||||
},
|
||||
{
|
||||
"title": "内容配置与上线",
|
||||
"description": "录入案例与服务资料,联调、提审并协助发布。"
|
||||
},
|
||||
{
|
||||
"title": "长期演进迭代",
|
||||
"description": "根据反馈完善内容,按约定范围迭代功能。"
|
||||
}
|
||||
],
|
||||
"proofs": [
|
||||
{
|
||||
"title": "已有系统基础",
|
||||
"description": "两套试点模板验证展示、配置与咨询链路。"
|
||||
},
|
||||
{
|
||||
"title": "支持后台管理",
|
||||
"description": "内容由品牌自行维护,草稿确认后再发布。"
|
||||
},
|
||||
{
|
||||
"title": "模块化扩展",
|
||||
"description": "复用稳定的系统能力,按需求扩展页面与服务。"
|
||||
},
|
||||
{
|
||||
"title": "定位先于视觉",
|
||||
"description": "先说明你是谁、为谁服务、为什么值得信任。"
|
||||
},
|
||||
{
|
||||
"title": "直接沟通与持续支持",
|
||||
"description": "独立主理人直接对接,合作边界与后续支持提前确认。"
|
||||
}
|
||||
],
|
||||
"faqs": [
|
||||
{
|
||||
"title": "还没整理好品牌文案,可以开始吗?",
|
||||
"description": "可以先沟通。第一阶段一起梳理定位、核心业务与已有素材,再确定需要补齐的内容。"
|
||||
},
|
||||
{
|
||||
"title": "后续内容可以自己修改吗?",
|
||||
"description": "可以通过网页管理后台维护简介、案例、服务与表单。保存先形成草稿,确认并发布后,公开小程序才更新。"
|
||||
},
|
||||
{
|
||||
"title": "可以先做轻量版本验证吗?",
|
||||
"description": "可以。优先用展示、服务介绍与意向咨询等核心页面验证需求,再依据反馈扩展。"
|
||||
},
|
||||
{
|
||||
"title": "设计和上线怎么配合?",
|
||||
"description": "需求对齐、结构梳理、视觉确认、内容配置与上线分阶段推进。微信认证与审核由平台决定,所需材料和分工提前确认。"
|
||||
}
|
||||
],
|
||||
"identity": {
|
||||
"status": "当前可接新项目",
|
||||
"experience": "10 年",
|
||||
"tags": [
|
||||
{
|
||||
"title": "大屏可视化"
|
||||
},
|
||||
{
|
||||
"title": "小程序"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"founder": "林予 · 示例主理人",
|
||||
"title": "产品设计 / 全栈开发"
|
||||
}
|
||||
},
|
||||
"safety": {
|
||||
"submissions": "disabled",
|
||||
"customerRecords": "disabled",
|
||||
"contactActions": "disabled"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,9 @@
|
||||
"exports": {
|
||||
".": "./src/index.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@personal-brand/validation": "workspace:^"
|
||||
},
|
||||
"scripts": {
|
||||
"typecheck": "tsc -p tsconfig.json --noEmit",
|
||||
"test": "node --experimental-strip-types --test test/*.test.mjs"
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { validateTemplatePreviewFixtures } from "@personal-brand/validation";
|
||||
|
||||
export const TEMPLATE_RUNTIME_CONTRACT = "1.0" as const;
|
||||
|
||||
export type TemplatePageKey =
|
||||
@@ -158,12 +160,20 @@ export type TemplatePackageManifest = {
|
||||
admin: TemplateAdminManifest;
|
||||
trustContentTypes?: TemplateTrustContentType[];
|
||||
sampleContent?: Record<string, TemplateSampleContent>;
|
||||
previewFixture?: Record<string, unknown>;
|
||||
};
|
||||
|
||||
export function validateTemplatePackageManifest(value: unknown): string[] {
|
||||
const errors: string[] = [];
|
||||
if (!value || typeof value !== "object") return ["manifest must be an object"];
|
||||
const manifest = value as Partial<TemplatePackageManifest>;
|
||||
if (manifest.previewFixture !== undefined) {
|
||||
for (const issue of validateTemplatePreviewFixtures(
|
||||
manifest.previewFixture,
|
||||
manifest.supportedIndustryTemplates ?? [],
|
||||
))
|
||||
errors.push(`previewFixture.${issue.path}: ${issue.message}`);
|
||||
}
|
||||
if (!manifest.packageKey?.trim()) errors.push("packageKey is required");
|
||||
if (!manifest.version?.trim()) errors.push("version is required");
|
||||
if (manifest.runtimeContract !== TEMPLATE_RUNTIME_CONTRACT)
|
||||
|
||||
@@ -8,6 +8,45 @@ import { runtimeContractForBinding } from "../../types/src/runtime-content-contr
|
||||
|
||||
const packageRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../..");
|
||||
|
||||
test("independent preview fixtures validate safety and industry without changing bootstrap content", () => {
|
||||
const manifest = JSON.parse(
|
||||
fs.readFileSync(path.join(packageRoot, "template-atelier-solopreneur/template.json"), "utf8"),
|
||||
);
|
||||
assert.deepEqual(validateTemplatePackageManifest(manifest), []);
|
||||
assert.notEqual(
|
||||
manifest.previewFixture.personal.content.brandConfig.founder,
|
||||
manifest.sampleContent.personal.brandConfig.founder,
|
||||
);
|
||||
for (const mutate of [
|
||||
(value) => {
|
||||
value.previewFixture.personal.safety.submissions = "enabled";
|
||||
},
|
||||
(value) => {
|
||||
value.previewFixture.personal.brand.contactPhone = "13800000000";
|
||||
},
|
||||
(value) => {
|
||||
value.previewFixture.personal.content.fields = [null];
|
||||
},
|
||||
(value) => {
|
||||
value.previewFixture.personal.content.templateKey = "food";
|
||||
},
|
||||
(value) => {
|
||||
value.previewFixture = [];
|
||||
},
|
||||
(value) => {
|
||||
value.previewFixture.personal = null;
|
||||
},
|
||||
]) {
|
||||
const invalid = structuredClone(manifest);
|
||||
mutate(invalid);
|
||||
assert.ok(
|
||||
validateTemplatePackageManifest(invalid).some((message) =>
|
||||
message.startsWith("previewFixture"),
|
||||
),
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
for (const key of ["acheng-campus-food", "linjing-editorial"]) {
|
||||
test(`${key} declares valid admin content and asset requirements`, () => {
|
||||
const manifestPath = path.join(packageRoot, `template-${key}`, "template.json");
|
||||
|
||||
@@ -106,3 +106,90 @@ export function validateFieldSnapshot(value: unknown): ValidationIssue[] {
|
||||
export function validateOfferingConfig(value: unknown): ValidationIssue[] {
|
||||
return value === undefined || value === null ? [] : issues(offeringConfigSchema.safeParse(value));
|
||||
}
|
||||
|
||||
// 预览身份采用白名单,联系信息由预览运行时固定为空,不允许导入真实联系人。
|
||||
export const templatePreviewFixtureSchema = z
|
||||
.object({
|
||||
schemaVersion: z.literal("1"),
|
||||
brand: z
|
||||
.object({
|
||||
name: z.string().trim().min(1),
|
||||
tagline: z.string(),
|
||||
description: z.string(),
|
||||
avatarUrl: z.string().optional(),
|
||||
coverUrl: z.string().optional(),
|
||||
hours: z.string().optional(),
|
||||
address: z.string().optional(),
|
||||
deliveryNote: z.string().optional(),
|
||||
})
|
||||
.strict(),
|
||||
content: z
|
||||
.object({
|
||||
templateKey: z.string().min(1),
|
||||
brandConfig: z.record(z.unknown()).optional(),
|
||||
inquiryFormName: z.string().trim().min(1),
|
||||
capabilityKey: z.string().min(1),
|
||||
offerings: z.array(
|
||||
z
|
||||
.object({
|
||||
kind: z.enum(["service", "product", "package", "subscription"]),
|
||||
name: z.string().trim().min(1),
|
||||
summary: z.string(),
|
||||
categoryKey: z.string().min(1),
|
||||
coverUrl: z.string().optional(),
|
||||
priceText: z.string().optional(),
|
||||
config: z.record(z.unknown()).optional(),
|
||||
})
|
||||
.strict(),
|
||||
),
|
||||
trustContent: z.array(
|
||||
z
|
||||
.object({
|
||||
type: z.string().min(1),
|
||||
title: z.string(),
|
||||
content: z.string(),
|
||||
summary: z.string().optional(),
|
||||
config: z.record(z.unknown()).optional(),
|
||||
})
|
||||
.strict(),
|
||||
),
|
||||
fields: fieldSnapshotSchema,
|
||||
})
|
||||
.strict(),
|
||||
safety: z
|
||||
.object({
|
||||
submissions: z.literal("disabled"),
|
||||
customerRecords: z.literal("disabled"),
|
||||
contactActions: z.literal("disabled"),
|
||||
})
|
||||
.strict(),
|
||||
})
|
||||
.strict();
|
||||
|
||||
export function validateTemplatePreviewFixture(value: unknown): ValidationIssue[] {
|
||||
return issues(templatePreviewFixtureSchema.safeParse(value));
|
||||
}
|
||||
|
||||
export function validateTemplatePreviewFixtures(
|
||||
value: unknown,
|
||||
industries: readonly string[],
|
||||
): ValidationIssue[] {
|
||||
if (!value || typeof value !== "object" || Array.isArray(value))
|
||||
return [{ path: "", message: "must be an industry map" }];
|
||||
const fixtures = value as Record<string, unknown>;
|
||||
const result: ValidationIssue[] = [];
|
||||
for (const industry of new Set([...industries, ...Object.keys(fixtures)])) {
|
||||
if (!industries.includes(industry))
|
||||
result.push({ path: industry, message: "is not a supported industry template" });
|
||||
const fixture = templatePreviewFixtureSchema.safeParse(fixtures[industry]);
|
||||
result.push(
|
||||
...issues(fixture).map((issue) => ({
|
||||
path: `${industry}.${issue.path}`,
|
||||
message: issue.message,
|
||||
})),
|
||||
);
|
||||
if (fixture.success && fixture.data.content.templateKey !== industry)
|
||||
result.push({ path: `${industry}.content.templateKey`, message: "must match its key" });
|
||||
}
|
||||
return result;
|
||||
}
|
||||
Reference in new issue
Block a user