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

Put new Veteran Status Card PDF behind feature flag #33230

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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 @@ -6,6 +6,7 @@
import { focusElement } from '~/platform/utilities/ui';
import { captureError } from '~/platform/user/profile/vap-svc/util/analytics';
import { CONTACTS } from '@department-of-veterans-affairs/component-library/contacts';
import { useFeatureToggle } from '~/platform/utilities/feature-toggles';
import { formatFullName } from '../../../common/helpers';
import { getServiceBranchDisplayName } from '../../helpers';

Expand All @@ -32,7 +33,7 @@
(/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) ||
/android/i.test(userAgent);

const pdfData = {
const pdfDataOld = {
title: `Veteran status card for ${formatFullName({
first,
middle,
Expand Down Expand Up @@ -60,6 +61,53 @@
},
},
};
const pdfDataNew = {
title: `Veteran status card for ${formatFullName({
first,
middle,
last,
suffix,
})}`,
details: {
fullName: formatFullName({
first,
middle,
last,
suffix,
}),
serviceHistory: serviceHistory.map(item => {
return {
...item,
branchOfService: getServiceBranchDisplayName(item.branchOfService),
};
}),
totalDisabilityRating,
edipi,
image: {
title: 'V-A logo',
url: '/img/design/logo/logo-black-and-white.png',
},
seal: {
title: 'V-A Seal',
url: '/img/design/logo/seal-black-and-white.png',
},
scissors: {
title: 'Scissors icon',
url: '/img/scissors-black.png',
},
},
};

const {
TOGGLE_NAMES,
useToggleValue,
useToggleLoadingValue,
} = useFeatureToggle();

const isLoadingFeatureFlags = useToggleLoadingValue();
const showNewPdf = useToggleValue(
TOGGLE_NAMES.veteranStatusCardUseLighthouse,
);

useEffect(
() => {
Expand All @@ -75,9 +123,11 @@

try {
await generatePdf(
'veteranStatus',
isLoadingFeatureFlags || !showNewPdf
? 'veteranStatus'
: 'veteranStatusNew',
'Veteran status card',
pdfData,
isLoadingFeatureFlags || !showNewPdf ? pdfDataOld : pdfDataNew,
!isMobile,
);
} catch (error) {
Expand Down Expand Up @@ -115,6 +165,10 @@
);
});

if (isLoadingFeatureFlags) {
return null;
}

return (
<>
<div id="proof-of-veteran-status">
Expand Down Expand Up @@ -167,7 +221,7 @@
<MobileAppCallout
headingText="Get proof of Veteran status on your mobile device"
bodyText={
<>

Check warning on line 224 in src/applications/personalization/profile/components/proof-of-veteran-status/ProofOfVeteranStatus.jsx

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/personalization/profile/components/proof-of-veteran-status/ProofOfVeteranStatus.jsx:224:19:Missing parentheses around multilines JSX
You can use our mobile app to get proof of Veteran status.
To get started, download the{' '}
<strong> VA: Health and Benefits </strong> mobile app.
Expand Down
4 changes: 3 additions & 1 deletion src/applications/personalization/profile/mocks/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ const responses = {
profileUseExperimental: false,
profileShowPrivacyPolicy: true,
veteranOnboardingContactInfoFlow: true,
veteranStatusCardUseLighthouse: true,
}),
),
secondsOfDelay,
Expand Down Expand Up @@ -236,7 +237,8 @@ const responses = {
// .json(serviceHistory.generateServiceHistoryError('403'));
},
'GET /v0/disability_compensation_form/rating_info': (_req, res) => {
return res.status(200).json(ratingInfo.success);
// return res.status(200).json(ratingInfo.success.serviceConnected0);
return res.status(200).json(ratingInfo.success.serviceConnected40);
// return res.status(500).json(genericErrors.error500);
},

Expand Down
4 changes: 4 additions & 0 deletions src/platform/pdf/templates/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,8 @@ templates.veteranStatus = () => {
return require('./veteran_status');
};

templates.veteranStatusNew = () => {
return require('./veteran_status_new');
};

export { templates };
Loading
Loading