@@ -12,13 +12,13 @@ import Text from '@components/Text';
12
12
import useLocalize from '@hooks/useLocalize' ;
13
13
import usePolicy from '@hooks/usePolicy' ;
14
14
import useThemeStyles from '@hooks/useThemeStyles' ;
15
- import * as CardUtils from '@libs/CardUtils' ;
15
+ import { deleteWorkspaceCompanyCardFeed , setWorkspaceCompanyCardTransactionLiability } from '@libs/actions/CompanyCards' ;
16
+ import { getCompanyFeeds , getCustomOrFormattedFeedName , getSelectedFeed } from '@libs/CardUtils' ;
16
17
import Navigation from '@libs/Navigation/Navigation' ;
17
18
import type { PlatformStackScreenProps } from '@libs/Navigation/PlatformStackNavigation/types' ;
18
19
import type { SettingsNavigatorParamList } from '@libs/Navigation/types' ;
19
20
import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper' ;
20
21
import ToggleSettingOptionRow from '@pages/workspace/workflows/ToggleSettingsOptionRow' ;
21
- import * as CompanyCards from '@userActions/CompanyCards' ;
22
22
import CONST from '@src/CONST' ;
23
23
import ONYXKEYS from '@src/ONYXKEYS' ;
24
24
import ROUTES from '@src/ROUTES' ;
@@ -41,12 +41,12 @@ function WorkspaceCompanyCardsSettingsPage({
41
41
const [ cardFeeds ] = useOnyx ( `${ ONYXKEYS . COLLECTION . SHARED_NVP_PRIVATE_DOMAIN_MEMBER } ${ workspaceAccountID } ` ) ;
42
42
const [ lastSelectedFeed ] = useOnyx ( `${ ONYXKEYS . COLLECTION . LAST_SELECTED_FEED } ${ policyID } ` ) ;
43
43
// eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps -- we want to run the hook only once to escape unexpected feed change
44
- const selectedFeed = useMemo ( ( ) => CardUtils . getSelectedFeed ( lastSelectedFeed , cardFeeds ) , [ ] ) ;
44
+ const selectedFeed = useMemo ( ( ) => getSelectedFeed ( lastSelectedFeed , cardFeeds ) , [ ] ) ;
45
45
const [ cardsList ] = useOnyx ( `${ ONYXKEYS . COLLECTION . WORKSPACE_CARDS_LIST } ${ workspaceAccountID } _${ selectedFeed } ` ) ;
46
- const feedName = CardUtils . getCustomOrFormattedFeedName ( selectedFeed , cardFeeds ?. settings ?. companyCardNicknames ) ;
47
- const companyFeeds = CardUtils . getCompanyFeeds ( cardFeeds ) ;
46
+ const feedName = getCustomOrFormattedFeedName ( selectedFeed , cardFeeds ?. settings ?. companyCardNicknames ) ;
47
+ const companyFeeds = getCompanyFeeds ( cardFeeds ) ;
48
48
const liabilityType = selectedFeed && companyFeeds [ selectedFeed ] ?. liabilityType ;
49
- const isPersonal = liabilityType === CONST . COMPANY_CARDS . DELETE_TRANSACTIONS . ALLOW ;
49
+ const isPersonal = liabilityType !== CONST . COMPANY_CARDS . DELETE_TRANSACTIONS . RESTRICT ;
50
50
51
51
const navigateToChangeFeedName = ( ) => {
52
52
Navigation . navigate ( ROUTES . WORKSPACE_COMPANY_CARDS_SETTINGS_FEED_NAME . getRoute ( policyID ) ) ;
@@ -59,7 +59,7 @@ function WorkspaceCompanyCardsSettingsPage({
59
59
const feedToOpen = ( Object . keys ( companyFeeds ) as CompanyCardFeed [ ] )
60
60
. filter ( ( feed ) => feed !== selectedFeed && companyFeeds [ feed ] ?. pendingAction !== CONST . RED_BRICK_ROAD_PENDING_ACTION . DELETE )
61
61
. at ( 0 ) ;
62
- CompanyCards . deleteWorkspaceCompanyCardFeed ( policyID , workspaceAccountID , selectedFeed , cardIDs , feedToOpen ) ;
62
+ deleteWorkspaceCompanyCardFeed ( policyID , workspaceAccountID , selectedFeed , cardIDs , feedToOpen ) ;
63
63
}
64
64
setDeleteCompanyCardConfirmModalVisible ( false ) ;
65
65
Navigation . setNavigationActionToMicrotaskQueue ( Navigation . goBack ) ;
@@ -69,7 +69,7 @@ function WorkspaceCompanyCardsSettingsPage({
69
69
if ( ! selectedFeed ) {
70
70
return ;
71
71
}
72
- CompanyCards . setWorkspaceCompanyCardTransactionLiability (
72
+ setWorkspaceCompanyCardTransactionLiability (
73
73
workspaceAccountID ,
74
74
policyID ,
75
75
selectedFeed ,
0 commit comments