From b1b905087d88cfb999d30793560eebdf72c5a4b8 Mon Sep 17 00:00:00 2001 From: Jessica McInchak Date: Fri, 12 Jul 2024 18:14:21 +0200 Subject: [PATCH] update all instances of formatRawProjectTypes --- .../inviteToPay/sendConfirmationEmail.test.ts | 20 +--------- .../inviteToPay/sendConfirmationEmail.ts | 7 ++-- .../inviteToPay/sendPaymentEmail.test.ts | 5 --- .../service/inviteToPay/sendPaymentEmail.ts | 22 +++++------ .../service/resumeApplication.test.ts | 31 +++------------ .../service/resumeApplication.ts | 14 ++++--- .../modules/saveAndReturn/service/utils.ts | 25 ++++++------ api.planx.uk/modules/sendEmail/index.test.ts | 4 -- api.planx.uk/package.json | 2 +- api.planx.uk/pnpm-lock.yaml | 39 ++++++++++++++----- e2e/tests/api-driven/package.json | 2 +- e2e/tests/api-driven/pnpm-lock.yaml | 35 ++++++++++++----- e2e/tests/ui-driven/package.json | 2 +- e2e/tests/ui-driven/pnpm-lock.yaml | 39 ++++++++++++++----- editor.planx.uk/package.json | 2 +- editor.planx.uk/pnpm-lock.yaml | 34 +++++++++++++--- editor.planx.uk/src/pages/Pay/MakePayment.tsx | 8 ++-- 17 files changed, 164 insertions(+), 127 deletions(-) diff --git a/api.planx.uk/modules/pay/service/inviteToPay/sendConfirmationEmail.test.ts b/api.planx.uk/modules/pay/service/inviteToPay/sendConfirmationEmail.test.ts index 7739adbd9c..6150f6b4a2 100644 --- a/api.planx.uk/modules/pay/service/inviteToPay/sendConfirmationEmail.test.ts +++ b/api.planx.uk/modules/pay/service/inviteToPay/sendConfirmationEmail.test.ts @@ -58,31 +58,13 @@ describe("sendAgentAndPayeeConfirmationEmail", () => { ], }, }); - queryMock.mockQuery({ - name: "LookupHumanReadableProjectType", - variables: { - rawList: [ - "alter.internal", - "alter.openings.add.doors.rear", - "alter.facades.paint", - ], - }, - data: { - projectTypes: [ - { description: "internal alterations" }, - { description: "addition of doorways to the rear of the building" }, - { description: "painting of facades" }, - ], - }, - }); const expectedConfig = { personalisation: { applicantName: "xyz", payeeName: "payeeName", address: "123 PLACE", - projectType: - "Internal alterations, addition of doorways to the rear of the building, and painting of facades", + projectType: "Paint the facade and changes to internal walls or layout", emailReplyToId: "123", helpEmail: "help@email.com", helpOpeningHours: "9-5", diff --git a/api.planx.uk/modules/pay/service/inviteToPay/sendConfirmationEmail.ts b/api.planx.uk/modules/pay/service/inviteToPay/sendConfirmationEmail.ts index 92e30223d7..be197253be 100644 --- a/api.planx.uk/modules/pay/service/inviteToPay/sendConfirmationEmail.ts +++ b/api.planx.uk/modules/pay/service/inviteToPay/sendConfirmationEmail.ts @@ -1,13 +1,14 @@ -import { $public, $api } from "../../../../client"; -import { sendEmail } from "../../../../lib/notify"; +import { formatRawProjectTypes } from "@opensystemslab/planx-core"; import { gql } from "graphql-request"; +import { $api } from "../../../../client"; +import { sendEmail } from "../../../../lib/notify"; import type { AgentAndPayeeSubmissionNotifyConfig } from "../../../../types"; export async function sendAgentAndPayeeConfirmationEmail(sessionId: string) { const { personalisation, applicantEmail, payeeEmail, projectTypes } = await getDataForPayeeAndAgentEmails(sessionId); const projectType = projectTypes.length - ? await $public.formatRawProjectTypes(projectTypes) + ? formatRawProjectTypes(projectTypes) : "Project type not submitted"; const config: AgentAndPayeeSubmissionNotifyConfig = { personalisation: { diff --git a/api.planx.uk/modules/pay/service/inviteToPay/sendPaymentEmail.test.ts b/api.planx.uk/modules/pay/service/inviteToPay/sendPaymentEmail.test.ts index d836ff4c21..191dc6c522 100644 --- a/api.planx.uk/modules/pay/service/inviteToPay/sendPaymentEmail.test.ts +++ b/api.planx.uk/modules/pay/service/inviteToPay/sendPaymentEmail.test.ts @@ -6,11 +6,6 @@ import { validatePaymentRequestNotFoundQueryMock, validatePaymentRequestQueryMock, } from "../../../../tests/mocks/inviteToPayMocks"; -import { CoreDomainClient } from "@opensystemslab/planx-core"; - -jest - .spyOn(CoreDomainClient.prototype, "formatRawProjectTypes") - .mockResolvedValue("New office premises"); const TEST_PAYMENT_REQUEST_ID = "09655c28-3f34-4619-9385-cd57312acc44"; diff --git a/api.planx.uk/modules/pay/service/inviteToPay/sendPaymentEmail.ts b/api.planx.uk/modules/pay/service/inviteToPay/sendPaymentEmail.ts index 14dd6cea5c..1924d221d7 100644 --- a/api.planx.uk/modules/pay/service/inviteToPay/sendPaymentEmail.ts +++ b/api.planx.uk/modules/pay/service/inviteToPay/sendPaymentEmail.ts @@ -1,16 +1,16 @@ +import { formatRawProjectTypes } from "@opensystemslab/planx-core"; +import type { PaymentRequest, Team } from "@opensystemslab/planx-core/types"; import { gql } from "graphql-request"; -import { - calculateExpiryDate, - getServiceLink, -} from "../../../saveAndReturn/service/utils"; import { Template, getClientForTemplate, sendEmail, } from "../../../../lib/notify"; import { InviteToPayNotifyConfig } from "../../../../types"; -import type { PaymentRequest, Team } from "@opensystemslab/planx-core/types"; -import { $public } from "../../../../client"; +import { + calculateExpiryDate, + getServiceLink, +} from "../../../saveAndReturn/service/utils"; interface SessionDetails { email: string; @@ -37,7 +37,7 @@ const sendSinglePaymentEmail = async ({ paymentRequestId, template, ); - const config = await getInviteToPayNotifyConfig(session, paymentRequest); + const config = getInviteToPayNotifyConfig(session, paymentRequest); const recipient = template.includes("-agent") ? session.email : paymentRequest.payeeEmail; @@ -104,10 +104,10 @@ const validatePaymentRequest = async ( } }; -const getInviteToPayNotifyConfig = async ( +const getInviteToPayNotifyConfig = ( session: SessionDetails, paymentRequest: PaymentRequest, -): Promise => { +): InviteToPayNotifyConfig => { const flow = session.flow; const { settings } = session.flow.team; @@ -127,11 +127,11 @@ const getInviteToPayNotifyConfig = async ( ).title, fee: getFee(paymentRequest), projectType: - (await $public.formatRawProjectTypes( + formatRawProjectTypes( paymentRequest.sessionPreviewData?.[ "proposal.projectType" ] as string[], - )) || "Project type not submitted", + ) || "Project type not submitted", serviceName: session.flow.name, serviceLink: getServiceLink(flow.team, flow.slug), expiryDate: calculateExpiryDate(paymentRequest.createdAt), diff --git a/api.planx.uk/modules/saveAndReturn/service/resumeApplication.test.ts b/api.planx.uk/modules/saveAndReturn/service/resumeApplication.test.ts index 1c57226fdb..47c6e35fd9 100644 --- a/api.planx.uk/modules/saveAndReturn/service/resumeApplication.test.ts +++ b/api.planx.uk/modules/saveAndReturn/service/resumeApplication.test.ts @@ -13,25 +13,6 @@ import { Team } from "@opensystemslab/planx-core/types"; const ENDPOINT = "/resume-application"; const TEST_EMAIL = "simulate-delivered@notifications.service.gov.uk"; -const mockFormatRawProjectTypes = jest - .fn() - .mockResolvedValue(["New office premises"]); - -jest.mock("@opensystemslab/planx-core", () => { - const actualCoreDomainClient = jest.requireActual( - "@opensystemslab/planx-core", - ).CoreDomainClient; - - return { - CoreDomainClient: class extends actualCoreDomainClient { - constructor() { - super(); - this.formatRawProjectTypes = () => mockFormatRawProjectTypes(); - } - }, - }; -}); - describe("buildContentFromSessions function", () => { it("should return correctly formatted content for a single session", async () => { const sessions: PartialDeep[] = [ @@ -57,7 +38,7 @@ describe("buildContentFromSessions function", () => { const result = `Service: Apply for a Lawful Development Certificate Address: 1 High Street - Project type: New office premises + Project type: New offices Expiry Date: 29 May 2026 Link: example.com/team/apply-for-a-lawful-development-certificate/published?sessionId=123`; expect( @@ -127,15 +108,15 @@ describe("buildContentFromSessions function", () => { ]; const result = `Service: Apply for a Lawful Development Certificate Address: 1 High Street - Project type: New office premises + Project type: New offices Expiry Date: 29 May 2026 Link: example.com/team/apply-for-a-lawful-development-certificate/published?sessionId=123\n\nService: Apply for a Lawful Development Certificate Address: 2 High Street - Project type: New office premises + Project type: New offices Expiry Date: 29 May 2026 Link: example.com/team/apply-for-a-lawful-development-certificate/published?sessionId=456\n\nService: Apply for a Lawful Development Certificate Address: 3 High Street - Project type: New office premises + Project type: New offices Expiry Date: 29 May 2026 Link: example.com/team/apply-for-a-lawful-development-certificate/published?sessionId=789`; expect( @@ -187,7 +168,7 @@ describe("buildContentFromSessions function", () => { ]; const result = `Service: Apply for a Lawful Development Certificate Address: 1 High Street - Project type: New office premises + Project type: New offices Expiry Date: 29 May 2026 Link: example.com/team/apply-for-a-lawful-development-certificate/published?sessionId=123`; expect( @@ -220,7 +201,7 @@ describe("buildContentFromSessions function", () => { const result = `Service: Apply for a Lawful Development Certificate Address: Address not submitted - Project type: New office premises + Project type: New offices Expiry Date: 29 May 2026 Link: example.com/team/apply-for-a-lawful-development-certificate/published?sessionId=123`; expect( diff --git a/api.planx.uk/modules/saveAndReturn/service/resumeApplication.ts b/api.planx.uk/modules/saveAndReturn/service/resumeApplication.ts index 5e0c877c0b..e8c1eb1414 100644 --- a/api.planx.uk/modules/saveAndReturn/service/resumeApplication.ts +++ b/api.planx.uk/modules/saveAndReturn/service/resumeApplication.ts @@ -1,7 +1,9 @@ +import { formatRawProjectTypes } from "@opensystemslab/planx-core"; import type { SiteAddress, Team } from "@opensystemslab/planx-core/types"; import { differenceInDays } from "date-fns"; import { gql } from "graphql-request"; -import { $api, $public } from "../../../client"; + +import { $api } from "../../../client"; import { sendEmail } from "../../../lib/notify"; import { LowCalSession } from "../../../types"; import { DAYS_UNTIL_EXPIRY, calculateExpiryDate, getResumeLink } from "./utils"; @@ -108,13 +110,15 @@ const buildContentFromSessions = async ( sessions: LowCalSession[], team: Team, ): Promise => { - const contentBuilder = async (session: LowCalSession) => { + const contentBuilder = (session: LowCalSession) => { const address: SiteAddress | undefined = session.data?.passport?.data?._address; const addressLine = address?.single_line_address || address?.title; - const projectType = await $public.formatRawProjectTypes( - session.data?.passport?.data?.["proposal.projectType"], - ); + const projectType = session.data?.passport?.data?.["proposal.projectType"] + ? formatRawProjectTypes( + session.data?.passport?.data?.["proposal.projectType"], + ) + : "Project type not submitted"; const resumeLink = getResumeLink(session, team, session.flow.slug); const expiryDate = calculateExpiryDate(session.created_at); diff --git a/api.planx.uk/modules/saveAndReturn/service/utils.ts b/api.planx.uk/modules/saveAndReturn/service/utils.ts index d65dedc16f..492cacf10e 100644 --- a/api.planx.uk/modules/saveAndReturn/service/utils.ts +++ b/api.planx.uk/modules/saveAndReturn/service/utils.ts @@ -1,9 +1,11 @@ +import { formatRawProjectTypes } from "@opensystemslab/planx-core"; import { SiteAddress, Team } from "@opensystemslab/planx-core/types"; -import { format, addDays } from "date-fns"; +import { addDays, format } from "date-fns"; import { gql } from "graphql-request"; -import { LowCalSession } from "../../../types"; + +import { $api } from "../../../client"; import { Template, getClientForTemplate, sendEmail } from "../../../lib/notify"; -import { $api, $public } from "../../../client"; +import { LowCalSession } from "../../../types"; const DAYS_UNTIL_EXPIRY = 28; const REMINDER_DAYS_FROM_EXPIRY = [7, 1]; @@ -129,7 +131,7 @@ const validateSingleSessionRequest = async ( flowSlug: session.flow.slug, flowName: session.flow.name, team: session.flow.team, - session: await getSessionDetails(session), + session: getSessionDetails(session), }; } catch (error) { throw Error(`Unable to validate request. ${(error as Error).message}`); @@ -148,14 +150,11 @@ interface SessionDetails { /** * Parse session details into an object which will be read by email template */ -export const getSessionDetails = async ( - session: LowCalSession, -): Promise => { +export const getSessionDetails = (session: LowCalSession): SessionDetails => { const passportProtectTypes = session.data.passport?.data?.["proposal.projectType"]; const projectTypes = - passportProtectTypes && - (await $public.formatRawProjectTypes(passportProtectTypes)); + passportProtectTypes && formatRawProjectTypes(passportProtectTypes); const address: SiteAddress | undefined = session.data?.passport?.data?._address; const addressLine = address?.single_line_address || address?.title; @@ -280,12 +279,12 @@ export const setupEmailEventTriggers = async (sessionId: string) => { }; export { - getSaveAndReturnPublicHeaders, - getResumeLink, - sendSingleApplicationEmail, - markSessionAsSubmitted, DAYS_UNTIL_EXPIRY, REMINDER_DAYS_FROM_EXPIRY, calculateExpiryDate, + getResumeLink, + getSaveAndReturnPublicHeaders, + markSessionAsSubmitted, + sendSingleApplicationEmail, softDeleteSession, }; diff --git a/api.planx.uk/modules/sendEmail/index.test.ts b/api.planx.uk/modules/sendEmail/index.test.ts index 8ae931321a..0f53513bbb 100644 --- a/api.planx.uk/modules/sendEmail/index.test.ts +++ b/api.planx.uk/modules/sendEmail/index.test.ts @@ -15,10 +15,6 @@ import { CoreDomainClient } from "@opensystemslab/planx-core"; const TEST_EMAIL = "simulate-delivered@notifications.service.gov.uk"; const SAVE_ENDPOINT = "/send-email/save"; -jest - .spyOn(CoreDomainClient.prototype, "formatRawProjectTypes") - .mockResolvedValue("New office premises"); - describe("Send Email endpoint", () => { beforeEach(() => { queryMock.reset(); diff --git a/api.planx.uk/package.json b/api.planx.uk/package.json index 64343791e3..fde3111f99 100644 --- a/api.planx.uk/package.json +++ b/api.planx.uk/package.json @@ -5,7 +5,7 @@ "packageManager": "pnpm@8.6.6", "dependencies": { "@airbrake/node": "^2.1.8", - "@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#7666a78", + "@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#eb3b635", "@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 956bcf7897..fce8b571b4 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#7666a78 - version: github.com/theopensystemslab/planx-core/7666a78 + specifier: git+https://github.com/theopensystemslab/planx-core#eb3b635 + version: github.com/theopensystemslab/planx-core/eb3b635 '@types/isomorphic-fetch': specifier: ^0.0.36 version: 0.0.36 @@ -1222,6 +1222,27 @@ packages: resolution: {integrity: sha512-dWO2pw8hhi+WrXq1YJy2yCuWoL20PddgGaqTgVe4cOS9Q6qklXCiA1tJEqX6BEwRNSCP84/afac9hd4MS+zEUA==} dev: false + /@formatjs/ecma402-abstract@2.0.0: + resolution: {integrity: sha512-rRqXOqdFmk7RYvj4khklyqzcfQl9vEL/usogncBHRZfZBDOwMGuSRNFl02fu5KGHXdbinju+YXyuR+Nk8xlr/g==} + dependencies: + '@formatjs/intl-localematcher': 0.5.4 + tslib: 2.6.3 + dev: false + + /@formatjs/intl-listformat@7.5.7: + resolution: {integrity: sha512-MG2TSChQJQT9f7Rlv+eXwUFiG24mKSzmF144PLb8m8OixyXqn4+YWU+5wZracZGCgVTVmx8viCf7IH3QXoiB2g==} + dependencies: + '@formatjs/ecma402-abstract': 2.0.0 + '@formatjs/intl-localematcher': 0.5.4 + tslib: 2.6.3 + dev: false + + /@formatjs/intl-localematcher@0.5.4: + resolution: {integrity: sha512-zTwEpWOzZ2CiKcB93BLngUX59hQkuZjT2+SAQEscSm52peDW/getsawMcWF1rGRpMCX6D7nSJA3CzJ8gn13N/g==} + dependencies: + tslib: 2.6.3 + dev: false + /@graphql-typed-document-node/core@3.2.0(graphql@16.9.0): resolution: {integrity: sha512-mB9oAsNCm9aM3/SOv4YtBMqZbYj10R7dkq8byBqxGY/ncFwhf2oQzMV+LCRlWoDSEBJ3COiR1yeDvMtsoOsuFQ==} peerDependencies: @@ -1890,10 +1911,6 @@ packages: '@types/qs': 6.9.15 '@types/serve-static': 1.15.7 - /@types/geojson@7946.0.14: - resolution: {integrity: sha512-WCfD5Ht3ZesJUsONdhvm84dmzWOiOzOAqOncN0++w0lBw1o8OuDNJF2McvvCef/yBqb/HYRahp1BYtODFQ8bRg==} - dev: false - /@types/graceful-fs@4.1.9: resolution: {integrity: sha512-olP3sd1qOEe5dXTSaFvQG+02VdRXcdytWLAZsAq1PecU8uqQAhkrnbli7DagjtXKW/Bl7YJbUsa8MPcuc8LHEQ==} dependencies: @@ -7732,6 +7749,10 @@ packages: resolution: {integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==} dev: true + /tslib@2.6.3: + resolution: {integrity: sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==} + dev: false + /tsscmp@1.0.6: resolution: {integrity: sha512-LxhtAkPDTkVCMQjt2h6eBVY28KCjikZqZfMcC15YBeNjkgUpdCfBu5HoiOTDu86v6smE8yOjyEktJ8hlbANHQA==} engines: {node: '>=0.6.x'} @@ -8203,8 +8224,8 @@ packages: resolution: {integrity: sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==} dev: false - github.com/theopensystemslab/planx-core/7666a78: - resolution: {tarball: https://codeload.github.com/theopensystemslab/planx-core/tar.gz/7666a78} + github.com/theopensystemslab/planx-core/eb3b635: + resolution: {tarball: https://codeload.github.com/theopensystemslab/planx-core/tar.gz/eb3b635} name: '@opensystemslab/planx-core' version: 1.0.0 prepare: true @@ -8212,8 +8233,8 @@ packages: dependencies: '@emotion/react': 11.11.4(react@18.3.1) '@emotion/styled': 11.11.5(@emotion/react@11.11.4)(react@18.3.1) + '@formatjs/intl-listformat': 7.5.7 '@mui/material': 5.15.21(@emotion/react@11.11.4)(@emotion/styled@11.11.5)(react-dom@18.3.1)(react@18.3.1) - '@types/geojson': 7946.0.14 ajv: 8.16.0 ajv-formats: 2.1.1(ajv@8.16.0) cheerio: 1.0.0-rc.12 diff --git a/e2e/tests/api-driven/package.json b/e2e/tests/api-driven/package.json index 56327dd937..7b62a2b100 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#7666a78", + "@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#eb3b635", "axios": "^1.6.8", "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 bbf9d8c26e..c1786a89ae 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#7666a78 - version: github.com/theopensystemslab/planx-core/7666a78 + specifier: git+https://github.com/theopensystemslab/planx-core#eb3b635 + version: github.com/theopensystemslab/planx-core/eb3b635 axios: specifier: ^1.6.8 version: 1.6.8 @@ -516,6 +516,27 @@ packages: resolution: {integrity: sha512-dWO2pw8hhi+WrXq1YJy2yCuWoL20PddgGaqTgVe4cOS9Q6qklXCiA1tJEqX6BEwRNSCP84/afac9hd4MS+zEUA==} dev: false + /@formatjs/ecma402-abstract@2.0.0: + resolution: {integrity: sha512-rRqXOqdFmk7RYvj4khklyqzcfQl9vEL/usogncBHRZfZBDOwMGuSRNFl02fu5KGHXdbinju+YXyuR+Nk8xlr/g==} + dependencies: + '@formatjs/intl-localematcher': 0.5.4 + tslib: 2.6.3 + dev: false + + /@formatjs/intl-listformat@7.5.7: + resolution: {integrity: sha512-MG2TSChQJQT9f7Rlv+eXwUFiG24mKSzmF144PLb8m8OixyXqn4+YWU+5wZracZGCgVTVmx8viCf7IH3QXoiB2g==} + dependencies: + '@formatjs/ecma402-abstract': 2.0.0 + '@formatjs/intl-localematcher': 0.5.4 + tslib: 2.6.3 + dev: false + + /@formatjs/intl-localematcher@0.5.4: + resolution: {integrity: sha512-zTwEpWOzZ2CiKcB93BLngUX59hQkuZjT2+SAQEscSm52peDW/getsawMcWF1rGRpMCX6D7nSJA3CzJ8gn13N/g==} + dependencies: + tslib: 2.6.3 + dev: false + /@graphql-typed-document-node/core@3.2.0(graphql@16.9.0): resolution: {integrity: sha512-mB9oAsNCm9aM3/SOv4YtBMqZbYj10R7dkq8byBqxGY/ncFwhf2oQzMV+LCRlWoDSEBJ3COiR1yeDvMtsoOsuFQ==} peerDependencies: @@ -804,10 +825,6 @@ packages: resolution: {integrity: sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==} dev: true - /@types/geojson@7946.0.14: - resolution: {integrity: sha512-WCfD5Ht3ZesJUsONdhvm84dmzWOiOzOAqOncN0++w0lBw1o8OuDNJF2McvvCef/yBqb/HYRahp1BYtODFQ8bRg==} - dev: false - /@types/json-schema@7.0.15: resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} dev: false @@ -3053,8 +3070,8 @@ packages: resolution: {integrity: sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==} dev: false - github.com/theopensystemslab/planx-core/7666a78: - resolution: {tarball: https://codeload.github.com/theopensystemslab/planx-core/tar.gz/7666a78} + github.com/theopensystemslab/planx-core/eb3b635: + resolution: {tarball: https://codeload.github.com/theopensystemslab/planx-core/tar.gz/eb3b635} name: '@opensystemslab/planx-core' version: 1.0.0 prepare: true @@ -3062,8 +3079,8 @@ packages: dependencies: '@emotion/react': 11.11.4(react@18.3.1) '@emotion/styled': 11.11.5(@emotion/react@11.11.4)(react@18.3.1) + '@formatjs/intl-listformat': 7.5.7 '@mui/material': 5.15.21(@emotion/react@11.11.4)(@emotion/styled@11.11.5)(react-dom@18.3.1)(react@18.3.1) - '@types/geojson': 7946.0.14 ajv: 8.16.0 ajv-formats: 2.1.1(ajv@8.16.0) cheerio: 1.0.0-rc.12 diff --git a/e2e/tests/ui-driven/package.json b/e2e/tests/ui-driven/package.json index 0ec4fb8c07..18b887e7ca 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#7666a78", + "@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#eb3b635", "axios": "^1.6.8", "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 05082a1442..6c8c7fbaa6 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#7666a78 - version: github.com/theopensystemslab/planx-core/7666a78 + specifier: git+https://github.com/theopensystemslab/planx-core#eb3b635 + version: github.com/theopensystemslab/planx-core/eb3b635 axios: specifier: ^1.6.8 version: 1.6.8 @@ -382,6 +382,27 @@ packages: resolution: {integrity: sha512-dWO2pw8hhi+WrXq1YJy2yCuWoL20PddgGaqTgVe4cOS9Q6qklXCiA1tJEqX6BEwRNSCP84/afac9hd4MS+zEUA==} dev: false + /@formatjs/ecma402-abstract@2.0.0: + resolution: {integrity: sha512-rRqXOqdFmk7RYvj4khklyqzcfQl9vEL/usogncBHRZfZBDOwMGuSRNFl02fu5KGHXdbinju+YXyuR+Nk8xlr/g==} + dependencies: + '@formatjs/intl-localematcher': 0.5.4 + tslib: 2.6.3 + dev: false + + /@formatjs/intl-listformat@7.5.7: + resolution: {integrity: sha512-MG2TSChQJQT9f7Rlv+eXwUFiG24mKSzmF144PLb8m8OixyXqn4+YWU+5wZracZGCgVTVmx8viCf7IH3QXoiB2g==} + dependencies: + '@formatjs/ecma402-abstract': 2.0.0 + '@formatjs/intl-localematcher': 0.5.4 + tslib: 2.6.3 + dev: false + + /@formatjs/intl-localematcher@0.5.4: + resolution: {integrity: sha512-zTwEpWOzZ2CiKcB93BLngUX59hQkuZjT2+SAQEscSm52peDW/getsawMcWF1rGRpMCX6D7nSJA3CzJ8gn13N/g==} + dependencies: + tslib: 2.6.3 + dev: false + /@graphql-typed-document-node/core@3.2.0(graphql@16.9.0): resolution: {integrity: sha512-mB9oAsNCm9aM3/SOv4YtBMqZbYj10R7dkq8byBqxGY/ncFwhf2oQzMV+LCRlWoDSEBJ3COiR1yeDvMtsoOsuFQ==} peerDependencies: @@ -643,10 +664,6 @@ packages: resolution: {integrity: sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==} dev: false - /@types/geojson@7946.0.14: - resolution: {integrity: sha512-WCfD5Ht3ZesJUsONdhvm84dmzWOiOzOAqOncN0++w0lBw1o8OuDNJF2McvvCef/yBqb/HYRahp1BYtODFQ8bRg==} - dev: false - /@types/json-schema@7.0.15: resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} dev: false @@ -2609,6 +2626,10 @@ packages: resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} dev: false + /tslib@2.6.3: + resolution: {integrity: sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==} + dev: false + /type-check@0.4.0: resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==} engines: {node: '>= 0.8.0'} @@ -2782,8 +2803,8 @@ packages: resolution: {integrity: sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==} dev: false - github.com/theopensystemslab/planx-core/7666a78: - resolution: {tarball: https://codeload.github.com/theopensystemslab/planx-core/tar.gz/7666a78} + github.com/theopensystemslab/planx-core/eb3b635: + resolution: {tarball: https://codeload.github.com/theopensystemslab/planx-core/tar.gz/eb3b635} name: '@opensystemslab/planx-core' version: 1.0.0 prepare: true @@ -2791,8 +2812,8 @@ packages: dependencies: '@emotion/react': 11.11.4(react@18.3.1) '@emotion/styled': 11.11.5(@emotion/react@11.11.4)(react@18.3.1) + '@formatjs/intl-listformat': 7.5.7 '@mui/material': 5.15.21(@emotion/react@11.11.4)(@emotion/styled@11.11.5)(react-dom@18.3.1)(react@18.3.1) - '@types/geojson': 7946.0.14 ajv: 8.16.0 ajv-formats: 2.1.1(ajv@8.16.0) cheerio: 1.0.0-rc.12 diff --git a/editor.planx.uk/package.json b/editor.planx.uk/package.json index 74c80819f3..553866560b 100644 --- a/editor.planx.uk/package.json +++ b/editor.planx.uk/package.json @@ -13,7 +13,7 @@ "@mui/material": "^5.15.2", "@mui/utils": "^5.15.2", "@opensystemslab/map": "^0.8.3", - "@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#7666a78", + "@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#eb3b635", "@tiptap/core": "^2.4.0", "@tiptap/extension-bold": "^2.0.3", "@tiptap/extension-bubble-menu": "^2.1.13", diff --git a/editor.planx.uk/pnpm-lock.yaml b/editor.planx.uk/pnpm-lock.yaml index d4765034e1..f908f2591c 100644 --- a/editor.planx.uk/pnpm-lock.yaml +++ b/editor.planx.uk/pnpm-lock.yaml @@ -43,8 +43,8 @@ dependencies: specifier: ^0.8.3 version: 0.8.3 '@opensystemslab/planx-core': - specifier: git+https://github.com/theopensystemslab/planx-core#7666a78 - version: github.com/theopensystemslab/planx-core/7666a78(@types/react@18.2.45) + specifier: git+https://github.com/theopensystemslab/planx-core#eb3b635 + version: github.com/theopensystemslab/planx-core/eb3b635(@types/react@18.2.45) '@tiptap/core': specifier: ^2.4.0 version: 2.4.0(@tiptap/pm@2.0.3) @@ -4578,6 +4578,27 @@ packages: react: 18.2.0 dev: true + /@formatjs/ecma402-abstract@2.0.0: + resolution: {integrity: sha512-rRqXOqdFmk7RYvj4khklyqzcfQl9vEL/usogncBHRZfZBDOwMGuSRNFl02fu5KGHXdbinju+YXyuR+Nk8xlr/g==} + dependencies: + '@formatjs/intl-localematcher': 0.5.4 + tslib: 2.6.3 + dev: false + + /@formatjs/intl-listformat@7.5.7: + resolution: {integrity: sha512-MG2TSChQJQT9f7Rlv+eXwUFiG24mKSzmF144PLb8m8OixyXqn4+YWU+5wZracZGCgVTVmx8viCf7IH3QXoiB2g==} + dependencies: + '@formatjs/ecma402-abstract': 2.0.0 + '@formatjs/intl-localematcher': 0.5.4 + tslib: 2.6.3 + dev: false + + /@formatjs/intl-localematcher@0.5.4: + resolution: {integrity: sha512-zTwEpWOzZ2CiKcB93BLngUX59hQkuZjT2+SAQEscSm52peDW/getsawMcWF1rGRpMCX6D7nSJA3CzJ8gn13N/g==} + dependencies: + tslib: 2.6.3 + dev: false + /@graphql-typed-document-node/core@3.2.0(graphql@16.8.1): resolution: {integrity: sha512-mB9oAsNCm9aM3/SOv4YtBMqZbYj10R7dkq8byBqxGY/ncFwhf2oQzMV+LCRlWoDSEBJ3COiR1yeDvMtsoOsuFQ==} peerDependencies: @@ -8480,6 +8501,7 @@ packages: /@types/geojson@7946.0.14: resolution: {integrity: sha512-WCfD5Ht3ZesJUsONdhvm84dmzWOiOzOAqOncN0++w0lBw1o8OuDNJF2McvvCef/yBqb/HYRahp1BYtODFQ8bRg==} + dev: true /@types/graceful-fs@4.1.9: resolution: {integrity: sha512-olP3sd1qOEe5dXTSaFvQG+02VdRXcdytWLAZsAq1PecU8uqQAhkrnbli7DagjtXKW/Bl7YJbUsa8MPcuc8LHEQ==} @@ -21832,9 +21854,9 @@ packages: use-sync-external-store: 1.2.0(react@18.2.0) dev: false - github.com/theopensystemslab/planx-core/7666a78(@types/react@18.2.45): - resolution: {tarball: https://codeload.github.com/theopensystemslab/planx-core/tar.gz/7666a78} - id: github.com/theopensystemslab/planx-core/7666a78 + github.com/theopensystemslab/planx-core/eb3b635(@types/react@18.2.45): + resolution: {tarball: https://codeload.github.com/theopensystemslab/planx-core/tar.gz/eb3b635} + id: github.com/theopensystemslab/planx-core/eb3b635 name: '@opensystemslab/planx-core' version: 1.0.0 prepare: true @@ -21842,8 +21864,8 @@ packages: dependencies: '@emotion/react': 11.11.4(@types/react@18.2.45)(react@18.3.1) '@emotion/styled': 11.11.5(@emotion/react@11.11.4)(@types/react@18.2.45)(react@18.3.1) + '@formatjs/intl-listformat': 7.5.7 '@mui/material': 5.15.2(@emotion/react@11.11.4)(@emotion/styled@11.11.5)(@types/react@18.2.45)(react-dom@18.3.1)(react@18.3.1) - '@types/geojson': 7946.0.14 ajv: 8.16.0 ajv-formats: 2.1.1(ajv@8.16.0) cheerio: 1.0.0-rc.12 diff --git a/editor.planx.uk/src/pages/Pay/MakePayment.tsx b/editor.planx.uk/src/pages/Pay/MakePayment.tsx index 39afbf201f..f6db81c4a1 100644 --- a/editor.planx.uk/src/pages/Pay/MakePayment.tsx +++ b/editor.planx.uk/src/pages/Pay/MakePayment.tsx @@ -2,6 +2,7 @@ import Check from "@mui/icons-material/Check"; import Container from "@mui/material/Container"; import { lighten, useTheme } from "@mui/material/styles"; import Typography from "@mui/material/Typography"; +import { formatRawProjectTypes } from "@opensystemslab/planx-core"; import { GovUKPayment, type PaymentRequest, @@ -170,14 +171,11 @@ export default function MakePayment({ ); const PaymentDetails = () => { - const $public = useStore((state) => state.$public); const [projectType, setProjectType] = useState(); useEffect(() => { - const fetchProjectType = async () => { - const projectType = await $public().formatRawProjectTypes( - rawProjectTypes, - ); + const fetchProjectType = () => { + const projectType = formatRawProjectTypes(rawProjectTypes); setProjectType(projectType); }; fetchProjectType();