diff --git a/editor.planx.uk/src/@planx/components/AddressInput/Editor.tsx b/editor.planx.uk/src/@planx/components/AddressInput/Editor.tsx index 7620175b83..d41fc325b6 100644 --- a/editor.planx.uk/src/@planx/components/AddressInput/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/AddressInput/Editor.tsx @@ -1,4 +1,4 @@ -import { TYPES } from "@planx/components/types"; +import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import { EditorProps, ICONS, diff --git a/editor.planx.uk/src/@planx/components/Calculate/Editor.tsx b/editor.planx.uk/src/@planx/components/Calculate/Editor.tsx index b6664bcaca..80821ae57d 100644 --- a/editor.planx.uk/src/@planx/components/Calculate/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/Calculate/Editor.tsx @@ -1,6 +1,6 @@ import { styled } from "@mui/material/styles"; import Typography from "@mui/material/Typography"; -import { TYPES } from "@planx/components/types"; +import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import { EditorProps, ICONS, diff --git a/editor.planx.uk/src/@planx/components/Calculate/logic.test.ts b/editor.planx.uk/src/@planx/components/Calculate/logic.test.ts index e2d4427c38..6d27065ed8 100644 --- a/editor.planx.uk/src/@planx/components/Calculate/logic.test.ts +++ b/editor.planx.uk/src/@planx/components/Calculate/logic.test.ts @@ -1,8 +1,8 @@ -import { TYPES } from "@planx/components/types"; +import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import { Store, vanillaStore } from "pages/FlowEditor/lib/store"; const { getState, setState } = vanillaStore; -const { upcomingCardIds, resetPreview, record, currentCard } = getState(); +const { upcomingCardIds, resetPreview, record } = getState(); // Helper method const visitedNodes = () => Object.keys(getState().breadcrumbs); @@ -74,7 +74,7 @@ const flowWithAutomation: Store.flow = { val: "1", text: "1", }, - type: TYPES.Response, + type: TYPES.Answer, edges: ["Group1Notice"], }, Question: { @@ -82,7 +82,7 @@ const flowWithAutomation: Store.flow = { fn: "testGroup", text: "Which test group? ", }, - type: TYPES.Statement, + type: TYPES.Question, edges: ["Group1Response", "Group2Response"], }, Group2Response: { @@ -90,7 +90,7 @@ const flowWithAutomation: Store.flow = { val: "2", text: "2", }, - type: TYPES.Response, + type: TYPES.Answer, edges: ["Group2Notice"], }, }; @@ -128,7 +128,7 @@ const flowWithoutAutomation: Store.flow = { val: "1", text: "1", }, - type: TYPES.Response, + type: TYPES.Answer, edges: ["Group1Notice"], }, Question: { @@ -136,7 +136,7 @@ const flowWithoutAutomation: Store.flow = { fn: "testGroup", text: "Which test group? ", }, - type: TYPES.Statement, + type: TYPES.Question, edges: ["Group1Response", "Group2Response"], }, Group2Response: { @@ -144,7 +144,7 @@ const flowWithoutAutomation: Store.flow = { val: "2", text: "2", }, - type: TYPES.Response, + type: TYPES.Answer, edges: ["Group2Notice"], }, }; diff --git a/editor.planx.uk/src/@planx/components/Checklist/Editor.tsx b/editor.planx.uk/src/@planx/components/Checklist/Editor.tsx index 1931f8463c..f33aa5ac4d 100644 --- a/editor.planx.uk/src/@planx/components/Checklist/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/Checklist/Editor.tsx @@ -2,6 +2,7 @@ import Delete from "@mui/icons-material/Delete"; import Box from "@mui/material/Box"; import Button from "@mui/material/Button"; import IconButton from "@mui/material/IconButton"; +import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import { useFormik } from "formik"; import adjust from "ramda/src/adjust"; import compose from "ramda/src/compose"; @@ -22,7 +23,6 @@ import InputRowItem from "ui/shared/InputRowItem"; import { Option, parseMoreInformation } from "../shared"; import PermissionSelect from "../shared/PermissionSelect"; -import { TYPES } from "../types"; import { ICONS, InternalNotes, MoreInformation } from "../ui"; import type { Checklist, Group } from "./model"; import { toggleExpandableChecklist } from "./model"; @@ -319,7 +319,7 @@ export const ChecklistComponent: React.FC = (props) => { .map((o) => ({ ...o, id: o.id || undefined, - type: TYPES.Response, + type: TYPES.Answer, })) : groupedOptions ? groupedOptions @@ -328,7 +328,7 @@ export const ChecklistComponent: React.FC = (props) => { .map((o) => ({ ...o, id: o.id || undefined, - type: TYPES.Response, + type: TYPES.Answer, })) : [], ); diff --git a/editor.planx.uk/src/@planx/components/Confirmation/Editor.tsx b/editor.planx.uk/src/@planx/components/Confirmation/Editor.tsx index e5d58c870a..099361c90f 100644 --- a/editor.planx.uk/src/@planx/components/Confirmation/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/Confirmation/Editor.tsx @@ -1,4 +1,5 @@ import Box from "@mui/material/Box"; +import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import { EditorProps, ICONS } from "@planx/components/ui"; import { useFormik } from "formik"; import React, { ChangeEvent } from "react"; @@ -11,7 +12,6 @@ import RichTextInput from "ui/editor/RichTextInput"; import Input from "ui/shared/Input"; import InputRow from "ui/shared/InputRow"; -import { TYPES } from "../types"; import { Confirmation, parseNextSteps, Step } from "./model"; export type Props = EditorProps; diff --git a/editor.planx.uk/src/@planx/components/ContactInput/Editor.tsx b/editor.planx.uk/src/@planx/components/ContactInput/Editor.tsx index 52108eb439..8bd7a6632c 100644 --- a/editor.planx.uk/src/@planx/components/ContactInput/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/ContactInput/Editor.tsx @@ -1,4 +1,4 @@ -import { TYPES } from "@planx/components/types"; +import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import { EditorProps, ICONS, diff --git a/editor.planx.uk/src/@planx/components/Content/Editor.tsx b/editor.planx.uk/src/@planx/components/Content/Editor.tsx index 58436bdb55..048b380e20 100644 --- a/editor.planx.uk/src/@planx/components/Content/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/Content/Editor.tsx @@ -1,6 +1,6 @@ +import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import type { Content } from "@planx/components/Content/model"; import { parseContent } from "@planx/components/Content/model"; -import { TYPES } from "@planx/components/types"; import { EditorProps, ICONS, diff --git a/editor.planx.uk/src/@planx/components/DateInput/Editor.tsx b/editor.planx.uk/src/@planx/components/DateInput/Editor.tsx index 78c53f8a9c..a0db680f5f 100644 --- a/editor.planx.uk/src/@planx/components/DateInput/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/DateInput/Editor.tsx @@ -1,11 +1,11 @@ import Box from "@mui/material/Box"; +import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import { DateInput, editorValidationSchema, paddedDate, } from "@planx/components/DateInput/model"; import { parseDateInput } from "@planx/components/DateInput/model"; -import { TYPES } from "@planx/components/types"; import { EditorProps, ICONS, diff --git a/editor.planx.uk/src/@planx/components/DrawBoundary/Editor.tsx b/editor.planx.uk/src/@planx/components/DrawBoundary/Editor.tsx index 2ce16c912e..b85054d325 100644 --- a/editor.planx.uk/src/@planx/components/DrawBoundary/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/DrawBoundary/Editor.tsx @@ -1,4 +1,4 @@ -import { TYPES } from "@planx/components/types"; +import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import { EditorProps, ICONS, diff --git a/editor.planx.uk/src/@planx/components/ExternalPortal/Editor.test.tsx b/editor.planx.uk/src/@planx/components/ExternalPortal/Editor.test.tsx index a1b1468ac0..b12b764c9e 100644 --- a/editor.planx.uk/src/@planx/components/ExternalPortal/Editor.test.tsx +++ b/editor.planx.uk/src/@planx/components/ExternalPortal/Editor.test.tsx @@ -1,8 +1,8 @@ +import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import { fireEvent, screen, waitFor } from "@testing-library/react"; import React from "react"; import { setup } from "testUtils"; -import { TYPES } from "../types"; import ExternalPortalForm from "./Editor"; test("adding an external portal", async () => { diff --git a/editor.planx.uk/src/@planx/components/ExternalPortal/Editor.tsx b/editor.planx.uk/src/@planx/components/ExternalPortal/Editor.tsx index 9c7a6d1483..9e8d44e52c 100644 --- a/editor.planx.uk/src/@planx/components/ExternalPortal/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/ExternalPortal/Editor.tsx @@ -1,4 +1,4 @@ -import { TYPES } from "@planx/components/types"; +import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import { useFormik } from "formik"; import React from "react"; import ModalSection from "ui/editor/ModalSection"; diff --git a/editor.planx.uk/src/@planx/components/FileUpload/Editor.tsx b/editor.planx.uk/src/@planx/components/FileUpload/Editor.tsx index 2b94223742..24f915f73d 100644 --- a/editor.planx.uk/src/@planx/components/FileUpload/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/FileUpload/Editor.tsx @@ -1,4 +1,4 @@ -import { TYPES } from "@planx/components/types"; +import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import { ICONS, InternalNotes, MoreInformation } from "@planx/components/ui"; import { useFormik } from "formik"; import React from "react"; diff --git a/editor.planx.uk/src/@planx/components/FileUploadAndLabel/Editor.tsx b/editor.planx.uk/src/@planx/components/FileUploadAndLabel/Editor.tsx index 08850fd666..6f4c3f8a01 100644 --- a/editor.planx.uk/src/@planx/components/FileUploadAndLabel/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/FileUploadAndLabel/Editor.tsx @@ -4,7 +4,7 @@ import Divider from "@mui/material/Divider"; import MenuItem from "@mui/material/MenuItem"; import { styled } from "@mui/material/styles"; import Typography from "@mui/material/Typography"; -import { TYPES } from "@planx/components/types"; +import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import { EditorProps, ICONS, diff --git a/editor.planx.uk/src/@planx/components/Filter/Editor.tsx b/editor.planx.uk/src/@planx/components/Filter/Editor.tsx index eeb83b0f6a..5d2f3f2b03 100644 --- a/editor.planx.uk/src/@planx/components/Filter/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/Filter/Editor.tsx @@ -2,7 +2,7 @@ import { DEFAULT_FLAG_CATEGORY, flatFlags, } from "@opensystemslab/planx-core/types"; -import { TYPES } from "@planx/components/types"; +import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import { useFormik } from "formik"; import React from "react"; @@ -29,7 +29,7 @@ const Filter: React.FC = (props) => { ] .filter((f) => f.category === DEFAULT_FLAG_CATEGORY) .map((f) => ({ - type: TYPES.Response, + type: TYPES.Answer, data: { text: f.text, val: f.value, diff --git a/editor.planx.uk/src/@planx/components/FindProperty/Editor.tsx b/editor.planx.uk/src/@planx/components/FindProperty/Editor.tsx index 5598b4bec4..d9edf981b7 100644 --- a/editor.planx.uk/src/@planx/components/FindProperty/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/FindProperty/Editor.tsx @@ -1,4 +1,4 @@ -import { TYPES } from "@planx/components/types"; +import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import { EditorProps, ICONS, diff --git a/editor.planx.uk/src/@planx/components/InternalPortal/Editor.test.tsx b/editor.planx.uk/src/@planx/components/InternalPortal/Editor.test.tsx index 63249b5fa4..de8b61bd57 100644 --- a/editor.planx.uk/src/@planx/components/InternalPortal/Editor.test.tsx +++ b/editor.planx.uk/src/@planx/components/InternalPortal/Editor.test.tsx @@ -1,8 +1,8 @@ +import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import { fireEvent, screen, waitFor } from "@testing-library/react"; import React from "react"; import { axe, setup } from "testUtils"; -import { TYPES } from "../types"; import InternalPortalForm from "./Editor"; describe("adding an internal portal", () => { diff --git a/editor.planx.uk/src/@planx/components/InternalPortal/Editor.tsx b/editor.planx.uk/src/@planx/components/InternalPortal/Editor.tsx index 966c5658fe..40adb18eab 100644 --- a/editor.planx.uk/src/@planx/components/InternalPortal/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/InternalPortal/Editor.tsx @@ -1,8 +1,8 @@ +import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import { useFormik } from "formik"; import React from "react"; import InputField from "ui/editor/InputField"; -import { TYPES } from "../types"; import { FormError } from "../ui"; interface Flow { diff --git a/editor.planx.uk/src/@planx/components/NextSteps/Editor.tsx b/editor.planx.uk/src/@planx/components/NextSteps/Editor.tsx index 7f32e3f2a4..ebe8b31d59 100644 --- a/editor.planx.uk/src/@planx/components/NextSteps/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/NextSteps/Editor.tsx @@ -1,7 +1,7 @@ import Box from "@mui/material/Box"; +import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import type { NextSteps, Step } from "@planx/components/NextSteps/model"; import { parseNextSteps } from "@planx/components/NextSteps/model"; -import { TYPES } from "@planx/components/types"; import { EditorProps, ICONS, diff --git a/editor.planx.uk/src/@planx/components/Notice/Editor.tsx b/editor.planx.uk/src/@planx/components/Notice/Editor.tsx index 9b2c24322b..b8a8d3ee2e 100644 --- a/editor.planx.uk/src/@planx/components/Notice/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/Notice/Editor.tsx @@ -1,6 +1,6 @@ +import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import type { Notice } from "@planx/components/Notice/model"; import { parseNotice } from "@planx/components/Notice/model"; -import { TYPES } from "@planx/components/types"; import { ICONS, InternalNotes, MoreInformation } from "@planx/components/ui"; import { useFormik } from "formik"; import React from "react"; diff --git a/editor.planx.uk/src/@planx/components/NumberInput/Editor.tsx b/editor.planx.uk/src/@planx/components/NumberInput/Editor.tsx index 066a49a876..f2f960acce 100644 --- a/editor.planx.uk/src/@planx/components/NumberInput/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/NumberInput/Editor.tsx @@ -1,6 +1,6 @@ +import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import type { NumberInput } from "@planx/components/NumberInput/model"; import { parseNumberInput } from "@planx/components/NumberInput/model"; -import { TYPES } from "@planx/components/types"; import { EditorProps, ICONS, diff --git a/editor.planx.uk/src/@planx/components/Pay/Editor.tsx b/editor.planx.uk/src/@planx/components/Pay/Editor.tsx index 6881fce76e..239135624c 100644 --- a/editor.planx.uk/src/@planx/components/Pay/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/Pay/Editor.tsx @@ -1,7 +1,7 @@ import Box from "@mui/material/Box"; +import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import { Pay, validationSchema } from "@planx/components/Pay/model"; import { parseMoreInformation } from "@planx/components/shared"; -import { TYPES } from "@planx/components/types"; import { ICONS, InternalNotes, MoreInformation } from "@planx/components/ui"; import { useFormik } from "formik"; import React from "react"; diff --git a/editor.planx.uk/src/@planx/components/Pay/Public/Pay.test.tsx b/editor.planx.uk/src/@planx/components/Pay/Public/Pay.test.tsx index df133bf213..b9762918e8 100644 --- a/editor.planx.uk/src/@planx/components/Pay/Public/Pay.test.tsx +++ b/editor.planx.uk/src/@planx/components/Pay/Public/Pay.test.tsx @@ -1,5 +1,5 @@ import { PaymentStatus } from "@opensystemslab/planx-core/types"; -import { TYPES } from "@planx/components/types"; +import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import { screen } from "@testing-library/react"; import { FullStore, Store, vanillaStore } from "pages/FlowEditor/lib/store"; import React from "react"; diff --git a/editor.planx.uk/src/@planx/components/PlanningConstraints/Editor.tsx b/editor.planx.uk/src/@planx/components/PlanningConstraints/Editor.tsx index 02029f382b..59f2584d05 100644 --- a/editor.planx.uk/src/@planx/components/PlanningConstraints/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/PlanningConstraints/Editor.tsx @@ -1,4 +1,4 @@ -import { TYPES } from "@planx/components/types"; +import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import { EditorProps, ICONS, InternalNotes } from "@planx/components/ui"; import { useFormik } from "formik"; import React from "react"; diff --git a/editor.planx.uk/src/@planx/components/PropertyInformation/Editor.tsx b/editor.planx.uk/src/@planx/components/PropertyInformation/Editor.tsx index e8c0fa88b7..e35fe88c36 100644 --- a/editor.planx.uk/src/@planx/components/PropertyInformation/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/PropertyInformation/Editor.tsx @@ -1,4 +1,4 @@ -import { TYPES } from "@planx/components/types"; +import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import { EditorProps, ICONS, diff --git a/editor.planx.uk/src/@planx/components/Question/Editor.tsx b/editor.planx.uk/src/@planx/components/Question/Editor.tsx index b70bb5b299..c92e0aaf55 100644 --- a/editor.planx.uk/src/@planx/components/Question/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/Question/Editor.tsx @@ -1,3 +1,4 @@ +import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import { useFormik } from "formik"; import React, { useEffect, useRef } from "react"; import ImgInput from "ui/editor/ImgInput"; @@ -12,7 +13,6 @@ import InputRowItem from "ui/shared/InputRowItem"; import { Option, parseMoreInformation } from "../shared"; import PermissionSelect from "../shared/PermissionSelect"; -import { TYPES } from "../types"; import { ICONS, InternalNotes, MoreInformation } from "../ui"; interface Props { @@ -126,7 +126,7 @@ const OptionEditor: React.FC<{ ); export const Question: React.FC = (props) => { - const type = TYPES.Statement; + const type = TYPES.Question; const formik = useFormik({ initialValues: { @@ -142,7 +142,7 @@ export const Question: React.FC = (props) => { .filter((o) => o.data.text) .map((o) => ({ id: o.id || undefined, - type: TYPES.Response, + type: TYPES.Answer, data: o.data, })); diff --git a/editor.planx.uk/src/@planx/components/Result/Editor.tsx b/editor.planx.uk/src/@planx/components/Result/Editor.tsx index 0ab4a04994..da1006eb2a 100644 --- a/editor.planx.uk/src/@planx/components/Result/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/Result/Editor.tsx @@ -2,6 +2,7 @@ import Box from "@mui/material/Box"; import Collapse from "@mui/material/Collapse"; import Typography from "@mui/material/Typography"; import { Flag, FlagSet, flatFlags } from "@opensystemslab/planx-core/types"; +import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import { useFormik } from "formik"; import groupBy from "lodash/groupBy"; import React, { useState } from "react"; @@ -10,7 +11,6 @@ import ModalSectionContent from "ui/editor/ModalSectionContent"; import Input from "ui/shared/Input"; import InputRow from "ui/shared/InputRow"; -import { TYPES } from "../types"; import { ICONS } from "../ui"; import type { Result } from "./model"; diff --git a/editor.planx.uk/src/@planx/components/Review/Editor.tsx b/editor.planx.uk/src/@planx/components/Review/Editor.tsx index 3ebeda3d69..38cec10acd 100644 --- a/editor.planx.uk/src/@planx/components/Review/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/Review/Editor.tsx @@ -1,3 +1,4 @@ +import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import { useFormik } from "formik"; import React from "react"; import ModalSection from "ui/editor/ModalSection"; @@ -6,7 +7,6 @@ import RichTextInput from "ui/editor/RichTextInput"; import Input from "ui/shared/Input"; import InputRow from "ui/shared/InputRow"; -import { TYPES } from "../types"; import { EditorProps, ICONS, InternalNotes } from "../ui"; import { parseContent, Review } from "./model"; diff --git a/editor.planx.uk/src/@planx/components/Section/Editor.tsx b/editor.planx.uk/src/@planx/components/Section/Editor.tsx index 9948271441..84294365dc 100644 --- a/editor.planx.uk/src/@planx/components/Section/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/Section/Editor.tsx @@ -1,4 +1,4 @@ -import { TYPES } from "@planx/components/types"; +import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import { EditorProps, ICONS, InternalNotes } from "@planx/components/ui"; import { useFormik } from "formik"; import React from "react"; diff --git a/editor.planx.uk/src/@planx/components/Section/Section.stories.tsx b/editor.planx.uk/src/@planx/components/Section/Section.stories.tsx index 0195e40443..1ca25dabd0 100644 --- a/editor.planx.uk/src/@planx/components/Section/Section.stories.tsx +++ b/editor.planx.uk/src/@planx/components/Section/Section.stories.tsx @@ -1,8 +1,8 @@ +import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import { Meta, StoryObj } from "@storybook/react"; import { ComponentProps } from "react"; import { SectionNode } from "types"; -import { TYPES } from "../types"; import { Root as Public } from "./Public"; const meta = { diff --git a/editor.planx.uk/src/@planx/components/Section/model.test.ts b/editor.planx.uk/src/@planx/components/Section/model.test.ts index cd08eb7f0e..03fbde13fd 100644 --- a/editor.planx.uk/src/@planx/components/Section/model.test.ts +++ b/editor.planx.uk/src/@planx/components/Section/model.test.ts @@ -1,4 +1,4 @@ -import { TYPES } from "@planx/components/types"; +import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import { SectionNode, SectionStatus } from "types"; import { computeSectionStatuses } from "./model"; diff --git a/editor.planx.uk/src/@planx/components/Send/Editor.tsx b/editor.planx.uk/src/@planx/components/Send/Editor.tsx index 188a637bc6..b9e26605f1 100644 --- a/editor.planx.uk/src/@planx/components/Send/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/Send/Editor.tsx @@ -2,6 +2,7 @@ import Warning from "@mui/icons-material/Warning"; import Box from "@mui/material/Box"; import Grid from "@mui/material/Grid"; import Typography from "@mui/material/Typography"; +import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import { getIn, useFormik } from "formik"; import React from "react"; import ModalSection from "ui/editor/ModalSection"; @@ -12,7 +13,6 @@ import Input from "ui/shared/Input"; import InputRow from "ui/shared/InputRow"; import { array, object } from "yup"; -import { TYPES } from "../types"; import { EditorProps, ICONS } from "../ui"; import { Destination, Send } from "./model"; import { parseContent } from "./model"; diff --git a/editor.planx.uk/src/@planx/components/Send/bops/index.ts b/editor.planx.uk/src/@planx/components/Send/bops/index.ts index 2c479979f5..415e06773c 100644 --- a/editor.planx.uk/src/@planx/components/Send/bops/index.ts +++ b/editor.planx.uk/src/@planx/components/Send/bops/index.ts @@ -9,6 +9,7 @@ import { GOV_PAY_PASSPORT_KEY, GovUKPayment, } from "@opensystemslab/planx-core/types"; +import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import { logger } from "airbrake"; import { isEmpty } from "lodash"; import { useStore } from "pages/FlowEditor/lib/store"; @@ -18,7 +19,6 @@ import striptags from "striptags"; import { Store } from "../../../../pages/FlowEditor/lib/store"; import { toPence } from "../../Pay/model"; import { removeNilValues } from "../../shared/utils"; -import { TYPES } from "../../types"; import { findGeoJSON } from "../helpers"; import { BOPSFullPayload, @@ -69,7 +69,7 @@ function isTypeForBopsPayload(type?: TYPES) { case TYPES.Pay: case TYPES.PlanningConstraints: case TYPES.PropertyInformation: - case TYPES.Response: + case TYPES.Answer: case TYPES.Result: case TYPES.Review: case TYPES.Section: @@ -82,7 +82,7 @@ function isTypeForBopsPayload(type?: TYPES) { case TYPES.Checklist: case TYPES.DateInput: case TYPES.NumberInput: - case TYPES.Statement: + case TYPES.Question: case TYPES.TextInput: case TYPES.ContactInput: return true; @@ -193,7 +193,7 @@ export const makePayload = ( case TYPES.TextInput: return Object.values(bc.data ?? {}).map((x) => String(x)); case TYPES.Checklist: - case TYPES.Statement: + case TYPES.Question: default: return bc.answers ?? []; } diff --git a/editor.planx.uk/src/@planx/components/Send/helpers.test.ts b/editor.planx.uk/src/@planx/components/Send/helpers.test.ts index e07debecf4..baa5629792 100644 --- a/editor.planx.uk/src/@planx/components/Send/helpers.test.ts +++ b/editor.planx.uk/src/@planx/components/Send/helpers.test.ts @@ -1,4 +1,4 @@ -import { TYPES } from "@planx/components/types"; +import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import { Store } from "pages/FlowEditor/lib/store"; import { findGeoJSON } from "./helpers"; diff --git a/editor.planx.uk/src/@planx/components/Send/helpers.ts b/editor.planx.uk/src/@planx/components/Send/helpers.ts index dc180fa9f8..3749bd8714 100644 --- a/editor.planx.uk/src/@planx/components/Send/helpers.ts +++ b/editor.planx.uk/src/@planx/components/Send/helpers.ts @@ -1,4 +1,4 @@ -import { TYPES } from "@planx/components/types"; +import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import { Store } from "pages/FlowEditor/lib/store"; export function findGeoJSON( diff --git a/editor.planx.uk/src/@planx/components/SetValue/Editor.tsx b/editor.planx.uk/src/@planx/components/SetValue/Editor.tsx index 48484e147c..766d094b39 100644 --- a/editor.planx.uk/src/@planx/components/SetValue/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/SetValue/Editor.tsx @@ -1,4 +1,4 @@ -import { TYPES } from "@planx/components/types"; +import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import { EditorProps, InternalNotes } from "@planx/components/ui"; import { useFormik } from "formik"; import React from "react"; diff --git a/editor.planx.uk/src/@planx/components/TaskList/Editor.tsx b/editor.planx.uk/src/@planx/components/TaskList/Editor.tsx index 5e08168a89..f869005888 100644 --- a/editor.planx.uk/src/@planx/components/TaskList/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/TaskList/Editor.tsx @@ -1,7 +1,7 @@ import Box from "@mui/material/Box"; +import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import type { Task, TaskList } from "@planx/components/TaskList/model"; import { parseTaskList } from "@planx/components/TaskList/model"; -import { TYPES } from "@planx/components/types"; import { EditorProps, ICONS, diff --git a/editor.planx.uk/src/@planx/components/TextInput/Editor.tsx b/editor.planx.uk/src/@planx/components/TextInput/Editor.tsx index d5e0ac39f0..e5a36631de 100644 --- a/editor.planx.uk/src/@planx/components/TextInput/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/TextInput/Editor.tsx @@ -1,4 +1,4 @@ -import { TYPES } from "@planx/components/types"; +import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import { EditorProps, ICONS, diff --git a/editor.planx.uk/src/@planx/components/shared/Preview/SummaryList.tsx b/editor.planx.uk/src/@planx/components/shared/Preview/SummaryList.tsx index e5a20bd827..12acb8cf6e 100644 --- a/editor.planx.uk/src/@planx/components/shared/Preview/SummaryList.tsx +++ b/editor.planx.uk/src/@planx/components/shared/Preview/SummaryList.tsx @@ -3,8 +3,8 @@ import Link from "@mui/material/Link"; import { styled } from "@mui/material/styles"; import Typography from "@mui/material/Typography"; import { visuallyHidden } from "@mui/utils"; +import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import { PASSPORT_UPLOAD_KEY } from "@planx/components/DrawBoundary/model"; -import { TYPES } from "@planx/components/types"; import format from "date-fns/format"; import { useAnalyticsTracking } from "pages/FlowEditor/lib/analyticsProvider"; import { Store, useStore } from "pages/FlowEditor/lib/store"; @@ -71,13 +71,13 @@ const presentationalComponents: { [TYPES.Pay]: undefined, [TYPES.PlanningConstraints]: undefined, [TYPES.PropertyInformation]: undefined, - [TYPES.Response]: Debug, + [TYPES.Answer]: Debug, [TYPES.Result]: undefined, [TYPES.Review]: undefined, [TYPES.Section]: undefined, [TYPES.Send]: undefined, [TYPES.SetValue]: undefined, - [TYPES.Statement]: Question, + [TYPES.Question]: Question, [TYPES.TaskList]: undefined, [TYPES.TextInput]: TextInput, } as const; diff --git a/editor.planx.uk/src/@planx/components/types.ts b/editor.planx.uk/src/@planx/components/types.ts deleted file mode 100644 index 6ad41564d4..0000000000 --- a/editor.planx.uk/src/@planx/components/types.ts +++ /dev/null @@ -1,33 +0,0 @@ -export enum TYPES { - Flow = 1, - Result = 3, - TaskList = 7, - Notice = 8, - FindProperty = 9, - DrawBoundary = 10, - PlanningConstraints = 11, - PropertyInformation = 12, - Statement = 100, // Question/DropDown - Checklist = 105, - TextInput = 110, - DateInput = 120, - AddressInput = 130, - ContactInput = 135, - FileUpload = 140, - FileUploadAndLabel = 145, - NumberInput = 150, - Response = 200, - Content = 250, - InternalPortal = 300, - ExternalPortal = 310, - // Page = 350, - Section = 360, - SetValue = 380, - Pay = 400, - Filter = 500, - Review = 600, - Send = 650, - Calculate = 700, - Confirmation = 725, - NextSteps = 730, -} diff --git a/editor.planx.uk/src/@planx/components/ui.tsx b/editor.planx.uk/src/@planx/components/ui.tsx index 0ae728dde4..8996f8e15a 100644 --- a/editor.planx.uk/src/@planx/components/ui.tsx +++ b/editor.planx.uk/src/@planx/components/ui.tsx @@ -24,7 +24,7 @@ import Send from "@mui/icons-material/Send"; import SquareFoot from "@mui/icons-material/SquareFoot"; import TextFields from "@mui/icons-material/TextFields"; import ViewAgenda from "@mui/icons-material/ViewAgenda"; -import { TYPES } from "@planx/components/types"; +import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import { Store } from "pages/FlowEditor/lib/store"; import type { handleSubmit } from "pages/Preview/Node"; import React, { ChangeEvent } from "react"; @@ -78,13 +78,13 @@ export const ICONS: { [TYPES.Pay]: PaymentOutlined, [TYPES.PlanningConstraints]: Map, [TYPES.PropertyInformation]: LocationOnOutlined, - [TYPES.Response]: undefined, + [TYPES.Answer]: undefined, [TYPES.Result]: PlaylistAddCheck, [TYPES.Review]: RateReview, [TYPES.Section]: ViewAgenda, [TYPES.Send]: Send, [TYPES.SetValue]: PlaylistAdd, - [TYPES.Statement]: CallSplit, + [TYPES.Question]: CallSplit, [TYPES.TaskList]: List, [TYPES.TextInput]: Create, } as const; diff --git a/editor.planx.uk/src/@planx/graph/index.ts b/editor.planx.uk/src/@planx/graph/index.ts index a45bc780b6..4eb69594ad 100644 --- a/editor.planx.uk/src/@planx/graph/index.ts +++ b/editor.planx.uk/src/@planx/graph/index.ts @@ -1,4 +1,4 @@ -import { TYPES } from "@planx/components/types"; +import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import { enablePatches, produceWithPatches } from "immer"; import { isEqual } from "lodash"; import difference from "lodash/difference"; diff --git a/editor.planx.uk/src/components/Header.tsx b/editor.planx.uk/src/components/Header.tsx index 4a45b0425b..b2989e3364 100644 --- a/editor.planx.uk/src/components/Header.tsx +++ b/editor.planx.uk/src/components/Header.tsx @@ -18,7 +18,7 @@ import { styled, Theme } from "@mui/material/styles"; import MuiToolbar from "@mui/material/Toolbar"; import Typography from "@mui/material/Typography"; import useMediaQuery from "@mui/material/useMediaQuery"; -import { TYPES } from "@planx/components/types"; +import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import { hasFeatureFlag } from "lib/featureFlags"; import { clearLocalFlow } from "lib/local"; import { capitalize } from "lodash"; @@ -415,14 +415,12 @@ const EditorToolbar: React.FC<{ setOpen(!open); }; - const isFlowSettingsVisible = - route.data.flow && canUserEditTeam(team.slug); + const isFlowSettingsVisible = route.data.flow && canUserEditTeam(team.slug); const isTeamSettingsVisible = route.data.team && !route.data.flow && canUserEditTeam(team.slug); - const isGlobalSettingsVisible = - !route.data.team && user?.isPlatformAdmin; + const isGlobalSettingsVisible = !route.data.team && user?.isPlatformAdmin; return ( <> diff --git a/editor.planx.uk/src/lib/dataMergedHotfix.ts b/editor.planx.uk/src/lib/dataMergedHotfix.ts index 48228f173c..ad5c60e1a8 100644 --- a/editor.planx.uk/src/lib/dataMergedHotfix.ts +++ b/editor.planx.uk/src/lib/dataMergedHotfix.ts @@ -1,4 +1,4 @@ -import { TYPES } from "@planx/components/types"; +import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import gql from "graphql-tag"; import { publicClient } from "../lib/graphql"; diff --git a/editor.planx.uk/src/lib/feedback.ts b/editor.planx.uk/src/lib/feedback.ts index b90bd96e5e..4f724ce036 100644 --- a/editor.planx.uk/src/lib/feedback.ts +++ b/editor.planx.uk/src/lib/feedback.ts @@ -1,5 +1,5 @@ import { gql } from "@apollo/client"; -import { TYPES } from "@planx/components/types"; +import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import Bowser from "bowser"; import { Store, useStore } from "pages/FlowEditor/lib/store"; diff --git a/editor.planx.uk/src/pages/FlowEditor/components/Flow/components/Checklist.tsx b/editor.planx.uk/src/pages/FlowEditor/components/Flow/components/Checklist.tsx index 639c2266e2..bb60498034 100644 --- a/editor.planx.uk/src/pages/FlowEditor/components/Flow/components/Checklist.tsx +++ b/editor.planx.uk/src/pages/FlowEditor/components/Flow/components/Checklist.tsx @@ -1,4 +1,4 @@ -import { TYPES } from "@planx/components/types"; +import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import { ICONS } from "@planx/components/ui"; import classNames from "classnames"; import mapAccum from "ramda/src/mapAccum"; diff --git a/editor.planx.uk/src/pages/FlowEditor/components/Flow/components/Filter.tsx b/editor.planx.uk/src/pages/FlowEditor/components/Flow/components/Filter.tsx index 90e0183c31..9103188b5f 100644 --- a/editor.planx.uk/src/pages/FlowEditor/components/Flow/components/Filter.tsx +++ b/editor.planx.uk/src/pages/FlowEditor/components/Flow/components/Filter.tsx @@ -1,4 +1,4 @@ -import { TYPES } from "@planx/components/types"; +import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import { ICONS } from "@planx/components/ui"; import classNames from "classnames"; import React from "react"; diff --git a/editor.planx.uk/src/pages/FlowEditor/components/Flow/components/Node.tsx b/editor.planx.uk/src/pages/FlowEditor/components/Flow/components/Node.tsx index 3165540ad9..1bc1094455 100644 --- a/editor.planx.uk/src/pages/FlowEditor/components/Flow/components/Node.tsx +++ b/editor.planx.uk/src/pages/FlowEditor/components/Flow/components/Node.tsx @@ -1,4 +1,4 @@ -import { TYPES } from "@planx/components/types"; +import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import React from "react"; import { ErrorBoundary } from "react-error-boundary"; @@ -122,9 +122,9 @@ const Node: React.FC = (props) => { ); - case TYPES.Response: + case TYPES.Answer: return