diff --git a/packages/api/src/hooks/useAccountStatus.ts b/packages/api/src/hooks/useAccountStatus.ts index 96e8f21c9b70..02aa628584af 100644 --- a/packages/api/src/hooks/useAccountStatus.ts +++ b/packages/api/src/hooks/useAccountStatus.ts @@ -96,8 +96,6 @@ const useAccountStatus = () => { is_authenticated_with_idv_photoid: status.has('authenticated_with_idv_photoid'), /** the client used to be fully authenticated by IDV but it was taken away due to compliance criteria. */ is_idv_revoked: status.has('idv_revoked'), - /** the client is disallowed from verifying using the IDV service */ - is_idv_disallowed: status.has('idv_disallowed'), }; }, [get_account_status_data?.status]); diff --git a/packages/api/src/hooks/usePOI.ts b/packages/api/src/hooks/usePOI.ts index e8d58f0589ee..96fab9402b0b 100644 --- a/packages/api/src/hooks/usePOI.ts +++ b/packages/api/src/hooks/usePOI.ts @@ -2,20 +2,16 @@ import { useMemo } from 'react'; import useResidenceList from './useResidenceList'; import useGetAccountStatus from './useGetAccountStatus'; import useSettings from './useSettings'; -import useAccountStatus from './useAccountStatus'; - -type TVerificationService = 'onfido' | 'idv' | 'manual'; /** A custom hook to get the user's identity verification status. */ const usePOI = () => { - const { data: get_account_status_data } = useGetAccountStatus(); - const { data: account_status } = useAccountStatus(); + const { data: get_account_status_data, ...rest } = useGetAccountStatus(); const { data: residence_list_data } = useResidenceList(); const { data: get_settings_data } = useSettings(); const previous_service = useMemo(() => { const latest_poi_attempt = get_account_status_data?.authentication?.attempts?.latest; - return latest_poi_attempt?.service as TVerificationService; + return latest_poi_attempt?.service; }, [get_account_status_data?.authentication?.attempts?.latest]); /** @@ -55,7 +51,7 @@ const usePOI = () => { const services = get_account_status_data?.authentication?.identity?.services; const idv_submission_left = services?.idv?.submissions_left ?? 0; const onfido_submission_left = services?.onfido?.submissions_left ?? 0; - if (is_idv_supported && idv_submission_left && !account_status?.is_idv_disallowed) { + if (is_idv_supported && idv_submission_left && !get_account_status_data?.status?.includes('idv_disallowed')) { return { service: 'idv', submission_left: idv_submission_left, @@ -72,16 +68,20 @@ const usePOI = () => { service: 'manual', }; }, [ - account_status?.is_idv_disallowed, get_account_status_data?.authentication?.identity?.services, + get_account_status_data?.status, get_settings_data?.citizen, get_settings_data?.country_code, residence_list_data, ]); return { - previous: previous_poi, - next: next_poi, + data: { + ...get_account_status_data?.authentication?.identity, + previous: previous_poi, + next: next_poi, + }, + ...rest, }; };