<commit_before>import React, { useEffect } from 'react';
import { connect } from 'react-redux';

import LoadingIndicator from '@department-of-veterans-affairs/component-library/LoadingIndicator';
import AdditionalInfo from '@department-of-veterans-affairs/component-library/AdditionalInfo';

import { isMultifactorEnabled, isVAPatient } from '~/platform/user/selectors';

import { getEnrollmentStatus as getEnrollmentStatusAction } from '~/applications/hca/actions';
import { HCA_ENROLLMENT_STATUSES } from '~/applications/hca/constants';
import {
  hasServerError as hasESRServerError,
  selectEnrollmentStatus as selectESRStatus,
} from '~/applications/hca/selectors';

import { fetchEDUPaymentInformation as fetchEDUPaymentInformationAction } from '@@profile/actions/paymentInformation';
import {
  eduDirectDepositInformation,
  eduDirectDepositIsSetUp,
} from '@@profile/selectors';

import ApplicationsInProgress from './ApplicationsInProgress';
import BenefitOfInterest from './BenefitOfInterest';

const BenefitsOfInterest = ({ children, showChildren }) => {
  return (
    <>
      <h3 className="vads-u-font-size--h4 vads-u-font-family--sans vads-u-margin-bottom--2p5">
        VA benefits you might be interested in
      </h3>
      <div data-testid="benefits-of-interest">
        {!showChildren && (
          <div className="vads-u-margin-y--2">
            <LoadingIndicator message="Loading benefits you might be interested in..." />
          </div>
        )}
        {showChildren && <div className="vads-l-row">{children}</div>}
      </div>
    </>
  );
};

