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

0966 new confirmation page followups #34101

Merged
merged 3 commits into from
Jan 17, 2025
Merged
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
239 changes: 198 additions & 41 deletions src/applications/simple-forms/21-0966/containers/ConfirmationPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import { ConfirmationView } from 'platform/forms-system/src/js/components/ConfirmationView';
import { DevOnlyTestVariations } from '../components/DevOnlyTestVariations';
import GetFormHelp from '../../shared/components/GetFormHelp';
import {

Check warning on line 13 in src/applications/simple-forms/21-0966/containers/ConfirmationPage.jsx

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/simple-forms/21-0966/containers/ConfirmationPage.jsx:13:1:Dependency cycle via ./form:13
hasActiveCompensationITF,
hasActivePensionITF,
confirmationPageFormBypassed,
Expand All @@ -28,7 +28,10 @@
} from '../definitions/constants';
import { useNewConfirmationPage } from '../config/features';

const { COMPENSATION, PENSION } = veteranBenefits;
const { SURVIVOR } = survivingDependentBenefits;

const NextSteps = ({ formData }) => (

Check warning on line 34 in src/applications/simple-forms/21-0966/containers/ConfirmationPage.jsx

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/simple-forms/21-0966/containers/ConfirmationPage.jsx:34:22:'formData' is missing in props validation
<div>
<h2>What are my next steps?</h2>
{confirmationPageNextStepsParagraph(formData) ? (
Expand All @@ -37,21 +40,23 @@
<p>{confirmationPageNextStepsParagraph(formData)}</p>
</>
) : (
<p>
You should complete and file your claims as soon as possible. If you
complete and file your claim before the intent to file expires and we
approve your claim, you may be able to get retroactive payments.
Retroactive payments are payments for the time between when we processed
your intent to file and when we approved your claim.
</p>
<>
<p>You should complete and file your claims as soon as possible.</p>
<p>
If you complete and file your claim before the intent to file expires
and we approve your claim, you may be able to get retroactive
payments. Retroactive payments are payments for the time between when
we processed your intent to file and when we approved your claim.
</p>
</>
)}
</div>
);

