From 5525543d50307f860670a62cdfca798a4bcdb776 Mon Sep 17 00:00:00 2001 From: Kevin Haube Date: Tue, 16 Jan 2024 10:19:10 -0500 Subject: [PATCH 01/18] Add missing additional info instrucitons --- src/services/ui/src/pages/actions/IssueRai.tsx | 3 +++ src/services/ui/src/pages/actions/WithdrawRai.tsx | 1 + 2 files changed, 4 insertions(+) diff --git a/src/services/ui/src/pages/actions/IssueRai.tsx b/src/services/ui/src/pages/actions/IssueRai.tsx index d78d6157cb..6355698374 100644 --- a/src/services/ui/src/pages/actions/IssueRai.tsx +++ b/src/services/ui/src/pages/actions/IssueRai.tsx @@ -45,6 +45,9 @@ export const RaiIssue = ({ attachments={attachments} attachmentFaqLink={"/faq/#medicaid-spa-rai-attachments"} requireAddlInfo + addlInfoInstructions={ +

Add anything else that you would like to share with the State.

+ } /> ); }; diff --git a/src/services/ui/src/pages/actions/WithdrawRai.tsx b/src/services/ui/src/pages/actions/WithdrawRai.tsx index 80cc313087..5ed292b91b 100644 --- a/src/services/ui/src/pages/actions/WithdrawRai.tsx +++ b/src/services/ui/src/pages/actions/WithdrawRai.tsx @@ -39,6 +39,7 @@ export const WithdrawRai = ({ attachments={attachments} attachmentFaqLink={"/faq/#medicaid-spa-rai-attachments"} requireAddlInfo + addlInfoInstructions={

Explain your need for withdrawal.

} /> ); }; From a63beb3e326c0ed8f853cc70ba4baee56513472a Mon Sep 17 00:00:00 2001 From: Kevin Haube Date: Tue, 16 Jan 2024 12:14:53 -0500 Subject: [PATCH 02/18] Update attachment label --- src/services/ui/src/pages/actions/setups/setupRespondToRai.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/ui/src/pages/actions/setups/setupRespondToRai.ts b/src/services/ui/src/pages/actions/setups/setupRespondToRai.ts index cd0cdd1021..1875c36edf 100644 --- a/src/services/ui/src/pages/actions/setups/setupRespondToRai.ts +++ b/src/services/ui/src/pages/actions/setups/setupRespondToRai.ts @@ -47,7 +47,7 @@ export const chipRespondToRaiSetup = { }, { name: "officialRaiResponse", - label: "Official Rai Response", + label: "Official RAI Response", required: true, }, { From 5c17f1a95bb23cda0204708a3a43222af17e647e Mon Sep 17 00:00:00 2001 From: Kevin Haube Date: Tue, 16 Jan 2024 15:40:23 -0500 Subject: [PATCH 03/18] Add dynamic instructions for WithdrawPackage --- .../ui/src/pages/actions/WithdrawPackage.tsx | 22 +++++++++++++++---- src/services/ui/src/pages/actions/index.tsx | 2 +- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/services/ui/src/pages/actions/WithdrawPackage.tsx b/src/services/ui/src/pages/actions/WithdrawPackage.tsx index 612301db86..e43885238c 100644 --- a/src/services/ui/src/pages/actions/WithdrawPackage.tsx +++ b/src/services/ui/src/pages/actions/WithdrawPackage.tsx @@ -7,6 +7,23 @@ import { zodResolver } from "@hookform/resolvers/zod"; import { useActionSubmitHandler } from "@/hooks/useActionFormController"; import { ActionFormTemplate } from "@/pages/actions/template"; import { FormSetup } from "@/pages/actions/setups"; +import { SetupOptions } from "@/pages"; +import { ReactElement } from "react"; + +const attachmentInstructions: Record = { + "Medicaid SPA": ( +

+ Upload your supporting documentation for withdrawal or explain your need + for withdrawal in the Additional Information section. +

+ ), + "CHIP SPA": ( +

+ Official withdrawal letters are required and must be on state letterhead + signed by the State Medicaid Director or CHIP Director. +

+ ), +}; export const WithdrawPackage = ({ item, @@ -56,10 +73,7 @@ export const WithdrawPackage = ({ attachments={attachments} attachmentFaqLink={"/faq"} attachmentInstructions={ -

- Official withdrawal letters are required and must be on state - letterhead signed by the State Medicaid Director or CHIP Director. -

+ attachmentInstructions[item!._source.planType as string as SetupOptions] } addlInfoInstructions={

diff --git a/src/services/ui/src/pages/actions/index.tsx b/src/services/ui/src/pages/actions/index.tsx index 2218c07cb7..90f252e16a 100644 --- a/src/services/ui/src/pages/actions/index.tsx +++ b/src/services/ui/src/pages/actions/index.tsx @@ -24,7 +24,7 @@ import { medicaidWithdrawPackageSetup, } from "@/pages/actions/setups"; -type SetupOptions = "CHIP SPA" | "Medicaid SPA"; +export type SetupOptions = "CHIP SPA" | "Medicaid SPA"; const getFormSetup = (opt: SetupOptions, type: Action): FormSetup | null => { switch (type) { case "issue-rai": From 9883a8f66cff9968c8ef1d01da4159286846a518 Mon Sep 17 00:00:00 2001 From: Kevin Haube Date: Tue, 16 Jan 2024 15:42:08 -0500 Subject: [PATCH 04/18] Details dynamic title --- src/services/ui/src/pages/detail/index.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/services/ui/src/pages/detail/index.tsx b/src/services/ui/src/pages/detail/index.tsx index affc597d72..6cc20c7cfd 100644 --- a/src/services/ui/src/pages/detail/index.tsx +++ b/src/services/ui/src/pages/detail/index.tsx @@ -200,7 +200,10 @@ export const DetailsContent = ({

- + From fb1a3534c1aee637be3ea388527f47f21addbb1c Mon Sep 17 00:00:00 2001 From: Kevin Haube Date: Tue, 16 Jan 2024 16:01:23 -0500 Subject: [PATCH 05/18] Dynamic additional info text --- .../ui/src/hooks/useActionFormController.ts | 2 +- .../ui/src/pages/actions/WithdrawPackage.tsx | 54 ++++++++++--------- 2 files changed, 31 insertions(+), 25 deletions(-) diff --git a/src/services/ui/src/hooks/useActionFormController.ts b/src/services/ui/src/hooks/useActionFormController.ts index 849ecefe12..63c59c9acd 100644 --- a/src/services/ui/src/hooks/useActionFormController.ts +++ b/src/services/ui/src/hooks/useActionFormController.ts @@ -6,7 +6,7 @@ import { submit } from "@/api/submissionService"; import { buildActionUrl } from "@/lib"; import { PlanType } from "shared-types"; -type DataConditionError = { +export type DataConditionError = { message: string; }; diff --git a/src/services/ui/src/pages/actions/WithdrawPackage.tsx b/src/services/ui/src/pages/actions/WithdrawPackage.tsx index e43885238c..f4c46d39f6 100644 --- a/src/services/ui/src/pages/actions/WithdrawPackage.tsx +++ b/src/services/ui/src/pages/actions/WithdrawPackage.tsx @@ -25,6 +25,22 @@ const attachmentInstructions: Record = { ), }; +const addlInfoInstructions: Record = { + "Medicaid SPA": ( +

+ Explain your need for withdrawal, or upload supporting documentation. +
+ + Once you submit this form, a confirmation email is sent to you and to + CMS. CMS will use this content to review your package. If CMS needs any + additional information, they will follow up by email + + . +

+ ), + "CHIP SPA":

Explain your need for withdrawal.

, +}; + export const WithdrawPackage = ({ item, schema, @@ -38,20 +54,19 @@ export const WithdrawPackage = ({ const handleSubmit = useActionSubmitHandler({ formHookReturn: form, authority: item?._source.authority as PlanType, - addDataConditions: [ - (data) => { - if ( - !data.attachments.supportingDocumentation && - !data.additionalInformation - ) { - return { - message: "An Attachment or Additional Information is required.", - }; - } else { - return null; - } - }, - ], + addDataConditions: + (item?._source.planType as string as SetupOptions) === "Medicaid SPA" + ? [ + (data) => + !data.attachments.supportingDocumentation && + !data.additionalInformation + ? { + message: + "An Attachment or Additional Information is required.", + } + : null, + ] + : [], }); if (!item) return ; // Prevents optionals below @@ -76,16 +91,7 @@ export const WithdrawPackage = ({ attachmentInstructions[item!._source.planType as string as SetupOptions] } addlInfoInstructions={ -

- Explain your need for withdrawal, or upload supporting documentation. -
- - Once you submit this form, a confirmation email is sent to you and - to CMS. CMS will use this content to review your package. If CMS - needs any additional information, they will follow up by email - - . -

+ addlInfoInstructions[item!._source.planType as string as SetupOptions] } /> ); From fde0b4da7f79e57e1f157fd7b441f2b72e86b635 Mon Sep 17 00:00:00 2001 From: Kevin Haube Date: Tue, 16 Jan 2024 16:01:40 -0500 Subject: [PATCH 06/18] Update zod schemas --- .../ui/src/pages/actions/setups/setupIssueRai.ts | 15 ++++++++------- .../src/pages/actions/setups/setupRespondToRai.ts | 2 +- .../pages/actions/setups/setupWithdrawPackage.ts | 4 ++-- .../src/pages/actions/setups/setupWithdrawRai.ts | 5 +++-- src/services/ui/src/pages/form/zod.ts | 3 +-- 5 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/services/ui/src/pages/actions/setups/setupIssueRai.ts b/src/services/ui/src/pages/actions/setups/setupIssueRai.ts index a641850869..b05574d6fd 100644 --- a/src/services/ui/src/pages/actions/setups/setupIssueRai.ts +++ b/src/services/ui/src/pages/actions/setups/setupIssueRai.ts @@ -1,15 +1,16 @@ import { z } from "zod"; +import { + zAdditionalInfo, + zAttachmentOptional, + zAttachmentRequired, +} from "@/pages/form/zod"; export const defaultIssueRaiSetup = { schema: z.object({ - additionalInformation: z.string().max(4000), + additionalInformation: zAdditionalInfo, attachments: z.object({ - formalRaiLetter: z - .array(z.instanceof(File)) - .refine((value) => value.length > 0, { - message: "Required", - }), - other: z.array(z.instanceof(File)).optional(), + formalRaiLetter: zAttachmentRequired({ min: 1 }), + other: zAttachmentOptional, }), }), attachments: [ diff --git a/src/services/ui/src/pages/actions/setups/setupRespondToRai.ts b/src/services/ui/src/pages/actions/setups/setupRespondToRai.ts index 1875c36edf..a4ed229ac6 100644 --- a/src/services/ui/src/pages/actions/setups/setupRespondToRai.ts +++ b/src/services/ui/src/pages/actions/setups/setupRespondToRai.ts @@ -7,7 +7,7 @@ import { export const medicaidRespondToRaiSetup = { schema: z.object({ - additionalInformation: zAdditionalInfo, + additionalInformation: zAdditionalInfo.optional(), attachments: z.object({ raiResponseLetter: zAttachmentRequired({ min: 1 }), other: zAttachmentOptional, diff --git a/src/services/ui/src/pages/actions/setups/setupWithdrawPackage.ts b/src/services/ui/src/pages/actions/setups/setupWithdrawPackage.ts index 8584392aaf..fd7d30142c 100644 --- a/src/services/ui/src/pages/actions/setups/setupWithdrawPackage.ts +++ b/src/services/ui/src/pages/actions/setups/setupWithdrawPackage.ts @@ -7,7 +7,7 @@ import { export const medicaidWithdrawPackageSetup = { schema: z.object({ - additionalInformation: zAdditionalInfo, + additionalInformation: zAdditionalInfo.optional(), attachments: z.object({ supportingDocumentation: zAttachmentOptional, }), @@ -23,7 +23,7 @@ export const medicaidWithdrawPackageSetup = { export const chipWithdrawPackageSetup = { schema: z.object({ - additionalInformation: zAdditionalInfo, + additionalInformation: zAdditionalInfo.optional(), attachments: z.object({ officialWithdrawalLetter: zAttachmentRequired({ min: 1 }), }), diff --git a/src/services/ui/src/pages/actions/setups/setupWithdrawRai.ts b/src/services/ui/src/pages/actions/setups/setupWithdrawRai.ts index f0ca690018..970d9bf40a 100644 --- a/src/services/ui/src/pages/actions/setups/setupWithdrawRai.ts +++ b/src/services/ui/src/pages/actions/setups/setupWithdrawRai.ts @@ -1,10 +1,11 @@ import { z } from "zod"; +import { zAdditionalInfo, zAttachmentOptional } from "@/pages/form/zod"; export const defaultWithdrawRaiSetup = { schema: z.object({ - additionalInformation: z.string().max(4000), + additionalInformation: zAdditionalInfo, attachments: z.object({ - supportingDocumentation: z.array(z.instanceof(File)).nullish(), + supportingDocumentation: zAttachmentOptional, }), }), attachments: [ diff --git a/src/services/ui/src/pages/form/zod.ts b/src/services/ui/src/pages/form/zod.ts index 6d7209b256..2a212c0f39 100644 --- a/src/services/ui/src/pages/form/zod.ts +++ b/src/services/ui/src/pages/form/zod.ts @@ -36,5 +36,4 @@ export const zAttachmentRequired = ({ export const zAdditionalInfo = z .string() - .max(4000, "This field may only be up to 4000 characters.") - .optional(); + .max(4000, "This field may only be up to 4000 characters."); From 83b0ab3e088d387f801b00458fded5f6aaf40b78 Mon Sep 17 00:00:00 2001 From: Kevin Haube Date: Tue, 16 Jan 2024 16:32:58 -0500 Subject: [PATCH 07/18] Update required addl info --- src/services/ui/src/pages/actions/RespondToRai.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/services/ui/src/pages/actions/RespondToRai.tsx b/src/services/ui/src/pages/actions/RespondToRai.tsx index d1d2bb25de..f12b082031 100644 --- a/src/services/ui/src/pages/actions/RespondToRai.tsx +++ b/src/services/ui/src/pages/actions/RespondToRai.tsx @@ -6,6 +6,7 @@ import { useActionSubmitHandler } from "@/hooks/useActionFormController"; import { ActionFormIntro } from "@/pages/actions/common"; import { ActionFormTemplate } from "@/pages/actions/template"; import { FormSetup } from "@/pages/actions/setups"; +import { SetupOptions } from "@/pages"; export const RespondToRai = ({ item, @@ -46,6 +47,9 @@ export const RespondToRai = ({ addlInfoInstructions={

Add anything else that you would like to share with CMS.

} + requireAddlInfo={ + (item._source.planType as string as SetupOptions) === "CHIP SPA" + } /> ); }; From 589b898aad8a54077fe709cfcc0e2c05475905e3 Mon Sep 17 00:00:00 2001 From: Kevin Haube Date: Tue, 16 Jan 2024 16:49:47 -0500 Subject: [PATCH 08/18] use zod for extra conditions --- .../ui/src/pages/actions/WithdrawPackage.tsx | 13 ---------- src/services/ui/src/pages/actions/index.tsx | 2 +- src/services/ui/src/pages/actions/setups/_.ts | 4 +-- .../actions/setups/setupWithdrawPackage.ts | 26 +++++++++++++++---- 4 files changed, 24 insertions(+), 21 deletions(-) diff --git a/src/services/ui/src/pages/actions/WithdrawPackage.tsx b/src/services/ui/src/pages/actions/WithdrawPackage.tsx index f4c46d39f6..7406da7b5d 100644 --- a/src/services/ui/src/pages/actions/WithdrawPackage.tsx +++ b/src/services/ui/src/pages/actions/WithdrawPackage.tsx @@ -54,19 +54,6 @@ export const WithdrawPackage = ({ const handleSubmit = useActionSubmitHandler({ formHookReturn: form, authority: item?._source.authority as PlanType, - addDataConditions: - (item?._source.planType as string as SetupOptions) === "Medicaid SPA" - ? [ - (data) => - !data.attachments.supportingDocumentation && - !data.additionalInformation - ? { - message: - "An Attachment or Additional Information is required.", - } - : null, - ] - : [], }); if (!item) return ; // Prevents optionals below diff --git a/src/services/ui/src/pages/actions/index.tsx b/src/services/ui/src/pages/actions/index.tsx index 90f252e16a..2f2e2d5f5a 100644 --- a/src/services/ui/src/pages/actions/index.tsx +++ b/src/services/ui/src/pages/actions/index.tsx @@ -3,7 +3,7 @@ import { ToggleRaiResponseWithdraw } from "@/pages/actions/ToggleRaiResponseWith import { RaiIssue } from "@/pages/actions/IssueRai"; import { WithdrawPackage } from "@/pages/actions/WithdrawPackage"; import { RespondToRai } from "@/pages/actions/RespondToRai"; -import { opensearch, Action } from "shared-types"; +import { Action } from "shared-types"; import { WithdrawRai } from "./WithdrawRai"; import { useGetItem, useGetPackageActions } from "@/api"; import { diff --git a/src/services/ui/src/pages/actions/setups/_.ts b/src/services/ui/src/pages/actions/setups/_.ts index cc6d519c6d..bd4e86bc69 100644 --- a/src/services/ui/src/pages/actions/setups/_.ts +++ b/src/services/ui/src/pages/actions/setups/_.ts @@ -1,7 +1,7 @@ -import { ZodObject } from "zod"; +import { ZodEffects, ZodObject } from "zod"; import { AttachmentRecipe } from "@/lib"; export type FormSetup = { - schema: ZodObject; + schema: ZodObject | ZodEffects; attachments: AttachmentRecipe[]; }; diff --git a/src/services/ui/src/pages/actions/setups/setupWithdrawPackage.ts b/src/services/ui/src/pages/actions/setups/setupWithdrawPackage.ts index fd7d30142c..31b028e04d 100644 --- a/src/services/ui/src/pages/actions/setups/setupWithdrawPackage.ts +++ b/src/services/ui/src/pages/actions/setups/setupWithdrawPackage.ts @@ -6,12 +6,28 @@ import { } from "@/pages/form/zod"; export const medicaidWithdrawPackageSetup = { - schema: z.object({ - additionalInformation: zAdditionalInfo.optional(), - attachments: z.object({ - supportingDocumentation: zAttachmentOptional, + schema: z + .object({ + additionalInformation: zAdditionalInfo.optional(), + attachments: z.object({ + supportingDocumentation: zAttachmentOptional, + }), + }) + .superRefine((val, ctx) => { + if ( + !val.attachments.supportingDocumentation && + !val.additionalInformation + ) { + ctx.addIssue({ + message: "An Attachment or Additional Information is required.", + code: z.ZodIssueCode.custom, + fatal: true, + }); + // Zod says this is to appease types + // https://github.com/colinhacks/zod?tab=readme-ov-file#type-refinements + return z.NEVER; + } }), - }), attachments: [ { name: "supportingDocumentation", From dd2f957ccd6b38b32fcde2a526d6769cbc555746 Mon Sep 17 00:00:00 2001 From: Kevin Haube Date: Tue, 16 Jan 2024 18:09:50 -0500 Subject: [PATCH 09/18] Update condition --- .../ui/src/pages/actions/setups/setupWithdrawPackage.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/services/ui/src/pages/actions/setups/setupWithdrawPackage.ts b/src/services/ui/src/pages/actions/setups/setupWithdrawPackage.ts index 31b028e04d..42d208da73 100644 --- a/src/services/ui/src/pages/actions/setups/setupWithdrawPackage.ts +++ b/src/services/ui/src/pages/actions/setups/setupWithdrawPackage.ts @@ -15,8 +15,8 @@ export const medicaidWithdrawPackageSetup = { }) .superRefine((val, ctx) => { if ( - !val.attachments.supportingDocumentation && - !val.additionalInformation + !val.attachments.supportingDocumentation?.length || + val.additionalInformation === undefined ) { ctx.addIssue({ message: "An Attachment or Additional Information is required.", From 32f7acb6453764b608417b1bafbb04c15e745fe9 Mon Sep 17 00:00:00 2001 From: Kevin Haube Date: Tue, 16 Jan 2024 18:13:11 -0500 Subject: [PATCH 10/18] Update condition --- .../ui/src/pages/actions/setups/setupWithdrawPackage.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/ui/src/pages/actions/setups/setupWithdrawPackage.ts b/src/services/ui/src/pages/actions/setups/setupWithdrawPackage.ts index 42d208da73..c49558d8e1 100644 --- a/src/services/ui/src/pages/actions/setups/setupWithdrawPackage.ts +++ b/src/services/ui/src/pages/actions/setups/setupWithdrawPackage.ts @@ -15,7 +15,7 @@ export const medicaidWithdrawPackageSetup = { }) .superRefine((val, ctx) => { if ( - !val.attachments.supportingDocumentation?.length || + !val.attachments.supportingDocumentation?.length && val.additionalInformation === undefined ) { ctx.addIssue({ From be478b835251445c3d5e49883a31c687f93ff787 Mon Sep 17 00:00:00 2001 From: Kevin Haube Date: Wed, 17 Jan 2024 09:39:56 -0500 Subject: [PATCH 11/18] Schema rule and error updates for withdrawpackage med spa --- src/services/ui/src/pages/actions/template.tsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/services/ui/src/pages/actions/template.tsx b/src/services/ui/src/pages/actions/template.tsx index 569f4c4fb2..a17f56ad7a 100644 --- a/src/services/ui/src/pages/actions/template.tsx +++ b/src/services/ui/src/pages/actions/template.tsx @@ -1,4 +1,4 @@ -import { LoadingSpinner } from "@/components"; +import { Alert, LoadingSpinner } from "@/components"; import { PackageInfo } from "@/pages/actions/common"; import { AttachmentsSizeTypesDesc } from "@/pages/form/content"; import { @@ -81,6 +81,18 @@ export const ActionFormTemplate = ({ required: requireAddlInfo, })} /> + {Object.keys(formController.formState.errors).length !== 0 ? ( + + Input validation error(s): +
    + {Object.values(formController.formState.errors).map((v, idx) => ( +
  • + {v?.message as string} +
  • + ))} +
+
+ ) : null}
-
From c0c67eff1f06f68fc6187bc1a0495b7f40534206 Mon Sep 17 00:00:00 2001 From: Kevin Haube Date: Thu, 18 Jan 2024 10:02:22 -0500 Subject: [PATCH 16/18] Add pre-commit message on template for state user actions --- src/packages/shared-utils/index.ts | 3 +- src/packages/shared-utils/is-state-user.ts | 12 -------- .../shared-utils/package-actions/rules.ts | 17 ++++++----- src/packages/shared-utils/user-helper.ts | 29 ++++++++++++------- .../ui/src/pages/actions/WithdrawPackage.tsx | 9 +----- .../ui/src/pages/actions/template.tsx | 11 +++++-- 6 files changed, 40 insertions(+), 41 deletions(-) delete mode 100644 src/packages/shared-utils/is-state-user.ts diff --git a/src/packages/shared-utils/index.ts b/src/packages/shared-utils/index.ts index 04d4ee65b9..553e55419f 100644 --- a/src/packages/shared-utils/index.ts +++ b/src/packages/shared-utils/index.ts @@ -1,8 +1,7 @@ export * from "./user-helper"; export * from "./s3-url-parser"; -export { isStateUser } from "./is-state-user"; export * from "./rai-helper"; export * from "./regex"; export * from "./package-actions/getAvailableActions"; export * from "./packageCheck"; -export * from "./seatool-date-helper" \ No newline at end of file +export * from "./seatool-date-helper"; diff --git a/src/packages/shared-utils/is-state-user.ts b/src/packages/shared-utils/is-state-user.ts deleted file mode 100644 index 19ed46a0d2..0000000000 --- a/src/packages/shared-utils/is-state-user.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { CognitoUserAttributes, STATE_ROLES } from "../shared-types"; - -export const isStateUser = (user: CognitoUserAttributes) => { - const userRoles = user["custom:cms-roles"]; - - for (const cmsRole of STATE_ROLES) { - if (userRoles?.includes(cmsRole)) { - return true; - } - } - return false; -}; diff --git a/src/packages/shared-utils/package-actions/rules.ts b/src/packages/shared-utils/package-actions/rules.ts index 4a7790cdb9..65bc13283c 100644 --- a/src/packages/shared-utils/package-actions/rules.ts +++ b/src/packages/shared-utils/package-actions/rules.ts @@ -1,6 +1,10 @@ -import { Action, ActionRule, SEATOOL_STATUS, finalDispositionStatuses } from "../../shared-types"; -import { isCmsUser, isStateUser, isCmsReadonlyUser, isCmsWriteUser } from "../user-helper"; -import { PackageCheck } from "../packageCheck"; +import { + Action, + ActionRule, + SEATOOL_STATUS, + finalDispositionStatuses, +} from "../../shared-types"; +import { isStateUser, isCmsWriteUser } from "../user-helper"; const arIssueRai: ActionRule = { action: Action.ISSUE_RAI, @@ -24,7 +28,7 @@ const arEnableWithdrawRaiResponse: ActionRule = { checker.isNotWithdrawn && checker.hasRaiResponse && !checker.hasEnabledRaiWithdraw && - isCmsWriteUser(user) + isCmsWriteUser(user), }; const arDisableWithdrawRaiResponse: ActionRule = { @@ -33,7 +37,7 @@ const arDisableWithdrawRaiResponse: ActionRule = { checker.isNotWithdrawn && checker.hasRaiResponse && checker.hasEnabledRaiWithdraw && - isCmsWriteUser(user) + isCmsWriteUser(user), }; const arWithdrawRaiResponse: ActionRule = { @@ -47,8 +51,7 @@ const arWithdrawRaiResponse: ActionRule = { const arWithdrawPackage: ActionRule = { action: Action.WITHDRAW_PACKAGE, check: (checker, user) => - !checker.hasStatus(finalDispositionStatuses) - && isStateUser(user), + !checker.hasStatus(finalDispositionStatuses) && isStateUser(user), }; export default [ diff --git a/src/packages/shared-utils/user-helper.ts b/src/packages/shared-utils/user-helper.ts index b0f3df46be..037502b436 100644 --- a/src/packages/shared-utils/user-helper.ts +++ b/src/packages/shared-utils/user-helper.ts @@ -1,4 +1,10 @@ -import { CMS_ROLES, CMS_WRITE_ROLES, CMS_READ_ONLY_ROLES, CognitoUserAttributes, STATE_ROLES } from "../shared-types"; +import { + CMS_ROLES, + CMS_WRITE_ROLES, + CMS_READ_ONLY_ROLES, + CognitoUserAttributes, + STATE_ROLES, +} from "../shared-types"; export const isCmsUser = (user: CognitoUserAttributes) => { const userRoles = user["custom:cms-roles"]; @@ -31,16 +37,19 @@ export const isCmsReadonlyUser = (user: CognitoUserAttributes) => { } } return false; -} +}; -export const isStateUser = (user: CognitoUserAttributes) => { - const userRoles = user["custom:cms-roles"]; +export const isStateUser = (user: CognitoUserAttributes | null) => { + if (!user) { + return false; + } else { + const userRoles = user["custom:cms-roles"]; - for (const role of STATE_ROLES) { - if (userRoles.includes(role)) { - return true; + for (const role of STATE_ROLES) { + if (userRoles.includes(role)) { + return true; + } } + return false; } - return false; - -} +}; diff --git a/src/services/ui/src/pages/actions/WithdrawPackage.tsx b/src/services/ui/src/pages/actions/WithdrawPackage.tsx index 7406da7b5d..e2e3054534 100644 --- a/src/services/ui/src/pages/actions/WithdrawPackage.tsx +++ b/src/services/ui/src/pages/actions/WithdrawPackage.tsx @@ -28,14 +28,7 @@ const attachmentInstructions: Record = { const addlInfoInstructions: Record = { "Medicaid SPA": (

- Explain your need for withdrawal, or upload supporting documentation. -
- - Once you submit this form, a confirmation email is sent to you and to - CMS. CMS will use this content to review your package. If CMS needs any - additional information, they will follow up by email - - . + Explain your need for withdrawal, or upload supporting documentation. .

), "CHIP SPA":

Explain your need for withdrawal.

, diff --git a/src/services/ui/src/pages/actions/template.tsx b/src/services/ui/src/pages/actions/template.tsx index a41e80b8fe..509620df46 100644 --- a/src/services/ui/src/pages/actions/template.tsx +++ b/src/services/ui/src/pages/actions/template.tsx @@ -1,6 +1,9 @@ import { Alert, LoadingSpinner } from "@/components"; import { PackageInfo } from "@/pages/actions/common"; -import { AttachmentsSizeTypesDesc } from "@/pages/form/content"; +import { + AttachmentsSizeTypesDesc, + PreSubmissionMessage, +} from "@/pages/form/content"; import { SlotAdditionalInfo, SlotAttachments, @@ -12,8 +15,9 @@ import { FormMessage, RequiredIndicator, } from "@/components/Inputs"; -import { ReactElement, ReactNode } from "react"; +import { ReactElement } from "react"; import { opensearch } from "shared-types"; +import { isStateUser } from "shared-utils"; import { FieldValues, Path, @@ -22,6 +26,7 @@ import { } from "react-hook-form"; import { AttachmentRecipe } from "@/lib"; import { useModalContext } from "@/pages/form/modals"; +import { useGetUser } from "@/api/useGetUser"; export const ActionFormTemplate = ({ item, @@ -45,6 +50,7 @@ export const ActionFormTemplate = ({ addlInfoInstructions?: ReactElement; }) => { const { setCancelModalOpen } = useModalContext(); + const { data: user } = useGetUser(); return (
@@ -96,6 +102,7 @@ export const ActionFormTemplate = ({ )} + {isStateUser(user!.user) && }