diff --git a/lib/libs/email/content/index.ts b/lib/libs/email/content/index.ts index d9bd5d3f8a..7ae4b2c128 100644 --- a/lib/libs/email/content/index.ts +++ b/lib/libs/email/content/index.ts @@ -5,3 +5,4 @@ export * from "./withdrawRai"; export * from "./withdrawPackage"; export * from "./email-components"; export * from "./respondToRai"; +export * from "./upload-subsequent-documents"; diff --git a/lib/libs/email/content/upload-subsequent-documents/emailTemplates/ChipSpaCMS.tsx b/lib/libs/email/content/upload-subsequent-documents/emailTemplates/ChipSpaCMS.tsx new file mode 100644 index 0000000000..0be5c1cd58 --- /dev/null +++ b/lib/libs/email/content/upload-subsequent-documents/emailTemplates/ChipSpaCMS.tsx @@ -0,0 +1,47 @@ +import { CommonEmailVariables, Events } from "shared-types"; +import { PackageDetails, BasicFooter, Attachments } from "../../email-components"; +import { BaseEmailTemplate } from "../../email-templates"; +import { styles } from "../../email-styles"; +import { Text } from "@react-email/components"; + +export const ChipSpaCMSEmail = (props: { + variables: Events["UploadSubsequentDocuments"] & CommonEmailVariables; +}) => { + const variables = props.variables; + const previewText = `Action required: review new documents for CHIP SPA ${variables.id} in OneMAC.`; + const heading = `New documents have been submitted for CHIP SPA ${variables.id} in OneMAC.`; + return ( + } + > + + + + How to Access: + + + • These documents can be found in OneMAC through this link{" "} + + {variables.applicationEndpointUrl} + + + + • If you are not already logged in, click “Login” at the top of the page and log in using + your Enterprise User Administration (EUA) credentials. + + + • After you logged in, click the submission ID number on the dashboard page to view details. + + Thank you. + + ); +}; diff --git a/lib/libs/email/content/upload-subsequent-documents/emailTemplates/ChipSpaState.tsx b/lib/libs/email/content/upload-subsequent-documents/emailTemplates/ChipSpaState.tsx new file mode 100644 index 0000000000..2ca4d4ba31 --- /dev/null +++ b/lib/libs/email/content/upload-subsequent-documents/emailTemplates/ChipSpaState.tsx @@ -0,0 +1,44 @@ +import { Events } from "shared-types"; +import { CommonEmailVariables } from "shared-types"; +import { Text } from "@react-email/components"; +import { + PackageDetails, + ContactStateLead, + DetailsHeading, + Attachments, +} from "../../email-components"; +import { BaseEmailTemplate } from "../../email-templates"; +import { styles } from "../../email-styles"; + +export const ChipSpaStateEmail = (props: { + variables: Events["UploadSubsequentDocuments"] & CommonEmailVariables; +}) => { + const variables = props.variables; + const previewText = `Additional documents submitted for CHIP SPA ${variables.id}`; + const heading = `You’ve successfully submitted the following to CMS reviewers for CHIP SPA ${variables.id}`; + + return ( + } + > + + + + + If you have questions or did not expect this email, please contact your CPOC. + + Thank you. + + ); +}; diff --git a/lib/libs/email/content/upload-subsequent-documents/emailTemplates/index.tsx b/lib/libs/email/content/upload-subsequent-documents/emailTemplates/index.tsx new file mode 100644 index 0000000000..fd031f1134 --- /dev/null +++ b/lib/libs/email/content/upload-subsequent-documents/emailTemplates/index.tsx @@ -0,0 +1,2 @@ +export { ChipSpaCMSEmail } from "./ChipSpaCMS"; +export { ChipSpaStateEmail } from "./ChipSpaState"; diff --git a/lib/libs/email/content/upload-subsequent-documents/index.tsx b/lib/libs/email/content/upload-subsequent-documents/index.tsx new file mode 100644 index 0000000000..2ed7f8e1c5 --- /dev/null +++ b/lib/libs/email/content/upload-subsequent-documents/index.tsx @@ -0,0 +1,30 @@ +import { Events, Authority, EmailAddresses, CommonEmailVariables } from "shared-types"; +import { AuthoritiesWithUserTypesTemplate } from "../.."; +import { ChipSpaCMSEmail, ChipSpaStateEmail } from "./emailTemplates"; +import { render } from "@react-email/render"; + +export const uploadSubsequentDocuments: AuthoritiesWithUserTypesTemplate = { + [Authority.CHIP_SPA]: { + cms: async ( + variables: Events["UploadSubsequentDocuments"] & + CommonEmailVariables & { emails: EmailAddresses }, + ) => { + return { + to: variables.emails.chipInbox, + cc: variables.emails.chipCcList, + subject: `Action required: review new documents for ${variables.actionType + variables.id}`, + body: await render(), + }; + }, + state: async ( + variables: Events["UploadSubsequentDocuments"] & + CommonEmailVariables & { emails: EmailAddresses }, + ) => { + return { + to: [`${variables.submitterName} <${variables.submitterEmail}>`], + subject: `Additional documents submitted for ${variables.actionType + variables.id}`, + body: await render(), + }; + }, + }, +}; diff --git a/lib/libs/email/mock-data/upload-subsequent-documents.ts b/lib/libs/email/mock-data/upload-subsequent-documents.ts new file mode 100644 index 0000000000..4548997448 --- /dev/null +++ b/lib/libs/email/mock-data/upload-subsequent-documents.ts @@ -0,0 +1,41 @@ +export const emailTemplateValue = { + territory: "CO", + applicationEndpointUrl: "https://mako-dev.cms.gov/", + actionType: "Upload-Subsequent-Documents", + origin: "mako" as const, + requestedDate: Date.now() - 5 * 24 * 60 * 60, + withdrawnDate: Date.now(), + attachments: { + cmsForm179: { + files: [ + { + filename: "withdraw-documentation.pdf", + title: "withdraw-documentation", + bucket: "mako-outbox-attachments-635052997545", + key: "b545ea14-6b1b-47c0-a374-743fcba4391f.pdf", + uploadDate: 1728493782785, + }, + ], + label: "CMS Form 179", + }, + spaPages: { + files: [ + { + filename: "Addditional Information.pdf", + title: "Addditional Information", + bucket: "mako-outbox-attachments-635052997545", + key: "f581c0ec-cbb2-4875-a384-86c06136f4c4.pdf", + uploadDate: 1728493784252, + }, + ], + label: "SPA Pages", + }, + }, + additionalInformation: + "This some additional infornormaiton about the request to withdraw and what makes it important.", + submitterName: "George Harrison", + submitterEmail: "george@example.com", + timestamp: 1723390633663, + event: "upload-subsequent-documents" as const, + id: "CA-10001-0003", +}; diff --git a/lib/libs/email/preview/Upload Subsequent Documents/CMS/CHIP_SPA.tsx b/lib/libs/email/preview/Upload Subsequent Documents/CMS/CHIP_SPA.tsx new file mode 100644 index 0000000000..0ee8ce9d25 --- /dev/null +++ b/lib/libs/email/preview/Upload Subsequent Documents/CMS/CHIP_SPA.tsx @@ -0,0 +1,27 @@ +import { ChipSpaCMSEmail } from "lib/libs/email/content/upload-subsequent-documents/emailTemplates/ChipSpaCMS"; +import { emailTemplateValue } from "lib/libs/email/mock-data/upload-subsequent-documents"; +import * as attachments from "lib/libs/email/mock-data/attachments"; + +const ChipSpaCMSEmailPreview = () => { + return ( + + ); +}; + +export default ChipSpaCMSEmailPreview; diff --git a/lib/libs/email/preview/Upload Subsequent Documents/State/CHIP_SPA.tsx b/lib/libs/email/preview/Upload Subsequent Documents/State/CHIP_SPA.tsx new file mode 100644 index 0000000000..5c1b7e9471 --- /dev/null +++ b/lib/libs/email/preview/Upload Subsequent Documents/State/CHIP_SPA.tsx @@ -0,0 +1,26 @@ +import { emailTemplateValue } from "lib/libs/email/mock-data/upload-subsequent-documents"; +import { ChipSpaStateEmail } from "lib/libs/email/content/upload-subsequent-documents/emailTemplates"; +import * as attachments from "lib/libs/email/mock-data/attachments"; +const ChipSpaStateEmailPreview = () => { + return ( + + ); +}; + +export default ChipSpaStateEmailPreview; diff --git a/lib/packages/shared-types/events/index.ts b/lib/packages/shared-types/events/index.ts index bc513baea5..d105594595 100644 --- a/lib/packages/shared-types/events/index.ts +++ b/lib/packages/shared-types/events/index.ts @@ -56,5 +56,6 @@ export type Events = { TempExtension: z.infer; NewAppKSubmission: z.infer; RespondToRai: z.infer; + UploadSubsequentDocuments: z.infer; WithdrawPackage: z.infer; }; diff --git a/lib/packages/shared-types/events/upload-subsequent-documents.ts b/lib/packages/shared-types/events/upload-subsequent-documents.ts index 5cc29cd40d..9cf2e90df7 100644 --- a/lib/packages/shared-types/events/upload-subsequent-documents.ts +++ b/lib/packages/shared-types/events/upload-subsequent-documents.ts @@ -2,9 +2,7 @@ import { z } from "zod"; import { attachmentArraySchemaOptional } from "../attachments"; export const baseSchema = z.object({ - event: z - .literal("upload-subsequent-documents") - .default("upload-subsequent-documents"), + event: z.literal("upload-subsequent-documents").default("upload-subsequent-documents"), additionalInformation: z.string().max(4000).default(null), attachments: z.record( z.string(),