// @requirements REQ-EU-GUARANTEE-LABEL REQ-PRODUCT-MOBILE REQ-PRODUCT-A11Y import {readFile} from 'node:fs/promises'; import {createHash} from 'node:crypto'; import {buildDurabilityGuaranteeLabel,verifyDurabilityGuaranteeLabel} from 'notabenda-authoring/guarantees'; import {renderDurabilityGuaranteeLabel} from 'notabenda/guarantees/label'; export async function producerGuaranteeFiles(){ const options=JSON.parse(await readFile(new URL('./producer/config.json',import.meta.url),'utf8')); const source=await readFile(new URL('./producer/juniper-jw-01.svg',import.meta.url)),provenance=JSON.parse(await readFile(new URL('./producer/manifest.json',import.meta.url),'utf8')); if(createHash('sha256').update(source).digest('hex')!==provenance.output.sha256)throw Error('Prepared producer label differs from its recorded source.'); const built=buildDurabilityGuaranteeLabel(options,source);verifyDurabilityGuaranteeLabel(built.label,source,{allowPreview:true}); const assetBase=built.label.asset.url.slice(0,built.label.asset.url.lastIndexOf('.')); const files={...built.files,[assetBase.slice(1)+'.NOTICE.txt']:await readFile(new URL('./producer/NOTICE.md',import.meta.url),'utf8'),[assetBase.slice(1)+'.provenance.json']:JSON.stringify(provenance,null,2)+'\n','assets/guarantees.css':await readFile(new URL('../../packages/notabenda/dist/guarantees.css',import.meta.url),'utf8'),'assets/juniper-desk-lamp.svg':await readFile(new URL('./producer/product.svg',import.meta.url),'utf8')}; for(const dark of [false,true]){ const path=(dark?'dark/':'')+'guarantees/product'; files[path+'/label.json']=JSON.stringify(built.label,null,2)+'\n'; files[path+'/index.html']=`Juniper desk lamp · Producer guarantee
Juniper Notes
Illustration of a green desk lamp with an adjustable angled arm.
Juniper Works / JW-01

LIGHT FOR YOUR DESK

Juniper
desk lamp

Adjustable task lighting, with the producer’s guarantee beside the product it covers.

Producer
Juniper Works
Model
JW-01
Durability guarantee
5 years
View the guarantee label

Example product and producer. No goods are sold here.

${renderDurabilityGuaranteeLabel(built.label,{idPrefix:'lamp-guarantee',allowPreview:true})}
Inspect label at larger size

Scroll across and down to read the complete label. With the image area focused, use the arrow keys to move.

Enlarged producer guarantee label: Juniper Works, JW-01, 5 years. The full graphic includes its multilingual wording and information QR.

EU artwork with only the brand, model and duration fields filled. Fonts are outlined; the fixed artwork, multilingual footer and QR are preserved.

`; } return files; }