From 1ca7143a9fc2acf8be5ab34166ba794199013df0 Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Tue, 13 Jan 2026 15:09:45 +0700 Subject: [PATCH 1/3] fix claim offer regression --- src/components/RequireTwoFactorAuthenticationModal.tsx | 6 ++++-- src/pages/workspace/accounting/ClaimOfferPage.tsx | 1 - 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/RequireTwoFactorAuthenticationModal.tsx b/src/components/RequireTwoFactorAuthenticationModal.tsx index fe156c15080f4..37350c8f958fe 100644 --- a/src/components/RequireTwoFactorAuthenticationModal.tsx +++ b/src/components/RequireTwoFactorAuthenticationModal.tsx @@ -32,7 +32,9 @@ type RequireTwoFactorAuthenticationModalProps = { }; function RequireTwoFactorAuthenticationModal({onCancel = () => {}, description, isVisible, onSubmit, shouldEnableNewFocusManagement}: RequireTwoFactorAuthenticationModalProps) { - const {shouldUseNarrowLayout} = useResponsiveLayout(); + // We need to use isSmallScreenWidth instead of shouldUseNarrowLayout to use the correct modal type + // eslint-disable-next-line rulesdir/prefer-shouldUseNarrowLayout-instead-of-isSmallScreenWidth + const {isSmallScreenWidth} = useResponsiveLayout(); const styles = useThemeStyles(); const {translate} = useLocalize(); const StyleUtils = useStyleUtils(); @@ -41,7 +43,7 @@ function RequireTwoFactorAuthenticationModal({onCancel = () => {}, description, diff --git a/src/pages/workspace/accounting/ClaimOfferPage.tsx b/src/pages/workspace/accounting/ClaimOfferPage.tsx index 00764ca49b037..71251b6e2f586 100644 --- a/src/pages/workspace/accounting/ClaimOfferPage.tsx +++ b/src/pages/workspace/accounting/ClaimOfferPage.tsx @@ -115,7 +115,6 @@ function ClaimOfferPage({route, policy}: ClaimOfferPageProps) { shouldBeBlocked={false} > Date: Wed, 14 Jan 2026 00:31:14 +0700 Subject: [PATCH 2/3] close the claim offer page when connected to integration --- src/libs/Environment/Environment.ts | 2 +- .../workspace/accounting/ClaimOfferPage.tsx | 31 +++++++++++++++++-- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/libs/Environment/Environment.ts b/src/libs/Environment/Environment.ts index 23c7b360dc630..b570fecd78162 100644 --- a/src/libs/Environment/Environment.ts +++ b/src/libs/Environment/Environment.ts @@ -12,7 +12,7 @@ const ENVIRONMENT_URLS = { }; const OLDDOT_ENVIRONMENT_URLS = { - [CONST.ENVIRONMENT.DEV]: CONST.INTERNAL_DEV_EXPENSIFY_URL, + [CONST.ENVIRONMENT.DEV]: CONST.EXPENSIFY_URL, [CONST.ENVIRONMENT.STAGING]: CONST.STAGING_EXPENSIFY_URL, [CONST.ENVIRONMENT.PRODUCTION]: CONST.EXPENSIFY_URL, [CONST.ENVIRONMENT.ADHOC]: CONST.STAGING_EXPENSIFY_URL, diff --git a/src/pages/workspace/accounting/ClaimOfferPage.tsx b/src/pages/workspace/accounting/ClaimOfferPage.tsx index 71251b6e2f586..33ca2026b1b61 100644 --- a/src/pages/workspace/accounting/ClaimOfferPage.tsx +++ b/src/pages/workspace/accounting/ClaimOfferPage.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, {useEffect, useMemo} from 'react'; import {View} from 'react-native'; import Button from '@components/Button'; import FixedFooter from '@components/FixedFooter'; @@ -8,18 +8,22 @@ import RenderHTML from '@components/RenderHTML'; import ScreenWrapper from '@components/ScreenWrapper'; import ScrollView from '@components/ScrollView'; import Text from '@components/Text'; +import useGetReceiptPartnersIntegrationData from '@hooks/useGetReceiptPartnersIntegrationData'; import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset'; import useLocalize from '@hooks/useLocalize'; import useNetwork from '@hooks/useNetwork'; +import useOnyx from '@hooks/useOnyx'; import useThemeStyles from '@hooks/useThemeStyles'; import {openExternalLink} from '@libs/actions/Link'; import Navigation from '@libs/Navigation/Navigation'; import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; +import {getConnectedIntegration} from '@libs/PolicyUtils'; import type {SettingsNavigatorParamList} from '@navigation/types'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; import type {WithPolicyConnectionsProps} from '@pages/workspace/withPolicyConnections'; import withPolicyConnections from '@pages/workspace/withPolicyConnections'; import CONST from '@src/CONST'; +import ONYXKEYS from '@src/ONYXKEYS'; import type SCREENS from '@src/SCREENS'; import type {PolicyFeatureName} from '@src/types/onyx/Policy'; import {AccountingContextProvider, useAccountingContext} from './AccountingContext'; @@ -47,6 +51,22 @@ function ClaimOfferPage({route, policy}: ClaimOfferPageProps) { const {startIntegrationFlow} = useAccountingContext(); const expensifyIcons = useMemoizedLazyExpensifyIcons(['TreasureChestGreenWithSparkle'] as const); const integrations = policy?.receiptPartners; + const {isUberConnected} = useGetReceiptPartnersIntegrationData(policyID); + const [connectionSyncProgress] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_CONNECTION_SYNC_PROGRESS}${policyID}`, {canBeMissing: true}); + + const connectionNames = CONST.POLICY.CONNECTIONS.NAME; + const accountingIntegrations = Object.values(connectionNames); + const connectedIntegration = getConnectedIntegration(policy, accountingIntegrations) ?? connectionSyncProgress?.connectionName; + + const isConnectedToIntegration = useMemo(() => { + if (integration === CONST.POLICY.CONNECTIONS.NAME.XERO) { + return connectedIntegration === CONST.POLICY.CONNECTIONS.NAME.XERO; + } + if (integration === CONST.POLICY.RECEIPT_PARTNERS.NAME.UBER) { + return isUberConnected; + } + return false; + }, [connectedIntegration, integration, isUberConnected]); const integrationConfig: Record = { xero: { @@ -74,6 +94,13 @@ function ClaimOfferPage({route, policy}: ClaimOfferPageProps) { }, }; + useEffect(() => { + if (!isConnectedToIntegration) { + return; + } + Navigation.dismissModal(); + }, [isConnectedToIntegration]); + const config = integrationConfig[integration as IntegrationType]; const handleClaimOffer = () => { @@ -112,7 +139,7 @@ function ClaimOfferPage({route, policy}: ClaimOfferPageProps) { policyID={policyID} accessVariants={[CONST.POLICY.ACCESS_VARIANTS.ADMIN]} featureName={config.featureName} - shouldBeBlocked={false} + shouldBeBlocked={!config} > Date: Wed, 14 Jan 2026 01:27:05 +0700 Subject: [PATCH 3/3] revert test change --- src/libs/Environment/Environment.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/Environment/Environment.ts b/src/libs/Environment/Environment.ts index b570fecd78162..23c7b360dc630 100644 --- a/src/libs/Environment/Environment.ts +++ b/src/libs/Environment/Environment.ts @@ -12,7 +12,7 @@ const ENVIRONMENT_URLS = { }; const OLDDOT_ENVIRONMENT_URLS = { - [CONST.ENVIRONMENT.DEV]: CONST.EXPENSIFY_URL, + [CONST.ENVIRONMENT.DEV]: CONST.INTERNAL_DEV_EXPENSIFY_URL, [CONST.ENVIRONMENT.STAGING]: CONST.STAGING_EXPENSIFY_URL, [CONST.ENVIRONMENT.PRODUCTION]: CONST.EXPENSIFY_URL, [CONST.ENVIRONMENT.ADHOC]: CONST.STAGING_EXPENSIFY_URL,