Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | 4x 1x 1x 1x 1x | import { render } from "@react-email/render"; import { userRoleMap } from "shared-utils"; import { AccessChangeNoticeEmail, AccessPendingNoticeEmail, AdminPendingNoticeEmail, SelfRevokeAdminChangeEmail, } from "./emailTemplates"; import { statesMap, statusMap, userRoleType } from "./roleHelper"; export type UserRoleEmailType = { role: userRoleType; status: keyof typeof statusMap; applicationEndpointUrl: string; territory: keyof typeof statesMap | "N/A"; fullName: string; email: string; doneBy: string; doneByEmail: string; approverList: string[]; }; export const userRoleTemplate = { AccessChangeNotice: async (variables: UserRoleEmailType) => { const roleDisplay = userRoleMap[variables.role]; const stateAccess = variables.territory === "N/A" ? "" : ` for ${statesMap[variables.territory]}`; return { to: [`${variables.fullName} <${variables.email}>`], subject: `Your OneMAC ${roleDisplay} Access${stateAccess} has been ${statusMap[variables.status]}`, body: await render(<AccessChangeNoticeEmail variables={variables} />), }; }, AccessPendingNotice: async (variables: UserRoleEmailType) => { return { to: [`${variables.fullName} <${variables.email}>`], subject: "Your OneMAC Role Access is Pending Review", body: await render(<AccessPendingNoticeEmail variables={variables} />), }; }, AdminPendingNotice: async (variables: UserRoleEmailType) => { const roleDisplay = userRoleMap[variables.role]; const approverList = variables.approverList; return { to: approverList, subject: `New OneMAC ${roleDisplay} Access Request`, body: await render(<AdminPendingNoticeEmail variables={variables} />), }; }, SelfRevokeAdminChangeEmail: async (variables: UserRoleEmailType) => { const stateAccess = variables.territory === "N/A" ? "" : ` for ${statesMap[variables.territory]}`; const approverList = variables.approverList; return { to: approverList, subject: `OneMAC State access for ${stateAccess} was self-revoked by ${variables.fullName}`, body: await render(<SelfRevokeAdminChangeEmail variables={variables} />), }; }, }; |