From 9a98d28eb9871ae16564f710b4d139940a6d71fc Mon Sep 17 00:00:00 2001 From: Yauheni Date: Thu, 3 Oct 2024 17:30:38 +0200 Subject: [PATCH 1/5] Create QuickbooksDesktopExportPage and update routes --- src/ROUTES.ts | 4 + src/SCREENS.ts | 1 + src/languages/en.ts | 3 + src/languages/es.ts | 3 + .../ModalStackNavigators/index.tsx | 2 + .../FULL_SCREEN_TO_RHP_MAPPING.ts | 1 + src/libs/Navigation/linkingConfig/config.ts | 1 + src/libs/Navigation/types.ts | 3 + .../export/QuickbooksDesktopExportPage.tsx | 117 ++++++++++++++++++ 9 files changed, 135 insertions(+) create mode 100644 src/pages/workspace/accounting/qbo-desktop/export/QuickbooksDesktopExportPage.tsx diff --git a/src/ROUTES.ts b/src/ROUTES.ts index dfcb42d3c4fe..5fc6d93a6e22 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -649,6 +649,10 @@ const ROUTES = { route: 'settings/workspaces/:policyID/accounting/quickbooks-online/export/date-select', getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-online/export/date-select` as const, }, + POLICY_ACCOUNTING_QUICKBOOKS_DESKTOP_EXPORT: { + route: 'settings/workspaces/:policyID/accounting/quickbooks-desktop/export', + getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/quickbooks-desktop/export` as const, + }, WORKSPACE_PROFILE_NAME: { route: 'settings/workspaces/:policyID/profile/name', getRoute: (policyID: string) => `settings/workspaces/${policyID}/profile/name` as const, diff --git a/src/SCREENS.ts b/src/SCREENS.ts index 395f1c4d5fb1..3fc72523dc6d 100644 --- a/src/SCREENS.ts +++ b/src/SCREENS.ts @@ -302,6 +302,7 @@ const SCREENS = { QUICKBOOKS_ONLINE_ADVANCED: 'Policy_Accounting_Quickbooks_Online_Advanced', QUICKBOOKS_ONLINE_ACCOUNT_SELECTOR: 'Policy_Accounting_Quickbooks_Online_Account_Selector', QUICKBOOKS_ONLINE_INVOICE_ACCOUNT_SELECTOR: 'Policy_Accounting_Quickbooks_Online_Invoice_Account_Selector', + QUICKBOOKS_DESKTOP_EXPORT: 'Workspace_Accounting_Quickbooks_Desktop_Export', XERO_IMPORT: 'Policy_Accounting_Xero_Import', XERO_ORGANIZATION: 'Policy_Accounting_Xero_Customers', XERO_CHART_OF_ACCOUNTS: 'Policy_Accounting_Xero_Import_Chart_Of_Accounts', diff --git a/src/languages/en.ts b/src/languages/en.ts index ae5a9314d72d..21ff76e5c6e7 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -2342,6 +2342,9 @@ const translations = { } }, }, + qbd: { + exportDescription: 'Configure how Expensify data exports to QuickBooks Desktop.', + }, qbo: { importDescription: 'Choose which coding configurations to import from QuickBooks Online to Expensify.', classes: 'Classes', diff --git a/src/languages/es.ts b/src/languages/es.ts index 71cb5037029d..13840d32d3a4 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -2363,6 +2363,9 @@ const translations = { } }, }, + qbd: { + exportDescription: 'Configura cómo se exportan los datos de Expensify a QuickBooks Desktop.', + }, qbo: { importDescription: 'Elige que configuraciónes de codificación son importadas desde QuickBooks Online a Expensify.', classes: 'Clases', diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx index e1c645118003..3b88a97820ff 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx @@ -299,6 +299,8 @@ const SettingsModalStackNavigator = createModalStackNavigator('../../../../pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountPage').default, [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER]: () => require('../../../../pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage').default, + [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_DESKTOP_EXPORT]: () => + require('../../../../pages/workspace/accounting/qbo-desktop/export/QuickbooksDesktopExportPage').default, [SCREENS.REIMBURSEMENT_ACCOUNT]: () => require('../../../../pages/ReimbursementAccount/ReimbursementAccountPage').default, [SCREENS.GET_ASSISTANCE]: () => require('../../../../pages/GetAssistancePage').default, [SCREENS.SETTINGS.TWO_FACTOR_AUTH]: () => require('../../../../pages/settings/Security/TwoFactorAuth/TwoFactorAuthPage').default, diff --git a/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts b/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts index 6d8871e5a38a..5a6e949ea6ec 100755 --- a/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts +++ b/src/libs/Navigation/linkingConfig/FULL_SCREEN_TO_RHP_MAPPING.ts @@ -45,6 +45,7 @@ const FULL_SCREEN_TO_RHP_MAPPING: Partial> = { SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_ADVANCED, SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_ACCOUNT_SELECTOR, SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_INVOICE_ACCOUNT_SELECTOR, + SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_DESKTOP_EXPORT, SCREENS.WORKSPACE.ACCOUNTING.XERO_IMPORT, SCREENS.WORKSPACE.ACCOUNTING.XERO_CHART_OF_ACCOUNTS, SCREENS.WORKSPACE.ACCOUNTING.XERO_ORGANIZATION, diff --git a/src/libs/Navigation/linkingConfig/config.ts b/src/libs/Navigation/linkingConfig/config.ts index 319ec60d143e..f0269ad66783 100644 --- a/src/libs/Navigation/linkingConfig/config.ts +++ b/src/libs/Navigation/linkingConfig/config.ts @@ -373,6 +373,7 @@ const config: LinkingOptions['config'] = { [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_INVOICE_ACCOUNT_SELECTOR]: { path: ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_INVOICE_ACCOUNT_SELECTOR.route, }, + [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_DESKTOP_EXPORT]: {path: ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_DESKTOP_EXPORT.route}, [SCREENS.WORKSPACE.ACCOUNTING.XERO_IMPORT]: {path: ROUTES.POLICY_ACCOUNTING_XERO_IMPORT.route}, [SCREENS.WORKSPACE.ACCOUNTING.XERO_CHART_OF_ACCOUNTS]: {path: ROUTES.POLICY_ACCOUNTING_XERO_CHART_OF_ACCOUNTS.route}, [SCREENS.WORKSPACE.ACCOUNTING.XERO_ORGANIZATION]: {path: ROUTES.POLICY_ACCOUNTING_XERO_ORGANIZATION.route}, diff --git a/src/libs/Navigation/types.ts b/src/libs/Navigation/types.ts index 39053de521db..f4a9c34752c7 100644 --- a/src/libs/Navigation/types.ts +++ b/src/libs/Navigation/types.ts @@ -433,6 +433,9 @@ type SettingsNavigatorParamList = { [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER]: { policyID: string; }; + [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_DESKTOP_EXPORT]: { + policyID: string; + }; [SCREENS.WORKSPACE.ACCOUNTING.XERO_IMPORT]: { policyID: string; }; diff --git a/src/pages/workspace/accounting/qbo-desktop/export/QuickbooksDesktopExportPage.tsx b/src/pages/workspace/accounting/qbo-desktop/export/QuickbooksDesktopExportPage.tsx new file mode 100644 index 000000000000..be2cfe2c8c26 --- /dev/null +++ b/src/pages/workspace/accounting/qbo-desktop/export/QuickbooksDesktopExportPage.tsx @@ -0,0 +1,117 @@ +import React, {useMemo} from 'react'; +import ConnectionLayout from '@components/ConnectionLayout'; +import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription'; +import OfflineWithFeedback from '@components/OfflineWithFeedback'; +import Text from '@components/Text'; +import TextLink from '@components/TextLink'; +import useLocalize from '@hooks/useLocalize'; +import useThemeStyles from '@hooks/useThemeStyles'; +import * as PolicyUtils from '@libs/PolicyUtils'; +import Navigation from '@navigation/Navigation'; +import type {WithPolicyConnectionsProps} from '@pages/workspace/withPolicyConnections'; +import withPolicyConnections from '@pages/workspace/withPolicyConnections'; +import * as Link from '@userActions/Link'; +import CONST from '@src/CONST'; +import ROUTES from '@src/ROUTES'; + +function QuickbooksDesktopExportPage({policy}: WithPolicyConnectionsProps) { + const {translate} = useLocalize(); + const styles = useThemeStyles(); + const policyID = policy?.id ?? '-1'; + const policyOwner = policy?.owner ?? ''; + const qboConfig = policy?.connections?.quickbooksOnline?.config; // TODO: should be updated to use the new connections object + const errorFields = qboConfig?.errorFields; + + const shouldShowVendorMenuItems = useMemo( + () => qboConfig?.nonReimbursableExpensesExportDestination === CONST.QUICKBOOKS_NON_REIMBURSABLE_EXPORT_ACCOUNT_TYPE.VENDOR_BILL, + [qboConfig?.nonReimbursableExpensesExportDestination], + ); + const menuItems = [ + { + description: translate('workspace.accounting.preferredExporter'), + onPress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_PREFERRED_EXPORTER.getRoute(policyID)), // TODO: should be updated to use new routes + title: qboConfig?.export?.exporter ?? policyOwner, + subscribedSettings: [CONST.QUICKBOOKS_CONFIG.EXPORT], + }, + { + description: translate('workspace.qbo.date'), + onPress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT.getRoute(policyID)), // TODO: should be updated to use new routes + title: qboConfig?.exportDate ? translate(`workspace.qbo.exportDate.values.${qboConfig?.exportDate}.label`) : undefined, + subscribedSettings: [CONST.QUICKBOOKS_CONFIG.EXPORT_DATE], + }, + { + description: translate('workspace.accounting.exportOutOfPocket'), + onPress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES.getRoute(policyID)), + title: qboConfig?.reimbursableExpensesExportDestination ? translate(`workspace.qbo.accounts.${qboConfig?.reimbursableExpensesExportDestination}`) : undefined, // TODO: should be updated to use new routes + subscribedSettings: [CONST.QUICKBOOKS_CONFIG.REIMBURSABLE_EXPENSES_EXPORT_DESTINATION, CONST.QUICKBOOKS_CONFIG.REIMBURSABLE_EXPENSES_ACCOUNT], + }, + { + description: translate('workspace.qbo.exportInvoices'), + onPress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_INVOICE_ACCOUNT_SELECT.getRoute(policyID)), // TODO: should be updated to use new routes + title: qboConfig?.receivableAccount?.name, + subscribedSettings: [CONST.QUICKBOOKS_CONFIG.RECEIVABLE_ACCOUNT], + }, + { + description: translate('workspace.accounting.exportCompanyCard'), + onPress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT.getRoute(policyID)), // TODO: should be updated to use new routes + brickRoadIndicator: qboConfig?.errorFields?.exportCompanyCard ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, + title: qboConfig?.nonReimbursableExpensesExportDestination ? translate(`workspace.qbo.accounts.${qboConfig?.nonReimbursableExpensesExportDestination}`) : undefined, + subscribedSettings: [ + CONST.QUICKBOOKS_CONFIG.NON_REIMBURSABLE_EXPENSES_EXPORT_DESTINATION, + CONST.QUICKBOOKS_CONFIG.NON_REIMBURSABLE_EXPENSE_ACCOUNT, + ...(shouldShowVendorMenuItems ? [CONST.QUICKBOOKS_CONFIG.AUTO_CREATE_VENDOR] : []), + ...(shouldShowVendorMenuItems && qboConfig?.autoCreateVendor ? [CONST.QUICKBOOKS_CONFIG.NON_REIMBURSABLE_BILL_DEFAULT_VENDOR] : []), + ], + }, + { + description: translate('workspace.qbo.exportExpensifyCard'), + title: translate('workspace.qbo.accounts.credit_card'), + shouldShowRightIcon: false, + interactive: false, + }, + ]; + + return ( + Navigation.goBack(ROUTES.POLICY_ACCOUNTING.getRoute(policyID))} + > + {menuItems.map((menuItem) => ( + + + + ))} + + {translate('workspace.qbo.deepDiveExpensifyCard')} + Link.openExternalLink(CONST.DEEP_DIVE_EXPENSIFY_CARD)} + style={[styles.mutedNormalTextLabel, styles.link]} + > + {translate('workspace.qbo.deepDiveExpensifyCardIntegration')} + + + + ); +} + +QuickbooksDesktopExportPage.displayName = 'QuickbooksDesktopExportPage'; + +export default withPolicyConnections(QuickbooksDesktopExportPage); From 9581d1475834f69bd35d3df151ac7ca6a205959e Mon Sep 17 00:00:00 2001 From: Yauheni Date: Thu, 3 Oct 2024 17:32:16 +0200 Subject: [PATCH 2/5] Update folder name --- .../Navigation/AppNavigator/ModalStackNavigators/index.tsx | 3 +-- .../export/QuickbooksDesktopExportPage.tsx | 0 2 files changed, 1 insertion(+), 2 deletions(-) rename src/pages/workspace/accounting/{qbo-desktop => qbd}/export/QuickbooksDesktopExportPage.tsx (100%) diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx index 3b88a97820ff..76906c69e00a 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx @@ -299,8 +299,7 @@ const SettingsModalStackNavigator = createModalStackNavigator('../../../../pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountPage').default, [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER]: () => require('../../../../pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage').default, - [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_DESKTOP_EXPORT]: () => - require('../../../../pages/workspace/accounting/qbo-desktop/export/QuickbooksDesktopExportPage').default, + [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_DESKTOP_EXPORT]: () => require('../../../../pages/workspace/accounting/qbd/export/QuickbooksDesktopExportPage').default, [SCREENS.REIMBURSEMENT_ACCOUNT]: () => require('../../../../pages/ReimbursementAccount/ReimbursementAccountPage').default, [SCREENS.GET_ASSISTANCE]: () => require('../../../../pages/GetAssistancePage').default, [SCREENS.SETTINGS.TWO_FACTOR_AUTH]: () => require('../../../../pages/settings/Security/TwoFactorAuth/TwoFactorAuthPage').default, diff --git a/src/pages/workspace/accounting/qbo-desktop/export/QuickbooksDesktopExportPage.tsx b/src/pages/workspace/accounting/qbd/export/QuickbooksDesktopExportPage.tsx similarity index 100% rename from src/pages/workspace/accounting/qbo-desktop/export/QuickbooksDesktopExportPage.tsx rename to src/pages/workspace/accounting/qbd/export/QuickbooksDesktopExportPage.tsx From 6b01554468eeb8e8ab7eff2d680986f2b671b343 Mon Sep 17 00:00:00 2001 From: Yauheni Date: Thu, 3 Oct 2024 17:35:01 +0200 Subject: [PATCH 3/5] update deepDiveExpensifyCard message --- .../accounting/qbd/export/QuickbooksDesktopExportPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/workspace/accounting/qbd/export/QuickbooksDesktopExportPage.tsx b/src/pages/workspace/accounting/qbd/export/QuickbooksDesktopExportPage.tsx index be2cfe2c8c26..ecb067495cb0 100644 --- a/src/pages/workspace/accounting/qbd/export/QuickbooksDesktopExportPage.tsx +++ b/src/pages/workspace/accounting/qbd/export/QuickbooksDesktopExportPage.tsx @@ -105,7 +105,7 @@ function QuickbooksDesktopExportPage({policy}: WithPolicyConnectionsProps) { onPress={() => Link.openExternalLink(CONST.DEEP_DIVE_EXPENSIFY_CARD)} style={[styles.mutedNormalTextLabel, styles.link]} > - {translate('workspace.qbo.deepDiveExpensifyCardIntegration')} + {` ${translate('workspace.qbo.deepDiveExpensifyCardIntegration')}`} From 256a747852de4882a989ae012647ed9cfe0a0f62 Mon Sep 17 00:00:00 2001 From: Yauheni Date: Fri, 4 Oct 2024 18:35:31 +0200 Subject: [PATCH 4/5] add beta for qbd --- src/CONST.ts | 3 ++ src/libs/AccountingUtils.ts | 2 ++ src/libs/Permissions.ts | 5 ++++ .../export/QuickbooksDesktopExportPage.tsx | 30 +++++++++++-------- src/types/onyx/Policy.ts | 3 ++ 5 files changed, 30 insertions(+), 13 deletions(-) diff --git a/src/CONST.ts b/src/CONST.ts index 4f177d2294de..25ba86ee3e1a 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -480,6 +480,7 @@ const CONST = { NEW_DOT_COPILOT: 'newDotCopilot', WORKSPACE_RULES: 'workspaceRules', COMBINED_TRACK_SUBMIT: 'combinedTrackSubmit', + NEW_DOT_QBD: 'quickbooksDesktopOnNewDot', }, BUTTON_STATES: { DEFAULT: 'default', @@ -2300,12 +2301,14 @@ const CONST = { XERO: 'xero', NETSUITE: 'netsuite', SAGE_INTACCT: 'intacct', + QBD: 'quickbooksDesktop', }, ROUTE: { QBO: 'quickbooks-online', XERO: 'xero', NETSUITE: 'netsuite', SAGE_INTACCT: 'sage-intacct', + QBD: 'quickbooks-desktop', }, NAME_USER_FRIENDLY: { netsuite: 'NetSuite', diff --git a/src/libs/AccountingUtils.ts b/src/libs/AccountingUtils.ts index fe472752978a..7516048241d6 100644 --- a/src/libs/AccountingUtils.ts +++ b/src/libs/AccountingUtils.ts @@ -7,6 +7,7 @@ const ROUTE_NAME_MAPPING = { [CONST.POLICY.CONNECTIONS.ROUTE.XERO]: CONST.POLICY.CONNECTIONS.NAME.XERO, [CONST.POLICY.CONNECTIONS.ROUTE.SAGE_INTACCT]: CONST.POLICY.CONNECTIONS.NAME.SAGE_INTACCT, [CONST.POLICY.CONNECTIONS.ROUTE.NETSUITE]: CONST.POLICY.CONNECTIONS.NAME.NETSUITE, + [CONST.POLICY.CONNECTIONS.ROUTE.QBD]: CONST.POLICY.CONNECTIONS.NAME.QBD, }; const NAME_ROUTE_MAPPING = { @@ -14,6 +15,7 @@ const NAME_ROUTE_MAPPING = { [CONST.POLICY.CONNECTIONS.NAME.XERO]: CONST.POLICY.CONNECTIONS.ROUTE.XERO, [CONST.POLICY.CONNECTIONS.NAME.SAGE_INTACCT]: CONST.POLICY.CONNECTIONS.ROUTE.SAGE_INTACCT, [CONST.POLICY.CONNECTIONS.NAME.NETSUITE]: CONST.POLICY.CONNECTIONS.ROUTE.NETSUITE, + [CONST.POLICY.CONNECTIONS.NAME.QBD]: CONST.POLICY.CONNECTIONS.ROUTE.QBD, }; function getConnectionNameFromRouteParam(routeParam: ValueOf) { diff --git a/src/libs/Permissions.ts b/src/libs/Permissions.ts index 7f7e89ad3585..12f5d59a025d 100644 --- a/src/libs/Permissions.ts +++ b/src/libs/Permissions.ts @@ -50,6 +50,10 @@ function canUseCombinedTrackSubmit(betas: OnyxEntry): boolean { return !!betas?.includes(CONST.BETAS.COMBINED_TRACK_SUBMIT); } +function canUseNewDotQBD(betas: OnyxEntry): boolean { + return !!betas?.includes(CONST.BETAS.NEW_DOT_QBD) || canUseAllBetas(betas); +} + /** * New Search Router is under construction and for now should be displayed only in dev to allow developers to work on it. * We are not using BETA for this feature, as betas are heavier to cleanup, @@ -81,4 +85,5 @@ export default { canUseWorkspaceRules, canUseCombinedTrackSubmit, canUseNewSearchRouter, + canUseNewDotQBD, }; diff --git a/src/pages/workspace/accounting/qbd/export/QuickbooksDesktopExportPage.tsx b/src/pages/workspace/accounting/qbd/export/QuickbooksDesktopExportPage.tsx index ecb067495cb0..5a86dc9d5bce 100644 --- a/src/pages/workspace/accounting/qbd/export/QuickbooksDesktopExportPage.tsx +++ b/src/pages/workspace/accounting/qbd/export/QuickbooksDesktopExportPage.tsx @@ -5,6 +5,7 @@ import OfflineWithFeedback from '@components/OfflineWithFeedback'; import Text from '@components/Text'; import TextLink from '@components/TextLink'; import useLocalize from '@hooks/useLocalize'; +import usePermissions from '@hooks/usePermissions'; import useThemeStyles from '@hooks/useThemeStyles'; import * as PolicyUtils from '@libs/PolicyUtils'; import Navigation from '@navigation/Navigation'; @@ -19,48 +20,49 @@ function QuickbooksDesktopExportPage({policy}: WithPolicyConnectionsProps) { const styles = useThemeStyles(); const policyID = policy?.id ?? '-1'; const policyOwner = policy?.owner ?? ''; - const qboConfig = policy?.connections?.quickbooksOnline?.config; // TODO: should be updated to use the new connections object - const errorFields = qboConfig?.errorFields; + const qbdConfig = policy?.connections?.quickbooksOnline?.config; // TODO: should be updated to use the new connections object + const errorFields = qbdConfig?.errorFields; + const {canUseNewDotQBD} = usePermissions(); const shouldShowVendorMenuItems = useMemo( - () => qboConfig?.nonReimbursableExpensesExportDestination === CONST.QUICKBOOKS_NON_REIMBURSABLE_EXPORT_ACCOUNT_TYPE.VENDOR_BILL, - [qboConfig?.nonReimbursableExpensesExportDestination], + () => qbdConfig?.nonReimbursableExpensesExportDestination === CONST.QUICKBOOKS_NON_REIMBURSABLE_EXPORT_ACCOUNT_TYPE.VENDOR_BILL, + [qbdConfig?.nonReimbursableExpensesExportDestination], ); const menuItems = [ { description: translate('workspace.accounting.preferredExporter'), onPress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_PREFERRED_EXPORTER.getRoute(policyID)), // TODO: should be updated to use new routes - title: qboConfig?.export?.exporter ?? policyOwner, + title: qbdConfig?.export?.exporter ?? policyOwner, subscribedSettings: [CONST.QUICKBOOKS_CONFIG.EXPORT], }, { description: translate('workspace.qbo.date'), onPress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT.getRoute(policyID)), // TODO: should be updated to use new routes - title: qboConfig?.exportDate ? translate(`workspace.qbo.exportDate.values.${qboConfig?.exportDate}.label`) : undefined, + title: qbdConfig?.exportDate ? translate(`workspace.qbo.exportDate.values.${qbdConfig?.exportDate}.label`) : undefined, subscribedSettings: [CONST.QUICKBOOKS_CONFIG.EXPORT_DATE], }, { description: translate('workspace.accounting.exportOutOfPocket'), onPress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES.getRoute(policyID)), - title: qboConfig?.reimbursableExpensesExportDestination ? translate(`workspace.qbo.accounts.${qboConfig?.reimbursableExpensesExportDestination}`) : undefined, // TODO: should be updated to use new routes + title: qbdConfig?.reimbursableExpensesExportDestination ? translate(`workspace.qbo.accounts.${qbdConfig?.reimbursableExpensesExportDestination}`) : undefined, // TODO: should be updated to use new routes subscribedSettings: [CONST.QUICKBOOKS_CONFIG.REIMBURSABLE_EXPENSES_EXPORT_DESTINATION, CONST.QUICKBOOKS_CONFIG.REIMBURSABLE_EXPENSES_ACCOUNT], }, { description: translate('workspace.qbo.exportInvoices'), onPress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_INVOICE_ACCOUNT_SELECT.getRoute(policyID)), // TODO: should be updated to use new routes - title: qboConfig?.receivableAccount?.name, + title: qbdConfig?.receivableAccount?.name, subscribedSettings: [CONST.QUICKBOOKS_CONFIG.RECEIVABLE_ACCOUNT], }, { description: translate('workspace.accounting.exportCompanyCard'), onPress: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT.getRoute(policyID)), // TODO: should be updated to use new routes - brickRoadIndicator: qboConfig?.errorFields?.exportCompanyCard ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, - title: qboConfig?.nonReimbursableExpensesExportDestination ? translate(`workspace.qbo.accounts.${qboConfig?.nonReimbursableExpensesExportDestination}`) : undefined, + brickRoadIndicator: qbdConfig?.errorFields?.exportCompanyCard ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, + title: qbdConfig?.nonReimbursableExpensesExportDestination ? translate(`workspace.qbo.accounts.${qbdConfig?.nonReimbursableExpensesExportDestination}`) : undefined, subscribedSettings: [ CONST.QUICKBOOKS_CONFIG.NON_REIMBURSABLE_EXPENSES_EXPORT_DESTINATION, CONST.QUICKBOOKS_CONFIG.NON_REIMBURSABLE_EXPENSE_ACCOUNT, ...(shouldShowVendorMenuItems ? [CONST.QUICKBOOKS_CONFIG.AUTO_CREATE_VENDOR] : []), - ...(shouldShowVendorMenuItems && qboConfig?.autoCreateVendor ? [CONST.QUICKBOOKS_CONFIG.NON_REIMBURSABLE_BILL_DEFAULT_VENDOR] : []), + ...(shouldShowVendorMenuItems && qbdConfig?.autoCreateVendor ? [CONST.QUICKBOOKS_CONFIG.NON_REIMBURSABLE_BILL_DEFAULT_VENDOR] : []), ], }, { @@ -71,12 +73,14 @@ function QuickbooksDesktopExportPage({policy}: WithPolicyConnectionsProps) { }, ]; + const accessVariants = canUseNewDotQBD ? [] : [CONST.POLICY.ACCESS_VARIANTS.ADMIN]; + return ( ( ; + + /** QuickBooks integration connection */ + [CONST.POLICY.CONNECTIONS.NAME.QBD]: Connection; }; /** All integration connections, including unsupported ones */ From 082240d0d38705c195ac89ee114ee6561ccafd68 Mon Sep 17 00:00:00 2001 From: Yauheni Date: Mon, 7 Oct 2024 10:12:53 +0200 Subject: [PATCH 5/5] add shouldBeBlocked for QuickbooksDesktopExportPage --- .../accounting/qbd/export/QuickbooksDesktopExportPage.tsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/pages/workspace/accounting/qbd/export/QuickbooksDesktopExportPage.tsx b/src/pages/workspace/accounting/qbd/export/QuickbooksDesktopExportPage.tsx index 5a86dc9d5bce..9a3b415dc087 100644 --- a/src/pages/workspace/accounting/qbd/export/QuickbooksDesktopExportPage.tsx +++ b/src/pages/workspace/accounting/qbd/export/QuickbooksDesktopExportPage.tsx @@ -73,18 +73,17 @@ function QuickbooksDesktopExportPage({policy}: WithPolicyConnectionsProps) { }, ]; - const accessVariants = canUseNewDotQBD ? [] : [CONST.POLICY.ACCESS_VARIANTS.ADMIN]; - return ( Navigation.goBack(ROUTES.POLICY_ACCOUNTING.getRoute(policyID))} >