diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 000000000..19c7bdba7 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +16 \ No newline at end of file diff --git a/src/Assets/OptionCardIcons/dont_know.png b/src/Assets/OptionCardIcons/dont_know.png new file mode 100644 index 000000000..42be5b26e Binary files /dev/null and b/src/Assets/OptionCardIcons/dont_know.png differ diff --git a/src/Assets/OptionCardIcons/emergency_medicaid.png b/src/Assets/OptionCardIcons/emergency_medicaid.png new file mode 100644 index 000000000..dad0ae611 Binary files /dev/null and b/src/Assets/OptionCardIcons/emergency_medicaid.png differ diff --git a/src/Assets/OptionCardIcons/family_planning.png b/src/Assets/OptionCardIcons/family_planning.png new file mode 100644 index 000000000..be4b28de8 Binary files /dev/null and b/src/Assets/OptionCardIcons/family_planning.png differ diff --git a/src/Assets/healthInsuranceOptions.js b/src/Assets/healthInsuranceOptions.tsx similarity index 50% rename from src/Assets/healthInsuranceOptions.js rename to src/Assets/healthInsuranceOptions.tsx index 39f3a0f25..6124da133 100644 --- a/src/Assets/healthInsuranceOptions.js +++ b/src/Assets/healthInsuranceOptions.tsx @@ -5,8 +5,25 @@ import padlock from './OptionCardIcons/padlock.png'; import redX from './OptionCardIcons/redX.png'; import teddyDoctor from './OptionCardIcons/teddyDoctor.png'; import umbrella from './OptionCardIcons/umbrella.png'; +import dontKnow from './OptionCardIcons/dont_know.png'; +import emergencyMedicaid from './OptionCardIcons/emergency_medicaid.png'; +import familyPlanning from './OptionCardIcons/family_planning.png'; +import { HealthInsurance } from '../Types/FormData'; -const healthInsuranceOptions = { +export type HealthInsuranceOptions = { + [Property in keyof HealthInsurance]: { + formattedMessage: JSX.Element; + image: string; + }; +}; + +const healthInsuranceOptions: HealthInsuranceOptions = { + none: { + formattedMessage: ( + + ), + image: redX, + }, employer: { formattedMessage: ( @@ -15,13 +32,13 @@ const healthInsuranceOptions = { }, private: { formattedMessage: ( - + ), image: padlock, }, medicaid: { formattedMessage: ( - + ), image: bill, }, @@ -35,14 +52,24 @@ const healthInsuranceOptions = { ), image: teddyDoctor, }, - none: { + emergency_medicaid: { formattedMessage: ( ), - image: redX, + image: emergencyMedicaid, + }, + family_planning: { + formattedMessage: ( + + ), + image: familyPlanning, + }, + dont_know: { + formattedMessage: , + image: dontKnow, }, }; diff --git a/src/Assets/questions.tsx b/src/Assets/questions.tsx index ba646006b..46192c45a 100644 --- a/src/Assets/questions.tsx +++ b/src/Assets/questions.tsx @@ -10,9 +10,7 @@ import { selectHasError, displayReferralSourceHelperText, signUpOptionsHaveError, - healthInsuranceHasError, acuteHHConditionsHasError, - displayHealthInsuranceHelperText, displayBenefitsHelperText, countySelectHelperText, otherReferalSourceHelperText, @@ -20,13 +18,11 @@ import { import referralOptions from './referralOptions.tsx'; import countiesByZipcode from './countiesByZipcode.js'; import signUpOptions from './signUpOptions.js'; -import healthInsuranceOptions from './healthInsuranceOptions.js'; import acuteConditionOptions from './acuteConditionOptions'; import { FormattedMessage } from 'react-intl'; export type QuestionNames = | 'zipcode' - | 'healthInsurance' | 'householdSize' | 'householdData' | 'hasExpenses' @@ -75,23 +71,6 @@ const questions = { ], headerType: 'aboutHousehold', }, - healthInsurance: { - name: 'healthInsurance', - question: ( - - ), - componentDetails: { - componentType: 'OptionCardGroup', - inputName: 'healthInsurance', - options: healthInsuranceOptions, - inputError: healthInsuranceHasError, - inputHelperText: displayHealthInsuranceHelperText, - }, - headerType: 'aboutHousehold', - }, householdSize: { name: 'householdSize', question: ( diff --git a/src/Assets/stepDirectory.ts b/src/Assets/stepDirectory.ts index 555abb353..114a0cd67 100644 --- a/src/Assets/stepDirectory.ts +++ b/src/Assets/stepDirectory.ts @@ -3,7 +3,6 @@ import questions, { type QuestionNames } from './questions'; export const startingQuestionNumber = 3; const defaultStepDirectory: QuestionNames[] = [ 'zipcode', - 'healthInsurance', //the hhSize and hhData have to be consecutive 'householdSize', 'householdData', @@ -16,7 +15,6 @@ const defaultStepDirectory: QuestionNames[] = [ ]; const referrerStepDirectory: QuestionNames[] = [ 'zipcode', - 'healthInsurance', //the hhSize and hhData have to be consecutive 'householdSize', 'householdData', diff --git a/src/Assets/updateScreen.js b/src/Assets/updateScreen.js index 0b7afb71d..3404b354f 100644 --- a/src/Assets/updateScreen.js +++ b/src/Assets/updateScreen.js @@ -45,12 +45,6 @@ const getScreensBody = (formData, languageCode) => { has_wic: formData.benefits.wic, has_upk: formData.benefits.upk, has_coctc: formData.benefits.coctc, - has_employer_hi: formData.healthInsurance.employer, - has_private_hi: formData.healthInsurance.private, - has_medicaid_hi: formData.healthInsurance.medicaid, - has_medicare_hi: formData.healthInsurance.medicare, - has_chp_hi: formData.healthInsurance.chp, - has_no_hi: formData.healthInsurance.none, referral_source: finalReferralSource, referrer_code: formData.immutableReferrer, needs_food: formData.acuteHHConditions.food, @@ -78,16 +72,15 @@ const getHouseholdMemberBody = (householdMemberData) => { const incomes = getIncomeStreamsBodies(householdMemberData); return { - relationship: householdMemberData.relationshipToHH, age: Number(householdMemberData.age), + relationship: householdMemberData.relationshipToHH, student: householdMemberData.student, pregnant: householdMemberData.pregnant, visually_impaired: householdMemberData.blindOrVisuallyImpaired, disabled: householdMemberData.disabled, - medicaid: householdMemberData.medicaid, - disability_medicaid: householdMemberData.disabilityRelatedMedicaid, has_income: householdMemberData.hasIncome, income_streams: incomes, + insurance: householdMemberData.healthInsurance, }; }; diff --git a/src/Assets/validationFunctions.tsx b/src/Assets/validationFunctions.tsx index b174b445e..3ed7d8d57 100644 --- a/src/Assets/validationFunctions.tsx +++ b/src/Assets/validationFunctions.tsx @@ -218,47 +218,70 @@ const displayHouseholdMemberAgeHelperText: MessageFunction = (applicantA }; const personDataIsValid: ValidationFunction = (householdDataState) => { - const { age, relationshipToHH, hasIncome, incomeStreams } = householdDataState; + const { age, relationshipToHH, hasIncome, incomeStreams, healthInsurance } = householdDataState; const ageIsValid = Number(age) >= 0 && age !== ''; const relationshipToHHIsValid = relationshipToHH !== ''; const incomeIsValid = (hasIncome && incomeStreamsAreValid(incomeStreams)) || !hasIncome; - - return ageIsValid && relationshipToHHIsValid && incomeIsValid; + const healthInsuranceIsValid = healthInsuranceDataIsValid(healthInsurance); + + return ageIsValid && relationshipToHHIsValid && incomeIsValid && healthInsuranceIsValid; +}; + +const getHealthInsuranceError: MessageFunction = (healthInsurance: HealthInsurance) => { + if (healthInsuranceDataIsValid(healthInsurance) === false) { + if (healthInsurance.none === true) { + //then they chose none and another option + return ( + + + + ); + } else if (healthInsurance.dont_know === true) { + //then they chose dont_know and another option + return ( + + + + ); + } else { + //they haven't selected an option + return ( + + + + ); + } + } }; -const getPersonDataErrorMsg: MessageFunction = (householdDataState) => { - const { age, relationshipToHH, hasIncome, incomeStreams } = householdDataState; +const healthInsuranceDataIsValid: ValidationFunction = (hhMemberHealthInsData) => { + const numOfTrueValues = Object.values(hhMemberHealthInsData).filter( + (healthInsuranceValue) => healthInsuranceValue === true, + ).length; - if (Number(age) < 0 || age === '') { - return ( - - - - ); - } else if (relationshipToHH === '') { - return ( - - - - ); - } else if (hasIncome && incomeStreamsAreValid(incomeStreams) === false) { - return ( - - - - ); + if (hhMemberHealthInsData.none === true || hhMemberHealthInsData.dont_know === true) { + //check here to ensure that that is the ONLY option that was selected via numOfTrueValues + return numOfTrueValues === 1; } else { - return ''; + const atLeastOneOptionWasSelected = numOfTrueValues > 0; + return atLeastOneOptionWasSelected; } }; +const healthInsuranceDataHasError: ValidationFunction = (hhMemberHealthInsData: HealthInsurance) => { + return !healthInsuranceDataIsValid(hhMemberHealthInsData); +}; + const emailHasError: ValidationFunction = (email) => { return !/^.+@(?:[a-zA-Z0-9]+\.)+[A-Za-z]+$/.test(email); }; @@ -571,7 +594,6 @@ export { acuteHHConditionsHasError, benefitsHasError, displayBenefitsHelperText, - getPersonDataErrorMsg, countySelectHelperText, expenseTypeHelperText, relationTypeHelperText, @@ -580,4 +602,6 @@ export { otherReferalSourceHelperText, termsOfServiceHasError, displayAgreeToTermsErrorMessage, + healthInsuranceDataHasError, + getHealthInsuranceError, }; diff --git a/src/Components/Confirmation/Confirmation.js b/src/Components/Confirmation/Confirmation.js index bec80d208..f016b87df 100644 --- a/src/Components/Confirmation/Confirmation.js +++ b/src/Components/Confirmation/Confirmation.js @@ -2,7 +2,6 @@ import { useNavigate, Link, useParams } from 'react-router-dom'; import { Button } from '@mui/material'; import { FormattedMessage, useIntl } from 'react-intl'; import relationshipOptions from '../../Assets/relationshipOptions'; -import taxYearOptions from '../../Assets/taxYearOptions'; import referralOptions from '../../Assets/referralOptions'; import incomeOptions from '../../Assets/incomeOptions'; import frequencyOptions from '../../Assets/frequencyOptions'; @@ -62,7 +61,7 @@ const Confirmation = () => { const allHouseholdAges = getAllHouseholdAges(); const householdMemberDataBlocks = householdData.map((personData, i) => { - const { hasIncome, incomeStreams } = personData; + const { hasIncome, incomeStreams, healthInsurance } = personData; return (
@@ -95,6 +94,7 @@ const Confirmation = () => { {hasIncome && incomeStreams.length > 0 &&
    {listAllIncomeStreams(incomeStreams)}
} {hasIncome === false && } + {displayHHMHealthInsuranceSection(healthInsurance)}