diff --git a/packages/api-v2/src/hooks/useIsEuRegion.ts b/packages/api-v2/src/hooks/useIsEuRegion.ts index cca779a2856a..4e639e61db33 100644 --- a/packages/api-v2/src/hooks/useIsEuRegion.ts +++ b/packages/api-v2/src/hooks/useIsEuRegion.ts @@ -1,13 +1,17 @@ import { useMemo } from 'react'; + +import useActiveWalletAccount from './useActiveWalletAccount'; import useLandingCompany from './useLandingCompany'; /** * A hook to determine if region is Eu using the useLandingCompany hook */ const useIsEuRegion = () => { /** Retrieve landing company data*/ const { data: landing_company, ...rest } = useLandingCompany(); + const { data: activeWallet } = useActiveWalletAccount(); + const isMFAccount = activeWallet?.loginid?.startsWith('MF'); const isEuRegion = useMemo(() => { - if (!landing_company) return false; + if (!landing_company || !isMFAccount) return false; /** Regular expressions for EU shortcodes and excluded residence */ const eu_shortcode_regex = /^maltainvest$/; @@ -32,18 +36,18 @@ const useIsEuRegion = () => { /** is region Eu based on residence */ const is_eu_based_on_residence = !shortcodes && is_residence_eu; - return is_financial_maltainvest || is_eu_based_on_shortcodes || is_eu_based_on_residence; - }, [landing_company]); + return isMFAccount && (is_financial_maltainvest || is_eu_based_on_shortcodes || is_eu_based_on_residence); + }, [isMFAccount, landing_company]); // New method to test, if this works will remove the legacy method above const isEUCountry = useMemo(() => { - if (!landing_company) return; + if (!landing_company || !isMFAccount) return; const { gaming_company, financial_company } = landing_company; - const isEuRegion = !gaming_company && financial_company?.shortcode === 'maltainvest'; + const isEuRegion = isMFAccount && !gaming_company && financial_company?.shortcode === 'maltainvest'; return isEuRegion; - }, [landing_company]); + }, [isMFAccount, landing_company]); return { /** A boolean flag indicating if the region is within the EU */