@@ -13,17 +13,20 @@ import { useFetchLocaliseData } from './hooks/useFetchLocalisedData';
1313import { useFetchCustomBenefitPageHints } from "@/ui/screens/benefit-page/hooks/useFetchCustomBenefitPageHints" ;
1414import useFetchData from '@/ui/shared-hooks/utility/useFetchResource' ;
1515import useFetchTargetClass from './hooks/useFetchTargetClass' ;
16+ import featureFlags from '@/featureFlags' ;
17+
1618
1719const BenefitPageScreenContainer = ( ) => {
1820 const { id } = useParams ( ) ;
1921 const { t } = useTranslation ( ) ;
2022 const isDesktop = useStore ( ( state ) => state . isDesktop ) ;
2123 const [ matchingGraph , setMatchingGraph ] = useState ( null ) ;
24+ const [ violations , setViolations ] = useState ( null ) ;
2225 const language = useLanguageStore ( ( state ) => state . language ) ;
2326
2427 const benefitPageData = useFetchStaticBenefitPageData ( id , language ) ;
2528 const categoryTitles = useBuildCategoryTitles ( id , language ) ;
26- const { validatedStatus, validationResult} = useValidatedStatus ( id ) ;
29+ const { validatedStatus, validationResult } = useValidatedStatus ( id ) ;
2730 const activeUserId = useUserStore ( ( state ) => state . activeUserId ) ;
2831 const localisedData = useFetchLocaliseData ( benefitPageData ) ; // merge this logic with customHints? TODO
2932 const customHints = useFetchCustomBenefitPageHints ( benefitPageData ) ;
@@ -44,6 +47,17 @@ const BenefitPageScreenContainer = () => {
4447 fetchMatchingReport ( ) ;
4548 } , [ id , activeUserId , language ] ) ;
4649
50+ useEffect ( ( ) => {
51+ async function fetchEvalGraph ( ) {
52+ const violations = await matchingEngineManager . fetchWrittenViolations ( matchingGraph )
53+ setViolations ( violations ) ;
54+ }
55+ if ( validatedStatus && matchingGraph && featureFlags . writtenViolations ) {
56+ fetchEvalGraph ( ) ;
57+ }
58+ } , [ validatedStatus , matchingGraph ] ) ;
59+
60+
4761 return (
4862 < BenefitPageScreen
4963 t = { t }
@@ -58,6 +72,7 @@ const BenefitPageScreenContainer = () => {
5872 targetClass = { targetClass }
5973 categoryTitles = { categoryTitles }
6074 matchingGraph = { matchingGraph }
75+ violations = { violations }
6176 />
6277 ) ;
6378} ;
0 commit comments