From 1f04f64bbf0115b53437cda2fd368c45095f91a7 Mon Sep 17 00:00:00 2001
From: Rutika Pawar <183392827+twilight2294@users.noreply.github.com>
Date: Mon, 20 Jan 2025 21:02:08 +0530
Subject: [PATCH 1/7] update navigation from dismiss modal to goBack

---
 src/libs/actions/IOU.ts | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts
index 26ebf5e37a8e..2c72f2113d0b 100644
--- a/src/libs/actions/IOU.ts
+++ b/src/libs/actions/IOU.ts
@@ -8265,7 +8265,7 @@ function submitReport(expenseReport: OnyxTypes.Report) {
     API.write(WRITE_COMMANDS.SUBMIT_REPORT, parameters, {optimisticData, successData, failureData});
 }
 
-function cancelPayment(expenseReport: OnyxEntry<OnyxTypes.Report>, chatReport: OnyxTypes.Report) {
+function cancelPayment(expenseReport: OnyxEntry<OnyxTypes.Report>, chatReport: OnyxTypes.Report, backTo?: Route) {
     if (isEmptyObject(expenseReport)) {
         return;
     }
@@ -8408,7 +8408,7 @@ function cancelPayment(expenseReport: OnyxEntry<OnyxTypes.Report>, chatReport: O
         },
         {optimisticData, successData, failureData},
     );
-    Navigation.dismissModal();
+    Navigation.goBack(backTo);
     notifyNewAction(expenseReport.reportID, userAccountID);
 }
 

From 63112887c13fbc897de5f1afad43a56e697ac0c7 Mon Sep 17 00:00:00 2001
From: Rutika Pawar <183392827+twilight2294@users.noreply.github.com>
Date: Mon, 20 Jan 2025 21:03:51 +0530
Subject: [PATCH 2/7] pass backTo to cancel payment

---
 src/pages/ReportDetailsPage.tsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/pages/ReportDetailsPage.tsx b/src/pages/ReportDetailsPage.tsx
index b48a90e88d95..3a1fa1d4e664 100644
--- a/src/pages/ReportDetailsPage.tsx
+++ b/src/pages/ReportDetailsPage.tsx
@@ -314,7 +314,7 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta
             return;
         }
 
-        IOU.cancelPayment(moneyRequestReport, chatReport);
+        IOU.cancelPayment(moneyRequestReport, chatReport, backTo);
         setIsConfirmModalVisible(false);
     }, [moneyRequestReport, chatReport]);
 

From 63cd61b9314cf5737e77e773e394994a25a42e37 Mon Sep 17 00:00:00 2001
From: Rutika Pawar <183392827+twilight2294@users.noreply.github.com>
Date: Tue, 21 Jan 2025 15:07:56 +0530
Subject: [PATCH 3/7] update imports

---
 src/pages/ReportDetailsPage.tsx | 426 +++++++++++++++++++++++---------
 1 file changed, 314 insertions(+), 112 deletions(-)

diff --git a/src/pages/ReportDetailsPage.tsx b/src/pages/ReportDetailsPage.tsx
index 3a1fa1d4e664..39216254baff 100644
--- a/src/pages/ReportDetailsPage.tsx
+++ b/src/pages/ReportDetailsPage.tsx
@@ -31,20 +31,99 @@ import useNetwork from '@hooks/useNetwork';
 import usePaginatedReportActions from '@hooks/usePaginatedReportActions';
 import useResponsiveLayout from '@hooks/useResponsiveLayout';
 import useThemeStyles from '@hooks/useThemeStyles';
-import * as ReportActions from '@libs/actions/Report';
+import {
+    cancelPayment as cancelPaymentModule,
+    deleteMoneyRequest,
+    deleteTrackExpense,
+    getNavigationUrlAfterTrackExpenseDelete,
+    getNavigationUrlOnMoneyRequestDelete,
+    unapproveExpenseReport,
+} from '@libs/actions/IOU';
+import {
+    clearAvatarErrors,
+    clearPolicyRoomNameErrors,
+    clearReportFieldKeyErrors,
+    exportReportToCSV,
+    getReportPrivateNote,
+    hasErrorInPrivateNotes,
+    leaveGroupChat,
+    leaveRoom,
+    setDeleteTransactionNavigateBackUrl,
+    updateGroupChatAvatar,
+} from '@libs/actions/Report';
+import {checkIfActionIsAllowed} from '@libs/actions/Session';
+import {canActionTask as canActionTaskModule, canModifyTask as canModifyTaskModule, deleteTask, reopenTask} from '@libs/actions/Task';
 import Navigation from '@libs/Navigation/Navigation';
 import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types';
 import type {ReportDetailsNavigatorParamList} from '@libs/Navigation/types';
-import * as OptionsListUtils from '@libs/OptionsListUtils';
-import * as PolicyUtils from '@libs/PolicyUtils';
-import * as ReportActionsUtils from '@libs/ReportActionsUtils';
-import * as ReportUtils from '@libs/ReportUtils';
+import {getPersonalDetailsForAccountIDs} from '@libs/OptionsListUtils';
+import {getConnectedIntegration, isPolicyAdmin as isPolicyAdminModule, isPolicyEmployee as isPolicyEmployeeModule, isSubmitAndClose, shouldShowPolicy} from '@libs/PolicyUtils';
+import {
+    getOneTransactionThreadReportID,
+    getOriginalMessage,
+    getReportAction,
+    getTrackExpenseActionableWhisper,
+    isDeletedAction,
+    isMoneyRequestAction,
+    isTrackExpenseAction,
+} from '@libs/ReportActionsUtils';
+import {
+    canDeleteTransaction,
+    canEditReportDescription as canEditReportDescriptionModule,
+    canHoldUnholdReportAction as canHoldUnholdReportActionModule,
+    canJoinChat,
+    canLeaveChat,
+    canWriteInReport,
+    createDraftTransactionAndNavigateToParticipantSelector,
+    getAvailableReportFields,
+    getChatRoomSubtitle,
+    getDisplayNamesWithTooltips,
+    getIcons,
+    getOriginalReportID,
+    getParentNavigationSubtitle,
+    getParticipantsAccountIDsForDisplay,
+    getParticipantsList,
+    getReportDescription,
+    getReportFieldKey,
+    getReportName,
+    isAdminOwnerApproverOrReportOwner,
+    isArchivedNonExpenseReport,
+    isCanceledTaskReport as isCanceledTaskReportModule,
+    isChatRoom as isChatRoomModule,
+    isChatThread as isChatThreadModule,
+    isClosedReport,
+    isCompletedTaskReport,
+    isConciergeChatReport,
+    isDefaultRoom as isDefaultRoomModule,
+    isExpenseReport as isExpenseReportModule,
+    isExported,
+    isGroupChat as isGroupChatModule,
+    isHiddenForCurrentUser,
+    isInvoiceReport as isInvoiceReportModule,
+    isInvoiceRoom as isInvoiceRoomModule,
+    isMoneyRequest as isMoneyRequestModule,
+    isMoneyRequestReport as isMoneyRequestReportModule,
+    isPayer as isPayerModule,
+    isPolicyExpenseChat as isPolicyExpenseChatModule,
+    isPublicRoom,
+    isReportApproved,
+    isReportFieldDisabled,
+    isReportFieldOfTypeTitle,
+    isReportManager,
+    isRootGroupChat as isRootGroupChatModule,
+    isSelfDM as isSelfDMModule,
+    isSettled as isSettledModule,
+    isSystemChat as isSystemChatModule,
+    isTaskReport as isTaskReportModule,
+    isThread as isThreadModule,
+    isTrackExpenseReport as isTrackExpenseReportModule,
+    isUserCreatedPolicyRoom as isUserCreatedPolicyRoomModule,
+    navigateBackOnDeleteTransaction,
+    navigateToPrivateNotes,
+    shouldDisableRename as shouldDisableRenameModule,
+} from '@libs/ReportUtils';
 import StringUtils from '@libs/StringUtils';
 import {getAllReportTransactions} from '@libs/TransactionUtils';
-import * as IOU from '@userActions/IOU';
-import * as Report from '@userActions/Report';
-import * as Session from '@userActions/Session';
-import * as Task from '@userActions/Task';
 import ConfirmModal from '@src/components/ConfirmModal';
 import CONST from '@src/CONST';
 import type {TranslationPaths} from '@src/languages/types';
@@ -99,10 +178,7 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta
     // eslint-disable-next-line rulesdir/prefer-shouldUseNarrowLayout-instead-of-isSmallScreenWidth
     const {isSmallScreenWidth} = useResponsiveLayout();
 
