Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/components/Profile/views/IdentityVerification.view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,18 +108,24 @@ const IdentityVerificationView = () => {
}
}, [showUserDetailsForm])

// Bridge country object for all bridge supported countries
const bridgeCountryObject = useMemo(
() => ({ title: 'Bridge', id: 'bridge', type: 'bridge', description: '', path: 'bridge' }),
[]
)

// Memoized country lookup from URL param
const selectedCountryParams = useMemo(() => {
if (countryParam) {
const country = countryData.find((country) => country.id.toUpperCase() === countryParam.toUpperCase())
if (country) {
return country
} else {
return { title: 'Bridge', id: 'bridge', type: 'bridge', description: '', path: 'bridge' }
return bridgeCountryObject
}
}
return null
}, [countryParam])
}, [countryParam, bridgeCountryObject])

// Skip country selection if coming from a supported bridge country
useEffect(() => {
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/useIdentityVerification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -249,15 +249,15 @@ export const useIdentityVerification = () => {
]
}, [])

const isBridgeSupportedCountry = (code: string) => {
const isBridgeSupportedCountry = useCallback((code: string) => {
const upper = code.toUpperCase()
return (
upper === 'US' ||
upper === 'MX' ||
Object.keys(BRIDGE_ALPHA3_TO_ALPHA2).includes(upper) ||
Object.values(BRIDGE_ALPHA3_TO_ALPHA2).includes(upper)
)
}
}, [])

return {
lockedRegions,
Expand Down
Loading