Files
persionalBrand/packages/config/src/template-package-manifest.ts
T
que01 4f0b50c7f1 fix: 收口模板契约与安全门禁
统一模板包 visual 契约并补齐完成证据;修复 release 版本一致性、管理员 token 撤销、CORS 与默认品牌配置;收敛依赖安全风险并完成全量回归验证。
2026-10-18 22:05:31 +08:00

154 lines
4.2 KiB
TypeScript

import type { TemplateVisualPresentation } from "@personal-brand/template-contract";
import type { BrandTemplateKey } from "./template-keys.js";
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;
displayName: string;
visualTemplateKey: VisualTemplateKey;
visualPresentation: TemplateVisualPresentation;
runtimeContract: "1.0";
supportedIndustryTemplates: readonly BrandTemplateKey[];
entrypoints: Readonly<Record<string, string>>;
requiredCapabilities: readonly CapabilityKey[];
defaultBrandSlug: string;
navigation: readonly {
key: string;
label: string;
page: string;
iconPath?: string;
selectedIconPath?: string;
}[];
renderers?: Readonly<Record<string, string>>;
runtimeOwnedPages?: readonly string[];
dataSlots: readonly {
key: string;
source: string;
required: boolean;
description: string;
}[];
templateFields?: readonly {
key: string;
page?: string;
binding?: string;
label: string;
help?: string;
input: string;
itemFields?: readonly { key: string; label: string; input?: string; required?: boolean }[];
itemValueKey?: string;
required?: boolean;
maxLength?: number;
previewTarget?: string;
placeholder?: string;
options?: readonly { value: string; label: string }[];
}[];
assetSlots: readonly {
key: string;
binding: string;
target: "brand" | "offering" | "trust";
label: string;
help: string;
required: boolean;
kind?: string;
aspectRatio?: string;
}[];
inquiryFormFields?: readonly {
key: string;
label: string;
type: string;
required: boolean;
placeholder?: string;
options?: readonly { label: string; value: string }[];
}[];
pages: readonly string[];
admin: {
sections: readonly {
key: string;
title: string;
description: string;
page: string;
target: "brand" | "offering" | "trust" | "inquiry";
previewTargets?: readonly {
key: string;
label: string;
composite?: boolean;
children?: readonly string[];
}[];
fields: readonly {
key: string;
binding: string;
label: string;
input: string;
help?: string;
required?: boolean;
itemFields?: readonly { key: string; label: string; input?: string; required?: boolean }[];
kind?: string;
itemValueKey?: string;
maxLength?: number;
placeholder?: string;
previewTarget?: string;
options?: readonly { value: string; label: string }[];
}[];
}[];
};
trustContentTypes?: readonly {
type: string;
label: string;
adminFields: {
title: string;
summary: string;
content: string;
summaryHelp?: string;
summaryPlaceholder?: string;
};
help?: string;
placeholder?: string;
previewTargets?: readonly {
key: string;
label: string;
page?: string;
}[];
required?: boolean;
maxPublishedItems?: number;
hideStandardFields?: readonly ("summary" | "content")[];
pages?: readonly string[];
configFields?: readonly {
key: string;
binding: string;
label: string;
input: string;
itemFields?: readonly { key: string; label: string; input?: string; required?: boolean }[];
itemValueKey?: string;
placeholder?: string;
previewTarget?: string;
required?: boolean;
}[];
}[];
overrides?: readonly string[];
sampleContent?: Partial<Record<BrandTemplateKey, TemplateSampleContent>>;
previewFixture: Readonly<Partial<Record<BrandTemplateKey, TemplatePreviewFixture>>>;
}