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
45 changes: 15 additions & 30 deletions src/components/MoneyRequestHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import useDeleteTransactions from '@hooks/useDeleteTransactions';
import useDuplicateTransactionsAndViolations from '@hooks/useDuplicateTransactionsAndViolations';
import useGetIOUReportFromReportAction from '@hooks/useGetIOUReportFromReportAction';
import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset';
import useLoadingBarVisibility from '@hooks/useLoadingBarVisibility';
import useLocalize from '@hooks/useLocalize';
import useOnyx from '@hooks/useOnyx';
Expand Down Expand Up @@ -60,6 +59,7 @@
import HoldOrRejectEducationalModal from './HoldOrRejectEducationalModal';
import HoldSubmitterEducationalModal from './HoldSubmitterEducationalModal';
import Icon from './Icon';
import * as Expensicons from './Icon/Expensicons';

Check warning on line 62 in src/components/MoneyRequestHeader.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

'./Icon/Expensicons' import is restricted from being used by a pattern. Direct imports from Icon/Expensicons are deprecated. Please use lazy loading hooks instead. Use `useMemoizedLazyExpensifyIcons` from @hooks/useLazyAsset. See docs/LAZY_ICONS_AND_ILLUSTRATIONS.md for details
import LoadingBar from './LoadingBar';
import type {MoneyRequestHeaderStatusBarProps} from './MoneyRequestHeaderStatusBar';
import MoneyRequestHeaderStatusBar from './MoneyRequestHeaderStatusBar';
Expand Down Expand Up @@ -108,7 +108,6 @@
> | null>(null);
const [dismissedRejectUseExplanation] = useOnyx(ONYXKEYS.NVP_DISMISSED_REJECT_USE_EXPLANATION, {canBeMissing: true});
const [dismissedHoldUseExplanation] = useOnyx(ONYXKEYS.NVP_DISMISSED_HOLD_USE_EXPLANATION, {canBeMissing: true});
const [allSnapshots] = useOnyx(ONYXKEYS.COLLECTION.SNAPSHOT, {canBeMissing: true});
const shouldShowLoadingBar = useLoadingBarVisibility();
const styles = useThemeStyles();
const theme = useTheme();
Expand Down Expand Up @@ -155,37 +154,24 @@
/>
);

const expensifyIcons = useMemoizedLazyExpensifyIcons([
'Stopwatch',
'Hourglass',
'Flag',
'CreditCardHourglass',
'ReceiptScan',
'ArrowSplit',
'ArrowCollapse',
'Info',
'Trashcan',
'ThumbsDown',
]);

