diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx index a3eae0e19f24..a55b293fc3a1 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage.tsx @@ -5,9 +5,11 @@ import SelectionList from '@components/SelectionList'; import RadioListItem from '@components/SelectionList/RadioListItem'; import type {ListItem} from '@components/SelectionList/types'; 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 * as PolicyUtils from '@libs/PolicyUtils'; import {getAdminEmployees} from '@libs/PolicyUtils'; import Navigation from '@navigation/Navigation'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; @@ -25,22 +27,29 @@ function QuickbooksPreferredExporterConfigurationPage({policy}: WithPolicyConnec const styles = useThemeStyles(); const {export: exportConfiguration} = policy?.connections?.quickbooksOnline?.config ?? {}; const exporters = getAdminEmployees(policy); + const {login: currentUserLogin} = useCurrentUserPersonalDetails(); const policyID = policy?.id ?? ''; const data: CardListItem[] = useMemo( () => - exporters?.reduce((vendors, vendor) => { - if (vendor.email) { - vendors.push({ - value: vendor.email, - text: vendor.email, - keyForList: vendor.email, - isSelected: exportConfiguration?.exporter === vendor.email, - }); + exporters?.reduce((options, exporter) => { + if (!exporter.email) { + return options; } - return vendors; + + // Don't show guides if the current user is not a guide themselves or an Expensify employee + if (PolicyUtils.isExpensifyTeam(exporter.email) && !PolicyUtils.isExpensifyTeam(policy?.owner) && !PolicyUtils.isExpensifyTeam(currentUserLogin)) { + return options; + } + options.push({ + value: exporter.email, + text: exporter.email, + keyForList: exporter.email, + isSelected: exportConfiguration?.exporter === exporter.email, + }); + return options; }, []), - [exportConfiguration, exporters], + [exportConfiguration, exporters, currentUserLogin, policy?.owner], ); const selectExporter = useCallback(