diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index fb190d8f7c..532be3ba20 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -28,10 +28,24 @@ jobs:
echo "ERROR: Your branch name, $STAGE_NAME, is not a valid Serverless Framework stage name." && exit 1
fi
+ test:
+ runs-on: ubuntu-20.04
+ needs:
+ - init
+ environment:
+ name: ${{ startsWith(github.ref_name, 'snyk-') && 'snyk' || github.ref_name }}
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ - uses: ./.github/actions/setup
+ - name: Test
+ run: run test
+
deploy:
runs-on: ubuntu-20.04
needs:
- init
+ - test
environment:
name: ${{ startsWith(github.ref_name, 'snyk-') && 'snyk' || github.ref_name }}
outputs:
@@ -96,19 +110,6 @@ jobs:
run: |
echo "Kibana URL: ${{ needs.deploy.outputs.kibana-url }}"
- test:
- runs-on: ubuntu-20.04
- needs:
- - init
- environment:
- name: ${{ startsWith(github.ref_name, 'snyk-') && 'snyk' || github.ref_name }}
- steps:
- - name: Checkout
- uses: actions/checkout@v4
- - uses: ./.github/actions/setup
- - name: Test
- run: run test
-
e2e:
runs-on: ubuntu-20.04
needs:
diff --git a/.gitignore b/.gitignore
index af47aca24d..a56abdec92 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,3 +21,4 @@ DS_Store
# tests
coverage
+.vitest
diff --git a/lib/lambda/processEmailsHandler.test.ts b/lib/lambda/processEmailsHandler.test.ts
index dd44c000a1..c8e92d4c0d 100644
--- a/lib/lambda/processEmailsHandler.test.ts
+++ b/lib/lambda/processEmailsHandler.test.ts
@@ -376,7 +376,7 @@ describe("process emails Handler for seatool", () => {
bootstrapServers: "",
};
await handler(mockEvent, {} as Context, callback);
- expect(secSPY).toHaveBeenCalledTimes(2);
+ expect(secSPY).toHaveBeenCalledTimes(1);
});
it("should not find the item ID and do nothing", async () => {
const callback = vi.fn();
diff --git a/lib/lambda/sinkChangelog.ts b/lib/lambda/sinkChangelog.ts
index c2e6652020..647eeb6772 100644
--- a/lib/lambda/sinkChangelog.ts
+++ b/lib/lambda/sinkChangelog.ts
@@ -76,7 +76,7 @@ const processAndIndex = async ({
const result = schema.safeParse(record);
if (result.success) {
- if (result.data.adminChangeType === "update-id") {
+ if (result.data.adminChangeType === "update-id" && "idToBeUpdated" in result.data) {
// Push doc with package being soft deleted
docs.forEach((log) => {
const recordOffset = log.id.split("-").at(-1);
@@ -97,7 +97,10 @@ const processAndIndex = async ({
packageId: result.data.id,
});
});
- } else if (result.data.adminChangeType === "split-spa") {
+ } else if (
+ result.data.adminChangeType === "split-spa" &&
+ "idToBeUpdated" in result.data
+ ) {
// Push doc with new split package
docs.push(result.data);
diff --git a/lib/lambda/sinkMainProcessors.test.ts b/lib/lambda/sinkMainProcessors.test.ts
index ff5e846b0e..46647e0240 100644
--- a/lib/lambda/sinkMainProcessors.test.ts
+++ b/lib/lambda/sinkMainProcessors.test.ts
@@ -228,6 +228,7 @@ describe("insertOneMacRecordsFromKafkaIntoMako", () => {
"respond-to-rai",
respondToRai,
{
+ authority: "Medicaid SPA",
raiReceivedDate: ISO_DATETIME,
raiWithdrawEnabled: false,
seatoolStatus: SEATOOL_STATUS.SUBMITTED,
diff --git a/lib/lambda/submit/submitSplitSPA.ts b/lib/lambda/submit/submitSplitSPA.ts
index 831bbd7cb7..fc73ef484a 100644
--- a/lib/lambda/submit/submitSplitSPA.ts
+++ b/lib/lambda/submit/submitSplitSPA.ts
@@ -11,7 +11,7 @@ import { z } from "zod";
EXAMPLE EVENT JSON:
{
"body": {
- "packageId": "MD-25-9999",
+ "packageId": "MD-25-9999"
}
}
*/
@@ -26,6 +26,8 @@ const sendSubmitSplitSPAMessage = async (currentPackage: ItemResult) => {
throw new Error("Error getting next Split SPA Id");
}
+ const currentTime = Date.now();
+
// ID and changeMade are excluded; the rest of the object has to be spread into the new package
const {
id: _id,
@@ -41,8 +43,9 @@ const sendSubmitSplitSPAMessage = async (currentPackage: ItemResult) => {
id: newId,
idToBeUpdated: currentPackage._id,
...remainingFields,
- makoChangedDate: Date.now(),
- changedDate: Date.now(),
+ makoChangedDate: currentTime,
+ changedDate: currentTime,
+ timestamp: currentTime,
origin: "OneMAC",
changeMade: "OneMAC Admin has added a package to OneMAC.",
changeReason: "Per request from CMS, this package was added to OneMAC.",
diff --git a/lib/lambda/update/adminChangeSchemas.ts b/lib/lambda/update/adminChangeSchemas.ts
index f13bc10fd2..b3956627d5 100644
--- a/lib/lambda/update/adminChangeSchemas.ts
+++ b/lib/lambda/update/adminChangeSchemas.ts
@@ -49,8 +49,6 @@ export const transformUpdateValuesSchema = (offset: number) =>
timestamp: Date.now(),
}));
-const currentTime = Date.now();
-
export const transformedUpdateIdSchema = updateIdAdminChangeSchema.transform((data) => ({
...data,
event: "update-id",
@@ -64,9 +62,6 @@ export const transformedSplitSPASchema = splitSPAAdminChangeSchema.transform((da
event: "split-spa",
packageId: data.id,
id: `${data.id}`,
- timestamp: currentTime,
- makoChangedDate: currentTime,
- changedDate: currentTime,
}));
export const submitNOSOAdminSchema = z.object({
diff --git a/lib/libs/email/content/email-components.tsx b/lib/libs/email/content/email-components.tsx
index bbfa311736..631fd76e09 100644
--- a/lib/libs/email/content/email-components.tsx
+++ b/lib/libs/email/content/email-components.tsx
@@ -217,11 +217,17 @@ const PackageDetails = ({ details }: { details: Record }) =>
);
-const MailboxNotice = ({ type }: { type: "SPA" | "Waiver" }) => (
+const MailboxNotice = ({
+ type,
+ onWaivers = true,
+}: {
+ type: "SPA" | "Waiver";
+ onWaivers: boolean;
+}) => (
{type === "SPA"
? "This mailbox is for the submittal of State Plan Amendments and non-web based responses to Requests for Additional Information (RAI) on submitted SPAs only."
- : "This mailbox is for the submittal of Section 1915(b) and 1915(c) Waivers, responses to Requests for Additional Information (RAI) on Waivers, and extension requests on Waivers only."}
+ : `This mailbox is for the submittal of Section 1915(b) and 1915(c) Waivers, responses to Requests for Additional Information (RAI)${onWaivers ? " on Waivers" : ""}, and extension requests on Waivers only.`}
{" Any other correspondence will be disregarded."}
);
@@ -230,13 +236,15 @@ const FollowUpNotice = ({
isChip,
includeStateLead = true,
includeDidNotExpect = true,
+ withDivider = true,
}: {
isChip?: boolean;
includeStateLead?: boolean;
includeDidNotExpect?: boolean;
+ withDivider?: boolean;
}) => (
<>
-
+ {withDivider && }
{isChip ? (
@@ -288,7 +296,9 @@ const WithdrawRAI: React.FC = ({ variables, relatedEvent }) =>
return (
- {`The OneMAC Submission Portal received a request to withdraw a Formal RAI Response. You are receiving this email notification as the Formal RAI was withdrawn by ${variables.submitterName} ${variables.submitterEmail}.`}
+ The OneMAC Submission Portal received a request to withdraw the Formal RAI Response. You
+ are receiving this email notification as the Formal RAI was withdrawn by{" "}
+ {variables.submitterName} {variables.submitterEmail}.
Note: The original RAI response details could not be retrieved.
@@ -300,7 +310,9 @@ const WithdrawRAI: React.FC = ({ variables, relatedEvent }) =>
return (
- {`The OneMAC Submission Portal received a request to withdraw the Formal RAI Response ${relatedEvent.id}. You are receiving this email notification as the Formal RAI for ${relatedEvent.id} was withdrawn by ${variables.submitterName} ${variables.submitterEmail}.`}
+ The OneMAC Submission Portal received a request to withdraw the Formal RAI Response{" "}
+ {relatedEvent.id}. You are receiving this email notification as the Formal RAI for{" "}
+ {relatedEvent.id} was withdrawn by {variables.submitterName} {variables.submitterEmail}.
);
diff --git a/lib/libs/email/content/respondToRai/emailTemplates/ChipSpaCMS.tsx b/lib/libs/email/content/respondToRai/emailTemplates/ChipSpaCMS.tsx
index 4041f0fd74..02b597f9f8 100644
--- a/lib/libs/email/content/respondToRai/emailTemplates/ChipSpaCMS.tsx
+++ b/lib/libs/email/content/respondToRai/emailTemplates/ChipSpaCMS.tsx
@@ -7,30 +7,27 @@ import {
} from "../../email-components";
import { BaseEmailTemplate } from "../../email-templates";
-export const ChipSpaCMSEmail = (props: {
+export const ChipSpaCMSEmail = ({
+ variables,
+}: {
variables: Events["RespondToRai"] & CommonEmailVariables;
-}) => {
- const { variables } = props;
- const previewText = `CHIP SPA ${variables.id} RAI Response Submitted`;
- const heading = "The OneMAC Submission Portal received a CHIP SPA RAI Response Submission";
- return (
- }
- >
-
-
-
-
- );
-};
+}) => (
+ }
+ >
+
+
+
+
+);
diff --git a/lib/libs/email/content/respondToRai/emailTemplates/ChipSpaState.tsx b/lib/libs/email/content/respondToRai/emailTemplates/ChipSpaState.tsx
index 3b90e7b8bb..542f19516e 100644
--- a/lib/libs/email/content/respondToRai/emailTemplates/ChipSpaState.tsx
+++ b/lib/libs/email/content/respondToRai/emailTemplates/ChipSpaState.tsx
@@ -1,39 +1,36 @@
import { formatNinetyDaysDate } from "shared-utils";
import { CommonEmailVariables, Events } from "shared-types";
import { Text } from "@react-email/components";
-import { PackageDetails, BasicFooter } from "../../email-components";
+import { PackageDetails, BasicFooter, FollowUpNotice } from "../../email-components";
import { BaseEmailTemplate } from "../../email-templates";
import { styles } from "../../email-styles";
-export const ChipSpaStateEmail = (props: {
+export const ChipSpaStateEmail = ({
+ variables,
+}: {
variables: Events["RespondToRai"] & CommonEmailVariables;
-}) => {
- const variables = props.variables;
- const previewText = `CHIP SPA ${variables.id} RAI Response Submitted`;
- const heading = "The OneMAC Submission Portal received a CHIP SPA RAI Response Submission";
- return (
- }
- >
-
-
- {`This response confirms receipt of your CHIP State Plan Amendment (SPA) or your response to a
+}) => (
+ }
+ >
+
+
+ {`This response confirms receipt of your CHIP State Plan Amendment (SPA) or your response to a
SPA Request for Additional Information (RAI). You can expect a formal response to your
- submittal to be issued within 90 days, before ${formatNinetyDaysDate(variables.timestamp)}
- .`}
-
-
- );
-};
+ submittal to be issued within 90 days, before ${formatNinetyDaysDate(variables.timestamp)}.`}
+
+
+
+);
diff --git a/lib/libs/email/content/respondToRai/emailTemplates/MedSpaCMS.tsx b/lib/libs/email/content/respondToRai/emailTemplates/MedSpaCMS.tsx
index cbdc9cf6a0..c4c8afdbaf 100644
--- a/lib/libs/email/content/respondToRai/emailTemplates/MedSpaCMS.tsx
+++ b/lib/libs/email/content/respondToRai/emailTemplates/MedSpaCMS.tsx
@@ -7,31 +7,27 @@ import {
} from "../../email-components";
import { BaseEmailTemplate } from "../../email-templates";
-export const MedSpaCMSEmail = (props: {
+export const MedSpaCMSEmail = ({
+ variables,
+}: {
variables: Events["RespondToRai"] & CommonEmailVariables;
-}) => {
- const variables = props.variables;
- const previewText = `Medicaid SPA ${variables.id} RAI Response Submitted`;
- const heading = "The OneMAC Submission Portal received a Medicaid SPA RAI Response Submission:";
-
- return (
- }
- >
-
-
-
-
- );
-};
+}) => (
+ }
+ >
+
+
+
+
+);
diff --git a/lib/libs/email/content/respondToRai/emailTemplates/MedSpaState.tsx b/lib/libs/email/content/respondToRai/emailTemplates/MedSpaState.tsx
index 248c111ee4..00d1e4c0c8 100644
--- a/lib/libs/email/content/respondToRai/emailTemplates/MedSpaState.tsx
+++ b/lib/libs/email/content/respondToRai/emailTemplates/MedSpaState.tsx
@@ -1,40 +1,35 @@
import { formatNinetyDaysDate } from "shared-utils";
import { CommonEmailVariables, Events } from "shared-types";
import { Text } from "@react-email/components";
-import { PackageDetails, MailboxNotice, FollowUpNotice } from "../../email-components";
+import { PackageDetails, MailboxNotice, FollowUpNotice, BasicFooter } from "../../email-components";
import { BaseEmailTemplate } from "../../email-templates";
import { styles } from "../../email-styles";
-export const MedSpaStateEmail = (props: {
+export const MedSpaStateEmail = ({
+ variables,
+}: {
variables: Events["RespondToRai"] & CommonEmailVariables;
-}) => {
- const variables = props.variables;
- const previewText = `Medicaid SPA ${variables.id} RAI Response Submitted`;
- const heading =
- "This response confirms you submitted a Medicaid SPA RAI Response to CMS for review";
- return (
- }
- >
-
-
- {`This response confirms receipt of your response to a SPA Request for Additional Information
- (RAI). You can expect a formal response to your submittal to be issued within 90 days,
- before ${formatNinetyDaysDate(variables.responseDate)}.`}
-
-
-
- );
-};
+}) => (
+ }
+ >
+
+
+ {`This response confirms receipt of your Medicaid State Plan Amendment (SPA or your response to a SPA Request for Additional Information (RAI)). You can expect a formal response to your submittal to be issued within 90 days, before ${formatNinetyDaysDate(variables.responseDate)}.`}
+
+
+
+
+);
diff --git a/lib/libs/email/content/respondToRai/emailTemplates/WaiverCMS.tsx b/lib/libs/email/content/respondToRai/emailTemplates/WaiverCMS.tsx
index b7c7be455e..81ab01ee16 100644
--- a/lib/libs/email/content/respondToRai/emailTemplates/WaiverCMS.tsx
+++ b/lib/libs/email/content/respondToRai/emailTemplates/WaiverCMS.tsx
@@ -7,30 +7,27 @@ import {
} from "../../email-components";
import { BaseEmailTemplate } from "../../email-templates";
-export const WaiverCMSEmail = (props: {
+export const WaiverCMSEmail = ({
+ variables,
+}: {
variables: Events["RespondToRai"] & CommonEmailVariables;
-}) => {
- const variables = props.variables;
- return (
- }
- >
-
-
-
-
-
- );
-};
+}) => (
+ }
+ >
+
+
+
+
+);
diff --git a/lib/libs/email/content/respondToRai/emailTemplates/WaiverState.tsx b/lib/libs/email/content/respondToRai/emailTemplates/WaiverState.tsx
index b8227af88c..360f6063db 100644
--- a/lib/libs/email/content/respondToRai/emailTemplates/WaiverState.tsx
+++ b/lib/libs/email/content/respondToRai/emailTemplates/WaiverState.tsx
@@ -1,49 +1,38 @@
import { formatNinetyDaysDate } from "shared-utils";
import { CommonEmailVariables, Events } from "shared-types";
import { Text } from "@react-email/components";
-import {
- PackageDetails,
- MailboxNotice,
- BasicFooter,
- FollowUpNotice,
- Divider,
-} from "../../email-components";
+import { PackageDetails, MailboxNotice, BasicFooter, FollowUpNotice } from "../../email-components";
import { BaseEmailTemplate } from "../../email-templates";
import { styles } from "../../email-styles";
-export const WaiverStateEmail = (props: {
+export const WaiverStateEmail = ({
+ variables,
+}: {
variables: Events["RespondToRai"] & CommonEmailVariables;
-}) => {
- const variables = props.variables;
- const previewText = `Appendix K Amendment Submitted`;
- const heading = `This response confirms the submission of your ${variables.authority} RAI Response to CMS for review:`;
- return (
- }
- >
-
-
-
- {`This response confirms the receipt of your Waiver request or your response to a Waiver
+}) => (
+ }
+ >
+
+
+ {`This response confirms the receipt of your Waiver request or your response to a Waiver
Request for Additional Information (RAI). You can expect a formal response to your submittal
- to be issued within 90 days, before ${formatNinetyDaysDate(variables.timestamp)}`}
- .
-
-
-
-
- );
-};
+ to be issued within 90 days, before ${formatNinetyDaysDate(variables.timestamp)}.`}
+
+
+
+
+);
diff --git a/lib/libs/email/content/withdrawConfirmation/emailTemplates/WaiverState.tsx b/lib/libs/email/content/withdrawConfirmation/emailTemplates/WaiverState.tsx
index 1d16bda02d..5616859671 100644
--- a/lib/libs/email/content/withdrawConfirmation/emailTemplates/WaiverState.tsx
+++ b/lib/libs/email/content/withdrawConfirmation/emailTemplates/WaiverState.tsx
@@ -15,7 +15,7 @@ export const WaiverStateEmail = (props: {
applicationEndpointUrl={variables.applicationEndpointUrl}
footerContent={}
>
-
+
);
};
diff --git a/lib/libs/email/content/withdrawConfirmation/index.tsx b/lib/libs/email/content/withdrawConfirmation/index.tsx
index a72d4f839a..48f7957b44 100644
--- a/lib/libs/email/content/withdrawConfirmation/index.tsx
+++ b/lib/libs/email/content/withdrawConfirmation/index.tsx
@@ -1,30 +1,34 @@
import { Authority, CommonEmailVariables, EmailAddresses, Events } from "shared-types";
import { AuthoritiesWithUserTypesTemplate } from "../..";
-import { WaiverStateEmail } from "./emailTemplates";
+import { ChipSpaStateEmail, MedSpaStateEmail, WaiverStateEmail } from "./emailTemplates";
import { render } from "@react-email/render";
+const generateWithdrawEmail = async (
+ variables: Events["WithdrawPackage"] & CommonEmailVariables & { emails: EmailAddresses },
+ subjectPrefix: string,
+ EmailComponent: React.FC<{ variables: any }>,
+) => {
+ return {
+ to: variables.allStateUsersEmails?.length
+ ? variables.allStateUsersEmails
+ : [`${variables.submitterName} <${variables.submitterEmail}>`],
+ subject: `${subjectPrefix} ${variables.id} Withdrawal Confirmation`,
+ body: await render(),
+ };
+};
+
export const withdrawConfirmation: AuthoritiesWithUserTypesTemplate = {
+ [Authority.MED_SPA]: {
+ state: (variables) =>
+ generateWithdrawEmail(variables, "Medicaid SPA Package", MedSpaStateEmail),
+ },
+ [Authority.CHIP_SPA]: {
+ state: (variables) => generateWithdrawEmail(variables, "CHIP SPA Package", ChipSpaStateEmail),
+ },
[Authority["1915b"]]: {
- state: async (
- variables: Events["WithdrawPackage"] & CommonEmailVariables & { emails: EmailAddresses },
- ) => {
- return {
- to: [`${variables.submitterName} <${variables.submitterEmail}>`], // TODO: change to all state users
- subject: `1915(b) ${variables.id} Withdrawal Confirmation`,
- body: await render(),
- };
- },
+ state: (variables) => generateWithdrawEmail(variables, "1915(b)", WaiverStateEmail),
},
[Authority["1915c"]]: {
- state: async (
- variables: Events["WithdrawPackage"] & CommonEmailVariables & { emails: EmailAddresses },
- ) => {
- return {
- to: [`${variables.submitterName} <${variables.submitterEmail}>`], // TODO: change to all state users
- subject: `1915(c) ${variables.id} Withdrawal Confirmation`,
- body: await render(),
- };
- },
+ state: (variables) => generateWithdrawEmail(variables, "1915(c)", WaiverStateEmail),
},
- // TODO: add CHIP & SPA Withdraw Confirmation Here
};
diff --git a/lib/libs/email/content/withdrawPackage/emailTemplates/WaiverState.tsx b/lib/libs/email/content/withdrawPackage/emailTemplates/WaiverState.tsx
index 85f7b3d5d7..1301b3bc3d 100644
--- a/lib/libs/email/content/withdrawPackage/emailTemplates/WaiverState.tsx
+++ b/lib/libs/email/content/withdrawPackage/emailTemplates/WaiverState.tsx
@@ -32,8 +32,8 @@ export const WaiverStateEmail = ({
}}
/>
-
-
+
+
);
};
diff --git a/lib/libs/email/content/withdrawPackage/index.tsx b/lib/libs/email/content/withdrawPackage/index.tsx
index e9ef7c9315..0761ed6d37 100644
--- a/lib/libs/email/content/withdrawPackage/index.tsx
+++ b/lib/libs/email/content/withdrawPackage/index.tsx
@@ -29,7 +29,7 @@ export const withdrawPackage: AuthoritiesWithUserTypesTemplate = {
to: variables.allStateUsersEmails?.length
? variables.allStateUsersEmails
: [`${variables.submitterName} <${variables.submitterEmail}>`],
- subject: `Medicaid SPA Package ${variables.id} Withdrawal Confirmation`,
+ subject: `SPA Package ${variables.id} Withdrawal Request`,
body: await render(),
};
},
@@ -56,7 +56,7 @@ export const withdrawPackage: AuthoritiesWithUserTypesTemplate = {
to: variables.allStateUsersEmails?.length
? variables.allStateUsersEmails
: [`${variables.submitterName} <${variables.submitterEmail}>`],
- subject: `CHIP SPA Package ${variables.id} Withdrawal Confirmation`,
+ subject: `CHIP SPA Package ${variables.id} Withdraw Request`,
body: await render(),
};
},
diff --git a/lib/libs/email/getAllStateUsers.test.ts b/lib/libs/email/getAllStateUsers.test.ts
index 129b2acc3c..2906d151a0 100644
--- a/lib/libs/email/getAllStateUsers.test.ts
+++ b/lib/libs/email/getAllStateUsers.test.ts
@@ -31,4 +31,14 @@ describe("getAllStateUsers", () => {
const result = await getAllStateUsers({ userPoolId: USER_POOL_ID, state: "MA" });
expect(result).toEqual([]);
});
+
+ it("should ignore users with no email", async () => {
+ const result = await getAllStateUsers({ userPoolId: USER_POOL_ID, state: "AK" });
+ expect(result).toEqual([]);
+ });
+
+ it("should ignore users with invalid email formats", async () => {
+ const result = await getAllStateUsers({ userPoolId: USER_POOL_ID, state: "LA" });
+ expect(result).toEqual([]);
+ });
});
diff --git a/lib/libs/email/index.ts b/lib/libs/email/index.ts
index f09adbb33f..00586101f6 100644
--- a/lib/libs/email/index.ts
+++ b/lib/libs/email/index.ts
@@ -60,7 +60,7 @@ const emailTemplates: EmailTemplates = {
"contracting-renewal-state": EmailContent.newSubmission,
"capitated-renewal-state": EmailContent.newSubmission,
"respond-to-rai": EmailContent.respondToRai,
- "seatool-withdraw": EmailContent.withdrawPackage,
+ "seatool-withdraw": EmailContent.withdrawConfirmation,
"app-k": EmailContent.newSubmission,
"upload-subsequent-documents": EmailContent.uploadSubsequentDocuments,
};
@@ -84,21 +84,21 @@ function hasAuthority(
export async function getEmailTemplates(
record: Events[keyof Events],
): Promise[]> {
- const event = record.event;
- if (!event || !(event in emailTemplates)) {
- console.log("No template found");
- return [];
- }
+ const { event } = record;
+
+ const emailTemplate = emailTemplates[event as keyof EmailTemplates];
+
+ if (event in emailTemplates && hasAuthority(record)) {
+ const authorityTemplates = emailTemplate[record.authority.toLowerCase() as Authority];
- const template = emailTemplates[event as keyof EmailTemplates];
- if (hasAuthority(record)) {
- const authorityTemplates = (template as AuthoritiesWithUserTypesTemplate)[
- record.authority.toLowerCase() as Authority
- ];
- return authorityTemplates ? Object.values(authorityTemplates) : [];
- } else {
- return Object.values(template as UserTypeOnlyTemplate);
+ if (authorityTemplates) {
+ return Object.values(authorityTemplates);
+ }
+
+ throw new Error("No email template found for authority");
}
+
+ throw new Error("Missing event authority or email template for event");
}
// I think this needs to be written to handle not finding any matching events and so forth
diff --git a/lib/libs/email/preview/RespondToRai/CMS/AppK.tsx b/lib/libs/email/preview/RespondToRai/CMS/AppK.tsx
deleted file mode 100644
index 11b4fb4925..0000000000
--- a/lib/libs/email/preview/RespondToRai/CMS/AppK.tsx
+++ /dev/null
@@ -1,23 +0,0 @@
-import { WaiverCMSEmail } from "libs/email/content/respondToRai/emailTemplates";
-import { emailTemplateValue } from "libs/email/mock-data/respond-to-rai";
-import * as attachments from "../../../mock-data/attachments";
-
-export default () => {
- return (
-
- );
-};
diff --git a/lib/libs/email/preview/RespondToRai/CMS/ResToRaiCMS.test.tsx b/lib/libs/email/preview/RespondToRai/CMS/ResToRaiCMS.test.tsx
index 20e13ad7f6..58809e7058 100644
--- a/lib/libs/email/preview/RespondToRai/CMS/ResToRaiCMS.test.tsx
+++ b/lib/libs/email/preview/RespondToRai/CMS/ResToRaiCMS.test.tsx
@@ -1,16 +1,10 @@
import { describe, it, expect } from "vitest";
import { render } from "@testing-library/react";
-import AppK from "./AppK";
import CHIP_SPA from "./CHIP_SPA";
import Medicaid_SPA from "./Medicaid_SPA";
-import Waiver_Capitated from "./Waiver_Capitated";
+import Waiver from "./Waiver";
describe("Respond To RAI CMS Email Snapshot Test", () => {
- it("renders a AppKCMSEmailPreview Preview Template", () => {
- const template = render();
-
- expect(template).toMatchSnapshot();
- });
it("renders a ChipSPA Preview Template", () => {
const template = render();
@@ -21,8 +15,8 @@ describe("Respond To RAI CMS Email Snapshot Test", () => {
expect(template).toMatchSnapshot();
});
- it("renders a Waiver Capitated Preview Template", () => {
- const template = render();
+ it("renders a Waiver Preview Template", () => {
+ const template = render();
expect(template).toMatchSnapshot();
});
diff --git a/lib/libs/email/preview/RespondToRai/CMS/Waiver_Capitated.tsx b/lib/libs/email/preview/RespondToRai/CMS/Waiver.tsx
similarity index 100%
rename from lib/libs/email/preview/RespondToRai/CMS/Waiver_Capitated.tsx
rename to lib/libs/email/preview/RespondToRai/CMS/Waiver.tsx
diff --git a/lib/libs/email/preview/RespondToRai/CMS/__snapshots__/ResToRaiCMS.test.tsx.snap b/lib/libs/email/preview/RespondToRai/CMS/__snapshots__/ResToRaiCMS.test.tsx.snap
index 3f171f9f85..453b44262a 100644
--- a/lib/libs/email/preview/RespondToRai/CMS/__snapshots__/ResToRaiCMS.test.tsx.snap
+++ b/lib/libs/email/preview/RespondToRai/CMS/__snapshots__/ResToRaiCMS.test.tsx.snap
@@ -1,6 +1,6 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
-exports[`Respond To RAI CMS Email Snapshot Test > renders a AppKCMSEmailPreview Preview Template 1`] = `
+exports[`Respond To RAI CMS Email Snapshot Test > renders a ChipSPA Preview Template 1`] = `
{
"asFragment": [Function],
"baseElement":
@@ -21,9 +21,9 @@ exports[`Respond To RAI CMS Email Snapshot Test > renders a AppKCMSEmailPreview
- Appendix K Amendment Submitted
+ RAI Response for CO-24-1234 Submitted
-
+
renders a AppKCMSEmailPreview
- The OneMAC Submission Portal received a 1915(c) Waiver RAI Response
- Submission:
+ The OneMAC Submission Portal received a CHIP SPA RAI Response Submission
-
@@ -263,7 +261,7 @@ exports[`Respond To RAI CMS Email Snapshot Test > renders a AppKCMSEmailPreview
- Waiver Number
+ CHIP SPA Package ID
:
@@ -273,7 +271,7 @@ exports[`Respond To RAI CMS Email Snapshot Test > renders a AppKCMSEmailPreview
- CO-1234.R21.00
+ CO-24-1234
@@ -350,7 +348,7 @@ exports[`Respond To RAI CMS Email Snapshot Test > renders a AppKCMSEmailPreview
- 1915(c) Appendix K Amendment Waiver Template
+ Other
:
@@ -364,7 +362,7 @@ exports[`Respond To RAI CMS Email Snapshot Test > renders a AppKCMSEmailPreview
style="font-size: 14px; line-height: 1.4; margin: 4px 0px 4px 0px; color: rgb(51, 51, 51);"
>
- appendix-k-amendment.docx
+ misc-documents.pdf
@@ -417,2930 +415,190 @@ exports[`Respond To RAI CMS Email Snapshot Test > renders a AppKCMSEmailPreview
-
- Thank you.
-
-
-
-
-
-
-
-
-
-
-
- U.S. Centers for Medicare & Medicaid Services
-
-
- ©
- 2023
- | 7500 Security Boulevard, Baltimore, MD 21244
-
- |
-
-
-
- |
-
-
-
-
-
-
-
-
-
-
-