-    const transactionThreadReportID = useMemo(
-        () => ReportActionsUtils.getOneTransactionThreadReportID(report.reportID, reportActions ?? [], isOffline),
-        [report.reportID, reportActions, isOffline],
-    );
+    const transactionThreadReportID = useMemo(() => getOneTransactionThreadReportID(report.reportID, reportActions ?? [], isOffline), [report.reportID, reportActions, isOffline]);
 
     const [transactionThreadReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${transactionThreadReportID}`);
     const [isDebugModeEnabled] = useOnyx(ONYXKEYS.USER, {selector: (user) => !!user?.isDebugModeEnabled});
@@ -117,34 +193,34 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta
     const [offlineModalVisible, setOfflineModalVisible] = useState(false);
     const [downloadErrorModalVisible, setDownloadErrorModalVisible] = useState(false);
     const policy = useMemo(() => policies?.[`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID}`], [policies, report?.policyID]);
-    const isPolicyAdmin = useMemo(() => PolicyUtils.isPolicyAdmin(policy), [policy]);
-    const isPolicyEmployee = useMemo(() => PolicyUtils.isPolicyEmployee(report?.policyID, policies), [report?.policyID, policies]);
-    const isPolicyExpenseChat = useMemo(() => ReportUtils.isPolicyExpenseChat(report), [report]);
-    const shouldUseFullTitle = useMemo(() => ReportUtils.shouldUseFullTitleToDisplay(report), [report]);
-    const isChatRoom = useMemo(() => ReportUtils.isChatRoom(report), [report]);
-    const isUserCreatedPolicyRoom = useMemo(() => ReportUtils.isUserCreatedPolicyRoom(report), [report]);
-    const isDefaultRoom = useMemo(() => ReportUtils.isDefaultRoom(report), [report]);
-    const isChatThread = useMemo(() => ReportUtils.isChatThread(report), [report]);
-    const isArchivedRoom = useMemo(() => ReportUtils.isArchivedNonExpenseReport(report, reportNameValuePairs), [report, reportNameValuePairs]);
-    const isMoneyRequestReport = useMemo(() => ReportUtils.isMoneyRequestReport(report), [report]);
-    const isMoneyRequest = useMemo(() => ReportUtils.isMoneyRequest(report), [report]);
-    const isInvoiceReport = useMemo(() => ReportUtils.isInvoiceReport(report), [report]);
-    const isInvoiceRoom = useMemo(() => ReportUtils.isInvoiceRoom(report), [report]);
-    const isTaskReport = useMemo(() => ReportUtils.isTaskReport(report), [report]);
-    const isSelfDM = useMemo(() => ReportUtils.isSelfDM(report), [report]);
-    const isTrackExpenseReport = ReportUtils.isTrackExpenseReport(report);
-    const parentReportAction = ReportActionsUtils.getReportAction(report?.parentReportID, report?.parentReportActionID);
-    const isCanceledTaskReport = ReportUtils.isCanceledTaskReport(report, parentReportAction);
-    const canEditReportDescription = useMemo(() => ReportUtils.canEditReportDescription(report, policy), [report, policy]);
+    const isPolicyAdmin = useMemo(() => isPolicyAdminModule(policy), [policy]);
+    const isPolicyEmployee = useMemo(() => isPolicyEmployeeModule(report?.policyID, policies), [report?.policyID, policies]);
+    const isPolicyExpenseChat = useMemo(() => isPolicyExpenseChatModule(report), [report]);
+    const shouldUseFullTitle = useMemo(() => shouldUseFullTitleToDisplayModule(report), [report]);
+    const isChatRoom = useMemo(() => isChatRoomModule(report), [report]);
+    const isUserCreatedPolicyRoom = useMemo(() => isUserCreatedPolicyRoomModule(report), [report]);
+    const isDefaultRoom = useMemo(() => isDefaultRoomModule(report), [report]);
+    const isChatThread = useMemo(() => isChatThreadModule(report), [report]);
+    const isArchivedRoom = useMemo(() => isArchivedNonExpenseReport(report, reportNameValuePairs), [report, reportNameValuePairs]);
+    const isMoneyRequestReport = useMemo(() => isMoneyRequestReportModule(report), [report]);
+    const isMoneyRequest = useMemo(() => isMoneyRequestModule(report), [report]);
+    const isInvoiceReport = useMemo(() => isInvoiceReportModule(report), [report]);
+    const isInvoiceRoom = useMemo(() => isInvoiceRoomModule(report), [report]);
+    const isTaskReport = useMemo(() => isTaskReportModule(report), [report]);
+    const isSelfDM = useMemo(() => isSelfDMModule(report), [report]);
+    const isTrackExpenseReport = isTrackExpenseReportModule(report);
+    const parentReportAction = getReportAction(report?.parentReportID, report?.parentReportActionID);
+    const isCanceledTaskReport = isCanceledTaskReportModule(report, parentReportAction);
+    const canEditReportDescription = useMemo(() => canEditReportDescriptionModule(report, policy), [report, policy]);
     const shouldShowReportDescription = isChatRoom && (canEditReportDescription || report.description !== '');
     const isExpenseReport = isMoneyRequestReport || isInvoiceReport || isMoneyRequest;
     const isSingleTransactionView = isMoneyRequest || isTrackExpenseReport;
-    const isSelfDMTrackExpenseReport = isTrackExpenseReport && ReportUtils.isSelfDM(parentReport);
-    const shouldDisableRename = useMemo(() => ReportUtils.shouldDisableRename(report), [report]);
-    const parentNavigationSubtitleData = ReportUtils.getParentNavigationSubtitle(report);
+    const isSelfDMTrackExpenseReport = isTrackExpenseReport && isSelfDMModule(parentReport);
+    const shouldDisableRename = useMemo(() => shouldDisableRenameModule(report), [report]);
+    const parentNavigationSubtitleData = getParentNavigationSubtitle(report);
     // eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps -- policy is a dependency because `getChatRoomSubtitle` calls `getPolicyName` which in turn retrieves the value from the `policy` value stored in Onyx
     const chatRoomSubtitle = useMemo(() => {
-        const subtitle = ReportUtils.getChatRoomSubtitle(report);
+        const subtitle = getChatRoomSubtitle(report);
 
         if (subtitle) {
             return subtitle;
@@ -152,15 +228,15 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta
 
         return '';
     }, [report]);
-    const isSystemChat = useMemo(() => ReportUtils.isSystemChat(report), [report]);
-    const isGroupChat = useMemo(() => ReportUtils.isGroupChat(report), [report]);
-    const isRootGroupChat = useMemo(() => ReportUtils.isRootGroupChat(report), [report]);
-    const isThread = useMemo(() => ReportUtils.isThread(report), [report]);
+    const isSystemChat = useMemo(() => isSystemChatModule(report), [report]);
+    const isGroupChat = useMemo(() => isGroupChatModule(report), [report]);
+    const isRootGroupChat = useMemo(() => isRootGroupChatModule(report), [report]);
+    const isThread = useMemo(() => isThreadModule(report), [report]);
     const shouldOpenRoomMembersPage = isUserCreatedPolicyRoom || isChatThread || (isPolicyExpenseChat && isPolicyAdmin);
     const participants = useMemo(() => {
-        return ReportUtils.getParticipantsList(report, personalDetails, shouldOpenRoomMembersPage);
+        return getParticipantsList(report, personalDetails, shouldOpenRoomMembersPage);
     }, [report, personalDetails, shouldOpenRoomMembersPage]);
-    const connectedIntegration = PolicyUtils.getConnectedIntegration(policy);
+    const connectedIntegration = getConnectedIntegration(policy);
 
     const transactionIDList = useMemo(() => {
         if (!isMoneyRequestReport) {
@@ -206,7 +282,7 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta
 
     const isActionOwner =
         typeof requestParentReportAction?.actorAccountID === 'number' && typeof session?.accountID === 'number' && requestParentReportAction.actorAccountID === session?.accountID;
-    const isDeletedParentAction = ReportActionsUtils.isDeletedAction(requestParentReportAction);
+    const isDeletedParentAction = isDeletedAction(requestParentReportAction);
 
     const moneyRequestReport: OnyxEntry<OnyxTypes.Report> = useMemo(() => {
         if (caseID === CASES.MONEY_REQUEST) {
@@ -217,21 +293,14 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta
 
     const moneyRequestAction = transactionThreadReportID ? requestParentReportAction : parentReportAction;
 
-    const canModifyTask = Task.canModifyTask(report, session?.accountID ?? CONST.DEFAULT_NUMBER_ID);
-    const canActionTask = Task.canActionTask(report, session?.accountID ?? CONST.DEFAULT_NUMBER_ID);
+    const canModifyTask = canModifyTaskModule(report, session?.accountID ?? CONST.DEFAULT_NUMBER_ID);
+    const canActionTask = canActionTaskModule(report, session?.accountID ?? CONST.DEFAULT_NUMBER_ID);
     const shouldShowTaskDeleteButton =
-        isTaskReport &&
-        !isCanceledTaskReport &&
-        ReportUtils.canWriteInReport(report) &&
-        report.stateNum !== CONST.REPORT.STATE_NUM.APPROVED &&
-        !ReportUtils.isClosedReport(report) &&
-        canModifyTask &&
-        canActionTask;
-    const canDeleteRequest = isActionOwner && (ReportUtils.canDeleteTransaction(moneyRequestReport) || isSelfDMTrackExpenseReport) && !isDeletedParentAction;
+        isTaskReport && !isCanceledTaskReport && canWriteInReport(report) && report.stateNum !== CONST.REPORT.STATE_NUM.APPROVED && !isClosedReport(report) && canModifyTask && canActionTask;
+    const canDeleteRequest = isActionOwner && (canDeleteTransaction(moneyRequestReport) || isSelfDMTrackExpenseReport) && !isDeletedParentAction;
     const shouldShowDeleteButton = shouldShowTaskDeleteButton || canDeleteRequest;
 
-    const canUnapproveRequest =
-        ReportUtils.isExpenseReport(report) && (ReportUtils.isReportManager(report) || isPolicyAdmin) && ReportUtils.isReportApproved(report) && !PolicyUtils.isSubmitAndClose(policy);
+    const canUnapproveRequest = isExpenseReportModule(report) && (isReportManager(report) || isPolicyAdmin) && isReportApproved(report) && !isSubmitAndClose(policy);
 
     useEffect(() => {
         if (canDeleteRequest) {
@@ -247,23 +316,23 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta
             return;
         }
 
-        Report.getReportPrivateNote(report?.reportID);
+        getReportPrivateNote(report?.reportID);
     }, [report?.reportID, isOffline, isPrivateNotesFetchTriggered, isSelfDM]);
 
     const leaveChat = useCallback(() => {
         Navigation.dismissModal();
         Navigation.isNavigationReady().then(() => {
             if (isRootGroupChat) {
-                Report.leaveGroupChat(report.reportID);
+                leaveGroupChat(report.reportID);
                 return;
             }
             const isWorkspaceMemberLeavingWorkspaceRoom = (report.visibility === CONST.REPORT.VISIBILITY.RESTRICTED || isPolicyExpenseChat) && isPolicyEmployee;
-            Report.leaveRoom(report.reportID, isWorkspaceMemberLeavingWorkspaceRoom);
+            leaveRoom(report.reportID, isWorkspaceMemberLeavingWorkspaceRoom);
         });
     }, [isPolicyEmployee, isPolicyExpenseChat, isRootGroupChat, report.reportID, report.visibility]);
 
     const [moneyRequestReportActions] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${moneyRequestReport?.reportID}`);
