-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Email templates - withdraw CHIP SPA, New Waiver, Response to Waiver R…
…AI (#463) * add withdraw chip spa package emails for cms and state * add 1915(b) Initial waiver emails * add 1915b rai response emails * fix 90 day lookup and withdraw chip spa template * consolidate 90days lookup * replace withdraw request confirmation with withdraw confirmation email * add withdraw 1915b waiver email * add notificationMetadata to the kafka event * refactor notificationMetaData to its own schema so it can be included on multiple action types * add notificationmetadata to rai response package action * fix merge error and simplify addtion of notificationMetadata to kafka message
- Loading branch information
1 parent
eaeea81
commit 33f513d
Showing
9 changed files
with
413 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { z } from "zod"; | ||
|
||
// This is addiitonal notification metadata needed for email | ||
export const notificationMetadataSchema = z.object({ | ||
proposedEffectiveDate: z.number().nullish(), | ||
submissionDate: z.number().nullish(), | ||
}); | ||
|
||
export type NotificationMetadata = z.infer<typeof notificationMetadataSchema>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,9 +33,11 @@ const formatDateFromTimestamp = (timestamp) => { | |
|
||
}; | ||
|
||
function formatNinetyDaysDate(emailBundle) { | ||
if (!emailBundle?.notificationMetadata?.submissionDate) return "Pending"; | ||
return DateTime.fromMillis(emailBundle.notificationMetadata.submissionDate) | ||
function formatNinetyDaysDate(data, lookupValues) { | ||
if (lookupValues?.ninetyDaysDate) | ||
return formatDateFromTimestamp(lookupValues?.ninetyDaysDate); | ||
if (!data?.notificationMetadata?.submissionDate) return "Pending"; | ||
return DateTime.fromMillis(data.notificationMetadata.submissionDate) | ||
.plus({ days: 90 }) | ||
.toFormat("DDDD '@ 11:59pm ET'"); | ||
|
||
|
@@ -57,9 +59,6 @@ export const buildEmailData = async (bundle, data) => { | |
case "proposedEffectiveDateNice": | ||
returnObject["proposedEffectiveDateNice"] = formatDateFromTimestamp(data?.notificationMetadata?.proposedEffectiveDate); | ||
break; | ||
case "ninetyDaysLookup": | ||
returnObject["ninetyDaysDateNice"] = formatDateFromTimestamp(lookupValues?.ninetyDaysDateLookup); | ||
break; | ||
case "applicationEndpoint": | ||
returnObject["applicationEndpoint"] = process.env.applicationEndpoint; | ||
break; | ||
|
@@ -69,8 +68,8 @@ export const buildEmailData = async (bundle, data) => { | |
case "textFileList": | ||
returnObject["textFileList"] = formatAttachments("text", data.attachments); | ||
break; | ||
case "ninetyDaysDateNice": | ||
returnObject["ninetyDaysDateNice"] = formatNinetyDaysDate(data); | ||
case "ninetyDaysDate": | ||
returnObject["ninetyDaysDate"] = formatNinetyDaysDate(data, lookupValues); | ||
break; | ||
case "submitter": | ||
returnObject["submitter"] = (data.submitterEmail === "[email protected]") ? "\"George's Substitute\" <[email protected]>" : `"${data.submitterName}" <${data.submitterEmail}>`; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ export const getOsInsightData = async (id) => { | |
console.log("Insights Item: ", JSON.stringify(osInsightsItem, null, 4)); | ||
returnData.cpoc = osInsightsItem?._source?.LEAD_ANALYST ? buildEmailsToSend(osInsightsItem?._source?.LEAD_ANALYST, osInsightsItem?._source?.STATE_PLAN.LEAD_ANALYST_ID) : "'CPOC Substitute' <[email protected]>"; | ||
returnData.srt = osInsightsItem?._source?.ACTION_OFFICERS ? buildEmailsToSend(osInsightsItem?._source?.ACTION_OFFICERS) : "'SRT Substitute' <[email protected]>"; | ||
returnData.ninetyDaysLookup = osInsightsItem?._source?.STATE_PLAN.ALERT_90_DAYS_DATE; | ||
returnData.ninetyDaysDate = osInsightsItem?._source?.STATE_PLAN.ALERT_90_DAYS_DATE; | ||
|
||
// const osChangeLogItem = await os.search(process.env.osDomain, "changelog", { | ||
// from: 0, | ||
|
Oops, something went wrong.