// @requirements REQ-PRODUCT-EMBEDS import {readFile} from 'node:fs/promises'; import {compileLegalDocuments} from 'notabenda/content'; import {renderEmbedPlaceholder,renderLegalLinks} from 'notabenda'; import {exampleConsentConfig} from '../static/choices-build.mjs'; export async function embedFiles(base){ const config=exampleConsentConfig(base);config.site.id='juniper-embeds'; const template=config.purposes[0]; config.purposes=[{...template,id:'embedded-media',name:'Embedded media',description:'Load fictional first-party framed content and an illustration in this demonstration.',dataCategories:['Synthetic media request'],retention:'No application record is created by these sample media resources.'},config.purposes.find(p=>p.id==='remember-choices')]; config.services=[{id:'sample-media',name:'Sample embedded media',provider:'Juniper Notes (fictional)',location:'This local demonstration only',purposeIds:['embedded-media'],resourceOrigins:['self']},config.services.find(s=>s.id==='privacy-choices')]; config.storage=config.storage.filter(s=>s.serviceId==='privacy-choices');for(const item of config.storage)item.name=item.name.replace('juniper-choices',config.site.id); config.consent.purposes=[{id:'embedded-media',scope:'sample-1'}];config.consent.services=[{id:'sample-media',scope:'sample-1'}]; for(const [kind,doc] of Object.entries(config.documents))doc.route=`/embeds/${kind}`; const build=compileLegalDocuments(config,{mode:'preview',stylesheetUrl:'/assets/notabenda.css'}); const html=`Gated media · Juniper NotesSkip to content
Juniper NotesJuniper Notes examples

Notabenda · Gated media

Embedded media
with consent

An embedded page and an illustration share one declared service. Their resource URLs stay out of the page until you allow embedded media.

Embedded media: Off — awaiting your choice

Media requests observed this page: 0

${renderEmbedPlaceholder({title:'Sample embedded page',description:'A local framed page that loads after permission.'})}
${renderEmbedPlaceholder({title:'Sample illustration',description:'An illustration served by the same media service.'})}
`; return {...build.files,'embeds/site.json':JSON.stringify(build.publicConfig),'embeds/index.html':html,'assets/embeds.mjs':await readFile(new URL('./client.mjs',import.meta.url),'utf8'), 'embeds/frame/index.html':'Sample embedded page

Embedded content

Sample embedded page

This sample page loads after permission and contains no scripts, cookies or other embeds.

', 'embeds/landscape.svg':''}; }