Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(emails): New Implementation of sending emails w/ cdk and w/o without templates #801

Draft
wants to merge 104 commits into
base: main
Choose a base branch
from

Conversation

benjaminpaige
Copy link
Collaborator

@benjaminpaige benjaminpaige commented Oct 2, 2024

What has been done.

  • there has been work done around being able to run only the e2e playwright tests from the top level run script.
  • templates were added for most if not all of the actions/events for new-submissions, rai responses, withdrawls, temp extensions, etc.
  • an email stack was added that processes emails from bigmac topics and sends emails based on the event and the action.
  • helpers were added to get srt's cpocs,, and allStateUsers, which goes through cognito to pull all the state submitters with a state value equal to the state you submitted a record for.
  • Sending a new submission will fire off two emails, one for a cms user, and one for a state user. The hard coded addresses are held in a default secrets manager json object, the remaining emails are retrieved based on the use case via the seatool record in opensearch.
  • React email was added and all the emails were put into reusable templates/components, and the old hard coded ones were removed.
  • emails go to mako.stateuser@gmail.com for the most part and are tagged (via +chip, +dmco etc) to indicate the various recipients in dev.
  • new submissions "work" in so far as they send out these notifications. thats the good news.

  • The bad part is that there is a lot of stuff in this pr based on the old record schemas that were recently changed. The change in how actions/events/seaActionTypes and attachments has left most of the emails in a disconnected state where the tests we wrote for them are not using data that is not relevent anymore. So these new shared-types/events/... represent the new representation of the shape of our objects and need to be reapplied to the react email templates that were created based on the old schemas.

There are a lot of changes in this pr. It should have been done in smaller pieces, but at this point we should focus on, connecting and ensuring that new waiver and chip spa submissions send emails to where they need to go with the content they need to have. The remaining action based functionality we can comment out from the templates for the time being. or remove.

Purpose

In this version of Onemac we do not keep a User Table so we rely on cognito and seatoool for our recipients. This nversion adds functinality to get allState submitters when needed as well as cpoc and srt emails and names and adding them to the correct emails when needed. Also, we are removing the templates for numerous reasons and replacing with the use of React.email library. Which makes it easier to use, cheeper, gives it proper email html content.... etc.

Linked Issues to Close

This should close :

Assorted Notes/Considerations/Learning

