diff --git a/client/schema/index.js b/client/schema/index.js index 71a33484..8c877e2b 100644 --- a/client/schema/index.js +++ b/client/schema/index.js @@ -26,28 +26,13 @@ export function getGrantedSubsections(schemaVersion) { export function getSubsections(schemaVersion) { const schema = versions[schemaVersion]; - const subsections = Object.values(schema()) + return Object.values(schema()) .reduce((sections, section) => { return { ...sections, ...(section.subsections || {}) }; }, {}); - - if (schemaVersion === 1) { - // inject the project licence holder into introductory details - const field = [ - { - label: 'Licence holder', - name: 'licenceHolder', - type: 'holder-name' - } - ]; - - subsections['introduction'].fields.splice(1, 0, field); - } - - return subsections; } export default versions; diff --git a/package-lock.json b/package-lock.json index 09910d24..12c8f242 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@asl/projects", - "version": "15.6.7", + "version": "15.6.9", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@asl/projects", - "version": "15.6.7", + "version": "15.6.9", "license": "MIT", "dependencies": { "@asl/service": "^10.3.2", @@ -3647,19 +3647,21 @@ "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==" }, "node_modules/cookie": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.1.tgz", - "integrity": "sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA==", + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", + "license": "MIT", "engines": { "node": ">= 0.6" } }, "node_modules/cookie-parser": { - "version": "1.4.6", - "resolved": "https://registry.npmjs.org/cookie-parser/-/cookie-parser-1.4.6.tgz", - "integrity": "sha512-z3IzaNjdwUC2olLIB5/ITd0/setiaFMLYiZJle7xg5Fe9KWAceil7xszYfHHBtDFYLSgJduS2Ty0P1uJdPDJeA==", + "version": "1.4.7", + "resolved": "https://registry.npmjs.org/cookie-parser/-/cookie-parser-1.4.7.tgz", + "integrity": "sha512-nGUvgXnotP3BsjiLX2ypbQnWoGUPIIfHQNZkkC668ntrzGWEZVW70HDEB1qnNGMicPje6EttlIgzo51YSwNQGw==", + "license": "MIT", "dependencies": { - "cookie": "0.4.1", + "cookie": "0.7.2", "cookie-signature": "1.0.6" }, "engines": { @@ -4856,16 +4858,17 @@ } }, "node_modules/express": { - "version": "4.21.0", - "resolved": "https://registry.npmjs.org/express/-/express-4.21.0.tgz", - "integrity": "sha512-VqcNGcj/Id5ZT1LZ/cfihi3ttTn+NJmkli2eZADigjq29qTlWi/hAQ43t/VLPq8+UX06FCEx3ByOYet6ZFblng==", + "version": "4.21.1", + "resolved": "https://registry.npmjs.org/express/-/express-4.21.1.tgz", + "integrity": "sha512-YSFlK1Ee0/GC8QaO91tHcDxJiE/X4FbpAyQWkxAvG6AXCuR65YzK8ua6D9hvi/TzUfZMpc+BwuM1IPw8fmQBiQ==", + "license": "MIT", "dependencies": { "accepts": "~1.3.8", "array-flatten": "1.1.1", "body-parser": "1.20.3", "content-disposition": "0.5.4", "content-type": "~1.0.4", - "cookie": "0.6.0", + "cookie": "0.7.1", "cookie-signature": "1.0.6", "debug": "2.6.9", "depd": "2.0.0", @@ -4916,11 +4919,12 @@ } }, "node_modules/express-session": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/express-session/-/express-session-1.18.0.tgz", - "integrity": "sha512-m93QLWr0ju+rOwApSsyso838LQwgfs44QtOP/WBiwtAgPIo/SAh1a5c6nn2BR6mFNZehTpqKDESzP+fRHVbxwQ==", + "version": "1.18.1", + "resolved": "https://registry.npmjs.org/express-session/-/express-session-1.18.1.tgz", + "integrity": "sha512-a5mtTqEaZvBCL9A9aqkrtfz+3SMDhOVUnjafjo+s7A9Txkq+SVX2DLvSp1Zrv4uCXa3lMSK3viWnh9Gg07PBUA==", + "license": "MIT", "dependencies": { - "cookie": "0.6.0", + "cookie": "0.7.2", "cookie-signature": "1.0.7", "debug": "2.6.9", "depd": "~2.0.0", @@ -4933,14 +4937,6 @@ "node": ">= 0.8.0" } }, - "node_modules/express-session/node_modules/cookie": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz", - "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==", - "engines": { - "node": ">= 0.6" - } - }, "node_modules/express-session/node_modules/cookie-signature": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.7.tgz", @@ -4960,9 +4956,10 @@ "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" }, "node_modules/express/node_modules/cookie": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz", - "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==", + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.1.tgz", + "integrity": "sha512-6DnInpx7SJ2AK3+CTUE/ZM0vWTUboZCegxhC2xiIydHR9jNuTAASBrfEpHhiGOZw/nX51bHt6YQl8jsGo4y/0w==", + "license": "MIT", "engines": { "node": ">= 0.6" } diff --git a/package.json b/package.json index 33c4e3b8..0cc617dd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@asl/projects", - "version": "15.6.8", + "version": "15.6.9", "description": "ASL PPL prototype", "main": "client/external.js", "styles": "assets/scss/projects.scss", diff --git a/views/pdf/v1/index.jsx b/views/pdf/v1/index.jsx index 9970188f..cedef7e9 100644 --- a/views/pdf/v1/index.jsx +++ b/views/pdf/v1/index.jsx @@ -5,12 +5,27 @@ import { getGrantedSubsections, getSubsections } from '../../../client/schema'; import StaticSection from '../../../client/components/static-section'; import StandardConditions from '../components/standard-conditions'; +function injectLicenceHolder(subsections) { + // inject the project licence holder into introductory details + const field = [ + { + label: 'Licence holder', + name: 'licenceHolder', + type: 'holder-name' + } + ]; + + subsections['introduction'].fields.splice(1, 0, field); + + return subsections; +} + export default function PDF() { const project = useSelector(state => state.project); const isFullApplication = useSelector(state => state.application.isFullApplication); const sections = isFullApplication - ? Object.values(getSubsections(1)) + ? Object.values(injectLicenceHolder(getSubsections(1))) .filter(s => !s.show || s.show(project)) : Object.values(getGrantedSubsections(1)) .filter(s => !s.granted.show || s.granted.show(project)) @@ -31,5 +46,5 @@ export default function PDF() { !isFullApplication && } - ) + ); }