Skip to content

Commit

Permalink
Merge branch 'main' into bpe
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminpaige committed Nov 29, 2024
2 parents 39fc247 + 380a573 commit f7cffaa
Show file tree
Hide file tree
Showing 72 changed files with 1,438 additions and 881 deletions.
57 changes: 39 additions & 18 deletions lib/libs/email/content/email-components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,29 +63,37 @@ const EmailNav = ({ appEndpointUrl }: { appEndpointUrl: string }) => (
</Section>
);

const LoginInstructions = ({ appEndpointURL }: { appEndpointURL: string }) => (
const LoginInstructions = ({
appEndpointURL,
useThisLink,
}: {
appEndpointURL: string;
useThisLink?: boolean;
}) => (
<ul style={{ marginLeft: "-20px" }}>
<li>
<Text style={styles.text.description}>
The submission can be accessed in the OneMAC application at{" "}
<Link href={appEndpointURL}>{appEndpointURL}</Link>
The submission can be accessed in the OneMAC application, which you can find at{" "}
<Link href={appEndpointURL}>{useThisLink ? "this link" : appEndpointURL}</Link>.
</Text>
</li>
<li>
<Text style={styles.text.description}>
If not logged in, click "Login" at the top and use your Enterprise User Administration (EUA)
credentials.
If you are not already logged in, please click the "Login" link at the top of the page and
log in using your Enterprise User Administration (EUA) credentials.
</Text>
</li>
<li>
<Text style={styles.text.description}>
After logging in, you'll see the submission listed on the dashboard. Click its ID number to
view details.
After you have logged in, you will be taken to the OneMAC application. The submission will
be listed on the dashboard page, and you can view its details by clicking on its ID number.
</Text>
</li>
</ul>
);

const Divider = () => <Hr style={styles.divider} />;

const DetailsHeading = () => (
<div>
<Hr style={styles.divider} />
Expand Down Expand Up @@ -154,15 +162,15 @@ const PackageDetails = ({ details }: { details: Record<string, ReactNode> }) =>
Summary:
</Heading>
</Text>
<Textarea>{value ?? "No additional information submitted"}</Textarea>
<Text>{value ?? "No additional information submitted"}</Text>
</Row>
);
}

