diff --git a/package.json b/package.json index e7189186..55d2fb02 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "homepage", - "version": "1.47.1", + "version": "1.47.2", "private": true, "type": "module", "scripts": { diff --git a/scripts/generate-loyalty-cards.ts b/scripts/generate-loyalty-cards.ts index 28ca0497..0e7c6914 100644 --- a/scripts/generate-loyalty-cards.ts +++ b/scripts/generate-loyalty-cards.ts @@ -23,10 +23,15 @@ type CardSpec = { filename: string; bcid: 'datamatrix' | 'code128'; scale: number; + parsefnc?: boolean; }; const cards: CardSpec[] = [ - { envVar: 'SHOPPING_COOP_SUPERCARD_NUMBER', filename: 'supercard.svg', bcid: 'datamatrix', scale: 6 }, + // Coop Supercard uses GS1 Data Matrix with FNC1 separators between fields. + // Put ^FNC1 in the env value wherever the real symbol has a separator + // (dmtxread -G prints them as 0x1D); parsefnc: true turns each ^FNC1 into + // a genuine FNC1 codeword so the regenerated code matches the card. + { envVar: 'SHOPPING_COOP_SUPERCARD_NUMBER', filename: 'supercard.svg', bcid: 'datamatrix', scale: 6, parsefnc: true }, { envVar: 'SHOPPING_MIGROS_CUMULUS_NUMBER', filename: 'cumulus.svg', bcid: 'code128', scale: 3 } ]; @@ -48,7 +53,8 @@ for (const card of cards) { scale: card.scale, includetext: false, paddingwidth: 8, - paddingheight: 8 + paddingheight: 8, + ...(card.parsefnc ? { parsefnc: true } : {}) }); writeFileSync(outPath, svg, 'utf8');