Skip to content

Commit

Permalink
chore: Drop GOVPAY_METADATA feature flag
Browse files Browse the repository at this point in the history
  • Loading branch information
DafyddLlyr committed Mar 26, 2024
1 parent 99f77af commit 6fd810a
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 76 deletions.
3 changes: 0 additions & 3 deletions editor.planx.uk/src/@planx/components/Pay/Editor.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ describe("Pay component - Editor Modal", () => {
describe("GOV.UK Pay Metadata section", () => {
jest.setTimeout(20000);

beforeAll(() => toggleFeatureFlag("GOVPAY_METADATA"));
afterAll(() => toggleFeatureFlag("GOVPAY_METADATA"));

// Set up mock state with platformAdmin user so all Editor features are enabled
const { getState, setState } = vanillaStore;
const mockUser: User = {
Expand Down
140 changes: 68 additions & 72 deletions editor.planx.uk/src/@planx/components/Pay/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
MoreInformation,
} from "@planx/components/ui";
import { Form, Formik, useFormikContext } from "formik";
import { hasFeatureFlag } from "lib/featureFlags";
import { useStore } from "pages/FlowEditor/lib/store";
import React from "react";
import ListManager, {
Expand Down Expand Up @@ -132,7 +131,6 @@ export type Props = EditorProps<TYPES.Pay, Pay>;

const Component: React.FC<Props> = (props: Props) => {
const [flowName] = useStore((store) => [store.flowName]);
const displayGovPayMetadataSection = hasFeatureFlag("GOVPAY_METADATA");

const initialValues: Pay = {
title: props.node?.data?.title || "Pay for your application",
Expand Down Expand Up @@ -269,79 +267,77 @@ const Component: React.FC<Props> = (props: Props) => {
Hide the pay buttons and show fee for information only
</OptionButton>
</ModalSection>
{displayGovPayMetadataSection && (
<ModalSection>
<ModalSectionContent
title="GOV.UK Pay Metadata"
Icon={DataObjectIcon}
<ModalSection>
<ModalSectionContent
title="GOV.UK Pay Metadata"
Icon={DataObjectIcon}
>
<Typography variant="subtitle2" sx={{ mb: 2 }}>
Include metadata alongside payments, such as VAT codes, cost
centers, or ledger codes. See{" "}
<Link
href={GOVPAY_DOCS_URL}
target="_blank"
rel="noopener noreferrer"
>
GOV.UK Pay documentation
</Link>{" "}
for more details.
</Typography>
<ErrorWrapper
error={
typeof errors.govPayMetadata === "string" &&
touched.govPayMetadata
? errors.govPayMetadata
: undefined
}
>
<Typography variant="subtitle2" sx={{ mb: 2 }}>
Include metadata alongside payments, such as VAT codes, cost
centers, or ledger codes. See{" "}
<Link
href={GOVPAY_DOCS_URL}
target="_blank"
rel="noopener noreferrer"
<>
<Box
sx={{
width: "100%",
mb: 1,
display: "flex",
justifyContent: "space-evenly",
}}
>
GOV.UK Pay documentation
</Link>{" "}
for more details.
</Typography>
<ErrorWrapper
error={
typeof errors.govPayMetadata === "string" &&
touched.govPayMetadata
? errors.govPayMetadata
: undefined
}
>
<>
<Box
sx={{
width: "100%",
mb: 1,
display: "flex",
justifyContent: "space-evenly",
}}
<Typography
sx={{ width: "100%", ml: 5 }}
variant="subtitle2"
component="label"
id="key-label"
>
<Typography
sx={{ width: "100%", ml: 5 }}
variant="subtitle2"
component="label"
id="key-label"
>
Key
</Typography>
<Typography
sx={{ width: "100%", ml: -5 }}
variant="subtitle2"
component="label"
id="value-label"
>
Value
</Typography>
</Box>
<ListManager
maxItems={10}
disableDragAndDrop
values={values.govPayMetadata || []}
onChange={(metadata) => {
setFieldValue("govPayMetadata", metadata);
}}
Editor={GovPayMetadataEditor}
newValue={() => {
setTouched({});
return { key: "", value: "" };
}}
isFieldDisabled={({ key }, index) =>
isFieldDisabled(key, index)
}
/>
</>
</ErrorWrapper>
</ModalSectionContent>
</ModalSection>
)}
Key
</Typography>
<Typography
sx={{ width: "100%", ml: -5 }}
variant="subtitle2"
component="label"
id="value-label"
>
Value
</Typography>
</Box>
<ListManager
maxItems={10}
disableDragAndDrop
values={values.govPayMetadata || []}
onChange={(metadata) => {
setFieldValue("govPayMetadata", metadata);
}}
Editor={GovPayMetadataEditor}
newValue={() => {
setTouched({});
return { key: "", value: "" };
}}
isFieldDisabled={({ key }, index) =>
isFieldDisabled(key, index)
}
/>
</>
</ErrorWrapper>
</ModalSectionContent>
</ModalSection>
<ModalSection>
<ModalSectionContent title="Invite to Pay" Icon={ICONS[TYPES.Pay]}>
<OptionButton
Expand Down
2 changes: 1 addition & 1 deletion editor.planx.uk/src/lib/featureFlags.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// add/edit/remove feature flags in array below
const AVAILABLE_FEATURE_FLAGS = ["SUBMISSION_VIEW", "GOVPAY_METADATA"] as const;
const AVAILABLE_FEATURE_FLAGS = ["SUBMISSION_VIEW"] as const;

type FeatureFlag = (typeof AVAILABLE_FEATURE_FLAGS)[number];

Expand Down

0 comments on commit 6fd810a

Please sign in to comment.