diff --git a/VAMobile/e2e/tests/Claims.e2e.ts b/VAMobile/e2e/tests/Claims.e2e.ts index ff1ca6c7ea7..a8ed2a84c78 100644 --- a/VAMobile/e2e/tests/Claims.e2e.ts +++ b/VAMobile/e2e/tests/Claims.e2e.ts @@ -84,20 +84,6 @@ describe('Claims Screen', () => { await element(by.text('Close')).tap() }) - it('Verify what should I do if disagreement information', async () => { - await element(by.id(ClaimsE2eIdConstants.CLAIMS_DETAILS_SCREEN_ID)).scrollTo('bottom') - await element(by.id(`What should I do if I disagree with V-A 's decision on my disability claim?`)).tap() - await expect( - element(by.label('What should I do if I disagree with your decision on my V-A disability claim?')), - ).toExist() - await element(by.id('ClaimsDecisionReviewOptionsTestID')).tap() - await element(by.text(CommonE2eIdConstants.LEAVING_APP_LEAVE_TEXT)).tap() - await setTimeout(5000) - await device.takeScreenshot('DecisionReviewOptionsWebsite') - await device.launchApp({ newInstance: false }) - await element(by.text('Close')).tap() - }) - it('open claim: verify that the need help? section information', async () => { await expect(element(by.text('Need help?'))).toExist() await expect( @@ -314,6 +300,7 @@ describe('Claims Screen', () => { it('verify the status details page of closed claim with decision letter', async () => { await element(by.id(ClaimsE2eIdConstants.CLOSED_CLAIM_DECISION_LETTER_ID)).tap() + await expect(element(by.text('Decision letter ready'))).toExist() await expect(element(by.text('We decided your claim on April 09, 2021'))).toExist() await expect( element(by.text('You can download your decision letter in the app. We also mailed you this letter.')), @@ -321,6 +308,18 @@ describe('Claims Screen', () => { await expect(element(by.id(ClaimsE2eIdConstants.GET_CLAIMS_LETTER_BUTTON_ID))).toExist() }) + it('Verify what should I do if disagreement information', async () => { + await element(by.id(ClaimsE2eIdConstants.CLAIMS_DETAILS_SCREEN_ID)).scrollTo('bottom') + await element(by.id('Learn what to do if you disagree with our decision')).atIndex(0).tap() + await expect(element(by.text('Learn what to do if you disagree with our decision')).atIndex(0)).toExist() + await element(by.id('ClaimsDecisionReviewOptionsTestID')).tap() + await element(by.text(CommonE2eIdConstants.LEAVING_APP_LEAVE_TEXT)).tap() + await setTimeout(5000) + await device.takeScreenshot('DecisionReviewOptionsWebsite') + await device.launchApp({ newInstance: false }) + await element(by.text('Close')).tap() + }) + it('closed claim: verify that the need help? section display information', async () => { await expect(element(by.text('Need help?'))).toExist() await expect( @@ -339,6 +338,7 @@ describe('Claims Screen', () => { }) it('verify details tab infomation', async () => { + await element(by.id(ClaimsE2eIdConstants.CLAIMS_DETAILS_SCREEN_ID)).scrollTo('top') await element(by.text('Details')).tap() await expect(element(by.text('Claim type'))).toExist() await expect(element(by.text('Compensation'))).toExist() diff --git a/VAMobile/src/screens/BenefitsScreen/ClaimsScreen/ClaimDetailsScreen/ClaimDetailsScreen.tsx b/VAMobile/src/screens/BenefitsScreen/ClaimsScreen/ClaimDetailsScreen/ClaimDetailsScreen.tsx index 9e4b08f2d2e..b28ec16997d 100644 --- a/VAMobile/src/screens/BenefitsScreen/ClaimsScreen/ClaimDetailsScreen/ClaimDetailsScreen.tsx +++ b/VAMobile/src/screens/BenefitsScreen/ClaimsScreen/ClaimDetailsScreen/ClaimDetailsScreen.tsx @@ -4,22 +4,26 @@ import { useTranslation } from 'react-i18next' import { useFocusEffect } from '@react-navigation/native' import { StackScreenProps } from '@react-navigation/stack/lib/typescript/src/types' -import { SegmentedControl } from '@department-of-veterans-affairs/mobile-component-library' +import { Alert, ButtonVariants, SegmentedControl } from '@department-of-veterans-affairs/mobile-component-library' +import { AlertProps } from '@department-of-veterans-affairs/mobile-component-library/src/components/Alert/Alert' +import { ButtonProps } from '@department-of-veterans-affairs/mobile-component-library/src/components/Button/Button' import { useQueryClient } from '@tanstack/react-query' import { TFunction } from 'i18next' import { useAuthorizedServices } from 'api/authorizedServices/getAuthorizedServices' import { useClaim } from 'api/claimsAndAppeals' import { claimsAndAppealsKeys } from 'api/claimsAndAppeals/queryKeys' +import { useDecisionLetters } from 'api/decisionLetters' import { ClaimAttributesData, ClaimData } from 'api/types' -import { Box, ErrorComponent, FeatureLandingTemplate, LoadingComponent, TextView } from 'components' +import { Box, ErrorComponent, FeatureLandingTemplate, LinkWithAnalytics, LoadingComponent, TextView } from 'components' import { Events } from 'constants/analytics' +import { ClaimTypeConstants } from 'constants/claims' import { NAMESPACE } from 'constants/namespaces' import { BenefitsStackParamList } from 'screens/BenefitsScreen/BenefitsStackScreens' import { ScreenIDTypesConstants } from 'store/api/types/Screens' import { logAnalyticsEvent } from 'utils/analytics' import { formatDateMMMMDDYYYY } from 'utils/formattingUtils' -import { useBeforeNavBackListener, useTheme } from 'utils/hooks' +import { useBeforeNavBackListener, useRouteNavigation, useTheme } from 'utils/hooks' import { registerReviewEvent } from 'utils/inAppReviews' import { featureEnabled } from 'utils/remoteConfig' import { screenContentAllowed } from 'utils/waygateConfig' @@ -37,7 +41,7 @@ type ClaimDetailsScreenProps = StackScreenProps { + logAnalyticsEvent(Events.vama_ddl_status_click()) + navigateTo('ClaimLettersScreen') + } + + const getActiveClosedClaimInformationAlertOrSubmitButton = () => { + if (claimType === ClaimTypeConstants.CLOSED) { + const isDecisionLetterReady = + (featureEnabled('decisionLettersWaygate') && + userAuthorizedServices?.decisionLetters && + claim?.attributes.decisionLetterSent && + (decisionLetterData?.data.length || 0) > 0) || + false + + const buttonProps: ButtonProps = { + buttonType: ButtonVariants.Primary, + label: t('claimDetails.getClaimLetters'), + onPress: onDecisionLetterPress, + } + + const alertProps: AlertProps = { + variant: 'info', + header: isDecisionLetterReady ? t('claims.decisionLetterReady') : t('claims.decisionLetterMailed'), + description: isDecisionLetterReady ? t('claims.decisionLetterReady.alertBody') : undefined, + primaryButton: isDecisionLetterReady ? buttonProps : undefined, + expandable: isDecisionLetterReady, + } + + if (isDecisionLetterReady) { + alertProps.initializeExpanded = isDecisionLetterReady + } + + return ( + + + + ) + } + return <> + } + + function renderActiveClosedClaimStatusHelpLink() { + const whatShouldOnPress = () => { + logAnalyticsEvent(Events.vama_claim_disag(claimID, claimType, attributes.phase)) + navigateTo('WhatDoIDoIfDisagreement', { + claimID: claimID, + claimType: claimType, + claimStep: attributes.phase, + }) + } + + if (claimType === ClaimTypeConstants.CLOSED) { + return ( + + + + ) + } + + return <> + } + return ( {t('claimDetails.receivedOn', { date: formattedReceivedDate })} + {getActiveClosedClaimInformationAlertOrSubmitButton()} } {claim && selectedTab === 1 && } + {renderActiveClosedClaimStatusHelpLink()} diff --git a/VAMobile/src/screens/BenefitsScreen/ClaimsScreen/ClaimDetailsScreen/ClaimStatus/WhatDoIDoIfDisagreement/WhatDoIDoIfDisagreement.test.tsx b/VAMobile/src/screens/BenefitsScreen/ClaimsScreen/ClaimDetailsScreen/ClaimStatus/WhatDoIDoIfDisagreement/WhatDoIDoIfDisagreement.test.tsx index d9020e58d30..9a5a3fd1920 100644 --- a/VAMobile/src/screens/BenefitsScreen/ClaimsScreen/ClaimDetailsScreen/ClaimStatus/WhatDoIDoIfDisagreement/WhatDoIDoIfDisagreement.test.tsx +++ b/VAMobile/src/screens/BenefitsScreen/ClaimsScreen/ClaimDetailsScreen/ClaimStatus/WhatDoIDoIfDisagreement/WhatDoIDoIfDisagreement.test.tsx @@ -14,12 +14,10 @@ context('WhatDoIDoIfDisagreement', () => { }) it('Renders WhatDoIDoIfDisagreement', () => { - expect( - screen.getByText('What should I do if I disagree with your decision on my VA disability claim?'), - ).toBeTruthy() + expect(screen.getByText('Learn what to do if you disagree with our decision')).toBeTruthy() expect( screen.getByText( - 'If you disagree with a claim decision that you received on or after February 19, 2019, you can ask us to review the decision. You have 3 decision review options to choose from.', + 'If you disagree with our decision, you can ask for a decision review. You have 3 decision review options to choose from.', ), ).toBeTruthy() expect(screen.getByText('Learn more about decision reviews and appeals')).toBeTruthy() diff --git a/VAMobile/src/translations/en/common.json b/VAMobile/src/translations/en/common.json index 0da07ee5017..335642128b8 100644 --- a/VAMobile/src/translations/en/common.json +++ b/VAMobile/src/translations/en/common.json @@ -404,6 +404,7 @@ "claimDetails.details": "Details", "claimDetails.estimatedDecisionDate": "Estimated decision date:", "claimDetails.getClaimLetters": "Get claim letters", + "claimDetails.learnWhatToDoIfDisagree": "Learn what to do if you disagree with our decision", "claimDetails.needHelp": "Need help?", "claimDetails.noEstimatedDecisionDate": "Claim completion dates aren't available right now.", "claimDetails.receivedOn": "Received {{date}}", @@ -449,7 +450,9 @@ "claimPhase.youHaveFileRequest_plural": "You have {{count}} file requests from VA", "claims.appealFor": "{{displayTitle}} updated on {{date}}", "claims.claimFor": "Claim for {{displayTitle}} updated on {{date}}", + "claims.decisionLetterMailed": "Decision letter mailed", "claims.decisionLetterReady": "Decision letter ready", + "claims.decisionLetterReady.alertBody": "You can download your decision letter and other claim letters in the app.", "claims.defaultClaimType": "disability compensation", "claims.title": "Claims", "claims.viewYourActiveClaims": "Review your active claims and appeals", @@ -466,8 +469,8 @@ "claimsAndAppeals.loadingClaimsAndAppeals": "Loading your claims and appeals...", "claimsAndAppeals.noClaimsAndAppealsAccess.body": "We're sorry. We can't find any claims for you in our records. If you think this is an error, call the VA benefits hotline.", "claimsAndAppeals.noClaimsAndAppealsAccess.title": "We can't find any claims information for you", - "claimsDetails.whatDoIDoIfDisagreement.content": "If you disagree with a claim decision that you received on or after February 19, 2019, you can ask us to review the decision. You have 3 decision review options to choose from. ", - "claimsDetails.whatDoIDoIfDisagreement.header": "What should I do if I disagree with your decision on my VA disability claim?", + "claimsDetails.whatDoIDoIfDisagreement.content": "If you disagree with our decision, you can ask for a decision review. You have 3 decision review options to choose from.", + "claimsDetails.whatDoIDoIfDisagreement.header": "Learn what to do if you disagree with our decision", "claimsDetails.whatDoIDoIfDisagreement.learnAboutDecisionReview": "Learn more about decision reviews and appeals", "claimsHistory.title": "Claims history", "claimsTab.active": "Active",