return (
<Row key={label + index}>
<Column align="left" style={{ width: "50%" }}>
<Text style={styles.text.title}>{label}</Text>
<Text style={styles.text.title}>{label}:</Text>
</Column>
<Column>
<Text style={styles.text.description}>{value ?? "Not provided"}</Text>
Expand Down Expand Up @@ -197,27 +205,39 @@ const SpamNotice = () => (
);

const ContactStateLead = ({ isChip }: { isChip?: boolean }) => (
<Section
style={{
...styles.section.footer,
paddingLeft: "16px",
paddingRight: "16px",
}}
>
<Section>
<Divider />
<Text style={{ fontSize: "14px" }}>
If you have questions or did not expect this email, please contact{" "}
<Link
href={`mailto:${isChip ? EMAIL_CONFIG.CHIP_EMAIL : EMAIL_CONFIG.SPA_EMAIL}`}
style={{ color: "#fff", textDecoration: "underline" }}
style={{ textDecoration: "underline" }}
>
{isChip ? EMAIL_CONFIG.CHIP_EMAIL : EMAIL_CONFIG.SPA_EMAIL}
</Link>{" "}
or your state lead.
</Text>
<Text>Thank you!</Text>
<Text>Thank you.</Text>
</Section>
);

export const SpamWarning = () => {
return (
<Section>
<Divider />
<Text style={{ fontSize: "14px" }}>
If the contents of this email seem suspicious, do not open them, and instead forward this
email to{" "}
<Link style={{ textDecoration: "underline" }} href={`mailto:${EMAIL_CONFIG.SPAM_EMAIL}`}>
{EMAIL_CONFIG.SPAM_EMAIL}
</Link>
.
</Text>
<Text>Thank you.</Text>
</Section>
);
};

const EmailFooter = ({ children }: { children: React.ReactNode }) => (
<Section style={styles.section.footer}>{children}</Section>
);
Expand Down Expand Up @@ -278,6 +298,7 @@ export {
EmailNav,
LoginInstructions,
DetailsHeading,
Divider,
Attachments,
PackageDetails,
MailboxNotice,
Expand Down
13 changes: 7 additions & 6 deletions lib/libs/email/content/new-submission/emailTemplates/AppKCMS.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Events, CommonEmailVariables } from "shared-types";

import {
LoginInstructions,
PackageDetails,
BasicFooter,
DetailsHeading,
Attachments,
BasicFooter,
SpamWarning,
Divider,
} from "../../email-components";
import { BaseEmailTemplate } from "../../email-templates";
import { formatDate } from "shared-utils";
Expand All @@ -21,21 +21,22 @@ export const AppKCMSEmail = ({ variables }: { variables: AppKEmailProps }) => {
applicationEndpointUrl={variables.applicationEndpointUrl}
footerContent={<BasicFooter />}
>
<DetailsHeading />
<LoginInstructions appEndpointURL={variables.applicationEndpointUrl} />
<Divider />
<LoginInstructions appEndpointURL={variables.applicationEndpointUrl} useThisLink />
<PackageDetails
details={{
"State or territory": variables.territory,
Name: variables.submitterName,
"Email Address": variables.submitterEmail,
"Amendment Title": variables.title ?? null,
"Waiver Amendment Number": variables.id,
"Waiver Authority": variables.seaActionType,
"Waiver Authority": variables.actionType,
"Proposed Effective Date": formatDate(variables.proposedEffectiveDate),
Summary: variables.additionalInformation,
}}
/>
<Attachments attachments={variables.attachments} />
<SpamWarning />
</BaseEmailTemplate>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { CommonEmailVariables, Events } from "shared-types";
import { formatNinetyDaysDate, formatDate } from "shared-utils";
import {
PackageDetails,
BasicFooter,
ContactStateLead,
DetailsHeading,
Attachments,
Divider,
MailboxNotice,
} from "../../email-components";
import { BaseEmailTemplate } from "../../email-templates";
Expand All @@ -22,28 +22,29 @@ export const AppKStateEmail = (props: {
previewText={previewText}
heading={heading}
applicationEndpointUrl={variables.applicationEndpointUrl}
footerContent={<ContactStateLead />}
footerContent={<BasicFooter />}
>
<DetailsHeading />
<Divider />
<PackageDetails
details={{
"State or territory": variables.territory,
Name: variables.submitterName,
"Email Address": variables.submitterEmail,
"Initial Waiver Numbers": variables.waiverIds.join(", "),
"Waiver Authority": variables.seaActionType,
"Initial Waiver Number": variables.id,
"Waiver Authority": variables.actionType,
"Proposed Effective Date": formatDate(variables.proposedEffectiveDate),
"90th Day Deadline": formatNinetyDaysDate(variables.timestamp),
Summary: variables.additionalInformation,
}}
/>
<Attachments attachments={variables.attachments} />
<Divider />
<Text style={styles.text.description}>
{`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)}.`}
</Text>
<ContactStateLead />
<MailboxNotice type="Waiver" />
</BaseEmailTemplate>
);
Expand Down

This file was deleted.

38 changes: 38 additions & 0 deletions lib/libs/email/content/respondToRai/emailTemplates/WaiverCMS.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { Events, CommonEmailVariables } from "shared-types";
import {
LoginInstructions,
PackageDetails,
Attachments,
BasicFooter,
SpamWarning,
} from "../../email-components";
import { BaseEmailTemplate } from "../../email-templates";

export const WaiverCMSEmail = (props: {
variables: Events["RespondToRai"] & CommonEmailVariables;
}) => {
const variables = props.variables;
return (
<BaseEmailTemplate
previewText="Appendix K Amendment Submitted"
heading={`The OneMAC Submission Portal received a ${variables.authority} Waiver RAI Response
Submission:`}
applicationEndpointUrl={variables.applicationEndpointUrl}
footerContent={<BasicFooter />}
>
<h3></h3>
<LoginInstructions appEndpointURL={variables.applicationEndpointUrl} />
<PackageDetails
details={{
"State or territory": variables.territory,
Name: variables.submitterName,
"Email Address": variables.submitterEmail,
"Waiver Number": variables.id,
Summary: variables.additionalInformation,
}}
/>
<Attachments attachments={variables.attachments} />
<SpamWarning />
</BaseEmailTemplate>
);
};
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
import { formatNinetyDaysDate } from "shared-utils";
import { CommonEmailVariables, Events } from "shared-types";
import { Text } from "@react-email/components";
import { PackageDetails, MailboxNotice, ContactStateLead } from "../../email-components";
import {
PackageDetails,
MailboxNotice,
BasicFooter,
ContactStateLead,
Divider,
} from "../../email-components";
import { BaseEmailTemplate } from "../../email-templates";
import { styles } from "../../email-styles";

export const Waiver1915bStateEmail = (props: {
export const WaiverStateEmail = (props: {
variables: Events["RespondToRai"] & CommonEmailVariables;
}) => {
const variables = props.variables;
const previewText = `Appendix K Amendment Submitted`;
const heading = "This response confirms the submission of your 1915(c) Waiver to CMS for review";
const heading = `This response confirms the submission of your ${variables.authority} RAI Response to CMS for review:`;
return (
<BaseEmailTemplate
previewText={previewText}
heading={heading}
applicationEndpointUrl={variables.applicationEndpointUrl}
footerContent={<ContactStateLead />}
footerContent={<BasicFooter />}
>
<PackageDetails
details={{
Expand All @@ -29,13 +35,15 @@ export const Waiver1915bStateEmail = (props: {
Summary: variables.additionalInformation,
}}
/>
<Divider />
<Text style={styles.text.description}>
{`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)}`}
.
</Text>
<MailboxNotice type="Waiver" />
<ContactStateLead />
</BaseEmailTemplate>
);
};
4 changes: 2 additions & 2 deletions lib/libs/email/content/respondToRai/emailTemplates/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ export { MedSpaCMSEmail } from "./MedSpaCMS";
export { MedSpaStateEmail } from "./MedSpaState";
export { ChipSpaCMSEmail } from "./ChipSpaCMS";
export { ChipSpaStateEmail } from "./ChipSpaState";
export { Waiver1915bCMSEmail } from "./Waiver1915bCMS";
export { Waiver1915bStateEmail } from "./Waiver1915bState";
export { WaiverCMSEmail } from "./WaiverCMS";
export { WaiverStateEmail } from "./WaiverState";
36 changes: 31 additions & 5 deletions lib/libs/email/content/respondToRai/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import {
MedSpaStateEmail,
ChipSpaCMSEmail,
ChipSpaStateEmail,
Waiver1915bCMSEmail,
Waiver1915bStateEmail,
WaiverCMSEmail,
WaiverStateEmail,
} from "./emailTemplates";
import { render } from "@react-email/render";

Expand Down Expand Up @@ -72,7 +72,7 @@ export const respondToRai: AuthoritiesWithUserTypesTemplate = {
...variables.emails.srtEmails,
],
subject: `Waiver RAI Response for ${variables.id} Submitted`,
body: await render(<Waiver1915bCMSEmail variables={variables} />),
body: await render(<WaiverCMSEmail variables={variables} />),
};
},
state: async (
Expand All @@ -81,8 +81,34 @@ export const respondToRai: AuthoritiesWithUserTypesTemplate = {
return {
to: [`${variables.submitterName} <${variables.submitterEmail}>`],
cc: variables.allStateUsersEmails,
subject: `Your Waiver Response for ${variables.id} has been submitted to CMS`,
body: await render(<Waiver1915bStateEmail variables={variables} />),
subject: `Your 1915(b) RAI Response for ${variables.id} has been submitted to CMS`,
body: await render(<WaiverStateEmail variables={variables} />),
};
},
},
[Authority["1915c"]]: {
cms: async (
variables: Events["RespondToRai"] & CommonEmailVariables & { emails: EmailAddresses },
) => {
return {
to: [
...variables.emails.osgEmail,
...variables.emails.dmcoEmail,
...variables.emails.cpocEmail,
...variables.emails.srtEmails,
],
subject: `Waiver RAI Response for ${variables.id} Submitted`,
body: await render(<WaiverCMSEmail variables={variables} />),
};
},
state: async (
variables: Events["RespondToRai"] & CommonEmailVariables & { emails: EmailAddresses },
) => {
return {
to: [`${variables.submitterName} <${variables.submitterEmail}>`],
cc: variables.allStateUsersEmails,
subject: `Your 1915(c) RAI Response for ${variables.id} has been submitted to CMS`,
body: await render(<WaiverStateEmail variables={variables} />),
};
},
},
Expand Down
Loading

0 comments on commit f7cffaa

Please sign in to comment.