diff --git a/api.planx.uk/helpers.ts b/api.planx.uk/helpers.ts index 6bbcf5b71e..3433f5a9cd 100644 --- a/api.planx.uk/helpers.ts +++ b/api.planx.uk/helpers.ts @@ -6,6 +6,7 @@ import { $public, getClient } from "./client"; export interface FlowData { slug: string; + name: string; data: Flow["data"]; team_id: number; team: { slug: string }; @@ -28,6 +29,7 @@ const getFlowData = async (id: string): Promise => { flow: flows_by_pk(id: $id) { slug data + name team_id team { slug @@ -62,6 +64,7 @@ interface InsertFlow { const insertFlow = async ( teamId: number, slug: string, + name: string, flowData: Flow["data"], creatorId?: number, copiedFrom?: Flow["id"], @@ -75,6 +78,7 @@ const insertFlow = async ( mutation InsertFlow( $team_id: Int! $slug: String! + $name: String! $data: jsonb = {} $creator_id: Int $copied_from: uuid @@ -83,6 +87,7 @@ const insertFlow = async ( object: { team_id: $team_id slug: $slug + name: $name data: $data version: 1 creator_id: $creator_id @@ -96,6 +101,7 @@ const insertFlow = async ( { team_id: teamId, slug: slug, + name: name, data: flowData, creator_id: creatorId, copied_from: copiedFrom, diff --git a/api.planx.uk/modules/flows/copyFlow/service.ts b/api.planx.uk/modules/flows/copyFlow/service.ts index 6cf7ef8fbf..68e31f46e8 100644 --- a/api.planx.uk/modules/flows/copyFlow/service.ts +++ b/api.planx.uk/modules/flows/copyFlow/service.ts @@ -15,6 +15,7 @@ const copyFlow = async ( // Check if copied flow data should be inserted into `flows` table, or just returned for reference if (insert) { const newSlug = flow.slug + "-copy"; + const newName = flow.name + " (copy)"; const creatorId = userContext.getStore()?.user?.sub; if (!creatorId) throw Error("User details missing from request"); @@ -22,6 +23,7 @@ const copyFlow = async ( await insertFlow( flow.team_id, newSlug, + newName, uniqueFlowData, parseInt(creatorId), flowId, diff --git a/api.planx.uk/package.json b/api.planx.uk/package.json index a2e5d0b35a..d089ee7276 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#9bebbd9", + "@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#5b8c840", "@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 89ec048f12..91194d1167 100644 --- a/api.planx.uk/pnpm-lock.yaml +++ b/api.planx.uk/pnpm-lock.yaml @@ -12,8 +12,8 @@ dependencies: specifier: ^2.1.8 version: 2.1.8 '@opensystemslab/planx-core': - specifier: git+https://github.com/theopensystemslab/planx-core#9bebbd9 - version: github.com/theopensystemslab/planx-core/9bebbd9 + specifier: git+https://github.com/theopensystemslab/planx-core#5b8c840 + version: github.com/theopensystemslab/planx-core/5b8c840 '@types/isomorphic-fetch': specifier: ^0.0.36 version: 0.0.36 @@ -2324,7 +2324,7 @@ packages: - supports-color dev: false - /ajv-formats@2.1.1(ajv@8.15.0): + /ajv-formats@2.1.1(ajv@8.16.0): resolution: {integrity: sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==} peerDependencies: ajv: ^8.0.0 @@ -2332,7 +2332,7 @@ packages: ajv: optional: true dependencies: - ajv: 8.15.0 + ajv: 8.16.0 dev: false /ajv@6.12.6: @@ -2343,13 +2343,13 @@ packages: json-schema-traverse: 0.4.1 uri-js: 4.4.1 - /ajv@8.15.0: - resolution: {integrity: sha512-15BTtQUOsSrmHCy+B4VnAiJAJxJ8IFgu6fcjFQF3jQYZ78nLSQthlFg4ehp+NLIyfvFgOlxNsjKIEhydtFPVHQ==} + /ajv@8.16.0: + resolution: {integrity: sha512-F0twR8U1ZU67JIEtekUcLkXkoO5mMMmgGD8sK/xUFzJ805jxHQl92hImFAqqXMyMYjSPOyUPAwHYhB72g5sTXw==} dependencies: fast-deep-equal: 3.1.3 - fast-uri: 2.3.0 json-schema-traverse: 1.0.0 require-from-string: 2.0.2 + uri-js: 4.4.1 dev: false /ansi-escapes@4.3.2: @@ -4100,10 +4100,6 @@ packages: resolution: {integrity: sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==} dev: true - /fast-uri@2.3.0: - resolution: {integrity: sha512-eel5UKGn369gGEWOqBShmFJWfq/xSJvsgDzgLYC845GneayWvXBf0lJCBn5qTABfewy1ZDPoaR5OZCP+kssfuw==} - dev: false - /fast-url-parser@1.1.3: resolution: {integrity: sha512-5jOCVXADYNuRkKFzNJ0dCCewsZiYo0dz8QNYljkOpFC6r2U4OBmKtvm/Tsuh4w1YYdDqDb31a8TVhBJ2OJKdqQ==} dependencies: @@ -5623,7 +5619,7 @@ packages: mkdirp: 3.0.1 mz: 2.7.0 node-fetch: 3.3.2 - prettier: 3.3.0 + prettier: 3.3.1 dev: false /json-schema-traverse@0.4.1: @@ -6674,8 +6670,8 @@ packages: hasBin: true dev: true - /prettier@3.3.0: - resolution: {integrity: sha512-J9odKxERhCQ10OC2yb93583f6UnYutOeiV5i0zEDS7UGTdUt0u+y8erxl3lBKvwo/JHyyoEdXjwp4dke9oyZ/g==} + /prettier@3.3.1: + resolution: {integrity: sha512-7CAwy5dRsxs8PHXT3twixW9/OEll8MLE0VRPCJyl7CkS6VHGPSlsVaWTiASPTyGyYRyApxlaWTzwUxVNrhcwDg==} engines: {node: '>=14'} hasBin: true dev: false @@ -7875,8 +7871,8 @@ packages: engines: {node: '>=16'} dev: false - /type-fest@4.18.3: - resolution: {integrity: sha512-Q08/0IrpvM+NMY9PA2rti9Jb+JejTddwmwmVQGskAlhtcrw1wsRzoR6ode6mR+OAabNa75w/dxedSUY2mlphaQ==} + /type-fest@4.20.0: + resolution: {integrity: sha512-MBh+PHUHHisjXf4tlx0CFWoMdjx8zCMLJHOjnV1prABYZFHqtFOyauCIK2/7w4oIfwkF8iNhLtnJEfVY2vn3iw==} engines: {node: '>=16'} dev: false @@ -8305,8 +8301,8 @@ packages: resolution: {integrity: sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==} dev: false - github.com/theopensystemslab/planx-core/9bebbd9: - resolution: {tarball: https://codeload.github.com/theopensystemslab/planx-core/tar.gz/9bebbd9} + github.com/theopensystemslab/planx-core/5b8c840: + resolution: {tarball: https://codeload.github.com/theopensystemslab/planx-core/tar.gz/5b8c840} name: '@opensystemslab/planx-core' version: 1.0.0 prepare: true @@ -8316,8 +8312,8 @@ packages: '@emotion/styled': 11.11.5(@emotion/react@11.11.4)(react@18.3.1) '@mui/material': 5.15.18(@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.15.0 - ajv-formats: 2.1.1(ajv@8.15.0) + ajv: 8.16.0 + ajv-formats: 2.1.1(ajv@8.16.0) cheerio: 1.0.0-rc.12 copyfiles: 2.4.1 docx: 8.5.0 @@ -8328,10 +8324,10 @@ packages: json-schema-to-typescript: 14.0.5 lodash: 4.17.21 marked: 12.0.2 - prettier: 3.3.0 + prettier: 3.3.1 react: 18.3.1 react-dom: 18.3.1(react@18.3.1) - type-fest: 4.18.3 + type-fest: 4.20.0 uuid: 9.0.1 zod: 3.23.8 transitivePeerDependencies: diff --git a/e2e/tests/api-driven/package.json b/e2e/tests/api-driven/package.json index cc5fd48c02..92eaafff95 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#9bebbd9", + "@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#5b8c840", "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 6725026776..7e5cbd89a9 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#9bebbd9 - version: github.com/theopensystemslab/planx-core/9bebbd9 + specifier: git+https://github.com/theopensystemslab/planx-core#5b8c840 + version: github.com/theopensystemslab/planx-core/5b8c840 axios: specifier: ^1.6.8 version: 1.6.8 @@ -780,7 +780,7 @@ packages: engines: {node: '>=0.4.0'} hasBin: true - /ajv-formats@2.1.1(ajv@8.15.0): + /ajv-formats@2.1.1(ajv@8.16.0): resolution: {integrity: sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==} peerDependencies: ajv: ^8.0.0 @@ -788,7 +788,7 @@ packages: ajv: optional: true dependencies: - ajv: 8.15.0 + ajv: 8.16.0 dev: false /ajv@6.12.6: @@ -800,13 +800,13 @@ packages: uri-js: 4.4.1 dev: false - /ajv@8.15.0: - resolution: {integrity: sha512-15BTtQUOsSrmHCy+B4VnAiJAJxJ8IFgu6fcjFQF3jQYZ78nLSQthlFg4ehp+NLIyfvFgOlxNsjKIEhydtFPVHQ==} + /ajv@8.16.0: + resolution: {integrity: sha512-F0twR8U1ZU67JIEtekUcLkXkoO5mMMmgGD8sK/xUFzJ805jxHQl92hImFAqqXMyMYjSPOyUPAwHYhB72g5sTXw==} dependencies: fast-deep-equal: 3.1.3 - fast-uri: 2.3.0 json-schema-traverse: 1.0.0 require-from-string: 2.0.2 + uri-js: 4.4.1 dev: false /ansi-regex@4.1.1: @@ -1454,10 +1454,6 @@ packages: resolution: {integrity: sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==} dev: false - /fast-uri@2.3.0: - resolution: {integrity: sha512-eel5UKGn369gGEWOqBShmFJWfq/xSJvsgDzgLYC845GneayWvXBf0lJCBn5qTABfewy1ZDPoaR5OZCP+kssfuw==} - dev: false - /fast-xml-parser@4.4.0: resolution: {integrity: sha512-kLY3jFlwIYwBNDojclKsNAC12sfD6NwW74QB2CoNGPvtVxjliYehVunB3HYyNi+n4Tt1dAcgwYvmKF/Z18flqg==} hasBin: true @@ -1829,7 +1825,7 @@ packages: mkdirp: 3.0.1 mz: 2.7.0 node-fetch: 3.3.2 - prettier: 3.3.0 + prettier: 3.3.1 dev: false /json-schema-traverse@0.4.1: @@ -2292,8 +2288,8 @@ packages: engines: {node: '>= 0.8.0'} dev: false - /prettier@3.3.0: - resolution: {integrity: sha512-J9odKxERhCQ10OC2yb93583f6UnYutOeiV5i0zEDS7UGTdUt0u+y8erxl3lBKvwo/JHyyoEdXjwp4dke9oyZ/g==} + /prettier@3.3.1: + resolution: {integrity: sha512-7CAwy5dRsxs8PHXT3twixW9/OEll8MLE0VRPCJyl7CkS6VHGPSlsVaWTiASPTyGyYRyApxlaWTzwUxVNrhcwDg==} engines: {node: '>=14'} hasBin: true dev: false @@ -2736,8 +2732,8 @@ packages: engines: {node: '>=10'} dev: false - /type-fest@4.18.3: - resolution: {integrity: sha512-Q08/0IrpvM+NMY9PA2rti9Jb+JejTddwmwmVQGskAlhtcrw1wsRzoR6ode6mR+OAabNa75w/dxedSUY2mlphaQ==} + /type-fest@4.20.0: + resolution: {integrity: sha512-MBh+PHUHHisjXf4tlx0CFWoMdjx8zCMLJHOjnV1prABYZFHqtFOyauCIK2/7w4oIfwkF8iNhLtnJEfVY2vn3iw==} engines: {node: '>=16'} dev: false @@ -2940,8 +2936,8 @@ packages: resolution: {integrity: sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==} dev: false - github.com/theopensystemslab/planx-core/9bebbd9: - resolution: {tarball: https://codeload.github.com/theopensystemslab/planx-core/tar.gz/9bebbd9} + github.com/theopensystemslab/planx-core/5b8c840: + resolution: {tarball: https://codeload.github.com/theopensystemslab/planx-core/tar.gz/5b8c840} name: '@opensystemslab/planx-core' version: 1.0.0 prepare: true @@ -2951,8 +2947,8 @@ packages: '@emotion/styled': 11.11.5(@emotion/react@11.11.4)(react@18.3.1) '@mui/material': 5.15.18(@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.15.0 - ajv-formats: 2.1.1(ajv@8.15.0) + ajv: 8.16.0 + ajv-formats: 2.1.1(ajv@8.16.0) cheerio: 1.0.0-rc.12 copyfiles: 2.4.1 docx: 8.5.0 @@ -2963,10 +2959,10 @@ packages: json-schema-to-typescript: 14.0.5 lodash: 4.17.21 marked: 12.0.2 - prettier: 3.3.0 + prettier: 3.3.1 react: 18.3.1 react-dom: 18.3.1(react@18.3.1) - type-fest: 4.18.3 + type-fest: 4.20.0 uuid: 9.0.1 zod: 3.23.8 transitivePeerDependencies: diff --git a/e2e/tests/api-driven/src/flowStatusHistory/steps.ts b/e2e/tests/api-driven/src/flowStatusHistory/steps.ts index af93d5a3f0..798c4e9b87 100644 --- a/e2e/tests/api-driven/src/flowStatusHistory/steps.ts +++ b/e2e/tests/api-driven/src/flowStatusHistory/steps.ts @@ -19,7 +19,11 @@ Before("@flow-status-history", async function () { }); Given("a flow exists", async function () { - const flowId = await createFlow({ teamId: this.teamId, slug: "test-flow" }); + const flowId = await createFlow({ + teamId: this.teamId, + slug: "test-flow", + name: "Test Flow", + }); assert.ok(flowId, "flowId is not defined"); diff --git a/e2e/tests/api-driven/src/invite-to-pay/helpers.ts b/e2e/tests/api-driven/src/invite-to-pay/helpers.ts index 302be5dd57..4a856b1b77 100644 --- a/e2e/tests/api-driven/src/invite-to-pay/helpers.ts +++ b/e2e/tests/api-driven/src/invite-to-pay/helpers.ts @@ -45,6 +45,7 @@ export async function buildITPFlow({ const flowId: string = await $admin.flow.create({ teamId, slug: `test-invite-to-pay-flow-with-send-to-${destination.toLowerCase()}`, + name: `Test invite to pay flow with send to ${destination}`, status: "online", data: flowGraph, }); diff --git a/e2e/tests/api-driven/src/permissions/helpers.ts b/e2e/tests/api-driven/src/permissions/helpers.ts index c191c0cfd9..521523c540 100644 --- a/e2e/tests/api-driven/src/permissions/helpers.ts +++ b/e2e/tests/api-driven/src/permissions/helpers.ts @@ -35,6 +35,7 @@ export const setup = async () => { const team1FlowId = await createFlow({ teamId: teamId1, slug: "team-1-flow", + name: "Team 1 Flow", }); const user2Id = await createUser({ @@ -44,6 +45,7 @@ export const setup = async () => { const team2FlowId = await createFlow({ teamId: teamId2, slug: "team-2-flow", + name: "Team 2 Flow", }); const world = { diff --git a/e2e/tests/api-driven/src/permissions/queries/flows.ts b/e2e/tests/api-driven/src/permissions/queries/flows.ts index 9db7a43379..4f2215939b 100644 --- a/e2e/tests/api-driven/src/permissions/queries/flows.ts +++ b/e2e/tests/api-driven/src/permissions/queries/flows.ts @@ -16,7 +16,7 @@ export const UPDATE_FLOW_QUERY = gql` mutation UpdateFlowE2E($team1FlowId: uuid!) { result: update_flows_by_pk( pk_columns: { id: $team1FlowId } - _set: { slug: "new-slug" } + _set: { slug: "new-slug", name: "new Name" } ) { id } diff --git a/e2e/tests/ui-driven/package.json b/e2e/tests/ui-driven/package.json index 142ebda58e..30cf3a65b1 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#9bebbd9", + "@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#5b8c840", "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 f7521951db..23b37e734a 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#9bebbd9 - version: github.com/theopensystemslab/planx-core/9bebbd9 + specifier: git+https://github.com/theopensystemslab/planx-core#5b8c840 + version: github.com/theopensystemslab/planx-core/5b8c840 axios: specifier: ^1.6.8 version: 1.6.8 @@ -601,7 +601,7 @@ packages: engines: {node: '>=0.4.0'} hasBin: true - /ajv-formats@2.1.1(ajv@8.15.0): + /ajv-formats@2.1.1(ajv@8.16.0): resolution: {integrity: sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==} peerDependencies: ajv: ^8.0.0 @@ -609,7 +609,7 @@ packages: ajv: optional: true dependencies: - ajv: 8.15.0 + ajv: 8.16.0 dev: false /ajv@6.12.6: @@ -629,13 +629,13 @@ packages: uri-js: 4.4.1 dev: false - /ajv@8.15.0: - resolution: {integrity: sha512-15BTtQUOsSrmHCy+B4VnAiJAJxJ8IFgu6fcjFQF3jQYZ78nLSQthlFg4ehp+NLIyfvFgOlxNsjKIEhydtFPVHQ==} + /ajv@8.16.0: + resolution: {integrity: sha512-F0twR8U1ZU67JIEtekUcLkXkoO5mMMmgGD8sK/xUFzJ805jxHQl92hImFAqqXMyMYjSPOyUPAwHYhB72g5sTXw==} dependencies: fast-deep-equal: 3.1.3 - fast-uri: 2.3.0 json-schema-traverse: 1.0.0 require-from-string: 2.0.2 + uri-js: 4.4.1 dev: false /ansi-align@3.0.1: @@ -1348,10 +1348,6 @@ packages: /fast-levenshtein@2.0.6: resolution: {integrity: sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==} - /fast-uri@2.3.0: - resolution: {integrity: sha512-eel5UKGn369gGEWOqBShmFJWfq/xSJvsgDzgLYC845GneayWvXBf0lJCBn5qTABfewy1ZDPoaR5OZCP+kssfuw==} - dev: false - /fast-url-parser@1.1.3: resolution: {integrity: sha512-5jOCVXADYNuRkKFzNJ0dCCewsZiYo0dz8QNYljkOpFC6r2U4OBmKtvm/Tsuh4w1YYdDqDb31a8TVhBJ2OJKdqQ==} dependencies: @@ -1707,7 +1703,7 @@ packages: mkdirp: 3.0.1 mz: 2.7.0 node-fetch: 3.3.2 - prettier: 3.3.0 + prettier: 3.3.1 dev: false /json-schema-traverse@0.4.1: @@ -2149,8 +2145,8 @@ packages: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} engines: {node: '>= 0.8.0'} - /prettier@3.3.0: - resolution: {integrity: sha512-J9odKxERhCQ10OC2yb93583f6UnYutOeiV5i0zEDS7UGTdUt0u+y8erxl3lBKvwo/JHyyoEdXjwp4dke9oyZ/g==} + /prettier@3.3.1: + resolution: {integrity: sha512-7CAwy5dRsxs8PHXT3twixW9/OEll8MLE0VRPCJyl7CkS6VHGPSlsVaWTiASPTyGyYRyApxlaWTzwUxVNrhcwDg==} engines: {node: '>=14'} hasBin: true dev: false @@ -2533,8 +2529,8 @@ packages: engines: {node: '>=12.20'} dev: false - /type-fest@4.18.3: - resolution: {integrity: sha512-Q08/0IrpvM+NMY9PA2rti9Jb+JejTddwmwmVQGskAlhtcrw1wsRzoR6ode6mR+OAabNa75w/dxedSUY2mlphaQ==} + /type-fest@4.20.0: + resolution: {integrity: sha512-MBh+PHUHHisjXf4tlx0CFWoMdjx8zCMLJHOjnV1prABYZFHqtFOyauCIK2/7w4oIfwkF8iNhLtnJEfVY2vn3iw==} engines: {node: '>=16'} dev: false @@ -2688,8 +2684,8 @@ packages: resolution: {integrity: sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==} dev: false - github.com/theopensystemslab/planx-core/9bebbd9: - resolution: {tarball: https://codeload.github.com/theopensystemslab/planx-core/tar.gz/9bebbd9} + github.com/theopensystemslab/planx-core/5b8c840: + resolution: {tarball: https://codeload.github.com/theopensystemslab/planx-core/tar.gz/5b8c840} name: '@opensystemslab/planx-core' version: 1.0.0 prepare: true @@ -2699,8 +2695,8 @@ packages: '@emotion/styled': 11.11.5(@emotion/react@11.11.4)(react@18.3.1) '@mui/material': 5.15.18(@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.15.0 - ajv-formats: 2.1.1(ajv@8.15.0) + ajv: 8.16.0 + ajv-formats: 2.1.1(ajv@8.16.0) cheerio: 1.0.0-rc.12 copyfiles: 2.4.1 docx: 8.5.0 @@ -2711,10 +2707,10 @@ packages: json-schema-to-typescript: 14.0.5 lodash: 4.17.21 marked: 12.0.2 - prettier: 3.3.0 + prettier: 3.3.1 react: 18.3.1 react-dom: 18.3.1(react@18.3.1) - type-fest: 4.18.3 + type-fest: 4.20.0 uuid: 9.0.1 zod: 3.23.8 transitivePeerDependencies: diff --git a/e2e/tests/ui-driven/src/context.ts b/e2e/tests/ui-driven/src/context.ts index b9369b6e02..f2ccb89479 100644 --- a/e2e/tests/ui-driven/src/context.ts +++ b/e2e/tests/ui-driven/src/context.ts @@ -25,6 +25,7 @@ export interface Context { id?: string; publishedId?: number; slug: string; + name: string; data?: object; }; sessionIds?: string[]; @@ -67,11 +68,13 @@ export async function setUpTestContext( if ( context.flow?.slug && context.flow?.data && + context.flow?.name && context.team?.id && context.user?.id ) { context.flow.id = await $admin.flow.create({ slug: context.flow.slug, + name: context.flow.name, teamId: context.team.id, data: context.flow!.data!, status: "online", diff --git a/e2e/tests/ui-driven/src/invite-to-pay/agent.spec.ts b/e2e/tests/ui-driven/src/invite-to-pay/agent.spec.ts index a31a1cfb53..7442170cf2 100644 --- a/e2e/tests/ui-driven/src/invite-to-pay/agent.spec.ts +++ b/e2e/tests/ui-driven/src/invite-to-pay/agent.spec.ts @@ -21,6 +21,7 @@ let context: Context = { ...contextDefaults, flow: { slug: "invite-to-pay-test", + name: "Invite to pay test", data: inviteToPayFlow, }, sessionIds: [], // used to collect and clean up sessions diff --git a/e2e/tests/ui-driven/src/invite-to-pay/nominee.spec.ts b/e2e/tests/ui-driven/src/invite-to-pay/nominee.spec.ts index d200fc05bb..db126996e9 100644 --- a/e2e/tests/ui-driven/src/invite-to-pay/nominee.spec.ts +++ b/e2e/tests/ui-driven/src/invite-to-pay/nominee.spec.ts @@ -18,6 +18,7 @@ let context: Context = { ...contextDefaults, flow: { slug: "invite-to-pay-test", + name: "Invite to pay test", data: inviteToPayFlow, }, sessionIds: [], // used to collect and clean up sessions diff --git a/e2e/tests/ui-driven/src/pay.spec.ts b/e2e/tests/ui-driven/src/pay.spec.ts index c5974ae55d..c630746073 100644 --- a/e2e/tests/ui-driven/src/pay.spec.ts +++ b/e2e/tests/ui-driven/src/pay.spec.ts @@ -23,6 +23,7 @@ let context: Context = { ...contextDefaults, flow: { slug: "pay-test", + name: "Pay test", data: payFlow, }, sessionIds: [], // used to collect and clean up sessions diff --git a/e2e/tests/ui-driven/src/save-and-return.spec.ts b/e2e/tests/ui-driven/src/save-and-return.spec.ts index 0188ef8624..162615bad5 100644 --- a/e2e/tests/ui-driven/src/save-and-return.spec.ts +++ b/e2e/tests/ui-driven/src/save-and-return.spec.ts @@ -24,6 +24,7 @@ test.describe("Save and return", () => { ...contextDefaults, flow: { slug: "e2e-save-and-return-test-flow", + name: "E2E Save and Return test flow", data: simpleSendFlow, }, }; diff --git a/e2e/tests/ui-driven/src/sections.spec.ts b/e2e/tests/ui-driven/src/sections.spec.ts index c9189eb6eb..2a44985e8a 100644 --- a/e2e/tests/ui-driven/src/sections.spec.ts +++ b/e2e/tests/ui-driven/src/sections.spec.ts @@ -38,6 +38,7 @@ test.describe("Section statuses", () => { ...contextDefaults, flow: { slug: "sections-test-flow", + name: "Sections test flow", data: flow, }, }; diff --git a/editor.planx.uk/package.json b/editor.planx.uk/package.json index 489774a832..38c0449911 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.2", - "@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#9bebbd9", + "@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#5b8c840", "@tiptap/core": "^2.4.0", "@tiptap/extension-bold": "^2.0.3", "@tiptap/extension-bubble-menu": "^2.1.13", @@ -222,4 +222,4 @@ "follow-redirects@<1.15.4": ">=1.15.4" } } -} \ No newline at end of file +} diff --git a/editor.planx.uk/pnpm-lock.yaml b/editor.planx.uk/pnpm-lock.yaml index 03374bfb2c..0c82366c43 100644 --- a/editor.planx.uk/pnpm-lock.yaml +++ b/editor.planx.uk/pnpm-lock.yaml @@ -41,8 +41,8 @@ dependencies: specifier: ^0.8.2 version: 0.8.2 '@opensystemslab/planx-core': - specifier: git+https://github.com/theopensystemslab/planx-core#9bebbd9 - version: github.com/theopensystemslab/planx-core/9bebbd9(@types/react@18.2.45) + specifier: git+https://github.com/theopensystemslab/planx-core#5b8c840 + version: github.com/theopensystemslab/planx-core/5b8c840(@types/react@18.2.45) '@tiptap/core': specifier: ^2.4.0 version: 2.4.0(@tiptap/pm@2.0.3) @@ -8970,6 +8970,17 @@ packages: dependencies: ajv: 8.15.0 + /ajv-formats@2.1.1(ajv@8.16.0): + resolution: {integrity: sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==} + peerDependencies: + ajv: ^8.0.0 + peerDependenciesMeta: + ajv: + optional: true + dependencies: + ajv: 8.16.0 + dev: false + /ajv-keywords@3.5.2(ajv@6.12.6): resolution: {integrity: sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==} peerDependencies: @@ -9001,6 +9012,15 @@ packages: json-schema-traverse: 1.0.0 require-from-string: 2.0.2 + /ajv@8.16.0: + resolution: {integrity: sha512-F0twR8U1ZU67JIEtekUcLkXkoO5mMMmgGD8sK/xUFzJ805jxHQl92hImFAqqXMyMYjSPOyUPAwHYhB72g5sTXw==} + dependencies: + fast-deep-equal: 3.1.3 + json-schema-traverse: 1.0.0 + require-from-string: 2.0.2 + uri-js: 4.4.1 + dev: false + /ansi-escapes@4.3.2: resolution: {integrity: sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==} engines: {node: '>=8'} @@ -14901,7 +14921,7 @@ packages: mkdirp: 3.0.1 mz: 2.7.0 node-fetch: 3.3.2 - prettier: 3.3.0 + prettier: 3.3.1 dev: false /json-schema-traverse@0.4.1: @@ -17442,6 +17462,13 @@ packages: resolution: {integrity: sha512-J9odKxERhCQ10OC2yb93583f6UnYutOeiV5i0zEDS7UGTdUt0u+y8erxl3lBKvwo/JHyyoEdXjwp4dke9oyZ/g==} engines: {node: '>=14'} hasBin: true + dev: true + + /prettier@3.3.1: + resolution: {integrity: sha512-7CAwy5dRsxs8PHXT3twixW9/OEll8MLE0VRPCJyl7CkS6VHGPSlsVaWTiASPTyGyYRyApxlaWTzwUxVNrhcwDg==} + engines: {node: '>=14'} + hasBin: true + dev: false /pretty-bytes@5.6.0: resolution: {integrity: sha512-FFw039TmrBqFK8ma/7OL3sDz/VytdtJr044/QUJtH0wK9lb9jLq9tJyIxUwtQJHwar2BqtiA4iCWSwo9JLkzFg==} @@ -20431,8 +20458,8 @@ packages: engines: {node: '>=16'} dev: false - /type-fest@4.18.3: - resolution: {integrity: sha512-Q08/0IrpvM+NMY9PA2rti9Jb+JejTddwmwmVQGskAlhtcrw1wsRzoR6ode6mR+OAabNa75w/dxedSUY2mlphaQ==} + /type-fest@4.20.0: + resolution: {integrity: sha512-MBh+PHUHHisjXf4tlx0CFWoMdjx8zCMLJHOjnV1prABYZFHqtFOyauCIK2/7w4oIfwkF8iNhLtnJEfVY2vn3iw==} engines: {node: '>=16'} dev: false @@ -21605,9 +21632,9 @@ packages: use-sync-external-store: 1.2.0(react@18.2.0) dev: false - github.com/theopensystemslab/planx-core/9bebbd9(@types/react@18.2.45): - resolution: {tarball: https://codeload.github.com/theopensystemslab/planx-core/tar.gz/9bebbd9} - id: github.com/theopensystemslab/planx-core/9bebbd9 + github.com/theopensystemslab/planx-core/5b8c840(@types/react@18.2.45): + resolution: {tarball: https://codeload.github.com/theopensystemslab/planx-core/tar.gz/5b8c840} + id: github.com/theopensystemslab/planx-core/5b8c840 name: '@opensystemslab/planx-core' version: 1.0.0 prepare: true @@ -21617,8 +21644,8 @@ packages: '@emotion/styled': 11.11.5(@emotion/react@11.11.4)(@types/react@18.2.45)(react@18.3.1) '@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.15.0 - ajv-formats: 2.1.1(ajv@8.15.0) + ajv: 8.16.0 + ajv-formats: 2.1.1(ajv@8.16.0) cheerio: 1.0.0-rc.12 copyfiles: 2.4.1 docx: 8.5.0 @@ -21629,10 +21656,10 @@ packages: json-schema-to-typescript: 14.0.5 lodash: 4.17.21 marked: 12.0.2 - prettier: 3.3.0 + prettier: 3.3.1 react: 18.3.1 react-dom: 18.3.1(react@18.3.1) - type-fest: 4.18.3 + type-fest: 4.20.0 uuid: 9.0.1 zod: 3.23.8 transitivePeerDependencies: diff --git a/editor.planx.uk/src/@planx/components/List/Editor.tsx b/editor.planx.uk/src/@planx/components/List/Editor.tsx index c55f3c50d7..df383537d2 100644 --- a/editor.planx.uk/src/@planx/components/List/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/List/Editor.tsx @@ -14,6 +14,7 @@ import InputRowLabel from "ui/shared/InputRowLabel"; import { EditorProps, ICONS, InternalNotes, MoreInformation } from "../ui"; import { List, parseContent } from "./model"; import { ProposedAdvertisements } from "./schemas/Adverts"; + import { BuildingDetailsGLA } from "./schemas/GLA/BuildingDetails"; import { CommunalSpaceGLA } from "./schemas/GLA/CommunalSpace"; import { ExistingAndProposedUsesGLA } from "./schemas/GLA/ExistingAndProposedUses"; diff --git a/editor.planx.uk/src/@planx/components/Pay/Editor.tsx b/editor.planx.uk/src/@planx/components/Pay/Editor.tsx index 528756c6d2..423d37a44e 100644 --- a/editor.planx.uk/src/@planx/components/Pay/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/Pay/Editor.tsx @@ -137,7 +137,6 @@ export type Props = EditorProps; const Component: React.FC = (props: Props) => { const [flowName] = useStore((store) => [store.flowName]); - const initialValues: Pay = { title: props.node?.data?.title || "Pay for your application", bannerTitle: diff --git a/editor.planx.uk/src/pages/FlowEditor/lib/store/editor.ts b/editor.planx.uk/src/pages/FlowEditor/lib/store/editor.ts index 21ac46dc07..a3b24ef3e3 100644 --- a/editor.planx.uk/src/pages/FlowEditor/lib/store/editor.ts +++ b/editor.planx.uk/src/pages/FlowEditor/lib/store/editor.ts @@ -73,7 +73,7 @@ export interface EditorStore extends Store.Store { connectTo: (id: Store.nodeId) => void; copyFlow: (flowId: string) => Promise; copyNode: (id: Store.nodeId) => void; - createFlow: (teamId: any, newSlug: any) => Promise; + createFlow: (teamId: any, newSlug: any, newName: string) => Promise; deleteFlow: (teamId: number, flowSlug: string) => Promise; validateAndDiffFlow: (flowId: string) => Promise; getFlows: (teamId: number) => Promise; @@ -139,7 +139,12 @@ export const editorStore: StateCreator< const cloneStateFromShareDb = () => { const flow = JSON.parse(JSON.stringify(doc.data)); - get().setFlow({ id, flow, flowSlug: get().flowSlug }); + get().setFlow({ + id, + flow, + flowSlug: get().flowSlug, + flowName: get().flowName, + }); }; // set state from initial load @@ -186,12 +191,17 @@ export const editorStore: StateCreator< localStorage.setItem("clipboard", id); }, - createFlow: async (teamId, newSlug) => { + createFlow: async (teamId, newSlug, newName) => { let response = (await client.mutate({ mutation: gql` - mutation CreateFlow($data: jsonb, $slug: String, $teamId: Int) { + mutation CreateFlow( + $data: jsonb + $slug: String + $teamId: Int + $name: String + ) { insert_flows_one( - object: { slug: $slug, team_id: $teamId, version: 1 } + object: { slug: $slug, team_id: $teamId, version: 1, name: $name } ) { id data @@ -199,6 +209,7 @@ export const editorStore: StateCreator< } `, variables: { + name: newName, slug: newSlug, teamId, }, @@ -274,6 +285,7 @@ export const editorStore: StateCreator< query GetFlow($teamId: Int!) { flows(where: { team: { id: { _eq: $teamId } } }) { id + name slug updatedAt: updated_at operations(limit: 1, order_by: { created_at: desc }) { diff --git a/editor.planx.uk/src/pages/FlowEditor/lib/store/shared.ts b/editor.planx.uk/src/pages/FlowEditor/lib/store/shared.ts index 3b4381a463..ff71086a35 100644 --- a/editor.planx.uk/src/pages/FlowEditor/lib/store/shared.ts +++ b/editor.planx.uk/src/pages/FlowEditor/lib/store/shared.ts @@ -24,18 +24,20 @@ export interface SharedStore extends Store.Store { id, flow, flowSlug, + flowName, flowStatus, }: { - id: string; - flow: Store.flow; - flowSlug: string; + id?: string; + flow?: Store.flow; + flowSlug?: string; + flowName?: string; flowStatus?: FlowStatus; }) => void; wasVisited: (id: Store.nodeId) => boolean; previewEnvironment: PreviewEnvironment; setPreviewEnvironment: (previewEnvironment: PreviewEnvironment) => void; setFlowSlug: (flowSlug: string) => void; - setFlowNameFromSlug: (flowSlug: string) => void; + setFlowName: (flowName: string) => void; $public: (auth?: Auth) => CoreDomainClient; $client: CoreDomainClient; } @@ -91,9 +93,8 @@ export const sharedStore: StateCreator< removeSessionIdSearchParam(); }, - setFlow({ id, flow, flowSlug, flowStatus }) { - this.setFlowNameFromSlug(flowSlug); - set({ id, flow, flowSlug, flowStatus }); + setFlow({ id, flow, flowSlug, flowName, flowStatus }) { + set({ id, flow, flowSlug, flowName, flowStatus }); get().initNavigationStore(); }, @@ -110,8 +111,7 @@ export const sharedStore: StateCreator< set({ flowSlug }); }, - setFlowNameFromSlug(flowSlug) { - const flowName = capitalize(flowSlug.replaceAll?.("-", " ")); + setFlowName(flowName) { set({ flowName }); }, diff --git a/editor.planx.uk/src/pages/Team.tsx b/editor.planx.uk/src/pages/Team.tsx index 0de4b82836..d530c235f8 100644 --- a/editor.planx.uk/src/pages/Team.tsx +++ b/editor.planx.uk/src/pages/Team.tsx @@ -193,7 +193,7 @@ const FlowItem: React.FC = ({ - {flow.slug} + {flow.name} {formatLastEditMessage( @@ -207,21 +207,23 @@ const FlowItem: React.FC = ({ items={[ { onClick: async () => { - const newSlug = prompt("New name", flow.slug); - if (newSlug && slugify(newSlug) !== flow.slug) { + const newName = prompt("New name", flow.name); + if (newName && newName !== flow.name) { + const newSlug = slugify(newName); await client.mutate({ mutation: gql` mutation UpdateFlowSlug( $teamId: Int $slug: String $newSlug: String + $newName: String ) { update_flows( where: { team: { id: { _eq: $teamId } } slug: { _eq: $slug } } - _set: { slug: $newSlug } + _set: { slug: $newSlug, name: $newName } ) { affected_rows } @@ -230,7 +232,8 @@ const FlowItem: React.FC = ({ variables: { teamId: teamId, slug: flow.slug, - newSlug: slugify(newSlug), + newSlug: newSlug, + newName: newName, }, }); @@ -328,7 +331,7 @@ const Team: React.FC = () => { const newFlowSlug = slugify(newFlowName); useStore .getState() - .createFlow(teamId, newFlowSlug) + .createFlow(teamId, newFlowSlug, newFlowName) .then((newId: string) => { navigation.navigate(`/${slug}/${newId}`); }); diff --git a/editor.planx.uk/src/routes/team.tsx b/editor.planx.uk/src/routes/team.tsx index 60e68060f2..2d956b14a6 100644 --- a/editor.planx.uk/src/routes/team.tsx +++ b/editor.planx.uk/src/routes/team.tsx @@ -1,5 +1,15 @@ +import { FlowGraph } from "@opensystemslab/planx-core/types"; +import axios from "axios"; import gql from "graphql-tag"; -import { compose, lazy, mount, route, withData, withView } from "navi"; +import { + compose, + lazy, + mount, + NotFoundError, + route, + withData, + withView, +} from "navi"; import React from "react"; import { client } from "../lib/graphql"; @@ -50,6 +60,7 @@ const routes = compose( } ) { id + name } } `, @@ -65,6 +76,7 @@ const routes = compose( }); } + useStore.getState().setFlowName(flow.name); useStore.getState().setFlowSlug(slug); await useStore.getState().connectTo(flow.id); } diff --git a/editor.planx.uk/src/routes/views/draft.tsx b/editor.planx.uk/src/routes/views/draft.tsx index d5b85c679c..5860824a5f 100644 --- a/editor.planx.uk/src/routes/views/draft.tsx +++ b/editor.planx.uk/src/routes/views/draft.tsx @@ -32,8 +32,7 @@ export const draftView = async (req: NaviRequest) => { const flowData = await fetchDraftFlattenedFlowData(flow.id); const state = useStore.getState(); - state.setFlow({ id: flow.id, flow: flowData, flowSlug }); - state.setFlowNameFromSlug(flowSlug); + state.setFlow({ id: flow.id, flow: flowData, flowSlug, flowName: flow.name }); state.setGlobalSettings(data.globalSettings[0]); state.setFlowSettings(flow.settings); state.setTeam(flow.team); @@ -80,6 +79,7 @@ const fetchSettingsForDraftView = async ( } settings slug + name } globalSettings: global_settings { footerContent: footer_content diff --git a/editor.planx.uk/src/routes/views/preview.tsx b/editor.planx.uk/src/routes/views/preview.tsx index 0cedf9545a..49346eb542 100644 --- a/editor.planx.uk/src/routes/views/preview.tsx +++ b/editor.planx.uk/src/routes/views/preview.tsx @@ -28,8 +28,12 @@ export const previewView = async (req: NaviRequest) => { const flowData = await fetchFlattenedFlowData(flow.id); const state = useStore.getState(); - state.setFlow({ id: flow.id, flow: flowData, flowSlug }); - state.setFlowNameFromSlug(flowSlug); + state.setFlow({ + id: flow.id, + flow: flowData, + flowSlug, + flowName: flow.name, + }); state.setGlobalSettings(data.globalSettings[0]); state.setFlowSettings(flow.settings); state.setTeam(flow.team); diff --git a/editor.planx.uk/src/routes/views/published.tsx b/editor.planx.uk/src/routes/views/published.tsx index 5f2b26e470..9570675577 100644 --- a/editor.planx.uk/src/routes/views/published.tsx +++ b/editor.planx.uk/src/routes/views/published.tsx @@ -49,6 +49,7 @@ export const publishedView = async (req: NaviRequest) => { flow: publishedFlow, flowSlug, flowStatus: flow.status, + flowName: flow.name, }); state.setGlobalSettings(data.globalSettings[0]); state.setFlowSettings(flow.settings); @@ -84,6 +85,7 @@ export const fetchSettingsForPublishedView = async ( } ) { id + name team { theme { primaryColour: primary_colour diff --git a/editor.planx.uk/src/routes/views/standalone.tsx b/editor.planx.uk/src/routes/views/standalone.tsx index 75d17bdcdb..5212c41b38 100644 --- a/editor.planx.uk/src/routes/views/standalone.tsx +++ b/editor.planx.uk/src/routes/views/standalone.tsx @@ -11,7 +11,7 @@ import { Flow, GlobalSettings } from "types"; import { getTeamFromDomain } from "../utils"; interface StandaloneViewData { - flows: Pick[]; + flows: Pick[]; globalSettings: GlobalSettings[]; } @@ -24,14 +24,12 @@ const standaloneView = async (req: NaviRequest) => { const teamSlug = req.params.team || (await getTeamFromDomain(window.location.hostname)); const data = await fetchDataForStandaloneView(flowSlug, teamSlug); - const { - flows: [{ team, settings: flowSettings }], + flows: [{ name, team, settings: flowSettings }], globalSettings, } = data; - const state = useStore.getState(); - state.setFlowNameFromSlug(flowSlug); + state.setFlowName(data.flows[0].name); state.setGlobalSettings(globalSettings[0]); state.setFlowSettings(flowSettings); state.setTeam(team); @@ -61,6 +59,7 @@ const fetchDataForStandaloneView = async ( } ) { id + name team { theme { primaryColour: primary_colour diff --git a/editor.planx.uk/src/types.ts b/editor.planx.uk/src/types.ts index ccb534ba1e..9a129e442e 100644 --- a/editor.planx.uk/src/types.ts +++ b/editor.planx.uk/src/types.ts @@ -17,6 +17,7 @@ export type FormikHookReturn = ReturnType; export interface Flow { id: string; slug: string; + name: string; team: Team; settings?: FlowSettings; status?: FlowStatus;