dsh-ppt 0.34.0 → 0.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -0
- package/README.en.md +14 -17
- package/README.md +14 -17
- package/docs/USAGE.en.md +44 -35
- package/docs/USAGE.md +45 -36
- package/docs/VALIDATION.md +4 -0
- package/docs/assets/intro/screen-en.webp +0 -0
- package/docs/assets/intro/screen-zh.webp +0 -0
- package/docs/assets/intro/workflow-en-dark.svg +1 -1
- package/docs/assets/intro/workflow-en-light.svg +1 -1
- package/docs/assets/intro/workflow-en-mobile-dark.svg +1 -1
- package/docs/assets/intro/workflow-en-mobile-light.svg +1 -1
- package/docs/assets/intro/workflow-zh-dark.svg +1 -1
- package/docs/assets/intro/workflow-zh-light.svg +1 -1
- package/docs/assets/intro/workflow-zh-mobile-dark.svg +1 -1
- package/docs/assets/intro/workflow-zh-mobile-light.svg +1 -1
- package/lib/client.js +333 -45
- package/lib/execution.js +20 -2
- package/lib/tools.js +64 -2
- package/lib/types.d.ts +58 -1
- package/lib/workbench.js +18 -2
- package/package.json +2 -2
- package/skills/dsh-ppt/SKILL.md +34 -32
- package/skills/dsh-ppt/package.json +1 -1
- package/skills/dsh-ppt/references/office-pack.md +124 -0
- package/skills/dsh-ppt/references/research-plan.md +93 -62
- package/skills/dsh-ppt/scripts/build-deck.mjs +60 -2
- package/skills/dsh-ppt/scripts/deck-absorb.mjs +2 -0
- package/skills/dsh-ppt/scripts/deck-advanced.mjs +198 -29
- package/skills/dsh-ppt/scripts/deck-brand-kit.mjs +13 -0
- package/skills/dsh-ppt/scripts/deck-charts-exec.mjs +805 -0
- package/skills/dsh-ppt/scripts/deck-chrome.mjs +10 -1
- package/skills/dsh-ppt/scripts/deck-compose.mjs +386 -0
- package/skills/dsh-ppt/scripts/deck-core.mjs +128 -14
- package/skills/dsh-ppt/scripts/deck-delivery.mjs +141 -3
- package/skills/dsh-ppt/scripts/deck-evidence.mjs +811 -118
- package/skills/dsh-ppt/scripts/deck-export.mjs +652 -0
- package/skills/dsh-ppt/scripts/deck-i18n.mjs +170 -0
- package/skills/dsh-ppt/scripts/deck-layouts.mjs +72 -8
- package/skills/dsh-ppt/scripts/deck-office.mjs +833 -38
|
@@ -17,7 +17,7 @@ import { resolve as resolvePath } from 'node:path'
|
|
|
17
17
|
import { pathToFileURL } from 'node:url'
|
|
18
18
|
import { listThemes, THEME_IDS, DEFAULT_THEME } from './deck-themes.mjs'
|
|
19
19
|
import { CHROME_STYLE_IDS } from './deck-absorb.mjs'
|
|
20
|
-
import { buildDeckAsync, listTemplates, editDeck, remixDeck, undoDeck, checkDeckAsync, renderDeck, absorbPptx, importPptxDeck, importOfficeDeck, listAllTasteRecipes, listCuratedExemplars, loadWorkspaceExemplars, ingestExemplarCorpus, buildResearchPlan, saveWorkspaceBrandKit, loadWorkspaceBrandKit } from './deck-advanced.mjs'
|
|
20
|
+
import { buildDeckAsync, listTemplates, editDeck, remixDeck, undoDeck, checkDeckAsync, renderDeck, absorbPptx, importPptxDeck, importOfficeDeck, listAllTasteRecipes, listCuratedExemplars, loadWorkspaceExemplars, ingestExemplarCorpus, buildResearchPlan, saveWorkspaceBrandKit, loadWorkspaceBrandKit, listSlideBank, mergeDecks } from './deck-advanced.mjs'
|
|
21
21
|
|
|
22
22
|
const HELP = `dsh-ppt —— 一句话 / 一篇文档 → HTML 放映 + PPTX 导出
|
|
23
23
|
|
|
@@ -47,6 +47,17 @@ const HELP = `dsh-ppt —— 一句话 / 一篇文档 → HTML 放映 + PPTX 导
|
|
|
47
47
|
--absorb <deck.pptx> 只读检查并输出参考 .pptx 的净化主题、推荐内置主题/骨架、深度审美配方 styleRecipe 与逐页分布 JSON
|
|
48
48
|
--import-pptx <path> 导入外部 .pptx 全量内容(标题/要点/表格/图表/图片/备注)并一键翻新为 dsh-ppt 工程
|
|
49
49
|
--from-office <path> 直吞 .xlsx / .csv / .tsv / .docx / .pdf 或本地混合素材目录,自动画像并生成全套文稿(多文件自动生成证据溯源账本)
|
|
50
|
+
--inspect-only 配合 --from-office 使用:仅输出精炼素材档案与 Mode C 权威外源补充检索计划(不直接出稿)
|
|
51
|
+
--instructions <text> 配合 --from-office 使用:自然语言呈现要求(如 "控制8页,跳过目录,product.png放封面")
|
|
52
|
+
--bind-data 配合 --from-office 使用:自动把 Excel 数值工作表绑定进 dataModel 供后续 ppt_data 实时刷新
|
|
53
|
+
--export <list> 可选附加导出(逗号分隔):xlsx,docx,qa-prep,memo,i18n,handout,one-pager,social-carousel,subtitles
|
|
54
|
+
--merge <json|@path> 跨工程拼装器:传入 sources[](deckPath + slides 或 bankIds)自动去重资产与重映射 [E#] 证据
|
|
55
|
+
--save-to-bank <slide> 配合 --edit 将指定页码/ID 收藏至 .dsh-ppt/slide-bank.json 企业金页库
|
|
56
|
+
--list-bank 列出 .dsh-ppt/slide-bank.json 已收藏金页
|
|
57
|
+
--translate <json|@path> 配合 --edit 无损应用翻译包(保持 100% 原版式/图表/图片)
|
|
58
|
+
--bilingual 配合 --translate 输出中英双语对照版
|
|
59
|
+
--feedback <path> 配合 --check 读取 HTML 按 R 导出的 review-feedback.json 审阅批注
|
|
60
|
+
--motion-profile <id> 动效档位:subtle / executive / keynote
|
|
50
61
|
--sync-pptx <path> 将 Office 修改后的 .pptx 内容回导同步至已有工程(自动写入 .history/ 支持撤销)
|
|
51
62
|
--target-project <dir> 配合 --sync-pptx 指定目标工程目录(或传 --edit <deck.json>)
|
|
52
63
|
--preserve-theme 配合 --import-pptx 使用,保留原 .pptx 净化后的品牌配色与 Logo
|
|
@@ -135,6 +146,17 @@ export function parseArgv(argv) {
|
|
|
135
146
|
else if (key === '--absorb') args.absorb = nextValue()
|
|
136
147
|
else if (key === '--import-pptx') args.importPptx = nextValue()
|
|
137
148
|
else if (key === '--from-office') args.fromOffice = nextValue()
|
|
149
|
+
else if (key === '--inspect-only') args.inspectOnly = true
|
|
150
|
+
else if (key === '--instructions') args.instructions = nextValue()
|
|
151
|
+
else if (key === '--bind-data') args.bindData = true
|
|
152
|
+
else if (key === '--export') args.exports = nextValue().split(',').map(s => s.trim()).filter(Boolean)
|
|
153
|
+
else if (key === '--merge') args.merge = readJson(nextValue())
|
|
154
|
+
else if (key === '--save-to-bank') args.saveToBank = nextValue()
|
|
155
|
+
else if (key === '--list-bank') args.listBank = true
|
|
156
|
+
else if (key === '--translate') args.translate = readJson(nextValue())
|
|
157
|
+
else if (key === '--bilingual') args.bilingual = true
|
|
158
|
+
else if (key === '--feedback') args.feedback = nextValue()
|
|
159
|
+
else if (key === '--motion-profile') args.motionProfile = nextValue()
|
|
138
160
|
else if (key === '--sync-pptx') args.syncPptx = nextValue()
|
|
139
161
|
else if (key === '--target-project') args.targetProject = nextValue()
|
|
140
162
|
else if (key === '--preserve-theme') args.preserveTheme = true
|
|
@@ -209,7 +231,9 @@ export async function main(argv = process.argv.slice(2), io = {}) {
|
|
|
209
231
|
if (args.listTemplates) { log(JSON.stringify({ templates: listTemplates(args.lang) }, null, 2)); return 0 }
|
|
210
232
|
if (args.listTastes) { log(JSON.stringify({ tasteRecipes: listAllTasteRecipes(process.cwd()) }, null, 2)); return 0 }
|
|
211
233
|
if (args.listExemplars) { log(JSON.stringify({ exemplars: listCuratedExemplars(loadWorkspaceExemplars(process.cwd())) }, null, 2)); return 0 }
|
|
234
|
+
if (args.listBank) { log(JSON.stringify(listSlideBank(process.cwd()), null, 2)); return 0 }
|
|
212
235
|
if (args.plan) {
|
|
236
|
+
const kit = loadWorkspaceBrandKit(process.cwd())
|
|
213
237
|
const plan = buildResearchPlan({
|
|
214
238
|
topic: args.plan,
|
|
215
239
|
persona: args.persona,
|
|
@@ -217,10 +241,29 @@ export async function main(argv = process.argv.slice(2), io = {}) {
|
|
|
217
241
|
evidence: args.evidence,
|
|
218
242
|
lang: args.lang,
|
|
219
243
|
workspaceExemplars: loadWorkspaceExemplars(process.cwd()),
|
|
244
|
+
preferredSources: kit?.preferredSources,
|
|
245
|
+
blockedDomains: kit?.blockedDomains,
|
|
220
246
|
})
|
|
221
247
|
log(JSON.stringify(plan, null, 2))
|
|
222
248
|
return 0
|
|
223
249
|
}
|
|
250
|
+
if (args.merge) {
|
|
251
|
+
const merged = await mergeDecks({
|
|
252
|
+
sources: Array.isArray(args.merge) ? args.merge : args.merge.sources,
|
|
253
|
+
title: args.title || undefined,
|
|
254
|
+
theme: args.theme,
|
|
255
|
+
lang: args.lang,
|
|
256
|
+
motion: args.motion,
|
|
257
|
+
motionProfile: args.motionProfile,
|
|
258
|
+
outputDir: resolvePath(args.out || '.'),
|
|
259
|
+
fileName: args.file || undefined,
|
|
260
|
+
overwrite: args.overwrite === true,
|
|
261
|
+
exports: args.exports,
|
|
262
|
+
cwd: process.cwd(),
|
|
263
|
+
})
|
|
264
|
+
log(JSON.stringify(merged, null, 2))
|
|
265
|
+
return 0
|
|
266
|
+
}
|
|
224
267
|
if (args.ingestExemplars) {
|
|
225
268
|
const report = await ingestExemplarCorpus({ dirPath: args.ingestExemplars, cwd: process.cwd() })
|
|
226
269
|
log(JSON.stringify(report, null, 2))
|
|
@@ -258,6 +301,12 @@ export async function main(argv = process.argv.slice(2), io = {}) {
|
|
|
258
301
|
...(args.chrome ? { chromeStyle: args.chrome } : {}),
|
|
259
302
|
...(args.lang ? { lang: args.lang } : {}),
|
|
260
303
|
...(args.motion ? { motion: args.motion } : {}),
|
|
304
|
+
...(args.motionProfile ? { motionProfile: args.motionProfile } : {}),
|
|
305
|
+
...(args.inspectOnly ? { inspectOnly: true } : {}),
|
|
306
|
+
...(args.instructions ? { instructions: args.instructions } : {}),
|
|
307
|
+
...(args.bindData ? { bindDataModel: true } : {}),
|
|
308
|
+
...(args.evidence !== undefined ? { evidence: args.evidence } : {}),
|
|
309
|
+
...(args.exports ? { exports: args.exports } : {}),
|
|
261
310
|
...(args.targetMinutes !== undefined ? { targetMinutes: args.targetMinutes } : {}),
|
|
262
311
|
overwrite: args.overwrite === true,
|
|
263
312
|
handout: args.handout === true,
|
|
@@ -304,7 +353,7 @@ export async function main(argv = process.argv.slice(2), io = {}) {
|
|
|
304
353
|
return 0
|
|
305
354
|
}
|
|
306
355
|
if (args.check) {
|
|
307
|
-
const report = await checkDeckAsync({ deckPath: args.check, renderReceipt: args.renderReceipt })
|
|
356
|
+
const report = await checkDeckAsync({ deckPath: args.check, renderReceipt: args.renderReceipt, ...(args.feedback ? { feedbackPath: args.feedback } : {}) })
|
|
308
357
|
log(JSON.stringify(report, null, 2)); return report.ok && (args.renderReceipt === undefined || report.render?.status === 'rendered') ? 0 : 1
|
|
309
358
|
}
|
|
310
359
|
if (args.render) {
|
|
@@ -316,6 +365,9 @@ export async function main(argv = process.argv.slice(2), io = {}) {
|
|
|
316
365
|
: args.brand
|
|
317
366
|
|
|
318
367
|
if (args.edit || args.undo) {
|
|
368
|
+
const bankSlideRef = args.saveToBank !== undefined
|
|
369
|
+
? (/^\d+$/.test(String(args.saveToBank)) ? Number(args.saveToBank) : String(args.saveToBank))
|
|
370
|
+
: undefined
|
|
319
371
|
const result = args.edit
|
|
320
372
|
? await editDeck({
|
|
321
373
|
deckPath: args.edit,
|
|
@@ -324,6 +376,10 @@ export async function main(argv = process.argv.slice(2), io = {}) {
|
|
|
324
376
|
...(args.taste ? { taste: args.taste } : {}),
|
|
325
377
|
referencePptx: args.referencePptx,
|
|
326
378
|
brand: effectiveBrand,
|
|
379
|
+
...(args.motionProfile ? { motionProfile: args.motionProfile } : {}),
|
|
380
|
+
...(bankSlideRef !== undefined ? { saveToBank: { slide: bankSlideRef } } : {}),
|
|
381
|
+
...(args.translate !== undefined ? { translations: args.translate, bilingualMode: args.bilingual === true } : {}),
|
|
382
|
+
...(args.exports ? { exports: args.exports } : {}),
|
|
327
383
|
...(args.targetMinutes !== undefined ? { targetMinutes: args.targetMinutes } : {}),
|
|
328
384
|
expectedRevision: args.revision,
|
|
329
385
|
})
|
|
@@ -360,6 +416,8 @@ export async function main(argv = process.argv.slice(2), io = {}) {
|
|
|
360
416
|
smartLayout: args.smartLayout,
|
|
361
417
|
lang: args.lang,
|
|
362
418
|
motion: args.motion,
|
|
419
|
+
...(args.motionProfile ? { motionProfile: args.motionProfile } : {}),
|
|
420
|
+
...(args.exports ? { exports: args.exports } : {}),
|
|
363
421
|
outputDir: resolvePath(args.out || '.'),
|
|
364
422
|
fileName: args.file,
|
|
365
423
|
overwrite: args.overwrite,
|
|
@@ -1493,6 +1493,8 @@ export async function absorbPptx(options = {}) {
|
|
|
1493
1493
|
watermark: options.watermark || bkOpts.watermark,
|
|
1494
1494
|
footer: options.footer || bkOpts.footer,
|
|
1495
1495
|
forbiddenTerms: Array.isArray(options.forbiddenTerms) ? options.forbiddenTerms : bkOpts.forbiddenTerms,
|
|
1496
|
+
preferredSources: Array.isArray(options.preferredSources) ? options.preferredSources : bkOpts.preferredSources,
|
|
1497
|
+
blockedDomains: Array.isArray(options.blockedDomains) ? options.blockedDomains : bkOpts.blockedDomains,
|
|
1496
1498
|
mandatoryClosing: options.mandatoryClosing || bkOpts.mandatoryClosing,
|
|
1497
1499
|
})
|
|
1498
1500
|
const savedBk = saveWorkspaceBrandKit(cwd, builtKit)
|
|
@@ -39,7 +39,22 @@ import {
|
|
|
39
39
|
renderExemplarPromptGuide,
|
|
40
40
|
} from './deck-exemplars.mjs'
|
|
41
41
|
import { upgradeWeakDeck, resequenceSlidesToExemplar, selfRepairDeck, synthesizeActionTitle } from './deck-upgrader.mjs'
|
|
42
|
-
import {
|
|
42
|
+
import {
|
|
43
|
+
normalizeEvidenceLedger,
|
|
44
|
+
applyEvidenceLedgerToSlides,
|
|
45
|
+
auditEvidenceAndSourcing,
|
|
46
|
+
buildResearchPlan,
|
|
47
|
+
AUTHORITATIVE_DOMAINS,
|
|
48
|
+
NOISE_DOMAINS,
|
|
49
|
+
detectResearchDomain,
|
|
50
|
+
buildAuthoritativeQueryPack,
|
|
51
|
+
classifySourceAuthority,
|
|
52
|
+
buildHybridEnrichmentPlan,
|
|
53
|
+
mergeHybridEvidence,
|
|
54
|
+
} from './deck-evidence.mjs'
|
|
55
|
+
import { renderDeckWorkbookXlsx, renderDeckReportDocx, renderDeckMemoMarkdown, renderQaPrepMarkdown } from './deck-export.mjs'
|
|
56
|
+
import { slideBankPathFor, loadSlideBank, saveSlideToBank, listSlideBank, removeBankSlide, mergeDecks } from './deck-compose.mjs'
|
|
57
|
+
import { extractTranslationBundle, applyTranslationBundle } from './deck-i18n.mjs'
|
|
43
58
|
import { computeMapModel, computeIsometricModel, generateVisualBrief, normalizeImageBrief } from './deck-infographics.mjs'
|
|
44
59
|
import {
|
|
45
60
|
normalizeBrandKit,
|
|
@@ -58,7 +73,7 @@ export { absorbPptx } from './deck-absorb.mjs'
|
|
|
58
73
|
export { extractPptxSlides } from './deck-import.mjs'
|
|
59
74
|
export { renderHandoutMarkdown, computePaceBudget, renderOnePagerHtml, renderSubtitlesSrt, renderSubtitlesVtt } from './deck-delivery.mjs'
|
|
60
75
|
export { REMIX_PRESETS, REMIX_PRESET_IDS, remixSlides, renderSocialCarouselHtml } from './deck-remix.mjs'
|
|
61
|
-
export { extractOfficeSource, importOfficeDeck } from './deck-office.mjs'
|
|
76
|
+
export { extractOfficeSource, importOfficeDeck, inspectLocalImage, inspectImageBytes, inspectOfficePack } from './deck-office.mjs'
|
|
62
77
|
export { inferThemeFromContent, optimizeVisualRhythm } from './deck-director.mjs'
|
|
63
78
|
export { listAllTasteRecipes, listCuratedTasteRecipes, loadWorkspaceTasteRecipes, saveWorkspaceTasteRecipe, resolveTasteRecipe } from './deck-taste.mjs'
|
|
64
79
|
export {
|
|
@@ -76,7 +91,23 @@ export {
|
|
|
76
91
|
renderExemplarPromptGuide,
|
|
77
92
|
} from './deck-exemplars.mjs'
|
|
78
93
|
export { upgradeWeakDeck, resequenceSlidesToExemplar, selfRepairDeck, synthesizeActionTitle } from './deck-upgrader.mjs'
|
|
79
|
-
export {
|
|
94
|
+
export {
|
|
95
|
+
normalizeEvidenceLedger,
|
|
96
|
+
applyEvidenceLedgerToSlides,
|
|
97
|
+
auditEvidenceAndSourcing,
|
|
98
|
+
buildResearchPlan,
|
|
99
|
+
AUTHORITATIVE_DOMAINS,
|
|
100
|
+
NOISE_DOMAINS,
|
|
101
|
+
detectResearchDomain,
|
|
102
|
+
buildAuthoritativeQueryPack,
|
|
103
|
+
classifySourceAuthority,
|
|
104
|
+
buildHybridEnrichmentPlan,
|
|
105
|
+
mergeHybridEvidence,
|
|
106
|
+
} from './deck-evidence.mjs'
|
|
107
|
+
export { renderDeckWorkbookXlsx, renderDeckReportDocx, renderDeckMemoMarkdown, renderQaPrepMarkdown } from './deck-export.mjs'
|
|
108
|
+
export { slideBankPathFor, loadSlideBank, saveSlideToBank, listSlideBank, removeBankSlide, mergeDecks } from './deck-compose.mjs'
|
|
109
|
+
export { extractTranslationBundle, applyTranslationBundle } from './deck-i18n.mjs'
|
|
110
|
+
export { EXEC_CHART_LAYOUTS, computeIssueTreeModel, computeTreemapModel, computeGaugeModel, computePricingModel } from './deck-charts-exec.mjs'
|
|
80
111
|
export { computeMapModel, computeIsometricModel, generateVisualBrief, normalizeImageBrief } from './deck-infographics.mjs'
|
|
81
112
|
export {
|
|
82
113
|
normalizeBrandKit,
|
|
@@ -298,7 +329,7 @@ function validateRawSlides(slides) {
|
|
|
298
329
|
}
|
|
299
330
|
|
|
300
331
|
function snapshot(manifest) {
|
|
301
|
-
return clone(Object.fromEntries(['title', 'theme', 'language', 'motion', 'slides', 'brand', 'brandKit', 'template', 'dataModel', 'evidence', 'targetMinutes', 'taste'].filter(k => manifest[k] !== undefined).map(k => [k, manifest[k]])))
|
|
332
|
+
return clone(Object.fromEntries(['title', 'theme', 'language', 'motion', 'motionProfile', 'slides', 'brand', 'brandKit', 'template', 'dataModel', 'evidence', 'targetMinutes', 'taste'].filter(k => manifest[k] !== undefined).map(k => [k, manifest[k]])))
|
|
302
333
|
}
|
|
303
334
|
|
|
304
335
|
function collectAssets(manifest) {
|
|
@@ -367,8 +398,10 @@ export function checkManifest(manifest) {
|
|
|
367
398
|
issue(i, 'template-unfilled', '模板中还有待填写内容', '提供实际事实、依据和行动,填完后重新检查')
|
|
368
399
|
}
|
|
369
400
|
if (slide.layout === 'table') {
|
|
370
|
-
|
|
371
|
-
if (
|
|
401
|
+
const colCount = slide.rows?.[0]?.length ?? 0
|
|
402
|
+
if (colCount > 6) issue(i, 'small-font', '表格超过 6 列,使用较小字号,小屏放映可能难以阅读', '减少列数或把重点数据改成图表,导出后检查可读性')
|
|
403
|
+
const cellLimit = colCount <= 4 && slide.tableStyle === 'booktabs' ? 24 : 18
|
|
404
|
+
if (slide.rows?.some(row => row.some(c => textWidth(c) > cellLimit))) issue(i, 'table-density', '表格单元格文字较长,可能换行拥挤', '精简单元格或减少列数')
|
|
372
405
|
}
|
|
373
406
|
const boxes = MEDIA_LAYOUTS.has(slide.layout) ? mediaBoxes(slide.layout, slide.variant, slide) : null
|
|
374
407
|
if (Array.isArray(boxes?.gallery) && Array.isArray(slide.images) && slide.images.length > 1) {
|
|
@@ -567,6 +600,34 @@ function documentBytes(manifest) {
|
|
|
567
600
|
if (Buffer.byteLength(text) > MAX_DOCUMENT) fail('JSON 工程含历史超过 64 MiB,请缩减图片或清理历史后另存工程')
|
|
568
601
|
return text
|
|
569
602
|
}
|
|
603
|
+
const ALLOWED_EXPORT_KINDS = new Set(['xlsx', 'docx', 'qa-prep', 'memo', 'social-carousel', 'subtitles', 'handout', 'one-pager', 'i18n'])
|
|
604
|
+
|
|
605
|
+
function parseExportOptions(options = {}) {
|
|
606
|
+
const list = Array.isArray(options.exports)
|
|
607
|
+
? options.exports.map(x => String(x ?? '').trim().toLowerCase()).filter(Boolean)
|
|
608
|
+
: []
|
|
609
|
+
for (const kind of list) {
|
|
610
|
+
if (!ALLOWED_EXPORT_KINDS.has(kind)) {
|
|
611
|
+
fail('未知导出格式 exports:' + kind + '(支持 ' + [...ALLOWED_EXPORT_KINDS].join(' / ') + ')')
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
const set = new Set(list)
|
|
615
|
+
return {
|
|
616
|
+
writeHandout: options.handout === true || set.has('handout'),
|
|
617
|
+
writeOnePager: options.onePager === true || set.has('one-pager'),
|
|
618
|
+
writeCarousel: Boolean(options.socialCarousel) || set.has('social-carousel'),
|
|
619
|
+
carouselRatio: options.socialCarousel === '1:1' ? '1:1' : '4:5',
|
|
620
|
+
writeSubtitles: Boolean(options.subtitles) || set.has('subtitles'),
|
|
621
|
+
subtitlesFormat: options.subtitles === 'vtt' ? 'vtt' : 'srt',
|
|
622
|
+
writeXlsx: set.has('xlsx'),
|
|
623
|
+
writeDocx: set.has('docx'),
|
|
624
|
+
writeMemo: set.has('memo'),
|
|
625
|
+
writeQaPrep: set.has('qa-prep'),
|
|
626
|
+
writeI18n: set.has('i18n'),
|
|
627
|
+
hasAnyExtra: set.size > 0 || options.handout === true || options.onePager === true || Boolean(options.socialCarousel) || Boolean(options.subtitles),
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
|
|
570
631
|
function result(manifest, paths, writeHandout = false, writeOnePager = false, extra = {}) {
|
|
571
632
|
const base = paths.json.slice(0, -5)
|
|
572
633
|
const handoutPath = base + '.handout.md'
|
|
@@ -574,6 +635,11 @@ function result(manifest, paths, writeHandout = false, writeOnePager = false, ex
|
|
|
574
635
|
const carouselPath = base + '.carousel.html'
|
|
575
636
|
const subtitlesExt = extra.subtitlesFormat === 'vtt' ? '.vtt' : '.srt'
|
|
576
637
|
const subtitlesPath = base + subtitlesExt
|
|
638
|
+
const xlsxPath = base + '.xlsx'
|
|
639
|
+
const docxPath = base + '.docx'
|
|
640
|
+
const memoPath = base + '.memo.md'
|
|
641
|
+
const qaPrepPath = base + '.qa-prep.md'
|
|
642
|
+
const i18nPath = base + '.i18n.json'
|
|
577
643
|
const paceBudget = computePaceBudget(manifest)
|
|
578
644
|
return { ok: true, title: manifest.title, theme: manifest.theme, language: manifest.language,
|
|
579
645
|
slideCount: manifest.slides.length, deckId: manifest.deckId, revision: manifest.revision,
|
|
@@ -587,7 +653,12 @@ function result(manifest, paths, writeHandout = false, writeOnePager = false, ex
|
|
|
587
653
|
...(writeHandout ? { handoutPath } : {}),
|
|
588
654
|
...(writeOnePager ? { onePagerPath } : {}),
|
|
589
655
|
...(extra.writeCarousel ? { carouselPath } : {}),
|
|
590
|
-
...(extra.writeSubtitles ? { subtitlesPath } : {})
|
|
656
|
+
...(extra.writeSubtitles ? { subtitlesPath } : {}),
|
|
657
|
+
...(extra.writeXlsx ? { xlsxPath } : {}),
|
|
658
|
+
...(extra.writeDocx ? { docxPath } : {}),
|
|
659
|
+
...(extra.writeMemo ? { memoPath } : {}),
|
|
660
|
+
...(extra.writeQaPrep ? { qaPrepPath } : {}),
|
|
661
|
+
...(extra.writeI18n ? { i18nPath } : {}) }
|
|
591
662
|
}
|
|
592
663
|
function pathsFor(jsonPath) {
|
|
593
664
|
const base = jsonPath.slice(0, -5)
|
|
@@ -651,6 +722,21 @@ function commit(paths, data, writeHandout = false, writeOnePager = false, extra
|
|
|
651
722
|
: renderSubtitlesSrt(data.manifest, data.language.id)
|
|
652
723
|
artifacts.push({ path: subtitlesPath, data: subData, encoding: 'utf8' })
|
|
653
724
|
}
|
|
725
|
+
if (extra.writeXlsx) {
|
|
726
|
+
artifacts.push({ path: base + '.xlsx', data: renderDeckWorkbookXlsx(data.manifest) })
|
|
727
|
+
}
|
|
728
|
+
if (extra.writeDocx) {
|
|
729
|
+
artifacts.push({ path: base + '.docx', data: renderDeckReportDocx(data.manifest, data.language.id) })
|
|
730
|
+
}
|
|
731
|
+
if (extra.writeMemo) {
|
|
732
|
+
artifacts.push({ path: base + '.memo.md', data: renderDeckMemoMarkdown(data.manifest, data.language.id), encoding: 'utf8' })
|
|
733
|
+
}
|
|
734
|
+
if (extra.writeQaPrep) {
|
|
735
|
+
artifacts.push({ path: base + '.qa-prep.md', data: renderQaPrepMarkdown(data.manifest, data.language.id), encoding: 'utf8' })
|
|
736
|
+
}
|
|
737
|
+
if (extra.writeI18n) {
|
|
738
|
+
artifacts.push({ path: base + '.i18n.json', data: JSON.stringify(extractTranslationBundle(data.manifest), null, 2) + '\n', encoding: 'utf8' })
|
|
739
|
+
}
|
|
654
740
|
commitDeckArtifacts(artifacts)
|
|
655
741
|
}
|
|
656
742
|
|
|
@@ -746,6 +832,9 @@ function mapSlidesToAbsorbedSkeleton(slides, slideSkeleton, langId) {
|
|
|
746
832
|
|
|
747
833
|
export async function buildDeckAsync(options = {}) {
|
|
748
834
|
abort(options.signal)
|
|
835
|
+
if (Array.isArray(options.mergeSources) && options.mergeSources.length > 0) {
|
|
836
|
+
return mergeDecks({ ...options, sources: options.mergeSources })
|
|
837
|
+
}
|
|
749
838
|
validateRawSlides(options.slides)
|
|
750
839
|
const cwd = resolve(options.cwd || '.')
|
|
751
840
|
const scenario = options.template ? findScenarioTemplate(options.template) : undefined
|
|
@@ -862,7 +951,10 @@ export async function buildDeckAsync(options = {}) {
|
|
|
862
951
|
normalized.deck.slides = optimizeVisualRhythm(normalized.deck.slides, resolvedTaste)
|
|
863
952
|
}
|
|
864
953
|
|
|
865
|
-
const evidence = normalizeEvidenceLedger(options.evidence
|
|
954
|
+
const evidence = normalizeEvidenceLedger(options.evidence, {
|
|
955
|
+
preferredSources: activeBrandKit?.preferredSources,
|
|
956
|
+
blockedDomains: activeBrandKit?.blockedDomains,
|
|
957
|
+
})
|
|
866
958
|
if (evidence.length > 0) {
|
|
867
959
|
const appliedEvidence = applyEvidenceLedgerToSlides(normalized.deck.slides, evidence, {
|
|
868
960
|
lang: langId,
|
|
@@ -916,6 +1008,8 @@ export async function buildDeckAsync(options = {}) {
|
|
|
916
1008
|
...(activeBrandKit.watermark ? { watermark: activeBrandKit.watermark } : {}),
|
|
917
1009
|
...(activeBrandKit.brand?.primaryColor ? { brand: { primaryColor: activeBrandKit.brand.primaryColor } } : {}),
|
|
918
1010
|
...(Array.isArray(activeBrandKit.forbiddenTerms) && activeBrandKit.forbiddenTerms.length > 0 ? { forbiddenTerms: activeBrandKit.forbiddenTerms } : {}),
|
|
1011
|
+
...(Array.isArray(activeBrandKit.preferredSources) && activeBrandKit.preferredSources.length > 0 ? { preferredSources: activeBrandKit.preferredSources } : {}),
|
|
1012
|
+
...(Array.isArray(activeBrandKit.blockedDomains) && activeBrandKit.blockedDomains.length > 0 ? { blockedDomains: activeBrandKit.blockedDomains } : {}),
|
|
919
1013
|
}
|
|
920
1014
|
: undefined
|
|
921
1015
|
|
|
@@ -935,6 +1029,7 @@ export async function buildDeckAsync(options = {}) {
|
|
|
935
1029
|
theme: normalized.theme.id,
|
|
936
1030
|
language: normalized.language.id,
|
|
937
1031
|
motion: normalized.motion,
|
|
1032
|
+
...(normalized.motionProfile ? { motionProfile: normalized.motionProfile } : {}),
|
|
938
1033
|
...(resolvedTaste ? { taste: listCuratedTasteRecipes().some(r => r.id === resolvedTaste.id) ? resolvedTaste.id : resolvedTaste } : {}),
|
|
939
1034
|
...(resolvedExemplar ? { exemplar: resolvedExemplar.id } : {}),
|
|
940
1035
|
...(targetMinutesRaw !== undefined ? { targetMinutes: targetMinutesRaw } : {}),
|
|
@@ -980,16 +1075,9 @@ export async function buildDeckAsync(options = {}) {
|
|
|
980
1075
|
// Resolve collisions after asynchronous rendering; an earlier call may have committed meanwhile.
|
|
981
1076
|
const file = resolveDeckFileName(normalized.outputDir, normalized.fileName, normalized.overwrite)
|
|
982
1077
|
const paths = pathsFor(resolve(normalized.outputDir, file + '.json'))
|
|
983
|
-
const
|
|
984
|
-
|
|
985
|
-
const
|
|
986
|
-
writeCarousel: Boolean(options.socialCarousel),
|
|
987
|
-
carouselRatio: options.socialCarousel === '1:1' ? '1:1' : '4:5',
|
|
988
|
-
writeSubtitles: Boolean(options.subtitles),
|
|
989
|
-
subtitlesFormat: options.subtitles === 'vtt' ? 'vtt' : 'srt',
|
|
990
|
-
}
|
|
991
|
-
withLock(paths.json, () => { abort(options.signal); commit(paths, data, writeHandout, writeOnePager, extraOpts) })
|
|
992
|
-
const builtResult = result(activeManifest, paths, writeHandout, writeOnePager, extraOpts)
|
|
1078
|
+
const exp = parseExportOptions(options)
|
|
1079
|
+
withLock(paths.json, () => { abort(options.signal); commit(paths, data, exp.writeHandout, exp.writeOnePager, exp) })
|
|
1080
|
+
const builtResult = result(activeManifest, paths, exp.writeHandout, exp.writeOnePager, exp)
|
|
993
1081
|
return upgradeReport ? { ...builtResult, upgradeReport } : builtResult
|
|
994
1082
|
}
|
|
995
1083
|
|
|
@@ -1032,7 +1120,7 @@ export function readDeckProject(options = {}) {
|
|
|
1032
1120
|
function expected(manifest, revision) {
|
|
1033
1121
|
if (revision !== undefined && (!Number.isInteger(revision) || revision !== manifest.revision)) fail(`修订号冲突:当前 revision=${manifest.revision},请重新读取工程后修改`)
|
|
1034
1122
|
}
|
|
1035
|
-
async function saveRevision(state, next, signal, saveAs = false, preserveUndo = false, saveAsSuffix = '-dsh') {
|
|
1123
|
+
async function saveRevision(state, next, signal, saveAs = false, preserveUndo = false, saveAsSuffix = '-dsh', expOpts = {}) {
|
|
1036
1124
|
if (!saveAs) { const problem = artifactProblem(state.manifest, pathsFor(state.path)); if (problem) fail(problem) }
|
|
1037
1125
|
next.version = DECK_VERSION; next.schemaVersion = 1; next.revision = state.manifest.revision + 1
|
|
1038
1126
|
if (saveAs) { next.deckId = randomUUID(); next.revision = 0; next.history = preserveUndo ? [snapshot(state.manifest)] : [] }
|
|
@@ -1047,9 +1135,9 @@ async function saveRevision(state, next, signal, saveAs = false, preserveUndo =
|
|
|
1047
1135
|
} else {
|
|
1048
1136
|
const problem = artifactProblem(state.manifest, paths); if (problem) fail(problem)
|
|
1049
1137
|
}
|
|
1050
|
-
commit(paths, data)
|
|
1138
|
+
commit(paths, data, expOpts.writeHandout === true, expOpts.writeOnePager === true, expOpts)
|
|
1051
1139
|
})
|
|
1052
|
-
return result(next, paths)
|
|
1140
|
+
return result(next, paths, expOpts.writeHandout === true, expOpts.writeOnePager === true, expOpts)
|
|
1053
1141
|
}
|
|
1054
1142
|
|
|
1055
1143
|
export async function remixDeck(options = {}) {
|
|
@@ -1077,6 +1165,7 @@ export async function editDeck(options = {}) {
|
|
|
1077
1165
|
const state = readDocument(options.deckPath, options.cwd), current = state.manifest
|
|
1078
1166
|
expected(current, options.expectedRevision)
|
|
1079
1167
|
const next = clone(current)
|
|
1168
|
+
const expOpts = parseExportOptions(options)
|
|
1080
1169
|
if (!Array.isArray(options.edits) || !options.edits.length) {
|
|
1081
1170
|
if (
|
|
1082
1171
|
options.brand === undefined &&
|
|
@@ -1089,14 +1178,18 @@ export async function editDeck(options = {}) {
|
|
|
1089
1178
|
options.append === undefined &&
|
|
1090
1179
|
options.targetMinutes === undefined &&
|
|
1091
1180
|
options.remixPreset === undefined &&
|
|
1181
|
+
options.motionProfile === undefined &&
|
|
1182
|
+
options.saveToBank === undefined &&
|
|
1183
|
+
options.translations === undefined &&
|
|
1184
|
+
!expOpts.hasAnyExtra &&
|
|
1092
1185
|
options.saveAs !== true
|
|
1093
1186
|
) {
|
|
1094
|
-
fail('请提供 edits、theme、taste、referencePptx、order、duplicate、remove、append、targetMinutes、remixPreset 或 brand')
|
|
1187
|
+
fail('请提供 edits、theme、taste、referencePptx、order、duplicate、remove、append、targetMinutes、remixPreset、motionProfile、saveToBank、translations、exports 或 brand')
|
|
1095
1188
|
}
|
|
1096
1189
|
}
|
|
1097
1190
|
const used = new Set()
|
|
1098
1191
|
const allowed = new Set([
|
|
1099
|
-
'layout', 'variant', 'chrome', 'cardMaterial', 'iconMode', 'coverPattern', 'imageBrief', 'title', 'subtitle', 'kicker', 'takeaway', 'source', 'evidenceIds',
|
|
1192
|
+
'layout', 'variant', 'chrome', 'cardMaterial', 'iconMode', 'reveal', 'coverPattern', 'imageBrief', 'title', 'subtitle', 'kicker', 'takeaway', 'source', 'evidenceIds',
|
|
1100
1193
|
'text', 'formula', 'mermaid', 'code', 'language', 'filename', 'url', 'xLabel', 'yLabel', 'activeIndex', 'tableStyle',
|
|
1101
1194
|
'bullets', 'items', 'cards', 'metrics', 'columns', 'steps', 'quadrants', 'rows', 'notes', 'image', 'images', 'chart', 'visual',
|
|
1102
1195
|
])
|
|
@@ -1242,6 +1335,39 @@ export async function editDeck(options = {}) {
|
|
|
1242
1335
|
...(options.brand?.logo === null ? { logo: undefined, logoAssetId: undefined } : {}) }, next.assets, cwd)
|
|
1243
1336
|
if (next.brand && Object.keys(next.brand).length === 0) delete next.brand
|
|
1244
1337
|
}
|
|
1338
|
+
if (options.motionProfile !== undefined) {
|
|
1339
|
+
if (options.motionProfile === null || options.motionProfile === '') {
|
|
1340
|
+
delete next.motionProfile
|
|
1341
|
+
} else {
|
|
1342
|
+
const mp = String(options.motionProfile).trim().toLowerCase()
|
|
1343
|
+
if (!['subtle', 'executive', 'keynote'].includes(mp)) fail('motionProfile 仅支持 subtle / executive / keynote')
|
|
1344
|
+
next.motionProfile = mp
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
|
|
1348
|
+
let savedBankEntry
|
|
1349
|
+
if (options.saveToBank !== undefined && options.saveToBank !== null) {
|
|
1350
|
+
const bankSpec = typeof options.saveToBank === 'number' || typeof options.saveToBank === 'string'
|
|
1351
|
+
? { slide: options.saveToBank }
|
|
1352
|
+
: options.saveToBank
|
|
1353
|
+
savedBankEntry = saveSlideToBank(cwd, next, bankSpec.slide, {
|
|
1354
|
+
bankId: bankSpec.bankId,
|
|
1355
|
+
name: bankSpec.name,
|
|
1356
|
+
tags: bankSpec.tags,
|
|
1357
|
+
})
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1360
|
+
if (options.translations !== undefined && options.translations !== null) {
|
|
1361
|
+
const mode = (options.bilingualMode === true || options.bilingualMode === 'bilingual') ? 'bilingual' : 'replace'
|
|
1362
|
+
const translated = applyTranslationBundle(next, options.translations, {
|
|
1363
|
+
mode,
|
|
1364
|
+
targetLang: options.targetLang,
|
|
1365
|
+
})
|
|
1366
|
+
next.title = translated.title
|
|
1367
|
+
next.language = translated.language
|
|
1368
|
+
next.slides = translated.slides
|
|
1369
|
+
}
|
|
1370
|
+
|
|
1245
1371
|
let remixReport
|
|
1246
1372
|
let saveAsFlag = options.saveAs === true
|
|
1247
1373
|
let saveAsSuffix = '-dsh'
|
|
@@ -1255,10 +1381,24 @@ export async function editDeck(options = {}) {
|
|
|
1255
1381
|
saveAsSuffix = '-' + remixed.preset.id
|
|
1256
1382
|
}
|
|
1257
1383
|
}
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1384
|
+
const unchangedContent = JSON.stringify(snapshot(next)) === JSON.stringify(snapshot(current))
|
|
1385
|
+
if (!saveAsFlag && unchangedContent && !expOpts.hasAnyExtra) {
|
|
1386
|
+
return {
|
|
1387
|
+
...result(current, pathsFor(state.path)),
|
|
1388
|
+
changed: false,
|
|
1389
|
+
...(savedBankEntry ? { savedBankEntry } : {}),
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
if (!unchangedContent) {
|
|
1393
|
+
next.history = [...next.history, snapshot(current)].slice(-MAX_HISTORY)
|
|
1394
|
+
}
|
|
1395
|
+
const saved = await saveRevision(state, next, options.signal, saveAsFlag, options.preserveUndo === true || Boolean(remixReport), saveAsSuffix, expOpts)
|
|
1396
|
+
return {
|
|
1397
|
+
...saved,
|
|
1398
|
+
changed: !unchangedContent || saveAsFlag || expOpts.hasAnyExtra,
|
|
1399
|
+
...(remixReport ? { remixReport } : {}),
|
|
1400
|
+
...(savedBankEntry ? { savedBankEntry } : {}),
|
|
1401
|
+
}
|
|
1262
1402
|
}
|
|
1263
1403
|
|
|
1264
1404
|
/** An AI-selected, bounded formatting vocabulary; always an undoable new copy. */
|
|
@@ -1281,7 +1421,7 @@ export async function undoDeck(options = {}) {
|
|
|
1281
1421
|
expected(state.manifest, options.expectedRevision)
|
|
1282
1422
|
if (!state.manifest.history.length) fail('该工程没有可撤销的修改')
|
|
1283
1423
|
const next = clone(state.manifest), prior = next.history.pop()
|
|
1284
|
-
for (const key of ['brand', 'brandKit', 'template', 'dataModel', 'targetMinutes', 'taste']) delete next[key]
|
|
1424
|
+
for (const key of ['brand', 'brandKit', 'template', 'dataModel', 'targetMinutes', 'taste', 'motionProfile']) delete next[key]
|
|
1285
1425
|
Object.assign(next, prior)
|
|
1286
1426
|
return saveRevision(state, next, options.signal)
|
|
1287
1427
|
}
|
|
@@ -1308,13 +1448,42 @@ export async function updateDeckData(options = {}) {
|
|
|
1308
1448
|
|
|
1309
1449
|
export function checkDeck(options = {}) {
|
|
1310
1450
|
abort(options.signal)
|
|
1311
|
-
const
|
|
1451
|
+
const cwd = resolve(options.cwd || '.')
|
|
1452
|
+
const { manifest, path } = readDocument(options.deckPath, cwd)
|
|
1312
1453
|
const quality = checkManifest(manifest), problem = artifactProblem(manifest, pathsFor(path))
|
|
1313
1454
|
if (problem) {
|
|
1314
1455
|
quality.issues.push({ slide: 0, severity: 'error', code: 'artifact-conflict', message: problem, suggestion: '保留原成品,使用 saveAs:true 或面板「另存副本」。副本不包含 Office 手工修改。' })
|
|
1315
1456
|
quality.errorCount++; quality.ok = false
|
|
1316
1457
|
}
|
|
1458
|
+
let stakeholderFeedback
|
|
1459
|
+
if (options.feedbackPath !== undefined && options.feedbackPath !== null && String(options.feedbackPath).trim() !== '') {
|
|
1460
|
+
const fbFile = resolve(cwd, String(options.feedbackPath).trim())
|
|
1461
|
+
let parsedFb
|
|
1462
|
+
try { parsedFb = JSON.parse(readFileSync(fbFile, 'utf8')) } catch { fail('无法读取审阅反馈文件 feedbackPath:' + fbFile) }
|
|
1463
|
+
const rawList = Array.isArray(parsedFb) ? parsedFb : (Array.isArray(parsedFb?.comments) ? parsedFb.comments : [])
|
|
1464
|
+
stakeholderFeedback = rawList
|
|
1465
|
+
.filter(c => c && typeof c === 'object' && String(c.text || '').trim())
|
|
1466
|
+
.map((c, idx) => ({
|
|
1467
|
+
id: String(c.id || `fb-${idx + 1}`),
|
|
1468
|
+
slide: Number.isInteger(c.slide) && c.slide >= 1 ? Math.min(manifest.slides.length, c.slide) : 1,
|
|
1469
|
+
author: String(c.author || 'Reviewer').slice(0, 60),
|
|
1470
|
+
text: String(c.text).replace(/\s+/g, ' ').trim().slice(0, 400),
|
|
1471
|
+
createdAt: c.createdAt ? String(c.createdAt) : '',
|
|
1472
|
+
}))
|
|
1473
|
+
for (const c of stakeholderFeedback) {
|
|
1474
|
+
quality.issues.push({
|
|
1475
|
+
slide: c.slide,
|
|
1476
|
+
slideId: manifest.slides[c.slide - 1]?.id,
|
|
1477
|
+
severity: 'warning',
|
|
1478
|
+
code: 'stakeholder-feedback',
|
|
1479
|
+
message: `[审阅批注 · ${c.author}] ${c.text}`,
|
|
1480
|
+
suggestion: '请根据审阅人意见调用 ppt_edit 修改对应页面并复核',
|
|
1481
|
+
})
|
|
1482
|
+
quality.warningCount += 1
|
|
1483
|
+
}
|
|
1484
|
+
}
|
|
1317
1485
|
return { ...quality, deckPath: path, deckId: manifest.deckId, revision: manifest.revision,
|
|
1486
|
+
...(stakeholderFeedback ? { stakeholderFeedback } : {}),
|
|
1318
1487
|
verification: { static: 'checked', pptxRender: 'not-verified', visual: 'not-verified' },
|
|
1319
1488
|
undoAvailable: manifest.history.length, slides: manifest.slides.map((s, i) => ({ slide: i + 1, id: s.id, title: s.title, layout: s.layout })) }
|
|
1320
1489
|
}
|
|
@@ -56,6 +56,15 @@ export function normalizeBrandKit(raw) {
|
|
|
56
56
|
.filter((t) => t.length >= 2),
|
|
57
57
|
)].slice(0, MAX_FORBIDDEN_TERMS)
|
|
58
58
|
|
|
59
|
+
const normalizeSourceList = (arr) => [...new Set(
|
|
60
|
+
(Array.isArray(arr) ? arr : [])
|
|
61
|
+
.map((s) => cleanStr(s, 96).replace(/^https?:\/\//i, '').replace(/\/.*$/, '').toLowerCase())
|
|
62
|
+
.filter((s) => s.length >= 2),
|
|
63
|
+
)].slice(0, MAX_FORBIDDEN_TERMS)
|
|
64
|
+
|
|
65
|
+
const preferredSources = normalizeSourceList(raw.preferredSources)
|
|
66
|
+
const blockedDomains = normalizeSourceList(raw.blockedDomains)
|
|
67
|
+
|
|
59
68
|
let mandatoryClosing
|
|
60
69
|
if (raw.mandatoryClosing && typeof raw.mandatoryClosing === 'object' && !Array.isArray(raw.mandatoryClosing)) {
|
|
61
70
|
const mcTitle = cleanStr(raw.mandatoryClosing.title, 120)
|
|
@@ -78,6 +87,8 @@ export function normalizeBrandKit(raw) {
|
|
|
78
87
|
...(Object.keys(brand).length > 0 ? { brand } : {}),
|
|
79
88
|
...(watermark ? { watermark } : {}),
|
|
80
89
|
...(forbiddenTerms.length > 0 ? { forbiddenTerms } : {}),
|
|
90
|
+
...(preferredSources.length > 0 ? { preferredSources } : {}),
|
|
91
|
+
...(blockedDomains.length > 0 ? { blockedDomains } : {}),
|
|
81
92
|
...(mandatoryClosing ? { mandatoryClosing } : {}),
|
|
82
93
|
updatedAt: raw.updatedAt || new Date().toISOString(),
|
|
83
94
|
}
|
|
@@ -121,6 +132,8 @@ export function buildBrandKitFromAbsorbed(absorbed, options = {}) {
|
|
|
121
132
|
},
|
|
122
133
|
...(options.watermark ? { watermark: options.watermark } : {}),
|
|
123
134
|
...(Array.isArray(options.forbiddenTerms) ? { forbiddenTerms: options.forbiddenTerms } : {}),
|
|
135
|
+
...(Array.isArray(options.preferredSources) ? { preferredSources: options.preferredSources } : {}),
|
|
136
|
+
...(Array.isArray(options.blockedDomains) ? { blockedDomains: options.blockedDomains } : {}),
|
|
124
137
|
...(options.mandatoryClosing ? { mandatoryClosing: options.mandatoryClosing } : {}),
|
|
125
138
|
})
|
|
126
139
|
}
|