diff --git a/src/ageAssurance/components/NoAccessScreen.tsx b/src/ageAssurance/components/NoAccessScreen.tsx index ccd14eaadb..600970459a 100644 --- a/src/ageAssurance/components/NoAccessScreen.tsx +++ b/src/ageAssurance/components/NoAccessScreen.tsx @@ -12,6 +12,8 @@ import { import {dateDiff, useGetTimeAgo} from '#/lib/hooks/useTimeAgo' import {useIsBirthdateUpdateAllowed} from '#/state/birthdate' import {useSessionApi} from '#/state/session' +import {DeactivateAccountDialog} from '#/screens/Settings/components/DeactivateAccountDialog' +import {DeleteAccountDialog} from '#/screens/Settings/components/DeleteAccountDialog' import {atoms as a, useBreakpoints, useTheme, web} from '#/alf' import {Admonition} from '#/components/Admonition' import {AgeAssuranceAppealDialog} from '#/components/ageAssurance/AgeAssuranceAppealDialog' @@ -49,6 +51,8 @@ export function NoAccessScreen() { const {gtPhone} = useBreakpoints() const insets = useSafeAreaInsets() const birthdateControl = useDialogControl() + const deactivateAccountControl = useDialogControl() + const deleteAccountControl = useDialogControl() const {data} = useAgeAssuranceDataContext() const region = useAgeAssuranceRegionConfig() const isBirthdateUpdateAllowed = useIsBirthdateUpdateAllowed() @@ -71,6 +75,7 @@ export function NoAccessScreen() { hasDeclaredAge, canUpdateBirthday, }) + // TODO This can be cleaned up with useEffectEvent once we're on 19.2 // eslint-disable-next-line react-hooks/exhaustive-deps }, []) @@ -234,18 +239,38 @@ export function NoAccessScreen() { )} - + - + To log out,{' '} { onPressLogout() - })}> + })} + style={[a.italic]}> click here + . Or if you’d prefer, you can{' '} + { + ax.metric( + 'ageAssurance:noAccessScreen:openDeleteAccountDialog', + {}, + ) + deleteAccountControl.open() + })} + style={[a.italic]}> + delete your account + . @@ -255,6 +280,11 @@ export function NoAccessScreen() { + + {/* * While this blocking overlay is up, other dialogs in the shell diff --git a/src/analytics/metrics/types.ts b/src/analytics/metrics/types.ts index ff6219ad65..4946213f40 100644 --- a/src/analytics/metrics/types.ts +++ b/src/analytics/metrics/types.ts @@ -847,6 +847,7 @@ export type Events = { canUpdateBirthday: boolean } 'ageAssurance:noAccessScreen:openBirthdateDialog': {} + 'ageAssurance:noAccessScreen:openDeleteAccountDialog': {} /* * Specifically for the `BlockedGeoOverlay` diff --git a/src/state/birthdate.ts b/src/state/birthdate.ts index 24dc1a846e..cab9c423c7 100644 --- a/src/state/birthdate.ts +++ b/src/state/birthdate.ts @@ -43,6 +43,7 @@ export function useIsBirthdateUpdateAllowed() { ]) if (!lastUpdated) return true const lastUpdatedDate = new Date(lastUpdated) + // eslint-disable-next-line react-hooks/purity const diffMs = Date.now() - lastUpdatedDate.getTime() const diffHours = diffMs / (1000 * 60 * 60) return diffHours >= BIRTHDATE_DELAY_HOURS @@ -66,7 +67,7 @@ export function useBirthdateMutation() { * Also patch the age assurance other required data with the new * birthdate, which may change the user's age assurance access level. */ - patchOtherRequiredData({birthdate: bday}) + void patchOtherRequiredData({birthdate: bday}) snoozeBirthdateUpdateAllowedForDid(agent.sessionManager.did!) }, })