Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
ba4a7e0
fix: keep template search selections distinct
ishpaul777 Nov 19, 2026
e3c9b01
test: cover template search selection and edits
ishpaul777 Nov 19, 2026
fa72fbf
fix: preserve literal template search names
ishpaul777 Nov 19, 2026
c830738
test: cover template search compatibility
ishpaul777 Nov 19, 2026
94a4904
fix: match export suggestions to inserted query
ishpaul777 Nov 19, 2026
5665faa
test: verify export suggestion previews
ishpaul777 Nov 19, 2026
9ff7a2a
fix: preserve export autocomplete clause meaning
ishpaul777 Nov 19, 2026
67a522e
test: cover export autocomplete clause edits
ishpaul777 Nov 19, 2026
c2d9e20
Merge remote-tracking branch 'upstream/main' into ishpaul/107372-dist…
ishpaul777 Nov 25, 2026
ba60123
Merge remote-tracking branch 'upstream/main' into ishpaul/107372-dist…
ishpaul777 Nov 30, 2026
74ae09c
fix: preserve export autocomplete inequality
ishpaul777 Nov 30, 2026
4e4e0b6
fix: distinguish export choices for screen readers
ishpaul777 Nov 30, 2026
de23ba3
Preserve saved export destination filters
ishpaul777 Nov 30, 2026
65726db
Parse compact export destination exclusions
ishpaul777 Nov 30, 2026
59f57ef
Preserve export filter query semantics
ishpaul777 Dec 1, 2026
abd7e3c
Localize export picker labels and restore saved integration icons
ishpaul777 Dec 1, 2026
499c1d0
Merge remote-tracking branch 'upstream/main' into ishpaul/107372-dist…
ishpaul777 Dec 1, 2026
39d8b35
Check the selected grouped report in Jest
ishpaul777 Dec 1, 2026
34e7b72
Generate localized export destination labels
ishpaul777 Dec 1, 2026
6fb4f59
Use verb-led names for export icon helpers
ishpaul777 Dec 1, 2026
c79da64
Merge remote-tracking branch 'upstream/main' into ishpaul/107372-dist…
ishpaul777 Dec 1, 2026
62fe31a
Move export label lookup into AccountingUtils
ishpaul777 Dec 2, 2026
7258b88
Merge remote-tracking branch 'upstream/main' into ishpaul/107372-dist…
ishpaul777 Dec 2, 2026
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
6 changes: 6 additions & 0 deletions src/CONST/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,8 @@ const CONST = {

EXPORT_LABELS: {
NETSUITE: 'NetSuite',
NETSUITE_QUICKSTART: 'NetSuite QuickStart',
SAGE_ACCOUNTING: 'Sage Accounting',
INTUIT_ENTERPRISE_SUITE: 'Intuit Enterprise Suite',
QBO: 'QuickBooks Online',
QBD: 'QuickBooks Desktop',
Expand Down Expand Up @@ -9448,6 +9450,8 @@ const CONST = {
EXPENSE: 'expense',
REPORT: 'report',
},
// Auth supports COUNT exports even though App does not list the connection.
COUNT_EXPORT_LABEL: 'COUNT',
SYNTAX_FILTER_KEYS: {
TYPE: 'type',
STATUS: 'status',
Expand Down Expand Up @@ -9510,6 +9514,7 @@ const CONST = {
IS: 'is',
REPORT_FIELD: 'reportField',
EXPORTED_TO: 'exportedTo',
EXPORTED_TO_TEMPLATE: 'exportedToTemplate',
SUBMITTER_USER_ID: 'submitterUserID',
SUBMITTER_PAYROLL_ID: 'submitterPayrollID',
ORDER_DEAL_NUMBERS: 'orderDealNumbers',
Expand Down Expand Up @@ -9610,6 +9615,7 @@ const CONST = {
IS: 'is',
REPORT_FIELD: 'report-field',
EXPORTED_TO: 'exported-to',
EXPORTED_TO_TEMPLATE: 'exported-to-template',
SUBMITTER_USER_ID: 'submitter-user-id',
SUBMITTER_PAYROLL_ID: 'submitter-payroll-id',
ORDER_DEAL_NUMBERS: 'order-deal-numbers',
Expand Down
86 changes: 58 additions & 28 deletions src/components/Search/FilterComponents/ExportedToSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,39 @@ import useStyleUtils from '@hooks/useStyleUtils';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';

import {getExportLabelsForConnection, getStandardExportTemplateDisplayName, isStandardExportTemplate} from '@libs/AccountingUtils';
import {
EXPORT_TEMPLATE_SEARCH_PREFIX,
getConnectionNameFromExportLabel,
getExportLabelsForConnection,
getExportedToDisplayName,
getExportTemplateSearchValue,
getStandardExportTemplateDisplayName,
isStandardExportTemplate,
} from '@libs/AccountingUtils';
import {getIntegrationIcon} from '@libs/ReportUtils';
import {getAllPolicyValues, getConnectedIntegrationNamesForPolicies} from '@libs/SearchQueryUtils';

import variables from '@styles/variables';

import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type {ConnectionName} from '@src/types/onyx/Policy';
import type IconAsset from '@src/types/utils/IconAsset';

import React from 'react';
import {View} from 'react-native';

import MultiSelect from './MultiSelect';

const integrationConnectionNames = CONST.POLICY.CONNECTIONS.ACCOUNTING_CONNECTION_NAMES;

type ExportedToSelectorProps = SearchFilterCommonProps<string[] | undefined> & {
policyID: Filter | undefined;
};

function ExportedToSelector({value = [], policyID, selectionListTextInputStyle, selectionListStyle, autoFocus, footer, onChange}: ExportedToSelectorProps) {
const styles = useThemeStyles();
const {localeCompare} = useLocalize();
const {localeCompare, translate} = useLocalize();
const StyleUtils = useStyleUtils();
const theme = useTheme();
const expensifyIcons = useMemoizedLazyExpensifyIcons([
Expand All @@ -49,6 +60,7 @@ function ExportedToSelector({value = [], policyID, selectionListTextInputStyle,
'BusinessCentralSquare',
'OdooSquare',
'GustoSquare',
'Export',
'Table',
'TablePencil',
]);
Expand All @@ -59,45 +71,46 @@ function ExportedToSelector({value = [], policyID, selectionListTextInputStyle,
const policiesToLoadTemplatesFrom = getAllPolicyValues(policyID, ONYXKEYS.COLLECTION.POLICY, policies);
const exportTemplates = useCombinedExportTemplates(policiesToLoadTemplatesFrom);

const integrationConnectionNames = CONST.POLICY.CONNECTIONS.ACCOUNTING_CONNECTION_NAMES;

const tableIconForExportOption = (tableIcon: IconAsset) => (
const getSmallIconForExportOption = (icon: IconAsset) => (
<View style={[styles.mr3, styles.alignItemsCenter, styles.justifyContentCenter, StyleUtils.getWidthAndHeightStyle(variables.w28, variables.h28)]}>
<Icon
src={tableIcon}
src={icon}
fill={theme.icon}
width={variables.iconSizeNormal}
height={variables.iconSizeNormal}
/>
</View>
);
const getIntegrationIconForExportOption = (label: string, connectionName?: ConnectionName) => {
const isIntuitEnterpriseSuite = label.toLowerCase() === CONST.EXPORT_LABELS.INTUIT_ENTERPRISE_SUITE.toLowerCase();
const icon = isIntuitEnterpriseSuite ? expensifyIcons.IntuitSquare : getIntegrationIcon(connectionName ?? getConnectionNameFromExportLabel(label), expensifyIcons);
return icon ? (
<View style={[styles.mr3, styles.alignItemsCenter, styles.justifyContentCenter]}>
<Icon
src={icon}
width={variables.iconSizeXLarge}
height={variables.iconSizeXLarge}
additionalStyles={[StyleUtils.getAvatarBorderStyle(CONST.AVATAR_SIZE.DEFAULT, CONST.AVATAR_SHAPE.CIRCLE)]}
/>
</View>
) : (
getSmallIconForExportOption(expensifyIcons.Export)
);
};

const exportedToPickerOptions = (() => {
const integrationConnectionNamesSet = new Set<string>(integrationConnectionNames);

const connectedIntegrationPickerItems = integrationConnectionNames
.filter((connectionName) => connectedIntegrationNames.has(connectionName))
.flatMap((connectionName) => {
const searchValues = getExportLabelsForConnection(connectionName, policiesToLoadTemplatesFrom);
return searchValues.map((searchValue) => {
const isIntuitEnterpriseSuite = searchValue === CONST.EXPORT_LABELS.INTUIT_ENTERPRISE_SUITE;
const icon = isIntuitEnterpriseSuite ? expensifyIcons.IntuitSquare : getIntegrationIcon(connectionName, expensifyIcons);
return {
text: searchValue,
value: searchValue,
leftElement: icon ? (
<View style={[styles.mr3, styles.alignItemsCenter, styles.justifyContentCenter]}>
<Icon
src={icon}
width={variables.iconSizeXLarge}
height={variables.iconSizeXLarge}
additionalStyles={[StyleUtils.getAvatarBorderStyle(CONST.AVATAR_SIZE.DEFAULT, CONST.AVATAR_SHAPE.CIRCLE)]}
/>
</View>
) : (
tableIconForExportOption(expensifyIcons.Table)
),
};
});
return searchValues.map((searchValue) => ({
text: searchValue,
accessibilityLabel: translate('search.exportIntegrationAccessibilityLabel', searchValue),
value: searchValue,
leftElement: getIntegrationIconForExportOption(searchValue, connectionName),
}));
});

const usedPickerValueKeys = new Set(connectedIntegrationPickerItems.map((item) => item.value));
Expand All @@ -113,16 +126,33 @@ function ExportedToSelector({value = [], policyID, selectionListTextInputStyle,

// Standard templates are filtered on by the label the backend records for them, while custom templates are filtered on by their display name
const isStandardTemplate = isStandardExportTemplate(template.templateName);
const filterValue = isStandardTemplate ? getStandardExportTemplateDisplayName(template.templateName) : displayName;
const templateLabel = isStandardTemplate ? getStandardExportTemplateDisplayName(template.templateName) : displayName;
const filterValue = getExportTemplateSearchValue(templateLabel);
if (usedPickerValueKeys.has(filterValue)) {
continue;
}

usedPickerValueKeys.add(filterValue);
standardAndIntegrationCustomTemplatePickerItems.push({
text: displayName,
accessibilityLabel: translate('search.exportTemplateAccessibilityLabel', displayName),
value: filterValue,
leftElement: tableIconForExportOption(isStandardTemplate ? expensifyIcons.Table : expensifyIcons.TablePencil),
leftElement: getSmallIconForExportOption(isStandardTemplate ? expensifyIcons.Table : expensifyIcons.TablePencil),
});
}

// Saved destinations can outlive connections and cached templates.
for (const selectedValue of value) {
if (usedPickerValueKeys.has(selectedValue)) {
continue;
}
const displayName = getExportedToDisplayName(selectedValue);
const isTemplate = selectedValue.startsWith(EXPORT_TEMPLATE_SEARCH_PREFIX);
standardAndIntegrationCustomTemplatePickerItems.push({
text: displayName,
accessibilityLabel: translate(isTemplate ? 'search.exportTemplateAccessibilityLabel' : 'search.exportIntegrationAccessibilityLabel', displayName),
value: selectedValue,
leftElement: isTemplate ? getSmallIconForExportOption(expensifyIcons.TablePencil) : getIntegrationIconForExportOption(displayName),
});
}

Expand Down
4 changes: 4 additions & 0 deletions src/components/Search/FilterComponents/MultiSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ type MultiSelectItem<T> = {
leftElement?: ReactNode;
searchableText?: string;

/** Overrides the row's spoken label without changing its visible text. */
accessibilityLabel?: string;

/** Optional supporting text rendered on a second line beneath `text` */
alternateText?: string;
};
Expand Down Expand Up @@ -124,6 +127,7 @@ function MultiSelect<T extends string>({
const listData: ListItem[] = filteredItems.map((item) => ({
text: item.text,
alternateText: item.alternateText,
accessibilityLabel: item.accessibilityLabel,
keyForList: item.value,
isSelected: !!selectedItems.find((i) => i.value === item.value),
icons: item.icons,
Expand Down
13 changes: 10 additions & 3 deletions src/components/Search/SearchAutocompleteList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import useSortedReportActionsData from '@hooks/useSortedReportActionsData';
import useThemeStyles from '@hooks/useThemeStyles';
import useTransactionsByID from '@hooks/useTransactionsByID';

import {EXPORT_TEMPLATE_SEARCH_PREFIX, getExportedToDisplayName} from '@libs/AccountingUtils';
import FS from '@libs/Fullstory';
import type {Options, SearchOption} from '@libs/OptionsListUtils';
import {combineOrderingOfReportsAndPersonalDetails, getSearchOptions} from '@libs/OptionsListUtils';
Expand Down Expand Up @@ -131,7 +132,9 @@ const setPerformanceTimersEnd = () => {
};

function getAutocompleteDisplayText(filterKey: UserFriendlyKey, value: string) {
return `${filterKey}:${value}`;
const isEncodedTemplate = filterKey === CONST.SEARCH.SEARCH_USER_FRIENDLY_KEYS.EXPORTED_TO && value.startsWith(EXPORT_TEMPLATE_SEARCH_PREFIX);
const displayKey = isEncodedTemplate ? CONST.SEARCH.SEARCH_USER_FRIENDLY_KEYS.EXPORTED_TO_TEMPLATE : filterKey;
return `${displayKey}:${isEncodedTemplate ? getExportedToDisplayName(value) : value}`;
}

function SearchRouterItem({
Expand Down Expand Up @@ -255,7 +258,7 @@ function SearchAutocompleteList({
const currentUserPersonalDetails = useCurrentUserPersonalDetails();
const currentUserEmail = currentUserPersonalDetails.email ?? '';
const currentUserAccountID = currentUserPersonalDetails.accountID;
const expensifyIcons = useMemoizedLazyExpensifyIcons(['History', 'MagnifyingGlass']);
const expensifyIcons = useMemoizedLazyExpensifyIcons(['History', 'MagnifyingGlass', 'TablePencil']);
const taxRates = getAllTaxRates(policies);
const [isTrackIntentUser] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED, {selector: isTrackIntentUserSelector});

Expand Down Expand Up @@ -734,7 +737,11 @@ function SearchAutocompleteList({
return {
text: getAutocompleteDisplayText(filterKey, text),
mapKey: mapKey ? getSubstitutionMapKey(mapKey, text) : undefined,
singleIcon: expensifyIcons.MagnifyingGlass,
singleIcon:
filterKey === CONST.SEARCH.SEARCH_USER_FRIENDLY_KEYS.EXPORTED_TO_TEMPLATE ||
(filterKey === CONST.SEARCH.SEARCH_USER_FRIENDLY_KEYS.EXPORTED_TO && text.startsWith(EXPORT_TEMPLATE_SEARCH_PREFIX))
? expensifyIcons.TablePencil
: expensifyIcons.MagnifyingGlass,
searchQuery: text,
autocompleteID,
keyForList: autocompleteID ?? text,
Expand Down
7 changes: 3 additions & 4 deletions src/components/Search/SearchRouter/SearchRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ import Parser from '@libs/Parser';
import {getAllTaxRates} from '@libs/PolicyUtils';
import {isHiddenForCurrentUser, isInvoiceReport, isMoneyRequestReport, isOneOnOneChat} from '@libs/ReportUtils';
import type {OptionData} from '@libs/ReportUtils';
import {getAutocompleteQueryWithComma, getTrimmedUserSearchQueryPreservingComma} from '@libs/SearchAutocompleteUtils';
import {getAutocompleteQueryWithComma, getQueryWithAutocompleteSelection} from '@libs/SearchAutocompleteUtils';
import {searchKeyToSavedSearchID} from '@libs/SearchKeyUtils';
import {buildSearchQueryJSON, buildUserReadableQueryString, getQueryWithPreservedSort, getQueryWithUpdatedValues, sanitizeSearchValue} from '@libs/SearchQueryUtils';
import {buildSearchQueryJSON, buildUserReadableQueryString, getQueryWithPreservedSort, getQueryWithUpdatedValues} from '@libs/SearchQueryUtils';
import StringUtils from '@libs/StringUtils';
import {
beginSearchRouterQuerySession,
Expand Down Expand Up @@ -486,8 +486,7 @@ function SearchRouter({onRouterClose, shouldHideInputCaret, isSearchRouterDispla
setFocusAndScrollToRight();
} else if (item.searchItemType === CONST.SEARCH.SEARCH_ROUTER_ITEM_TYPE.AUTOCOMPLETE_SUGGESTION && textInputValue) {
const fieldKey = item.mapKey?.includes(':') ? item.mapKey.split(':').at(0) : item.mapKey;
const trimmedUserSearchQuery = getTrimmedUserSearchQueryPreservingComma(textInputValue, fieldKey);
const newSearchQuery = `${trimmedUserSearchQuery}${sanitizeSearchValue(item.searchQuery)}\u00A0`;
const newSearchQuery = getQueryWithAutocompleteSelection(textInputValue, fieldKey, item.searchQuery);
onSearchQueryChange(newSearchQuery, true, undefined, false);
setSelection({start: newSearchQuery.length, end: newSearchQuery.length});

Expand Down
17 changes: 13 additions & 4 deletions src/hooks/useAutocompleteSuggestions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type {LocaleContextProps} from '@components/LocaleContextProvider';
import type {SubstitutionMap} from '@components/Search/SearchRouter/getQueryWithSubstitutions';
import type {SearchFilterKey, UserFriendlyKey} from '@components/Search/types';

import {EXPORT_TEMPLATE_SEARCH_PREFIX, getExportedToDisplayName, getExportedToPickerValue} from '@libs/AccountingUtils';
import {getBankAccountSearchLabel, isFilterableBankAccount} from '@libs/BankAccountUtils';
import {getCardFeedsForDisplay} from '@libs/CardFeedUtils';
import {getCardDescription, isCard, isCardHiddenFromSearch} from '@libs/CardUtils';
Expand Down Expand Up @@ -668,18 +669,26 @@ function useAutocompleteSuggestions({

return filteredIsValues.map((isValue) => ({filterKey: CONST.SEARCH.SEARCH_USER_FRIENDLY_KEYS.IS, text: isValue}));
}
case CONST.SEARCH.SYNTAX_FILTER_KEYS.EXPORTED_TO_TEMPLATE:
case CONST.SEARCH.SYNTAX_FILTER_KEYS.EXPORTED_TO: {
const isTemplateFilter = autocompleteKey === CONST.SEARCH.SYNTAX_FILTER_KEYS.EXPORTED_TO_TEMPLATE;
const selectedExports = new Set(
ranges
.filter((range) => range.key === CONST.SEARCH.SYNTAX_FILTER_KEYS.EXPORTED_TO || range.key === CONST.SEARCH.SYNTAX_FILTER_KEYS.EXPORTED_TO_TEMPLATE)
.map((range) => getExportedToPickerValue(range.value, range.key === CONST.SEARCH.SYNTAX_FILTER_KEYS.EXPORTED_TO_TEMPLATE).toLowerCase()),
);
const filteredExportedTo = exportedToFilterOptions
.filter((value) => !isTemplateFilter || value.startsWith(EXPORT_TEMPLATE_SEARCH_PREFIX))
.filter((value) => {
const lowerValue = value.toLowerCase();
return lowerValue.includes(autocompleteValue.toLowerCase()) && !alreadyAutocompletedKeys.has(lowerValue);
return getExportedToDisplayName(value).toLowerCase().includes(autocompleteValue.toLowerCase()) && !selectedExports.has(lowerValue);
})
.sort()
.slice(0, 10);
return filteredExportedTo.map((value) => ({
filterKey: CONST.SEARCH.SEARCH_USER_FRIENDLY_KEYS.EXPORTED_TO,
text: value,
mapKey: CONST.SEARCH.SYNTAX_FILTER_KEYS.EXPORTED_TO,
filterKey: isTemplateFilter ? CONST.SEARCH.SEARCH_USER_FRIENDLY_KEYS.EXPORTED_TO_TEMPLATE : CONST.SEARCH.SEARCH_USER_FRIENDLY_KEYS.EXPORTED_TO,
text: isTemplateFilter ? getExportedToDisplayName(value) : value,
mapKey: isTemplateFilter ? CONST.SEARCH.SYNTAX_FILTER_KEYS.EXPORTED_TO_TEMPLATE : CONST.SEARCH.SYNTAX_FILTER_KEYS.EXPORTED_TO,
}));
}
case CONST.SEARCH.SYNTAX_FILTER_KEYS.ANY_APPROVAL:
Expand Down
8 changes: 5 additions & 3 deletions src/hooks/useExportedToFilterOptions.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {useSearchQueryContext} from '@components/Search/SearchContext';
import type {Filter} from '@components/Search/types';

import {getExportLabelsForConnection, getStandardExportTemplateDisplayName} from '@libs/AccountingUtils';
import {getExportLabelsForConnection, getExportTemplateSearchValue, getStandardExportTemplateDisplayName} from '@libs/AccountingUtils';
import {getAllPolicyValues, getConnectedIntegrationNamesForPolicies, getFilterFromQuery} from '@libs/SearchQueryUtils';

import CONST from '@src/CONST';
Expand Down Expand Up @@ -51,7 +51,9 @@ function exportedToPoliciesSelector(policies: OnyxCollection<Policy>): OnyxColle
*/
export default function useExportedToFilterOptions(policyIDsOverride?: Filter): UseExportedToFilterDataResult {
const {currentSearchQueryJSON} = useSearchQueryContext();
const [policies] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {selector: exportedToPoliciesSelector});
const [policies] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {
selector: exportedToPoliciesSelector,
});

// When search is scoped to workspaces, use only those policies otherwise use all.
const policiesToUse = getAllPolicyValues(
Expand All @@ -71,7 +73,7 @@ export default function useExportedToFilterOptions(policyIDsOverride?: Filter):

const standardExportTemplateDisplayName = getStandardExportTemplateDisplayName(template.templateName);
const filterValue = standardExportTemplateDisplayName !== template.templateName ? standardExportTemplateDisplayName : (template.name ?? template.templateName);
standardAndCustomExportTemplates.push(filterValue);
standardAndCustomExportTemplates.push(getExportTemplateSearchValue(filterValue));
}

// React Compiler stops memoizing a value made before a hook call and passed to a function after it, unless the hook also received it, so the policy IDs are read again here.
Expand Down
Loading
Loading