feat: 完成模板管理阶段4闭环
This commit is contained in:
1 parent
b1e8012ded
commit
d1958a7d7f
26 files changed
+1179
-310
No files matched your search
@@ -63,7 +63,14 @@ export interface TemplateMethods {
|
||||
supportedIndustryTemplates: BrandTemplateKey[];
|
||||
variants: Record<string, string>;
|
||||
} | null;
|
||||
installations: Array<{ id: string; templateKey: BrandTemplateKey; templateVersion: string }>;
|
||||
installations: Array<{
|
||||
id: string;
|
||||
templateKey: BrandTemplateKey;
|
||||
templateVersion: string;
|
||||
visualTemplateKey: string | null;
|
||||
templatePackageVersionId: string | null;
|
||||
contentChecksum: string | null;
|
||||
}>;
|
||||
fields: BrandFieldDefinition[];
|
||||
offerings: Offering[];
|
||||
forms: unknown[];
|
||||
@@ -71,7 +78,10 @@ export interface TemplateMethods {
|
||||
capabilities?: CapabilityWithMetadata[];
|
||||
}>;
|
||||
getAdminPreviewWorkspace(): Promise<RuntimeWorkspace>;
|
||||
installAdminTemplate(templateKey: BrandTemplateKey): Promise<unknown>;
|
||||
installAdminTemplate(
|
||||
templateKey: BrandTemplateKey,
|
||||
templatePackageVersionId?: string,
|
||||
): Promise<unknown>;
|
||||
listAdminCapabilities(): Promise<CapabilityWithMetadata[]>;
|
||||
updateAdminCapability(
|
||||
key: string,
|
||||
@@ -80,13 +90,48 @@ export interface TemplateMethods {
|
||||
config?: Record<string, unknown>;
|
||||
},
|
||||
): Promise<CapabilityWithMetadata>;
|
||||
previewAdminSampleContent(): Promise<{
|
||||
previewAdminSampleContent(params?: {
|
||||
templatePackageVersionId?: string;
|
||||
strategy?: "missing_only";
|
||||
}): Promise<{
|
||||
templateKey: string;
|
||||
visualTemplateKey: string;
|
||||
source: {
|
||||
kind: "package_version" | "registry";
|
||||
packageKey: string;
|
||||
version: string;
|
||||
contentChecksum: string | null;
|
||||
templatePackageVersionId?: string;
|
||||
};
|
||||
alreadyImported: boolean;
|
||||
counts: Record<string, number>;
|
||||
counts: Record<
|
||||
"brandConfig" | "offerings" | "trustContent" | "fields" | "inquiryForms",
|
||||
number
|
||||
>;
|
||||
skipped: Record<
|
||||
"brandConfig" | "offerings" | "trustContent" | "fields" | "inquiryForms",
|
||||
number
|
||||
>;
|
||||
willCreateInquiryForm: boolean;
|
||||
missingConfigKeys: string[];
|
||||
plan: Array<{ type: string; key: string; action: "create" | "skip" }>;
|
||||
}>;
|
||||
importAdminSampleContent(body: {
|
||||
templatePackageVersionId?: string;
|
||||
strategy: "missing_only";
|
||||
confirm: true;
|
||||
}): Promise<{
|
||||
imported: boolean;
|
||||
alreadyImported: boolean;
|
||||
source: {
|
||||
kind: "package_version" | "registry";
|
||||
packageKey: string;
|
||||
version: string;
|
||||
contentChecksum: string | null;
|
||||
templatePackageVersionId?: string;
|
||||
};
|
||||
counts: Record<string, number>;
|
||||
}>;
|
||||
importAdminSampleContent(): Promise<{ imported: boolean; counts: Record<string, number> }>;
|
||||
getAdminTemplateUpgradePreview(): Promise<{
|
||||
templateKey: BrandTemplateKey;
|
||||
currentVersion: string;
|
||||
@@ -276,17 +321,29 @@ export function templateMethods({ request }: { request: RequestFn }): TemplateMe
|
||||
),
|
||||
getAdminWorkspace: () => request("/admin/workspace"),
|
||||
getAdminPreviewWorkspace: () => request("/admin/workspace/preview"),
|
||||
installAdminTemplate: (templateKey) =>
|
||||
request("/admin/workspace/install", { method: "POST", body: { templateKey } }),
|
||||
installAdminTemplate: (templateKey, templatePackageVersionId) =>
|
||||
request("/admin/workspace/install", {
|
||||
method: "POST",
|
||||
body: { templateKey, ...(templatePackageVersionId ? { templatePackageVersionId } : {}) },
|
||||
}),
|
||||
listAdminCapabilities: () => request("/admin/workspace/capabilities"),
|
||||
updateAdminCapability: (key, body) =>
|
||||
request(`/admin/workspace/capabilities/${encodeURIComponent(key)}`, {
|
||||
method: "PATCH",
|
||||
body,
|
||||
}),
|
||||
previewAdminSampleContent: () => request("/admin/workspace/sample-content/preview"),
|
||||
importAdminSampleContent: () =>
|
||||
request("/admin/workspace/sample-content/import", { method: "POST" }),
|
||||
previewAdminSampleContent: (params) => {
|
||||
const query = [
|
||||
params?.templatePackageVersionId
|
||||
? `templatePackageVersionId=${encodeURIComponent(params.templatePackageVersionId)}`
|
||||
: "",
|
||||
params?.strategy ? `strategy=${encodeURIComponent(params.strategy)}` : "",
|
||||
].filter(Boolean);
|
||||
const suffix = query.length ? `?${query.join("&")}` : "";
|
||||
return request(`/admin/workspace/sample-content/preview${suffix}`);
|
||||
},
|
||||
importAdminSampleContent: (body) =>
|
||||
request("/admin/workspace/sample-content/import", { method: "POST", body }),
|
||||
getAdminTemplateUpgradePreview: () => request("/admin/workspace/template/preview"),
|
||||
upgradeAdminTemplate: () => request("/admin/workspace/template/upgrade", { method: "POST" }),
|
||||
rollbackAdminTemplate: () => request("/admin/workspace/template/rollback", { method: "POST" }),
|
||||
|
||||
Reference in new issue
Block a user