@@ -6,10 +6,9 @@ import Text from '@components/Text';
6
6
import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails' ;
7
7
import useLocalize from '@hooks/useLocalize' ;
8
8
import useThemeStyles from '@hooks/useThemeStyles' ;
9
- import * as QuickbooksOnline from '@libs/actions/connections/QuickbooksOnline' ;
10
- import * as ErrorUtils from '@libs/ErrorUtils' ;
11
- import * as PolicyUtils from '@libs/PolicyUtils' ;
12
- import { getAdminEmployees } from '@libs/PolicyUtils' ;
9
+ import { updateQuickbooksOnlinePreferredExporter } from '@libs/actions/connections/QuickbooksOnline' ;
10
+ import { getLatestErrorField } from '@libs/ErrorUtils' ;
11
+ import { getAdminEmployees , isExpensifyTeam , settingsPendingAction } from '@libs/PolicyUtils' ;
13
12
import Navigation from '@navigation/Navigation' ;
14
13
import type { WithPolicyConnectionsProps } from '@pages/workspace/withPolicyConnections' ;
15
14
import withPolicyConnections from '@pages/workspace/withPolicyConnections' ;
@@ -28,7 +27,7 @@ function QuickbooksPreferredExporterConfigurationPage({policy}: WithPolicyConnec
28
27
const exporters = getAdminEmployees ( policy ) ;
29
28
const { login : currentUserLogin } = useCurrentUserPersonalDetails ( ) ;
30
29
31
- const policyID = policy ?. id ?? '-1' ;
30
+ const policyID = policy ?. id ;
32
31
const data : CardListItem [ ] = useMemo (
33
32
( ) =>
34
33
exporters ?. reduce < CardListItem [ ] > ( ( options , exporter ) => {
@@ -37,7 +36,7 @@ function QuickbooksPreferredExporterConfigurationPage({policy}: WithPolicyConnec
37
36
}
38
37
39
38
// Don't show guides if the current user is not a guide themselves or an Expensify employee
40
- if ( PolicyUtils . isExpensifyTeam ( exporter . email ) && ! PolicyUtils . isExpensifyTeam ( policy ?. owner ) && ! PolicyUtils . isExpensifyTeam ( currentUserLogin ) ) {
39
+ if ( isExpensifyTeam ( exporter . email ) && ! isExpensifyTeam ( policy ?. owner ) && ! isExpensifyTeam ( currentUserLogin ) ) {
41
40
return options ;
42
41
}
43
42
options . push ( {
@@ -54,9 +53,9 @@ function QuickbooksPreferredExporterConfigurationPage({policy}: WithPolicyConnec
54
53
const selectExporter = useCallback (
55
54
( row : CardListItem ) => {
56
55
if ( row . value !== qboConfig ?. export ?. exporter ) {
57
- QuickbooksOnline . updateQuickbooksOnlinePreferredExporter ( policyID , { exporter : row . value } , { exporter : qboConfig ?. export . exporter ?? '' } ) ;
56
+ updateQuickbooksOnlinePreferredExporter ( policyID , { exporter : row . value } , { exporter : qboConfig ?. export ? .exporter ?? '' } ) ;
58
57
}
59
- Navigation . goBack ( ROUTES . POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_PREFERRED_EXPORTER . getRoute ( policyID ) ) ;
58
+ Navigation . goBack ( ROUTES . POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT . getRoute ( policyID ) ) ;
60
59
} ,
61
60
[ qboConfig ?. export , policyID ] ,
62
61
) ;
@@ -86,8 +85,8 @@ function QuickbooksPreferredExporterConfigurationPage({policy}: WithPolicyConnec
86
85
initiallyFocusedOptionKey = { data . find ( ( mode ) => mode . isSelected ) ?. keyForList }
87
86
title = "workspace.accounting.preferredExporter"
88
87
connectionName = { CONST . POLICY . CONNECTIONS . NAME . QBO }
89
- pendingAction = { PolicyUtils . settingsPendingAction ( [ CONST . QUICKBOOKS_CONFIG . EXPORT ] , qboConfig ?. pendingFields ) }
90
- errors = { ErrorUtils . getLatestErrorField ( qboConfig , CONST . QUICKBOOKS_CONFIG . EXPORT ) }
88
+ pendingAction = { settingsPendingAction ( [ CONST . QUICKBOOKS_CONFIG . EXPORT ] , qboConfig ?. pendingFields ) }
89
+ errors = { getLatestErrorField ( qboConfig , CONST . QUICKBOOKS_CONFIG . EXPORT ) }
91
90
errorRowStyles = { [ styles . ph5 , styles . pv3 ] }
92
91
onClose = { ( ) => clearQBOErrorField ( policyID , CONST . QUICKBOOKS_CONFIG . EXPORT ) }
93
92
/>
0 commit comments