diff --git a/api.planx.uk/admin/session/digitalPlanningData.test.ts b/api.planx.uk/admin/session/digitalPlanningData.test.ts new file mode 100644 index 0000000000..6dbeb7c078 --- /dev/null +++ b/api.planx.uk/admin/session/digitalPlanningData.test.ts @@ -0,0 +1,48 @@ +import supertest from "supertest"; +import app from "../../server"; +import { authHeader } from "../../tests/mockJWT"; +import { expectedPlanningPermissionPayload } from "../../tests/mocks/digitalPlanningDataMocks"; + +const endpoint = (strings: TemplateStringsArray) => + `/admin/session/${strings[0]}/digital-planning-application`; + +const mockGenerateDigitalPlanningApplicationPayload = jest.fn().mockResolvedValue(expectedPlanningPermissionPayload); + +jest.mock("@opensystemslab/planx-core", () => { + return { + CoreDomainClient: jest.fn().mockImplementation(() => ({ + export: { + digitalPlanningDataPayload: () => mockGenerateDigitalPlanningApplicationPayload(), + }, + })), + }; +}); + +describe("Digital Planning Application payload admin endpoint", () => { + it("requires a user to be logged in", async () => { + await supertest(app) + .get(endpoint`123`) + .expect(401) + .then((res) => + expect(res.body).toEqual({ + error: "No authorization token was found", + }), + ); + }); + + it("requires a user to have the 'platformAdmin' role", async () => { + await supertest(app) + .get(endpoint`123`) + .set(authHeader({ role: "teamEditor" })) + .expect(403); + }); + + it("returns a valid JSON payload", async () => { + await supertest(app) + .get(endpoint`123`) + .set(authHeader({ role: "platformAdmin" })) + .expect(200) + .expect("content-type", "application/json; charset=utf-8") + .then((res) => expect(res.body).toEqual(expectedPlanningPermissionPayload)); + }); +}); diff --git a/api.planx.uk/admin/session/digitalPlanningData.ts b/api.planx.uk/admin/session/digitalPlanningData.ts new file mode 100644 index 0000000000..9b8c258a83 --- /dev/null +++ b/api.planx.uk/admin/session/digitalPlanningData.ts @@ -0,0 +1,31 @@ +import { NextFunction, Request, Response } from "express"; +import { $api } from "../../client"; + +/** + * @swagger + * /admin/session/{sessionId}/digital-planning-application: + * get: + * summary: Generates a Digital Planning Application payload + * description: Generates a Digital Planning Application payload and validates it against the Digital Planning Data JSON Schema + * tags: + * - admin + * parameters: + * - $ref: '#/components/parameters/sessionId' + * security: + * - bearerAuth: [] + */ +export const getDigitalPlanningApplicationPayload = async ( + req: Request, + res: Response, + next: NextFunction, +) => { + try { + const data = await $api.export.digitalPlanningDataPayload(req.params.sessionId); + res.set("content-type", "application/json"); + return res.send(data); + } catch (error) { + return next({ + message: "Failed to make Digital Planning Application payload: " + (error as Error).message, + }); + } +}; diff --git a/api.planx.uk/package.json b/api.planx.uk/package.json index 2c9e8c3c74..bd806c9e69 100644 --- a/api.planx.uk/package.json +++ b/api.planx.uk/package.json @@ -4,7 +4,7 @@ "private": true, "dependencies": { "@airbrake/node": "^2.1.8", - "@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#3a85966", + "@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#280aaff", "@types/isomorphic-fetch": "^0.0.36", "adm-zip": "^0.5.10", "aws-sdk": "^2.1467.0", diff --git a/api.planx.uk/pnpm-lock.yaml b/api.planx.uk/pnpm-lock.yaml index 8089877bfe..2564b88bd6 100644 --- a/api.planx.uk/pnpm-lock.yaml +++ b/api.planx.uk/pnpm-lock.yaml @@ -9,8 +9,8 @@ dependencies: specifier: ^2.1.8 version: 2.1.8 '@opensystemslab/planx-core': - specifier: git+https://github.com/theopensystemslab/planx-core#3a85966 - version: github.com/theopensystemslab/planx-core/3a85966 + specifier: git+https://github.com/theopensystemslab/planx-core#280aaff + version: github.com/theopensystemslab/planx-core/280aaff '@types/isomorphic-fetch': specifier: ^0.0.36 version: 0.0.36 @@ -8152,10 +8152,11 @@ packages: resolution: {integrity: sha512-iC+8Io04lddc+mVqQ9AZ7OQ2MrUKGN+oIQyq1vemgt46jwCwLfhq7/pwnBnNXXXZb8VTVLKwp9EDkx+ryxIWmg==} dev: false - github.com/theopensystemslab/planx-core/3a85966: - resolution: {tarball: https://codeload.github.com/theopensystemslab/planx-core/tar.gz/3a85966} + github.com/theopensystemslab/planx-core/280aaff: + resolution: {tarball: https://codeload.github.com/theopensystemslab/planx-core/tar.gz/280aaff} name: '@opensystemslab/planx-core' version: 1.0.0 + prepare: true requiresBuild: true dependencies: '@emotion/react': 11.11.1(react@18.2.0) diff --git a/api.planx.uk/server.ts b/api.planx.uk/server.ts index e6d5910e9f..b038b36dc7 100644 --- a/api.planx.uk/server.ts +++ b/api.planx.uk/server.ts @@ -73,6 +73,7 @@ import webhookRoutes from "./modules/webhooks/routes"; import analyticsRoutes from "./modules/analytics/routes"; import { useSwaggerDocs } from "./docs"; import { Role } from "@opensystemslab/planx-core/types"; +import { getDigitalPlanningApplicationPayload } from "./admin/session/digitalPlanningData"; const router = express.Router(); @@ -213,6 +214,7 @@ app.get("/admin/session/:sessionId/html", getHTMLExport); app.get("/admin/session/:sessionId/html-redacted", getRedactedHTMLExport); app.get("/admin/session/:sessionId/zip", generateZip); app.get("/admin/session/:sessionId/summary", getSessionSummary); +app.get("/admin/session/:sessionId/digital-planning-application", getDigitalPlanningApplicationPayload); app.post("/flows/:flowId/copy", useTeamEditorAuth, copyFlow); diff --git a/api.planx.uk/tests/mocks/digitalPlanningDataMocks.ts b/api.planx.uk/tests/mocks/digitalPlanningDataMocks.ts new file mode 100644 index 0000000000..9a9f0920cb --- /dev/null +++ b/api.planx.uk/tests/mocks/digitalPlanningDataMocks.ts @@ -0,0 +1,1713 @@ +export const expectedPlanningPermissionPayload = { + data: { + application: { + type: { + value: 'pp.full.householder', + description: 'Planning Permission - Full householder', + }, + fee: { + calculated: 206, + payable: 206, + exemption: { + disability: true, + resubmission: true, + }, + reduction: { + sports: true, + parishCouncil: true, + alternative: true, + }, + reference: { + govPay: 'sandbox-ref-456', + }, + }, + declaration: { + accurate: true, + connection: { + value: 'none', + }, + }, + }, + user: { + role: 'proxy', + }, + applicant: { + type: 'individual', + contact: { + name: { + first: 'David', + last: 'Bowie', + }, + email: 'ziggy@example.com', + phone: { + primary: 'Not provided by agent', + }, + company: {}, + }, + address: { + sameAsSiteAddress: true, + }, + siteContact: { + role: 'proxy', + }, + interest: 'owner.sole', + ownership: { + certificate: 'a', + }, + agent: { + contact: { + name: { + first: 'Ziggy', + last: 'Stardust', + }, + email: 'ziggy@example.com', + phone: { + primary: '01100 0110 0011', + }, + company: {}, + }, + address: { + line1: '40 Stansfield Road', + line2: 'Brixton', + town: 'London', + county: 'Greater London', + postcode: 'SW9 9RZ', + country: 'UK', + }, + }, + }, + property: { + address: { + latitude: 51.4656522, + longitude: -0.1185926, + x: 530787, + y: 175754, + title: '40, STANSFIELD ROAD, LONDON', + singleLine: '40, STANSFIELD ROAD, LONDON, SW9 9RZ', + source: 'Ordnance Survey', + uprn: '100021892955', + usrn: '21901294', + pao: '40', + street: 'STANSFIELD ROAD', + town: 'LONDON', + postcode: 'SW9 9RZ', + }, + boundary: { + site: { + type: 'Feature', + geometry: { + type: 'Polygon', + coordinates: [ + [ + [-0.1186569035053321, 51.465703531871384], + [-0.1185938715934822, 51.465724418998775], + [-0.1184195280075143, 51.46552473766957], + [-0.11848390102387167, 51.4655038504508], + [-0.1186569035053321, 51.465703531871384], + ], + ], + }, + properties: null, + }, + area: { + hectares: 0.012592, + squareMetres: 125.92, + }, + }, + constraints: { + planning: [ + { + value: 'tpo', + description: 'Tree Preservation Order (TPO) or zone', + overlaps: false, + }, + { + value: 'listed', + description: 'Listed Building', + overlaps: false, + }, + { + value: 'article4', + description: 'Article 4 Direction area', + overlaps: false, + }, + { + value: 'monument', + description: 'Site of a Scheduled Monument', + overlaps: false, + }, + { + value: 'designated', + description: 'Designated land', + overlaps: false, + }, + { + value: 'nature.SAC', + description: 'Special Area of Conservation (SAC)', + overlaps: false, + }, + { + value: 'nature.ASNW', + description: 'Ancient Semi-Natural Woodland (ASNW)', + overlaps: false, + }, + { + value: 'nature.SSSI', + description: 'Site of Special Scientific Interest (SSSI)', + overlaps: false, + }, + { + value: 'locallyListed', + description: 'Locally Listed Building', + overlaps: false, + }, + { + value: 'designated.SPA', + description: 'Special Protection Area (SPA)', + overlaps: false, + }, + { + value: 'designated.WHS', + description: 'UNESCO World Heritage Site or buffer zone', + overlaps: false, + }, + { + value: 'registeredPark', + description: 'Historic Park or Garden', + overlaps: false, + }, + { + value: 'designated.AONB', + description: 'Area of Outstanding Natural Beauty (AONB)', + overlaps: false, + }, + { + value: 'article4.caz', + description: 'Central Activities Zone (CAZ)', + overlaps: false, + }, + { + value: 'designated.nationalPark', + description: 'National Park', + overlaps: false, + }, + { + value: 'designated.conservationArea', + description: 'Conservation Area', + overlaps: false, + }, + { + value: 'designated.nationalPark.broads', + description: 'National Park - Broads', + overlaps: false, + }, + { + value: 'road.classified', + description: 'Classified Road', + overlaps: false, + }, + ], + }, + localAuthorityDistrict: ['Lambeth'], + region: 'London', + type: { + value: 'residential.dwelling.house.terrace', + description: 'Terrace', + }, + }, + proposal: { + projectType: [ + { + value: 'extend.roof.dormer', + description: 'Add a roof dormer', + }, + ], + description: + 'Roof extension to the rear of the property, incorporating starship launchpad.', + boundary: { + site: { + type: 'Feature', + geometry: { + type: 'Polygon', + coordinates: [ + [ + [-0.1186569035053321, 51.465703531871384], + [-0.1185938715934822, 51.465724418998775], + [-0.1184195280075143, 51.46552473766957], + [-0.11848390102387167, 51.4655038504508], + [-0.1186569035053321, 51.465703531871384], + ], + ], + }, + properties: null, + }, + area: { + hectares: 0.012592, + squareMetres: 125.92, + }, + }, + date: { + start: '2024-05-01', + completion: '2024-05-02', + }, + details: { + extend: { + area: { + squareMetres: 45, + }, + }, + vehicleParking: { + type: [ + { + value: 'cars.offStreet.residents', + description: 'Off-street parking for residents only', + }, + { + value: 'bicycles.offStreet', + description: 'Off-street parking for bicycles', + }, + ], + cars: { + count: { + existing: 1, + proposed: 1, + }, + offStreet: { + count: { + existing: 0, + proposed: 0, + }, + club: { + count: { + existing: 0, + proposed: 0, + }, + }, + disabled: { + count: { + existing: 0, + proposed: 0, + }, + }, + other: { + count: { + existing: 0, + proposed: 0, + }, + }, + residents: { + count: { + existing: 1, + proposed: 1, + }, + }, + }, + onStreet: { + count: { + existing: 0, + proposed: 0, + }, + club: { + count: { + existing: 0, + proposed: 0, + }, + }, + disabled: { + count: { + existing: 0, + proposed: 0, + }, + }, + other: { + count: { + existing: 0, + proposed: 0, + }, + }, + residents: { + count: { + existing: 0, + proposed: 0, + }, + }, + }, + }, + vans: { + count: { + existing: 0, + proposed: 0, + }, + offStreet: { + count: { + existing: 0, + proposed: 0, + }, + }, + onStreet: { + count: { + existing: 0, + proposed: 0, + }, + }, + }, + motorcycles: { + count: { + existing: 0, + proposed: 0, + }, + offStreet: { + count: { + existing: 0, + proposed: 0, + }, + }, + onStreet: { + count: { + existing: 0, + proposed: 0, + }, + }, + }, + bicycles: { + count: { + existing: 2, + proposed: 2, + }, + offStreet: { + count: { + existing: 2, + proposed: 2, + }, + }, + onStreet: { + count: { + existing: 0, + proposed: 0, + }, + }, + }, + buses: { + count: { + existing: 0, + proposed: 0, + }, + offStreet: { + count: { + existing: 0, + proposed: 0, + }, + }, + onStreet: { + count: { + existing: 0, + proposed: 0, + }, + }, + }, + }, + }, + }, + }, + result: [], + responses: [ + { + question: 'Is the property in Lambeth?', + responses: [ + { + value: 'Yes', + }, + ], + metadata: { + autoAnswered: true, + sectionName: 'The property', + }, + }, + { + question: 'What type of property is it?', + responses: [ + { + value: 'House', + }, + ], + metadata: { + autoAnswered: true, + sectionName: 'The property', + }, + }, + { + question: 'What type of house it is?', + responses: [ + { + value: 'Terrace', + }, + ], + metadata: { + autoAnswered: true, + sectionName: 'The property', + }, + }, + { + question: 'Is the property in a flood zone?', + responses: [ + { + value: 'No', + }, + ], + metadata: { + sectionName: 'The property', + }, + }, + { + question: 'What type of property is it?', + responses: [ + { + value: 'House', + metadata: { + flags: ['Listed building consent / Not required'], + }, + }, + ], + metadata: { + autoAnswered: true, + sectionName: 'About the project', + }, + }, + { + question: 'List the changes involved in the project', + responses: [ + { + value: 'Add a roof extension', + metadata: { + flags: ['Listed building consent / Not required'], + }, + }, + ], + metadata: { + sectionName: 'About the project', + }, + }, + { + question: 'Have works already started?', + responses: [ + { + value: 'No', + }, + ], + metadata: { + sectionName: 'About the project', + }, + }, + { + question: 'Is the property in a flood zone?', + responses: [ + { + value: 'No', + }, + ], + metadata: { + autoAnswered: true, + sectionName: 'About the project', + }, + }, + { + question: 'What type of changes does the project involve?', + responses: [ + { + value: 'Extension', + }, + ], + metadata: { + autoAnswered: true, + sectionName: 'About the project', + }, + }, + { + question: 'Is the project to add an outbuilding?', + responses: [ + { + value: 'No', + }, + ], + metadata: { + autoAnswered: true, + sectionName: 'About the project', + }, + }, + { + question: 'How much new floor area is being added to the house?', + responses: [ + { + value: 'Less than 100m²', + }, + ], + metadata: { + sectionName: 'About the project', + }, + }, + { + question: + 'How much exactly is the internal floor area of the property increasing by?', + responses: [ + { + value: '45', + }, + ], + metadata: { + policyRefs: [ + { + text: 'The Town and Country Planning (Development Management Procedure) (England) 2015 (as amended)', + }, + ], + sectionName: 'About the project', + }, + }, + { + question: + 'Does the project involve creating any new bedrooms or bathrooms?', + responses: [ + { + value: 'No', + }, + ], + metadata: { + policyRefs: [ + { + text: 'The Town and Country Planning (Development Management Procedure) (England) 2015 (as amended)', + }, + ], + sectionName: 'About the project', + }, + }, + { + question: 'Describe the wall materials of the existing house', + responses: [ + { + value: 'London stock brick', + }, + ], + metadata: { + policyRefs: [ + { + text: 'The Town and Country Planning (Development Management Procedure) (England) 2015 (as amended)', + }, + ], + sectionName: 'About the project', + }, + }, + { + question: 'Describe the wall materials of the new extension', + responses: [ + { + value: 'Metallic cladding, reflective. Multiple colours.', + }, + ], + metadata: { + policyRefs: [ + { + text: 'The Town and Country Planning (Development Management Procedure) (England) 2015 (as amended)', + }, + ], + sectionName: 'About the project', + }, + }, + { + question: 'Describe the material of the roof of the existing house', + responses: [ + { + value: 'Grey slate', + }, + ], + metadata: { + policyRefs: [ + { + text: 'The Town and Country Planning (Development Management Procedure) (England) 2015 (as amended)', + }, + ], + sectionName: 'About the project', + }, + }, + { + question: 'Describe the material for the new roof of the extension', + responses: [ + { + value: 'Zinc panels', + }, + ], + metadata: { + policyRefs: [ + { + text: 'The Town and Country Planning (Development Management Procedure) (England) 2015 (as amended)', + }, + ], + sectionName: 'About the project', + }, + }, + { + question: 'Describe the window materials of the existing house', + responses: [ + { + value: 'Wooden sash windows, painted white', + }, + ], + metadata: { + policyRefs: [ + { + text: 'The Town and Country Planning (Development Management Procedure) (England) 2015 (as amended)', + }, + ], + sectionName: 'About the project', + }, + }, + { + question: 'Describe the window materials of the extension', + responses: [ + { + value: 'Brushed steel.', + }, + ], + metadata: { + policyRefs: [ + { + text: 'The Town and Country Planning (Development Management Procedure) (England) 2015 (as amended)', + }, + ], + sectionName: 'About the project', + }, + }, + { + question: 'Describe the door materials of the existing house', + responses: [ + { + value: 'Wood, painted.', + }, + ], + metadata: { + policyRefs: [ + { + text: 'The Town and Country Planning (Development Management Procedure) (England) 2015 (as amended)', + }, + ], + sectionName: 'About the project', + }, + }, + { + question: 'Describe the door materials of the extension', + responses: [ + { + value: 'No door present', + }, + ], + metadata: { + policyRefs: [ + { + text: 'The Town and Country Planning (Development Management Procedure) (England) 2015 (as amended)', + }, + ], + sectionName: 'About the project', + }, + }, + { + question: + 'Are there any trees that could fall within the property or the areas affected by the project (the previously drawn outline)?', + responses: [ + { + value: 'No', + }, + ], + metadata: { + sectionName: 'About the project', + }, + }, + { + question: 'Does the project involve any of these?', + responses: [ + { + value: 'No, none of these', + }, + ], + metadata: { + sectionName: 'About the project', + }, + }, + { + question: 'Is the property in Greater London?', + responses: [ + { + value: 'Yes', + }, + ], + metadata: { + autoAnswered: true, + sectionName: 'About the project', + }, + }, + { + question: 'Does the site include more than one property?', + responses: [ + { + value: 'No', + }, + ], + metadata: { + policyRefs: [ + { + text: 'Greater London Authority Act 1999', + }, + ], + sectionName: 'About the project', + }, + }, + { + question: 'Do you know the title number of the property?', + responses: [ + { + value: 'No', + }, + ], + metadata: { + sectionName: 'About the project', + }, + }, + { + question: + 'Does the property have an Energy Performance Certificate (EPC)?', + responses: [ + { + value: 'No', + }, + ], + metadata: { + policyRefs: [ + { + text: 'Greater London Authority Act 1999', + }, + ], + sectionName: 'About the project', + }, + }, + { + question: 'What type of application is this?', + responses: [ + { + value: 'Planning permission for a home', + }, + ], + metadata: { + autoAnswered: true, + policyRefs: [ + { + text: 'Greater London Authority Act 1999', + }, + ], + sectionName: 'About the project', + }, + }, + { + question: 'When will the works start?', + responses: [ + { + value: '2024-05-01', + }, + ], + metadata: { + policyRefs: [ + { + text: 'Greater London Authority Act 1999', + }, + ], + sectionName: 'About the project', + }, + }, + { + question: 'When will the works be completed?', + responses: [ + { + value: '2024-05-02', + }, + ], + metadata: { + policyRefs: [ + { + text: 'Greater London Authority Act 1999', + }, + ], + sectionName: 'About the project', + }, + }, + { + question: 'Does the site include parking spaces for any of these?', + responses: [ + { + value: 'Cars', + }, + { + value: 'Bicycles', + }, + ], + metadata: { + policyRefs: [ + { + text: 'Greater London Authority Act 1999', + }, + ], + sectionName: 'About the project', + }, + }, + { + question: 'Total number of car parking spaces before', + responses: [ + { + value: '1', + }, + ], + metadata: { + sectionName: 'About the project', + }, + }, + { + question: 'Total number of car parking spaces after', + responses: [ + { + value: '1', + }, + ], + metadata: { + sectionName: 'About the project', + }, + }, + { + question: 'What types of car parking space are present?', + responses: [ + { + value: 'Off-street parking for residents only', + }, + ], + metadata: { + policyRefs: [ + { + text: 'Greater London Authority Act 1999', + }, + ], + sectionName: 'About the project', + }, + }, + { + question: 'Off-street, residents-only car spaces before', + responses: [ + { + value: '1', + }, + ], + metadata: { + policyRefs: [ + { + text: 'Greater London Authority Act 1999', + }, + ], + sectionName: 'About the project', + }, + }, + { + question: 'Off-street, residents-only car spaces after', + responses: [ + { + value: '1', + }, + ], + metadata: { + policyRefs: [ + { + text: 'Greater London Authority Act 1999', + }, + ], + sectionName: 'About the project', + }, + }, + { + question: 'What type of bicycle parking is there?', + responses: [ + { + value: 'Off-street cycle parking', + }, + ], + metadata: { + policyRefs: [ + { + text: 'Greater London Authority Act 1999', + }, + ], + sectionName: 'About the project', + }, + }, + { + question: 'Off-street bicycle spaces before', + responses: [ + { + value: '2', + }, + ], + metadata: { + policyRefs: [ + { + text: 'Greater London Authority Act 1999', + }, + ], + sectionName: 'About the project', + }, + }, + { + question: 'Off-street bicycle spaces after', + responses: [ + { + value: '2', + }, + ], + metadata: { + policyRefs: [ + { + text: 'Greater London Authority Act 1999', + }, + ], + sectionName: 'About the project', + }, + }, + { + question: 'Is the property on designated land?', + responses: [ + { + value: 'No', + }, + ], + metadata: { + autoAnswered: true, + sectionName: 'About the project', + }, + }, + { + question: 'Does the property include any of these?', + responses: [ + { + value: 'None of these', + }, + ], + metadata: { + autoAnswered: true, + policyRefs: [ + { + text: 'The Town and Country Planning (Development Management Procedure) (England) 2015 (as amended)', + }, + ], + sectionName: 'About the project', + }, + }, + { + question: 'Heritage Statement needed?', + responses: [ + { + value: 'No', + }, + ], + metadata: { + autoAnswered: true, + sectionName: 'About the project', + }, + }, + { + question: 'Is the property in a flood zone?', + responses: [ + { + value: 'No', + }, + ], + metadata: { + autoAnswered: true, + sectionName: 'About the project', + }, + }, + { + question: 'What type of application is it?', + responses: [ + { + value: 'Apply for planning permission', + }, + ], + metadata: { + autoAnswered: true, + sectionName: 'About you', + }, + }, + { + question: 'Your contact details', + responses: [ + { + value: 'Mx Ziggy Stardust 01100 0110 0011 ziggy@example.com', + }, + ], + metadata: { + sectionName: 'About you', + }, + }, + { + question: 'Is this a test?', + responses: [ + { + value: 'No', + }, + ], + metadata: { + sectionName: 'About you', + }, + }, + { + question: 'Are you applying on behalf of someone else?', + responses: [ + { + value: 'Yes', + }, + ], + metadata: { + sectionName: 'About you', + }, + }, + { + question: 'Which of these best describes you?', + responses: [ + { + value: 'Friend or relative', + }, + ], + metadata: { + sectionName: 'About you', + }, + }, + { + question: 'Your contact address', + responses: [ + { + value: + '40 Stansfield Road, Brixton, London, Greater London, SW9 9RZ, UK', + }, + ], + metadata: { + sectionName: 'About you', + }, + }, + { + question: 'Which of these best describes the applicant?', + responses: [ + { + value: 'Private individual', + }, + ], + metadata: { + sectionName: 'About you', + }, + }, + { + question: "Applicant's title", + responses: [ + { + value: 'Mr', + }, + ], + metadata: { + sectionName: 'About you', + }, + }, + { + question: 'Do you want to provide an email address for the applicant?', + responses: [ + { + value: 'No', + }, + ], + metadata: { + sectionName: 'About you', + }, + }, + { + question: 'Do you want to provide a telephone number for the applicant?', + responses: [ + { + value: 'No', + }, + ], + metadata: { + sectionName: 'About you', + }, + }, + { + question: + "Is the applicant's contact address the same as the property address?", + responses: [ + { + value: 'Yes', + }, + ], + metadata: { + sectionName: 'About you', + }, + }, + { + question: 'Which of these best describes you?', + responses: [ + { + value: 'Friend or relative', + }, + ], + metadata: { + autoAnswered: true, + sectionName: 'About you', + }, + }, + { + question: + 'We may need to visit your site to assess your application. If we do, who should we contact to arrange the visit?', + responses: [ + { + value: 'Me', + }, + ], + metadata: { + sectionName: 'About you', + }, + }, + { + question: 'Which of these best describes you?', + responses: [ + { + value: "Friend or relative acting on the applicant's behalf", + }, + ], + metadata: { + autoAnswered: true, + sectionName: 'About you', + }, + }, + { + question: + "Which of these best describes the applicant's interest in the land?", + responses: [ + { + value: 'Sole owner', + }, + ], + metadata: { + policyRefs: [ + { + text: 'The Town and Country Planning (Development Management Procedure) (England) Order 2015', + }, + ], + sectionName: 'About you', + }, + }, + { + question: + 'Did you get any pre-application advice from the council before making this application?', + responses: [ + { + value: 'No', + }, + ], + metadata: { + sectionName: 'About this application', + }, + }, + { + question: 'What type of planning application are you making?', + responses: [ + { + value: 'Full planning permission', + }, + ], + metadata: { + autoAnswered: true, + sectionName: 'About this application', + }, + }, + { + question: 'Is the property a home?', + responses: [ + { + value: 'Yes', + }, + ], + metadata: { + autoAnswered: true, + sectionName: 'About this application', + }, + }, + { + question: 'What types of changes does the application relate to?', + responses: [ + { + value: 'Extension', + }, + ], + metadata: { + autoAnswered: true, + sectionName: 'About this application', + }, + }, + { + question: 'What type of extension is it?', + responses: [ + { + value: 'Roof extension', + }, + ], + metadata: { + autoAnswered: true, + sectionName: 'About this application', + }, + }, + { + question: 'List the changes involved in the roof extension', + responses: [ + { + value: 'Add dormer', + }, + ], + metadata: { + sectionName: 'About this application', + }, + }, + { + question: + 'Is the purpose of the project to support the needs of a disabled resident?', + responses: [ + { + value: 'No', + }, + ], + metadata: { + policyRefs: [ + { + text: 'The Town and Country Planning (Fees for Applications, Deemed Applications, Requests and Site Visits) (England) Regulations 2012, Regulation 14UK Statutory Instruments 2012 No. 2920 Regulation 4, Equalities Act 2010, Section 6 Children Act 1989, Part 3', + }, + ], + sectionName: 'About this application', + }, + }, + { + question: 'Is it a prior approval application?', + responses: [ + { + value: 'No', + }, + ], + metadata: { + autoAnswered: true, + sectionName: 'About this application', + }, + }, + { + question: 'Is the property a home?', + responses: [ + { + value: 'Yes', + }, + ], + metadata: { + autoAnswered: true, + sectionName: 'About this application', + }, + }, + { + question: 'What works does the project involve?', + responses: [ + { + value: 'Extension', + }, + ], + metadata: { + autoAnswered: true, + sectionName: 'About this application', + }, + }, + { + question: 'Is this application a resubmission?', + responses: [ + { + value: 'No', + }, + ], + metadata: { + policyRefs: [ + { + text: 'The Town and Country Planning (Fees for Applications, Deemed Applications, Requests and Site Visits) (England) Regulations 2012, Regulation 9', + }, + ], + sectionName: 'About this application', + }, + }, + { + question: 'Does the application qualify for a disability exemption?', + responses: [ + { + value: 'No', + }, + ], + metadata: { + autoAnswered: true, + sectionName: 'About this application', + }, + }, + { + question: 'Does the application qualify for a resubmission exemption?', + responses: [ + { + value: 'No', + }, + ], + metadata: { + autoAnswered: true, + sectionName: 'About this application', + }, + }, + { + question: 'Is the site a sports field?', + responses: [ + { + value: 'No', + }, + ], + metadata: { + autoAnswered: true, + policyRefs: [ + { + text: 'The Town and Country Planning (Fees for Applications, Deemed Applications, Requests and Site Visits) (England) Regulations 2012 Chapter 2, Paragraph 3', + }, + ], + sectionName: 'About this application', + }, + }, + { + question: + 'Is the application being made by (or on behalf of) a parish or community council?', + responses: [ + { + value: 'No', + }, + ], + metadata: { + autoAnswered: true, + policyRefs: [ + { + text: 'The Town and Country Planning (Fees for Applications, Deemed Applications, Requests and Site Visits) (England) Regulations 2012 - Regulation 11', + }, + ], + sectionName: 'About this application', + }, + }, + { + question: + 'Are you also submitting another proposal for the same site today?', + responses: [ + { + value: 'No', + }, + ], + metadata: { + policyRefs: [ + { + text: 'The Town and Country Planning (Fees for Applications, Deemed Applications, Requests and Site Visits) (England) Regulations 2012 Chapter 2, Paragraph 10', + }, + ], + sectionName: 'About this application', + }, + }, + { + question: + 'Does the application qualify for the sports club fee reduction?', + responses: [ + { + value: 'No', + }, + ], + metadata: { + autoAnswered: true, + sectionName: 'About this application', + }, + }, + { + question: + 'Does the application qualify for the parish council reduction?', + responses: [ + { + value: 'No', + }, + ], + metadata: { + autoAnswered: true, + policyRefs: [ + { + text: 'The Town and Country Planning (Fees for Applications, Deemed Applications, Requests and Site Visits) (England) Regulations 2012 - Regulation 11', + }, + ], + sectionName: 'About this application', + }, + }, + { + question: + 'Does the application qualify for the alternative application reduction?', + responses: [ + { + value: 'No', + }, + ], + metadata: { + autoAnswered: true, + policyRefs: [ + { + text: 'The Town and Country Planning (Fees for Applications, Deemed Applications, Requests and Site Visits) (England) Regulations 2012 Chapter 2, Paragraph 10', + }, + ], + sectionName: 'About this application', + }, + }, + { + question: 'What type of application is it?', + responses: [ + { + value: 'Full planning permission', + }, + ], + metadata: { + autoAnswered: true, + sectionName: 'About this application', + }, + }, + { + question: 'What does the project involve?', + responses: [ + { + value: 'Extension', + }, + ], + metadata: { + autoAnswered: true, + sectionName: 'About this application', + }, + }, + { + question: 'How much new floor area is being created?', + responses: [ + { + value: 'Less than 100m²', + metadata: { + flags: ['Community infrastructure levy / Not liable'], + }, + }, + ], + metadata: { + autoAnswered: true, + policyRefs: [ + { + text: 'The Community Infrastructure Levy Regulations 2010, Regulation 42', + }, + ], + sectionName: 'About this application', + }, + }, + { + question: 'Is this a householder planning application?', + responses: [ + { + value: 'Yes', + metadata: { + flags: ['Community infrastructure levy / Not liable'], + }, + }, + ], + metadata: { + autoAnswered: true, + policyRefs: [ + { + text: 'The Community Infrastructure Levy Regulations 2010, Regulation 42', + }, + ], + sectionName: 'About this application', + }, + }, + { + question: 'Have the works already started?', + responses: [ + { + value: 'No', + }, + ], + metadata: { + autoAnswered: true, + sectionName: 'Upload drawings', + }, + }, + { + question: 'What changes does the project involve?', + responses: [ + { + value: 'Extension', + }, + ], + metadata: { + autoAnswered: true, + sectionName: 'Upload drawings', + }, + }, + { + question: 'Is the project to add an outbuilding?', + responses: [ + { + value: 'No', + }, + ], + metadata: { + autoAnswered: true, + sectionName: 'Upload drawings', + }, + }, + { + question: 'Which Local Planning authority is it?', + responses: [ + { + value: 'Lambeth', + }, + ], + metadata: { + autoAnswered: true, + sectionName: 'Check', + }, + }, + { + question: 'Connections with London Borough of Lambeth', + responses: [ + { + value: 'None of the above apply to me', + }, + ], + metadata: { + sectionName: 'Check', + }, + }, + { + question: 'I confirm that:', + responses: [ + { + value: + 'The information contained in this application is truthful, accurate and complete, to the best of my knowledge', + }, + ], + metadata: { + sectionName: 'Check', + }, + }, + { + question: 'Does the application qualify for a disability exemption?', + responses: [ + { + value: 'No', + }, + ], + metadata: { + autoAnswered: true, + sectionName: 'Pay and send', + }, + }, + { + question: 'Does the application qualify for a resubmission exemption?', + responses: [ + { + value: 'No', + }, + ], + metadata: { + autoAnswered: true, + sectionName: 'Pay and send', + }, + }, + { + question: 'Which Local Planning authority is it?', + responses: [ + { + value: 'Lambeth', + }, + ], + metadata: { + autoAnswered: true, + sectionName: 'Pay and send', + }, + }, + ], + files: [ + { + name: 'https://api.editor.planx.dev/file/private/vg0av01p/RoofPlan.pdf', + type: [ + { + value: 'property.drawing.roofPlan', + description: 'Roof plan - existing', + }, + { + value: 'proposal.drawing.roofPlan', + description: 'Roof plan - proposed', + }, + ], + }, + { + name: 'https://api.editor.planx.dev/file/private/ka97yl2c/Site%20plan.pdf', + type: [ + { + value: 'property.drawing.sitePlan', + description: 'Site plan - existing', + }, + { + value: 'proposal.drawing.sitePlan', + description: 'Site plan - proposed', + }, + ], + }, + { + name: 'https://api.editor.planx.dev/file/private/osprppqo/Elevations.pdf', + type: [ + { + value: 'property.drawing.elevation', + description: 'Elevation plan - existing', + }, + { + value: 'proposal.drawing.elevation', + description: 'Elevation plan - proposed', + }, + ], + }, + { + name: 'https://api.editor.planx.dev/file/private/cri3ziaj/Plan.pdf', + type: [ + { + value: 'property.drawing.floorPlan', + description: 'Floor plan - existing', + }, + { + value: 'proposal.drawing.floorPlan', + description: 'Floor plan - proposed', + }, + ], + }, + ], + metadata: { + service: { + flowId: '01e38c5d-e701-4e44-acdc-4d6b5cc3b854', + name: 'Apply for planning permission', + owner: 'Lambeth', + url: 'https://www.editor.planx.dev/lambeth/apply-for-planning-permission/preview', + }, + session: { + source: 'PlanX', + id: '81bcaa0f-baf5-4573-ba0a-ea868c573faf', + createdAt: '2023-10-01 00:00:00', + submittedAt: '2023-10-02 00:00:00', + }, + schema: { + url: 'https://theopensystemslab.github.io/digital-planning-data-schemas/v0.0.1/schema.json', + }, + }, +}; diff --git a/e2e/tests/api-driven/package.json b/e2e/tests/api-driven/package.json index 48f20ab556..51ffa99ba9 100644 --- a/e2e/tests/api-driven/package.json +++ b/e2e/tests/api-driven/package.json @@ -6,7 +6,7 @@ }, "dependencies": { "@cucumber/cucumber": "^9.3.0", - "@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#3a85966", + "@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#280aaff", "axios": "^1.4.0", "dotenv": "^16.3.1", "dotenv-expand": "^10.0.0", diff --git a/e2e/tests/ui-driven/package.json b/e2e/tests/ui-driven/package.json index f029be3d67..eafb06dfa0 100644 --- a/e2e/tests/ui-driven/package.json +++ b/e2e/tests/ui-driven/package.json @@ -8,7 +8,7 @@ "postinstall": "./install-dependencies.sh" }, "dependencies": { - "@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#3a85966", + "@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#280aaff", "axios": "^1.4.0", "dotenv": "^16.3.1", "eslint": "^8.44.0", diff --git a/editor.planx.uk/package.json b/editor.planx.uk/package.json index 8ea7b375b7..8e4b2b996a 100644 --- a/editor.planx.uk/package.json +++ b/editor.planx.uk/package.json @@ -14,7 +14,7 @@ "@mui/styles": "^5.14.5", "@mui/utils": "^5.14.5", "@opensystemslab/map": "^0.7.5", - "@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#3a85966", + "@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#280aaff", "@tiptap/core": "^2.0.3", "@tiptap/extension-bold": "^2.0.3", "@tiptap/extension-bubble-menu": "^2.1.6", diff --git a/editor.planx.uk/pnpm-lock.yaml b/editor.planx.uk/pnpm-lock.yaml index 7d75980a5b..f696093a3f 100644 --- a/editor.planx.uk/pnpm-lock.yaml +++ b/editor.planx.uk/pnpm-lock.yaml @@ -46,8 +46,8 @@ dependencies: specifier: ^0.7.5 version: 0.7.5 '@opensystemslab/planx-core': - specifier: git+https://github.com/theopensystemslab/planx-core#3a85966 - version: github.com/theopensystemslab/planx-core/3a85966(@types/react@18.2.20) + specifier: git+https://github.com/theopensystemslab/planx-core#280aaff + version: github.com/theopensystemslab/planx-core/280aaff(@types/react@18.2.20) '@tiptap/core': specifier: ^2.0.3 version: 2.0.3(@tiptap/pm@2.0.3) @@ -4002,7 +4002,7 @@ packages: '@emotion/core': ^10.0.28 react: '>=16.3.0' dependencies: - '@babel/runtime': 7.22.15 + '@babel/runtime': 7.23.2 '@emotion/core': 10.3.1(react@18.2.0) '@emotion/is-prop-valid': 0.8.8 '@emotion/serialize': 0.11.16 @@ -5403,8 +5403,8 @@ packages: '@types/react': optional: true dependencies: - '@babel/runtime': 7.22.15 - '@mui/utils': 5.14.11(@types/react@18.2.20)(react@18.2.0) + '@babel/runtime': 7.23.2 + '@mui/utils': 5.14.13(@types/react@18.2.20)(react@18.2.0) '@types/react': 18.2.20 prop-types: 15.8.1 react: 18.2.0 @@ -5457,7 +5457,7 @@ packages: '@emotion/styled': optional: true dependencies: - '@babel/runtime': 7.22.15 + '@babel/runtime': 7.23.2 '@emotion/cache': 11.11.0 '@emotion/react': 11.11.1(@types/react@18.2.20)(react@18.2.0) '@emotion/styled': 11.11.0(@emotion/react@11.11.1)(@types/react@18.2.20)(react@18.2.0) @@ -5611,8 +5611,8 @@ packages: '@types/react': optional: true dependencies: - '@babel/runtime': 7.22.15 - '@types/prop-types': 15.7.5 + '@babel/runtime': 7.23.2 + '@types/prop-types': 15.7.8 '@types/react': 18.2.20 prop-types: 15.8.1 react: 18.2.0 @@ -5934,13 +5934,13 @@ packages: /@remirror/core-constants@2.0.1: resolution: {integrity: sha512-ZR4aihtnnT9lMbhh5DEbsriJRlukRXmLZe7HmM+6ufJNNUDoazc75UX26xbgQlNUqgAqMcUdGFAnPc1JwgAdLQ==} dependencies: - '@babel/runtime': 7.22.15 + '@babel/runtime': 7.23.2 dev: false /@remirror/core-helpers@2.0.3: resolution: {integrity: sha512-LqIPF4stGG69l9qu/FFicv9d9B+YaItzgDMC5A0CEvDQfKkGD3BfabLmfpnuWbsc06oKGdTduilgWcALLZoYLg==} dependencies: - '@babel/runtime': 7.22.15 + '@babel/runtime': 7.23.2 '@linaria/core': 4.2.9 '@remirror/core-constants': 2.0.1 '@remirror/types': 1.0.1 @@ -9240,7 +9240,7 @@ packages: /babel-plugin-macros@2.8.0: resolution: {integrity: sha512-SEP5kJpfGYqYKpBrj5XU3ahw5p5GOHJ0U5ssOSQ/WBVdwkD2Dzlce95exQTs3jOVWPPKLBN2rlEWkCK7dSmLvg==} dependencies: - '@babel/runtime': 7.22.15 + '@babel/runtime': 7.23.2 cosmiconfig: 6.0.0 resolve: 1.22.2 dev: true @@ -9249,7 +9249,7 @@ packages: resolution: {integrity: sha512-Cg7TFGpIr01vOQNODXOOaGz2NpCU5gl8x1qJFbb6hbZxR7XrcE2vtbAsTAbJ7/xwJtUuJEw8K8Zr/AE0LHlesg==} engines: {node: '>=10', npm: '>=6'} dependencies: - '@babel/runtime': 7.22.15 + '@babel/runtime': 7.23.2 cosmiconfig: 7.1.0 resolve: 1.22.2 @@ -9759,7 +9759,7 @@ packages: engines: {node: '>=10.0.0'} requiresBuild: true dependencies: - '@babel/runtime': 7.22.15 + '@babel/runtime': 7.23.2 '@types/raf': 3.4.0 core-js: 3.31.1 raf: 3.4.1 @@ -10476,7 +10476,7 @@ packages: /css-vendor@2.0.8: resolution: {integrity: sha512-x9Aq0XTInxrkuFeHKbYC7zWY8ai7qJ04Kxd9MnvbC1uO5DagxoHQjm4JvG+vCdXOoFtCjbL2XSZfxmoYa9uQVQ==} dependencies: - '@babel/runtime': 7.22.15 + '@babel/runtime': 7.23.2 is-in-browser: 1.1.3 /css-what@3.4.2: @@ -18409,7 +18409,7 @@ packages: /rtl-css-js@1.16.1: resolution: {integrity: sha512-lRQgou1mu19e+Ya0LsTvKrVJ5TYUbqCVPAiImX3UfLTenarvPUl1QFdvu5Z3PYmHT9RCcwIfbjRQBntExyj3Zg==} dependencies: - '@babel/runtime': 7.22.15 + '@babel/runtime': 7.23.2 dev: false /run-parallel@1.2.0: @@ -20645,7 +20645,7 @@ packages: '@apideck/better-ajv-errors': 0.3.6(ajv@8.12.0) '@babel/core': 7.22.9 '@babel/preset-env': 7.22.7(@babel/core@7.22.9) - '@babel/runtime': 7.22.15 + '@babel/runtime': 7.23.2 '@rollup/plugin-babel': 5.3.1(@babel/core@7.22.9)(rollup@2.79.1) '@rollup/plugin-node-resolve': 11.2.1(rollup@2.79.1) '@rollup/plugin-replace': 2.4.2(rollup@2.79.1) @@ -20999,11 +20999,12 @@ packages: use-sync-external-store: 1.2.0(react@18.2.0) dev: false - github.com/theopensystemslab/planx-core/3a85966(@types/react@18.2.20): - resolution: {tarball: https://codeload.github.com/theopensystemslab/planx-core/tar.gz/3a85966} - id: github.com/theopensystemslab/planx-core/3a85966 + github.com/theopensystemslab/planx-core/280aaff(@types/react@18.2.20): + resolution: {tarball: https://codeload.github.com/theopensystemslab/planx-core/tar.gz/280aaff} + id: github.com/theopensystemslab/planx-core/280aaff name: '@opensystemslab/planx-core' version: 1.0.0 + prepare: true requiresBuild: true dependencies: '@emotion/react': 11.11.1(@types/react@18.2.20)(react@18.2.0)