diff --git a/src/CONST.ts b/src/CONST.ts index 9d3042b64f80..642398e0d1f1 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -1249,7 +1249,7 @@ const CONST = { ENABLE_NEW_CATEGORIES: 'enableNewCategories', SYNC_CUSTOMERS: 'syncCustomers', SYNC_LOCATIONS: 'syncLocations', - SYNC_TAXES: 'syncTaxes', + SYNC_TAX: 'syncTax', PREFERRED_EXPORTER: 'exporter', EXPORT_DATE: 'exportDate', OUT_OF_POCKET_EXPENSES: 'outOfPocketExpenses', @@ -1260,7 +1260,7 @@ const CONST = { EXPORT_COMPANY_CARD_ACCOUNT: 'exportCompanyCardAccount', EXPORT_COMPANY_CARD: 'exportCompanyCard', AUTO_SYNC: 'autoSync', - SYNCE_PEOPLE: 'syncPeople', + SYNC_PEOPLE: 'syncPeople', AUTO_CREATE_VENDOR: 'autoCreateVendor', REIMBURSEMENT_ACCOUNT_ID: 'reimbursementAccountID', COLLECTION_ACCOUNT_ID: 'collectionAccountID', diff --git a/src/libs/actions/connections/index.ts b/src/libs/actions/connections/index.ts index 6d65c917a34c..774007db594d 100644 --- a/src/libs/actions/connections/index.ts +++ b/src/libs/actions/connections/index.ts @@ -118,7 +118,7 @@ function updatePolicyConnectionConfig Connections.updatePolicyConnectionConfig(policyID, CONST.POLICY.CONNECTIONS.NAME.QBO, CONST.QUICK_BOOKS_CONFIG.SYNCE_PEOPLE, !syncPeople), + onToggle: () => Connections.updatePolicyConnectionConfig(policyID, CONST.POLICY.CONNECTIONS.NAME.QBO, CONST.QUICK_BOOKS_CONFIG.SYNC_PEOPLE, !syncPeople), pendingAction: pendingFields?.syncPeople, - errors: ErrorUtils.getLatestErrorField(qboConfig ?? {}, CONST.QUICK_BOOKS_CONFIG.SYNCE_PEOPLE), - onCloseError: () => Policy.clearQBOErrorField(policyID, CONST.QUICK_BOOKS_CONFIG.SYNCE_PEOPLE), + errors: ErrorUtils.getLatestErrorField(qboConfig ?? {}, CONST.QUICK_BOOKS_CONFIG.SYNC_PEOPLE), + onCloseError: () => Policy.clearQBOErrorField(policyID, CONST.QUICK_BOOKS_CONFIG.SYNC_PEOPLE), wrapperStyle: styles.mv3, }, { diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx index 2c8f210b330a..5ed2cf9d8978 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx @@ -18,9 +18,9 @@ function QuickbooksOutOfPocketExpenseConfigurationPage({policy}: WithPolicyConne const {translate} = useLocalize(); const styles = useThemeStyles(); const policyID = policy?.id ?? ''; - const {syncLocations, exportAccount, exportEntity, errorFields, syncTaxes, pendingFields} = policy?.connections?.quickbooksOnline?.config ?? {}; + const {syncLocations, exportAccount, exportEntity, errorFields, syncTax, pendingFields} = policy?.connections?.quickbooksOnline?.config ?? {}; const isLocationEnabled = Boolean(syncLocations && syncLocations !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE); - const isTaxesEnabled = Boolean(syncTaxes && syncTaxes !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE); + const isTaxesEnabled = Boolean(syncTax); const shouldShowTaxError = isTaxesEnabled && exportEntity === CONST.QUICKBOOKS_EXPORT_ENTITY.JOURNAL_ENTRY; const shouldShowLocationError = isLocationEnabled && exportEntity !== CONST.QUICKBOOKS_EXPORT_ENTITY.JOURNAL_ENTRY; const hasErrors = Boolean(errorFields?.exportEntity) || shouldShowTaxError || shouldShowLocationError; diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx index 07bac6d07991..3467943d3b07 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx @@ -27,9 +27,9 @@ type CardsSection = SectionListData>; function QuickbooksOutOfPocketExpenseEntitySelectPage({policy}: WithPolicyConnectionsProps) { const {translate} = useLocalize(); const styles = useThemeStyles(); - const {exportEntity, syncTaxes, syncLocations} = policy?.connections?.quickbooksOnline?.config ?? {}; + const {exportEntity, syncTax, syncLocations} = policy?.connections?.quickbooksOnline?.config ?? {}; const isLocationsEnabled = Boolean(syncLocations && syncLocations !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE); - const isTaxesEnabled = Boolean(syncTaxes && syncTaxes !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE); + const isTaxesEnabled = Boolean(syncTax); const isTaxError = isTaxesEnabled && exportEntity === CONST.QUICKBOOKS_EXPORT_ENTITY.JOURNAL_ENTRY; const isLocationError = isLocationsEnabled && exportEntity !== CONST.QUICKBOOKS_EXPORT_ENTITY.JOURNAL_ENTRY; const policyID = policy?.id ?? ''; diff --git a/src/pages/workspace/accounting/qbo/import/QuickbooksImportPage.tsx b/src/pages/workspace/accounting/qbo/import/QuickbooksImportPage.tsx index e3e3eaf84591..2376614fcee3 100644 --- a/src/pages/workspace/accounting/qbo/import/QuickbooksImportPage.tsx +++ b/src/pages/workspace/accounting/qbo/import/QuickbooksImportPage.tsx @@ -26,7 +26,7 @@ function QuickbooksImportPage({policy}: WithPolicyProps) { [CONST.INTEGRATION_ENTITY_MAP_TYPES.REPORT_FIELD]: translate('workspace.qbo.importedAsReportFields'), }; const policyID = policy?.id ?? ''; - const {syncClasses, syncCustomers, syncLocations, syncTaxes, enableNewCategories, pendingFields} = policy?.connections?.quickbooksOnline?.config ?? {}; + const {syncClasses, syncCustomers, syncLocations, syncTax, enableNewCategories, pendingFields} = policy?.connections?.quickbooksOnline?.config ?? {}; const sections = [ { @@ -63,9 +63,9 @@ function QuickbooksImportPage({policy}: WithPolicyProps) { sections.push({ description: translate('workspace.accounting.taxes'), action: () => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_TAXES.getRoute(policyID)), - hasError: Boolean(policy?.errors?.syncTaxes), - title: syncTaxes, - pendingAction: pendingFields?.syncTaxes, + hasError: Boolean(policy?.errors?.syncTax), + title: syncTax ? CONST.INTEGRATION_ENTITY_MAP_TYPES.IMPORTED : CONST.INTEGRATION_ENTITY_MAP_TYPES.NOT_IMPORTED, + pendingAction: pendingFields?.syncTax, }); } diff --git a/src/pages/workspace/accounting/qbo/import/QuickbooksTaxesPage.tsx b/src/pages/workspace/accounting/qbo/import/QuickbooksTaxesPage.tsx index e8a32a62d8b5..9cd6e9e1653f 100644 --- a/src/pages/workspace/accounting/qbo/import/QuickbooksTaxesPage.tsx +++ b/src/pages/workspace/accounting/qbo/import/QuickbooksTaxesPage.tsx @@ -19,8 +19,7 @@ function QuickbooksTaxesPage({policy}: WithPolicyProps) { const {translate} = useLocalize(); const styles = useThemeStyles(); const policyID = policy?.id ?? ''; - const {syncTaxes, pendingFields} = policy?.connections?.quickbooksOnline?.config ?? {}; - const isSwitchOn = Boolean(syncTaxes && syncTaxes !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE); + const {syncTax, pendingFields} = policy?.connections?.quickbooksOnline?.config ?? {}; return ( {translate('workspace.accounting.import')} - + - Connections.updatePolicyConnectionConfig( - policyID, - CONST.POLICY.CONNECTIONS.NAME.QBO, - CONST.QUICK_BOOKS_CONFIG.SYNC_TAXES, - isSwitchOn ? CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE : CONST.INTEGRATION_ENTITY_MAP_TYPES.TAG, - ) - } + isOn={!!syncTax} + onToggle={() => Connections.updatePolicyConnectionConfig(policyID, CONST.POLICY.CONNECTIONS.NAME.QBO, CONST.QUICK_BOOKS_CONFIG.SYNC_TAX, !syncTax)} /> diff --git a/src/types/onyx/Policy.ts b/src/types/onyx/Policy.ts index 60492583dda1..8073ac17464d 100644 --- a/src/types/onyx/Policy.ts +++ b/src/types/onyx/Policy.ts @@ -178,7 +178,6 @@ type QBOConnectionConfig = OnyxCommon.OnyxValueWithOfflineFeedback<{ syncCustomers: IntegrationEntityMap; syncLocations: IntegrationEntityMap; syncAccounts: IntegrationEntityMap; - syncTaxes: IntegrationEntityMap; lastConfigurationTime: number; exportCompanyCardAccount?: string; syncTax: boolean;