const ApplyForBenefits = ({
  getDD4EDUStatus,
  getESREnrollmentStatus,
  hasDD4EDU,
  hasLoadedAllData,
  isInESR,
  isPatient,
  shouldGetDD4EDUStatus,
  shouldGetESRStatus,
}) => {
  useEffect(
    () => {
      if (shouldGetESRStatus) {
        getESREnrollmentStatus();
      }
    },
    [shouldGetESRStatus, getESREnrollmentStatus],
  );

  useEffect(
    () => {
      if (shouldGetDD4EDUStatus) {
        getDD4EDUStatus();
      }
    },
    [shouldGetDD4EDUStatus, getDD4EDUStatus],
  );

  const showHealthCare = !isPatient && !isInESR;
  const showEducation = !hasDD4EDU;

  return (
    <>
      <h2>Apply for VA benefits</h2>
      <div className="vads-u-margin-top--2">
        <AdditionalInfo triggerText="What benefits does VA offer?">
          <p className="vads-u-font-weight--bold">
            Explore VA.gov to learn about the benefits we offer.
          </p>
          <ul>
            <li>
              <a href="/health-care/">Health care</a>
            </li>
            <li>
              <a href="/education/">Education and training</a>
            </li>
            <li>
              <a href="/disability/">Disability compensation</a>
            </li>
            <li>
              <a href="/careers-employment/">Careers &amp; employment</a>
            </li>
            <li>
              <a href="/pension/">Pension</a>
            </li>
            <li>
              <a href="/housing-assistance/">Housing assistance</a>
            </li>
            <li>
              <a href="/burials-memorials/">Burials &amp; memorials</a>
            </li>
            <li>
              <a href="/life-insurance/">Life insurance</a>
            </li>
            <li>
              <a href="/service-member-benefits/">Service member benefits</a>
            </li>
            <li>
              <a href="/family-member-benefits/">Family member benefits</a>
            </li>
          </ul>
        </AdditionalInfo>
      </div>
      <ApplicationsInProgress />
      <BenefitsOfInterest showChildren={hasLoadedAllData}>
        <>
          {showHealthCare && (
            <BenefitOfInterest
              title="Health care"
              icon="health-care"
              ctaButtonLabel="Apply for VA health care"
              ctaUrl="/health-care/how-to-apply/"
            >
              <p>
                With VA health care, you’ll receive coverage for services like
                regular checkups with your health care provider and specialist<commit_msg>update health care benefit link (#16800)<commit_after>import React, { useEffect } from 'react';
import { connect } from 'react-redux';

import LoadingIndicator from '@department-of-veterans-affairs/component-library/LoadingIndicator';
import AdditionalInfo from '@department-of-veterans-affairs/component-library/AdditionalInfo';

import { isMultifactorEnabled, isVAPatient } from '~/platform/user/selectors';

import { getEnrollmentStatus as getEnrollmentStatusAction } from '~/applications/hca/actions';
import { HCA_ENROLLMENT_STATUSES } from '~/applications/hca/constants';
import {
  hasServerError as hasESRServerError,
  selectEnrollmentStatus as selectESRStatus,
} from '~/applications/hca/selectors';

import { fetchEDUPaymentInformation as fetchEDUPaymentInformationAction } from '@@profile/actions/paymentInformation';
import {
  eduDirectDepositInformation,
  eduDirectDepositIsSetUp,
} from '@@profile/selectors';

import ApplicationsInProgress from './ApplicationsInProgress';
import BenefitOfInterest from './BenefitOfInterest';

const BenefitsOfInterest = ({ children, showChildren }) => {
  return (
    <>
      <h3 className="vads-u-font-size--h4 vads-u-font-family--sans vads-u-margin-bottom--2p5">
        VA benefits you might be interested in
      </h3>
      <div data-testid="benefits-of-interest">
        {!showChildren && (
          <div className="vads-u-margin-y--2">
            <LoadingIndicator message="Loading benefits you might be interested in..." />
          </div>
        )}
        {showChildren && <div className="vads-l-row">{children}</div>}
      </div>
    </>
  );
};

const ApplyForBenefits = ({
  getDD4EDUStatus,
  getESREnrollmentStatus,
  hasDD4EDU,
  hasLoadedAllData,
  isInESR,
  isPatient,
  shouldGetDD4EDUStatus,
  shouldGetESRStatus,
}) => {
  useEffect(
    () => {
      if (shouldGetESRStatus) {
        getESREnrollmentStatus();
      }
    },
    [shouldGetESRStatus, getESREnrollmentStatus],
  );

  useEffect(
    () => {
      if (shouldGetDD4EDUStatus) {
        getDD4EDUStatus();
      }
    },
    [shouldGetDD4EDUStatus, getDD4EDUStatus],
  );

  const showHealthCare = !isPatient && !isInESR;
  const showEducation = !hasDD4EDU;

  return (
    <>
      <h2>Apply for VA benefits</h2>
      <div className="vads-u-margin-top--2">
        <AdditionalInfo triggerText="What benefits does VA offer?">
          <p className="vads-u-font-weight--bold">
            Explore VA.gov to learn about the benefits we offer.
          </p>
          <ul>
            <li>
              <a href="/health-care/">Health care</a>
            </li>
            <li>
              <a href="/education/">Education and training</a>
            </li>
            <li>
              <a href="/disability/">Disability compensation</a>
            </li>
            <li>
              <a href="/careers-employment/">Careers &amp; employment</a>
            </li>
            <li>
              <a href="/pension/">Pension</a>
            </li>
            <li>
              <a href="/housing-assistance/">Housing assistance</a>
            </li>
            <li>
              <a href="/burials-memorials/">Burials &amp; memorials</a>
            </li>
            <li>
              <a href="/life-insurance/">Life insurance</a>
            </li>
            <li>
              <a href="/service-member-benefits/">Service member benefits</a>
            </li>
            <li>
              <a href="/family-member-benefits/">Family member benefits</a>
            </li>
          </ul>
        </AdditionalInfo>
      </div>
      <ApplicationsInProgress />
      <BenefitsOfInterest showChildren={hasLoadedAllData}>
        <>
          {showHealthCare && (
            <BenefitOfInterest
              title="Health care"
              icon="health-care"
              ctaButtonLabel="Learn how to apply for VA health care"
              ctaUrl="/health-care/how-to-apply/"
            >
              <p>
                With VA health care, you’ll receive coverage for services like
                regular checkups with your health care provider and specialist
{'fraction_non_alphanumeric': 0.1271641063155328, 'fraction_numerical': 0.004754937820043892, 'mean_word_length': 2.1980506822612087, 'pattern_counts': {'":': 0, '<': 137, '<?xml version=': 0, '>': 145, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '264577', 'n_tokens_mistral': 2520, 'n_tokens_neox': 2416, 'n_words': 489}