// @requirements REQ-PRODUCT-CONTRACT-ACTIONS REQ-PRODUCT-MOBILE REQ-PRODUCT-A11Y import {readFile} from 'node:fs/promises'; import {compileLegalDocuments,createContractActionDefinition} from 'notabenda/content'; import {renderLegalLinks} from 'notabenda'; export function contractActionExample(base){ const config=structuredClone(base);config.site.id='juniper-contract-actions';config.site.name='Juniper Notes';for(const [kind,doc] of Object.entries(config.documents))doc.route='/contract-actions/'+kind; const build=compileLegalDocuments(config,{mode:'preview'}),definitions={}; for(const [route,profile] of [['withdrawal','eu-withdrawal'],['cancellation','de-cancellation']])definitions[route]=createContractActionDefinition(build.artifact,{actionId:route,revision:'form-1@'+build.manifest.artifactId,profile,reviewStatus:'draft'},{mode:'preview'}); return {build,definitions}; } export async function contractActionFiles(base){ const {build,definitions}=contractActionExample(base),files={...build.files,'assets/contract-actions.mjs':await readFile(new URL('./client.mjs',import.meta.url),'utf8'),'assets/contract-actions.css':await readFile(new URL('./style.css',import.meta.url),'utf8')}; for(const [route,d] of Object.entries(definitions)){ files['contract-actions/'+route+'/definition.json']=JSON.stringify(d); for(const dark of [false,true]){const prefix=dark?'dark/':'',de=route==='cancellation'; files[prefix+'contract-actions/'+route+'/index.html']=`${de?'Vertrag kündigen':'Submit a withdrawal request'} · Juniper Notes
Juniper Notes

Notabenda · ${de?'Vertragskündigung':'Contract withdrawal'}

${de?'Vertrag kündigen':'Submit a withdrawal request'}

${de?'Ihre Erklärung, mit den Angaben zum Vertrag und einer Kopie zum Speichern.':'Your declaration, the details that identify your contract, and a copy you can keep.'}

${de?'Formular wird vorbereitet…':'Preparing the form…'}

${de?'Demonstration: Nutzen Sie eine example.test-Adresse. Es wird keine E-Mail versandt und kein echter Vertrag beendet.':'Demonstration: use an example.test address. No email is sent and no real contract is changed.'}

`; } } return files; }