-    const isMoneyRequestExported = ReportUtils.isExported(moneyRequestReportActions);
+    const isMoneyRequestExported = isExported(moneyRequestReportActions);
     const {isDelegateAccessRestricted} = useDelegateUserDetails();
     const [isNoDelegateAccessMenuVisible, setIsNoDelegateAccessMenuVisible] = useState(false);
 
@@ -275,16 +344,16 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta
             return;
         }
         Navigation.dismissModal();
-        IOU.unapproveExpenseReport(moneyRequestReport);
+        unapproveExpenseReport(moneyRequestReport);
     }, [isMoneyRequestExported, moneyRequestReport, isDelegateAccessRestricted]);
 
-    const shouldShowLeaveButton = ReportUtils.canLeaveChat(report, policy);
-    const shouldShowGoToWorkspace = PolicyUtils.shouldShowPolicy(policy, false, session?.email) && !policy?.isJoinRequestPending;
+    const shouldShowLeaveButton = canLeaveChat(report, policy);
+    const shouldShowGoToWorkspace = shouldShowPolicy(policy, false, session?.email) && !policy?.isJoinRequestPending;
 
-    const reportName = ReportUtils.getReportName(report);
+    const reportName = getReportName(report);
 
     const additionalRoomDetails =
-        (isPolicyExpenseChat && !!report?.isOwnPolicyExpenseChat) || ReportUtils.isExpenseReport(report) || isPolicyExpenseChat || isInvoiceRoom
+        (isPolicyExpenseChat && !!report?.isOwnPolicyExpenseChat) || isExpenseReportModule(report) || isPolicyExpenseChat || isInvoiceRoom
             ? chatRoomSubtitle
             : `${translate('threads.in')} ${chatRoomSubtitle}`;
 
@@ -297,26 +366,26 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta
         roomDescription = translate('newRoomPage.roomName');
     }
 
-    const shouldShowNotificationPref = !isMoneyRequestReport && !ReportUtils.isHiddenForCurrentUser(report);
+    const shouldShowNotificationPref = !isMoneyRequestReport && !isHiddenForCurrentUser(report);
     const shouldShowWriteCapability = !isMoneyRequestReport;
     const shouldShowMenuItem = shouldShowNotificationPref || shouldShowWriteCapability || (!!report?.visibility && report.chatType !== CONST.REPORT.CHAT_TYPE.INVOICE);
 
-    const isPayer = ReportUtils.isPayer(session, moneyRequestReport);
-    const isSettled = ReportUtils.isSettled(moneyRequestReport?.reportID);
+    const isPayer = isPayerModule(session, moneyRequestReport);
+    const isSettled = isSettledModule(moneyRequestReport?.reportID);
 
