Inscription client et cartes Apple / Google Wallet
- Page d'inscription /c/<slug> aux couleurs du magasin (prénom, e-mail, consentement RGPD), carte déjà existante avec renvoi du lien, programme indisponible, page confidentialité - Page de la carte /carte/<serial> avec lien secret, suppression RGPD - Génération .pkpass (passkit-generator) et lien Google Wallet (JWT) - E-mail de confirmation (SMTP, ou logs en développement) - Affichette A5/A6 imprimable avec le QR d'inscription - Activation du magasin conditionnée au logo Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
a6533f2520
commit
eec67bbf86
24 changed files with 2315 additions and 8 deletions
334
admin/package-lock.json
generated
334
admin/package-lock.json
generated
|
|
@ -8,11 +8,13 @@
|
||||||
"name": "@mep/admin",
|
"name": "@mep/admin",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"qrcode": "^1.5.4",
|
||||||
"react": "^18.3.1",
|
"react": "^18.3.1",
|
||||||
"react-dom": "^18.3.1",
|
"react-dom": "^18.3.1",
|
||||||
"react-router-dom": "^6.30.6"
|
"react-router-dom": "^6.30.6"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@types/qrcode": "^1.5.6",
|
||||||
"@types/react": "^18.3.31",
|
"@types/react": "^18.3.31",
|
||||||
"@types/react-dom": "^18.3.7",
|
"@types/react-dom": "^18.3.7",
|
||||||
"@vitejs/plugin-react": "^4.7.0",
|
"@vitejs/plugin-react": "^4.7.0",
|
||||||
|
|
@ -1220,6 +1222,16 @@
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/node": {
|
||||||
|
"version": "26.6.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-26.6.4.tgz",
|
||||||
|
"integrity": "sha512-ldVPDCzj7fsaGZrLB0NuHuTvJcsNasysBAqMolr/cgxrLd1xbqxIr3XJiPnHHJUCxj5sNF1vnRj9aWnrVh5Jcg==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"undici-types": "~8.9.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@types/prop-types": {
|
"node_modules/@types/prop-types": {
|
||||||
"version": "15.7.15",
|
"version": "15.7.15",
|
||||||
"resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.15.tgz",
|
"resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.15.tgz",
|
||||||
|
|
@ -1227,6 +1239,16 @@
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/qrcode": {
|
||||||
|
"version": "1.5.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/qrcode/-/qrcode-1.5.6.tgz",
|
||||||
|
"integrity": "sha512-te7NQcV2BOvdj2b1hCAHzAoMNuj65kNBMz0KBaxM6c3VGBOhU0dURQKOtH8CFNI/dsKkwlv32p26qYQTWoB5bw==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@types/node": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@types/react": {
|
"node_modules/@types/react": {
|
||||||
"version": "18.3.31",
|
"version": "18.3.31",
|
||||||
"resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.31.tgz",
|
"resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.31.tgz",
|
||||||
|
|
@ -1269,6 +1291,30 @@
|
||||||
"vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0"
|
"vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/ansi-regex": {
|
||||||
|
"version": "5.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
|
||||||
|
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/ansi-styles": {
|
||||||
|
"version": "4.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
||||||
|
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"color-convert": "^2.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/baseline-browser-mapping": {
|
"node_modules/baseline-browser-mapping": {
|
||||||
"version": "2.11.27",
|
"version": "2.11.27",
|
||||||
"resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.27.tgz",
|
"resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.27.tgz",
|
||||||
|
|
@ -1316,6 +1362,15 @@
|
||||||
"node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"
|
"node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/camelcase": {
|
||||||
|
"version": "5.3.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
|
||||||
|
"integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/caniuse-lite": {
|
"node_modules/caniuse-lite": {
|
||||||
"version": "1.0.30001814",
|
"version": "1.0.30001814",
|
||||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001814.tgz",
|
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001814.tgz",
|
||||||
|
|
@ -1337,6 +1392,35 @@
|
||||||
],
|
],
|
||||||
"license": "CC-BY-4.0"
|
"license": "CC-BY-4.0"
|
||||||
},
|
},
|
||||||
|
"node_modules/cliui": {
|
||||||
|
"version": "6.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz",
|
||||||
|
"integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"string-width": "^4.2.0",
|
||||||
|
"strip-ansi": "^6.0.0",
|
||||||
|
"wrap-ansi": "^6.2.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/color-convert": {
|
||||||
|
"version": "2.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
||||||
|
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"color-name": "~1.1.4"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=7.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/color-name": {
|
||||||
|
"version": "1.1.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
||||||
|
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/convert-source-map": {
|
"node_modules/convert-source-map": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz",
|
||||||
|
|
@ -1369,6 +1453,21 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/decamelize": {
|
||||||
|
"version": "1.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
|
||||||
|
"integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/dijkstrajs": {
|
||||||
|
"version": "1.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/dijkstrajs/-/dijkstrajs-1.0.3.tgz",
|
||||||
|
"integrity": "sha512-qiSlmBq9+BCdCA/L46dw8Uy93mloxsPSbwnm5yrKn2vMPiy8KyAskTF6zuV/j5BMsmOGZDPs7KjU+mjb670kfA==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/electron-to-chromium": {
|
"node_modules/electron-to-chromium": {
|
||||||
"version": "1.5.445",
|
"version": "1.5.445",
|
||||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.445.tgz",
|
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.445.tgz",
|
||||||
|
|
@ -1376,6 +1475,12 @@
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "ISC"
|
"license": "ISC"
|
||||||
},
|
},
|
||||||
|
"node_modules/emoji-regex": {
|
||||||
|
"version": "8.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
|
||||||
|
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/esbuild": {
|
"node_modules/esbuild": {
|
||||||
"version": "0.21.5",
|
"version": "0.21.5",
|
||||||
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.5.tgz",
|
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.5.tgz",
|
||||||
|
|
@ -1425,6 +1530,19 @@
|
||||||
"node": ">=6"
|
"node": ">=6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/find-up": {
|
||||||
|
"version": "4.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz",
|
||||||
|
"integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"locate-path": "^5.0.0",
|
||||||
|
"path-exists": "^4.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/fsevents": {
|
"node_modules/fsevents": {
|
||||||
"version": "2.3.3",
|
"version": "2.3.3",
|
||||||
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
|
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
|
||||||
|
|
@ -1450,6 +1568,24 @@
|
||||||
"node": ">=6.9.0"
|
"node": ">=6.9.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/get-caller-file": {
|
||||||
|
"version": "2.0.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
|
||||||
|
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
|
||||||
|
"license": "ISC",
|
||||||
|
"engines": {
|
||||||
|
"node": "6.* || 8.* || >= 10.*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/is-fullwidth-code-point": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/js-tokens": {
|
"node_modules/js-tokens": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
|
||||||
|
|
@ -1482,6 +1618,18 @@
|
||||||
"node": ">=6"
|
"node": ">=6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/locate-path": {
|
||||||
|
"version": "5.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz",
|
||||||
|
"integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"p-locate": "^4.1.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/loose-envify": {
|
"node_modules/loose-envify": {
|
||||||
"version": "1.4.0",
|
"version": "1.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
|
||||||
|
|
@ -1540,6 +1688,51 @@
|
||||||
"node": ">=18"
|
"node": ">=18"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/p-limit": {
|
||||||
|
"version": "2.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",
|
||||||
|
"integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"p-try": "^2.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/p-locate": {
|
||||||
|
"version": "4.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz",
|
||||||
|
"integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"p-limit": "^2.2.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/p-try": {
|
||||||
|
"version": "2.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
|
||||||
|
"integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/path-exists": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/picocolors": {
|
"node_modules/picocolors": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
|
||||||
|
|
@ -1547,6 +1740,15 @@
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "ISC"
|
"license": "ISC"
|
||||||
},
|
},
|
||||||
|
"node_modules/pngjs": {
|
||||||
|
"version": "5.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/pngjs/-/pngjs-5.0.0.tgz",
|
||||||
|
"integrity": "sha512-40QW5YalBNfQo5yRYmiw7Yz6TKKVr3h6970B2YE+3fQpsWcrbj1PzJgxeJ19DRQjhMbKPIuMY8rFaXc8moolVw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10.13.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/postcss": {
|
"node_modules/postcss": {
|
||||||
"version": "8.5.29",
|
"version": "8.5.29",
|
||||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.29.tgz",
|
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.29.tgz",
|
||||||
|
|
@ -1576,6 +1778,23 @@
|
||||||
"node": "^10 || ^12 || >=14"
|
"node": "^10 || ^12 || >=14"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/qrcode": {
|
||||||
|
"version": "1.5.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/qrcode/-/qrcode-1.5.4.tgz",
|
||||||
|
"integrity": "sha512-1ca71Zgiu6ORjHqFBDpnSMTR2ReToX4l1Au1VFLyVeBTFavzQnv5JxMFr3ukHVKpSrSA2MCk0lNJSykjUfz7Zg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"dijkstrajs": "^1.0.1",
|
||||||
|
"pngjs": "^5.0.0",
|
||||||
|
"yargs": "^15.3.1"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"qrcode": "bin/qrcode"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10.13.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/react": {
|
"node_modules/react": {
|
||||||
"version": "18.3.1",
|
"version": "18.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz",
|
||||||
|
|
@ -1643,6 +1862,21 @@
|
||||||
"react-dom": ">=16.8"
|
"react-dom": ">=16.8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/require-directory": {
|
||||||
|
"version": "2.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
|
||||||
|
"integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/require-main-filename": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==",
|
||||||
|
"license": "ISC"
|
||||||
|
},
|
||||||
"node_modules/rollup": {
|
"node_modules/rollup": {
|
||||||
"version": "4.64.0",
|
"version": "4.64.0",
|
||||||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-4.64.0.tgz",
|
"resolved": "https://registry.npmjs.org/rollup/-/rollup-4.64.0.tgz",
|
||||||
|
|
@ -1708,6 +1942,12 @@
|
||||||
"semver": "bin/semver.js"
|
"semver": "bin/semver.js"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/set-blocking": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==",
|
||||||
|
"license": "ISC"
|
||||||
|
},
|
||||||
"node_modules/source-map-js": {
|
"node_modules/source-map-js": {
|
||||||
"version": "1.2.2",
|
"version": "1.2.2",
|
||||||
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.2.tgz",
|
||||||
|
|
@ -1718,6 +1958,32 @@
|
||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/string-width": {
|
||||||
|
"version": "4.2.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
|
||||||
|
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"emoji-regex": "^8.0.0",
|
||||||
|
"is-fullwidth-code-point": "^3.0.0",
|
||||||
|
"strip-ansi": "^6.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/strip-ansi": {
|
||||||
|
"version": "6.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
|
||||||
|
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"ansi-regex": "^5.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/typescript": {
|
"node_modules/typescript": {
|
||||||
"version": "5.9.3",
|
"version": "5.9.3",
|
||||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz",
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz",
|
||||||
|
|
@ -1732,6 +1998,13 @@
|
||||||
"node": ">=14.17"
|
"node": ">=14.17"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/undici-types": {
|
||||||
|
"version": "8.9.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-8.9.0.tgz",
|
||||||
|
"integrity": "sha512-KTDyRTYX8sWmKXAikPHHSyc63CRPETMctyjKFupcC6OBLXT3xsN0e9aF7m+mIXutFWpUXuedtowG7iLOzp0kQg==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/update-browserslist-db": {
|
"node_modules/update-browserslist-db": {
|
||||||
"version": "1.3.3",
|
"version": "1.3.3",
|
||||||
"resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.3.3.tgz",
|
"resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.3.3.tgz",
|
||||||
|
|
@ -1823,12 +2096,73 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/which-module": {
|
||||||
|
"version": "2.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.1.tgz",
|
||||||
|
"integrity": "sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ==",
|
||||||
|
"license": "ISC"
|
||||||
|
},
|
||||||
|
"node_modules/wrap-ansi": {
|
||||||
|
"version": "6.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz",
|
||||||
|
"integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"ansi-styles": "^4.0.0",
|
||||||
|
"string-width": "^4.1.0",
|
||||||
|
"strip-ansi": "^6.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/y18n": {
|
||||||
|
"version": "4.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz",
|
||||||
|
"integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==",
|
||||||
|
"license": "ISC"
|
||||||
|
},
|
||||||
"node_modules/yallist": {
|
"node_modules/yallist": {
|
||||||
"version": "3.1.1",
|
"version": "3.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
|
||||||
"integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==",
|
"integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "ISC"
|
"license": "ISC"
|
||||||
|
},
|
||||||
|
"node_modules/yargs": {
|
||||||
|
"version": "15.4.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz",
|
||||||
|
"integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"cliui": "^6.0.0",
|
||||||
|
"decamelize": "^1.2.0",
|
||||||
|
"find-up": "^4.1.0",
|
||||||
|
"get-caller-file": "^2.0.1",
|
||||||
|
"require-directory": "^2.1.1",
|
||||||
|
"require-main-filename": "^2.0.0",
|
||||||
|
"set-blocking": "^2.0.0",
|
||||||
|
"string-width": "^4.2.0",
|
||||||
|
"which-module": "^2.0.0",
|
||||||
|
"y18n": "^4.0.0",
|
||||||
|
"yargs-parser": "^18.1.2"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/yargs-parser": {
|
||||||
|
"version": "18.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz",
|
||||||
|
"integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"camelcase": "^5.0.0",
|
||||||
|
"decamelize": "^1.2.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,11 +10,13 @@
|
||||||
"preview": "vite preview"
|
"preview": "vite preview"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"qrcode": "^1.5.4",
|
||||||
"react": "^18.3.1",
|
"react": "^18.3.1",
|
||||||
"react-dom": "^18.3.1",
|
"react-dom": "^18.3.1",
|
||||||
"react-router-dom": "^6.30.6"
|
"react-router-dom": "^6.30.6"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@types/qrcode": "^1.5.6",
|
||||||
"@types/react": "^18.3.31",
|
"@types/react": "^18.3.31",
|
||||||
"@types/react-dom": "^18.3.7",
|
"@types/react-dom": "^18.3.7",
|
||||||
"@vitejs/plugin-react": "^4.7.0",
|
"@vitejs/plugin-react": "^4.7.0",
|
||||||
|
|
|
||||||
|
|
@ -143,6 +143,8 @@ export interface StoreListItem extends Store {
|
||||||
export interface StoreDetail extends Store {
|
export interface StoreDetail extends Store {
|
||||||
counts: { cards: number; staff: number; transactions: number };
|
counts: { cards: number; staff: number; transactions: number };
|
||||||
subscription: { status: SubscriptionStatus } | null;
|
subscription: { status: SubscriptionStatus } | null;
|
||||||
|
/** Lien encodé dans le QR d'inscription. */
|
||||||
|
enrollUrl: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type PointsMode = 'AMOUNT' | 'STAMP';
|
export type PointsMode = 'AMOUNT' | 'STAMP';
|
||||||
|
|
|
||||||
76
admin/src/components/Poster.tsx
Normal file
76
admin/src/components/Poster.tsx
Normal file
|
|
@ -0,0 +1,76 @@
|
||||||
|
import { useEffect, useState } from 'react';
|
||||||
|
import QRCode from 'qrcode';
|
||||||
|
|
||||||
|
export type PosterFormat = 'A5' | 'A6';
|
||||||
|
|
||||||
|
export interface PosterProps {
|
||||||
|
format: PosterFormat;
|
||||||
|
url: string;
|
||||||
|
storeName: string;
|
||||||
|
programName: string;
|
||||||
|
logoUrl: string | null;
|
||||||
|
backgroundColor: string;
|
||||||
|
foregroundColor: string;
|
||||||
|
labelColor: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Dimensions en mm (impression) et tailles de texte, d'après la maquette « Affichette comptoir ». */
|
||||||
|
const SIZES = {
|
||||||
|
A5: { w: 148, h: 210, pad: 12, logo: 14, store: 6, eyebrow: 3.8, title: 10, qr: 66, body: 4.5, small: 4 },
|
||||||
|
A6: { w: 105, h: 148, pad: 8, logo: 10, store: 4.5, eyebrow: 3, title: 7, qr: 46, body: 3.4, small: 3.1 },
|
||||||
|
};
|
||||||
|
|
||||||
|
export function Poster(p: PosterProps) {
|
||||||
|
const s = SIZES[p.format];
|
||||||
|
const [svg, setSvg] = useState('');
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
// Correction d'erreur élevée : le QR reste lisible même un peu abîmé ou mal éclairé.
|
||||||
|
QRCode.toString(p.url, { type: 'svg', errorCorrectionLevel: 'Q', margin: 0, color: { dark: '#111111', light: '#FFFFFF' } }).then(setSvg);
|
||||||
|
}, [p.url]);
|
||||||
|
|
||||||
|
const mm = (v: number) => `${v}mm`;
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className="poster"
|
||||||
|
style={{
|
||||||
|
width: mm(s.w),
|
||||||
|
height: mm(s.h),
|
||||||
|
padding: mm(s.pad),
|
||||||
|
boxSizing: 'border-box',
|
||||||
|
background: p.backgroundColor,
|
||||||
|
color: p.foregroundColor,
|
||||||
|
fontFamily: "'Figtree', system-ui, sans-serif",
|
||||||
|
display: 'flex',
|
||||||
|
flexDirection: 'column',
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'space-between',
|
||||||
|
textAlign: 'center',
|
||||||
|
overflow: 'hidden',
|
||||||
|
printColorAdjust: 'exact',
|
||||||
|
WebkitPrintColorAdjust: 'exact',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div style={{ display: 'flex', alignItems: 'center', gap: mm(3) }}>
|
||||||
|
{p.logoUrl && <img src={p.logoUrl} alt="" style={{ width: mm(s.logo), height: mm(s.logo), objectFit: 'contain', borderRadius: mm(2.5), background: '#fff' }} />}
|
||||||
|
<span style={{ fontSize: mm(s.store), fontWeight: 700 }}>{p.storeName}</span>
|
||||||
|
</div>
|
||||||
|
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', gap: mm(2.5) }}>
|
||||||
|
<span style={{ fontSize: mm(s.eyebrow), fontWeight: 700, letterSpacing: '0.1em', textTransform: 'uppercase', color: p.labelColor }}>{p.programName}</span>
|
||||||
|
<span style={{ fontSize: mm(s.title), lineHeight: 1.12, fontWeight: 800, letterSpacing: '-0.02em', maxWidth: '92%' }}>
|
||||||
|
Scannez pour obtenir votre carte de fidélité
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
role="img"
|
||||||
|
aria-label="QR code d'inscription"
|
||||||
|
style={{ background: '#fff', borderRadius: mm(3.5), padding: mm(4), width: mm(s.qr), height: mm(s.qr), boxSizing: 'content-box' }}
|
||||||
|
dangerouslySetInnerHTML={{ __html: svg }}
|
||||||
|
/>
|
||||||
|
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', gap: mm(1.5) }}>
|
||||||
|
<span style={{ fontSize: mm(s.body), lineHeight: 1.4, fontWeight: 600 }}>Ajoutez-la à Apple Wallet ou Google Wallet.</span>
|
||||||
|
<span style={{ fontSize: mm(s.small), lineHeight: 1.4, color: p.labelColor }}>Gratuit, sans application à télécharger.</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -7,6 +7,7 @@ import { LoginPage } from './pages/LoginPage';
|
||||||
import { StoresPage } from './pages/StoresPage';
|
import { StoresPage } from './pages/StoresPage';
|
||||||
import { NewStorePage } from './pages/NewStorePage';
|
import { NewStorePage } from './pages/NewStorePage';
|
||||||
import { StorePage } from './pages/StorePage';
|
import { StorePage } from './pages/StorePage';
|
||||||
|
import { PosterPage } from './pages/PosterPage';
|
||||||
import './styles.css';
|
import './styles.css';
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
|
|
@ -30,6 +31,7 @@ function App() {
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<Routes>
|
<Routes>
|
||||||
|
<Route path="/magasins/:id/affichette" element={<PosterPage />} />
|
||||||
<Route element={<Layout />}>
|
<Route element={<Layout />}>
|
||||||
<Route path="/magasins" element={<StoresPage />} />
|
<Route path="/magasins" element={<StoresPage />} />
|
||||||
<Route path="/magasins/nouveau" element={<NewStorePage />} />
|
<Route path="/magasins/nouveau" element={<NewStorePage />} />
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
import { ChangeEvent, useEffect, useState } from 'react';
|
import { ChangeEvent, useEffect, useState } from 'react';
|
||||||
import { api, assetUrl, CardDesign, Reward, StoreDetail } from '../api';
|
import { api, assetUrl, CardDesign, Reward, StoreDetail } from '../api';
|
||||||
|
import { Link } from 'react-router-dom';
|
||||||
import { ApplePreview, GooglePreview } from '../components/WalletPreview';
|
import { ApplePreview, GooglePreview } from '../components/WalletPreview';
|
||||||
|
import { Poster } from '../components/Poster';
|
||||||
import { contrast, dominantColor, prepareLogo, prepareStrip } from '../components/images';
|
import { contrast, dominantColor, prepareLogo, prepareStrip } from '../components/images';
|
||||||
|
|
||||||
const STEPS = ['Identité', 'Couleurs', 'Règle de points', 'Récompenses', 'Récapitulatif'];
|
const STEPS = ['Identité', 'Couleurs', 'Règle de points', 'Récompenses', 'Récapitulatif'];
|
||||||
|
|
@ -230,10 +232,34 @@ export function CardWizard({ store, onSaved }: { store: StoreDetail; onSaved: ()
|
||||||
<li>Récompenses : {draft.rewards.filter((r) => r.active !== false).map((r) => `${r.label} (${r.cost})`).join(', ') || 'aucune'}</li>
|
<li>Récompenses : {draft.rewards.filter((r) => r.active !== false).map((r) => `${r.label} (${r.cost})`).join(', ') || 'aucune'}</li>
|
||||||
<li>Logo : {images.logoUrl ? 'oui' : <span style={{ color: 'var(--warn)' }}>manquant</span>} · Bandeau : {images.stripUrl ? 'oui' : 'non'}</li>
|
<li>Logo : {images.logoUrl ? 'oui' : <span style={{ color: 'var(--warn)' }}>manquant</span>} · Bandeau : {images.stripUrl ? 'oui' : 'non'}</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p className="muted" style={{ margin: 0 }}>
|
<h3 style={{ margin: '8px 0 0' }}>Affichette du comptoir</h3>
|
||||||
Le QR d'inscription imprimable sera disponible ici dès que la page d'inscription client sera en place.
|
<div style={{ display: 'flex', gap: 24, flexWrap: 'wrap', alignItems: 'flex-start' }}>
|
||||||
</p>
|
<div style={{ width: 222, height: 315, overflow: 'hidden', borderRadius: 8, boxShadow: '0 4px 16px rgb(0 0 0 / 0.15)' }}>
|
||||||
{store.status === 'DRAFT' && <p style={{ margin: 0 }}>Utilisez le bouton <strong>Activer</strong> en haut de la fiche pour ouvrir le programme.</p>}
|
{/* Aperçu réduit de l'affichette A5 (148 mm → 222 px) */}
|
||||||
|
<div style={{ transform: 'scale(0.4)', transformOrigin: 'top left' }}>
|
||||||
|
<Poster
|
||||||
|
format="A5"
|
||||||
|
url={store.enrollUrl}
|
||||||
|
storeName={store.name}
|
||||||
|
programName={draft.programName}
|
||||||
|
logoUrl={images.logoUrl}
|
||||||
|
backgroundColor={draft.backgroundColor}
|
||||||
|
foregroundColor={draft.foregroundColor}
|
||||||
|
labelColor={draft.labelColor}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div style={{ display: 'flex', flexDirection: 'column', gap: 12, flex: '1 1 220px' }}>
|
||||||
|
<p style={{ margin: 0 }}>Le QR mène à la page d'inscription :</p>
|
||||||
|
<a href={store.enrollUrl} target="_blank" rel="noreferrer" style={{ wordBreak: 'break-all' }}>{store.enrollUrl}</a>
|
||||||
|
<Link to={`/magasins/${store.id}/affichette`} className="btn secondary">Imprimer l'affichette (A5 / A6)</Link>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{store.status === 'DRAFT' && (
|
||||||
|
<p style={{ margin: 0 }}>
|
||||||
|
Utilisez le bouton <strong>Activer</strong> en haut de la fiche pour ouvrir le programme (logo obligatoire).
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|
|
||||||
60
admin/src/pages/PosterPage.tsx
Normal file
60
admin/src/pages/PosterPage.tsx
Normal file
|
|
@ -0,0 +1,60 @@
|
||||||
|
import { useEffect, useState } from 'react';
|
||||||
|
import { Link, useParams, useSearchParams } from 'react-router-dom';
|
||||||
|
import { api, assetUrl, CardDesign, StoreDetail } from '../api';
|
||||||
|
import { Poster, PosterFormat } from '../components/Poster';
|
||||||
|
|
||||||
|
/** Page d'impression de l'affichette, sans la mise en page de l'admin. */
|
||||||
|
export function PosterPage() {
|
||||||
|
const { id } = useParams<{ id: string }>();
|
||||||
|
const [params, setParams] = useSearchParams();
|
||||||
|
const format: PosterFormat = params.get('format') === 'A6' ? 'A6' : 'A5';
|
||||||
|
const [store, setStore] = useState<StoreDetail | null>(null);
|
||||||
|
const [design, setDesign] = useState<CardDesign | null>(null);
|
||||||
|
const [error, setError] = useState<string | null>(null);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
Promise.all([api.get<StoreDetail>(`/api/admin/stores/${id}`), api.get<CardDesign | null>(`/api/admin/stores/${id}/card-design`)])
|
||||||
|
.then(([s, d]) => {
|
||||||
|
setStore(s);
|
||||||
|
setDesign(d);
|
||||||
|
})
|
||||||
|
.catch((e) => setError(e.message));
|
||||||
|
}, [id]);
|
||||||
|
|
||||||
|
if (error) return <div className="alert error" style={{ margin: 24 }}>{error}</div>;
|
||||||
|
if (!store) return <p className="muted" style={{ margin: 24 }}>Chargement…</p>;
|
||||||
|
if (!design) return <div className="alert warn" style={{ margin: 24 }}>Concevez d'abord la carte de fidélité.</div>;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="poster-page">
|
||||||
|
<style>{`@page{size:${format};margin:0}@media print{.no-print{display:none!important}body{background:#fff}.poster-page{padding:0!important}}`}</style>
|
||||||
|
<div className="no-print row between" style={{ padding: 16 }}>
|
||||||
|
<Link to={`/magasins/${id}/carte`}>← Retour à la carte</Link>
|
||||||
|
<div className="row" style={{ gap: 8 }}>
|
||||||
|
{(['A5', 'A6'] as const).map((f) => (
|
||||||
|
<button key={f} type="button" className="chip" aria-pressed={format === f} onClick={() => setParams({ format: f })}>{f}</button>
|
||||||
|
))}
|
||||||
|
<button type="button" className="btn" onClick={() => window.print()}>Imprimer</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{store.status !== 'ACTIVE' && (
|
||||||
|
<div className="alert warn no-print" style={{ margin: '0 16px 16px' }}>
|
||||||
|
Le magasin n'est pas actif : le QR mène pour l'instant à une page « introuvable » ou « indisponible ».
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
<div style={{ display: 'flex', justifyContent: 'center', padding: 16 }} className="poster-page">
|
||||||
|
<Poster
|
||||||
|
format={format}
|
||||||
|
url={store.enrollUrl}
|
||||||
|
storeName={store.name}
|
||||||
|
programName={design.programName}
|
||||||
|
logoUrl={assetUrl(design.logoUrl)}
|
||||||
|
backgroundColor={design.backgroundColor}
|
||||||
|
foregroundColor={design.foregroundColor}
|
||||||
|
labelColor={design.labelColor}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<p className="no-print muted" style={{ textAlign: 'center' }}>{store.enrollUrl}</p>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -7,3 +7,25 @@ JWT_REFRESH_SECRET=dev-refresh-secret
|
||||||
CORS_ORIGINS=http://localhost:5173
|
CORS_ORIGINS=http://localhost:5173
|
||||||
SEED_ADMIN_EMAIL=
|
SEED_ADMIN_EMAIL=
|
||||||
SEED_ADMIN_PASSWORD=
|
SEED_ADMIN_PASSWORD=
|
||||||
|
|
||||||
|
# URL publique de l'API (QR d'inscription, liens e-mail, images Google Wallet) — HTTPS en production
|
||||||
|
PUBLIC_URL=http://localhost:3100
|
||||||
|
|
||||||
|
# Apple Wallet — fichiers PEM hors du dépôt (voir docs/wallet.md)
|
||||||
|
APPLE_PASS_TYPE_ID=
|
||||||
|
APPLE_TEAM_ID=
|
||||||
|
APPLE_SIGNER_CERT=
|
||||||
|
APPLE_SIGNER_KEY=
|
||||||
|
APPLE_SIGNER_KEY_PASSPHRASE=
|
||||||
|
APPLE_WWDR_CERT=
|
||||||
|
|
||||||
|
# Google Wallet
|
||||||
|
GOOGLE_WALLET_ISSUER_ID=
|
||||||
|
GOOGLE_WALLET_SA_FILE=
|
||||||
|
|
||||||
|
# E-mails (sans SMTP_HOST, les e-mails sont écrits dans les logs)
|
||||||
|
SMTP_HOST=
|
||||||
|
SMTP_PORT=587
|
||||||
|
SMTP_USER=
|
||||||
|
SMTP_PASS=
|
||||||
|
MAIL_FROM="MonEspacePro <no-reply@exemple.fr>"
|
||||||
|
|
|
||||||
823
backend/package-lock.json
generated
823
backend/package-lock.json
generated
|
|
@ -22,6 +22,10 @@
|
||||||
"class-transformer": "^0.5.1",
|
"class-transformer": "^0.5.1",
|
||||||
"class-validator": "^0.14.1",
|
"class-validator": "^0.14.1",
|
||||||
"helmet": "^8.3.0",
|
"helmet": "^8.3.0",
|
||||||
|
"jimp": "^1.6.1",
|
||||||
|
"jose": "^6.2.12",
|
||||||
|
"nodemailer": "^7.0.13",
|
||||||
|
"passkit-generator": "^3.6.1",
|
||||||
"passport": "^0.7.0",
|
"passport": "^0.7.0",
|
||||||
"passport-jwt": "^4.0.1",
|
"passport-jwt": "^4.0.1",
|
||||||
"reflect-metadata": "^0.2.2",
|
"reflect-metadata": "^0.2.2",
|
||||||
|
|
@ -33,6 +37,7 @@
|
||||||
"@types/express": "^5.0.0",
|
"@types/express": "^5.0.0",
|
||||||
"@types/multer": "^2.3.0",
|
"@types/multer": "^2.3.0",
|
||||||
"@types/node": "^22.7.4",
|
"@types/node": "^22.7.4",
|
||||||
|
"@types/nodemailer": "^8.0.2",
|
||||||
"@types/passport-jwt": "^4.0.1",
|
"@types/passport-jwt": "^4.0.1",
|
||||||
"prisma": "^5.20.0",
|
"prisma": "^5.20.0",
|
||||||
"ts-node": "^10.9.2",
|
"ts-node": "^10.9.2",
|
||||||
|
|
@ -258,6 +263,21 @@
|
||||||
"node": ">=12"
|
"node": ">=12"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@hapi/hoek": {
|
||||||
|
"version": "9.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.3.0.tgz",
|
||||||
|
"integrity": "sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ==",
|
||||||
|
"license": "BSD-3-Clause"
|
||||||
|
},
|
||||||
|
"node_modules/@hapi/topo": {
|
||||||
|
"version": "5.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-5.1.0.tgz",
|
||||||
|
"integrity": "sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg==",
|
||||||
|
"license": "BSD-3-Clause",
|
||||||
|
"dependencies": {
|
||||||
|
"@hapi/hoek": "^9.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@isaacs/cliui": {
|
"node_modules/@isaacs/cliui": {
|
||||||
"version": "8.0.2",
|
"version": "8.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz",
|
||||||
|
|
@ -361,6 +381,488 @@
|
||||||
"url": "https://github.com/chalk/wrap-ansi?sponsor=1"
|
"url": "https://github.com/chalk/wrap-ansi?sponsor=1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@jimp/core": {
|
||||||
|
"version": "1.6.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@jimp/core/-/core-1.6.1.tgz",
|
||||||
|
"integrity": "sha512-+BoKC5G6hkrSy501zcJ2EpfnllP+avPevcBfRcZe/CW+EwEfY6X1EZ8QWyT7NpDIvEEJb1fdJnMMfUnFkxmw9A==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@jimp/file-ops": "1.6.1",
|
||||||
|
"@jimp/types": "1.6.1",
|
||||||
|
"@jimp/utils": "1.6.1",
|
||||||
|
"await-to-js": "^3.0.0",
|
||||||
|
"exif-parser": "^0.1.12",
|
||||||
|
"file-type": "^21.3.3",
|
||||||
|
"mime": "3"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@jimp/core/node_modules/@tokenizer/inflate": {
|
||||||
|
"version": "0.4.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@tokenizer/inflate/-/inflate-0.4.1.tgz",
|
||||||
|
"integrity": "sha512-2mAv+8pkG6GIZiF1kNg1jAjh27IDxEPKwdGul3snfztFerfPGI1LjDezZp3i7BElXompqEtPmoPx6c2wgtWsOA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"debug": "^4.4.3",
|
||||||
|
"token-types": "^6.1.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/Borewit"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@jimp/core/node_modules/debug": {
|
||||||
|
"version": "4.4.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
|
||||||
|
"integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"ms": "^2.1.3"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"supports-color": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@jimp/core/node_modules/file-type": {
|
||||||
|
"version": "21.3.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/file-type/-/file-type-21.3.4.tgz",
|
||||||
|
"integrity": "sha512-Ievi/yy8DS3ygGvT47PjSfdFoX+2isQueoYP1cntFW1JLYAuS4GD7NUPGg4zv2iZfV52uDyk5w5Z0TdpRS6Q1g==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@tokenizer/inflate": "^0.4.1",
|
||||||
|
"strtok3": "^10.3.4",
|
||||||
|
"token-types": "^6.1.1",
|
||||||
|
"uint8array-extras": "^1.4.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=20"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sindresorhus/file-type?sponsor=1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@jimp/core/node_modules/mime": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/mime/-/mime-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==",
|
||||||
|
"license": "MIT",
|
||||||
|
"bin": {
|
||||||
|
"mime": "cli.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@jimp/core/node_modules/ms": {
|
||||||
|
"version": "2.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
||||||
|
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/@jimp/diff": {
|
||||||
|
"version": "1.6.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@jimp/diff/-/diff-1.6.1.tgz",
|
||||||
|
"integrity": "sha512-YkKDPdHjLgo1Api3+Bhc0GLAygldlpt97NfOKoNg1U6IUNXA6X2MgosCjPfSBiSvJvrrz1fsIR+/4cfYXBI/HQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@jimp/plugin-resize": "1.6.1",
|
||||||
|
"@jimp/types": "1.6.1",
|
||||||
|
"@jimp/utils": "1.6.1",
|
||||||
|
"pixelmatch": "^5.3.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@jimp/file-ops": {
|
||||||
|
"version": "1.6.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@jimp/file-ops/-/file-ops-1.6.1.tgz",
|
||||||
|
"integrity": "sha512-T+gX6osHjprbDRad0/B71Evyre7ZdVY1z/gFGEG9Z8KOtZPKboWvPeP2UjbZYWQLy9UKCPQX1FNAnDiOPkJL7w==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@jimp/js-bmp": {
|
||||||
|
"version": "1.6.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@jimp/js-bmp/-/js-bmp-1.6.1.tgz",
|
||||||
|
"integrity": "sha512-xzWzNT4/u5zGrTT3Tme9sGU7YzIKxi13+BCQwLqACbt5DXf9SAfdzRkopZQnmDko+6In5nqaT89Gjs43/WdnYQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@jimp/core": "1.6.1",
|
||||||
|
"@jimp/types": "1.6.1",
|
||||||
|
"@jimp/utils": "1.6.1",
|
||||||
|
"bmp-ts": "^1.0.9"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@jimp/js-gif": {
|
||||||
|
"version": "1.6.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@jimp/js-gif/-/js-gif-1.6.1.tgz",
|
||||||
|
"integrity": "sha512-YjY2W26rQa05XhanYhRZ7dingCiNN+T2Ymb1JiigIbABY0B28wHE3v3Cf1/HZPWGu0hOg36ylaKgV5KxF2M58w==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@jimp/core": "1.6.1",
|
||||||
|
"@jimp/types": "1.6.1",
|
||||||
|
"gifwrap": "^0.10.1",
|
||||||
|
"omggif": "^1.0.10"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@jimp/js-jpeg": {
|
||||||
|
"version": "1.6.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@jimp/js-jpeg/-/js-jpeg-1.6.1.tgz",
|
||||||
|
"integrity": "sha512-HT9H3yOmlOFzYmdI15IYdfy6ggQhSRIaHeA+OTJSEORXBqEo97sUZu/DsgHIcX5NJ7TkJBTgZ9BZXsV6UbsyMg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@jimp/core": "1.6.1",
|
||||||
|
"@jimp/types": "1.6.1",
|
||||||
|
"jpeg-js": "^0.4.4"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@jimp/js-png": {
|
||||||
|
"version": "1.6.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@jimp/js-png/-/js-png-1.6.1.tgz",
|
||||||
|
"integrity": "sha512-SZ/KVhI5UjcSzzlXsXdIi/LhJ7UShf2NkMOtVrbZQcGzsqNtynAelrOXeoTxcanfVqmNhAoVHg8yR2cYoqrYjA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@jimp/core": "1.6.1",
|
||||||
|
"@jimp/types": "1.6.1",
|
||||||
|
"pngjs": "^7.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@jimp/js-tiff": {
|
||||||
|
"version": "1.6.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@jimp/js-tiff/-/js-tiff-1.6.1.tgz",
|
||||||
|
"integrity": "sha512-jDG/eJquID1M4MBlKMmDRBmz2TpXMv7TUyu2nIRUxhlUc2ogC82T+VQUkca9GJH1BBJ9dx5sSE5dGkWNjIbZxw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@jimp/core": "1.6.1",
|
||||||
|
"@jimp/types": "1.6.1",
|
||||||
|
"utif2": "^4.1.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@jimp/plugin-blit": {
|
||||||
|
"version": "1.6.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@jimp/plugin-blit/-/plugin-blit-1.6.1.tgz",
|
||||||
|
"integrity": "sha512-MwnI7C7K81uWddY9FLw1fCOIy6SsPIUftUz36Spt7jisCn8/40DhQMlSxpxTNelnZb/2SnloFimQfRZAmHLOqQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@jimp/types": "1.6.1",
|
||||||
|
"@jimp/utils": "1.6.1",
|
||||||
|
"zod": "^3.23.8"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@jimp/plugin-blur": {
|
||||||
|
"version": "1.6.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@jimp/plugin-blur/-/plugin-blur-1.6.1.tgz",
|
||||||
|
"integrity": "sha512-lIo7Tzp5jQu30EFFSK/phXANK3citKVEjepDjQ6ljHoIFtuMRrnybnmI2Md24ulvWlDaz+hh3n6qrMb8ydwhZQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@jimp/core": "1.6.1",
|
||||||
|
"@jimp/utils": "1.6.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@jimp/plugin-circle": {
|
||||||
|
"version": "1.6.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@jimp/plugin-circle/-/plugin-circle-1.6.1.tgz",
|
||||||
|
"integrity": "sha512-kK1PavY6cKHNNKce37vdV4Tmpc1/zDKngGoeOV3j+EMatoHFZUinV3s6F9aWryPs3A0xhCLZgdJ6Zeea1d5LCQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@jimp/types": "1.6.1",
|
||||||
|
"zod": "^3.23.8"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@jimp/plugin-color": {
|
||||||
|
"version": "1.6.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@jimp/plugin-color/-/plugin-color-1.6.1.tgz",
|
||||||
|
"integrity": "sha512-LtUN1vAP+LRlZAtTNVhDRSiXx+26Kbz3zJaG6a5k59gQ95jgT5mknnF8lxkHcqJthM4MEk3/tPxkdJpEybyF/A==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@jimp/core": "1.6.1",
|
||||||
|
"@jimp/types": "1.6.1",
|
||||||
|
"@jimp/utils": "1.6.1",
|
||||||
|
"tinycolor2": "^1.6.0",
|
||||||
|
"zod": "^3.23.8"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@jimp/plugin-contain": {
|
||||||
|
"version": "1.6.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@jimp/plugin-contain/-/plugin-contain-1.6.1.tgz",
|
||||||
|
"integrity": "sha512-m0qhrfA8jkTqretGv4w+T/ADFR4GwBpE0sCOC2uJ0dzr44/ddOMsIdrpi89kabqYiPYIrxkgdCVCLm3zn1Vkkg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@jimp/core": "1.6.1",
|
||||||
|
"@jimp/plugin-blit": "1.6.1",
|
||||||
|
"@jimp/plugin-resize": "1.6.1",
|
||||||
|
"@jimp/types": "1.6.1",
|
||||||
|
"@jimp/utils": "1.6.1",
|
||||||
|
"zod": "^3.23.8"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@jimp/plugin-cover": {
|
||||||
|
"version": "1.6.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@jimp/plugin-cover/-/plugin-cover-1.6.1.tgz",
|
||||||
|
"integrity": "sha512-hZytnsth0zoll6cPf434BrT+p/v569Wr5tyO6Dp0dH1IDPhzhB5F38sZGMLDo7bzQiN9JFVB3fxkcJ/WYCJ3Mg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@jimp/core": "1.6.1",
|
||||||
|
"@jimp/plugin-crop": "1.6.1",
|
||||||
|
"@jimp/plugin-resize": "1.6.1",
|
||||||
|
"@jimp/types": "1.6.1",
|
||||||
|
"zod": "^3.23.8"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@jimp/plugin-crop": {
|
||||||
|
"version": "1.6.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@jimp/plugin-crop/-/plugin-crop-1.6.1.tgz",
|
||||||
|
"integrity": "sha512-EerRSLlclXyKDnYc/H9w/1amZW7b7v3OGi/VlerPd2M/pAu5X8TkyYWtfqYCXnNp1Ixtd8oCo9zGfY9zoXT4rg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@jimp/core": "1.6.1",
|
||||||
|
"@jimp/types": "1.6.1",
|
||||||
|
"@jimp/utils": "1.6.1",
|
||||||
|
"zod": "^3.23.8"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@jimp/plugin-displace": {
|
||||||
|
"version": "1.6.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@jimp/plugin-displace/-/plugin-displace-1.6.1.tgz",
|
||||||
|
"integrity": "sha512-K07QVl7xQwIfD6KfxRV/c3E9e7ZBXxUXdWuvoTWcKHL2qV48MOF5Nqbz/aJW4ThnQARIsxvYlZjPFiqkCjlU+g==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@jimp/types": "1.6.1",
|
||||||
|
"@jimp/utils": "1.6.1",
|
||||||
|
"zod": "^3.23.8"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@jimp/plugin-dither": {
|
||||||
|
"version": "1.6.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@jimp/plugin-dither/-/plugin-dither-1.6.1.tgz",
|
||||||
|
"integrity": "sha512-+2V+GCV2WycMoX1/z977TkZ8Zq/4MVSKElHYatgUqtwXMi2fDK2gKYU2g9V39IqFvTJsTIsK0+58VFz/ROBVew==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@jimp/types": "1.6.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@jimp/plugin-fisheye": {
|
||||||
|
"version": "1.6.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@jimp/plugin-fisheye/-/plugin-fisheye-1.6.1.tgz",
|
||||||
|
"integrity": "sha512-XtS5ZyoZ0vxZxJ6gkqI63SivhtI58vX95foMPM+cyzYkRsJXMOYCr8DScxF5bp4Xr003NjYm/P+7+08tibwzHA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@jimp/types": "1.6.1",
|
||||||
|
"@jimp/utils": "1.6.1",
|
||||||
|
"zod": "^3.23.8"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@jimp/plugin-flip": {
|
||||||
|
"version": "1.6.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@jimp/plugin-flip/-/plugin-flip-1.6.1.tgz",
|
||||||
|
"integrity": "sha512-ws38W/sGj7LobNRayQ83garxiktOyWxM5vO/y4a/2cy9v65SLEUzVkrj+oeAaUSSObdz4HcCEla7XtGlnAGAaA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@jimp/types": "1.6.1",
|
||||||
|
"zod": "^3.23.8"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@jimp/plugin-hash": {
|
||||||
|
"version": "1.6.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@jimp/plugin-hash/-/plugin-hash-1.6.1.tgz",
|
||||||
|
"integrity": "sha512-sZt6ZcMX6i8vFWb4GYnw0pR/o9++ef0dTVcboTB5B/g7nrxCODIB4wfEkJ/YqZM5wUvol77K1qeS0/rVO6z21A==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@jimp/core": "1.6.1",
|
||||||
|
"@jimp/js-bmp": "1.6.1",
|
||||||
|
"@jimp/js-jpeg": "1.6.1",
|
||||||
|
"@jimp/js-png": "1.6.1",
|
||||||
|
"@jimp/js-tiff": "1.6.1",
|
||||||
|
"@jimp/plugin-color": "1.6.1",
|
||||||
|
"@jimp/plugin-resize": "1.6.1",
|
||||||
|
"@jimp/types": "1.6.1",
|
||||||
|
"@jimp/utils": "1.6.1",
|
||||||
|
"any-base": "^1.1.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@jimp/plugin-mask": {
|
||||||
|
"version": "1.6.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@jimp/plugin-mask/-/plugin-mask-1.6.1.tgz",
|
||||||
|
"integrity": "sha512-SIG0/FcmEj3tkwFxc7fAGLO8o4uNzMpSOdQOhbCgxefQKq5wOVMk9BQx/sdMPBwtMLr9WLq0GzLA/rk6t2v20A==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@jimp/types": "1.6.1",
|
||||||
|
"zod": "^3.23.8"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@jimp/plugin-print": {
|
||||||
|
"version": "1.6.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@jimp/plugin-print/-/plugin-print-1.6.1.tgz",
|
||||||
|
"integrity": "sha512-BYVz/X3Xzv8XYilVeDy11NOp0h7BTDjlOtu0BekIFHP1yHVd24AXNzbOy52XlzYZWQ0Dl36HOHEpl/nSNrzc6w==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@jimp/core": "1.6.1",
|
||||||
|
"@jimp/js-jpeg": "1.6.1",
|
||||||
|
"@jimp/js-png": "1.6.1",
|
||||||
|
"@jimp/plugin-blit": "1.6.1",
|
||||||
|
"@jimp/types": "1.6.1",
|
||||||
|
"parse-bmfont-ascii": "^1.0.6",
|
||||||
|
"parse-bmfont-binary": "^1.0.6",
|
||||||
|
"parse-bmfont-xml": "^1.1.6",
|
||||||
|
"simple-xml-to-json": "^1.2.2",
|
||||||
|
"zod": "^3.23.8"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@jimp/plugin-quantize": {
|
||||||
|
"version": "1.6.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@jimp/plugin-quantize/-/plugin-quantize-1.6.1.tgz",
|
||||||
|
"integrity": "sha512-J2En9PLURfP+vwYDtuZ9T8yBW6BWYZBScydAjRiPBmJfEhTcNQqiiQODrZf7EqbbX/Sy5H6dAeRiqkgoV9N6Ww==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"image-q": "^4.0.0",
|
||||||
|
"zod": "^3.23.8"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@jimp/plugin-resize": {
|
||||||
|
"version": "1.6.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@jimp/plugin-resize/-/plugin-resize-1.6.1.tgz",
|
||||||
|
"integrity": "sha512-CLkrtJoIz2HdWnpYiN6p8KYcPc00rCH/SUu6o+lfZL05Q4uhecJlnvXuj9x+U6mDn3ldPmJj6aZqMHuUJzdVqg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@jimp/core": "1.6.1",
|
||||||
|
"@jimp/types": "1.6.1",
|
||||||
|
"zod": "^3.23.8"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@jimp/plugin-rotate": {
|
||||||
|
"version": "1.6.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@jimp/plugin-rotate/-/plugin-rotate-1.6.1.tgz",
|
||||||
|
"integrity": "sha512-nOjVjbbj705B02ksysKnh0POAwEBXZtJ9zQ5qC+X7Tavl3JNn+P3BzQovbBxLPSbUSld6XID9z5ijin4PtOAUg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@jimp/core": "1.6.1",
|
||||||
|
"@jimp/plugin-crop": "1.6.1",
|
||||||
|
"@jimp/plugin-resize": "1.6.1",
|
||||||
|
"@jimp/types": "1.6.1",
|
||||||
|
"@jimp/utils": "1.6.1",
|
||||||
|
"zod": "^3.23.8"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@jimp/plugin-threshold": {
|
||||||
|
"version": "1.6.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@jimp/plugin-threshold/-/plugin-threshold-1.6.1.tgz",
|
||||||
|
"integrity": "sha512-JOKv9F8s6tnVLf4sB/2fF0F339EFnHvgEdFYugO6VhowKLsap0pEZmLyE/DlRnYtIj2RddHZVxVMp/eKJ04l2Q==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@jimp/core": "1.6.1",
|
||||||
|
"@jimp/plugin-color": "1.6.1",
|
||||||
|
"@jimp/plugin-hash": "1.6.1",
|
||||||
|
"@jimp/types": "1.6.1",
|
||||||
|
"@jimp/utils": "1.6.1",
|
||||||
|
"zod": "^3.23.8"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@jimp/types": {
|
||||||
|
"version": "1.6.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@jimp/types/-/types-1.6.1.tgz",
|
||||||
|
"integrity": "sha512-leI7YbveTNi565m910XgIOwXyuu074H5qazAD1357HImJSv2hqxnWXpwxQbadGWZ7goZRYBDZy5lpqud0p7q5w==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"zod": "^3.23.8"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@jimp/utils": {
|
||||||
|
"version": "1.6.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@jimp/utils/-/utils-1.6.1.tgz",
|
||||||
|
"integrity": "sha512-veFPRd93FCnS7AgmCkPgARVGoDRrJ9cm1ujuNyA+UfQ5VKbED2002sm5XfFLFwTsKC8j04heTrwe+tU1dluXOw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@jimp/types": "1.6.1",
|
||||||
|
"tinycolor2": "^1.6.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@jridgewell/gen-mapping": {
|
"node_modules/@jridgewell/gen-mapping": {
|
||||||
"version": "0.3.13",
|
"version": "0.3.13",
|
||||||
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz",
|
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz",
|
||||||
|
|
@ -806,6 +1308,27 @@
|
||||||
"@prisma/debug": "5.22.0"
|
"@prisma/debug": "5.22.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@sideway/address": {
|
||||||
|
"version": "4.1.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.5.tgz",
|
||||||
|
"integrity": "sha512-IqO/DUQHUkPeixNQ8n0JA6102hT9CmaljNTPmQ1u8MEhBo/R4Q8eKLN/vGZxuebwOroDB4cbpjheD4+/sKFK4Q==",
|
||||||
|
"license": "BSD-3-Clause",
|
||||||
|
"dependencies": {
|
||||||
|
"@hapi/hoek": "^9.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@sideway/formula": {
|
||||||
|
"version": "3.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@sideway/formula/-/formula-3.0.1.tgz",
|
||||||
|
"integrity": "sha512-/poHZJJVjx3L+zVD6g9KgHfYnb443oi7wLu/XKojDviHy6HOEOA6z1Trk5aR1dGcmPenJEgb2sK2I80LeS3MIg==",
|
||||||
|
"license": "BSD-3-Clause"
|
||||||
|
},
|
||||||
|
"node_modules/@sideway/pinpoint": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@sideway/pinpoint/-/pinpoint-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==",
|
||||||
|
"license": "BSD-3-Clause"
|
||||||
|
},
|
||||||
"node_modules/@tokenizer/inflate": {
|
"node_modules/@tokenizer/inflate": {
|
||||||
"version": "0.2.7",
|
"version": "0.2.7",
|
||||||
"resolved": "https://registry.npmjs.org/@tokenizer/inflate/-/inflate-0.2.7.tgz",
|
"resolved": "https://registry.npmjs.org/@tokenizer/inflate/-/inflate-0.2.7.tgz",
|
||||||
|
|
@ -998,6 +1521,16 @@
|
||||||
"undici-types": "~6.21.0"
|
"undici-types": "~6.21.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/nodemailer": {
|
||||||
|
"version": "8.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/nodemailer/-/nodemailer-8.0.2.tgz",
|
||||||
|
"integrity": "sha512-c7M5ox8p0nEOfbJ2E9Qcmt8/QCu/VzsiAhzBiZbvky2PhKZDHpKB3sQHBM5MEZNkCfBOaS6S9//AGPRTNB7IaA==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@types/node": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@types/passport": {
|
"node_modules/@types/passport": {
|
||||||
"version": "1.0.17",
|
"version": "1.0.17",
|
||||||
"resolved": "https://registry.npmjs.org/@types/passport/-/passport-1.0.17.tgz",
|
"resolved": "https://registry.npmjs.org/@types/passport/-/passport-1.0.17.tgz",
|
||||||
|
|
@ -1384,6 +1917,12 @@
|
||||||
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
|
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/any-base": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/any-base/-/any-base-1.1.0.tgz",
|
||||||
|
"integrity": "sha512-uMgjozySS8adZZYePpaWs8cxB9/kdzmpX6SgJZ+wbz1K5eYk5QMYDVJaZKhxyIHUdnnJkfR7SVgStgH7LkGUyg==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/anymatch": {
|
"node_modules/anymatch": {
|
||||||
"version": "3.1.3",
|
"version": "3.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz",
|
||||||
|
|
@ -1459,6 +1998,15 @@
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/await-to-js": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/await-to-js/-/await-to-js-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-zJAaP9zxTcvTHRlejau3ZOY4V7SRpiByf3/dxx2uyKxxor19tpmpV2QRsTKikckwhaPmr2dVpxxMr7jOCYVp5g==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/balanced-match": {
|
"node_modules/balanced-match": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
|
||||||
|
|
@ -1525,6 +2073,12 @@
|
||||||
"readable-stream": "^3.4.0"
|
"readable-stream": "^3.4.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/bmp-ts": {
|
||||||
|
"version": "1.0.9",
|
||||||
|
"resolved": "https://registry.npmjs.org/bmp-ts/-/bmp-ts-1.0.9.tgz",
|
||||||
|
"integrity": "sha512-cTEHk2jLrPyi+12M3dhpEbnnPOsaZuq7C45ylbbQIiWgDFZq4UVYPEY5mlqjvsj/6gJv9qX5sa+ebDzLXT28Vw==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/body-parser": {
|
"node_modules/body-parser": {
|
||||||
"version": "1.20.4",
|
"version": "1.20.4",
|
||||||
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.4.tgz",
|
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.4.tgz",
|
||||||
|
|
@ -2137,6 +2691,12 @@
|
||||||
"node": ">=0.3.1"
|
"node": ">=0.3.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/do-not-zip": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/do-not-zip/-/do-not-zip-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-Pgd81ET43bhAGaN2Hq1zluSX1FmD7kl7KcV9ER/lawiLsRUB9pRA5y8r6us29Xk6BrINZETO8TjhYwtwafWUww==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/dotenv": {
|
"node_modules/dotenv": {
|
||||||
"version": "16.4.5",
|
"version": "16.4.5",
|
||||||
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz",
|
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz",
|
||||||
|
|
@ -2384,6 +2944,11 @@
|
||||||
"node": ">=0.8.x"
|
"node": ">=0.8.x"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/exif-parser": {
|
||||||
|
"version": "0.1.12",
|
||||||
|
"resolved": "https://registry.npmjs.org/exif-parser/-/exif-parser-0.1.12.tgz",
|
||||||
|
"integrity": "sha512-c2bQfLNbMzLPmzQuOr8fy0csy84WmwnER81W88DzTp9CYNPJ6yzOj2EZAh9pywYpqHnshVLHQJ8WzldAyfY+Iw=="
|
||||||
|
},
|
||||||
"node_modules/express": {
|
"node_modules/express": {
|
||||||
"version": "4.22.1",
|
"version": "4.22.1",
|
||||||
"resolved": "https://registry.npmjs.org/express/-/express-4.22.1.tgz",
|
"resolved": "https://registry.npmjs.org/express/-/express-4.22.1.tgz",
|
||||||
|
|
@ -2705,6 +3270,16 @@
|
||||||
"node": ">= 0.4"
|
"node": ">= 0.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/gifwrap": {
|
||||||
|
"version": "0.10.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/gifwrap/-/gifwrap-0.10.1.tgz",
|
||||||
|
"integrity": "sha512-2760b1vpJHNmLzZ/ubTtNnEx5WApN/PYWJvXvgS+tL1egTTthayFYIQQNi136FLEDcN/IyEY2EcGpIITD6eYUw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"image-q": "^4.0.0",
|
||||||
|
"omggif": "^1.0.10"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/glob": {
|
"node_modules/glob": {
|
||||||
"version": "10.4.5",
|
"version": "10.4.5",
|
||||||
"resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz",
|
"resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz",
|
||||||
|
|
@ -2912,6 +3487,21 @@
|
||||||
],
|
],
|
||||||
"license": "BSD-3-Clause"
|
"license": "BSD-3-Clause"
|
||||||
},
|
},
|
||||||
|
"node_modules/image-q": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/image-q/-/image-q-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-PfJGVgIfKQJuq3s0tTDOKtztksibuUEbJQIYT3by6wctQo+Rdlh7ef4evJ5NCdxY4CfMbvFkocEwbl4BF8RlJw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@types/node": "16.9.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/image-q/node_modules/@types/node": {
|
||||||
|
"version": "16.9.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.9.1.tgz",
|
||||||
|
"integrity": "sha512-QpLcX9ZSsq3YYUUnD3nFDY8H7wctAhQj/TFKL8Ya8v5fMm3CFXxo8zStsLAl780ltoYoo1WvKUVGBQK+1ifr7g==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/import-fresh": {
|
"node_modules/import-fresh": {
|
||||||
"version": "3.3.1",
|
"version": "3.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz",
|
||||||
|
|
@ -3120,6 +3710,72 @@
|
||||||
"url": "https://github.com/chalk/supports-color?sponsor=1"
|
"url": "https://github.com/chalk/supports-color?sponsor=1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/jimp": {
|
||||||
|
"version": "1.6.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/jimp/-/jimp-1.6.1.tgz",
|
||||||
|
"integrity": "sha512-hNQh6rZtWfSVWSNVmvq87N5BPJsNH7k7I7qyrXf9DOma9xATQk3fsyHazCQe51nCjdkoWdTmh0vD7bjVSLoxxw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@jimp/core": "1.6.1",
|
||||||
|
"@jimp/diff": "1.6.1",
|
||||||
|
"@jimp/js-bmp": "1.6.1",
|
||||||
|
"@jimp/js-gif": "1.6.1",
|
||||||
|
"@jimp/js-jpeg": "1.6.1",
|
||||||
|
"@jimp/js-png": "1.6.1",
|
||||||
|
"@jimp/js-tiff": "1.6.1",
|
||||||
|
"@jimp/plugin-blit": "1.6.1",
|
||||||
|
"@jimp/plugin-blur": "1.6.1",
|
||||||
|
"@jimp/plugin-circle": "1.6.1",
|
||||||
|
"@jimp/plugin-color": "1.6.1",
|
||||||
|
"@jimp/plugin-contain": "1.6.1",
|
||||||
|
"@jimp/plugin-cover": "1.6.1",
|
||||||
|
"@jimp/plugin-crop": "1.6.1",
|
||||||
|
"@jimp/plugin-displace": "1.6.1",
|
||||||
|
"@jimp/plugin-dither": "1.6.1",
|
||||||
|
"@jimp/plugin-fisheye": "1.6.1",
|
||||||
|
"@jimp/plugin-flip": "1.6.1",
|
||||||
|
"@jimp/plugin-hash": "1.6.1",
|
||||||
|
"@jimp/plugin-mask": "1.6.1",
|
||||||
|
"@jimp/plugin-print": "1.6.1",
|
||||||
|
"@jimp/plugin-quantize": "1.6.1",
|
||||||
|
"@jimp/plugin-resize": "1.6.1",
|
||||||
|
"@jimp/plugin-rotate": "1.6.1",
|
||||||
|
"@jimp/plugin-threshold": "1.6.1",
|
||||||
|
"@jimp/types": "1.6.1",
|
||||||
|
"@jimp/utils": "1.6.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/joi": {
|
||||||
|
"version": "17.13.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/joi/-/joi-17.13.4.tgz",
|
||||||
|
"integrity": "sha512-1RuuER6kmt8K8I3nIWvPZKi5RQCb568ZPyY4Pwjlua+yo+63ZTmIwxLZH0heBmiKN4uxjvCiarDrjaeH84xicQ==",
|
||||||
|
"license": "BSD-3-Clause",
|
||||||
|
"dependencies": {
|
||||||
|
"@hapi/hoek": "^9.3.0",
|
||||||
|
"@hapi/topo": "^5.1.0",
|
||||||
|
"@sideway/address": "^4.1.5",
|
||||||
|
"@sideway/formula": "^3.0.1",
|
||||||
|
"@sideway/pinpoint": "^2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/jose": {
|
||||||
|
"version": "6.2.12",
|
||||||
|
"resolved": "https://registry.npmjs.org/jose/-/jose-6.2.12.tgz",
|
||||||
|
"integrity": "sha512-9NiFmJEex0sy2Dk58j2UGBSHgUs2ypF9eZSu4L6vjOX3Dp96Sw1F3uL+H+D1sx02jZZdzUT0HgvCy59CuvXcWw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/panva"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/jpeg-js": {
|
||||||
|
"version": "0.4.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/jpeg-js/-/jpeg-js-0.4.4.tgz",
|
||||||
|
"integrity": "sha512-WZzeDOEtTOBK4Mdsar0IqEU5sMr3vSV2RqkAIzUEV2BHnUfKGyswWFPFwK5EeDo93K3FohSHbLAjj0s1Wzd+dg==",
|
||||||
|
"license": "BSD-3-Clause"
|
||||||
|
},
|
||||||
"node_modules/js-tokens": {
|
"node_modules/js-tokens": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
|
||||||
|
|
@ -3601,6 +4257,15 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/node-forge": {
|
||||||
|
"version": "1.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.4.0.tgz",
|
||||||
|
"integrity": "sha512-LarFH0+6VfriEhqMMcLX2F7SwSXeWwnEAJEsYm5QKWchiVYVvJyV9v7UDvUv+w5HO23ZpQTXDv/GxdDdMyOuoQ==",
|
||||||
|
"license": "(BSD-3-Clause OR GPL-2.0)",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 6.13.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/node-gyp-build": {
|
"node_modules/node-gyp-build": {
|
||||||
"version": "4.8.4",
|
"version": "4.8.4",
|
||||||
"resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.4.tgz",
|
"resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.4.tgz",
|
||||||
|
|
@ -3622,6 +4287,15 @@
|
||||||
"node": ">=18"
|
"node": ">=18"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/nodemailer": {
|
||||||
|
"version": "7.0.13",
|
||||||
|
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-7.0.13.tgz",
|
||||||
|
"integrity": "sha512-PNDFSJdP+KFgdsG3ZzMXCgquO7I6McjY2vlqILjtJd0hy8wEvtugS9xKRF2NWlPNGxvLCXlTNIae4serI7dinw==",
|
||||||
|
"license": "MIT-0",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/normalize-path": {
|
"node_modules/normalize-path": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
|
||||||
|
|
@ -3653,6 +4327,12 @@
|
||||||
"url": "https://github.com/sponsors/ljharb"
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/omggif": {
|
||||||
|
"version": "1.0.10",
|
||||||
|
"resolved": "https://registry.npmjs.org/omggif/-/omggif-1.0.10.tgz",
|
||||||
|
"integrity": "sha512-LMJTtvgc/nugXj0Vcrrs68Mn2D1r0zf630VNtqtpI1FEO7e+O9FP4gqs9AcnBaSEeoHIPm28u6qgPR0oyEpGSw==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/on-finished": {
|
"node_modules/on-finished": {
|
||||||
"version": "2.4.1",
|
"version": "2.4.1",
|
||||||
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
|
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
|
||||||
|
|
@ -3722,6 +4402,12 @@
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "BlueOak-1.0.0"
|
"license": "BlueOak-1.0.0"
|
||||||
},
|
},
|
||||||
|
"node_modules/pako": {
|
||||||
|
"version": "1.0.11",
|
||||||
|
"resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz",
|
||||||
|
"integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==",
|
||||||
|
"license": "(MIT AND Zlib)"
|
||||||
|
},
|
||||||
"node_modules/parent-module": {
|
"node_modules/parent-module": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",
|
||||||
|
|
@ -3735,6 +4421,28 @@
|
||||||
"node": ">=6"
|
"node": ">=6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/parse-bmfont-ascii": {
|
||||||
|
"version": "1.0.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/parse-bmfont-ascii/-/parse-bmfont-ascii-1.0.6.tgz",
|
||||||
|
"integrity": "sha512-U4RrVsUFCleIOBsIGYOMKjn9PavsGOXxbvYGtMOEfnId0SVNsgehXh1DxUdVPLoxd5mvcEtvmKs2Mmf0Mpa1ZA==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/parse-bmfont-binary": {
|
||||||
|
"version": "1.0.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/parse-bmfont-binary/-/parse-bmfont-binary-1.0.6.tgz",
|
||||||
|
"integrity": "sha512-GxmsRea0wdGdYthjuUeWTMWPqm2+FAd4GI8vCvhgJsFnoGhTrLhXDDupwTo7rXVAgaLIGoVHDZS9p/5XbSqeWA==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/parse-bmfont-xml": {
|
||||||
|
"version": "1.1.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/parse-bmfont-xml/-/parse-bmfont-xml-1.1.6.tgz",
|
||||||
|
"integrity": "sha512-0cEliVMZEhrFDwMh4SxIyVJpqYoOWDJ9P895tFuS+XuNzI5UBmBk5U5O4KuJdTnZpSBI4LFA2+ZiJaiwfSwlMA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"xml-parse-from-string": "^1.0.0",
|
||||||
|
"xml2js": "^0.5.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/parse-json": {
|
"node_modules/parse-json": {
|
||||||
"version": "5.2.0",
|
"version": "5.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz",
|
||||||
|
|
@ -3763,6 +4471,21 @@
|
||||||
"node": ">= 0.8"
|
"node": ">= 0.8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/passkit-generator": {
|
||||||
|
"version": "3.6.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/passkit-generator/-/passkit-generator-3.6.1.tgz",
|
||||||
|
"integrity": "sha512-HSAKRMtQydsP65fj09O+UuLlzQWfWlziUjpETTT7P7w/DAlSlC3iHPTrw58nNgFbMDN5lLj2VoI+NvJLGgXvOQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"do-not-zip": "^1.0.0",
|
||||||
|
"joi": "17.13.4",
|
||||||
|
"node-forge": "^1.4.0",
|
||||||
|
"tslib": "^2.7.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14.21.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/passport": {
|
"node_modules/passport": {
|
||||||
"version": "0.7.0",
|
"version": "0.7.0",
|
||||||
"resolved": "https://registry.npmjs.org/passport/-/passport-0.7.0.tgz",
|
"resolved": "https://registry.npmjs.org/passport/-/passport-0.7.0.tgz",
|
||||||
|
|
@ -3867,6 +4590,27 @@
|
||||||
"url": "https://github.com/sponsors/jonschlinkert"
|
"url": "https://github.com/sponsors/jonschlinkert"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/pixelmatch": {
|
||||||
|
"version": "5.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/pixelmatch/-/pixelmatch-5.3.0.tgz",
|
||||||
|
"integrity": "sha512-o8mkY4E/+LNUf6LzX96ht6k6CEDi65k9G2rjMtBe9Oo+VPKSvl+0GKHuH/AlG+GA5LPG/i5hrekkxUc3s2HU+Q==",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"pngjs": "^6.0.0"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"pixelmatch": "bin/pixelmatch"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/pixelmatch/node_modules/pngjs": {
|
||||||
|
"version": "6.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/pngjs/-/pngjs-6.0.0.tgz",
|
||||||
|
"integrity": "sha512-TRzzuFRRmEoSW/p1KVAmiOgPco2Irlah+bGFCeNfJXxxYGwSw7YwAOAcd7X28K/m5bjBWKsC29KyoMfHbypayg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12.13.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/pluralize": {
|
"node_modules/pluralize": {
|
||||||
"version": "8.0.0",
|
"version": "8.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz",
|
||||||
|
|
@ -3877,6 +4621,15 @@
|
||||||
"node": ">=4"
|
"node": ">=4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/pngjs": {
|
||||||
|
"version": "7.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/pngjs/-/pngjs-7.0.0.tgz",
|
||||||
|
"integrity": "sha512-LKWqWJRhstyYo9pGvgor/ivk2w94eSjE3RGVuzLGlr3NmD8bf7RcYGze1mNdEHRP6TRP6rMuDHk5t44hnTRyow==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14.19.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/prisma": {
|
"node_modules/prisma": {
|
||||||
"version": "5.22.0",
|
"version": "5.22.0",
|
||||||
"resolved": "https://registry.npmjs.org/prisma/-/prisma-5.22.0.tgz",
|
"resolved": "https://registry.npmjs.org/prisma/-/prisma-5.22.0.tgz",
|
||||||
|
|
@ -4105,6 +4858,15 @@
|
||||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
|
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/sax": {
|
||||||
|
"version": "1.6.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/sax/-/sax-1.6.1.tgz",
|
||||||
|
"integrity": "sha512-42tBVwLWnaQvW5zc4HbZrTuWccECCZfBi92FDuwtqxasH+JbPB3/FOKb1m222K42R4WxuxzzMsTswfzgtSu64Q==",
|
||||||
|
"license": "BlueOak-1.0.0",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=11.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/schema-utils": {
|
"node_modules/schema-utils": {
|
||||||
"version": "3.3.0",
|
"version": "3.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.3.0.tgz",
|
||||||
|
|
@ -4347,6 +5109,15 @@
|
||||||
"url": "https://github.com/sponsors/isaacs"
|
"url": "https://github.com/sponsors/isaacs"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/simple-xml-to-json": {
|
||||||
|
"version": "1.2.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/simple-xml-to-json/-/simple-xml-to-json-1.2.7.tgz",
|
||||||
|
"integrity": "sha512-mz9VXphOxQWX3eQ/uXCtm6upltoN0DLx8Zb5T4TFC4FHB7S9FDPGre8CfLWqPWQQH/GrQYd2AXhhVM5LDpYx6Q==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=20.12.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/source-map": {
|
"node_modules/source-map": {
|
||||||
"version": "0.7.4",
|
"version": "0.7.4",
|
||||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz",
|
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz",
|
||||||
|
|
@ -4684,6 +5455,12 @@
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/tinycolor2": {
|
||||||
|
"version": "1.6.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.6.0.tgz",
|
||||||
|
"integrity": "sha512-XPaBkWQJdsf3pLKJV9p4qN/S+fm2Oj8AIPo1BTUhg5oxkvm9+SVEGFdhyOz7tTdUTfvxMiAs4sp6/eZO2Ew+pw==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/tmp": {
|
"node_modules/tmp": {
|
||||||
"version": "0.0.33",
|
"version": "0.0.33",
|
||||||
"resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz",
|
"resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz",
|
||||||
|
|
@ -4970,6 +5747,15 @@
|
||||||
"punycode": "^2.1.0"
|
"punycode": "^2.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/utif2": {
|
||||||
|
"version": "4.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/utif2/-/utif2-4.1.0.tgz",
|
||||||
|
"integrity": "sha512-+oknB9FHrJ7oW7A2WZYajOcv4FcDR4CfoGB0dPNfxbi4GO05RRnFmt5oa23+9w32EanrYcSJWspUiJkLMs+37w==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"pako": "^1.0.11"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/util-deprecate": {
|
"node_modules/util-deprecate": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
||||||
|
|
@ -5166,6 +5952,34 @@
|
||||||
"url": "https://github.com/chalk/wrap-ansi?sponsor=1"
|
"url": "https://github.com/chalk/wrap-ansi?sponsor=1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/xml-parse-from-string": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/xml-parse-from-string/-/xml-parse-from-string-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-ErcKwJTF54uRzzNMXq2X5sMIy88zJvfN2DmdoQvy7PAFJ+tPRU6ydWuOKNMyfmOjdyBQTFREi60s0Y0SyI0G0g==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/xml2js": {
|
||||||
|
"version": "0.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.5.0.tgz",
|
||||||
|
"integrity": "sha512-drPFnkQJik/O+uPKpqSgr22mpuFHqKdbS835iAQrUC73L2F5WkboIRd63ai/2Yg6I1jzifPFKH2NTK+cfglkIA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"sax": ">=0.6.0",
|
||||||
|
"xmlbuilder": "~11.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/xmlbuilder": {
|
||||||
|
"version": "11.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz",
|
||||||
|
"integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/xtend": {
|
"node_modules/xtend": {
|
||||||
"version": "4.0.2",
|
"version": "4.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
|
||||||
|
|
@ -5194,6 +6008,15 @@
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6"
|
"node": ">=6"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"node_modules/zod": {
|
||||||
|
"version": "3.25.76",
|
||||||
|
"resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz",
|
||||||
|
"integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/colinhacks"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,10 @@
|
||||||
"class-transformer": "^0.5.1",
|
"class-transformer": "^0.5.1",
|
||||||
"class-validator": "^0.14.1",
|
"class-validator": "^0.14.1",
|
||||||
"helmet": "^8.3.0",
|
"helmet": "^8.3.0",
|
||||||
|
"jimp": "^1.6.1",
|
||||||
|
"jose": "^6.2.12",
|
||||||
|
"nodemailer": "^7.0.13",
|
||||||
|
"passkit-generator": "^3.6.1",
|
||||||
"passport": "^0.7.0",
|
"passport": "^0.7.0",
|
||||||
"passport-jwt": "^4.0.1",
|
"passport-jwt": "^4.0.1",
|
||||||
"reflect-metadata": "^0.2.2",
|
"reflect-metadata": "^0.2.2",
|
||||||
|
|
@ -41,6 +45,7 @@
|
||||||
"@types/express": "^5.0.0",
|
"@types/express": "^5.0.0",
|
||||||
"@types/multer": "^2.3.0",
|
"@types/multer": "^2.3.0",
|
||||||
"@types/node": "^22.7.4",
|
"@types/node": "^22.7.4",
|
||||||
|
"@types/nodemailer": "^8.0.2",
|
||||||
"@types/passport-jwt": "^4.0.1",
|
"@types/passport-jwt": "^4.0.1",
|
||||||
"prisma": "^5.20.0",
|
"prisma": "^5.20.0",
|
||||||
"ts-node": "^10.9.2",
|
"ts-node": "^10.9.2",
|
||||||
|
|
|
||||||
|
|
@ -129,6 +129,8 @@ model LoyaltyCard {
|
||||||
serial String @unique
|
serial String @unique
|
||||||
/// Jeton d'authentification du service web Apple Wallet.
|
/// Jeton d'authentification du service web Apple Wallet.
|
||||||
authToken String
|
authToken String
|
||||||
|
/// Clé secrète des liens client (page de la carte, téléchargement du pass).
|
||||||
|
accessKey String @unique
|
||||||
balance Int @default(0)
|
balance Int @default(0)
|
||||||
lastCreditAt DateTime?
|
lastCreditAt DateTime?
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@ import configuration from './config/configuration';
|
||||||
import { PrismaModule } from './prisma/prisma.module';
|
import { PrismaModule } from './prisma/prisma.module';
|
||||||
import { AuthModule } from './auth/auth.module';
|
import { AuthModule } from './auth/auth.module';
|
||||||
import { AdminModule } from './admin.module';
|
import { AdminModule } from './admin.module';
|
||||||
|
import { MailModule } from './mail/mail.service';
|
||||||
|
import { EnrollmentModule } from './enrollment/enrollment.module';
|
||||||
import { HealthController } from './health.controller';
|
import { HealthController } from './health.controller';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
|
|
@ -15,6 +17,8 @@ import { HealthController } from './health.controller';
|
||||||
PrismaModule,
|
PrismaModule,
|
||||||
AuthModule,
|
AuthModule,
|
||||||
AdminModule,
|
AdminModule,
|
||||||
|
MailModule,
|
||||||
|
EnrollmentModule,
|
||||||
],
|
],
|
||||||
controllers: [HealthController],
|
controllers: [HealthController],
|
||||||
providers: [{ provide: APP_GUARD, useClass: ThrottlerGuard }],
|
providers: [{ provide: APP_GUARD, useClass: ThrottlerGuard }],
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
export default () => ({
|
export default () => ({
|
||||||
env: process.env.NODE_ENV ?? 'development',
|
env: process.env.NODE_ENV ?? 'development',
|
||||||
port: parseInt(process.env.PORT ?? '3100', 10),
|
port: parseInt(process.env.PORT ?? '3100', 10),
|
||||||
|
/** URL publique de l'API (liens e-mail, QR d'inscription, images Google Wallet). */
|
||||||
|
publicUrl: (process.env.PUBLIC_URL ?? 'http://localhost:3100').replace(/\/$/, ''),
|
||||||
cors: { origins: process.env.CORS_ORIGINS ?? '' },
|
cors: { origins: process.env.CORS_ORIGINS ?? '' },
|
||||||
jwt: {
|
jwt: {
|
||||||
accessSecret: process.env.JWT_ACCESS_SECRET ?? 'dev-access-secret',
|
accessSecret: process.env.JWT_ACCESS_SECRET ?? 'dev-access-secret',
|
||||||
|
|
@ -8,4 +10,25 @@ export default () => ({
|
||||||
accessTtl: process.env.JWT_ACCESS_TTL ?? '15m',
|
accessTtl: process.env.JWT_ACCESS_TTL ?? '15m',
|
||||||
refreshTtl: process.env.JWT_REFRESH_TTL ?? '30d',
|
refreshTtl: process.env.JWT_REFRESH_TTL ?? '30d',
|
||||||
},
|
},
|
||||||
|
apple: {
|
||||||
|
passTypeId: process.env.APPLE_PASS_TYPE_ID ?? '',
|
||||||
|
teamId: process.env.APPLE_TEAM_ID ?? '',
|
||||||
|
/** Chemins vers les fichiers PEM (hors du dépôt). */
|
||||||
|
signerCert: process.env.APPLE_SIGNER_CERT ?? '',
|
||||||
|
signerKey: process.env.APPLE_SIGNER_KEY ?? '',
|
||||||
|
signerKeyPassphrase: process.env.APPLE_SIGNER_KEY_PASSPHRASE || undefined,
|
||||||
|
wwdrCert: process.env.APPLE_WWDR_CERT ?? '',
|
||||||
|
},
|
||||||
|
google: {
|
||||||
|
issuerId: process.env.GOOGLE_WALLET_ISSUER_ID ?? '',
|
||||||
|
/** Chemin vers la clé JSON du compte de service. */
|
||||||
|
serviceAccountFile: process.env.GOOGLE_WALLET_SA_FILE ?? '',
|
||||||
|
},
|
||||||
|
mail: {
|
||||||
|
host: process.env.SMTP_HOST ?? '',
|
||||||
|
port: parseInt(process.env.SMTP_PORT ?? '587', 10),
|
||||||
|
user: process.env.SMTP_USER ?? '',
|
||||||
|
pass: process.env.SMTP_PASS ?? '',
|
||||||
|
from: process.env.MAIL_FROM ?? 'MonEspacePro <no-reply@localhost>',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
|
||||||
144
backend/src/enrollment/enrollment.controller.ts
Normal file
144
backend/src/enrollment/enrollment.controller.ts
Normal file
|
|
@ -0,0 +1,144 @@
|
||||||
|
import {
|
||||||
|
Body,
|
||||||
|
Controller,
|
||||||
|
Delete,
|
||||||
|
Get,
|
||||||
|
Headers,
|
||||||
|
HttpCode,
|
||||||
|
NotFoundException,
|
||||||
|
Param,
|
||||||
|
Post,
|
||||||
|
Query,
|
||||||
|
Res,
|
||||||
|
} from '@nestjs/common';
|
||||||
|
import { Throttle } from '@nestjs/throttler';
|
||||||
|
import { Response } from 'express';
|
||||||
|
import { Transform } from 'class-transformer';
|
||||||
|
import { Equals, IsEmail, IsString, Length } from 'class-validator';
|
||||||
|
import { EnrollmentService } from './enrollment.service';
|
||||||
|
import { ApplePassService } from '../wallet/apple-pass.service';
|
||||||
|
import { GoogleWalletService } from '../wallet/google-wallet.service';
|
||||||
|
import { cardPage, detectPlatform, enrollPage, notFoundPage, privacyPage, unavailablePage } from './pages';
|
||||||
|
|
||||||
|
const trim = ({ value }: { value: unknown }) => (typeof value === 'string' ? value.trim() : value);
|
||||||
|
|
||||||
|
class EnrollDto {
|
||||||
|
@Transform(trim) @IsString() @Length(1, 40)
|
||||||
|
firstName!: string;
|
||||||
|
|
||||||
|
@Transform(trim) @IsEmail()
|
||||||
|
email!: string;
|
||||||
|
|
||||||
|
/** Le consentement RGPD est obligatoire ; sa date est enregistrée. */
|
||||||
|
@Equals(true)
|
||||||
|
consent!: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
class ResendDto {
|
||||||
|
@Transform(trim) @IsEmail()
|
||||||
|
email!: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
function html(res: Response, body: string, status = 200) {
|
||||||
|
res.status(status).type('html').setHeader('Cache-Control', 'no-store').send(body);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Pages HTML publiques (hors préfixe /api : ce sont les URL imprimées et envoyées). */
|
||||||
|
@Controller()
|
||||||
|
export class EnrollmentPagesController {
|
||||||
|
constructor(
|
||||||
|
private enrollment: EnrollmentService,
|
||||||
|
private apple: ApplePassService,
|
||||||
|
private google: GoogleWalletService,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
@Get('c/:slug')
|
||||||
|
async enroll(@Param('slug') slug: string, @Res() res: Response) {
|
||||||
|
const store = await this.enrollment.findStore(slug);
|
||||||
|
if (!store || store.status === 'DRAFT') return html(res, notFoundPage(), 404);
|
||||||
|
if (store.status !== 'ACTIVE' || !store.cardDesign) return html(res, unavailablePage(store));
|
||||||
|
html(res, enrollPage(store));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Get('c/:slug/confidentialite')
|
||||||
|
async privacy(@Param('slug') slug: string, @Res() res: Response) {
|
||||||
|
const store = await this.enrollment.findStore(slug);
|
||||||
|
if (!store) return html(res, notFoundPage(), 404);
|
||||||
|
html(res, privacyPage(store));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Get('carte/:serial')
|
||||||
|
async card(
|
||||||
|
@Param('serial') serial: string,
|
||||||
|
@Query('k') key: string | undefined,
|
||||||
|
@Query('nouveau') isNew: string | undefined,
|
||||||
|
@Headers('user-agent') ua: string | undefined,
|
||||||
|
@Res() res: Response,
|
||||||
|
) {
|
||||||
|
const card = await this.enrollment.findCard(serial, key);
|
||||||
|
if (!card) return html(res, notFoundPage(), 404);
|
||||||
|
// La clé du lien ne doit pas fuiter vers des tiers (polices Google, etc.).
|
||||||
|
res.setHeader('Referrer-Policy', 'no-referrer');
|
||||||
|
html(
|
||||||
|
res,
|
||||||
|
cardPage(card, {
|
||||||
|
platform: detectPlatform(ua),
|
||||||
|
isNew: isNew !== undefined,
|
||||||
|
apple: this.apple.enabled,
|
||||||
|
google: this.google.enabled,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Controller('public')
|
||||||
|
export class EnrollmentApiController {
|
||||||
|
constructor(
|
||||||
|
private enrollment: EnrollmentService,
|
||||||
|
private apple: ApplePassService,
|
||||||
|
private google: GoogleWalletService,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
@Post('stores/:slug/enroll')
|
||||||
|
@HttpCode(200)
|
||||||
|
@Throttle({ default: { limit: 10, ttl: 60_000 } })
|
||||||
|
enroll(@Param('slug') slug: string, @Body() dto: EnrollDto) {
|
||||||
|
return this.enrollment.enroll(slug, dto.firstName, dto.email);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Post('stores/:slug/resend')
|
||||||
|
@HttpCode(200)
|
||||||
|
@Throttle({ default: { limit: 3, ttl: 10 * 60_000 } })
|
||||||
|
async resend(@Param('slug') slug: string, @Body() dto: ResendDto) {
|
||||||
|
await this.enrollment.resend(slug, dto.email);
|
||||||
|
return { ok: true };
|
||||||
|
}
|
||||||
|
|
||||||
|
@Get('cards/:serial/apple')
|
||||||
|
async applePass(@Param('serial') serial: string, @Query('k') key: string | undefined, @Res() res: Response) {
|
||||||
|
const card = await this.enrollment.findCard(serial, key);
|
||||||
|
if (!card) throw new NotFoundException();
|
||||||
|
const pkpass = await this.apple.generate(card);
|
||||||
|
res
|
||||||
|
.status(200)
|
||||||
|
.type('application/vnd.apple.pkpass')
|
||||||
|
.setHeader('Content-Disposition', `attachment; filename="carte-${card.store.slug}.pkpass"`)
|
||||||
|
.setHeader('Cache-Control', 'no-store')
|
||||||
|
.send(pkpass);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Get('cards/:serial/google')
|
||||||
|
async googlePass(@Param('serial') serial: string, @Query('k') key: string | undefined, @Res() res: Response) {
|
||||||
|
const card = await this.enrollment.findCard(serial, key);
|
||||||
|
if (!card) throw new NotFoundException();
|
||||||
|
res.redirect(302, await this.google.saveUrl(card));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Delete('cards/:serial')
|
||||||
|
async remove(@Param('serial') serial: string, @Query('k') key: string | undefined) {
|
||||||
|
const card = await this.enrollment.findCard(serial, key);
|
||||||
|
if (!card) throw new NotFoundException();
|
||||||
|
await this.enrollment.deleteCard(card);
|
||||||
|
return { ok: true };
|
||||||
|
}
|
||||||
|
}
|
||||||
13
backend/src/enrollment/enrollment.module.ts
Normal file
13
backend/src/enrollment/enrollment.module.ts
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
import { Module } from '@nestjs/common';
|
||||||
|
import { EnrollmentApiController, EnrollmentPagesController } from './enrollment.controller';
|
||||||
|
import { EnrollmentService } from './enrollment.service';
|
||||||
|
import { ApplePassService } from '../wallet/apple-pass.service';
|
||||||
|
import { GoogleWalletService } from '../wallet/google-wallet.service';
|
||||||
|
|
||||||
|
/** Inscription des clients finaux et remise des cartes Wallet. */
|
||||||
|
@Module({
|
||||||
|
controllers: [EnrollmentPagesController, EnrollmentApiController],
|
||||||
|
providers: [EnrollmentService, ApplePassService, GoogleWalletService],
|
||||||
|
exports: [ApplePassService, GoogleWalletService],
|
||||||
|
})
|
||||||
|
export class EnrollmentModule {}
|
||||||
121
backend/src/enrollment/enrollment.service.ts
Normal file
121
backend/src/enrollment/enrollment.service.ts
Normal file
|
|
@ -0,0 +1,121 @@
|
||||||
|
import { ConflictException, Injectable, Logger, NotFoundException } from '@nestjs/common';
|
||||||
|
import { ConfigService } from '@nestjs/config';
|
||||||
|
import { randomBytes, timingSafeEqual } from 'crypto';
|
||||||
|
import { PrismaService } from '../prisma/prisma.service';
|
||||||
|
import { MailService } from '../mail/mail.service';
|
||||||
|
import { CARD_WITH_CONTEXT, CardWithContext } from '../wallet/wallet.types';
|
||||||
|
import { escapeHtml } from './pages';
|
||||||
|
|
||||||
|
/** Alphabet sans caractères ambigus : le numéro peut être lu à voix haute au comptoir. */
|
||||||
|
const SERIAL_ALPHABET = 'ABCDEFGHJKLMNPQRSTUVWXYZ23456789';
|
||||||
|
|
||||||
|
function randomSerial() {
|
||||||
|
const bytes = randomBytes(16);
|
||||||
|
return 'MEP' + [...bytes].map((b) => SERIAL_ALPHABET[b % SERIAL_ALPHABET.length]).join('');
|
||||||
|
}
|
||||||
|
|
||||||
|
const token = () => randomBytes(24).toString('base64url');
|
||||||
|
|
||||||
|
/** « tony.prive@gmail.com » → « t•••@g•••.com » */
|
||||||
|
export function maskEmail(email: string) {
|
||||||
|
const [user, domain = ''] = email.split('@');
|
||||||
|
const dot = domain.lastIndexOf('.');
|
||||||
|
const host = dot > 0 ? domain.slice(0, dot) : domain;
|
||||||
|
const tld = dot > 0 ? domain.slice(dot) : '';
|
||||||
|
return `${user[0]}•••@${host[0] ?? ''}•••${tld}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type EnrollResult = { status: 'created'; cardUrl: string } | { status: 'exists'; maskedEmail: string };
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class EnrollmentService {
|
||||||
|
private readonly logger = new Logger(EnrollmentService.name);
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private prisma: PrismaService,
|
||||||
|
private mail: MailService,
|
||||||
|
private config: ConfigService,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
findStore(slug: string) {
|
||||||
|
return this.prisma.store.findUnique({
|
||||||
|
where: { slug },
|
||||||
|
include: { cardDesign: { include: { rewards: { where: { active: true }, orderBy: { cost: 'asc' } } } } },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Inscription ouverte uniquement si le magasin est actif et sa carte conçue. */
|
||||||
|
private async openStore(slug: string) {
|
||||||
|
const store = await this.findStore(slug);
|
||||||
|
if (!store) throw new NotFoundException('Programme introuvable');
|
||||||
|
if (store.status !== 'ACTIVE' || !store.cardDesign) throw new ConflictException('Programme indisponible');
|
||||||
|
return store;
|
||||||
|
}
|
||||||
|
|
||||||
|
async enroll(slug: string, firstName: string, rawEmail: string): Promise<EnrollResult> {
|
||||||
|
const store = await this.openStore(slug);
|
||||||
|
const email = rawEmail.toLowerCase();
|
||||||
|
const existing = await this.findCardByEmail(store.id, email);
|
||||||
|
if (existing) return { status: 'exists', maskedEmail: maskEmail(email) };
|
||||||
|
|
||||||
|
const card = await this.prisma.loyaltyCard.create({
|
||||||
|
data: {
|
||||||
|
serial: randomSerial(),
|
||||||
|
authToken: token(),
|
||||||
|
accessKey: token(),
|
||||||
|
store: { connect: { id: store.id } },
|
||||||
|
customer: { create: { firstName, email, consentAt: new Date() } },
|
||||||
|
},
|
||||||
|
include: CARD_WITH_CONTEXT,
|
||||||
|
});
|
||||||
|
this.sendCardLink(card, true).catch((e) => this.logger.error(`E-mail d'inscription non envoyé : ${e.message}`));
|
||||||
|
return { status: 'created', cardUrl: this.cardUrl(card) };
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Réponse identique que la carte existe ou non : rien n'est révélé. */
|
||||||
|
async resend(slug: string, rawEmail: string) {
|
||||||
|
const store = await this.findStore(slug);
|
||||||
|
if (!store) return;
|
||||||
|
const card = await this.findCardByEmail(store.id, rawEmail.toLowerCase());
|
||||||
|
if (card) await this.sendCardLink(card, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Carte accessible par son lien secret ; null si le lien est faux. */
|
||||||
|
async findCard(serial: string, key: string | undefined): Promise<CardWithContext | null> {
|
||||||
|
if (!key) return null;
|
||||||
|
const card = await this.prisma.loyaltyCard.findUnique({ where: { serial }, include: CARD_WITH_CONTEXT });
|
||||||
|
if (!card || card.store.status === 'CLOSED') return null;
|
||||||
|
const a = Buffer.from(card.accessKey);
|
||||||
|
const b = Buffer.from(key);
|
||||||
|
return a.length === b.length && timingSafeEqual(a, b) ? card : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Droit à l'effacement : la carte et les données du client disparaissent. */
|
||||||
|
async deleteCard(card: CardWithContext) {
|
||||||
|
await this.prisma.$transaction(async (tx) => {
|
||||||
|
await tx.loyaltyCard.delete({ where: { id: card.id } });
|
||||||
|
const others = await tx.loyaltyCard.count({ where: { customerId: card.customerId } });
|
||||||
|
if (others === 0) await tx.customer.delete({ where: { id: card.customerId } });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
cardUrl(card: { serial: string; accessKey: string }) {
|
||||||
|
return `${this.config.get('publicUrl')}/carte/${card.serial}?k=${card.accessKey}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
private findCardByEmail(storeId: string, email: string) {
|
||||||
|
return this.prisma.loyaltyCard.findFirst({ where: { storeId, customer: { email } }, include: CARD_WITH_CONTEXT });
|
||||||
|
}
|
||||||
|
|
||||||
|
private async sendCardLink(card: CardWithContext, isNew: boolean) {
|
||||||
|
const url = this.cardUrl(card);
|
||||||
|
const program = card.store.cardDesign?.programName ?? card.store.name;
|
||||||
|
const subject = isNew ? `Votre carte ${program}` : `Le lien de votre carte ${program}`;
|
||||||
|
const intro = isNew
|
||||||
|
? `Bienvenue dans le programme ${program} de ${card.store.name} !`
|
||||||
|
: `Voici le lien de votre carte ${program}, comme demandé.`;
|
||||||
|
const text = `Bonjour ${card.customer.firstName},\n\n${intro}\n\nOuvrez ce lien sur votre téléphone pour ajouter la carte à Apple Wallet ou Google Wallet :\n${url}\n\nGardez cet e-mail : il vous permet de retrouver votre carte si vous changez de téléphone.\n\n${card.store.name}`;
|
||||||
|
const html = `<p>Bonjour ${escapeHtml(card.customer.firstName)},</p><p>${escapeHtml(intro)}</p><p><a href="${escapeHtml(url)}">Ajouter ma carte à mon téléphone</a></p><p>Gardez cet e-mail : il vous permet de retrouver votre carte si vous changez de téléphone.</p><p>${escapeHtml(card.store.name)}</p>`;
|
||||||
|
await this.mail.send(card.customer.email, subject, text, html);
|
||||||
|
}
|
||||||
|
}
|
||||||
302
backend/src/enrollment/pages.ts
Normal file
302
backend/src/enrollment/pages.ts
Normal file
|
|
@ -0,0 +1,302 @@
|
||||||
|
import type { CardDesign, Reward, Store } from '@prisma/client';
|
||||||
|
import type { CardWithContext } from '../wallet/wallet.types';
|
||||||
|
|
||||||
|
/** Pages publiques (clients finaux), rendues côté serveur aux couleurs du magasin. */
|
||||||
|
|
||||||
|
export type StoreWithDesign = Store & { cardDesign: (CardDesign & { rewards: Reward[] }) | null };
|
||||||
|
export type Platform = 'apple' | 'google' | 'other';
|
||||||
|
|
||||||
|
export function escapeHtml(value: unknown) {
|
||||||
|
return String(value ?? '')
|
||||||
|
.replace(/&/g, '&')
|
||||||
|
.replace(/</g, '<')
|
||||||
|
.replace(/>/g, '>')
|
||||||
|
.replace(/"/g, '"')
|
||||||
|
.replace(/'/g, ''');
|
||||||
|
}
|
||||||
|
const e = escapeHtml;
|
||||||
|
|
||||||
|
export function detectPlatform(userAgent = ''): Platform {
|
||||||
|
if (/iPhone|iPad|iPod|Macintosh/i.test(userAgent)) return 'apple';
|
||||||
|
if (/Android/i.test(userAgent)) return 'google';
|
||||||
|
return 'other';
|
||||||
|
}
|
||||||
|
|
||||||
|
/** « Boulangerie Le Fournil » → « de Boulangerie Le Fournil », « Atelier » → « d'Atelier ». */
|
||||||
|
function de(name: string) {
|
||||||
|
return /^[aeiouyhàâéèêîôû]/i.test(name) ? `d’${name}` : `de ${name}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
const SYMBOL = (size: number) =>
|
||||||
|
`<svg width="${size}" height="${size}" viewBox="0.5 -2 64 64" aria-hidden="true"><path d="M12 54V32a9 9 0 0 1 18 0v22M30 32a9 9 0 0 1 18 0v22" fill="none" stroke="currentColor" stroke-width="9"/><circle cx="51" cy="12" r="7" fill="currentColor"/></svg>`;
|
||||||
|
|
||||||
|
function theme(store: StoreWithDesign) {
|
||||||
|
const d = store.cardDesign;
|
||||||
|
return {
|
||||||
|
bg: d?.backgroundColor ?? '#1F2937',
|
||||||
|
fg: d?.foregroundColor ?? '#FFFFFF',
|
||||||
|
label: d?.labelColor ?? '#D1D5DB',
|
||||||
|
logo: d?.logoPath ? `/uploads/${d.logoPath}` : null,
|
||||||
|
strip: d?.stripPath ? `/uploads/${d.stripPath}` : null,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function layout(store: StoreWithDesign, title: string, body: string, script = '') {
|
||||||
|
const t = theme(store);
|
||||||
|
return `<!doctype html>
|
||||||
|
<html lang="fr">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<meta name="robots" content="noindex">
|
||||||
|
<meta name="theme-color" content="${e(t.bg)}">
|
||||||
|
<title>${e(title)}</title>
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Figtree:wght@400;500;600;700&display=swap" rel="stylesheet">
|
||||||
|
<style>
|
||||||
|
:root{--brand:${e(t.bg)};--on-brand:${e(t.fg)};--brand-label:${e(t.label)};--bg:#F6F6F3;--surface:#fff;--text:#1C1C19;--muted:#5F5E56;--border:#DEDDD6;--err:#B8322A;--ok:#1E7A3C}
|
||||||
|
@media (prefers-color-scheme:dark){:root{--bg:#121211;--surface:#1D1D1A;--text:#F2F1EC;--muted:#A5A49B;--border:#34342F;--err:#F08A80;--ok:#6FCF8F}}
|
||||||
|
*{box-sizing:border-box}
|
||||||
|
body{margin:0;background:var(--bg);color:var(--text);font:400 16px/1.5 'Figtree',system-ui,sans-serif}
|
||||||
|
a{color:inherit}
|
||||||
|
.wrap{max-width:480px;margin:0 auto;min-height:100vh;display:flex;flex-direction:column}
|
||||||
|
header{position:relative;background:var(--brand);color:var(--on-brand)}
|
||||||
|
header .strip{display:block;width:100%;aspect-ratio:1125/432;object-fit:cover}
|
||||||
|
header .nostrip{height:96px}
|
||||||
|
header .logo{position:absolute;left:20px;bottom:-32px;width:72px;height:72px;border-radius:16px;object-fit:contain;background:var(--surface);border:3px solid var(--surface);box-shadow:0 4px 12px rgb(0 0 0/.15)}
|
||||||
|
main{flex:1;padding:48px 20px 24px;display:flex;flex-direction:column;gap:20px}
|
||||||
|
.eyebrow{font-size:14px;font-weight:600;color:var(--muted)}
|
||||||
|
h1{margin:0;font-size:28px;line-height:1.2;font-weight:700;letter-spacing:-.01em}
|
||||||
|
p{margin:0}
|
||||||
|
.promises{display:flex;flex-direction:column;gap:10px;background:var(--surface);border:1px solid var(--border);border-radius:14px;padding:14px 16px}
|
||||||
|
.promises div{display:flex;gap:10px;align-items:center;font-weight:500}
|
||||||
|
.dot{width:10px;height:10px;border-radius:50%;background:var(--brand);flex:none;outline:2px solid var(--border)}
|
||||||
|
form{display:flex;flex-direction:column;gap:16px}
|
||||||
|
.field{display:flex;flex-direction:column;gap:6px}
|
||||||
|
label{font-weight:600}
|
||||||
|
.hint{font-size:14px;color:var(--muted)}
|
||||||
|
.error{font-size:14px;color:var(--err);font-weight:500}
|
||||||
|
input[type=text],input[type=email]{height:52px;padding:0 14px;border:1px solid #8A897F;border-radius:12px;background:var(--surface);color:var(--text);font:400 17px 'Figtree',sans-serif;width:100%}
|
||||||
|
input:focus{outline:2px solid var(--brand);outline-offset:1px}
|
||||||
|
.consent{display:flex;gap:12px;align-items:flex-start;font-weight:400;font-size:15px}
|
||||||
|
.consent input{width:22px;height:22px;margin-top:2px;flex:none;accent-color:var(--brand)}
|
||||||
|
.btn{display:flex;align-items:center;justify-content:center;gap:10px;min-height:54px;padding:0 20px;border-radius:14px;border:0;background:var(--brand);color:var(--on-brand);font:700 17px 'Figtree',sans-serif;text-decoration:none;cursor:pointer;width:100%}
|
||||||
|
.btn:disabled{opacity:.6}
|
||||||
|
.btn.ghost{background:transparent;color:var(--text);border:1px solid var(--border)}
|
||||||
|
.btn.wallet{background:#000;color:#fff;border:1px solid #A6A6A6}
|
||||||
|
.small{font-size:14px;color:var(--muted);text-align:center}
|
||||||
|
.notice{padding:14px 16px;border-radius:12px;background:var(--surface);border:1px solid var(--border)}
|
||||||
|
.icon-ok{width:44px;height:44px;border-radius:50%;background:var(--brand);color:var(--on-brand);display:flex;align-items:center;justify-content:center}
|
||||||
|
.pass{border-radius:16px;overflow:hidden;background:var(--brand);color:var(--on-brand);box-shadow:0 8px 24px rgb(0 0 0/.18)}
|
||||||
|
.pass .top{display:flex;align-items:center;gap:10px;padding:12px 14px;font-weight:600}
|
||||||
|
.pass .top img{max-height:30px;max-width:110px;object-fit:contain}
|
||||||
|
.pass .band{position:relative;min-height:90px;background:rgb(255 255 255/.08)}
|
||||||
|
.pass .band img{display:block;width:100%;aspect-ratio:1125/432;object-fit:cover}
|
||||||
|
.pass .bal{position:absolute;left:14px;bottom:8px}
|
||||||
|
.pass .lbl{font-size:11px;font-weight:600;color:var(--brand-label);text-transform:uppercase}
|
||||||
|
.pass .big{font-size:34px;line-height:1}
|
||||||
|
.pass .row{display:flex;justify-content:space-between;padding:10px 14px 14px}
|
||||||
|
footer{padding:20px;display:flex;flex-direction:column;align-items:center;gap:10px;font-size:13px;color:var(--muted)}
|
||||||
|
footer nav{display:flex;gap:16px}
|
||||||
|
footer .powered{display:inline-flex;align-items:center;gap:6px;font-size:12px;text-decoration:none}
|
||||||
|
[hidden]{display:none!important}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="wrap">
|
||||||
|
<header>
|
||||||
|
${t.strip ? `<img class="strip" src="${e(t.strip)}" alt="">` : '<div class="nostrip"></div>'}
|
||||||
|
${t.logo ? `<img class="logo" src="${e(t.logo)}" alt="${e(store.name)}">` : ''}
|
||||||
|
</header>
|
||||||
|
<main>
|
||||||
|
${body}
|
||||||
|
</main>
|
||||||
|
<footer>
|
||||||
|
<nav><a href="/c/${e(store.slug)}/confidentialite">Confidentialité</a></nav>
|
||||||
|
<span class="powered">${SYMBOL(14)}<span>Propulsé par <strong>MonEspacePro</strong></span></span>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
${script ? `<script>${script}</script>` : ''}
|
||||||
|
</body>
|
||||||
|
</html>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function promises(store: StoreWithDesign) {
|
||||||
|
const d = store.cardDesign!;
|
||||||
|
const rule =
|
||||||
|
d.pointsMode === 'STAMP'
|
||||||
|
? 'Un tampon à chaque passage'
|
||||||
|
: Number(d.pointsPerEuro) === 1
|
||||||
|
? 'Gagnez 1 point par euro dépensé'
|
||||||
|
: `Gagnez ${Number(d.pointsPerEuro).toLocaleString('fr-FR')} points par euro dépensé`;
|
||||||
|
const unit = d.pointsMode === 'STAMP' ? 'tampons' : 'points';
|
||||||
|
const reward = d.rewards[0];
|
||||||
|
return `<div class="promises">
|
||||||
|
<div><span class="dot"></span><span>${e(rule)}</span></div>
|
||||||
|
${reward ? `<div><span class="dot"></span><span>${e(reward.label)} à ${reward.cost} ${unit}</span></div>` : ''}
|
||||||
|
</div>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function enrollPage(store: StoreWithDesign) {
|
||||||
|
const program = store.cardDesign!.programName;
|
||||||
|
const unitLower = store.cardDesign!.pointsMode === 'STAMP' ? 'tampons' : 'points';
|
||||||
|
const body = `
|
||||||
|
<section id="v-form">
|
||||||
|
<div style="display:flex;flex-direction:column;gap:4px;margin-bottom:20px">
|
||||||
|
<span class="eyebrow">${e(store.name)} · ${e(store.city)}</span>
|
||||||
|
<h1>${e(program)}</h1>
|
||||||
|
</div>
|
||||||
|
${promises(store)}
|
||||||
|
<form id="f" novalidate style="margin-top:20px">
|
||||||
|
<div class="field">
|
||||||
|
<label for="firstName">Prénom</label>
|
||||||
|
<input id="firstName" name="firstName" type="text" autocomplete="given-name" maxlength="40" required>
|
||||||
|
<span class="error" id="e-firstName" hidden>Indiquez votre prénom.</span>
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<label for="email">E-mail</label>
|
||||||
|
<input id="email" name="email" type="email" inputmode="email" autocomplete="email" placeholder="vous@exemple.fr" required>
|
||||||
|
<span class="hint" id="h-email">Pour retrouver votre carte si vous changez de téléphone.</span>
|
||||||
|
<span class="error" id="e-email" hidden>Vérifiez votre adresse e-mail.</span>
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<label class="consent"><input id="consent" type="checkbox" required>
|
||||||
|
<span>J'accepte que ${e(store.name)} utilise mon prénom et mon e-mail pour gérer ma carte de fidélité. <a href="/c/${e(store.slug)}/confidentialite">Politique de confidentialité</a></span>
|
||||||
|
</label>
|
||||||
|
<span class="error" id="e-consent" hidden>Cochez la case pour créer votre carte.</span>
|
||||||
|
</div>
|
||||||
|
<span class="error" id="e-global" role="alert" hidden></span>
|
||||||
|
<button class="btn" id="submit">Créer ma carte</button>
|
||||||
|
<span class="small">Gratuit, sans application à télécharger.<br>Désinscription possible à tout moment.</span>
|
||||||
|
</form>
|
||||||
|
</section>
|
||||||
|
<section id="v-exists" hidden style="display:flex;flex-direction:column;gap:20px">
|
||||||
|
<h1>Vous avez déjà une carte</h1>
|
||||||
|
<p>Une carte ${e(program)} est déjà associée à <strong id="masked"></strong>. Vos ${unitLower} sont bien conservés.</p>
|
||||||
|
<button class="btn" id="resend" type="button">Renvoyer le lien par e-mail</button>
|
||||||
|
<div class="notice" id="resent" role="status" hidden><strong>C'est envoyé.</strong> Ouvrez l'e-mail sur ce téléphone pour ajouter votre carte. Pensez à regarder dans les courriers indésirables.</div>
|
||||||
|
<button class="btn ghost" id="back" type="button">Utiliser une autre adresse</button>
|
||||||
|
</section>`;
|
||||||
|
|
||||||
|
const script = `
|
||||||
|
(function(){
|
||||||
|
var slug=${JSON.stringify(store.slug)};
|
||||||
|
var $=function(id){return document.getElementById(id)};
|
||||||
|
var lastEmail='';
|
||||||
|
function show(id,on){$(id).hidden=!on}
|
||||||
|
$('f').addEventListener('submit',async function(ev){
|
||||||
|
ev.preventDefault();
|
||||||
|
var firstName=$('firstName').value.trim(),email=$('email').value.trim(),consent=$('consent').checked;
|
||||||
|
var okName=firstName.length>0,okMail=/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(email);
|
||||||
|
show('e-firstName',!okName);show('e-email',!okMail);show('h-email',okMail);show('e-consent',!consent);show('e-global',false);
|
||||||
|
if(!okName||!okMail||!consent)return;
|
||||||
|
$('submit').disabled=true;
|
||||||
|
try{
|
||||||
|
var r=await fetch('/api/public/stores/'+slug+'/enroll',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({firstName:firstName,email:email,consent:true})});
|
||||||
|
var data=await r.json().catch(function(){return {}});
|
||||||
|
if(!r.ok){throw new Error(r.status===409?'Le programme est momentanément indisponible.':r.status===429?'Trop de tentatives, réessayez dans une minute.':'Une erreur est survenue, réessayez.')}
|
||||||
|
if(data.status==='created'){location.href=data.cardUrl+'&nouveau=1';return}
|
||||||
|
lastEmail=email;$('masked').textContent=data.maskedEmail;show('v-form',false);show('v-exists',true);show('resent',false);show('resend',true);
|
||||||
|
}catch(err){$('e-global').textContent=err.message;show('e-global',true)}
|
||||||
|
finally{$('submit').disabled=false}
|
||||||
|
});
|
||||||
|
$('resend').addEventListener('click',async function(){
|
||||||
|
this.disabled=true;
|
||||||
|
await fetch('/api/public/stores/'+slug+'/resend',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({email:lastEmail})}).catch(function(){});
|
||||||
|
show('resend',false);show('resent',true);this.disabled=false;
|
||||||
|
});
|
||||||
|
$('back').addEventListener('click',function(){show('v-exists',false);show('v-form',true);$('email').focus()});
|
||||||
|
})();`;
|
||||||
|
return layout(store, program, body, script);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function unavailablePage(store: StoreWithDesign) {
|
||||||
|
const unitLower = store.cardDesign?.pointsMode === 'STAMP' ? 'tampons' : 'points';
|
||||||
|
return layout(
|
||||||
|
store,
|
||||||
|
store.name,
|
||||||
|
`<span class="eyebrow">${e(store.name)} · ${e(store.city)}</span>
|
||||||
|
<h1>Programme momentanément indisponible</h1>
|
||||||
|
<p>L'inscription au programme de fidélité ${e(de(store.name))} n'est pas possible pour le moment. Si vous avez déjà une carte, vos ${unitLower} sont conservés.</p>
|
||||||
|
<p>N'hésitez pas à vous renseigner au comptoir. Merci de votre fidélité !</p>`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function cardPage(
|
||||||
|
card: CardWithContext,
|
||||||
|
opts: { platform: Platform; isNew: boolean; apple: boolean; google: boolean },
|
||||||
|
) {
|
||||||
|
const store = card.store as StoreWithDesign;
|
||||||
|
const d = store.cardDesign!;
|
||||||
|
const t = theme(store);
|
||||||
|
const unit = d.pointsMode === 'STAMP' ? 'Tampons' : 'Points';
|
||||||
|
const q = `?k=${encodeURIComponent(card.accessKey)}`;
|
||||||
|
const appleBtn = opts.apple
|
||||||
|
? `<a class="btn wallet" href="/api/public/cards/${e(card.serial)}/apple${e(q)}">Ajouter à Apple Wallet</a>`
|
||||||
|
: '';
|
||||||
|
const googleBtn = opts.google
|
||||||
|
? `<a class="btn wallet" href="/api/public/cards/${e(card.serial)}/google${e(q)}">Ajouter à Google Wallet</a>`
|
||||||
|
: '';
|
||||||
|
// Le bouton de la plateforme détectée en premier, l'autre en lien secondaire.
|
||||||
|
const buttons =
|
||||||
|
opts.platform === 'google'
|
||||||
|
? googleBtn + (appleBtn && `<a class="small" href="/api/public/cards/${e(card.serial)}/apple${e(q)}">Vous avez un iPhone ? Apple Wallet</a>`)
|
||||||
|
: opts.platform === 'apple'
|
||||||
|
? appleBtn + (googleBtn && `<a class="small" href="/api/public/cards/${e(card.serial)}/google${e(q)}">Vous avez un Android ? Google Wallet</a>`)
|
||||||
|
: appleBtn + googleBtn;
|
||||||
|
const none = !opts.apple && !opts.google;
|
||||||
|
|
||||||
|
const body = `
|
||||||
|
<div style="display:flex;flex-direction:column;gap:8px">
|
||||||
|
${opts.isNew ? `<span class="icon-ok"><svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg></span>` : ''}
|
||||||
|
<h1>${opts.isNew ? `Votre carte est prête, ${e(card.customer.firstName)} !` : `Votre carte ${e(d.programName)}`}</h1>
|
||||||
|
<p class="hint">Ajoutez-la à votre téléphone et présentez-la au comptoir à chaque passage.</p>
|
||||||
|
</div>
|
||||||
|
<div class="pass" aria-label="Aperçu de votre carte">
|
||||||
|
<div class="top">${t.logo ? `<img src="${e(t.logo)}" alt="">` : ''}<span>${e(d.programName)}</span></div>
|
||||||
|
<div class="band">${t.strip ? `<img src="${e(t.strip)}" alt="">` : ''}<div class="bal"><div class="lbl">${unit}</div><div class="big">${card.balance}</div></div></div>
|
||||||
|
<div class="row"><div><div class="lbl">Membre</div>${e(card.customer.firstName)}</div><div style="text-align:right"><div class="lbl">Récompense</div>${e(d.rewards[0]?.label ?? '—')}</div></div>
|
||||||
|
</div>
|
||||||
|
<div style="display:flex;flex-direction:column;gap:12px;align-items:stretch">
|
||||||
|
${none ? '<div class="notice">L\'ajout au téléphone sera disponible très bientôt. Gardez l\'e-mail reçu : il contient le lien de votre carte.</div>' : buttons}
|
||||||
|
</div>
|
||||||
|
${opts.isNew ? '<p class="small">Un e-mail de confirmation vous a été envoyé avec le lien de votre carte.</p>' : ''}
|
||||||
|
<details style="margin-top:12px">
|
||||||
|
<summary class="small" style="cursor:pointer">Supprimer ma carte</summary>
|
||||||
|
<div style="display:flex;flex-direction:column;gap:12px;margin-top:12px">
|
||||||
|
<p class="hint">Votre carte, votre solde et vos données personnelles seront définitivement effacés. Pensez aussi à retirer la carte de votre Wallet.</p>
|
||||||
|
<button class="btn ghost" id="delete" type="button" style="color:var(--err)">Supprimer définitivement</button>
|
||||||
|
</div>
|
||||||
|
</details>`;
|
||||||
|
|
||||||
|
const script = `
|
||||||
|
document.getElementById('delete').addEventListener('click',async function(){
|
||||||
|
if(!confirm('Supprimer définitivement votre carte et votre solde ?'))return;
|
||||||
|
this.disabled=true;
|
||||||
|
var r=await fetch('/api/public/cards/${card.serial}${q}',{method:'DELETE'});
|
||||||
|
document.querySelector('main').innerHTML=r.ok?'<h1>Carte supprimée</h1><p>Vos données ont été effacées. Vous pouvez retirer la carte de votre Wallet.</p>':'<h1>Suppression impossible</h1><p>Réessayez plus tard.</p>';
|
||||||
|
});`;
|
||||||
|
return layout(store, d.programName, body, script);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function privacyPage(store: StoreWithDesign) {
|
||||||
|
return layout(
|
||||||
|
store,
|
||||||
|
`Confidentialité — ${store.name}`,
|
||||||
|
`<h1>Confidentialité</h1>
|
||||||
|
<p><strong>Responsable du traitement :</strong> ${e(store.name)}, ${e(store.addressLine)}, ${e(store.postalCode)} ${e(store.city)} (SIRET ${e(store.siret)}). Contact : <a href="mailto:${e(store.contactEmail)}">${e(store.contactEmail)}</a>.</p>
|
||||||
|
<p><strong>Données collectées :</strong> votre prénom, votre adresse e-mail, votre solde et l'historique de vos passages (date, montant, points).</p>
|
||||||
|
<p><strong>Finalité :</strong> gérer votre carte de fidélité. Vos données ne sont ni vendues ni utilisées à des fins publicitaires.</p>
|
||||||
|
<p><strong>Base légale :</strong> votre consentement, que vous pouvez retirer à tout moment en supprimant votre carte depuis le lien reçu par e-mail.</p>
|
||||||
|
<p><strong>Sous-traitant :</strong> la plateforme MonEspacePro (EI Tony Averty) héberge les données pour le compte du commerce, en France / Union européenne.</p>
|
||||||
|
<p><strong>Durée de conservation :</strong> tant que votre carte est active, puis suppression.</p>
|
||||||
|
<p><strong>Vos droits :</strong> accès, rectification, effacement, portabilité, en écrivant au commerce. Vous pouvez aussi saisir la CNIL (cnil.fr).</p>
|
||||||
|
<a class="btn ghost" href="/c/${e(store.slug)}">Retour</a>`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function notFoundPage() {
|
||||||
|
return `<!doctype html><html lang="fr"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><meta name="robots" content="noindex"><title>Introuvable</title>
|
||||||
|
<style>body{margin:0;min-height:100vh;display:grid;place-items:center;font:16px/1.5 system-ui,sans-serif;background:#F6F6F3;color:#1C1C19;padding:20px;text-align:center}</style></head>
|
||||||
|
<body><div><h1 style="font-size:24px">Lien introuvable</h1><p>Ce lien n'existe pas ou n'est plus valide. Renseignez-vous au comptoir.</p></div></body></html>`;
|
||||||
|
}
|
||||||
39
backend/src/mail/mail.service.ts
Normal file
39
backend/src/mail/mail.service.ts
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
import { Global, Injectable, Logger, Module } from '@nestjs/common';
|
||||||
|
import { ConfigService } from '@nestjs/config';
|
||||||
|
import { createTransport, Transporter } from 'nodemailer';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Envoi d'e-mails transactionnels. Sans SMTP configuré (développement),
|
||||||
|
* le message est écrit dans les logs au lieu d'être envoyé.
|
||||||
|
*/
|
||||||
|
@Injectable()
|
||||||
|
export class MailService {
|
||||||
|
private readonly logger = new Logger(MailService.name);
|
||||||
|
private readonly transport: Transporter | null;
|
||||||
|
private readonly from: string;
|
||||||
|
|
||||||
|
constructor(config: ConfigService) {
|
||||||
|
const mail = config.get('mail');
|
||||||
|
this.from = mail.from;
|
||||||
|
this.transport = mail.host
|
||||||
|
? createTransport({
|
||||||
|
host: mail.host,
|
||||||
|
port: mail.port,
|
||||||
|
secure: mail.port === 465,
|
||||||
|
auth: mail.user ? { user: mail.user, pass: mail.pass } : undefined,
|
||||||
|
})
|
||||||
|
: null;
|
||||||
|
}
|
||||||
|
|
||||||
|
async send(to: string, subject: string, text: string, html: string) {
|
||||||
|
if (!this.transport) {
|
||||||
|
this.logger.warn(`SMTP non configuré — e-mail à ${to} : « ${subject} »\n${text}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await this.transport.sendMail({ from: this.from, to, subject, text, html });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Global()
|
||||||
|
@Module({ providers: [MailService], exports: [MailService] })
|
||||||
|
export class MailModule {}
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
process.env.TZ = process.env.TZ || 'Europe/Paris';
|
process.env.TZ = process.env.TZ || 'Europe/Paris';
|
||||||
|
|
||||||
import { NestFactory } from '@nestjs/core';
|
import { NestFactory } from '@nestjs/core';
|
||||||
import { ValidationPipe } from '@nestjs/common';
|
import { RequestMethod, ValidationPipe } from '@nestjs/common';
|
||||||
import { ConfigService } from '@nestjs/config';
|
import { ConfigService } from '@nestjs/config';
|
||||||
import { NestExpressApplication } from '@nestjs/platform-express';
|
import { NestExpressApplication } from '@nestjs/platform-express';
|
||||||
import helmet from 'helmet';
|
import helmet from 'helmet';
|
||||||
|
|
@ -32,7 +32,14 @@ async function bootstrap() {
|
||||||
app.use(helmet({ contentSecurityPolicy: false, crossOriginResourcePolicy: { policy: 'cross-origin' } }));
|
app.use(helmet({ contentSecurityPolicy: false, crossOriginResourcePolicy: { policy: 'cross-origin' } }));
|
||||||
// Logos et bandeaux des cartes (aperçu admin, page d'inscription, génération des pass).
|
// Logos et bandeaux des cartes (aperçu admin, page d'inscription, génération des pass).
|
||||||
app.useStaticAssets(UPLOADS_DIR, { prefix: '/uploads/' });
|
app.useStaticAssets(UPLOADS_DIR, { prefix: '/uploads/' });
|
||||||
app.setGlobalPrefix('api');
|
// Les pages client gardent des URL courtes (imprimées sur les QR, envoyées par e-mail).
|
||||||
|
app.setGlobalPrefix('api', {
|
||||||
|
exclude: [
|
||||||
|
{ path: 'c/:slug', method: RequestMethod.GET },
|
||||||
|
{ path: 'c/:slug/confidentialite', method: RequestMethod.GET },
|
||||||
|
{ path: 'carte/:serial', method: RequestMethod.GET },
|
||||||
|
],
|
||||||
|
});
|
||||||
app.useGlobalPipes(new ValidationPipe({ whitelist: true, forbidNonWhitelisted: true, transform: true }));
|
app.useGlobalPipes(new ValidationPipe({ whitelist: true, forbidNonWhitelisted: true, transform: true }));
|
||||||
|
|
||||||
const origins = (config.get<string>('cors.origins') ?? '')
|
const origins = (config.get<string>('cors.origins') ?? '')
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import { BadRequestException, Injectable, NotFoundException } from '@nestjs/common';
|
import { BadRequestException, Injectable, NotFoundException } from '@nestjs/common';
|
||||||
|
import { ConfigService } from '@nestjs/config';
|
||||||
import { Prisma, Store, StoreStatus } from '@prisma/client';
|
import { Prisma, Store, StoreStatus } from '@prisma/client';
|
||||||
import { randomBytes } from 'crypto';
|
import { randomBytes } from 'crypto';
|
||||||
import { PrismaService } from '../prisma/prisma.service';
|
import { PrismaService } from '../prisma/prisma.service';
|
||||||
|
|
@ -14,7 +15,10 @@ const TRANSITIONS: Record<StoreStatus, StoreStatus[]> = {
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class StoresService {
|
export class StoresService {
|
||||||
constructor(private prisma: PrismaService) {}
|
constructor(
|
||||||
|
private prisma: PrismaService,
|
||||||
|
private config: ConfigService,
|
||||||
|
) {}
|
||||||
|
|
||||||
async list(query: ListStoresQuery) {
|
async list(query: ListStoresQuery) {
|
||||||
const where: Prisma.StoreWhereInput = {
|
const where: Prisma.StoreWhereInput = {
|
||||||
|
|
@ -49,7 +53,12 @@ export class StoresService {
|
||||||
});
|
});
|
||||||
if (!store) throw new NotFoundException('Magasin introuvable');
|
if (!store) throw new NotFoundException('Magasin introuvable');
|
||||||
const { _count, subscription, ...s } = store;
|
const { _count, subscription, ...s } = store;
|
||||||
return { ...this.present(s), counts: _count, subscription };
|
return {
|
||||||
|
...this.present(s),
|
||||||
|
counts: _count,
|
||||||
|
subscription,
|
||||||
|
enrollUrl: `${this.config.get('publicUrl')}/c/${s.slug}`,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
async create(dto: CreateStoreDto) {
|
async create(dto: CreateStoreDto) {
|
||||||
|
|
@ -76,6 +85,10 @@ export class StoresService {
|
||||||
if (status === 'ACTIVE' && !store.cardDesign) {
|
if (status === 'ACTIVE' && !store.cardDesign) {
|
||||||
throw new BadRequestException("La carte de fidélité doit être conçue avant l'activation");
|
throw new BadRequestException("La carte de fidélité doit être conçue avant l'activation");
|
||||||
}
|
}
|
||||||
|
if (status === 'ACTIVE' && !store.cardDesign?.logoPath) {
|
||||||
|
// Google Wallet refuse une carte sans logo ; Apple s'en sert comme icône.
|
||||||
|
throw new BadRequestException("Ajoutez le logo du magasin avant l'activation");
|
||||||
|
}
|
||||||
const updated = await this.prisma.store.update({ where: { id }, data: { status } });
|
const updated = await this.prisma.store.update({ where: { id }, data: { status } });
|
||||||
return this.present(updated);
|
return this.present(updated);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
135
backend/src/wallet/apple-pass.service.ts
Normal file
135
backend/src/wallet/apple-pass.service.ts
Normal file
|
|
@ -0,0 +1,135 @@
|
||||||
|
import { Injectable, Logger, ServiceUnavailableException } from '@nestjs/common';
|
||||||
|
import { ConfigService } from '@nestjs/config';
|
||||||
|
import { readFileSync } from 'fs';
|
||||||
|
import { join } from 'path';
|
||||||
|
import { Jimp } from 'jimp';
|
||||||
|
import { PKPass } from 'passkit-generator';
|
||||||
|
import { UPLOADS_DIR } from '../card-design/card-design.service';
|
||||||
|
import { CardWithContext, rewardsText, unitLabel } from './wallet.types';
|
||||||
|
|
||||||
|
type Certificates = { wwdr: Buffer; signerCert: Buffer; signerKey: Buffer; signerKeyPassphrase?: string };
|
||||||
|
|
||||||
|
/** « #1F2937 » → « rgb(31, 41, 55) » (seul format accepté par pass.json). */
|
||||||
|
function rgb(hex: string) {
|
||||||
|
const [r, g, b] = [1, 3, 5].map((i) => parseInt(hex.slice(i, i + 2), 16));
|
||||||
|
return `rgb(${r}, ${g}, ${b})`;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Génération des .pkpass Apple Wallet (style « storeCard »).
|
||||||
|
* Le QR contient le numéro de série de la carte : fixe, la protection
|
||||||
|
* anti-triche est faite côté serveur au moment du scan.
|
||||||
|
*/
|
||||||
|
@Injectable()
|
||||||
|
export class ApplePassService {
|
||||||
|
private readonly logger = new Logger(ApplePassService.name);
|
||||||
|
private certificates: Certificates | null | undefined;
|
||||||
|
|
||||||
|
constructor(private config: ConfigService) {}
|
||||||
|
|
||||||
|
get enabled() {
|
||||||
|
return this.loadCertificates() !== null;
|
||||||
|
}
|
||||||
|
|
||||||
|
async generate(card: CardWithContext): Promise<Buffer> {
|
||||||
|
const certificates = this.loadCertificates();
|
||||||
|
if (!certificates) throw new ServiceUnavailableException('Apple Wallet n’est pas encore configuré');
|
||||||
|
const design = card.store.cardDesign;
|
||||||
|
if (!design) throw new ServiceUnavailableException('Carte non conçue');
|
||||||
|
|
||||||
|
const unit = unitLabel(card);
|
||||||
|
const passJson = {
|
||||||
|
formatVersion: 1,
|
||||||
|
passTypeIdentifier: this.config.get('apple.passTypeId'),
|
||||||
|
teamIdentifier: this.config.get('apple.teamId'),
|
||||||
|
serialNumber: card.serial,
|
||||||
|
organizationName: card.store.name,
|
||||||
|
description: design.programName,
|
||||||
|
backgroundColor: rgb(design.backgroundColor),
|
||||||
|
foregroundColor: rgb(design.foregroundColor),
|
||||||
|
labelColor: rgb(design.labelColor),
|
||||||
|
...(design.logoPath ? {} : { logoText: card.store.name }),
|
||||||
|
sharingProhibited: true,
|
||||||
|
barcodes: [{ format: 'PKBarcodeFormatQR', message: card.serial, messageEncoding: 'iso-8859-1' }],
|
||||||
|
storeCard: {
|
||||||
|
headerFields: [{ key: 'balance-header', label: unit.toUpperCase(), value: card.balance }],
|
||||||
|
primaryFields: [{ key: 'balance', label: 'SOLDE', value: card.balance, changeMessage: `Nouveau solde : %@ ${unit.toLowerCase()}` }],
|
||||||
|
secondaryFields: [
|
||||||
|
{ key: 'program', label: 'PROGRAMME', value: design.programName },
|
||||||
|
{ key: 'member', label: 'MEMBRE', value: card.customer.firstName, textAlignment: 'PKTextAlignmentRight' },
|
||||||
|
],
|
||||||
|
backFields: [
|
||||||
|
{ key: 'rewards', label: 'Récompenses', value: rewardsText(card) },
|
||||||
|
{
|
||||||
|
key: 'store',
|
||||||
|
label: card.store.name,
|
||||||
|
value: `${card.store.addressLine}\n${card.store.postalCode} ${card.store.city}`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'manage',
|
||||||
|
label: 'Ma carte',
|
||||||
|
value: `${this.config.get('publicUrl')}/carte/${card.serial}?k=${card.accessKey}`,
|
||||||
|
},
|
||||||
|
{ key: 'powered', label: '', value: 'Propulsé par MonEspacePro' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const pass = new PKPass(
|
||||||
|
{ 'pass.json': Buffer.from(JSON.stringify(passJson)), ...(await this.images(card)) },
|
||||||
|
certificates,
|
||||||
|
);
|
||||||
|
return pass.getAsBuffer();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Icône (obligatoire), logo et bandeau aux trois densités d'écran. */
|
||||||
|
private async images(card: CardWithContext) {
|
||||||
|
const design = card.store.cardDesign!;
|
||||||
|
const files: Record<string, Buffer> = {};
|
||||||
|
const scales = [1, 2, 3] as const;
|
||||||
|
const name = (base: string, s: number) => (s === 1 ? `${base}.png` : `${base}@${s}x.png`);
|
||||||
|
|
||||||
|
if (design.logoPath) {
|
||||||
|
const logo = await Jimp.read(join(UPLOADS_DIR, design.logoPath));
|
||||||
|
for (const s of scales) {
|
||||||
|
files[name('icon', s)] = await logo.clone().contain({ w: 29 * s, h: 29 * s }).getBuffer('image/png');
|
||||||
|
files[name('logo', s)] = await logo.clone().scaleToFit({ w: 160 * s, h: 50 * s }).getBuffer('image/png');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Icône unie à la couleur de la carte : Apple refuse un pass sans icône.
|
||||||
|
for (const s of scales) {
|
||||||
|
const icon = new Jimp({ width: 29 * s, height: 29 * s, color: design.backgroundColor + 'FF' });
|
||||||
|
files[name('icon', s)] = await icon.getBuffer('image/png');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (design.stripPath) {
|
||||||
|
const strip = await Jimp.read(join(UPLOADS_DIR, design.stripPath));
|
||||||
|
for (const s of scales) {
|
||||||
|
files[name('strip', s)] = await strip.clone().cover({ w: 375 * s, h: 144 * s }).getBuffer('image/png');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return files;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Lus une fois ; null si la configuration Apple est incomplète. */
|
||||||
|
private loadCertificates(): Certificates | null {
|
||||||
|
if (this.certificates !== undefined) return this.certificates;
|
||||||
|
const a = this.config.get('apple');
|
||||||
|
if (!a.passTypeId || !a.teamId || !a.signerCert || !a.signerKey || !a.wwdrCert) {
|
||||||
|
this.certificates = null;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
this.certificates = {
|
||||||
|
signerCert: readFileSync(a.signerCert),
|
||||||
|
signerKey: readFileSync(a.signerKey),
|
||||||
|
wwdr: readFileSync(a.wwdrCert),
|
||||||
|
signerKeyPassphrase: a.signerKeyPassphrase,
|
||||||
|
};
|
||||||
|
} catch (e) {
|
||||||
|
this.logger.error(`Certificats Apple illisibles : ${(e as Error).message}`);
|
||||||
|
this.certificates = null;
|
||||||
|
}
|
||||||
|
return this.certificates;
|
||||||
|
}
|
||||||
|
}
|
||||||
101
backend/src/wallet/google-wallet.service.ts
Normal file
101
backend/src/wallet/google-wallet.service.ts
Normal file
|
|
@ -0,0 +1,101 @@
|
||||||
|
import { Injectable, Logger, ServiceUnavailableException } from '@nestjs/common';
|
||||||
|
import { ConfigService } from '@nestjs/config';
|
||||||
|
import { readFileSync } from 'fs';
|
||||||
|
import { importPKCS8, SignJWT } from 'jose';
|
||||||
|
import { CardWithContext, rewardsText, unitLabel } from './wallet.types';
|
||||||
|
|
||||||
|
type ServiceAccount = { client_email: string; private_key: string };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Google Wallet : lien « Ajouter à Google Wallet » sous forme de JWT signé
|
||||||
|
* par le compte de service, qui embarque la classe (le programme du
|
||||||
|
* magasin) et l'objet (la carte du client). Aucun appel à l'API Google
|
||||||
|
* n'est nécessaire à l'inscription ; les mises à jour du solde passeront
|
||||||
|
* par l'API REST (étape 5).
|
||||||
|
*/
|
||||||
|
@Injectable()
|
||||||
|
export class GoogleWalletService {
|
||||||
|
private readonly logger = new Logger(GoogleWalletService.name);
|
||||||
|
private account: ServiceAccount | null | undefined;
|
||||||
|
|
||||||
|
constructor(private config: ConfigService) {}
|
||||||
|
|
||||||
|
get enabled() {
|
||||||
|
return this.loadAccount() !== null;
|
||||||
|
}
|
||||||
|
|
||||||
|
classId(storeId: string) {
|
||||||
|
return `${this.config.get('google.issuerId')}.store_${storeId}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
objectId(serial: string) {
|
||||||
|
return `${this.config.get('google.issuerId')}.card_${serial}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
async saveUrl(card: CardWithContext): Promise<string> {
|
||||||
|
const account = this.loadAccount();
|
||||||
|
if (!account) throw new ServiceUnavailableException('Google Wallet n’est pas encore configuré');
|
||||||
|
const design = card.store.cardDesign;
|
||||||
|
if (!design?.logoPath) throw new ServiceUnavailableException('Logo du magasin manquant');
|
||||||
|
|
||||||
|
const publicUrl: string = this.config.get('publicUrl')!;
|
||||||
|
const image = (path: string, description: string) => ({
|
||||||
|
sourceUri: { uri: `${publicUrl}/uploads/${path}` },
|
||||||
|
contentDescription: { defaultValue: { language: 'fr-FR', value: description } },
|
||||||
|
});
|
||||||
|
|
||||||
|
const loyaltyClass = {
|
||||||
|
id: this.classId(card.storeId),
|
||||||
|
issuerName: card.store.name,
|
||||||
|
programName: design.programName,
|
||||||
|
programLogo: image(design.logoPath, `Logo ${card.store.name}`),
|
||||||
|
...(design.stripPath && { heroImage: image(design.stripPath, card.store.name) }),
|
||||||
|
hexBackgroundColor: design.backgroundColor,
|
||||||
|
reviewStatus: 'UNDER_REVIEW',
|
||||||
|
countryCode: 'FR',
|
||||||
|
multipleDevicesAndHoldersAllowedStatus: 'ONE_USER_ALL_DEVICES',
|
||||||
|
};
|
||||||
|
const loyaltyObject = {
|
||||||
|
id: this.objectId(card.serial),
|
||||||
|
classId: loyaltyClass.id,
|
||||||
|
state: 'ACTIVE',
|
||||||
|
accountId: card.serial,
|
||||||
|
accountName: card.customer.firstName,
|
||||||
|
loyaltyPoints: { label: unitLabel(card), balance: { int: card.balance } },
|
||||||
|
barcode: { type: 'QR_CODE', value: card.serial },
|
||||||
|
textModulesData: [{ id: 'rewards', header: 'Récompenses', body: rewardsText(card) }],
|
||||||
|
linksModuleData: {
|
||||||
|
uris: [{ id: 'manage', uri: `${publicUrl}/carte/${card.serial}?k=${card.accessKey}`, description: 'Ma carte' }],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const key = await importPKCS8(account.private_key, 'RS256');
|
||||||
|
const jwt = await new SignJWT({
|
||||||
|
origins: [publicUrl],
|
||||||
|
typ: 'savetowallet',
|
||||||
|
payload: { loyaltyClasses: [loyaltyClass], loyaltyObjects: [loyaltyObject] },
|
||||||
|
})
|
||||||
|
.setProtectedHeader({ alg: 'RS256', typ: 'JWT' })
|
||||||
|
.setIssuer(account.client_email)
|
||||||
|
.setAudience('google')
|
||||||
|
.setIssuedAt()
|
||||||
|
.sign(key);
|
||||||
|
return `https://pay.google.com/gp/v/save/${jwt}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
private loadAccount(): ServiceAccount | null {
|
||||||
|
if (this.account !== undefined) return this.account;
|
||||||
|
const file: string = this.config.get('google.serviceAccountFile')!;
|
||||||
|
if (!file || !this.config.get('google.issuerId')) {
|
||||||
|
this.account = null;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
this.account = JSON.parse(readFileSync(file, 'utf8')) as ServiceAccount;
|
||||||
|
} catch (e) {
|
||||||
|
this.logger.error(`Clé Google Wallet illisible : ${(e as Error).message}`);
|
||||||
|
this.account = null;
|
||||||
|
}
|
||||||
|
return this.account;
|
||||||
|
}
|
||||||
|
}
|
||||||
21
backend/src/wallet/wallet.types.ts
Normal file
21
backend/src/wallet/wallet.types.ts
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
import { Prisma } from '@prisma/client';
|
||||||
|
|
||||||
|
/** Tout ce qu'il faut pour dessiner une carte, chargé en une requête. */
|
||||||
|
export const CARD_WITH_CONTEXT = {
|
||||||
|
customer: true,
|
||||||
|
store: { include: { cardDesign: { include: { rewards: { where: { active: true }, orderBy: { cost: 'asc' } } } } } },
|
||||||
|
} satisfies Prisma.LoyaltyCardInclude;
|
||||||
|
|
||||||
|
export type CardWithContext = Prisma.LoyaltyCardGetPayload<{ include: typeof CARD_WITH_CONTEXT }>;
|
||||||
|
|
||||||
|
export function unitLabel(card: CardWithContext, plural = true) {
|
||||||
|
const stamp = card.store.cardDesign?.pointsMode === 'STAMP';
|
||||||
|
if (!plural) return stamp ? 'tampon' : 'point';
|
||||||
|
return stamp ? 'Tampons' : 'Points';
|
||||||
|
}
|
||||||
|
|
||||||
|
export function rewardsText(card: CardWithContext) {
|
||||||
|
const unit = card.store.cardDesign?.pointsMode === 'STAMP' ? 'tampons' : 'points';
|
||||||
|
const rewards = card.store.cardDesign?.rewards ?? [];
|
||||||
|
return rewards.length ? rewards.map((r) => `${r.label} — ${r.cost} ${unit}`).join('\n') : 'Renseignez-vous au comptoir.';
|
||||||
|
}
|
||||||
30
docs/wallet.md
Normal file
30
docs/wallet.md
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
# Configuration Apple Wallet et Google Wallet
|
||||||
|
|
||||||
|
## Apple Wallet
|
||||||
|
|
||||||
|
1. developer.apple.com → Identifiers → **Pass Type IDs** → créer `pass.<domaine-inversé>.mep`.
|
||||||
|
2. Sur ce Pass Type ID → **Create Certificate** (CSR générée depuis Trousseau d'accès, ou avec OpenSSL ci-dessous).
|
||||||
|
3. Télécharger le certificat **Apple WWDR G4** : https://www.apple.com/certificateauthority/ (`AppleWWDRCAG4.cer`).
|
||||||
|
4. Convertir en PEM (Git Bash, sur ton PC — pas besoin de shell sur le serveur) :
|
||||||
|
|
||||||
|
```bash
|
||||||
|
openssl pkcs12 -in pass.p12 -clcerts -nokeys -out signerCert.pem -legacy
|
||||||
|
openssl pkcs12 -in pass.p12 -nocerts -out signerKey.pem -legacy
|
||||||
|
openssl x509 -inform der -in AppleWWDRCAG4.cer -out wwdr.pem
|
||||||
|
```
|
||||||
|
|
||||||
|
5. Déposer les trois `.pem` sur le serveur **hors du dossier public** (ex. `backend/certs/`, ignoré par git) et renseigner
|
||||||
|
`APPLE_PASS_TYPE_ID`, `APPLE_TEAM_ID`, `APPLE_SIGNER_CERT`, `APPLE_SIGNER_KEY`, `APPLE_SIGNER_KEY_PASSPHRASE`, `APPLE_WWDR_CERT`.
|
||||||
|
|
||||||
|
## Google Wallet
|
||||||
|
|
||||||
|
1. pay.google.com/business/console → **Google Wallet API** → noter l'**Issuer ID**.
|
||||||
|
2. Google Cloud Console → activer « Google Wallet API » → créer un **compte de service** → clé JSON.
|
||||||
|
3. Dans la console Wallet → Utilisateurs → ajouter l'e-mail du compte de service (rôle Développeur).
|
||||||
|
4. Déposer la clé JSON dans `backend/certs/` et renseigner `GOOGLE_WALLET_ISSUER_ID`, `GOOGLE_WALLET_SA_FILE`.
|
||||||
|
5. Tant que le compte émetteur est en mode démo, seuls les comptes Google de test ajoutés dans la console peuvent enregistrer une carte.
|
||||||
|
|
||||||
|
## Notes
|
||||||
|
- `PUBLIC_URL` doit être en HTTPS en production : Google télécharge les logos depuis cette adresse.
|
||||||
|
- Les boutons « Ajouter à Apple Wallet / Google Wallet » sont provisoires : remplacer par les badges officiels FR
|
||||||
|
(Apple : developer.apple.com/wallet/add-to-apple-wallet-guidelines, Google : developers.google.com/wallet/generic/resources/brand-guidelines).
|
||||||
Loading…
Reference in a new issue