Skip to content

Commit

Permalink
feat(emails): CHIP SPA Withdraw Package emails for CMS/State (#870)
Browse files Browse the repository at this point in the history
* fix: update `email-dev` command

* chore: update type for `PackageDetails`

* feat: add `WithdrawPackage` to `Events`

* chore: remove string from unnecessary curly braces

* chore: rename folder and create new withdraw request emails for state/CMS

* chore: rename `widthdraw` to `withdraw`

* chore: add attachments for `withdraw-package`

* feat: add previews for CMS/State `withdraw-package`

* chore: JSX removed from template literal

* feat: update ChipSpaCMS email to have a spam notice

* feat: create additional notice for further questions

* chore: move notice to email body

* chore: change ! to .
  • Loading branch information
asharonbaltazar authored and RanyeM committed Dec 2, 2024
1 parent 36cb06f commit 38f6a16
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 85 deletions.
5 changes: 3 additions & 2 deletions lib/libs/email/content/email-components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,9 @@ const WithdrawRAI = ({
}) => (
<Section>
<Heading as="h2">
{`The OneMAC Submission Portal received a request to withdraw the Formal RAI Response. You are
receiving this email notification as the Formal RAI for ${id} was withdrawn by ${submitterName} ${submitterEmail}.`}
The OneMAC Submission Portal received a request to withdraw the Formal RAI Response. You are
receiving this email notification as the Formal RAI for {id} was withdrawn by {submitterName}{" "}
{submitterEmail}.
</Heading>
</Section>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { CommonEmailVariables, Events } from "shared-types";
import { SpamWarning, PackageDetails, BasicFooter } from "../../email-components";
import { BaseEmailTemplate } from "../../email-templates";

export const WaiverCMSEmail = ({
variables,
}: {
variables: Events["WithdrawPackage"] & CommonEmailVariables;
}) => {
const previewText = `Withdrawal of ${variables.authority} ${variables.id}`;
const heading =
"The OneMAC Submission Portal received a request to withdraw the package below. The package will no longer be considered for CMS review:";
return (
<BaseEmailTemplate
previewText={previewText}
heading={heading}
applicationEndpointUrl={variables.applicationEndpointUrl}
footerContent={<BasicFooter />}
>
<PackageDetails
details={{
"State or territory": variables.territory,
Name: variables.submitterName,
"Email Address": variables.submitterEmail,
"Waiver Number": variables.id,
Summary: variables.additionalInformation,
}}
/>
<SpamWarning />
</BaseEmailTemplate>
);
};
65 changes: 5 additions & 60 deletions lib/libs/email/content/withdrawPackage/index.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,24 @@
import { Events, Authority, CommonEmailVariables, EmailAddresses } from "shared-types";
import { Authority, CommonEmailVariables, EmailAddresses } from "shared-types";
import { AuthoritiesWithUserTypesTemplate } from "../..";
import {
MedSpaCMSEmail,
MedSpaStateEmail,
ChipSpaCMSEmail,
ChipSpaStateEmail,
WaiverCMSEmail,
WaiverStateEmail,
} from "./emailTemplates";
import { render } from "@react-email/render";

export const withdrawPackage: AuthoritiesWithUserTypesTemplate = {
[Authority.MED_SPA]: {
cms: async (
variables: Events["WithdrawPackage"] & CommonEmailVariables & { emails: EmailAddresses },
) => {
cms: async (variables: any & CommonEmailVariables & { emails: EmailAddresses }) => {
return {
to: variables.emails.osgEmail,
cc: variables.emails.dpoEmail,
subject: `SPA Package ${variables.id} Withdraw Request`,
body: await render(<MedSpaCMSEmail variables={variables} />),
};
},
state: async (
variables: Events["WithdrawPackage"] & CommonEmailVariables & { emails: EmailAddresses },
) => {
state: async (variables: any & CommonEmailVariables & { emails: EmailAddresses }) => {
return {
to: [`${variables.submitterName} <${variables.submitterEmail}>`],
subject: `Medicaid SPA Package ${variables.id} Withdrawal Confirmation`,
Expand All @@ -33,19 +27,15 @@ export const withdrawPackage: AuthoritiesWithUserTypesTemplate = {
},
},
[Authority.CHIP_SPA]: {
cms: async (
variables: Events["WithdrawPackage"] & CommonEmailVariables & { emails: EmailAddresses },
) => {
cms: async (variables: any & CommonEmailVariables & { emails: EmailAddresses }) => {
return {
to: [...variables.emails.cpocEmail, ...variables.emails.srtEmails],
cc: variables.emails.chipCcList,
subject: `CHIP SPA Package ${variables.id} Withdraw Request`,
body: await render(<ChipSpaCMSEmail variables={variables} />),
};
},
state: async (
variables: Events["WithdrawPackage"] & CommonEmailVariables & { emails: EmailAddresses },
) => {
state: async (variables: any & CommonEmailVariables & { emails: EmailAddresses }) => {
return {
to: [
...variables.emails.cpocEmail,
Expand All @@ -58,49 +48,4 @@ export const withdrawPackage: AuthoritiesWithUserTypesTemplate = {
};
},
},
[Authority["1915b"]]: {
cms: async (
variables: Events["WithdrawPackage"] & CommonEmailVariables & { emails: EmailAddresses },
) => {
return {
to: variables.emails.osgEmail,
subject: `Waiver Package ${variables.id} Withdraw Request`,
body: await render(<WaiverCMSEmail variables={variables} />),
};
},
state: async (
variables: Events["WithdrawPackage"] & CommonEmailVariables & { emails: EmailAddresses },
) => {
return {
to: [`${variables.submitterName} <${variables.submitterEmail}>`], // TODO: change to ALL state users
subject: `Waiver Package ${variables.id} Withdraw Request`,
body: await render(<WaiverStateEmail variables={variables} />),
};
},
},

[Authority["1915c"]]: {
cms: async (
variables: Events["WithdrawPackage"] & CommonEmailVariables & { emails: EmailAddresses },
) => {
return {
to: [
...variables.emails.osgEmail,
...variables.emails.cpocEmail,
...variables.emails.srtEmails,
],
subject: `Waiver Package ${variables.id} Withdraw Request`,
body: await render(<WaiverCMSEmail variables={variables} />),
};
},
state: async (
variables: Events["WithdrawPackage"] & CommonEmailVariables & { emails: EmailAddresses },
) => {
return {
to: [`${variables.submitterName} <${variables.submitterEmail}>`], // TODO: change to ALL state users
subject: `Waiver Package ${variables.id} Withdraw Request`,
body: await render(<WaiverStateEmail variables={variables} />),
};
},
},
};
44 changes: 21 additions & 23 deletions lib/libs/email/content/withdrawRai/emailTemplates/AppKCMS.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,28 @@
import { CommonEmailVariables, Events, RelatedEventType } from "shared-types";
import { Attachments, PackageDetails, BasicFooter, SpamWarning } from "../../email-components";
import { BaseEmailTemplate } from "../../email-templates";
import { CommonEmailVariables } from "shared-types";
import { RaiWithdraw } from "shared-types";
import { Html, Container } from "@react-email/components";
import { WithdrawRAI, PackageDetails, BasicFooter } from "../../email-components";

export const AppKCMSEmail = (props: {
variables: Events["RespondToRai"] & CommonEmailVariables;
relatedEvent: RelatedEventType;
variables: RaiWithdraw & CommonEmailVariables;
relatedEvent: any;
}) => {
const { variables, relatedEvent } = { ...props };
return (
<BaseEmailTemplate
previewText="Withdraw Formal RAI Response for Waiver Package"
heading={`The OneMAC Submission Portal received a request to withdraw the Formal RAI Response. You are receiving this email notification as the Formal RAI for ${variables.id} was withdrawn by ${variables.submitterName} ${variables.submitterEmail}.`}
applicationEndpointUrl={variables.applicationEndpointUrl}
footerContent={<BasicFooter />}
>
<PackageDetails
details={{
"State or territory": variables.territory,
Name: relatedEvent.submitterName,
"Email Address": relatedEvent.submitterEmail,
"Waiver Number": variables.id,
Summary: variables.additionalInformation,
}}
/>
<Attachments attachments={variables.attachments} />
<SpamWarning />
</BaseEmailTemplate>
<Html lang="en" dir="ltr">
<Container>
<WithdrawRAI {...variables} />
<PackageDetails
details={{
"State or territory": variables.territory,
Name: relatedEvent.submitterName,
"Email Address": relatedEvent.submitterEmail,
"Waiver Number": variables.id,
Summary: variables.additionalInformation,
}}
/>
<BasicFooter />
</Container>
</Html>
);
};

0 comments on commit 38f6a16

Please sign in to comment.