-    const shouldShowCancelPaymentButton = caseID === CASES.MONEY_REPORT && isPayer && isSettled && ReportUtils.isExpenseReport(moneyRequestReport);
+    const shouldShowCancelPaymentButton = caseID === CASES.MONEY_REPORT && isPayer && isSettled && isExpenseReportModule(moneyRequestReport);
     const [chatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${moneyRequestReport?.chatReportID}`);
 
-    const iouTransactionID = ReportActionsUtils.isMoneyRequestAction(requestParentReportAction) ? ReportActionsUtils.getOriginalMessage(requestParentReportAction)?.IOUTransactionID : '';
+    const iouTransactionID = isMoneyRequestAction(requestParentReportAction) ? getOriginalMessage(requestParentReportAction)?.IOUTransactionID : '';
 
     const cancelPayment = useCallback(() => {
         if (!chatReport) {
             return;
         }
 
-        IOU.cancelPayment(moneyRequestReport, chatReport, backTo);
+        cancelPaymentModule(moneyRequestReport, chatReport, backTo);
         setIsConfirmModalVisible(false);
-    }, [moneyRequestReport, chatReport]);
+    }, [moneyRequestReport, chatReport, backTo]);
 
     const menuItems: ReportDetailsPageMenuItem[] = useMemo(() => {
         const items: ReportDetailsPageMenuItem[] = [];
@@ -337,8 +406,8 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta
             (isGroupChat ||
                 (isDefaultRoom && isChatThread && isPolicyEmployee) ||
                 (!isUserCreatedPolicyRoom && participants.length) ||
-                (isUserCreatedPolicyRoom && (isPolicyEmployee || (isChatThread && !ReportUtils.isPublicRoom(report))))) &&
-            !ReportUtils.isConciergeChatReport(report) &&
+                (isUserCreatedPolicyRoom && (isPolicyEmployee || (isChatThread && !isPublicRoom(report))))) &&
+            !isConciergeChatReport(report) &&
             !isSystemChat
         ) {
             items.push({
@@ -383,8 +452,8 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta
         }
 
         if (isTrackExpenseReport && !isDeletedParentAction) {
-            const actionReportID = ReportUtils.getOriginalReportID(report.reportID, parentReportAction);
-            const whisperAction = ReportActionsUtils.getTrackExpenseActionableWhisper(iouTransactionID, moneyRequestReport?.reportID);
+            const actionReportID = getOriginalReportID(report.reportID, parentReportAction);
+            const whisperAction = getTrackExpenseActionableWhisper(iouTransactionID, moneyRequestReport?.reportID);
             const actionableWhisperReportActionID = whisperAction?.reportActionID;
             items.push({
                 key: CONST.REPORT_DETAILS_MENU_ITEM.SETTINGS,
@@ -393,7 +462,7 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta
                 isAnonymousAction: false,
                 shouldShowRightIcon: true,
                 action: () => {
-                    ReportUtils.createDraftTransactionAndNavigateToParticipantSelector(iouTransactionID, actionReportID, CONST.IOU.ACTION.SUBMIT, actionableWhisperReportActionID);
+                    createDraftTransactionAndNavigateToParticipantSelector(iouTransactionID, actionReportID, CONST.IOU.ACTION.SUBMIT, actionableWhisperReportActionID);
                 },
             });
             items.push({
@@ -403,7 +472,7 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta
                 isAnonymousAction: false,
                 shouldShowRightIcon: true,
                 action: () => {
-                    ReportUtils.createDraftTransactionAndNavigateToParticipantSelector(iouTransactionID, actionReportID, CONST.IOU.ACTION.CATEGORIZE, actionableWhisperReportActionID);
+                    createDraftTransactionAndNavigateToParticipantSelector(iouTransactionID, actionReportID, CONST.IOU.ACTION.CATEGORIZE, actionableWhisperReportActionID);
                 },
             });
             items.push({
@@ -413,7 +482,7 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta
                 isAnonymousAction: false,
                 shouldShowRightIcon: true,
                 action: () => {
-                    ReportUtils.createDraftTransactionAndNavigateToParticipantSelector(iouTransactionID, actionReportID, CONST.IOU.ACTION.SHARE, actionableWhisperReportActionID);
+                    createDraftTransactionAndNavigateToParticipantSelector(iouTransactionID, actionReportID, CONST.IOU.ACTION.SHARE, actionableWhisperReportActionID);
                 },
             });
         }
@@ -426,22 +495,22 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta
                 icon: Expensicons.Pencil,
                 isAnonymousAction: false,
                 shouldShowRightIcon: true,
-                action: () => ReportUtils.navigateToPrivateNotes(report, session, backTo),
-                brickRoadIndicator: Report.hasErrorInPrivateNotes(report) ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined,
+                action: () => navigateToPrivateNotes(report, session, backTo),
+                brickRoadIndicator: hasErrorInPrivateNotes(report) ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined,
             });
         }
 
         // Show actions related to Task Reports
         if (isTaskReport && !isCanceledTaskReport) {
-            if (ReportUtils.isCompletedTaskReport(report) && canModifyTask && canActionTask) {
+            if (isCompletedTaskReport(report) && canModifyTask && canActionTask) {
                 items.push({
                     key: CONST.REPORT_DETAILS_MENU_ITEM.MARK_AS_INCOMPLETE,
                     icon: Expensicons.Checkmark,
                     translationKey: 'task.markAsIncomplete',
                     isAnonymousAction: false,
-                    action: Session.checkIfActionIsAllowed(() => {
+                    action: checkIfActionIsAllowed(() => {
                         Navigation.dismissModal();
-                        Task.reopenTask(report);
+                        reopenTask(report);
                     }),
                 });
             }
@@ -469,7 +538,7 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta
                         return;
                     }
 
-                    ReportActions.exportReportToCSV({reportID: report.reportID, transactionIDList}, () => {
+                    exportReportToCSV({reportID: report.reportID, transactionIDList}, () => {
                         setDownloadErrorModalVisible(true);
                     });
                 },
@@ -525,7 +594,7 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta
                 icon: Expensicons.Exit,
                 isAnonymousAction: true,
                 action: () => {
-                    if (ReportUtils.getParticipantsAccountIDsForDisplay(report, false, true).length === 1 && isRootGroupChat) {
+                    if (getParticipantsAccountIDsForDisplay(report, false, true).length === 1 && isRootGroupChat) {
                         setIsLastMemberLeavingGroupModalVisible(true);
                         return;
                     }
@@ -595,10 +664,10 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta
 
     const displayNamesWithTooltips = useMemo(() => {
         const hasMultipleParticipants = participants.length > 1;
-        return ReportUtils.getDisplayNamesWithTooltips(OptionsListUtils.getPersonalDetailsForAccountIDs(participants, personalDetails), hasMultipleParticipants);
+        return getDisplayNamesWithTooltips(getPersonalDetailsForAccountIDs(participants, personalDetails), hasMultipleParticipants);
     }, [participants, personalDetails]);
 
-    const icons = useMemo(() => ReportUtils.getIcons(report, personalDetails, null, '', -1, policy), [report, personalDetails, policy]);
+    const icons = useMemo(() => getIcons(report, personalDetails, null, '', -1, policy), [report, personalDetails, policy]);
 
     const chatRoomSubtitleText = chatRoomSubtitle ? (
         <DisplayNames
@@ -640,15 +709,15 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta
                     onViewPhotoPress={() => Navigation.navigate(ROUTES.REPORT_AVATAR.getRoute(report.reportID))}
                     onImageRemoved={() => {
                         // Calling this without a file will remove the avatar
-                        Report.updateGroupChatAvatar(report.reportID);
+                        updateGroupChatAvatar(report.reportID);
                     }}
-                    onImageSelected={(file) => Report.updateGroupChatAvatar(report.reportID, file)}
+                    onImageSelected={(file) => updateGroupChatAvatar(report.reportID, file)}
                     editIcon={Expensicons.Camera}
                     editIconStyle={styles.smallEditIconAccount}
                     pendingAction={report.pendingFields?.avatar ?? undefined}
                     errors={report.errorFields?.avatar ?? null}
                     errorRowStyles={styles.mt6}
-                    onErrorClose={() => Report.clearAvatarErrors(report.reportID)}
+                    onErrorClose={() => clearAvatarErrors(report.reportID)}
                     shouldUseStyleUtilityForAnchorPosition
                     style={[styles.w100, styles.mb3]}
                 />
@@ -664,12 +733,12 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta
         );
     }, [report, icons, isMoneyRequestReport, isInvoiceReport, isGroupChat, isThread, styles]);
 
-    const canHoldUnholdReportAction = ReportUtils.canHoldUnholdReportAction(moneyRequestAction);
+    const canHoldUnholdReportAction = canHoldUnholdReportActionModule(moneyRequestAction);
     const shouldShowHoldAction =
         caseID !== CASES.DEFAULT &&
         (canHoldUnholdReportAction.canHoldRequest || canHoldUnholdReportAction.canUnholdRequest) &&
-        !ReportUtils.isArchivedNonExpenseReport(transactionThreadReportID ? report : parentReport, parentReportNameValuePairs);
-    const canJoin = ReportUtils.canJoinChat(report, parentReportAction, policy);
+        !isArchivedNonExpenseReport(transactionThreadReportID ? report : parentReport, parentReportNameValuePairs);
+    const canJoin = canJoinChat(report, parentReportAction, policy);
 
     const promotedActions = useMemo(() => {
         const result: PromotedAction[] = [];
@@ -765,7 +834,7 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta
             pendingAction={report?.pendingFields?.reportName}
             errors={report?.errorFields?.reportName}
             errorRowStyles={[styles.ph5]}
-            onClose={() => Report.clearPolicyRoomNameErrors(report?.reportID)}
+            onClose={() => clearPolicyRoomNameErrors(report?.reportID)}
         >
             <View style={[styles.flex1, !shouldDisableRename && styles.mt3]}>
                 <MenuItemWithTopDescription
@@ -786,13 +855,13 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta
     );
 
     const titleField = useMemo<OnyxTypes.PolicyReportField | undefined>((): OnyxTypes.PolicyReportField | undefined => {
-        const fields = ReportUtils.getAvailableReportFields(report, Object.values(policy?.fieldList ?? {}));
-        return fields.find((reportField) => ReportUtils.isReportFieldOfTypeTitle(reportField));
+        const fields = getAvailableReportFields(report, Object.values(policy?.fieldList ?? {}));
+        return fields.find((reportField) => isReportFieldOfTypeTitle(reportField));
     }, [report, policy?.fieldList]);
-    const fieldKey = ReportUtils.getReportFieldKey(titleField?.fieldID);
-    const isFieldDisabled = ReportUtils.isReportFieldDisabled(report, titleField, policy);
+    const fieldKey = getReportFieldKey(titleField?.fieldID);
+    const isFieldDisabled = isReportFieldDisabled(report, titleField, policy);
 
-    const shouldShowTitleField = caseID !== CASES.MONEY_REQUEST && !isFieldDisabled && ReportUtils.isAdminOwnerApproverOrReportOwner(report, policy);
+    const shouldShowTitleField = caseID !== CASES.MONEY_REQUEST && !isFieldDisabled && isAdminOwnerApproverOrReportOwner(report, policy);
 
     const nameSectionFurtherDetailsContent = (
         <ParentNavigationSubtitle
@@ -811,9 +880,9 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta
             key={`menuItem-${fieldKey}`}
             onClose={() => {
                 if (report.errorFields?.reportName) {
-                    Report.clearPolicyRoomNameErrors(report.reportID);
+                    clearPolicyRoomNameErrors(report.reportID);
                 }
-                Report.clearReportFieldKeyErrors(report.reportID, fieldKey);
+                clearReportFieldKeyErrors(report.reportID, fieldKey);
             }}
         >
             <View style={[styles.flex1]}>
@@ -841,7 +910,7 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta
 
     const deleteTransaction = useCallback(() => {
         if (caseID === CASES.DEFAULT) {
-            Task.deleteTask(report);
+            deleteTask(report);
             return;
         }
 
@@ -849,12 +918,12 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta
             return;
         }
 
-        const isTrackExpense = ReportActionsUtils.isTrackExpenseAction(requestParentReportAction);
+        const isTrackExpense = isTrackExpenseAction(requestParentReportAction);
 
         if (isTrackExpense) {
-            IOU.deleteTrackExpense(moneyRequestReport?.reportID, iouTransactionID, requestParentReportAction, isSingleTransactionView);
+            deleteTrackExpense(moneyRequestReport?.reportID, iouTransactionID, requestParentReportAction, isSingleTransactionView);
         } else {
-            IOU.deleteMoneyRequest(iouTransactionID, requestParentReportAction, isSingleTransactionView);
+            deleteMoneyRequest(iouTransactionID, requestParentReportAction, isSingleTransactionView);
         }
     }, [caseID, iouTransactionID, isSingleTransactionView, moneyRequestReport?.reportID, report, requestParentReportAction]);
 
@@ -884,19 +953,19 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta
 
         // Only proceed with navigation logic if transaction was actually deleted
         if (!isEmptyObject(requestParentReportAction)) {
-            const isTrackExpense = ReportActionsUtils.isTrackExpenseAction(requestParentReportAction);
+            const isTrackExpense = isTrackExpenseAction(requestParentReportAction);
             if (isTrackExpense) {
-                urlToNavigateBack = IOU.getNavigationUrlAfterTrackExpenseDelete(moneyRequestReport?.reportID, iouTransactionID, requestParentReportAction, isSingleTransactionView);
+                urlToNavigateBack = getNavigationUrlAfterTrackExpenseDelete(moneyRequestReport?.reportID, iouTransactionID, requestParentReportAction, isSingleTransactionView);
             } else {
-                urlToNavigateBack = IOU.getNavigationUrlOnMoneyRequestDelete(iouTransactionID, requestParentReportAction, isSingleTransactionView);
+                urlToNavigateBack = getNavigationUrlOnMoneyRequestDelete(iouTransactionID, requestParentReportAction, isSingleTransactionView);
             }
         }
 
         if (!urlToNavigateBack) {
             Navigation.dismissModal();
         } else {
-            Report.setDeleteTransactionNavigateBackUrl(urlToNavigateBack);
-            ReportUtils.navigateBackOnDeleteTransaction(urlToNavigateBack as Route, true);
+            setDeleteTransactionNavigateBackUrl(urlToNavigateBack);
+            navigateBackOnDeleteTransaction(urlToNavigateBack as Route, true);
         }
     }, [iouTransactionID, requestParentReportAction, isSingleTransactionView, isTransactionDeleted, moneyRequestReport?.reportID]);
 
@@ -925,7 +994,7 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta
                                 <MenuItemWithTopDescription
                                     shouldShowRightIcon
                                     interactive
-                                    title={ReportUtils.getReportDescription(report)}
+                                    title={getReportDescription(report)}
                                     shouldRenderAsHTML
                                     shouldTruncateTitle
                                     characterLimit={100}
@@ -1015,7 +1084,7 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta
                     onConfirm={() => {
                         setIsUnapproveModalVisible(false);
                         Navigation.dismissModal();
-                        IOU.unapproveExpenseReport(moneyRequestReport);
+                        unapproveExpenseReport(moneyRequestReport);
                     }}
                     cancelText={translate('common.cancel')}
                     onCancel={() => setIsUnapproveModalVisible(false)}
@@ -1047,3 +1116,136 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta
 ReportDetailsPage.displayName = 'ReportDetailsPage';
 
 export default withReportOrNotFound()(ReportDetailsPage);
+function shouldUseFullTitleToDisplayModule(
+    report: {
+        avatarUrl?: string | undefined;
+        chatType?: any;
+        hasOutstandingChildRequest?: boolean | undefined;
+        hasOutstandingChildTask?: boolean | undefined;
+        isOwnPolicyExpenseChat?: boolean | undefined;
+        isPinned?: boolean | undefined;
+        lastMessageText?: string | undefined;
+        lastVisibleActionCreated?: string | undefined;
+        lastReadTime?: string | undefined;
+        lastReadSequenceNumber?: number | undefined;
+        lastMentionedTime?: string | null | undefined;
+        policyAvatar?: string | null | undefined;
+        policyName?: string | null | undefined;
+        oldPolicyName?: string | undefined;
+        hasParentAccess?: boolean | undefined;
+        description?: string | undefined;
+        isDeletedParentAction?: boolean | undefined;
+        policyID?: string | undefined;
+        reportName?: string | undefined;
+        reportID: string;
+        chatReportID?: string | undefined;
+        stateNum?: any;
+        statusNum?: any;
+        writeCapability?: any;
+        type?: string | undefined;
+        visibility?: any;
+        invoiceReceiver?: import('@src/types/onyx/Report').InvoiceReceiver | undefined;
+        parentReportID?: string | undefined;
+        parentReportActionID?: string | undefined;
+        managerID?: number | undefined;
+        /* eslint-enable @typescript-eslint/prefer-nullish-coalescing */
+        lastVisibleActionLastModified?: string | undefined;
+        lastMessageHtml?: string | undefined;
+        lastActorAccountID?: number | undefined;
+        lastActionType?: any;
+        ownerAccountID?: number | undefined;
+        participants?: import('@src/types/onyx/Report').Participants | undefined;
+        total?: number | undefined;
+        unheldTotal?: number | undefined;
+        unheldNonReimbursableTotal?: number | undefined;
+        currency?: string | undefined;
+        errorFields?: import('@src/types/onyx/OnyxCommon').ErrorFields | undefined;
+        errors?: import('@src/types/onyx/OnyxCommon').Errors | undefined;
+        isWaitingOnBankAccount?: boolean | undefined;
+        isCancelledIOU?: boolean | undefined;
+        iouReportID?: string | undefined;
+        preexistingReportID?: string | undefined;
+        nonReimbursableTotal?: number | undefined;
+        privateNotes?:
+            | Record<
+                  number,
+                  {note: string; errors?: import('@src/types/onyx/OnyxCommon').Errors | undefined} & {
+                      pendingAction?: any;
+                      pendingFields?: import('@src/types/onyx/OnyxCommon').PendingFields<'errors' | 'note'> | undefined;
+                  }
+              >
+            | undefined;
+        fieldList?: Record<string, OnyxTypes.PolicyReportField> | undefined;
+        permissions?: ValueOf<{readonly READ: 'read'; readonly WRITE: 'write'; readonly SHARE: 'share'; readonly OWN: 'own'; readonly AUDITOR: 'auditor'}>[] | undefined;
+        tripData?: {startDate: string; endDate: string; tripID: string} | undefined;
+        private_isArchived?: string | undefined;
+        welcomeMessage?: string | undefined;
+    } & {
+        pendingAction?: any;
+        pendingFields?:
+            | import('@src/types/onyx/OnyxCommon').PendingFields<
+                  | 'description'
+                  | 'avatar'
+                  | 'privateNotes'
+                  | 'currency'
+                  | 'type'
+                  | 'policyID'
+                  | 'reportID'
+                  | 'preview'
+                  | 'parentReportID'
+                  | 'errors'
+                  | 'policyName'
+                  | 'total'
+                  | 'errorFields'
+                  | 'reportName'
+                  | 'writeCapability'
+                  | 'participants'
+                  | 'visibility'
+                  | 'addWorkspaceRoom'
+                  | 'ownerAccountID'
+                  | 'fieldList'
+                  | 'createChat'
+                  | 'partial'
+                  | 'reimbursed'
+                  | 'avatarUrl'
+                  | 'chatType'
+                  | 'hasOutstandingChildRequest'
+                  | 'hasOutstandingChildTask'
+                  | 'isOwnPolicyExpenseChat'
+                  | 'isPinned'
+                  | 'lastMessageText'
+                  | 'lastVisibleActionCreated'
+                  | 'lastReadTime'
+                  | 'lastReadSequenceNumber'
+                  | 'lastMentionedTime'
+                  | 'policyAvatar'
+                  | 'oldPolicyName'
+                  | 'hasParentAccess'
+                  | 'isDeletedParentAction'
+                  | 'chatReportID'
+                  | 'stateNum'
+                  | 'statusNum'
+                  | 'invoiceReceiver'
+                  | 'parentReportActionID'
+                  | 'managerID'
+                  | 'lastVisibleActionLastModified'
+                  | 'lastMessageHtml'
+                  | 'lastActorAccountID'
+                  | 'lastActionType'
+                  | 'unheldTotal'
+                  | 'unheldNonReimbursableTotal'
+                  | 'isWaitingOnBankAccount'
+                  | 'isCancelledIOU'
+                  | 'iouReportID'
+                  | 'preexistingReportID'
+                  | 'nonReimbursableTotal'
+                  | 'permissions'
+                  | 'tripData'
+                  | 'private_isArchived'
+                  | 'welcomeMessage'
+              >
+            | undefined;
+    },
+): any {
+    throw new Error('Function not implemented.');
+}

From cf8042713b7d9eb9e5f92eb11d646050170ffa68 Mon Sep 17 00:00:00 2001
From: Rutika Pawar <183392827+twilight2294@users.noreply.github.com>
Date: Tue, 21 Jan 2025 15:11:46 +0530
Subject: [PATCH 4/7] fix wrong import

---
 src/pages/ReportDetailsPage.tsx | 136 +-------------------------------
 1 file changed, 2 insertions(+), 134 deletions(-)

diff --git a/src/pages/ReportDetailsPage.tsx b/src/pages/ReportDetailsPage.tsx
index 39216254baff..89d985b9ac73 100644
--- a/src/pages/ReportDetailsPage.tsx
+++ b/src/pages/ReportDetailsPage.tsx
@@ -121,6 +121,7 @@ import {
     navigateBackOnDeleteTransaction,
     navigateToPrivateNotes,
     shouldDisableRename as shouldDisableRenameModule,
+    shouldUseFullTitleToDisplay,
 } from '@libs/ReportUtils';
 import StringUtils from '@libs/StringUtils';
 import {getAllReportTransactions} from '@libs/TransactionUtils';
@@ -196,7 +197,7 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta
     const isPolicyAdmin = useMemo(() => isPolicyAdminModule(policy), [policy]);
     const isPolicyEmployee = useMemo(() => isPolicyEmployeeModule(report?.policyID, policies), [report?.policyID, policies]);
     const isPolicyExpenseChat = useMemo(() => isPolicyExpenseChatModule(report), [report]);
-    const shouldUseFullTitle = useMemo(() => shouldUseFullTitleToDisplayModule(report), [report]);
+    const shouldUseFullTitle = useMemo(() => shouldUseFullTitleToDisplay(report), [report]);
     const isChatRoom = useMemo(() => isChatRoomModule(report), [report]);
     const isUserCreatedPolicyRoom = useMemo(() => isUserCreatedPolicyRoomModule(report), [report]);
     const isDefaultRoom = useMemo(() => isDefaultRoomModule(report), [report]);
@@ -1116,136 +1117,3 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta
 ReportDetailsPage.displayName = 'ReportDetailsPage';
 
 export default withReportOrNotFound()(ReportDetailsPage);
-function shouldUseFullTitleToDisplayModule(
-    report: {
-        avatarUrl?: string | undefined;
-        chatType?: any;
-        hasOutstandingChildRequest?: boolean | undefined;
-        hasOutstandingChildTask?: boolean | undefined;
-        isOwnPolicyExpenseChat?: boolean | undefined;
-        isPinned?: boolean | undefined;
-        lastMessageText?: string | undefined;
-        lastVisibleActionCreated?: string | undefined;
-        lastReadTime?: string | undefined;
-        lastReadSequenceNumber?: number | undefined;
-        lastMentionedTime?: string | null | undefined;
-        policyAvatar?: string | null | undefined;
-        policyName?: string | null | undefined;
-        oldPolicyName?: string | undefined;
-        hasParentAccess?: boolean | undefined;
-        description?: string | undefined;
-        isDeletedParentAction?: boolean | undefined;
-        policyID?: string | undefined;
-        reportName?: string | undefined;
-        reportID: string;
-        chatReportID?: string | undefined;
-        stateNum?: any;
-        statusNum?: any;
-        writeCapability?: any;
-        type?: string | undefined;
-        visibility?: any;
-        invoiceReceiver?: import('@src/types/onyx/Report').InvoiceReceiver | undefined;
-        parentReportID?: string | undefined;
-        parentReportActionID?: string | undefined;
-        managerID?: number | undefined;
-        /* eslint-enable @typescript-eslint/prefer-nullish-coalescing */
-        lastVisibleActionLastModified?: string | undefined;
-        lastMessageHtml?: string | undefined;
-        lastActorAccountID?: number | undefined;
-        lastActionType?: any;
-        ownerAccountID?: number | undefined;
-        participants?: import('@src/types/onyx/Report').Participants | undefined;
-        total?: number | undefined;
-        unheldTotal?: number | undefined;
-        unheldNonReimbursableTotal?: number | undefined;
-        currency?: string | undefined;
-        errorFields?: import('@src/types/onyx/OnyxCommon').ErrorFields | undefined;
-        errors?: import('@src/types/onyx/OnyxCommon').Errors | undefined;
-        isWaitingOnBankAccount?: boolean | undefined;
-        isCancelledIOU?: boolean | undefined;
-        iouReportID?: string | undefined;
-        preexistingReportID?: string | undefined;
-        nonReimbursableTotal?: number | undefined;
-        privateNotes?:
-            | Record<
-                  number,
-                  {note: string; errors?: import('@src/types/onyx/OnyxCommon').Errors | undefined} & {
-                      pendingAction?: any;
-                      pendingFields?: import('@src/types/onyx/OnyxCommon').PendingFields<'errors' | 'note'> | undefined;
-                  }
-              >
-            | undefined;
-        fieldList?: Record<string, OnyxTypes.PolicyReportField> | undefined;
-        permissions?: ValueOf<{readonly READ: 'read'; readonly WRITE: 'write'; readonly SHARE: 'share'; readonly OWN: 'own'; readonly AUDITOR: 'auditor'}>[] | undefined;
-        tripData?: {startDate: string; endDate: string; tripID: string} | undefined;
-        private_isArchived?: string | undefined;
-        welcomeMessage?: string | undefined;
-    } & {
-        pendingAction?: any;
-        pendingFields?:
-            | import('@src/types/onyx/OnyxCommon').PendingFields<
-                  | 'description'
-                  | 'avatar'
-                  | 'privateNotes'
-                  | 'currency'
-                  | 'type'
-                  | 'policyID'
-                  | 'reportID'
-                  | 'preview'
-                  | 'parentReportID'
-                  | 'errors'
-                  | 'policyName'
-                  | 'total'
-                  | 'errorFields'
-                  | 'reportName'
-                  | 'writeCapability'
-                  | 'participants'
-                  | 'visibility'
-                  | 'addWorkspaceRoom'
-                  | 'ownerAccountID'
-                  | 'fieldList'
-                  | 'createChat'
-                  | 'partial'
-                  | 'reimbursed'
-                  | 'avatarUrl'
-                  | 'chatType'
-                  | 'hasOutstandingChildRequest'
-                  | 'hasOutstandingChildTask'
-                  | 'isOwnPolicyExpenseChat'
-                  | 'isPinned'
-                  | 'lastMessageText'
-                  | 'lastVisibleActionCreated'
-                  | 'lastReadTime'
-                  | 'lastReadSequenceNumber'
-                  | 'lastMentionedTime'
-                  | 'policyAvatar'
-                  | 'oldPolicyName'
-                  | 'hasParentAccess'
-                  | 'isDeletedParentAction'
-                  | 'chatReportID'
-                  | 'stateNum'
-                  | 'statusNum'
-                  | 'invoiceReceiver'
-                  | 'parentReportActionID'
-                  | 'managerID'
-                  | 'lastVisibleActionLastModified'
-                  | 'lastMessageHtml'
-                  | 'lastActorAccountID'
-                  | 'lastActionType'
-                  | 'unheldTotal'
-                  | 'unheldNonReimbursableTotal'
-                  | 'isWaitingOnBankAccount'
-                  | 'isCancelledIOU'
-                  | 'iouReportID'
-                  | 'preexistingReportID'
-                  | 'nonReimbursableTotal'
-                  | 'permissions'
-                  | 'tripData'
-                  | 'private_isArchived'
-                  | 'welcomeMessage'
-              >
-            | undefined;
-    },
-): any {
-    throw new Error('Function not implemented.');
-}

From fd930d3392eeb08d2adf2bead2c14f5c949cd114 Mon Sep 17 00:00:00 2001
From: Rutika Pawar <183392827+twilight2294@users.noreply.github.com>
Date: Wed, 22 Jan 2025 13:41:33 +0530
Subject: [PATCH 5/7] use proper module names

---
 src/pages/ReportDetailsPage.tsx | 114 ++++++++++++++++----------------
 1 file changed, 57 insertions(+), 57 deletions(-)

diff --git a/src/pages/ReportDetailsPage.tsx b/src/pages/ReportDetailsPage.tsx
index 89d985b9ac73..f9b08ced4953 100644
--- a/src/pages/ReportDetailsPage.tsx
+++ b/src/pages/ReportDetailsPage.tsx
@@ -32,7 +32,7 @@ import usePaginatedReportActions from '@hooks/usePaginatedReportActions';
 import useResponsiveLayout from '@hooks/useResponsiveLayout';
 import useThemeStyles from '@hooks/useThemeStyles';
 import {
-    cancelPayment as cancelPaymentModule,
+    cancelPayment as cancelPaymentIOU,
     deleteMoneyRequest,
     deleteTrackExpense,
     getNavigationUrlAfterTrackExpenseDelete,
@@ -52,12 +52,12 @@ import {
     updateGroupChatAvatar,
 } from '@libs/actions/Report';
 import {checkIfActionIsAllowed} from '@libs/actions/Session';
-import {canActionTask as canActionTaskModule, canModifyTask as canModifyTaskModule, deleteTask, reopenTask} from '@libs/actions/Task';
+import {canActionTask as canActionTaskTask, canModifyTask as canModifyTaskTask, deleteTask, reopenTask} from '@libs/actions/Task';
 import Navigation from '@libs/Navigation/Navigation';
 import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types';
 import type {ReportDetailsNavigatorParamList} from '@libs/Navigation/types';
 import {getPersonalDetailsForAccountIDs} from '@libs/OptionsListUtils';
-import {getConnectedIntegration, isPolicyAdmin as isPolicyAdminModule, isPolicyEmployee as isPolicyEmployeeModule, isSubmitAndClose, shouldShowPolicy} from '@libs/PolicyUtils';
+import {getConnectedIntegration, isPolicyAdmin as isPolicyAdminPolicyUtils, isPolicyEmployee as isPolicyEmployeePolicyUtils, isSubmitAndClose, shouldShowPolicy} from '@libs/PolicyUtils';
 import {
     getOneTransactionThreadReportID,
     getOriginalMessage,
@@ -69,8 +69,8 @@ import {
 } from '@libs/ReportActionsUtils';
 import {
     canDeleteTransaction,
-    canEditReportDescription as canEditReportDescriptionModule,
-    canHoldUnholdReportAction as canHoldUnholdReportActionModule,
+    canEditReportDescription as canEditReportDescriptionReportUtils,
+    canHoldUnholdReportAction as canHoldUnholdReportActionReportUtils,
     canJoinChat,
     canLeaveChat,
     canWriteInReport,
@@ -88,39 +88,39 @@ import {
     getReportName,
     isAdminOwnerApproverOrReportOwner,
     isArchivedNonExpenseReport,
-    isCanceledTaskReport as isCanceledTaskReportModule,
-    isChatRoom as isChatRoomModule,
-    isChatThread as isChatThreadModule,
+    isCanceledTaskReport as isCanceledTaskReportReportUtils,
+    isChatRoom as isChatRoomReportUtils,
+    isChatThread as isChatThreadReportUtils,
     isClosedReport,
     isCompletedTaskReport,
     isConciergeChatReport,
-    isDefaultRoom as isDefaultRoomModule,
-    isExpenseReport as isExpenseReportModule,
+    isDefaultRoom as isDefaultRoomReportUtils,
+    isExpenseReport as isExpenseReportReportUtils,
     isExported,
-    isGroupChat as isGroupChatModule,
+    isGroupChat as isGroupChatReportUtils,
     isHiddenForCurrentUser,
-    isInvoiceReport as isInvoiceReportModule,
-    isInvoiceRoom as isInvoiceRoomModule,
-    isMoneyRequest as isMoneyRequestModule,
-    isMoneyRequestReport as isMoneyRequestReportModule,
-    isPayer as isPayerModule,
-    isPolicyExpenseChat as isPolicyExpenseChatModule,
+    isInvoiceReport as isInvoiceReportReportUtils,
+    isInvoiceRoom as isInvoiceRoomReportUtils,
+    isMoneyRequestReport as isMoneyRequestReportReportUtils,
+    isMoneyRequest as isMoneyRequestReportUtils,
+    isPayer as isPayerReportUtils,
+    isPolicyExpenseChat as isPolicyExpenseChatReportUtils,
     isPublicRoom,
     isReportApproved,
     isReportFieldDisabled,
     isReportFieldOfTypeTitle,
     isReportManager,
-    isRootGroupChat as isRootGroupChatModule,
-    isSelfDM as isSelfDMModule,
-    isSettled as isSettledModule,
-    isSystemChat as isSystemChatModule,
-    isTaskReport as isTaskReportModule,
-    isThread as isThreadModule,
-    isTrackExpenseReport as isTrackExpenseReportModule,
-    isUserCreatedPolicyRoom as isUserCreatedPolicyRoomModule,
+    isRootGroupChat as isRootGroupChatReportUtils,
+    isSelfDM as isSelfDMReportUtils,
+    isSettled as isSettledReportUtils,
+    isSystemChat as isSystemChatReportUtils,
+    isTaskReport as isTaskReportReportUtils,
+    isThread as isThreadReportUtils,
+    isTrackExpenseReport as isTrackExpenseReportReportUtils,
+    isUserCreatedPolicyRoom as isUserCreatedPolicyRoomReportUtils,
     navigateBackOnDeleteTransaction,
     navigateToPrivateNotes,
-    shouldDisableRename as shouldDisableRenameModule,
+    shouldDisableRename as shouldDisableRenameReportUtils,
     shouldUseFullTitleToDisplay,
 } from '@libs/ReportUtils';
 import StringUtils from '@libs/StringUtils';
@@ -194,30 +194,30 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta
     const [offlineModalVisible, setOfflineModalVisible] = useState(false);
     const [downloadErrorModalVisible, setDownloadErrorModalVisible] = useState(false);
     const policy = useMemo(() => policies?.[`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID}`], [policies, report?.policyID]);
-    const isPolicyAdmin = useMemo(() => isPolicyAdminModule(policy), [policy]);
-    const isPolicyEmployee = useMemo(() => isPolicyEmployeeModule(report?.policyID, policies), [report?.policyID, policies]);
-    const isPolicyExpenseChat = useMemo(() => isPolicyExpenseChatModule(report), [report]);
+    const isPolicyAdmin = useMemo(() => isPolicyAdminPolicyUtils(policy), [policy]);
+    const isPolicyEmployee = useMemo(() => isPolicyEmployeePolicyUtils(report?.policyID, policies), [report?.policyID, policies]);
+    const isPolicyExpenseChat = useMemo(() => isPolicyExpenseChatReportUtils(report), [report]);
     const shouldUseFullTitle = useMemo(() => shouldUseFullTitleToDisplay(report), [report]);
-    const isChatRoom = useMemo(() => isChatRoomModule(report), [report]);
-    const isUserCreatedPolicyRoom = useMemo(() => isUserCreatedPolicyRoomModule(report), [report]);
-    const isDefaultRoom = useMemo(() => isDefaultRoomModule(report), [report]);
-    const isChatThread = useMemo(() => isChatThreadModule(report), [report]);
+    const isChatRoom = useMemo(() => isChatRoomReportUtils(report), [report]);
+    const isUserCreatedPolicyRoom = useMemo(() => isUserCreatedPolicyRoomReportUtils(report), [report]);
+    const isDefaultRoom = useMemo(() => isDefaultRoomReportUtils(report), [report]);
+    const isChatThread = useMemo(() => isChatThreadReportUtils(report), [report]);
     const isArchivedRoom = useMemo(() => isArchivedNonExpenseReport(report, reportNameValuePairs), [report, reportNameValuePairs]);
-    const isMoneyRequestReport = useMemo(() => isMoneyRequestReportModule(report), [report]);
-    const isMoneyRequest = useMemo(() => isMoneyRequestModule(report), [report]);
-    const isInvoiceReport = useMemo(() => isInvoiceReportModule(report), [report]);
-    const isInvoiceRoom = useMemo(() => isInvoiceRoomModule(report), [report]);
-    const isTaskReport = useMemo(() => isTaskReportModule(report), [report]);
-    const isSelfDM = useMemo(() => isSelfDMModule(report), [report]);
-    const isTrackExpenseReport = isTrackExpenseReportModule(report);
+    const isMoneyRequestReport = useMemo(() => isMoneyRequestReportReportUtils(report), [report]);
+    const isMoneyRequest = useMemo(() => isMoneyRequestReportUtils(report), [report]);
+    const isInvoiceReport = useMemo(() => isInvoiceReportReportUtils(report), [report]);
+    const isInvoiceRoom = useMemo(() => isInvoiceRoomReportUtils(report), [report]);
+    const isTaskReport = useMemo(() => isTaskReportReportUtils(report), [report]);
+    const isSelfDM = useMemo(() => isSelfDMReportUtils(report), [report]);
+    const isTrackExpenseReport = isTrackExpenseReportReportUtils(report);
     const parentReportAction = getReportAction(report?.parentReportID, report?.parentReportActionID);
-    const isCanceledTaskReport = isCanceledTaskReportModule(report, parentReportAction);
-    const canEditReportDescription = useMemo(() => canEditReportDescriptionModule(report, policy), [report, policy]);
+    const isCanceledTaskReport = isCanceledTaskReportReportUtils(report, parentReportAction);
+    const canEditReportDescription = useMemo(() => canEditReportDescriptionReportUtils(report, policy), [report, policy]);
     const shouldShowReportDescription = isChatRoom && (canEditReportDescription || report.description !== '');
     const isExpenseReport = isMoneyRequestReport || isInvoiceReport || isMoneyRequest;
     const isSingleTransactionView = isMoneyRequest || isTrackExpenseReport;
-    const isSelfDMTrackExpenseReport = isTrackExpenseReport && isSelfDMModule(parentReport);
-    const shouldDisableRename = useMemo(() => shouldDisableRenameModule(report), [report]);
+    const isSelfDMTrackExpenseReport = isTrackExpenseReport && isSelfDMReportUtils(parentReport);
+    const shouldDisableRename = useMemo(() => shouldDisableRenameReportUtils(report), [report]);
     const parentNavigationSubtitleData = getParentNavigationSubtitle(report);
     // eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps -- policy is a dependency because `getChatRoomSubtitle` calls `getPolicyName` which in turn retrieves the value from the `policy` value stored in Onyx
     const chatRoomSubtitle = useMemo(() => {
@@ -229,10 +229,10 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta
 
         return '';
     }, [report]);
-    const isSystemChat = useMemo(() => isSystemChatModule(report), [report]);
-    const isGroupChat = useMemo(() => isGroupChatModule(report), [report]);
-    const isRootGroupChat = useMemo(() => isRootGroupChatModule(report), [report]);
-    const isThread = useMemo(() => isThreadModule(report), [report]);
+    const isSystemChat = useMemo(() => isSystemChatReportUtils(report), [report]);
+    const isGroupChat = useMemo(() => isGroupChatReportUtils(report), [report]);
+    const isRootGroupChat = useMemo(() => isRootGroupChatReportUtils(report), [report]);
+    const isThread = useMemo(() => isThreadReportUtils(report), [report]);
     const shouldOpenRoomMembersPage = isUserCreatedPolicyRoom || isChatThread || (isPolicyExpenseChat && isPolicyAdmin);
     const participants = useMemo(() => {
         return getParticipantsList(report, personalDetails, shouldOpenRoomMembersPage);
@@ -294,14 +294,14 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta
 
     const moneyRequestAction = transactionThreadReportID ? requestParentReportAction : parentReportAction;
 
-    const canModifyTask = canModifyTaskModule(report, session?.accountID ?? CONST.DEFAULT_NUMBER_ID);
-    const canActionTask = canActionTaskModule(report, session?.accountID ?? CONST.DEFAULT_NUMBER_ID);
+    const canModifyTask = canModifyTaskTask(report, session?.accountID ?? CONST.DEFAULT_NUMBER_ID);
+    const canActionTask = canActionTaskTask(report, session?.accountID ?? CONST.DEFAULT_NUMBER_ID);
     const shouldShowTaskDeleteButton =
         isTaskReport && !isCanceledTaskReport && canWriteInReport(report) && report.stateNum !== CONST.REPORT.STATE_NUM.APPROVED && !isClosedReport(report) && canModifyTask && canActionTask;
     const canDeleteRequest = isActionOwner && (canDeleteTransaction(moneyRequestReport) || isSelfDMTrackExpenseReport) && !isDeletedParentAction;
     const shouldShowDeleteButton = shouldShowTaskDeleteButton || canDeleteRequest;
 
-    const canUnapproveRequest = isExpenseReportModule(report) && (isReportManager(report) || isPolicyAdmin) && isReportApproved(report) && !isSubmitAndClose(policy);
+    const canUnapproveRequest = isExpenseReportReportUtils(report) && (isReportManager(report) || isPolicyAdmin) && isReportApproved(report) && !isSubmitAndClose(policy);
 
     useEffect(() => {
         if (canDeleteRequest) {
@@ -354,7 +354,7 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta
     const reportName = getReportName(report);
 
     const additionalRoomDetails =
-        (isPolicyExpenseChat && !!report?.isOwnPolicyExpenseChat) || isExpenseReportModule(report) || isPolicyExpenseChat || isInvoiceRoom
+        (isPolicyExpenseChat && !!report?.isOwnPolicyExpenseChat) || isExpenseReportReportUtils(report) || isPolicyExpenseChat || isInvoiceRoom
             ? chatRoomSubtitle
             : `${translate('threads.in')} ${chatRoomSubtitle}`;
 
@@ -371,10 +371,10 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta
     const shouldShowWriteCapability = !isMoneyRequestReport;
     const shouldShowMenuItem = shouldShowNotificationPref || shouldShowWriteCapability || (!!report?.visibility && report.chatType !== CONST.REPORT.CHAT_TYPE.INVOICE);
 
-    const isPayer = isPayerModule(session, moneyRequestReport);
-    const isSettled = isSettledModule(moneyRequestReport?.reportID);
+    const isPayer = isPayerReportUtils(session, moneyRequestReport);
+    const isSettled = isSettledReportUtils(moneyRequestReport?.reportID);
 
-    const shouldShowCancelPaymentButton = caseID === CASES.MONEY_REPORT && isPayer && isSettled && isExpenseReportModule(moneyRequestReport);
+    const shouldShowCancelPaymentButton = caseID === CASES.MONEY_REPORT && isPayer && isSettled && isExpenseReportReportUtils(moneyRequestReport);
     const [chatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${moneyRequestReport?.chatReportID}`);
 
     const iouTransactionID = isMoneyRequestAction(requestParentReportAction) ? getOriginalMessage(requestParentReportAction)?.IOUTransactionID : '';
