diff --git a/src/applications/686c-674/containers/App.jsx b/src/applications/686c-674/containers/App.jsx
index b08dad696912..57df90a3be7d 100644
--- a/src/applications/686c-674/containers/App.jsx
+++ b/src/applications/686c-674/containers/App.jsx
@@ -1,47 +1,66 @@
import React from 'react';
import { connect } from 'react-redux';
import RoutedSavableApp from 'platform/forms/save-in-progress/RoutedSavableApp';
-import { VA_FORM_IDS } from '@department-of-veterans-affairs/platform-forms/constants';
-// import manifest from '../manifest.json';
import { useBrowserMonitoring } from '~/platform/utilities/real-user-monitoring';
import { useFeatureToggle } from '~/platform/utilities/feature-toggles';
+import manifest from '../manifest.json';
import formConfig from '../config/form';
import { DOC_TITLE } from '../config/constants';
-function App({ location, children, isLoading, featureToggles, savedForms }) {
+function App({
+ location,
+ children,
+ isLoggedIn,
+ isLoading,
+ vaFileNumber,
+ featureToggles,
+}) {
const { TOGGLE_NAMES } = useFeatureToggle();
useBrowserMonitoring({
location,
toggleName: TOGGLE_NAMES.disablityBenefitsBrowserMonitoringEnabled,
});
+
// Must match the H1
document.title = DOC_TITLE;
+
// Handle loading
if (isLoading || !featureToggles || featureToggles.loading) {
return ;
}
- const flipperV2 = featureToggles.vaDependentsV2;
- const hasV1Form = savedForms.some(
- form => form.form === VA_FORM_IDS.FORM_21_686C,
- );
- const hasV2Form = savedForms.some(
- form => form.form === VA_FORM_IDS.FORM_21_686CV2,
- );
-
- const shouldUseV2 = hasV2Form || (flipperV2 && !hasV1Form);
- if (!shouldUseV2) {
+ if (!featureToggles.vaDependentsV2) {
window.location.href = '/view-change-dependents/add-remove-form-21-686c/';
return <>>;
}
- return (
+ const content = (
{children}
);
+
+ // If on intro page, just return
+ if (location.pathname === '/introduction') {
+ return content;
+ }
+
+ // If a user is not logged in OR
+ // a user is logged in, but hasn't gone through va file number validation
+ // redirect them to the introduction page.
+ if (
+ !isLoggedIn ||
+ (isLoggedIn && !vaFileNumber?.hasVaFileNumber?.VALIDVAFILENUMBER)
+ ) {
+ document.location.replace(`${manifest.rootUrl}`);
+ return (
+
+ );
+ }
+
+ return content;
}
const mapStateToProps = state => {
diff --git a/src/applications/disability-benefits/686c-674/containers/App.jsx b/src/applications/disability-benefits/686c-674/containers/App.jsx
index 6b6455fac903..dd1f44419824 100644
--- a/src/applications/disability-benefits/686c-674/containers/App.jsx
+++ b/src/applications/disability-benefits/686c-674/containers/App.jsx
@@ -1,7 +1,6 @@
import React from 'react';
import { connect } from 'react-redux';
import RoutedSavableApp from 'platform/forms/save-in-progress/RoutedSavableApp';
-import { VA_FORM_IDS } from '@department-of-veterans-affairs/platform-forms/constants';
import { useBrowserMonitoring } from '~/platform/utilities/real-user-monitoring';
import { useFeatureToggle } from '~/platform/utilities/feature-toggles';
import manifest from '../manifest.json';
@@ -15,7 +14,6 @@ function App({
isLoading,
vaFileNumber,
featureToggles,
- savedForms,
}) {
const { TOGGLE_NAMES } = useFeatureToggle();
useBrowserMonitoring({
@@ -31,16 +29,7 @@ function App({
return ;
}
- const flipperV2 = featureToggles.vaDependentsV2;
- const hasV1Form = savedForms.some(
- form => form.form === VA_FORM_IDS.FORM_21_686C,
- );
- const hasV2Form = savedForms.some(
- form => form.form === VA_FORM_IDS.FORM_21_686CV2,
- );
-
- const shouldUseV2 = hasV2Form || (flipperV2 && !hasV1Form);
- if (shouldUseV2) {
+ if (featureToggles.vaDependentsV2) {
window.location.href =
'/view-change-dependents/add-remove-form-21-686c-v2/';
return <>>;
@@ -52,6 +41,7 @@ function App({
);
+
// If on intro page, just return
if (location.pathname === '/introduction') {
return content;