diff --git a/api.planx.uk/modules/send/downloadApplicationFiles/index.ts b/api.planx.uk/modules/send/downloadApplicationFiles/index.ts index aede2c8369..2c3e0f8a68 100644 --- a/api.planx.uk/modules/send/downloadApplicationFiles/index.ts +++ b/api.planx.uk/modules/send/downloadApplicationFiles/index.ts @@ -17,10 +17,10 @@ export async function downloadApplicationFiles( try { // Confirm that the provided email matches the stored team settings for the provided localAuthority - const { notifyPersonalisation } = await getTeamEmailSettings( + const { teamSettings } = await getTeamEmailSettings( req.query.localAuthority as string, ); - if (notifyPersonalisation.sendToEmail !== req.query.email) { + if (teamSettings.submissionEmail !== req.query.email) { return next({ status: 403, message: diff --git a/api.planx.uk/modules/send/email/index.test.ts b/api.planx.uk/modules/send/email/index.test.ts index 973ff9cbbc..74c21f805a 100644 --- a/api.planx.uk/modules/send/email/index.test.ts +++ b/api.planx.uk/modules/send/email/index.test.ts @@ -49,9 +49,9 @@ describe(`sending an application by email to a planning office`, () => { data: { teams: [ { - notifyPersonalisation: { + teamSettings: { emailReplyToId: "abc123", - sendToEmail: "planning.office.example@council.gov.uk", + submissionEmail: "planning.office.example@council.gov.uk", }, }, ], @@ -154,9 +154,9 @@ describe(`sending an application by email to a planning office`, () => { data: { teams: [ { - notifyPersonalisation: { + teamSettings: { emailReplyToId: "abc123", - sendToEmail: null, + submissionEmail: null, }, }, ], @@ -206,8 +206,8 @@ describe(`downloading application data received by email`, () => { data: { teams: [ { - notifyPersonalisation: { - sendToEmail: "planning.office.example@council.gov.uk", + teamSettings: { + submissionEmail: "planning.office.example@council.gov.uk", }, }, ], diff --git a/api.planx.uk/modules/send/email/index.ts b/api.planx.uk/modules/send/email/index.ts index 4d36063ad3..cd19e6bffe 100644 --- a/api.planx.uk/modules/send/email/index.ts +++ b/api.planx.uk/modules/send/email/index.ts @@ -28,9 +28,8 @@ export async function sendToEmail( try { // Confirm this local authority (aka team) has an email configured in teams.submission_email - const { notifyPersonalisation } = - await getTeamEmailSettings(localAuthority); - if (!notifyPersonalisation.sendToEmail) { + const { teamSettings } = await getTeamEmailSettings(localAuthority); + if (!teamSettings.submissionEmail) { return next({ status: 400, message: `Send to email is not enabled for this local authority (${localAuthority})`, @@ -47,15 +46,15 @@ export async function sendToEmail( serviceName: flowName, sessionId: payload.sessionId, applicantEmail: email, - downloadLink: `${process.env.API_URL_EXT}/download-application-files/${payload.sessionId}?email=${notifyPersonalisation.sendToEmail}&localAuthority=${localAuthority}`, - ...notifyPersonalisation, + downloadLink: `${process.env.API_URL_EXT}/download-application-files/${payload.sessionId}?email=${teamSettings.submissionEmail}&localAuthority=${localAuthority}`, + ...teamSettings, }, }; // Send the email const response = await sendEmail( "submit", - notifyPersonalisation.sendToEmail, + teamSettings.submissionEmail, config, ); @@ -66,14 +65,14 @@ export async function sendToEmail( insertAuditEntry( payload.sessionId, localAuthority, - notifyPersonalisation.sendToEmail, + teamSettings.submissionEmail, config, response, ); return res.status(200).send({ message: `Successfully sent to email`, - inbox: notifyPersonalisation.sendToEmail, + inbox: teamSettings.submissionEmail, govuk_notify_template: "Submit", }); } catch (error) { diff --git a/api.planx.uk/modules/send/email/service.ts b/api.planx.uk/modules/send/email/service.ts index 2a5454bc0c..878d165856 100644 --- a/api.planx.uk/modules/send/email/service.ts +++ b/api.planx.uk/modules/send/email/service.ts @@ -1,14 +1,11 @@ import { gql } from "graphql-request"; import { $api } from "../../../client/index.js"; -import { - NotifyPersonalisation, - Session, -} from "@opensystemslab/planx-core/types"; +import { Session, TeamContactSettings } from "@opensystemslab/planx-core/types"; import { EmailSubmissionNotifyConfig } from "../../../types.js"; interface GetTeamEmailSettings { teams: { - notifyPersonalisation: NotifyPersonalisation & { sendToEmail: string }; + teamSettings: TeamContactSettings; }[]; } @@ -17,12 +14,12 @@ export async function getTeamEmailSettings(localAuthority: string) { gql` query GetTeamEmailSettings($slug: String) { teams(where: { slug: { _eq: $slug } }) { - notifyPersonalisation: team_settings { + teamSettings: team_settings { helpEmail: help_email helpPhone: help_phone emailReplyToId: email_reply_to_id helpOpeningHours: help_opening_hours - sendToEmail: submission_email + submissionEmail: submission_email } } } diff --git a/api.planx.uk/package.json b/api.planx.uk/package.json index a5c53d3fcd..297ada5bc9 100644 --- a/api.planx.uk/package.json +++ b/api.planx.uk/package.json @@ -11,7 +11,7 @@ }, "dependencies": { "@airbrake/node": "^2.1.8", - "@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#931d4db", + "@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#ec52620", "@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 e75edf6d12..e01b020420 100644 --- a/api.planx.uk/pnpm-lock.yaml +++ b/api.planx.uk/pnpm-lock.yaml @@ -14,8 +14,8 @@ dependencies: specifier: ^2.1.8 version: 2.1.8 '@opensystemslab/planx-core': - specifier: git+https://github.com/theopensystemslab/planx-core#931d4db - version: github.com/theopensystemslab/planx-core/931d4db + specifier: git+https://github.com/theopensystemslab/planx-core#ec52620 + version: github.com/theopensystemslab/planx-core/ec52620 '@types/isomorphic-fetch': specifier: ^0.0.36 version: 0.0.36 @@ -5902,8 +5902,8 @@ packages: engines: {node: '>=16'} dev: false - /type-fest@4.25.0: - resolution: {integrity: sha512-bRkIGlXsnGBRBQRAY56UXBm//9qH4bmJfFvq83gSz41N282df+fjy8ofcEgc1sM8geNt5cl6mC2g9Fht1cs8Aw==} + /type-fest@4.26.0: + resolution: {integrity: sha512-OduNjVJsFbifKb57UqZ2EMP1i4u64Xwow3NYXUtBbD4vIwJdQd4+xl8YDou1dlm4DVrtwT/7Ky8z8WyCULVfxw==} engines: {node: '>=16'} dev: false @@ -6360,8 +6360,8 @@ packages: resolution: {integrity: sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==} dev: false - github.com/theopensystemslab/planx-core/931d4db: - resolution: {tarball: https://codeload.github.com/theopensystemslab/planx-core/tar.gz/931d4db} + github.com/theopensystemslab/planx-core/ec52620: + resolution: {tarball: https://codeload.github.com/theopensystemslab/planx-core/tar.gz/ec52620} name: '@opensystemslab/planx-core' version: 1.0.0 prepare: true @@ -6387,7 +6387,7 @@ packages: prettier: 3.3.3 react: 18.3.1 react-dom: 18.3.1(react@18.3.1) - type-fest: 4.25.0 + type-fest: 4.26.0 uuid: 10.0.0 zod: 3.23.8 transitivePeerDependencies: diff --git a/e2e/tests/api-driven/package.json b/e2e/tests/api-driven/package.json index 77cd72ac3a..56008e0dcd 100644 --- a/e2e/tests/api-driven/package.json +++ b/e2e/tests/api-driven/package.json @@ -7,7 +7,7 @@ "packageManager": "pnpm@8.6.6", "dependencies": { "@cucumber/cucumber": "^9.3.0", - "@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#931d4db", + "@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#ec52620", "axios": "^1.7.4", "dotenv": "^16.3.1", "dotenv-expand": "^10.0.0", diff --git a/e2e/tests/api-driven/pnpm-lock.yaml b/e2e/tests/api-driven/pnpm-lock.yaml index f1195bf03d..ee5dcc3424 100644 --- a/e2e/tests/api-driven/pnpm-lock.yaml +++ b/e2e/tests/api-driven/pnpm-lock.yaml @@ -9,8 +9,8 @@ dependencies: specifier: ^9.3.0 version: 9.3.0 '@opensystemslab/planx-core': - specifier: git+https://github.com/theopensystemslab/planx-core#931d4db - version: github.com/theopensystemslab/planx-core/931d4db + specifier: git+https://github.com/theopensystemslab/planx-core#ec52620 + version: github.com/theopensystemslab/planx-core/ec52620 axios: specifier: ^1.7.4 version: 1.7.4 @@ -2719,8 +2719,8 @@ packages: engines: {node: '>=10'} dev: false - /type-fest@4.25.0: - resolution: {integrity: sha512-bRkIGlXsnGBRBQRAY56UXBm//9qH4bmJfFvq83gSz41N282df+fjy8ofcEgc1sM8geNt5cl6mC2g9Fht1cs8Aw==} + /type-fest@4.26.0: + resolution: {integrity: sha512-OduNjVJsFbifKb57UqZ2EMP1i4u64Xwow3NYXUtBbD4vIwJdQd4+xl8YDou1dlm4DVrtwT/7Ky8z8WyCULVfxw==} engines: {node: '>=16'} dev: false @@ -2931,8 +2931,8 @@ packages: resolution: {integrity: sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==} dev: false - github.com/theopensystemslab/planx-core/931d4db: - resolution: {tarball: https://codeload.github.com/theopensystemslab/planx-core/tar.gz/931d4db} + github.com/theopensystemslab/planx-core/ec52620: + resolution: {tarball: https://codeload.github.com/theopensystemslab/planx-core/tar.gz/ec52620} name: '@opensystemslab/planx-core' version: 1.0.0 prepare: true @@ -2958,7 +2958,7 @@ packages: prettier: 3.3.3 react: 18.3.1 react-dom: 18.3.1(react@18.3.1) - type-fest: 4.25.0 + type-fest: 4.26.0 uuid: 10.0.0 zod: 3.23.8 transitivePeerDependencies: diff --git a/e2e/tests/ui-driven/package.json b/e2e/tests/ui-driven/package.json index 89043a4a02..971eea4a6e 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#931d4db", + "@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#ec52620", "axios": "^1.7.4", "dotenv": "^16.3.1", "eslint": "^8.56.0", diff --git a/e2e/tests/ui-driven/pnpm-lock.yaml b/e2e/tests/ui-driven/pnpm-lock.yaml index d7442aa1a9..5844006a8a 100644 --- a/e2e/tests/ui-driven/pnpm-lock.yaml +++ b/e2e/tests/ui-driven/pnpm-lock.yaml @@ -6,8 +6,8 @@ settings: dependencies: '@opensystemslab/planx-core': - specifier: git+https://github.com/theopensystemslab/planx-core#931d4db - version: github.com/theopensystemslab/planx-core/931d4db + specifier: git+https://github.com/theopensystemslab/planx-core#ec52620 + version: github.com/theopensystemslab/planx-core/ec52620 axios: specifier: ^1.7.4 version: 1.7.4 @@ -2501,8 +2501,8 @@ packages: engines: {node: '>=12.20'} dev: false - /type-fest@4.25.0: - resolution: {integrity: sha512-bRkIGlXsnGBRBQRAY56UXBm//9qH4bmJfFvq83gSz41N282df+fjy8ofcEgc1sM8geNt5cl6mC2g9Fht1cs8Aw==} + /type-fest@4.26.0: + resolution: {integrity: sha512-OduNjVJsFbifKb57UqZ2EMP1i4u64Xwow3NYXUtBbD4vIwJdQd4+xl8YDou1dlm4DVrtwT/7Ky8z8WyCULVfxw==} engines: {node: '>=16'} dev: false @@ -2669,8 +2669,8 @@ packages: resolution: {integrity: sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==} dev: false - github.com/theopensystemslab/planx-core/931d4db: - resolution: {tarball: https://codeload.github.com/theopensystemslab/planx-core/tar.gz/931d4db} + github.com/theopensystemslab/planx-core/ec52620: + resolution: {tarball: https://codeload.github.com/theopensystemslab/planx-core/tar.gz/ec52620} name: '@opensystemslab/planx-core' version: 1.0.0 prepare: true @@ -2696,7 +2696,7 @@ packages: prettier: 3.3.3 react: 18.3.1 react-dom: 18.3.1(react@18.3.1) - type-fest: 4.25.0 + type-fest: 4.26.0 uuid: 10.0.0 zod: 3.23.8 transitivePeerDependencies: diff --git a/e2e/tests/ui-driven/src/helpers/context.ts b/e2e/tests/ui-driven/src/helpers/context.ts index 2e60786e54..c94783189e 100644 --- a/e2e/tests/ui-driven/src/helpers/context.ts +++ b/e2e/tests/ui-driven/src/helpers/context.ts @@ -60,7 +60,7 @@ export async function setUpTestContext( name: context.team.name, settings: { homepage: context.team.settings?.homepage, - submissionEmail: context.team.submissionEmail, + submissionEmail: context.team.settings?.submissionEmail, }, }); } diff --git a/editor.planx.uk/package.json b/editor.planx.uk/package.json index 9f16b6549e..d52764d757 100644 --- a/editor.planx.uk/package.json +++ b/editor.planx.uk/package.json @@ -14,7 +14,7 @@ "@mui/lab": "5.0.0-alpha.170", "@mui/material": "^5.15.10", "@mui/utils": "^5.15.11", - "@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#931d4db", + "@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#ec52620", "@opensystemslab/map": "1.0.0-alpha.2", "@tiptap/core": "^2.4.0", "@tiptap/extension-bold": "^2.0.3", diff --git a/editor.planx.uk/pnpm-lock.yaml b/editor.planx.uk/pnpm-lock.yaml index 014ad884f5..8e03e5da42 100644 --- a/editor.planx.uk/pnpm-lock.yaml +++ b/editor.planx.uk/pnpm-lock.yaml @@ -47,8 +47,8 @@ dependencies: specifier: 1.0.0-alpha.2 version: 1.0.0-alpha.2 '@opensystemslab/planx-core': - specifier: git+https://github.com/theopensystemslab/planx-core#931d4db - version: github.com/theopensystemslab/planx-core/931d4db(@types/react@18.2.45) + specifier: git+https://github.com/theopensystemslab/planx-core#ec52620 + version: github.com/theopensystemslab/planx-core/ec52620(@types/react@18.2.45) '@tiptap/core': specifier: ^2.4.0 version: 2.4.0(@tiptap/pm@2.0.3) @@ -19994,8 +19994,8 @@ packages: engines: {node: '>=16'} dev: false - /type-fest@4.25.0: - resolution: {integrity: sha512-bRkIGlXsnGBRBQRAY56UXBm//9qH4bmJfFvq83gSz41N282df+fjy8ofcEgc1sM8geNt5cl6mC2g9Fht1cs8Aw==} + /type-fest@4.26.0: + resolution: {integrity: sha512-OduNjVJsFbifKb57UqZ2EMP1i4u64Xwow3NYXUtBbD4vIwJdQd4+xl8YDou1dlm4DVrtwT/7Ky8z8WyCULVfxw==} engines: {node: '>=16'} dev: false @@ -21379,9 +21379,9 @@ packages: use-sync-external-store: 1.2.0(react@18.2.0) dev: false - github.com/theopensystemslab/planx-core/931d4db(@types/react@18.2.45): - resolution: {tarball: https://codeload.github.com/theopensystemslab/planx-core/tar.gz/931d4db} - id: github.com/theopensystemslab/planx-core/931d4db + github.com/theopensystemslab/planx-core/ec52620(@types/react@18.2.45): + resolution: {tarball: https://codeload.github.com/theopensystemslab/planx-core/tar.gz/ec52620} + id: github.com/theopensystemslab/planx-core/ec52620 name: '@opensystemslab/planx-core' version: 1.0.0 prepare: true @@ -21407,7 +21407,7 @@ packages: prettier: 3.3.3 react: 18.3.1 react-dom: 18.3.1(react@18.3.1) - type-fest: 4.25.0 + type-fest: 4.26.0 uuid: 10.0.0 zod: 3.23.8 transitivePeerDependencies: diff --git a/editor.planx.uk/src/types.ts b/editor.planx.uk/src/types.ts index 9a129e442e..8837621420 100644 --- a/editor.planx.uk/src/types.ts +++ b/editor.planx.uk/src/types.ts @@ -1,8 +1,8 @@ import { FlowStatus, GovUKPayment, - NotifyPersonalisation, Team, + TeamContactSettings, } from "@opensystemslab/planx-core/types"; import { OT } from "@planx/graph/types"; import { useFormik } from "formik"; @@ -116,7 +116,7 @@ export interface AdminPanelData { subdomain?: string; planningDataEnabled: boolean; article4sEnabled: string; - govnotifyPersonalisation?: NotifyPersonalisation; + govnotifyPersonalisation?: TeamContactSettings; govpayEnabled: boolean; sendToEmailAddress?: string; bopsSubmissionURL?: string;