@@ -384,7 +384,7 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta
             return;
         }
 
-        cancelPaymentModule(moneyRequestReport, chatReport, backTo);
+        cancelPaymentIOU(moneyRequestReport, chatReport, backTo);
         setIsConfirmModalVisible(false);
     }, [moneyRequestReport, chatReport, backTo]);
 
@@ -734,7 +734,7 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta
         );
     }, [report, icons, isMoneyRequestReport, isInvoiceReport, isGroupChat, isThread, styles]);
 
-    const canHoldUnholdReportAction = canHoldUnholdReportActionModule(moneyRequestAction);
+    const canHoldUnholdReportAction = canHoldUnholdReportActionReportUtils(moneyRequestAction);
     const shouldShowHoldAction =
         caseID !== CASES.DEFAULT &&
         (canHoldUnholdReportAction.canHoldRequest || canHoldUnholdReportAction.canUnholdRequest) &&

From 68252f5eb158a3d1796623392dfb12ad1a67ad9f Mon Sep 17 00:00:00 2001
From: Rutika Pawar <183392827+twilight2294@users.noreply.github.com>
Date: Thu, 23 Jan 2025 17:51:25 +0530
Subject: [PATCH 6/7] remove extra line

---
 src/pages/ReportDetailsPage.tsx | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/pages/ReportDetailsPage.tsx b/src/pages/ReportDetailsPage.tsx
