diff --git a/src/pages/workspace/accounting/xero/export/XeroPreferredExporterSelectPage.tsx b/src/pages/workspace/accounting/xero/export/XeroPreferredExporterSelectPage.tsx index d56eb3476863..ce79ded13f9d 100644 --- a/src/pages/workspace/accounting/xero/export/XeroPreferredExporterSelectPage.tsx +++ b/src/pages/workspace/accounting/xero/export/XeroPreferredExporterSelectPage.tsx @@ -5,10 +5,11 @@ import RadioListItem from '@components/SelectionList/RadioListItem'; import type {ListItem} from '@components/SelectionList/types'; import SelectionScreen from '@components/SelectionScreen'; import Text from '@components/Text'; +import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as Connections from '@libs/actions/connections'; -import {getAdminEmployees} from '@libs/PolicyUtils'; +import {getAdminEmployees, isExpensifyTeam} from '@libs/PolicyUtils'; import Navigation from '@navigation/Navigation'; import type {WithPolicyConnectionsProps} from '@pages/workspace/withPolicyConnections'; import withPolicyConnections from '@pages/workspace/withPolicyConnections'; @@ -25,6 +26,7 @@ function XeroPreferredExporterSelectPage({policy}: WithPolicyConnectionsProps) { const styles = useThemeStyles(); const policyOwner = policy?.owner ?? ''; const exporters = getAdminEmployees(policy); + const {login: currentUserLogin} = useCurrentUserPersonalDetails(); const policyID = policy?.id ?? ''; const data: CardListItem[] = useMemo(() => { @@ -38,18 +40,26 @@ function XeroPreferredExporterSelectPage({policy}: WithPolicyConnectionsProps) { }, ]; } - return exporters?.reduce((vendors, vendor) => { - if (vendor.email) { - vendors.push({ - value: vendor.email, - text: vendor.email, - keyForList: vendor.email, - isSelected: exportConfiguration?.exporter === vendor.email, - }); + + return exporters?.reduce((options, exporter) => { + if (!exporter.email) { + return options; + } + + // Don't show guides if the current user is not a guide themselves or an Expensify employee + if (isExpensifyTeam(exporter.email) && !isExpensifyTeam(policyOwner) && !isExpensifyTeam(currentUserLogin)) { + return options; } - return vendors; + + options.push({ + value: exporter.email, + text: exporter.email, + keyForList: exporter.email, + isSelected: exportConfiguration?.exporter === exporter.email, + }); + return options; }, []); - }, [exportConfiguration, exporters, policyOwner]); + }, [exportConfiguration, exporters, policyOwner, currentUserLogin]); const selectExporter = useCallback( (row: CardListItem) => {