// @requirements REQ-PRODUCT-COLLECTION-FLOW REQ-TR-BASIS import {compileLegalDocuments,createCollectionFlow} from '@notabenda/core/content'; export function collectionFlowExample(base){ const config=structuredClone(base);config.site.id='juniper-permissions';config.controller.name='Juniper Notes Cooperative';config.services=[];config.storage=[]; config.scopeGuards={version:1,revision:'ordinary-form-1',site:{children:'absent',sensitiveData:'absent',highRiskProfiling:'absent',regulatedSector:'absent'}}; const purpose=(id,name,description,basis,categories,consequences)=>({id,name,description,legalBasis:basis,dataCategories:categories,retention:'The demonstration workspace is cleared after one day without use.',collection:{source:'direct',description:'Information you provide on this page.',required:false,consequences}}); config.purposes=[purpose('flow-message','Reply to your message','Use your message and reply address to answer the question you choose to send.','Illustrative contract-request condition; the operator must assess the actual request and processing.',['Reply address','Message text'],'Without a reply address we cannot respond.'),purpose('flow-updates','Send reading updates','Send email about Juniper Notes reading tools if you choose these updates.','Explicit consent for these optional updates; applicability and wording need review.',['Purpose and channel choice','Opaque contact-generation reference','Request and recording timestamps'],'Your message works without email updates.')]; for(const [kind,doc] of Object.entries(config.documents))doc.route='/collection-flow/'+kind; const build=compileLegalDocuments(config,{mode:'preview'}),settings={reviewedArtifactId:build.manifest.artifactId,notice:{scopeId:'message-and-updates',purposeIds:['flow-message','flow-updates'],reviewStatus:'draft',wording:{title:'About this form',intro:'Your message and email updates have different purposes. Read what each uses below.'}},decisions:[{purposeId:'flow-message',presentation:'notice-only'},{purposeId:'flow-updates',presentation:'separate-permission',permission:{permissionId:'flow-updates-email',channel:{id:'email',label:'Email'},revision:'reading-updates-1',reviewStatus:'draft',withdrawalUrl:'/collection-flow/privacy#nb-privacy-section-rights',refusal:{label:'No email updates',recorded:'Your refusal has been saved. Email updates are off.',pending:'Refusal is waiting for confirmation. Updates stay off.',retry:'Retry refusal'},wording:{title:'Choose email updates',statement:'Send me email updates about Juniper Notes reading tools.',grantLabel:'Save email permission',withdrawLabel:'Withdraw email permission',optionality:'Optional. Preparing your message does not require this choice.',withdrawalExplanation:'Withdraw updates here at any time. This does not change your message.'}}}]}; return {build,settings,flow:createCollectionFlow(build.artifact,settings,{mode:'preview'})}; }