Skip to content

Commit

Permalink
fix: use email as default destination for new Send components and add…
Browse files Browse the repository at this point in the history
… warnings when selecting BOPS or Uniform (#2659)
  • Loading branch information
jessicamcinchak authored Jan 12, 2024
1 parent e840e7d commit 76c03c3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
25 changes: 21 additions & 4 deletions editor.planx.uk/src/@planx/components/Send/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,25 @@ const SendComponent: React.FC<Props> = (props) => {
return originalValues.indexOf(a) - originalValues.indexOf(b);
}),
);

// Show warnings on selection of BOPS or Uniform for likely unsupported services
// Don't actually restrict selection because flowSlug matching is imperfect for some valid test cases
const flowSlug = window.location.pathname?.split("/")?.[1];
if (
value === Destination.BOPS &&
newCheckedValues.includes(value) &&
!["apply-for-a-lawful-development-certificate", "apply-for-prior-approval", "apply-for-planning-permission"].includes(flowSlug)
) {
alert("BOPS only accepts Lawful Development Certificate, Prior Approval, and Planning Permission submissions. Please do not select if you're building another type of submission service!");
}

if (
value === Destination.Uniform &&
newCheckedValues.includes(value) &&
flowSlug !== "apply-for-a-lawful-development-certificate"
) {
alert("Uniform only accepts Lawful Development Certificate submissions. Please do not select if you're building another type of submission service!");
}
};

return (
Expand Down Expand Up @@ -109,10 +128,8 @@ const SendComponent: React.FC<Props> = (props) => {
<Box display="flex" mt={2}>
<Warning titleAccess="Warning" color="primary" fontSize="large" />
<Typography variant="body2" ml={1}>
API tokens are required to submit successfully to the selected
destinations. Check in with PlanX developers before launching your
service to make sure that tokens are available and configured for
your environment.
API tokens may be required to submit successfully. Check in with PlanX developers before launching your
service to make sure that submissions are configured for your environment.
</Typography>
</Box>
</ModalSectionContent>
Expand Down
2 changes: 1 addition & 1 deletion editor.planx.uk/src/@planx/components/Send/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export interface Send extends MoreInformation {
}

export const DEFAULT_TITLE = "Send";
export const DEFAULT_DESTINATION = Destination.BOPS;
export const DEFAULT_DESTINATION = Destination.Email;

export const parseContent = (data: Record<string, any> | undefined): Send => ({
...parseMoreInformation(data),
Expand Down

0 comments on commit 76c03c3

Please sign in to comment.