Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

92494 OH - Add support for request flow #32266

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import { isCernerLocation } from '../../../services/location';
import NoAddressNote from '../NoAddressNote';
import { useOHDirectScheduling } from '../../hooks/useOHDirectScheduling';
import { useOHRequestScheduling } from '../../hooks/useOHRequestScheduling';

const INITIAL_FACILITY_DISPLAY_COUNT = 5;
/*
Expand Down Expand Up @@ -67,6 +68,7 @@
});

const useOHDirectSchedule = useOHDirectScheduling();
const useOHRequestSchedule = useOHRequestScheduling();

useEffect(
() => {
Expand All @@ -74,7 +76,7 @@
scrollAndFocus(`#${id}_${INITIAL_FACILITY_DISPLAY_COUNT + 1}`);
}
},
[displayedOptions.length, displayAll],

Check warning on line 79 in src/applications/vaos/new-appointment/components/VAFacilityPage/FacilitiesRadioWidget.jsx

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/vaos/new-appointment/components/VAFacilityPage/FacilitiesRadioWidget.jsx:79:5:React Hook useEffect has a missing dependency: 'id'. Either include it or remove the dependency array.
);

return (
Expand Down Expand Up @@ -107,7 +109,7 @@
level="3"
>
<p>Make sure your browser’s location feature is turned on.</p>
<button

Check warning on line 112 in src/applications/vaos/new-appointment/components/VAFacilityPage/FacilitiesRadioWidget.jsx

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/vaos/new-appointment/components/VAFacilityPage/FacilitiesRadioWidget.jsx:112:15:The <va-button> Web Component should be used instead of the button HTML element.
type="button"
className="va-button-link"
onClick={() =>
Expand Down Expand Up @@ -164,7 +166,7 @@
</span>
)}
{isCerner &&
!useOHDirectSchedule && (
(!useOHDirectSchedule && !useOHRequestSchedule) && (
<a href={getCernerURL('/pages/scheduling/upcoming')}>
Schedule online at <strong>My VA Health</strong>
</a>
Expand All @@ -176,7 +178,7 @@
{!displayAll &&
!requestingLocationFailed &&
hiddenCount > 0 && (
<button

Check warning on line 181 in src/applications/vaos/new-appointment/components/VAFacilityPage/FacilitiesRadioWidget.jsx

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/vaos/new-appointment/components/VAFacilityPage/FacilitiesRadioWidget.jsx:181:11:The <va-button> Web Component should be used instead of the button HTML element.
type="button"
className="additional-info-button usa-button-secondary vads-u-display--block"
onClick={() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { shallowEqual, useSelector } from 'react-redux';
import { getFacilityPageV2Info } from '../redux/selectors';
import { selectFeatureOHRequest } from '../../redux/selectors';

const OH_REQUEST_SCHEDULE_ENABLED_TYPES_OF_CARE = ['foodAndNutrition'];

export function useOHRequestScheduling() {
const featureOHRequest = useSelector(selectFeatureOHRequest);

const { typeOfCare } = useSelector(
state => getFacilityPageV2Info(state),
shallowEqual,
);

return (
featureOHRequest &&
OH_REQUEST_SCHEDULE_ENABLED_TYPES_OF_CARE.includes(typeOfCare.idV2)
);
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { recordEvent } from '@department-of-veterans-affairs/platform-monitoring/exports';
import {
selectFeatureBreadcrumbUrlUpdate,
selectFeatureOHDirectSchedule,
selectFeatureOHRequest,
selectRegisteredCernerFacilityIds,
} from '../redux/selectors';
import {
Expand All @@ -24,7 +26,7 @@
getSiteIdFromFacilityId,
isCernerLocation,
} from '../services/location';
import {

Check warning on line 29 in src/applications/vaos/new-appointment/newAppointmentFlow.js

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/vaos/new-appointment/newAppointmentFlow.js:29:1:Dependency cycle detected.
checkEligibility,
showEligibilityModal,
showPodiatryAppointmentUnavailableModal,
Expand Down Expand Up @@ -81,8 +83,10 @@
const location = getChosenFacilityInfo(state);
const cernerSiteIds = selectRegisteredCernerFacilityIds(state);
const isCerner = isCernerLocation(location?.id, cernerSiteIds);
const featureOHDirectSchedule = selectFeatureOHDirectSchedule(state);
const featureOHRequest = selectFeatureOHRequest(state);

if (isCerner) {
if (isCerner && !featureOHDirectSchedule && !featureOHRequest) {
return 'scheduleCerner';
}

Expand Down
6 changes: 5 additions & 1 deletion src/applications/vaos/redux/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,18 @@ import {
selectCernerFacilityIds,
selectEhrDataByVhaId,
} from 'platform/site-wide/drupal-static-data/source-files/vamc-ehr/selectors';
import { getRealFacilityId } from '../utils/appointment';

export const selectRegisteredCernerFacilityIds = state => {
const patientFacilities = selectPatientFacilities(state);
const cernerFacilityIds = selectCernerFacilityIds(state);

return (
patientFacilities?.reduce((accumulator, current) => {
if (cernerFacilityIds.includes(current.facilityId) || current.isCerner)
if (
cernerFacilityIds.includes(getRealFacilityId(current.facilityId)) ||
current.isCerner
)
return [...accumulator, current.facilityId];
return accumulator;
}, []) || []
Expand Down
Loading