-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sa 102293 kicker dod notification (#33929)
* Adds mebKickerNotificationEnabled to Original Claims form and copies it to formData * Refactors additional COnsiderations component to not use the old feature flags * Hides questions with new kicker notification turned On and displays alert if eligibility is detected * Implement kicker widget to display notification based on API data * Adds fallback for accessing kicker fields from claimant object * Adds try catch so that when properties are undefined on introduction page the application can still excecute until the values are fetched on the next page * Fix validation issue by treating street2 as a string, handling null/undefined values * Remove unused prefill transformer functions * Fix race condition with feature flags: only prefill kicker data when mebKickerNotificationEnabled is true * Adds conditional logic for preventing fetching of exclusion periods when mebKickerNotificationEnabled is true * Prevent fetching exclusion periods when mebKickerNotificationEnabled is true and remove mebKickerNotificationEnabled logic gate references * Fix redundant fetch of personal info when Chapter33 is selected - Optimized useEffect to ensure personal info is only fetched once when a benefit is selected. - Prevents duplicate calls to getPersonalInfo by checking if the chosen benefit has changed. - Ensured previousChosenBenefit is updated after each fetch to avoid unnecessary API calls. * More refactoring * removes commenting out of moment removal debug * Fix: Safely handle falsy values for kicker eligibility * Adds custom notification message to submission if eligibility is detected * Updates abbreviation and capitalization of Defense * updates prefill transformer to include only one version of the function * feat(test): Improve prefillTransformer coverage for mebKickerNotificationEnabled and address fallback • Add scenarios testing mebKickerNotificationEnabled both ON and OFF • Verify eligibility flags for active/reserve kickers populate correctly • Expand tests for domestic vs. international address fallback • Ensure missing phone fields are handled gracefully * fix(tests): Ensure sixHundredDollarBuyUp key is present to pass exclusion message test • Added sixHundredDollarBuyUp: undefined to the test data for createAdditionalConsiderations • Allows the function to produce 'N/A' for buy-up, matching the test’s expected output • Fixes the failing unit test in form-submit-transform.unit.spec.js
- Loading branch information
1 parent
9be31b3
commit ca07dfb
Showing
11 changed files
with
723 additions
and
984 deletions.
There are no files selected for viewing
72 changes: 72 additions & 0 deletions
72
src/applications/my-education-benefits/components/KickerWidget.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import React from 'react'; | ||
import { connect } from 'react-redux'; | ||
import PropTypes from 'prop-types'; | ||
|
||
/** | ||
* KickerWidget checks formData for mebKickerNotificationEnabled plus | ||
* `eligibleForActiveDutyKicker` or `eligibleForReserveKicker`. | ||
* If conditions are met, it displays a <va-alert> for that kicker type. | ||
*/ | ||
const KickerWidget = ({ | ||
formData, | ||
kickerType, | ||
eligibleForActiveDutyKicker, | ||
eligibleForReserveKicker, | ||
}) => { | ||
if (!formData) { | ||
return null; | ||
} | ||
|
||
const { mebKickerNotificationEnabled } = formData; | ||
|
||
// If the global flag is off, we skip | ||
if (!mebKickerNotificationEnabled) { | ||
return null; | ||
} | ||
|
||
// Check the actual kicker type | ||
if (kickerType === 'activeDuty' && eligibleForActiveDutyKicker) { | ||
return ( | ||
<va-alert> | ||
Department of Defense data shows you are potentially eligible for an | ||
active duty kicker | ||
</va-alert> | ||
); | ||
} | ||
|
||
if (kickerType === 'reserve' && eligibleForReserveKicker) { | ||
return ( | ||
<va-alert> | ||
Department of Defense data shows you are potentially eligible for a | ||
reserve kicker | ||
</va-alert> | ||
); | ||
} | ||
|
||
return null; | ||
}; | ||
|
||
KickerWidget.propTypes = { | ||
eligibleForActiveDutyKicker: PropTypes.bool, | ||
eligibleForReserveKicker: PropTypes.bool, | ||
formData: PropTypes.object, | ||
kickerType: PropTypes.oneOf(['activeDuty', 'reserve']), | ||
}; | ||
|
||
KickerWidget.defaultProps = { | ||
kickerType: 'activeDuty', | ||
}; | ||
|
||
const mapStateToProps = state => { | ||
const claimant = state?.data?.formData?.data?.attributes?.claimant || {}; | ||
const { eligibleForActiveDutyKicker, eligibleForReserveKicker } = | ||
claimant || {}; | ||
|
||
return { | ||
formData: state?.form?.data, | ||
eligibleForActiveDutyKicker, | ||
eligibleForReserveKicker, | ||
}; | ||
}; | ||
|
||
export default connect(mapStateToProps)(KickerWidget); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.