Skip to content

Commit

Permalink
feature/9277-9275-9274-SubmitEvidenceFileRequestAnalytics (#9611)
Browse files Browse the repository at this point in the history
Co-authored-by: Rachael Bontrager <[email protected]>
  • Loading branch information
Sparowhawk and rbontrager authored Sep 26, 2024
1 parent 651630a commit b9678d7
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
17 changes: 17 additions & 0 deletions VAMobile/src/constants/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,23 @@ export const Events = {
},
}
},
vama_claim_submit_ev: (claim_id: string): Event => {
return {
name: 'vama_claim_submit_ev',
params: {
claim_id,
},
}
},
vama_claim_submit_tap: (claim_id: string, claim_type: string): Event => {
return {
name: 'vama_claim_submit_tap',
params: {
claim_id,
claim_type,
},
}
},
vama_claim_upload_compl: (
claim_id: string,
claim_request_id: number | null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,15 @@ function ClaimDetailsScreen({ navigation, route }: ClaimDetailsScreenProps) {
const { attributes } = claim || ({} as ClaimData)
const { dateFiled } = attributes || ({} as ClaimAttributesData)

const [count, setCount] = useState(0)
const [count, setCount] = useState(-1)

const [scrollIsEnabled, setScrollIsEnabled] = useState(true)

useFocusEffect(
useCallback(() => {
setCount(numberOfItemsNeedingAttentionFromVet(attributes?.eventsTimeline || []))
if (attributes) {
setCount(numberOfItemsNeedingAttentionFromVet(attributes.eventsTimeline))
}
}, [attributes]),
) //force a rerender due to react query updating data

Expand Down Expand Up @@ -119,6 +121,18 @@ function ClaimDetailsScreen({ navigation, route }: ClaimDetailsScreenProps) {
}
}, [claim, loadingClaim, claimError, claimID, attributes])

useEffect(() => {
if (claimType === ClaimTypeConstants.ACTIVE && claim) {
if (claimPhaseExpansionFlag) {
if (count > 0 && !claim.attributes.waiverSubmitted) {
logAnalyticsEvent(Events.vama_claim_file_request(claimID))
} else if (submitEvidenceExpansionFlag && claim.attributes.open && count >= 0) {
logAnalyticsEvent(Events.vama_claim_submit_ev(claimID))
}
}
}
}, [claimType, claimPhaseExpansionFlag, submitEvidenceExpansionFlag, count, claim, claimID])

// Track how long user maintains focus on this screen
useFocusEffect(
useCallback(() => {
Expand Down Expand Up @@ -177,7 +191,7 @@ function ClaimDetailsScreen({ navigation, route }: ClaimDetailsScreenProps) {
}

const submitEvidencePress = () => {
logAnalyticsEvent(Events.vama_claim_review(claimID, attributes.claimType, count))
logAnalyticsEvent(Events.vama_claim_submit_tap(claimID, attributes.claimType))
navigateTo('SubmitEvidence', { claimID })
}

Expand Down

0 comments on commit b9678d7

Please sign in to comment.