const getStatusBarProps: () => MoneyRequestHeaderStatusBarProps | undefined = () => {
if (isOnHold) {
return {icon: getStatusIcon(expensifyIcons.Stopwatch), description: translate('iou.expenseOnHold')};
return {icon: getStatusIcon(Expensicons.Stopwatch), description: translate('iou.expenseOnHold')};
}
if (isMarkAsResolvedAction(parentReport, transactionViolations, policy)) {
return {icon: getStatusIcon(expensifyIcons.Hourglass), description: translate('iou.reject.rejectedStatus')};
return {icon: getStatusIcon(Expensicons.Hourglass), description: translate('iou.reject.rejectedStatus')};
}

if (isDuplicate) {
return {icon: getStatusIcon(expensifyIcons.Flag), description: translate('iou.expenseDuplicate')};
return {icon: getStatusIcon(Expensicons.Flag), description: translate('iou.expenseDuplicate')};
}

if (isExpensifyCardTransaction(transaction) && isPending(transaction)) {
return {icon: getStatusIcon(expensifyIcons.CreditCardHourglass), description: translate('iou.transactionPendingDescription')};
return {icon: getStatusIcon(Expensicons.CreditCardHourglass), description: translate('iou.transactionPendingDescription')};
}
if (shouldShowBrokenConnectionViolation) {
return {
icon: getStatusIcon(expensifyIcons.Hourglass),
icon: getStatusIcon(Expensicons.Hourglass),
description: (
<BrokenConnectionDescription
transactionID={transaction?.transactionID}
Expand All @@ -196,10 +182,10 @@
};
}
if (hasPendingRTERViolation) {
return {icon: getStatusIcon(expensifyIcons.Hourglass), description: translate('iou.pendingMatchWithCreditCardDescription')};
return {icon: getStatusIcon(Expensicons.Hourglass), description: translate('iou.pendingMatchWithCreditCardDescription')};
}
if (isScanning(transaction)) {
return {icon: getStatusIcon(expensifyIcons.ReceiptScan), description: translate('iou.receiptScanInProgressDescription')};
return {icon: getStatusIcon(Expensicons.ReceiptScan), description: translate('iou.receiptScanInProgressDescription')};
}
};

Expand Down Expand Up @@ -308,7 +294,7 @@
const secondaryActionsImplementation: Record<ValueOf<typeof CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS>, DropdownOption<ValueOf<typeof CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS>>> = {
[CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS.HOLD]: {
text: translate('iou.hold'),
icon: expensifyIcons.Stopwatch,
icon: Expensicons.Stopwatch,
value: CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS.HOLD,
onSelected: () => {
if (!parentReportAction) {
Expand All @@ -333,7 +319,7 @@
},
[CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS.REMOVE_HOLD]: {
text: translate('iou.unhold'),
icon: expensifyIcons.Stopwatch,
icon: Expensicons.Stopwatch,
value: CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS.REMOVE_HOLD,
onSelected: () => {
if (!parentReportAction) {
Expand All @@ -345,15 +331,15 @@
},
[CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS.SPLIT]: {
text: isExpenseSplit ? translate('iou.editSplits') : translate('iou.split'),
icon: expensifyIcons.ArrowSplit,
icon: Expensicons.ArrowSplit,
value: CONST.REPORT.SECONDARY_ACTIONS.SPLIT,
onSelected: () => {
initSplitExpense(allTransactions, allReports, transaction);
},
},
[CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS.MERGE]: {
text: translate('common.merge'),
icon: expensifyIcons.ArrowCollapse,
icon: Expensicons.ArrowCollapse,
value: CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS.MERGE,
onSelected: () => {
if (!transaction) {
Expand All @@ -367,22 +353,22 @@
[CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS.VIEW_DETAILS]: {
value: CONST.REPORT.SECONDARY_ACTIONS.VIEW_DETAILS,
text: translate('iou.viewDetails'),
icon: expensifyIcons.Info,
icon: Expensicons.Info,
onSelected: () => {
navigateToDetailsPage(report, Navigation.getActiveRoute());
},
},
[CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS.DELETE]: {
text: translate('common.delete'),
icon: expensifyIcons.Trashcan,
icon: Expensicons.Trashcan,
value: CONST.REPORT.SECONDARY_ACTIONS.DELETE,
onSelected: () => {
setIsDeleteModalVisible(true);
},
},
[CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS.REJECT]: {
text: translate('common.reject'),
icon: expensifyIcons.ThumbsDown,
icon: Expensicons.ThumbsDown,
value: CONST.REPORT.TRANSACTION_SECONDARY_ACTIONS.REJECT,
onSelected: () => {
if (dismissedRejectUseExplanation) {
Expand Down Expand Up @@ -498,7 +484,6 @@
isSingleTransactionView: true,
isChatReportArchived: isParentReportArchived,
isChatIOUReportArchived,
allSnapshots,
});
} else {
deleteTransactions([transaction.transactionID], duplicateTransactions, duplicateTransactionViolations, currentSearchHash, true);
Expand Down
30 changes: 8 additions & 22 deletions src/hooks/useDeleteTransactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ type UseDeleteTransactionsParams = {
function useDeleteTransactions({report, reportActions, policy}: UseDeleteTransactionsParams) {
const [allTransactions] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION, {canBeMissing: false});
const [allReports] = useOnyx(ONYXKEYS.COLLECTION.REPORT, {canBeMissing: true});
const [allSnapshots] = useOnyx(ONYXKEYS.COLLECTION.SNAPSHOT, {canBeMissing: true});
const [policyCategories] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${getNonEmptyStringOnyxID(report?.policyID)}`, {canBeMissing: true});
const [allPolicyRecentlyUsedCategories] = useOnyx(ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_CATEGORIES, {canBeMissing: true});
const [allReportNameValuePairs] = useOnyx(ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS, {canBeMissing: true});
Expand Down Expand Up @@ -137,19 +136,18 @@ function useDeleteTransactions({report, reportActions, policy}: UseDeleteTransac
const chatReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${iouReport?.chatReportID}`];
const chatIOUReportID = chatReport?.reportID;
const isChatIOUReportArchived = archivedReportsIdSet.has(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${chatIOUReportID}`);
deleteMoneyRequest({
deleteMoneyRequest(
transactionID,
reportAction: action,
transactions: duplicateTransactions,
violations: duplicateTransactionViolations,
action,
duplicateTransactions,
duplicateTransactionViolations,
iouReport,
chatReport,
isChatIOUReportArchived,
allSnapshots,
isSingleTransactionView,
transactionIDsPendingDeletion: deletedTransactionIDs,
selectedTransactionIDs: transactionIDs,
});
deletedTransactionIDs,
transactionIDs,
);
deletedTransactionIDs.push(transactionID);
if (action.childReportID) {
deletedTransactionThreadReportIDs.add(action.childReportID);
Expand All @@ -158,19 +156,7 @@ function useDeleteTransactions({report, reportActions, policy}: UseDeleteTransac

return Array.from(deletedTransactionThreadReportIDs);
},
[
reportActions,
allTransactions,
allReports,
report,
allReportNameValuePairs,
allPolicyRecentlyUsedCategories,
policyCategories,
policy,
archivedReportsIdSet,
isBetaEnabled,
allSnapshots,
],
[reportActions, allTransactions, allReports, report, allReportNameValuePairs, allPolicyRecentlyUsedCategories, policyCategories, policy, archivedReportsIdSet, isBetaEnabled],
);

return {
Expand Down
33 changes: 17 additions & 16 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
import type {Message, OldDotReportAction, ReportActions} from '@src/types/onyx/ReportAction';
import type {PendingChatMember} from '@src/types/onyx/ReportMetadata';
import type {OnyxData} from '@src/types/onyx/Request';
import type {SearchTransaction} from '@src/types/onyx/SearchResults';
import type {Comment, TransactionChanges, WaypointCollection} from '@src/types/onyx/Transaction';
import type {FileObject} from '@src/types/utils/Attachment';
import {isEmptyObject} from '@src/types/utils/EmptyObject';
Expand Down Expand Up @@ -928,7 +929,7 @@
parentReportActionParam?: OnyxInputOrEntry<ReportAction>;
personalDetails?: Partial<PersonalDetailsList>;
invoiceReceiverPolicy?: OnyxEntry<Policy>;
transactions?: Transaction[];
transactions?: SearchTransaction[];

Check failure on line 932 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

`SearchTransaction` is deprecated. - Use Transaction instead
reports?: Report[];
policies?: Policy[];
isReportArchived?: boolean;
Expand Down Expand Up @@ -960,7 +961,7 @@
const parsedReportActionMessageCache: Record<string, string> = {};

let conciergeReportID: OnyxEntry<string>;
Onyx.connect({

Check warning on line 964 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.CONCIERGE_REPORT_ID,
callback: (value) => {
conciergeReportID = value;
Expand All @@ -968,7 +969,7 @@
});

const defaultAvatarBuildingIconTestID = 'SvgDefaultAvatarBuilding Icon';
Onyx.connect({

Check warning on line 972 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.SESSION,
callback: (value) => {
// When signed out, val is undefined
Expand All @@ -986,7 +987,7 @@
let allPersonalDetails: OnyxEntry<PersonalDetailsList>;
let allPersonalDetailLogins: string[];
let currentUserPersonalDetails: OnyxEntry<PersonalDetails>;
Onyx.connect({

Check warning on line 990 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
callback: (value) => {
if (currentUserAccountID) {
Expand All @@ -998,14 +999,14 @@
});

let allReportsDraft: OnyxCollection<Report>;
Onyx.connect({

Check warning on line 1002 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT_DRAFT,
waitForCollectionCallback: true,
callback: (value) => (allReportsDraft = value),
});

let allPolicies: OnyxCollection<Policy>;
Onyx.connect({

Check warning on line 1009 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.POLICY,
waitForCollectionCallback: true,
callback: (value) => (allPolicies = value),
Expand All @@ -1020,7 +1021,7 @@

let allReports: OnyxCollection<Report>;
let reportsByPolicyID: ReportByPolicyMap;
Onyx.connect({

Check warning on line 1024 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT,
waitForCollectionCallback: true,
callback: (value) => {
Expand Down Expand Up @@ -1058,14 +1059,14 @@
});

let allBetas: OnyxEntry<Beta[]>;
Onyx.connect({

Check warning on line 1062 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.BETAS,
callback: (value) => (allBetas = value),
});

let allTransactions: OnyxCollection<Transaction> = {};
let reportsTransactions: Record<string, Transaction[]> = {};
Onyx.connect({

Check warning on line 1069 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.TRANSACTION,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -1091,7 +1092,7 @@
});

let allReportActions: OnyxCollection<ReportActions>;
Onyx.connect({

Check warning on line 1095 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT_ACTIONS,
waitForCollectionCallback: true,
callback: (actions) => {
Expand Down Expand Up @@ -2250,7 +2251,7 @@
/**
* Whether the provided report has expenses
*/
function hasExpenses(reportID?: string, transactions?: Transaction[] | Array<OnyxEntry<Transaction>>): boolean {
function hasExpenses(reportID?: string, transactions?: SearchTransaction[] | Array<OnyxEntry<Transaction>>): boolean {

Check failure on line 2254 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

`SearchTransaction` is deprecated. - Use Transaction instead
if (transactions) {
return !!transactions?.find((transaction) => transaction?.reportID === reportID);
}
Expand All @@ -2260,7 +2261,7 @@
/**
* Whether the provided report is a closed expense report with no expenses
*/
function isClosedExpenseReportWithNoExpenses(report: OnyxEntry<Report>, transactions?: Transaction[] | Array<OnyxEntry<Transaction>>): boolean {
function isClosedExpenseReportWithNoExpenses(report: OnyxEntry<Report>, transactions?: SearchTransaction[] | Array<OnyxEntry<Transaction>>): boolean {

Check failure on line 2264 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

`SearchTransaction` is deprecated. - Use Transaction instead
if (!report?.statusNum || report.statusNum !== CONST.REPORT.STATUS_NUM.CLOSED || !isExpenseReport(report)) {
return false;
}
Expand Down Expand Up @@ -4483,7 +4484,7 @@
isChatReportArchived = false,
report?: OnyxInputOrEntry<Report>,
policy?: OnyxEntry<Policy>,
linkedTransaction?: OnyxEntry<Transaction> | Transaction,
linkedTransaction?: OnyxEntry<Transaction> | SearchTransaction,

Check failure on line 4487 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

`SearchTransaction` is deprecated. - Use Transaction instead
): boolean {
const isDeleted = isDeletedAction(reportAction);

Expand Down Expand Up @@ -4625,7 +4626,7 @@
isDeleteAction?: boolean,
isChatReportArchived = false,
outstandingReportsByPolicyID?: OutstandingReportsByPolicyIDDerivedValue,
linkedTransaction?: OnyxEntry<Transaction> | Transaction,
linkedTransaction?: OnyxEntry<Transaction> | SearchTransaction,

Check failure on line 4629 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

`SearchTransaction` is deprecated. - Use Transaction instead
report?: OnyxInputOrEntry<Report>,
policy?: OnyxEntry<Policy>,
): boolean {
Expand Down Expand Up @@ -4923,7 +4924,7 @@
*
* NOTE: This method is only meant to be used inside this action file. Do not export and use it elsewhere. Use useOnyx instead.
*/
function getLinkedTransaction(reportAction: OnyxEntry<ReportAction | OptimisticIOUReportAction>, transactions?: Transaction[]): OnyxEntry<Transaction> | Transaction {
function getLinkedTransaction(reportAction: OnyxEntry<ReportAction | OptimisticIOUReportAction>, transactions?: SearchTransaction[]): OnyxEntry<Transaction> | SearchTransaction {

Check failure on line 4927 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

`SearchTransaction` is deprecated. - Use Transaction instead

Check failure on line 4927 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

`SearchTransaction` is deprecated. - Use Transaction instead
let transactionID: string | undefined;

if (isMoneyRequestAction(reportAction)) {
Expand Down Expand Up @@ -4978,7 +4979,7 @@
reports,
}: {
reportAction: OnyxEntry<ReportAction | OptimisticIOUReportAction>;
transactions?: Transaction[];
transactions?: SearchTransaction[];

Check failure on line 4982 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

`SearchTransaction` is deprecated. - Use Transaction instead
reports?: Report[];
}): string {
if (isReversedTransaction(reportAction)) {
Expand Down Expand Up @@ -5608,7 +5609,7 @@
personalDetails?: Partial<PersonalDetailsList>,
invoiceReceiverPolicy?: OnyxEntry<Policy>,
reportAttributes?: ReportAttributesDerivedValue['reports'],
transactions?: Transaction[],
transactions?: SearchTransaction[],

Check failure on line 5612 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

`SearchTransaction` is deprecated. - Use Transaction instead
isReportArchived?: boolean,
reports?: Report[],
policies?: Policy[],
Expand Down Expand Up @@ -8932,7 +8933,7 @@
reportID: string | undefined,
transactionViolations: OnyxCollection<TransactionViolation[]>,
shouldShowInReview?: boolean,
reportTransactions?: Transaction[],
reportTransactions?: SearchTransaction[],

Check failure on line 8936 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

`SearchTransaction` is deprecated. - Use Transaction instead
): boolean {
const transactions = reportTransactions ?? getReportTransactions(reportID);
return transactions.some((transaction) => hasViolation(transaction, transactionViolations, shouldShowInReview));
Expand All @@ -8945,7 +8946,7 @@
reportID: string | undefined,
transactionViolations: OnyxCollection<TransactionViolation[]>,
shouldShowInReview?: boolean,
reportTransactions?: Transaction[],
reportTransactions?: SearchTransaction[],
): boolean {
const transactions = reportTransactions ?? getReportTransactions(reportID);
return transactions.some((transaction) => hasWarningTypeViolation(transaction, transactionViolations, shouldShowInReview));
Expand Down Expand Up @@ -8978,7 +8979,7 @@
reportID: string | undefined,
transactionViolations: OnyxCollection<TransactionViolation[]>,
shouldShowInReview?: boolean,
reportTransactions?: Transaction[],
reportTransactions?: SearchTransaction[],
): boolean {
const transactions = reportTransactions ?? getReportTransactions(reportID);
return transactions.some((transaction) => hasNoticeTypeViolation(transaction, transactionViolations, shouldShowInReview));
Expand All @@ -8987,7 +8988,7 @@
/**
* Checks to see if a report contains any type of violation
*/
function hasAnyViolations(reportID: string | undefined, transactionViolations: OnyxCollection<TransactionViolation[]>, reportTransactions?: Transaction[]) {
function hasAnyViolations(reportID: string | undefined, transactionViolations: OnyxCollection<TransactionViolation[]>, reportTransactions?: SearchTransaction[]) {
return (
hasViolations(reportID, transactionViolations, undefined, reportTransactions) ||
hasNoticeTypeViolations(reportID, transactionViolations, true, reportTransactions) ||
Expand All @@ -9011,12 +9012,12 @@
reportID: string | undefined,
transactionViolations: OnyxCollection<TransactionViolation[]>,
areStrictPolicyRulesEnabled: boolean,
reportTransactions?: Transaction[],
reportTransactions?: Transaction[] | SearchTransaction[],
) {
if (!areStrictPolicyRulesEnabled) {
return false;
}
return hasAnyViolations(reportID, transactionViolations, reportTransactions);
return hasAnyViolations(reportID, transactionViolations, reportTransactions as SearchTransaction[]);
}

type ReportErrorsAndReportActionThatRequiresAttention = {
Expand Down Expand Up @@ -10369,7 +10370,7 @@
/**
* Check if Report has any held expenses
*/
function hasHeldExpenses(iouReportID?: string, allReportTransactions?: Transaction[]): boolean {
function hasHeldExpenses(iouReportID?: string, allReportTransactions?: SearchTransaction[]): boolean {
const iouReportTransactions = getReportTransactions(iouReportID);
const transactions = allReportTransactions ?? iouReportTransactions;
return transactions.some((transaction) => isOnHoldTransactionUtils(transaction));
Expand All @@ -10378,7 +10379,7 @@
/**
* Check if all expenses in the Report are on hold
*/
function hasOnlyHeldExpenses(iouReportID?: string, allReportTransactions?: Transaction[]): boolean {
function hasOnlyHeldExpenses(iouReportID?: string, allReportTransactions?: SearchTransaction[]): boolean {
const transactionsByIouReportID = getReportTransactions(iouReportID);
const reportTransactions = allReportTransactions ?? transactionsByIouReportID;
return reportTransactions.length > 0 && !reportTransactions.some((transaction) => !isOnHoldTransactionUtils(transaction));
Expand Down
11 changes: 0 additions & 11 deletions src/libs/SearchUIUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2584,16 +2584,6 @@ function getColumnsToShow(
return columns;
}

type OnyxSnapshotKey = `${typeof ONYXKEYS.COLLECTION.SNAPSHOT}${string}`;

function getSnapshotKeys(allSnapshots: OnyxCollection<OnyxTypes.SearchResults>) {
if (!allSnapshots) {
return [];
}

return Object.keys(allSnapshots || {}) as OnyxSnapshotKey[];
}

export {
getSuggestedSearches,
getListItem,
Expand Down Expand Up @@ -2635,6 +2625,5 @@ export {
getActionOptions,
getColumnsToShow,
getHasOptions,
getSnapshotKeys,
};
export type {SavedSearchMenuItem, SearchTypeMenuSection, SearchTypeMenuItem, SearchDateModifier, SearchDateModifierLower, SearchKey, ArchivedReportsIDSet};
Loading
Loading