Closed cherylli closed 1 year ago
Hey, team! Just a note that we see the same problem on the MailChimp list when subscribing from the Newsletter sections, so we need to test the fix both on the contact form and on the newsletter sections, please. Thanks!
Working on branch bug/MailChimp-not-saving-name:
* details in a temp file /temp-notes.txt
Next step: assess and refactor \
Three tasks: 1. refactor /api/contact.js and /api/register.js I- Both APIs are checking reCaptcha (code repetition) and one of them is sending email. G- Having a function to check reCaptcha and one to send email - avoids repetition. N- Changing these 2 API files and also changing the components that call them in order to call the new API and have a naming normalization (they need to use the same variable names to call the API).
2. refactor \
3. create \
* I- Issue, G- Goal, N- Need * working to keep the same logic and messages btw FE and BE * working also based on the discussion with Mariana and Cheryl via Slack
Task #1
Task #2
* The way both components above handle messages is a bit different - see /components/ContacUs/index.js.
* \
That's great you're describing what you are doing on the issue, @tonykieling ! I like your ideas to solve the problem while refactoring the codebase. That's fantastic! Thanks! 🥷 Another way of doing that is to just submit a DRAFT PR as mentioned here: https://github.com/Web-Dev-Path/web-dev-path/wiki/Creating-a-Pull-Request#about-draft-pull-requests
Task #3
* This way has fewer props to be exchanged among components and it is easier to manage reCAPTCHA because it is centralized. Though, it mixes Mailchimp and reCAPTCHA implementations.
What do we need to build or fix? Name is not saving on mailchimp when the subscription checkbox is checked on the contact form
Technical details This is probably because
Name
and other details except the email are not passed intoFormData
incomponents/ContactUsForm/index.js
This is what we have in the
subscribe
function nowwhich is why only the email is added
Approach suggestions I suggest adding a
name
field to the subscribe function, which would look likeHere is the link to the package we are using for reference, https://www.npmjs.com/package/react-mailchimp-subscribe
It might be best to create your own MailChimp account to test that the function is working before submitting the pull request
Deadline Please keep in mind that once you assign this task to yourself, you'll need to complete it in 10 days.
Acceptance criteria
yarn build
locally to solve the issues and commit the changes.