1- import { useState } from 'react' ;
1+ import { useContext , useState } from 'react' ;
22import type { DropdownOption } from '@components/ButtonWithDropdownMenu/types' ;
3+ import { DelegateNoAccessContext } from '@components/DelegateNoAccessModalProvider' ;
34import type { PopoverMenuItem } from '@components/PopoverMenu' ;
45import { useSearchContext } from '@components/Search/SearchContext' ;
56import { initSplitExpense } from '@libs/actions/IOU' ;
@@ -67,6 +68,7 @@ function useSelectedTransactionsActions({
6768 isOnSearch ?: boolean ;
6869} ) {
6970 const { isOffline} = useNetworkWithOfflineStatus ( ) ;
71+ const { isDelegateAccessRestricted, showDelegateNoAccessModal} = useContext ( DelegateNoAccessContext ) ;
7072 const { selectedTransactionIDs, clearSelectedTransactions, currentSearchHash, selectedTransactions : selectedTransactionsMeta } = useSearchContext ( ) ;
7173 const allTransactions = useAllTransactions ( ) ;
7274 const [ allReports ] = useOnyx ( ONYXKEYS . COLLECTION . REPORT , { canBeMissing : false } ) ;
@@ -184,6 +186,11 @@ function useSelectedTransactionsActions({
184186 icon : expensifyIcons . Stopwatch ,
185187 value : HOLD ,
186188 onSelected : ( ) => {
189+ if ( isDelegateAccessRestricted ) {
190+ showDelegateNoAccessModal ( ) ;
191+ return ;
192+ }
193+
187194 if ( ! report ?. reportID ) {
188195 return ;
189196 }
@@ -198,6 +205,11 @@ function useSelectedTransactionsActions({
198205 icon : expensifyIcons . Stopwatch ,
199206 value : UNHOLD ,
200207 onSelected : ( ) => {
208+ if ( isDelegateAccessRestricted ) {
209+ showDelegateNoAccessModal ( ) ;
210+ return ;
211+ }
212+
201213 for ( const transactionID of selectedTransactionIDs ) {
202214 const action = getIOUActionForTransactionID ( reportActions , transactionID ) ;
203215 if ( ! action ?. childReportID ) {
@@ -219,6 +231,11 @@ function useSelectedTransactionsActions({
219231 icon : expensifyIcons . ThumbsDown ,
220232 value : CONST . REPORT . SECONDARY_ACTIONS . REJECT ,
221233 onSelected : ( ) => {
234+ if ( isDelegateAccessRestricted ) {
235+ showDelegateNoAccessModal ( ) ;
236+ return ;
237+ }
238+
222239 Navigation . navigate ( ROUTES . SEARCH_MONEY_REQUEST_REPORT_REJECT_TRANSACTIONS . getRoute ( { reportID : report . reportID } ) ) ;
223240 } ,
224241 } ) ;
0 commit comments