From 5663cb5e840d5df3592f888f52efb9911b01eb48 Mon Sep 17 00:00:00 2001 From: Yuwen Memon Date: Mon, 1 Jul 2024 13:02:46 -0700 Subject: [PATCH 1/2] Hide Sage Intacct integration behind Sage Intactt Beta --- src/CONST.ts | 1 + src/libs/Permissions.ts | 5 +++++ src/pages/workspace/accounting/PolicyAccountingPage.tsx | 8 ++++++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/CONST.ts b/src/CONST.ts index d74474978c2b..40d0b957884c 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -365,6 +365,7 @@ const CONST = { REPORT_FIELDS_FEATURE: 'reportFieldsFeature', WORKSPACE_FEEDS: 'workspaceFeeds', NETSUITE_USA_TAX: 'netsuiteUsaTax', + INTACCT_ON_NEW_EXPENSIFY: 'intacctOnNewExpensify', }, BUTTON_STATES: { DEFAULT: 'default', diff --git a/src/libs/Permissions.ts b/src/libs/Permissions.ts index fb4c99b3d465..faea5965fee4 100644 --- a/src/libs/Permissions.ts +++ b/src/libs/Permissions.ts @@ -44,6 +44,10 @@ function canUseNetSuiteIntegration(betas: OnyxEntry): boolean { return !!betas?.includes(CONST.BETAS.NETSUITE_ON_NEW_EXPENSIFY) || canUseAllBetas(betas); } +function canUseSageIntacctIntegration(betas: OnyxEntry): boolean { + return !!betas?.includes(CONST.BETAS.INTACCT_ON_NEW_EXPENSIFY) || canUseAllBetas(betas); +} + function canUseReportFieldsFeature(betas: OnyxEntry): boolean { return !!betas?.includes(CONST.BETAS.REPORT_FIELDS_FEATURE) || canUseAllBetas(betas); } @@ -74,6 +78,7 @@ export default { canUseWorkflowsDelayedSubmission, canUseSpotnanaTravel, canUseNetSuiteIntegration, + canUseSageIntacctIntegration, canUseReportFieldsFeature, canUseWorkspaceFeeds, canUseNetSuiteUSATax, diff --git a/src/pages/workspace/accounting/PolicyAccountingPage.tsx b/src/pages/workspace/accounting/PolicyAccountingPage.tsx index 4ccc67c2aba4..856a99aee4b5 100644 --- a/src/pages/workspace/accounting/PolicyAccountingPage.tsx +++ b/src/pages/workspace/accounting/PolicyAccountingPage.tsx @@ -142,7 +142,7 @@ function PolicyAccountingPage({policy, connectionSyncProgress}: PolicyAccounting const styles = useThemeStyles(); const {translate, datetimeToRelative: getDatetimeToRelative} = useLocalize(); const {isOffline} = useNetwork(); - const {canUseNetSuiteIntegration} = usePermissions(); + const {canUseNetSuiteIntegration, canUseSageIntacctIntegration} = usePermissions(); const {isSmallScreenWidth, windowWidth} = useWindowDimensions(); const [threeDotsMenuPosition, setThreeDotsMenuPosition] = useState({horizontal: 0, vertical: 0}); const [isDisconnectModalOpen, setIsDisconnectModalOpen] = useState(false); @@ -157,8 +157,12 @@ function PolicyAccountingPage({policy, connectionSyncProgress}: PolicyAccounting differenceInMinutes(new Date(), lastSyncProgressDate) < CONST.POLICY.CONNECTIONS.SYNC_STAGE_TIMEOUT_MINUTES; const accountingIntegrations = Object.values(CONST.POLICY.CONNECTIONS.NAME).filter( - (name) => !((name === CONST.POLICY.CONNECTIONS.NAME.NETSUITE || name === CONST.POLICY.CONNECTIONS.NAME.SAGE_INTACCT) && !canUseNetSuiteIntegration), + (name) => !( + (name === CONST.POLICY.CONNECTIONS.NAME.NETSUITE && !canUseNetSuiteIntegration) || + (name === CONST.POLICY.CONNECTIONS.NAME.SAGE_INTACCT && !canUseSageIntacctIntegration) + ), ); + const connectedIntegration = accountingIntegrations.find((integration) => !!policy?.connections?.[integration]) ?? connectionSyncProgress?.connectionName; const policyID = policy?.id ?? '-1'; const successfulDate = getIntegrationLastSuccessfulDate(connectedIntegration ? policy?.connections?.[connectedIntegration] : undefined); From 3b456600c0e70e5cd2318febbde97daff7e56720 Mon Sep 17 00:00:00 2001 From: Yuwen Memon Date: Mon, 1 Jul 2024 13:10:05 -0700 Subject: [PATCH 2/2] 'Prettier' --- src/pages/workspace/accounting/PolicyAccountingPage.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/pages/workspace/accounting/PolicyAccountingPage.tsx b/src/pages/workspace/accounting/PolicyAccountingPage.tsx index 856a99aee4b5..381cb6762e5a 100644 --- a/src/pages/workspace/accounting/PolicyAccountingPage.tsx +++ b/src/pages/workspace/accounting/PolicyAccountingPage.tsx @@ -157,10 +157,8 @@ function PolicyAccountingPage({policy, connectionSyncProgress}: PolicyAccounting differenceInMinutes(new Date(), lastSyncProgressDate) < CONST.POLICY.CONNECTIONS.SYNC_STAGE_TIMEOUT_MINUTES; const accountingIntegrations = Object.values(CONST.POLICY.CONNECTIONS.NAME).filter( - (name) => !( - (name === CONST.POLICY.CONNECTIONS.NAME.NETSUITE && !canUseNetSuiteIntegration) || - (name === CONST.POLICY.CONNECTIONS.NAME.SAGE_INTACCT && !canUseSageIntacctIntegration) - ), + (name) => + !((name === CONST.POLICY.CONNECTIONS.NAME.NETSUITE && !canUseNetSuiteIntegration) || (name === CONST.POLICY.CONNECTIONS.NAME.SAGE_INTACCT && !canUseSageIntacctIntegration)), ); const connectedIntegration = accountingIntegrations.find((integration) => !!policy?.connections?.[integration]) ?? connectionSyncProgress?.connectionName;