// @requirements REQ-PRODUCT-STORAGE-CLEANUP
import {readFile} from 'node:fs/promises';
import {compileLegalDocuments} from '@notabenda/core/content';
import {renderLegalLinks} from '@notabenda/core';
import {exampleConsentConfig} from '../static/choices-build.mjs';
export async function storageCleanupFiles(base){
const config=exampleConsentConfig(base);config.site.id='juniper-storage-cleanup';config.purposes=config.purposes.filter(p=>p.id!=='suggestions');config.services=config.services.filter(s=>s.id!=='sample-suggestions');config.storage=config.storage.filter(s=>s.serviceId==='privacy-choices');
const purpose=config.purposes[0];purpose.name='Sample memory';purpose.description='Create three fictional browser markers only after permission.';purpose.dataCategories=['Synthetic browser marker'];purpose.retention='Removed on withdrawal while this example is running, or browser clearing.';
config.services[0].name='Sample browser memory';config.consent.purposes=[config.consent.purposes[0]];config.consent.services=[config.consent.services[0]];
for(const item of config.storage)item.name=item.name.replace('juniper-choices',config.site.id);
for(const [i,type] of ['localStorage','sessionStorage','cookie'].entries())config.storage.push({id:'demo-'+i,name:'juniper-cleanup-'+i,type,serviceId:'sample-measurements',duration:'Until withdrawal or browser clearing',classification:'optional'});
for(const [kind,doc] of Object.entries(config.documents))doc.route='/storage-cleanup/'+kind;
const build=compileLegalDocuments(config,{mode:'preview'});
const html=`
Allow memory to create three browser markers. Withdraw permission to stop the producer and remove its exact declared browser storage.
Local demonstration. No external trackers. Cookie expiration is requested for the declared path; it is not proof of deletion from every cookie scope.
Browser memory
Declared localStorage marker
Declared sessionStorage marker
Same-path cookie visible to this page
Unrelated local marker
Producer starts this visit:
Waiting for the runtime.
Declared cleanup targets
The adapter uses exact inventory IDs. It leaves unrelated items and choice memory alone. It cannot recall sent data, remove HttpOnly cookies or stop producers outside the lifecycle.