Story 6-4/6-5: Chat with PDF (done) + PPTX watermark PLG
Story 6-4 — Chat with PDF: - Feature déjà implémentée (document-qa-overlay.tsx, ingestion, search) - Marquée done dans sprint-status Story 6-5 — PPTX Export Watermark (PLG viral loop): - lib/brainstorm/export-pptx.ts: addWatermark + withWatermark helpers - lib/ai/tools/pptx.tool.ts: même pattern monkey-patch addSlide - Watermark 'memento-note.com' 7pt gris bas-droite sur chaque slide - Zéro modification des 14+ fonctions de slides existantes - 174 tests passent, aucune erreur TS Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -105,6 +105,26 @@ const SHAPE_RECT = 'rect' as const
|
||||
const SHAPE_ROUND_RECT = 'roundRect' as const
|
||||
const SHAPE_OVAL = 'ellipse' as const
|
||||
|
||||
/** PLG viral watermark injected on every slide automatically */
|
||||
function addWatermark(slide: any) {
|
||||
slide.addText('memento-note.com', {
|
||||
x: 7.0, y: 5.35, w: 2.7, h: 0.2,
|
||||
fontSize: 7, fontFace: 'Arial', color: 'B8B0A8',
|
||||
align: 'right', italic: true,
|
||||
})
|
||||
}
|
||||
|
||||
/** Wrap pres.addSlide so every new slide gets the Momento watermark automatically */
|
||||
function withWatermark(pres: PptxGenJSModule): PptxGenJSModule {
|
||||
const original = pres.addSlide.bind(pres)
|
||||
;(pres as any).addSlide = (...args: any[]) => {
|
||||
const slide = original(...args)
|
||||
addWatermark(slide)
|
||||
return slide
|
||||
}
|
||||
return pres
|
||||
}
|
||||
|
||||
function addBadge(s: any, num: number, accent: string) {
|
||||
s.addShape(SHAPE_OVAL, {
|
||||
x: 9.3, y: 5.1, w: 0.4, h: 0.4,
|
||||
@@ -978,7 +998,7 @@ async function buildPresentation(spec: PresentationSpec): Promise<PptxGenJSModul
|
||||
const style = STYLES[spec.style || 'soft'] || STYLES.soft!
|
||||
|
||||
const PptxGenJS = await getPptxGenClass()
|
||||
const pres = new PptxGenJS()
|
||||
const pres = withWatermark(new PptxGenJS())
|
||||
pres.title = spec.title
|
||||
pres.author = 'Momento'
|
||||
pres.subject = spec.title
|
||||
|
||||
@@ -66,6 +66,29 @@ function truncate(text: string, max: number): string {
|
||||
return text.length > max ? text.slice(0, max - 1) + '…' : text
|
||||
}
|
||||
|
||||
/**
|
||||
* PLG viral watermark — added to every slide automatically via addSlide monkey-patch.
|
||||
* Subtle branding in bottom-right corner to drive organic acquisition.
|
||||
*/
|
||||
function addWatermark(slide: any) {
|
||||
slide.addText('memento-note.com', {
|
||||
x: 7.0, y: 5.35, w: 2.7, h: 0.2,
|
||||
fontSize: 7, fontFace: 'Arial', color: 'B8B0A8',
|
||||
align: 'right', italic: true,
|
||||
})
|
||||
}
|
||||
|
||||
/** Wrap pres.addSlide so every new slide gets the Momento watermark automatically */
|
||||
function withWatermark(pres: PptxGenJSModule): PptxGenJSModule {
|
||||
const original = pres.addSlide.bind(pres)
|
||||
;(pres as any).addSlide = (...args: any[]) => {
|
||||
const slide = original(...args)
|
||||
addWatermark(slide)
|
||||
return slide
|
||||
}
|
||||
return pres
|
||||
}
|
||||
|
||||
// Add a consistent slide background
|
||||
function addBg(slide: any) {
|
||||
slide.background = { color: T.bg }
|
||||
@@ -279,7 +302,7 @@ function buildSummarySlide(pres: PptxGenJSModule, session: SessionLike, stats: {
|
||||
|
||||
export async function generateBrainstormPptx(session: SessionLike): Promise<{ buffer: Buffer; filename: string }> {
|
||||
const PptxGenJS = await getPptxGenClass()
|
||||
const pres = new PptxGenJS()
|
||||
const pres = withWatermark(new PptxGenJS())
|
||||
|
||||
pres.layout = 'LAYOUT_WIDE'
|
||||
pres.author = 'Momento'
|
||||
|
||||
Reference in New Issue
Block a user