@@ -8,10 +8,10 @@ import ONYXKEYS from '@src/ONYXKEYS';
8
8
import type { Policy , ReimbursementAccount , Report , ReportAction , ReportActions , TransactionViolations } from '@src/types/onyx' ;
9
9
import type { PolicyConnectionSyncProgress , Unit } from '@src/types/onyx/Policy' ;
10
10
import { isConnectionInProgress } from './actions/connections' ;
11
- import * as CurrencyUtils from './CurrencyUtils' ;
11
+ import { convertToDisplayString } from './CurrencyUtils' ;
12
12
import { isPolicyAdmin , shouldShowCustomUnitsError , shouldShowEmployeeListError , shouldShowPolicyError , shouldShowSyncError , shouldShowTaxRateError } from './PolicyUtils' ;
13
- import * as ReportActionsUtils from './ReportActionsUtils' ;
14
- import * as ReportUtils from './ReportUtils' ;
13
+ import { getOneTransactionThreadReportID } from './ReportActionsUtils' ;
14
+ import { getAllReportErrors , hasReportViolations , isReportOwner , isUnread , isUnreadWithMention , requiresAttentionFromCurrentUser , shouldDisplayViolationsRBRInLHN } from './ReportUtils' ;
15
15
16
16
type CheckingMethod = ( ) => boolean ;
17
17
@@ -67,13 +67,13 @@ Onyx.connect({
67
67
*/
68
68
const getBrickRoadForPolicy = ( report : Report , altReportActions ?: OnyxCollection < ReportActions > ) : BrickRoad => {
69
69
const reportActions = ( altReportActions ?? allReportActions ) ?. [ `${ ONYXKEYS . COLLECTION . REPORT_ACTIONS } ${ report . reportID } ` ] ?? { } ;
70
- const reportErrors = ReportUtils . getAllReportErrors ( report , reportActions ) ;
71
- const oneTransactionThreadReportID = ReportActionsUtils . getOneTransactionThreadReportID ( report . reportID , reportActions ) ;
70
+ const reportErrors = getAllReportErrors ( report , reportActions ) ;
71
+ const oneTransactionThreadReportID = getOneTransactionThreadReportID ( report . reportID , reportActions ) ;
72
72
let doesReportContainErrors = Object . keys ( reportErrors ?? { } ) . length !== 0 ? CONST . BRICK_ROAD_INDICATOR_STATUS . ERROR : undefined ;
73
73
74
74
if ( ! doesReportContainErrors ) {
75
- const shouldDisplayViolations = ReportUtils . shouldDisplayViolationsRBRInLHN ( report , allTransactionViolations ) ;
76
- const shouldDisplayReportViolations = ReportUtils . isReportOwner ( report ) && ReportUtils . hasReportViolations ( report . reportID ) ;
75
+ const shouldDisplayViolations = shouldDisplayViolationsRBRInLHN ( report , allTransactionViolations ) ;
76
+ const shouldDisplayReportViolations = isReportOwner ( report ) && hasReportViolations ( report . reportID ) ;
77
77
const hasViolations = shouldDisplayViolations || shouldDisplayReportViolations ;
78
78
if ( hasViolations ) {
79
79
doesReportContainErrors = CONST . BRICK_ROAD_INDICATOR_STATUS . ERROR ;
@@ -83,7 +83,7 @@ const getBrickRoadForPolicy = (report: Report, altReportActions?: OnyxCollection
83
83
if ( oneTransactionThreadReportID && ! doesReportContainErrors ) {
84
84
const oneTransactionThreadReport = reportsCollection ?. [ `${ ONYXKEYS . COLLECTION . REPORT } ${ oneTransactionThreadReportID } ` ] ;
85
85
86
- if ( ReportUtils . shouldDisplayViolationsRBRInLHN ( oneTransactionThreadReport , allTransactionViolations ) ) {
86
+ if ( shouldDisplayViolationsRBRInLHN ( oneTransactionThreadReport , allTransactionViolations ) ) {
87
87
doesReportContainErrors = CONST . BRICK_ROAD_INDICATOR_STATUS . ERROR ;
88
88
}
89
89
}
@@ -98,8 +98,8 @@ const getBrickRoadForPolicy = (report: Report, altReportActions?: OnyxCollection
98
98
const itemParentReportActions = allReportActions ?. [ `${ ONYXKEYS . COLLECTION . REPORT_ACTIONS } ${ report . parentReportID } ` ] ?? { } ;
99
99
itemParentReportAction = report . parentReportActionID ? itemParentReportActions [ report . parentReportActionID ] : undefined ;
100
100
}
101
- const reportOption = { ...report , isUnread : ReportUtils . isUnread ( report ) , isUnreadWithMention : ReportUtils . isUnreadWithMention ( report ) } ;
102
- const shouldShowGreenDotIndicator = ReportUtils . requiresAttentionFromCurrentUser ( reportOption , itemParentReportAction ) ;
101
+ const reportOption = { ...report , isUnread : isUnread ( report ) , isUnreadWithMention : isUnreadWithMention ( report ) } ;
102
+ const shouldShowGreenDotIndicator = requiresAttentionFromCurrentUser ( reportOption , itemParentReportAction ) ;
103
103
return shouldShowGreenDotIndicator ? CONST . BRICK_ROAD_INDICATOR_STATUS . INFO : undefined ;
104
104
} ;
105
105
@@ -224,7 +224,7 @@ function getWorkspacesUnreadStatuses(reports: OnyxCollection<Report>): Record<st
224
224
225
225
// When the only message of a report is deleted lastVisibileActionCreated is not reset leading to wrongly
226
226
// setting it Unread so we add additional condition here to avoid read workspace indicator from being bold.
227
- workspacesUnreadStatuses [ policyID ] = ReportUtils . isUnread ( report ) && ! ! report . lastActorAccountID ;
227
+ workspacesUnreadStatuses [ policyID ] = isUnread ( report ) && ! ! report . lastActorAccountID ;
228
228
} ) ;
229
229
230
230
return workspacesUnreadStatuses ;
@@ -274,7 +274,7 @@ function getOwnershipChecksDisplayText(
274
274
title = translate ( 'workspace.changeOwner.ownerOwesAmountTitle' ) ;
275
275
text = translate ( 'workspace.changeOwner.ownerOwesAmountText' , {
276
276
email : ownerOwesAmount ?. ownerEmail ,
277
- amount : CurrencyUtils . convertToDisplayString ( ownerOwesAmount ?. amount , ownerOwesAmount ?. currency ) ,
277
+ amount : convertToDisplayString ( ownerOwesAmount ?. amount , ownerOwesAmount ?. currency ) ,
278
278
} ) ;
279
279
buttonText = translate ( 'workspace.changeOwner.ownerOwesAmountButtonText' ) ;
280
280
break ;
0 commit comments