const ActionLinksToCompleteClaims = ({ formData }) => (

Check warning on line 56 in src/applications/simple-forms/21-0966/containers/ConfirmationPage.jsx

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/simple-forms/21-0966/containers/ConfirmationPage.jsx:56:40:'formData' is missing in props validation
<>
{(hasActiveCompensationITF({ formData }) ||
formData.benefitSelection[veteranBenefits.COMPENSATION]) && (
formData.benefitSelection[COMPENSATION]) && (

Check warning on line 59 in src/applications/simple-forms/21-0966/containers/ConfirmationPage.jsx

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/simple-forms/21-0966/containers/ConfirmationPage.jsx:59:16:'formData.benefitSelection' is missing in props validation
<div>
<va-link-action
href="/disability/file-disability-claim-form-21-526ez/introduction"
Expand All @@ -61,7 +66,7 @@
</div>
)}
{(hasActivePensionITF({ formData }) ||
formData.benefitSelection[veteranBenefits.PENSION]) && (
formData.benefitSelection[PENSION]) && (

Check warning on line 69 in src/applications/simple-forms/21-0966/containers/ConfirmationPage.jsx

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/simple-forms/21-0966/containers/ConfirmationPage.jsx:69:16:'formData.benefitSelection' is missing in props validation
<div>
<va-link-action
href="/pension/file-pension-claim-form-21p-527ez/introduction"
Expand All @@ -70,7 +75,7 @@
/>
</div>
)}
{formData.benefitSelection[survivingDependentBenefits.SURVIVOR] && (
{formData.benefitSelection[SURVIVOR] && (

Check warning on line 78 in src/applications/simple-forms/21-0966/containers/ConfirmationPage.jsx

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/simple-forms/21-0966/containers/ConfirmationPage.jsx:78:15:'formData.benefitSelection' is missing in props validation
<div>
<va-link-action
href="/find-forms/about-form-21p-534ez/"
Expand All @@ -82,12 +87,176 @@
</>
);

const CompensationAction = () => (
<div>
<va-link-action
href="/disability/file-disability-claim-form-21-526ez/introduction"
text="Complete your disability compensation claim"
type="secondary"
/>
</div>
);

const PensionAction = () => (
<div>
<va-link-action
href="/pension/file-pension-claim-form-21p-527ez/introduction"
text="Complete your pension claim"
type="secondary"
/>
</div>
);

const SurvivorAction = () => (
<div>
<va-link-action
href="/find-forms/about-form-21p-534ez/"
text="Complete your pension for survivors claim"
type="secondary"
/>
</div>
);

const PensionExistingAction = ({ formData }) => (

Check warning on line 120 in src/applications/simple-forms/21-0966/containers/ConfirmationPage.jsx

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/simple-forms/21-0966/containers/ConfirmationPage.jsx:120:34:'formData' is missing in props validation
<div>
<p>
Our records show that you already have an intent to file for pension
claims. Your intent to file for pension claims expires on{' '}
{format(
new Date(formData['view:activePensionITF'].expirationDate),

Check warning on line 126 in src/applications/simple-forms/21-0966/containers/ConfirmationPage.jsx

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/simple-forms/21-0966/containers/ConfirmationPage.jsx:126:27:'formData.view:activePensionITF' is missing in props validation

Check warning on line 126 in src/applications/simple-forms/21-0966/containers/ConfirmationPage.jsx

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/simple-forms/21-0966/containers/ConfirmationPage.jsx:126:52:'formData.view:activePensionITF.expirationDate' is missing in props validation
'MMMM d, yyyy',
)}
.
</p>
<PensionAction />
</div>
);

const CompensationExistingAction = ({ formData }) => (

Check warning on line 135 in src/applications/simple-forms/21-0966/containers/ConfirmationPage.jsx

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/simple-forms/21-0966/containers/ConfirmationPage.jsx:135:39:'formData' is missing in props validation
<div>
<p>
Our records show that you already have an intent to file for disability
compensation. Your intent to file for disability compensation expires on{' '}
{format(
new Date(formData['view:activeCompensationITF'].expirationDate),
'MMMM d, yyyy',
)}
.
</p>
<CompensationAction />
</div>
);

const newActionMap = {
[COMPENSATION]: CompensationAction,
[PENSION]: PensionAction,
[SURVIVOR]: SurvivorAction,
};

const existingActionMap = {
[COMPENSATION]: CompensationExistingAction,
[PENSION]: PensionExistingAction,
};

/**
* Returns a data only object of string constants like this:
* {
* actionsNew: ["compensation", "pension"],
* actionsExisting: ["compensation", "pension"]
* }
*
* This makes it easier to test the logic in isolation without rendering
*/
export const getNextStepsActionsPlaceholders = formData => {
const actionsExisting = [];
const actionsNew = [];

const isCompensationApplicable =
hasActiveCompensationITF({ formData }) ||
formData.benefitSelection?.[COMPENSATION];

const isPensionApplicable =
hasActivePensionITF({ formData }) || formData.benefitSelection?.[PENSION];

const isSurvivorApplicable = formData.benefitSelection?.[SURVIVOR];
const hasCompensationExisting = hasActiveCompensationITF({ formData });
const hasPensionExisting = hasActivePensionITF({ formData });

if (hasCompensationExisting) {
actionsExisting.push(COMPENSATION);
} else if (isCompensationApplicable) {
actionsNew.push(COMPENSATION);
}

if (hasPensionExisting) {
actionsExisting.push(PENSION);
} else if (isPensionApplicable) {
actionsNew.push(PENSION);
}

if (isSurvivorApplicable) {
actionsNew.push(SURVIVOR);
}

return { actionsNew, actionsExisting };
};

const NextStepsV2Actions = ({ formData }) => {
let { actionsNew, actionsExisting } = getNextStepsActionsPlaceholders(
formData,
);

// convert arrays of strings to arrays of JSX
// e.g. ["compensation", "pension"] => [<CompensationAction />, <PensionAction />]
actionsNew = actionsNew.map(action => {
const Component = newActionMap[action];
return <Component key={action} />;
});
actionsExisting = actionsExisting.map(action => {
const Component = existingActionMap[action];
return <Component key={action} formData={formData} />;
});

return (
<div>
{actionsNew}
{actionsExisting}
</div>
);
};

const NextStepsV2 = ({ formData }) => {
return (
<div>
<h2>What are my next steps?</h2>
{confirmationPageNextStepsParagraph(formData) ? (
<>
<p>You should complete and file your claims as soon as possible.</p>
<p>{confirmationPageNextStepsParagraph(formData)}</p>
</>
) : (
<>
<p>You should complete and file your claims as soon as possible.</p>
<p>
If you complete and file your claim before the intent to file
expires and we approve your claim, you may be able to get
retroactive payments. Retroactive payments are payments for the time
between when we processed your intent to file and when we approved
your claim.
</p>
</>
)}
<NextStepsV2Actions formData={formData} />
</div>
);
};

const AlreadySubmittedHeader = ({ formData }) => (
<>
{!confirmationPageFormBypassed(formData) && (
<>
{hasActiveCompensationITF({ formData }) &&
formData.benefitSelection[veteranBenefits.PENSION] && (
formData.benefitSelection[PENSION] && (
<div>
<h2>
You’ve already submitted an intent to file for disability
Expand All @@ -108,7 +277,7 @@
</div>
)}
{hasActivePensionITF({ formData }) &&
formData.benefitSelection[veteranBenefits.COMPENSATION] && (
formData.benefitSelection[COMPENSATION] && (
<div>
<h2>
You’ve already submitted an intent to file for pension claims
Expand Down Expand Up @@ -142,14 +311,12 @@
const currentFormData = {
...data,
benefitSelection: {
[veteranBenefits.COMPENSATION]:
data.benefitSelection?.[veteranBenefits.COMPENSATION] ||
[COMPENSATION]:
data.benefitSelection?.[COMPENSATION] ||
data.benefitSelectionCompensation,
[veteranBenefits.PENSION]:
data.benefitSelection?.[veteranBenefits.PENSION] ||
data.benefitSelectionPension,
[survivingDependentBenefits.SURVIVOR]:
data.benefitSelection?.[survivingDependentBenefits.SURVIVOR],
[PENSION]:
data.benefitSelection?.[PENSION] || data.benefitSelectionPension,
[SURVIVOR]: data.benefitSelection?.[SURVIVOR],
},
};

Expand Down Expand Up @@ -183,6 +350,7 @@
expirationDate: submissionResponse?.expirationDate,
confirmationNumber,
})}
actions={<></>}
/>
{!confirmationPageFormBypassed(formData) && (
<>
Expand All @@ -191,34 +359,23 @@
/>
<ConfirmationView.ChapterSectionCollection />
<ConfirmationView.PrintThisPage />
<ConfirmationView.WhatsNextProcessList
item2Content={
submissionApi === submissionApis.BENEFITS_INTAKE ? (
{submissionApi === submissionApis.BENEFITS_INTAKE && (
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note all the code that uses ConfirmationView is gated to only dev currently, so we can test before pushing to prod.

<ConfirmationView.WhatsNextProcessList
item1Header="We’ll confirm that we’ve received your form"
item1Content="We will contact you when we have received your submission. This can take up to 30 days."
item2Header="Next, we’ll review your form"
item2Content={
<p>
After we review your form, we’ll confirm next steps. Then
you’ll have 1 year to file your claim.
</p>
) : (
<>
<p>
After we process your request, we’ll confirm next steps.
If we don’t already have a form showing that you’re
authorized as a signer, we’ll contact the Veteran or
family member who intends to file the claim.
</p>
<p>
If we need information after reviewing your form, we’ll
contact you
</p>
</>
)
}
/>
}
item1Actions={<></>}
/>
)}
</>
)}
<AlreadySubmittedHeader formData={formData} />
<NextSteps formData={formData} />
<ActionLinksToCompleteClaims formData={formData} />
<NextStepsV2 formData={formData} />
<ConfirmationView.HowToContact />
<ConfirmationView.GoBackLink />
<ConfirmationView.NeedHelp />
Expand Down
Loading
Loading