@@ -23,6 +23,7 @@ import usePolicy from '@hooks/usePolicy';
2323import useStyleUtils from '@hooks/useStyleUtils' ;
2424import useThemeIllustrations from '@hooks/useThemeIllustrations' ;
2525import useThemeStyles from '@hooks/useThemeStyles' ;
26+ import { isUsingStagingApi } from '@libs/ApiUtils' ;
2627import { getCardFeedIcon , getCompanyCardFeed , getCompanyFeeds , getDefaultCardName , getDomainOrWorkspaceAccountID , getPlaidInstitutionIconUrl , maskCardNumber } from '@libs/CardUtils' ;
2728import { getLatestErrorField } from '@libs/ErrorUtils' ;
2829import type { PlatformStackScreenProps } from '@libs/Navigation/PlatformStackNavigation/types' ;
@@ -53,7 +54,7 @@ function WorkspaceCompanyCardDetailsPage({route}: WorkspaceCompanyCardDetailsPag
5354 const bank = getCompanyCardFeed ( feedName ) ;
5455 const [ connectionSyncProgress ] = useOnyx ( `${ ONYXKEYS . COLLECTION . POLICY_CONNECTION_SYNC_PROGRESS } ${ policyID } ` ) ;
5556 const [ customCardNames ] = useOnyx ( ONYXKEYS . NVP_EXPENSIFY_COMPANY_CARDS_CUSTOM_NAMES ) ;
56- const [ shouldUseStagingServer ] = useOnyx ( ONYXKEYS . SHOULD_USE_STAGING_SERVER ) ;
57+ const [ shouldUseStagingServer = isUsingStagingApi ( ) ] = useOnyx ( ONYXKEYS . SHOULD_USE_STAGING_SERVER ) ;
5758 const policy = usePolicy ( policyID ) ;
5859 const workspaceAccountID = policy ?. workspaceAccountID ?? CONST . DEFAULT_NUMBER_ID ;
5960 const [ isUnassignModalVisible , setIsUnassignModalVisible ] = useState ( false ) ;
@@ -109,10 +110,10 @@ function WorkspaceCompanyCardDetailsPage({route}: WorkspaceCompanyCardDetailsPag
109110 updateWorkspaceCompanyCard ( domainOrWorkspaceAccountID , cardID , bank , card ?. lastScrapeResult , true ) ;
110111 } ;
111112
112- // Show "Break connection" option only for Mock Bank cards when the backend API is non-production
113+ // Show "Break connection" only when Mock Bank requests target non-production APIs.
113114 const isMockBank = bank ?. includes ( CONST . COMPANY_CARDS . BANK_CONNECTIONS . MOCK_BANK ) ;
114- const isNonProductionBackend = CONFIG . EXPENSIFY . EXPENSIFY_URL . includes ( '.dev' ) || CONFIG . EXPENSIFY . EXPENSIFY_URL . includes ( 'staging' ) || ! ! shouldUseStagingServer ;
115- const shouldShowBreakConnection = isMockBank && isNonProductionBackend ;
115+ const isUsingNonProductionAPI = shouldUseStagingServer || CONFIG . IS_USING_LOCAL_WEB ;
116+ const shouldShowBreakConnection = isMockBank && isUsingNonProductionAPI ;
116117
117118 const lastScrape = useMemo ( ( ) => {
118119 if ( ! card ?. lastScrape ) {
0 commit comments