index 109d8d5f6030..ec0cb640b807 100644
--- a/src/pages/ReportDetailsPage.tsx
+++ b/src/pages/ReportDetailsPage.tsx
@@ -299,7 +299,6 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta
 
     const canModifyTask = canModifyTaskAction(report, session?.accountID ?? CONST.DEFAULT_NUMBER_ID);
     const canActionTask = canActionTaskAction(report, session?.accountID ?? CONST.DEFAULT_NUMBER_ID);
-
     const shouldShowTaskDeleteButton =
         isTaskReport && !isCanceledTaskReport && canWriteInReport(report) && report.stateNum !== CONST.REPORT.STATE_NUM.APPROVED && !isClosedReport(report) && canModifyTask && canActionTask;
     const canDeleteRequest = isActionOwner && (canDeleteTransaction(moneyRequestReport) || isSelfDMTrackExpenseReport) && !isDeletedParentAction;

From f4c3fe755a1a020bc12e37fdec7b7010711190d6 Mon Sep 17 00:00:00 2001
From: Rutika Pawar <183392827+twilight2294@users.noreply.github.com>
Date: Thu, 23 Jan 2025 17:52:36 +0530
Subject: [PATCH 7/7] correct function name

---
 src/pages/ReportDetailsPage.tsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/pages/ReportDetailsPage.tsx b/src/pages/ReportDetailsPage.tsx
index ec0cb640b807..dd68a8586a0b 100644
--- a/src/pages/ReportDetailsPage.tsx
+++ b/src/pages/ReportDetailsPage.tsx
@@ -387,7 +387,7 @@ function ReportDetailsPage({policies, report, route, reportMetadata}: ReportDeta
             return;
         }
 
-        cancelPaymentIOU(moneyRequestReport, chatReport, backTo);
+        cancelPaymentAction(moneyRequestReport, chatReport, backTo);
         setIsConfirmModalVisible(false);
     }, [moneyRequestReport, chatReport, backTo]);
 