This relies on emailAddresses that are secrets but also gets info from seatool (cpoc, srt's) and all state users via ListUsers from cognito. But this does not account for users that sign up but never sign in. Which we are hopefully going to have a solution from IDM asap.

Andie's Notes

The email templates are created with React Email

To test the emails in dev

  1. cd into lib/libs
  2. run npm run email-dev

Changes to the components will need to be refreshed to see

Copy link

@codeclimate codeclimate bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR diff size of 6191 lines exceeds the maximum allowed for the inline comments feature.

Copy link
Contributor

github-actions bot commented Oct 2, 2024

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 60.74% 4445 / 7318
🔵 Statements 60.48% 4716 / 7797
🔵 Functions 53.56% 1216 / 2270
🔵 Branches 32.95% 851 / 2582
File Coverage
File Stmts % Branch % Funcs % Lines Uncovered Lines
Changed Files
lib/lambda/item.test.ts 100% 100% 100% 100%
lib/lambda/item.ts 95.65% 93.33% 100% 95.65% 58-61
lib/lambda/processEmails.text.ts 0% 100% 0% 0% 27-37, 39-58, 41, 44-52, 55, 59-62, 61, 63-118, 64-86, 72, 74-80, 82-83, 88-91, 90, 93-117, 94-116, 120-152, 121-128, 130-132, 131, 134-142, 135-136, 138-141, 144-151, 145-148, 150, 154-234, 155-177, 179-180, 182-191, 183, 186-188, 193-196, 195, 198-207, 199-201, 203-206, 209-223, 210-219, 221-222, 225-233, 226-228, 230-232
lib/lambda/processEmails.ts 0% 0% 0% 0% 23-27, 29-37, 36, 39, 41-61, 42-60, 44-53, 47-52, 54-56, 58-59, 68-74, 72-73, 76-100, 82-99, 104-108, 105-107, 109, 121-124, 126-141, 143-147, 146, 149-164, 159, 161-163, 166-167, 174-189, 193, 195-202, 197-198, 200-201
lib/lambda/sinkBackup.ts 0% 0% 0% 0% 6-9, 11-54, 12-53, 14-49, 15-47, 18-46, 24-26, 25, 27-32, 34-44, 35-41, 43, 45, 48, 51-52
lib/lambda/sinkMain.ts 0% 0% 0% 0% 14-18, 17, 19, 21-57, 22-56, 28-52, 29-51, 34-35, 37-44, 46-47, 49-50, 54-55, 59-129, 73-125, 75-124, 80-83, 82, 86, 90-92, 91, 95-96, 98-117, 100, 102, 104, 104-112, 106-111, 113-114, 116, 119-123, 128, 131-206, 132, 135-139, 136, 138, 141-148, 145-147, 150-204, 151-203, 153, 156-159, 157-158, 162-174, 168-173, 175-186, 184-185, 187-188, 190-196, 195, 198-202, 205, 208-247, 212-245, 214-244, 217-219, 218, 222-223, 226, 226, 228-236, 230-235, 237, 239-243, 246
lib/lambda/package-actions/withdraw-rai/withdraw-rai.test.ts 85.71% 37.5% 100% 85.29% 10-13, 16-19, 27-32, 28-31, 33-36
lib/lambda/submit/submit.ts 0% 0% 0% 0% 8-56, 9-14, 10-13, 16, 18, 21-26, 22-25, 29-34, 30-33, 36-55, 37, 39-43, 45-48, 50-54, 58
lib/libs/api/kafka.test.ts 33.33% 100% 25% 34.28% 12, 16, 25-26, 30, 34-35, 39-41, 43, 45-57, 61-63, 68, 70-82, 86-87, 87
lib/libs/api/package/appk.test.ts 100% 100% 100% 100%
lib/libs/api/package/appk.ts 100% 100% 100% 100%
lib/libs/email/getAllStateUsers.test.ts 100% 100% 100% 100%
lib/libs/email/getAllStateUsers.ts 10.52% 0% 0% 10.52% 18-54, 19-22, 24-25, 27-29, 28, 31-48, 32-34, 33, 35, 37-40, 38-39, 42-47, 50, 52-53
lib/libs/email/index.ts 92.5% 85% 100% 92.1% 43-44, 225
lib/packages/shared-types/forms.ts 100% 100% 100% 100%
lib/packages/shared-types/user.ts 100% 100% 100% 100%
lib/packages/shared-types/events/app-k.ts 100% 100% 100% 100%
lib/packages/shared-types/events/capitated-amendment.ts 100% 100% 100% 100%
lib/packages/shared-types/events/capitated-initial.ts 100% 100% 100% 100%
lib/packages/shared-types/events/capitated-renewal.ts 100% 100% 100% 100%
lib/packages/shared-types/events/contracting-amendment.ts 100% 100% 100% 100%
lib/packages/shared-types/events/contracting-initial.ts 100% 100% 100% 100%
lib/packages/shared-types/events/contracting-renewal.ts 100% 100% 100% 100%
lib/packages/shared-types/events/index.ts 100% 100% 100% 100%
lib/packages/shared-types/events/new-chip-submission.ts 100% 100% 100% 100%
lib/packages/shared-types/events/new-medicaid-submission.ts 100% 100% 100% 100%
lib/packages/shared-types/events/seatool.ts 100% 100% 100% 100%
lib/packages/shared-types/events/temporary-extension.ts 100% 100% 100% 100%
lib/packages/shared-types/events/withdraw-package.ts 100% 100% 100% 100%
lib/packages/shared-types/opensearch/main/transforms/new-chip-submission.ts 25% 100% 0% 14.28% 9-37, 10-13, 15-36
lib/packages/shared-types/opensearch/main/transforms/seatool.ts 56.57% 59.21% 48.38% 59.67% 22-23, 23, 26-30, 27-29, 46-48, 47, 49-51, 50, 52-54, 53, 55, 59, 62, 65, 111, 121-123, 155, 157-160, 164, 166-169, 200-224, 22-24, 23, 47, 50, 53, 55, 83-86, 111
lib/packages/shared-utils/cloudformation.test.ts 100% 100% 100% 100%
lib/packages/shared-utils/seatool-date-helper.test.ts 93.87% 100% 93.33% 93.87% 92-94
lib/packages/shared-utils/testData.ts 100% 100% 100% 100%
lib/packages/shared-utils/user-helper.test.ts 100% 50% 100% 100%
react-app/src/api/submissionService.test.ts 100% 100% 100% 100%
react-app/src/api/submissionService.ts 58.82% 36.66% 64.28% 58.06% 40, 78-87, 89-94, 157-201, 159-160, 163-169, 165-169, 173-175, 178-184, 180-183, 187-195, 198-200, 211-214, 213
react-app/src/components/ConfirmationDialog/userPrompt.test.tsx 100% 100% 100% 100%
react-app/src/components/ConfirmationDialog/userPrompt.tsx 100% 83.33% 100% 100%
react-app/src/features/package/package-details/hooks.tsx 14.28% 0% 0% 14.7% 14-17, 16, 28, 28, 44-143, 48, 53, 59, 65, 77-79, 84-85, 87, 93-94, 96, 103, 112, 120, 127, 135, 141, 147-166, 154, 163, 170-179, 175-177, 183-204, 187, 193, 200-202
react-app/src/hooks/useCountdown/index.test.ts 100% 100% 100% 100%
Generated in workflow #331 for commit 77dcd40 by the Vitest Coverage Report Action

Copy link

@codeclimate codeclimate bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR diff size of 6212 lines exceeds the maximum allowed for the inline comments feature.

Copy link

@codeclimate codeclimate bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR diff size of 6218 lines exceeds the maximum allowed for the inline comments feature.

Copy link

@codeclimate codeclimate bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR diff size of 6267 lines exceeds the maximum allowed for the inline comments feature.

Copy link

codeclimate bot commented Oct 2, 2024

Code Climate has analyzed commit 77dcd40 and detected 2 issues on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 2

The test coverage on the diff in this pull request is 38.8% (50% is the threshold).

This pull request will bring the total coverage in the repository to 60.8% (-1.3% change).

View more on Code Climate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants