From 581e174d599c65d8cf7de677a2cb20391ab8b564 Mon Sep 17 00:00:00 2001 From: Manu Salmeron Date: Tue, 21 Nov 2023 08:49:10 -0300 Subject: [PATCH] Newsletter Form fix --- .../Shared/NewsletterFormComponent/index.tsx | 36 +++++++++++++++---- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/src/components/Shared/NewsletterFormComponent/index.tsx b/src/components/Shared/NewsletterFormComponent/index.tsx index 8a62e3e..1091f51 100644 --- a/src/components/Shared/NewsletterFormComponent/index.tsx +++ b/src/components/Shared/NewsletterFormComponent/index.tsx @@ -11,6 +11,7 @@ export default function NewsletterFormComponent({ newsletterData }: any) { const [languageOptions, setLanguageOptions] = useState([]); const [interestsOptions, setInterestsOptions] = useState([]); const [blockchainOptions, setBlockchainOptions] = useState([]); + const [legalConsentOptions, setLegalConsentOptions] = useState(null); const [submitError, setSubmitError] = useState(""); const [submitSuccess, setSubmitSuccess] = useState(""); @@ -26,6 +27,7 @@ export default function NewsletterFormComponent({ newsletterData }: any) { setLanguageOptions(json.languageOptions); setInterestsOptions(json.interestsOptions); setBlockchainOptions(json.blockchainOptions); + setLegalConsentOptions(json.legalConsentOptions); }; getData(); @@ -172,7 +174,17 @@ export default function NewsletterFormComponent({ newsletterData }: any) { country_dropdown: selectValues["country_label"], preferred_programming_language: selectValues["preferred_language_label"] ?? "", interests__developer_portal_: selectValues["interests_label"] ?? "", - blockchain_familiarity: selectValues["blockchain_familiarity_label"] ?? "" + blockchain_familiarity: selectValues["blockchain_familiarity_label"] ?? "", + legal_consent: { + value: agree, + subscriptionTypeId: legalConsentOptions.communicationsCheckboxes[0].subscriptionTypeId, + text: legalConsentOptions.communicationsCheckboxes[0].label + }, + page_context: { + hutk: null, + pageUri: location.href, + pageName: document.title + } }) }); @@ -318,8 +330,14 @@ export default function NewsletterFormComponent({ newsletterData }: any) { > {icons.check} - - {newsletterData.agree_label} + {legalConsentOptions && ( + + )} {agreeError && (