From faa4eb7a0ded8130ce3de4175d37fdaff6afe36e Mon Sep 17 00:00:00 2001 From: Hayata Suenaga Date: Sat, 4 May 2024 09:08:44 -0500 Subject: [PATCH 01/39] fix: lock the toggle for disabling location when the account selected is not JE --- .../accounting/qbo/import/QuickbooksLocationsPage.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pages/workspace/accounting/qbo/import/QuickbooksLocationsPage.tsx b/src/pages/workspace/accounting/qbo/import/QuickbooksLocationsPage.tsx index 307847809d62..bddefeb0beda 100644 --- a/src/pages/workspace/accounting/qbo/import/QuickbooksLocationsPage.tsx +++ b/src/pages/workspace/accounting/qbo/import/QuickbooksLocationsPage.tsx @@ -21,7 +21,8 @@ function QuickbooksLocationsPage({policy}: WithPolicyProps) { const styles = useThemeStyles(); const policyID = policy?.id ?? ''; const {syncLocations, pendingFields} = policy?.connections?.quickbooksOnline?.config ?? {}; - const isSwitchOn = Boolean(syncLocations && syncLocations !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE); + const shouldLocationImportBeOff = policy?.connections?.quickbooksOnline?.config.reimbursableExpensesExportDestination !== CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.JOURNAL_ENTRY; + const isSwitchOn = Boolean(syncLocations && syncLocations !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE) && !shouldLocationImportBeOff; const isReportFieldsSelected = syncLocations === CONST.INTEGRATION_ENTITY_MAP_TYPES.REPORT_FIELD; return ( @@ -46,7 +47,7 @@ function QuickbooksLocationsPage({policy}: WithPolicyProps) { Connections.updatePolicyConnectionConfig( policyID, From 43d57ac1940a798fa50125280dc900f7d06f2c95 Mon Sep 17 00:00:00 2001 From: Hayata Suenaga Date: Sun, 5 May 2024 08:05:20 -0500 Subject: [PATCH 02/39] fix the boolean condition --- .../workspace/accounting/qbo/import/QuickbooksLocationsPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/workspace/accounting/qbo/import/QuickbooksLocationsPage.tsx b/src/pages/workspace/accounting/qbo/import/QuickbooksLocationsPage.tsx index bddefeb0beda..87521e816685 100644 --- a/src/pages/workspace/accounting/qbo/import/QuickbooksLocationsPage.tsx +++ b/src/pages/workspace/accounting/qbo/import/QuickbooksLocationsPage.tsx @@ -47,7 +47,7 @@ function QuickbooksLocationsPage({policy}: WithPolicyProps) { Connections.updatePolicyConnectionConfig( policyID, From 102c2bf28f55f3ef5d8294d269672c504a1850fa Mon Sep 17 00:00:00 2001 From: Hayata Suenaga Date: Sun, 5 May 2024 09:50:52 -0500 Subject: [PATCH 03/39] chore: filter out account options depending on whether the location tracking is enabled or not --- ...ooksOutOfPocketExpenseEntitySelectPage.tsx | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx index 35e06f6734e2..49ca18b8637f 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx @@ -31,16 +31,10 @@ function QuickbooksOutOfPocketExpenseEntitySelectPage({policy}: WithPolicyConnec const isLocationsEnabled = Boolean(syncLocations && syncLocations !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE); const isTaxesEnabled = Boolean(syncTax); const policyID = policy?.id ?? ''; + const isLocationImportEnabled = !!policy?.connections?.quickbooksOnline?.config?.syncLocations; const data: CardListItem[] = useMemo( () => [ - { - value: CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.CHECK, - text: translate(`workspace.qbo.accounts.check`), - keyForList: CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.CHECK, - isSelected: reimbursableExpensesExportDestination === CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.CHECK, - isShown: !isLocationsEnabled, - }, { value: CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.JOURNAL_ENTRY, text: translate(`workspace.qbo.accounts.journal_entry`), @@ -48,6 +42,19 @@ function QuickbooksOutOfPocketExpenseEntitySelectPage({policy}: WithPolicyConnec isSelected: reimbursableExpensesExportDestination === CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.JOURNAL_ENTRY, isShown: !isTaxesEnabled || isLocationsEnabled, }, + ], + [reimbursableExpensesExportDestination, isTaxesEnabled, translate, isLocationsEnabled], + ); + + if (!isLocationImportEnabled) { + data.push( + { + value: CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.CHECK, + text: translate(`workspace.qbo.accounts.check`), + keyForList: CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.CHECK, + isSelected: reimbursableExpensesExportDestination === CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.CHECK, + isShown: !isLocationsEnabled, + }, { value: CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.VENDOR_BILL, text: translate(`workspace.qbo.accounts.bill`), @@ -55,9 +62,8 @@ function QuickbooksOutOfPocketExpenseEntitySelectPage({policy}: WithPolicyConnec isSelected: reimbursableExpensesExportDestination === CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.VENDOR_BILL, isShown: !isLocationsEnabled, }, - ], - [reimbursableExpensesExportDestination, isTaxesEnabled, translate, isLocationsEnabled], - ); + ); + } const sections: CardsSection[] = useMemo(() => [{data: data.filter((item) => item.isShown)}], [data]); From 056c3627fc87cdc9b3574efb0afd0c20906b24d9 Mon Sep 17 00:00:00 2001 From: Hayata Suenaga Date: Sun, 5 May 2024 22:27:07 -0500 Subject: [PATCH 04/39] chore: lock the toggle button when the location import should be off --- .../workspace/accounting/qbo/import/QuickbooksLocationsPage.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/workspace/accounting/qbo/import/QuickbooksLocationsPage.tsx b/src/pages/workspace/accounting/qbo/import/QuickbooksLocationsPage.tsx index 87521e816685..254ed65ff2d9 100644 --- a/src/pages/workspace/accounting/qbo/import/QuickbooksLocationsPage.tsx +++ b/src/pages/workspace/accounting/qbo/import/QuickbooksLocationsPage.tsx @@ -56,6 +56,7 @@ function QuickbooksLocationsPage({policy}: WithPolicyProps) { isSwitchOn ? CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE : CONST.INTEGRATION_ENTITY_MAP_TYPES.TAG, ) } + disabled={shouldLocationImportBeOff} /> From e74a7ae25eb7fa2859eaee2347ae56a089d5f062 Mon Sep 17 00:00:00 2001 From: Hayata Suenaga Date: Sun, 5 May 2024 22:54:05 -0500 Subject: [PATCH 05/39] chore: add a todo comment not to forget to change the description text --- .../accounting/qbo/import/QuickbooksLocationsPage.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pages/workspace/accounting/qbo/import/QuickbooksLocationsPage.tsx b/src/pages/workspace/accounting/qbo/import/QuickbooksLocationsPage.tsx index 254ed65ff2d9..b48b91e4848f 100644 --- a/src/pages/workspace/accounting/qbo/import/QuickbooksLocationsPage.tsx +++ b/src/pages/workspace/accounting/qbo/import/QuickbooksLocationsPage.tsx @@ -72,6 +72,9 @@ function QuickbooksLocationsPage({policy}: WithPolicyProps) { )} + {/** Make sure to change the description text to explain why the toggle button is locked and how the user can unlock the toggle button + * @see https://expensify.slack.com/archives/C036QM0SLJK/p1714967365830889?thread_ts=1714400674.229349&cid=C036QM0SLJK + */} {translate('workspace.qbo.locationsAdditionalDescription')} From add3daf39965dab024d26a41bad1ee3fbe078d18 Mon Sep 17 00:00:00 2001 From: Hayata Suenaga Date: Fri, 10 May 2024 17:37:42 -0700 Subject: [PATCH 06/39] fix: wrong conditional statement --- .../export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx index 49ca18b8637f..ae5959dc9b96 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx @@ -31,7 +31,8 @@ function QuickbooksOutOfPocketExpenseEntitySelectPage({policy}: WithPolicyConnec const isLocationsEnabled = Boolean(syncLocations && syncLocations !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE); const isTaxesEnabled = Boolean(syncTax); const policyID = policy?.id ?? ''; - const isLocationImportEnabled = !!policy?.connections?.quickbooksOnline?.config?.syncLocations; + const isLocationImportEnabled = + !policy?.connections?.quickbooksOnline?.config?.syncLocations || policy?.connections?.quickbooksOnline?.config?.syncLocations !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE; const data: CardListItem[] = useMemo( () => [ From c771c51839d01f055b6aff473676f8ba723a2fb1 Mon Sep 17 00:00:00 2001 From: Hayata Suenaga Date: Fri, 10 May 2024 17:39:09 -0700 Subject: [PATCH 07/39] change const name and don't force in-active state --- .../qbo/import/QuickbooksLocationsPage.tsx | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/pages/workspace/accounting/qbo/import/QuickbooksLocationsPage.tsx b/src/pages/workspace/accounting/qbo/import/QuickbooksLocationsPage.tsx index b48b91e4848f..7528af8fbfb9 100644 --- a/src/pages/workspace/accounting/qbo/import/QuickbooksLocationsPage.tsx +++ b/src/pages/workspace/accounting/qbo/import/QuickbooksLocationsPage.tsx @@ -21,8 +21,8 @@ function QuickbooksLocationsPage({policy}: WithPolicyProps) { const styles = useThemeStyles(); const policyID = policy?.id ?? ''; const {syncLocations, pendingFields} = policy?.connections?.quickbooksOnline?.config ?? {}; - const shouldLocationImportBeOff = policy?.connections?.quickbooksOnline?.config.reimbursableExpensesExportDestination !== CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.JOURNAL_ENTRY; - const isSwitchOn = Boolean(syncLocations && syncLocations !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE) && !shouldLocationImportBeOff; + const shouldBeDisabled = policy?.connections?.quickbooksOnline?.config.reimbursableExpensesExportDestination !== CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.JOURNAL_ENTRY; + const isSwitchOn = Boolean(syncLocations && syncLocations !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE); const isReportFieldsSelected = syncLocations === CONST.INTEGRATION_ENTITY_MAP_TYPES.REPORT_FIELD; return ( @@ -47,7 +47,7 @@ function QuickbooksLocationsPage({policy}: WithPolicyProps) { Connections.updatePolicyConnectionConfig( policyID, @@ -56,7 +56,7 @@ function QuickbooksLocationsPage({policy}: WithPolicyProps) { isSwitchOn ? CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE : CONST.INTEGRATION_ENTITY_MAP_TYPES.TAG, ) } - disabled={shouldLocationImportBeOff} + disabled={shouldBeDisabled} /> @@ -71,12 +71,14 @@ function QuickbooksLocationsPage({policy}: WithPolicyProps) { /> )} - - {/** Make sure to change the description text to explain why the toggle button is locked and how the user can unlock the toggle button - * @see https://expensify.slack.com/archives/C036QM0SLJK/p1714967365830889?thread_ts=1714400674.229349&cid=C036QM0SLJK - */} - {translate('workspace.qbo.locationsAdditionalDescription')} - + {shouldBeDisabled && ( + + {/** Make sure to change the description text to explain why the toggle button is locked and how the user can unlock the toggle button + * @see https://expensify.slack.com/archives/C036QM0SLJK/p1714967365830889?thread_ts=1714400674.229349&cid=C036QM0SLJK + */} + {translate('workspace.qbo.locationsAdditionalDescription')} + + )} From 21aef13dc4f7742b2b317965488f22649e50a700 Mon Sep 17 00:00:00 2001 From: Hayata Suenaga Date: Tue, 14 May 2024 12:02:06 -0700 Subject: [PATCH 08/39] fix: use existing value to determine if the location is enabled or not --- .../export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx index ae5959dc9b96..ddf45fde9ac8 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx @@ -31,8 +31,6 @@ function QuickbooksOutOfPocketExpenseEntitySelectPage({policy}: WithPolicyConnec const isLocationsEnabled = Boolean(syncLocations && syncLocations !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE); const isTaxesEnabled = Boolean(syncTax); const policyID = policy?.id ?? ''; - const isLocationImportEnabled = - !policy?.connections?.quickbooksOnline?.config?.syncLocations || policy?.connections?.quickbooksOnline?.config?.syncLocations !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE; const data: CardListItem[] = useMemo( () => [ @@ -47,7 +45,7 @@ function QuickbooksOutOfPocketExpenseEntitySelectPage({policy}: WithPolicyConnec [reimbursableExpensesExportDestination, isTaxesEnabled, translate, isLocationsEnabled], ); - if (!isLocationImportEnabled) { + if (!isLocationsEnabled) { data.push( { value: CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.CHECK, From 01d10e50116cbababbd0f8db8910c0eedece6353 Mon Sep 17 00:00:00 2001 From: Hayata Suenaga Date: Tue, 14 May 2024 12:05:06 -0700 Subject: [PATCH 09/39] fix: don't use conditional rendering --- .../QuickbooksOutOfPocketExpenseEntitySelectPage.tsx | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx index ddf45fde9ac8..9902495747bb 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx @@ -41,12 +41,6 @@ function QuickbooksOutOfPocketExpenseEntitySelectPage({policy}: WithPolicyConnec isSelected: reimbursableExpensesExportDestination === CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.JOURNAL_ENTRY, isShown: !isTaxesEnabled || isLocationsEnabled, }, - ], - [reimbursableExpensesExportDestination, isTaxesEnabled, translate, isLocationsEnabled], - ); - - if (!isLocationsEnabled) { - data.push( { value: CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.CHECK, text: translate(`workspace.qbo.accounts.check`), @@ -61,8 +55,9 @@ function QuickbooksOutOfPocketExpenseEntitySelectPage({policy}: WithPolicyConnec isSelected: reimbursableExpensesExportDestination === CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.VENDOR_BILL, isShown: !isLocationsEnabled, }, - ); - } + ], + [reimbursableExpensesExportDestination, isTaxesEnabled, translate, isLocationsEnabled], + ); const sections: CardsSection[] = useMemo(() => [{data: data.filter((item) => item.isShown)}], [data]); From 286980f699103ca5cb115165cc53b1d96594ef09 Mon Sep 17 00:00:00 2001 From: Hayata Suenaga Date: Tue, 14 May 2024 12:06:14 -0700 Subject: [PATCH 10/39] fix: the ordering of items --- ...uickbooksOutOfPocketExpenseEntitySelectPage.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx index 9902495747bb..edac36b66927 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx @@ -34,6 +34,13 @@ function QuickbooksOutOfPocketExpenseEntitySelectPage({policy}: WithPolicyConnec const data: CardListItem[] = useMemo( () => [ + { + value: CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.VENDOR_BILL, + text: translate(`workspace.qbo.accounts.bill`), + keyForList: CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.VENDOR_BILL, + isSelected: reimbursableExpensesExportDestination === CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.VENDOR_BILL, + isShown: !isLocationsEnabled, + }, { value: CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.JOURNAL_ENTRY, text: translate(`workspace.qbo.accounts.journal_entry`), @@ -48,13 +55,6 @@ function QuickbooksOutOfPocketExpenseEntitySelectPage({policy}: WithPolicyConnec isSelected: reimbursableExpensesExportDestination === CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.CHECK, isShown: !isLocationsEnabled, }, - { - value: CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.VENDOR_BILL, - text: translate(`workspace.qbo.accounts.bill`), - keyForList: CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.VENDOR_BILL, - isSelected: reimbursableExpensesExportDestination === CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.VENDOR_BILL, - isShown: !isLocationsEnabled, - }, ], [reimbursableExpensesExportDestination, isTaxesEnabled, translate, isLocationsEnabled], ); From a9f76f4b2f9381a27fbd96c2ed29155212e62175 Mon Sep 17 00:00:00 2001 From: Hayata Suenaga Date: Tue, 14 May 2024 12:07:05 -0700 Subject: [PATCH 11/39] fix: the ordering of items --- ...ckbooksOutOfPocketExpenseEntitySelectPage.tsx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx index edac36b66927..35e06f6734e2 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx @@ -35,10 +35,10 @@ function QuickbooksOutOfPocketExpenseEntitySelectPage({policy}: WithPolicyConnec const data: CardListItem[] = useMemo( () => [ { - value: CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.VENDOR_BILL, - text: translate(`workspace.qbo.accounts.bill`), - keyForList: CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.VENDOR_BILL, - isSelected: reimbursableExpensesExportDestination === CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.VENDOR_BILL, + value: CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.CHECK, + text: translate(`workspace.qbo.accounts.check`), + keyForList: CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.CHECK, + isSelected: reimbursableExpensesExportDestination === CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.CHECK, isShown: !isLocationsEnabled, }, { @@ -49,10 +49,10 @@ function QuickbooksOutOfPocketExpenseEntitySelectPage({policy}: WithPolicyConnec isShown: !isTaxesEnabled || isLocationsEnabled, }, { - value: CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.CHECK, - text: translate(`workspace.qbo.accounts.check`), - keyForList: CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.CHECK, - isSelected: reimbursableExpensesExportDestination === CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.CHECK, + value: CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.VENDOR_BILL, + text: translate(`workspace.qbo.accounts.bill`), + keyForList: CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.VENDOR_BILL, + isSelected: reimbursableExpensesExportDestination === CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.VENDOR_BILL, isShown: !isLocationsEnabled, }, ], From b9cf43326542ea2a7490bf665f3dea2bfc2e4693 Mon Sep 17 00:00:00 2001 From: Hayata Suenaga Date: Tue, 14 May 2024 12:10:51 -0700 Subject: [PATCH 12/39] don't disable the switch for the location import if the location is already enabled so that the user can disable it --- .../accounting/qbo/import/QuickbooksLocationsPage.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/workspace/accounting/qbo/import/QuickbooksLocationsPage.tsx b/src/pages/workspace/accounting/qbo/import/QuickbooksLocationsPage.tsx index 7528af8fbfb9..7a88e5f90671 100644 --- a/src/pages/workspace/accounting/qbo/import/QuickbooksLocationsPage.tsx +++ b/src/pages/workspace/accounting/qbo/import/QuickbooksLocationsPage.tsx @@ -21,7 +21,8 @@ function QuickbooksLocationsPage({policy}: WithPolicyProps) { const styles = useThemeStyles(); const policyID = policy?.id ?? ''; const {syncLocations, pendingFields} = policy?.connections?.quickbooksOnline?.config ?? {}; - const shouldBeDisabled = policy?.connections?.quickbooksOnline?.config.reimbursableExpensesExportDestination !== CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.JOURNAL_ENTRY; + const shouldBeDisabled = + !syncLocations && policy?.connections?.quickbooksOnline?.config.reimbursableExpensesExportDestination !== CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.JOURNAL_ENTRY; const isSwitchOn = Boolean(syncLocations && syncLocations !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE); const isReportFieldsSelected = syncLocations === CONST.INTEGRATION_ENTITY_MAP_TYPES.REPORT_FIELD; From 3c1b8415f96966c6eae896cd90b9bf8dc9f668c5 Mon Sep 17 00:00:00 2001 From: Hayata Suenaga Date: Tue, 14 May 2024 12:12:26 -0700 Subject: [PATCH 13/39] chore: remove todo comments --- .../accounting/qbo/import/QuickbooksLocationsPage.tsx | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/pages/workspace/accounting/qbo/import/QuickbooksLocationsPage.tsx b/src/pages/workspace/accounting/qbo/import/QuickbooksLocationsPage.tsx index 7a88e5f90671..5b9fb5e06276 100644 --- a/src/pages/workspace/accounting/qbo/import/QuickbooksLocationsPage.tsx +++ b/src/pages/workspace/accounting/qbo/import/QuickbooksLocationsPage.tsx @@ -74,9 +74,6 @@ function QuickbooksLocationsPage({policy}: WithPolicyProps) { )} {shouldBeDisabled && ( - {/** Make sure to change the description text to explain why the toggle button is locked and how the user can unlock the toggle button - * @see https://expensify.slack.com/archives/C036QM0SLJK/p1714967365830889?thread_ts=1714400674.229349&cid=C036QM0SLJK - */} {translate('workspace.qbo.locationsAdditionalDescription')} )} From bcecadabba073db7227dcf393f6a9c47cca0b62b Mon Sep 17 00:00:00 2001 From: Hayata Suenaga Date: Wed, 15 May 2024 10:22:03 -0700 Subject: [PATCH 14/39] update the UI copy --- src/languages/en.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index d21c4883ee21..306ecee566b5 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -1925,8 +1925,7 @@ export default { customersDescription: 'Choose whether to import customers/projects and see where customers/projects are displayed.', locationsDescription: 'Choose whether to import locations, and see where locations are displayed.', taxesDescription: 'Choose whether to import tax rates and tax defaults from your accounting integration.', - locationsAdditionalDescription: - 'Locations are imported as Tags. This limits exporting expense reports as Vendor Bills or Checks to QuickBooks Online. To unlock these export options, either disable Locations import or upgrade to the Control Plan to export Locations encoded as a Report Field.', + locationsAdditionalDescription: `QuickBooks Online does not support adding a location to vendor bills or checks. Update your export preference to journal entry if you'd like to import locations as tags.`, export: 'Export', exportAs: 'Export as', exportDescription: 'Configure how data in Expensify gets exported to QuickBooks Online.', From dd891b7f63ad88a42775911582580f09e5b89710 Mon Sep 17 00:00:00 2001 From: Hayata Suenaga Date: Wed, 15 May 2024 10:23:59 -0700 Subject: [PATCH 15/39] style: get config value from the destructuring statement --- .../accounting/qbo/import/QuickbooksLocationsPage.tsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/pages/workspace/accounting/qbo/import/QuickbooksLocationsPage.tsx b/src/pages/workspace/accounting/qbo/import/QuickbooksLocationsPage.tsx index b871a3697930..c2f11018a419 100644 --- a/src/pages/workspace/accounting/qbo/import/QuickbooksLocationsPage.tsx +++ b/src/pages/workspace/accounting/qbo/import/QuickbooksLocationsPage.tsx @@ -20,9 +20,8 @@ function QuickbooksLocationsPage({policy}: WithPolicyProps) { const {translate} = useLocalize(); const styles = useThemeStyles(); const policyID = policy?.id ?? ''; - const {syncLocations, pendingFields} = policy?.connections?.quickbooksOnline?.config ?? {}; - const shouldBeDisabled = - !syncLocations && policy?.connections?.quickbooksOnline?.config.reimbursableExpensesExportDestination !== CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.JOURNAL_ENTRY; + const {syncLocations, pendingFields, reimbursableExpensesExportDestination} = policy?.connections?.quickbooksOnline?.config ?? {}; + const shouldBeDisabled = !syncLocations && reimbursableExpensesExportDestination !== CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.JOURNAL_ENTRY; const isSwitchOn = Boolean(syncLocations && syncLocations !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE); const isReportFieldsSelected = syncLocations === CONST.INTEGRATION_ENTITY_MAP_TYPES.REPORT_FIELD; From 9b082710dec4abfa3dd05e5527b0e87ae85ff569 Mon Sep 17 00:00:00 2001 From: Hayata Suenaga Date: Mon, 20 May 2024 15:45:22 -0700 Subject: [PATCH 16/39] fix: update the spanish translation --- src/languages/es.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/languages/es.ts b/src/languages/es.ts index 9c4d33664c98..5acba396779e 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -1961,7 +1961,7 @@ export default { taxesJournalEntrySwitchNote: 'Nota: QuickBooks Online no admite un campo para impuestos al exportar entradas en el libro diario. Cambia tu preferencia de exportación a Factura de Proveedor o Cheque para importar impuestos.', locationsAdditionalDescription: - 'Los lugares son importados como Etiquegas. Esto limita a exportar los informes de gastos como Factura del Proveedor o Cheques a Quicbooks Online. Para desbloquear estas opciones de exportación desactiva la importación de Lugares o cambia al Plan Control para exportar Lugares como Campos de Informes.', + 'QuickBooks Online no permite añadir una ubicación a las facturas de proveedores o a los cheques. Actualice su preferencia de exportación a asiento contable si desea importar ubicaciones como etiquetas.', export: 'Exportar', exportAs: 'Exportar cómo', exportExpenses: 'Exportar gastos de bolsillo como', From 6ba9dc4be8c88f85afea2bc0ab7a4cdafcdec280 Mon Sep 17 00:00:00 2001 From: Hayata Suenaga Date: Thu, 23 May 2024 15:29:44 -0700 Subject: [PATCH 17/39] fix: use `isSwitchOn` to decide if the admin should be allowed to toggle the switch --- .../workspace/accounting/qbo/import/QuickbooksLocationsPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/workspace/accounting/qbo/import/QuickbooksLocationsPage.tsx b/src/pages/workspace/accounting/qbo/import/QuickbooksLocationsPage.tsx index c2f11018a419..6f895317f782 100644 --- a/src/pages/workspace/accounting/qbo/import/QuickbooksLocationsPage.tsx +++ b/src/pages/workspace/accounting/qbo/import/QuickbooksLocationsPage.tsx @@ -21,8 +21,8 @@ function QuickbooksLocationsPage({policy}: WithPolicyProps) { const styles = useThemeStyles(); const policyID = policy?.id ?? ''; const {syncLocations, pendingFields, reimbursableExpensesExportDestination} = policy?.connections?.quickbooksOnline?.config ?? {}; - const shouldBeDisabled = !syncLocations && reimbursableExpensesExportDestination !== CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.JOURNAL_ENTRY; const isSwitchOn = Boolean(syncLocations && syncLocations !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE); + const shouldBeDisabled = !isSwitchOn && reimbursableExpensesExportDestination !== CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.JOURNAL_ENTRY; const isReportFieldsSelected = syncLocations === CONST.INTEGRATION_ENTITY_MAP_TYPES.REPORT_FIELD; return ( From 14943e71992c3eb177335f3d255d20c9873433d9 Mon Sep 17 00:00:00 2001 From: Hayata Suenaga Date: Thu, 23 May 2024 16:24:47 -0700 Subject: [PATCH 18/39] fix: move the hint text to the entity select page --- ...ooksOutOfPocketExpenseEntitySelectPage.tsx | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx index 1a1047a7fc55..9cdbbfe4e8d5 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage.tsx @@ -18,6 +18,29 @@ import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; import type {QBOReimbursableExportAccountType} from '@src/types/onyx/Policy'; +function Footer({isTaxEnabled, isLocationsEnabled}: {isTaxEnabled: boolean; isLocationsEnabled: boolean}) { + const styles = useThemeStyles(); + const {translate} = useLocalize(); + + if (isTaxEnabled) { + return ( + <> + isTaxesEnabled && {translate('workspace.qbo.outOfPocketTaxEnabledDescription')} + + ); + } + + if (isLocationsEnabled) { + return ( + + {translate('workspace.qbo.locationsAdditionalDescription')} + + ); + } + + return null; +} + type CardListItem = ListItem & { value: QBOReimbursableExportAccountType; isShown: boolean; @@ -90,7 +113,12 @@ function QuickbooksOutOfPocketExpenseEntitySelectPage({policy}: WithPolicyConnec ListItem={RadioListItem} onSelectRow={selectExportEntity} initiallyFocusedOptionKey={data.find((mode) => mode.isSelected)?.keyForList} - footerContent={isTaxesEnabled && {translate('workspace.qbo.outOfPocketTaxEnabledDescription')}} + footerContent={ +