import {renderWorkspaceShell} from '../packages/notabenda-cf/dist/render.js'; import {adminPresentation} from './admin-presentation.mjs'; // @requirements REQ-PRODUCT-DEMO-WORKSPACE REQ-PRODUCT-MOBILE const sections=[['orders','Order requests','Inspect retained order reviews, customer confirmation files and delivery status.'],['history','Document revisions','Compare the wording, rendered pages and MDX source of retained releases.'],['choices','Cookie-choice history','Follow full acceptance, a later withdrawal, partial choices and refusals.'],['agreements','Terms agreements','Inspect membership agreements, each bound to the exact document and statement.'],['processing','Processing opt-outs','Review readers’ requests and the processing restrictions retained for each.'],['permissions','Form permissions','Review purpose-specific email choices, withdrawals and the evaluated current state.'],['contracts','Contract declarations','Follow the declaration, its exact copy and independent confirmation/application handoffs.'],['recorded','Your sandbox choices','See the reports made through the recorded-choice example in this workspace.'],['lifecycle','Retention & holds','Explore held evidence, a resumable purge and a restore barrier across the record lifecycle.']]; export const demoNavigation=()=>``; export function demoHome(){ const nonce=crypto.randomUUID().replaceAll('-',''); const html=renderWorkspaceShell(`

DEMO WORKSPACE

Demo records

Search sample choices and agreements, compare document versions, and inspect records created through the examples.

Explore cookie-choice history ↗
${sections.map(([id,title,description],i)=>`0${i+1} / EXPLORE

${title}

${description}

`).join('')}

CREATE A RECORD

Try a recorded example

Make a choice in an example, then follow its notice, version and receipt here.

`,{...adminPresentation('/demo/admin'),basePath:'/demo/admin',title:'Your demo workspace',scopeLabel:'Your demo workspace',nonce},'','demo-home-page'); return new Response(html,{headers:{'Content-Type':'text/html; charset=utf-8','Content-Security-Policy':`default-src 'none'; style-src 'self' 'nonce-${nonce}'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'`}}); } export async function decorateDemoAdmin(response,path){ if(!path.startsWith('/demo/admin')||!response.headers.get('Content-Type')?.includes('text/html'))return response; const headers=new Headers(response.headers);headers.delete('Content-Length'); const csp=headers.get('Content-Security-Policy')??"default-src 'none'; style-src 'self'"; headers.set('Content-Security-Policy',csp.replace(/style-src /u,"style-src 'self' ")); const source=await response.text(); const html=source.includes('class="admin-app"')?source:source.replace('','').replace('',''+demoNavigation()); return new Response(html,{status:response.status,headers}); } export function demoExpired(){return new Response(`Demo session ended · Notabenda

SESSION EXPIRED

Your demo session ended

This session ended. Open a fresh workspace to continue exploring.

Open a fresh demo ↗
`,{status:410,headers:{'Content-Type':'text/html; charset=utf-8','Content-Security-Policy':"default-src 'none'; style-src 'self'; img-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'"}});}