-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.tsx
107 lines (105 loc) · 3.7 KB
/
index.tsx
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
import { Events, Authority, EmailAddresses, CommonEmailVariables } from "shared-types";
import { formatActionType } from "shared-utils";
import { AuthoritiesWithUserTypesTemplate } from "../..";
import {
MedSpaCMSEmail,
MedSpaStateEmail,
ChipSpaCMSEmail,
ChipSpaStateEmail,
AppKCMSEmail,
AppKStateEmail,
Waiver1915bCMSEmail,
Waiver1915bStateEmail,
} from "./emailTemplates";
import { render } from "@react-email/render";
export const newSubmission: AuthoritiesWithUserTypesTemplate = {
[Authority.MED_SPA]: {
cms: async (
variables: Events["NewMedicaidSubmission"] &
CommonEmailVariables & { emails: EmailAddresses },
) => {
return {
to: variables.emails.osgEmail,
subject: `Medicaid SPA ${variables.id} Submitted`,
body: await render(<MedSpaCMSEmail variables={variables} />),
};
},
state: async (
variables: Events["NewMedicaidSubmission"] &
CommonEmailVariables & { emails: EmailAddresses },
) => {
return {
to: [`${variables.submitterName} <${variables.submitterEmail}>`],
subject: `Your SPA ${variables.id} has been submitted to CMS`,
body: await render(<MedSpaStateEmail variables={variables} />),
};
},
},
[Authority.CHIP_SPA]: {
cms: async (
variables: Events["NewChipSubmission"] & CommonEmailVariables & { emails: EmailAddresses },
) => {
return {
to: variables.emails.chipInbox,
cc: variables.emails.chipCcList,
subject: `New CHIP SPA ${variables.id} Submitted`,
body: await render(<ChipSpaCMSEmail variables={variables} />),
};
},
state: async (
variables: Events["NewChipSubmission"] & CommonEmailVariables & { emails: EmailAddresses },
) => {
return {
to: [`${variables.submitterName} <${variables.submitterEmail}>`],
subject: `Your CHIP SPA ${variables.id} has been submitted to CMS`,
body: await render(<ChipSpaStateEmail variables={variables} />),
};
},
},
[Authority["1915b"]]: {
cms: async (
variables:
| (Events["CapitatedInitial"] & CommonEmailVariables & { emails: EmailAddresses })
| (Events["ContractingInitial"] & CommonEmailVariables & { emails: EmailAddresses }),
) => {
return {
to: variables.emails.osgEmail,
subject: `${variables.authority} ${variables.id} Submitted`,
body: await render(<Waiver1915bCMSEmail variables={variables} />),
};
},
state: async (
variables:
| (Events["CapitatedInitial"] & CommonEmailVariables & { emails: EmailAddresses })
| (Events["ContractingInitial"] & CommonEmailVariables & { emails: EmailAddresses }),
) => {
return {
to: [`${variables.submitterName} <${variables.submitterEmail}>`],
subject: `Your ${formatActionType(variables.actionType)} ${
variables.id
} has been submitted to CMS`,
body: await render(<Waiver1915bStateEmail variables={variables} />),
};
},
},
[Authority["1915c"]]: {
cms: async (
variables: Events["NewAppKSubmission"] & CommonEmailVariables & { emails: EmailAddresses },
) => {
return {
to: variables.emails.osgEmail,
subject: `1915(c) ${variables.id} Submitted`,
body: await render(<AppKCMSEmail variables={variables} />),
};
},
state: async (
variables: Events["NewAppKSubmission"] & CommonEmailVariables & { emails: EmailAddresses },
) => {
return {
to: [`${variables.submitterName} <${variables.submitterEmail}>`],
subject: `Your 1915(c) ${variables.id} has been submitted to CMS`,
body: await render(<AppKStateEmail variables={variables} />),
};
},
},
};