From da9099bd2e463c10eb5afdbfdcadaa61195f7f3c Mon Sep 17 00:00:00 2001 From: Manan Jadhav Date: Tue, 10 Sep 2024 23:27:44 +0530 Subject: [PATCH 01/12] feat: added last sync object to netsuite --- src/libs/actions/connections/index.ts | 3 --- src/types/onyx/Policy.ts | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libs/actions/connections/index.ts b/src/libs/actions/connections/index.ts index 20581d40ed0b..79875a161103 100644 --- a/src/libs/actions/connections/index.ts +++ b/src/libs/actions/connections/index.ts @@ -307,9 +307,6 @@ function hasSynchronizationErrorMessage(policy: OnyxEntry, connectionNam } function isAuthenticationError(policy: OnyxEntry, connectionName: PolicyConnectionName) { - if (connectionName === CONST.POLICY.CONNECTIONS.NAME.NETSUITE) { - return false; - } const connection = policy?.connections?.[connectionName]; return connection?.lastSync?.isAuthenticationError === true; } diff --git a/src/types/onyx/Policy.ts b/src/types/onyx/Policy.ts index 139f3782c117..fcfc5a86f951 100644 --- a/src/types/onyx/Policy.ts +++ b/src/types/onyx/Policy.ts @@ -995,6 +995,9 @@ type NetSuiteConnection = { /** Date when the connection's last failed sync occurred */ lastErrorSyncDate: string; + /** State of the last synchronization */ + lastSync?: ConnectionLastSync; + /** Where did the connection's last sync came from */ source: JobSourceValues; From 2f3099c492887faecd7b74d261784b8a5259f670 Mon Sep 17 00:00:00 2001 From: Manan Jadhav Date: Tue, 10 Sep 2024 23:48:50 +0530 Subject: [PATCH 02/12] feat: move all auth errors to common --- src/CONST.ts | 8 +++++-- src/languages/en.ts | 4 ++-- src/languages/es.ts | 4 ++-- src/pages/workspace/accounting/utils.tsx | 30 ++++++++++++++---------- 4 files changed, 27 insertions(+), 19 deletions(-) diff --git a/src/CONST.ts b/src/CONST.ts index d0695b1e285f..c75f8b8faa84 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -712,8 +712,6 @@ const CONST = { EXPENSIFY_PACKAGE_FOR_SAGE_INTACCT_FILE_NAME: 'ExpensifyPackageForSageIntacct', SAGE_INTACCT_INSTRUCTIONS: 'https://help.expensify.com/articles/expensify-classic/integrations/accounting-integrations/Sage-Intacct', HOW_TO_CONNECT_TO_SAGE_INTACCT: 'https://help.expensify.com/articles/expensify-classic/integrations/accounting-integrations/Sage-Intacct#how-to-connect-to-sage-intacct', - SAGE_INTACCT_HELP_LINK: - "https://help.expensify.com/articles/expensify-classic/connections/sage-intacct/Sage-Intacct-Troubleshooting#:~:text=First%20make%20sure%20that%20you,your%20company's%20Web%20Services%20authorizations.", PRICING: `https://www.expensify.com/pricing`, CUSTOM_REPORT_NAME_HELP_URL: 'https://help.expensify.com/articles/expensify-classic/spending-insights/Custom-Templates', // Use Environment.getEnvironmentURL to get the complete URL with port number @@ -2272,6 +2270,12 @@ const CONST = { billCom: 'Bill.com', zenefits: 'Zenefits', }, + AUTH_HELP_LINKS: { + intacct: + "https://help.expensify.com/articles/expensify-classic/connections/sage-intacct/Sage-Intacct-Troubleshooting#:~:text=First%20make%20sure%20that%20you,your%20company's%20Web%20Services%20authorizations.", + netsuite: + 'https://help.expensify.com/articles/expensify-classic/connections/netsuite/Netsuite-Troubleshooting#expensierror-ns0109-failed-to-login-to-netsuite-please-verify-your-credentials', + }, SYNC_STAGE_NAME: { STARTING_IMPORT_QBO: 'startingImportQBO', STARTING_IMPORT_XERO: 'startingImportXero', diff --git a/src/languages/en.ts b/src/languages/en.ts index 6ef5390d4dcb..152841f634c9 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -2227,6 +2227,8 @@ export default { reuseExistingConnection: 'Reuse existing connection', existingConnections: 'Existing connections', lastSyncDate: (connectionName: string, formattedDate: string) => `${connectionName} - Last synced ${formattedDate}`, + authenticationError: (connectionName: string) => `Can’t connect to ${connectionName} due to an authentication error.`, + learnMore: 'Learn more.', }, qbo: { importDescription: 'Choose which coding configurations to import from QuickBooks Online to Expensify.', @@ -2454,8 +2456,6 @@ export default { syncReimbursedReports: 'Sync reimbursed reports', syncReimbursedReportsDescription: 'Any time a report is paid using Expensify ACH, the corresponding bill payment will be created in the Sage Intacct account below.', paymentAccount: 'Sage Intacct payment account', - authenticationError: 'Can’t connect to Sage Intacct due to an authentication error. ', - learnMore: 'Learn more.', }, netsuite: { subsidiary: 'Subsidiary', diff --git a/src/languages/es.ts b/src/languages/es.ts index e4ebf709baf1..6b62add6a0df 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -2258,6 +2258,8 @@ export default { existingConnections: 'Conexiones existentes', lastSyncDate: (connectionName: string, formattedDate: string) => `${connectionName} - Última sincronización ${formattedDate}`, topLevel: 'Nivel superior', + authenticationError: (connectionName: string) => `No se puede conectar a ${connectionName} debido a un error de autenticación.`, + learnMore: 'Más información.', }, qbo: { importDescription: 'Elige que configuraciónes de codificación son importadas desde QuickBooks Online a Expensify.', @@ -2496,8 +2498,6 @@ export default { syncReimbursedReportsDescription: 'Cuando un informe se reembolsa utilizando Expensify ACH, la factura de compra correspondiente se creará en la cuenta de Sage Intacct a continuación.', paymentAccount: 'Cuenta de pago Sage Intacct', - authenticationError: 'No se puede conectar a Sage Intacct debido a un error de autenticación. ', - learnMore: 'Más información.', }, netsuite: { subsidiary: 'Subsidiaria', diff --git a/src/pages/workspace/accounting/utils.tsx b/src/pages/workspace/accounting/utils.tsx index b7b63502c842..45398b21e2d6 100644 --- a/src/pages/workspace/accounting/utils.tsx +++ b/src/pages/workspace/accounting/utils.tsx @@ -257,6 +257,23 @@ function getSynchronizationErrorMessage( translate: LocaleContextProps['translate'], styles?: ThemeStyles, ): React.ReactNode | undefined { + + if (isAuthenticationError(policy, connectionName)) { + return ( + + {translate('workspace.common.authenticationError', CONST.POLICY.CONNECTIONS.NAME_USER_FRIENDLY[connectionName])} + {connectionName in CONST.POLICY.CONNECTIONS.AUTH_HELP_LINKS && ( + + {translate('workspace.common.learnMore')} + + )} + + ); + } + const syncError = Localize.translateLocal('workspace.accounting.syncError', connectionName); // NetSuite does not use the conventional lastSync object, so we need to check for lastErrorSyncDate if (connectionName === CONST.POLICY.CONNECTIONS.NAME.NETSUITE) { @@ -274,19 +291,6 @@ function getSynchronizationErrorMessage( return; } - if (connectionName === CONST.POLICY.CONNECTIONS.NAME.SAGE_INTACCT && isAuthenticationError(policy, CONST.POLICY.CONNECTIONS.NAME.SAGE_INTACCT)) { - return ( - - {translate('workspace.sageIntacct.authenticationError')} - - {translate('workspace.sageIntacct.learnMore')} - - - ); - } return `${syncError} ("${connection?.lastSync?.errorMessage}")`; } From cd21a6fe648a2ec8c9d457c2312ff3f0a93e47d9 Mon Sep 17 00:00:00 2001 From: Manan Jadhav Date: Wed, 11 Sep 2024 00:04:15 +0530 Subject: [PATCH 03/12] feat: allow redirect for netsuite --- src/components/ConnectToNetSuiteFlow/index.tsx | 8 +++++++- src/pages/workspace/accounting/PolicyAccountingPage.tsx | 5 ++--- src/pages/workspace/accounting/utils.tsx | 1 - 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/components/ConnectToNetSuiteFlow/index.tsx b/src/components/ConnectToNetSuiteFlow/index.tsx index f946742f8cc3..93041f3301c6 100644 --- a/src/components/ConnectToNetSuiteFlow/index.tsx +++ b/src/components/ConnectToNetSuiteFlow/index.tsx @@ -1,13 +1,16 @@ import React, {useEffect, useState} from 'react'; +import {useOnyx} from 'react-native-onyx'; import * as Expensicons from '@components/Icon/Expensicons'; import PopoverMenu from '@components/PopoverMenu'; import useLocalize from '@hooks/useLocalize'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; +import {isAuthenticationError} from '@libs/actions/connections'; import {getAdminPoliciesConnectedToNetSuite} from '@libs/actions/Policy/Policy'; import Navigation from '@libs/Navigation/Navigation'; import {useAccountingContext} from '@pages/workspace/accounting/AccountingContext'; import type {AnchorPosition} from '@styles/index'; import CONST from '@src/CONST'; +import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type {ConnectToNetSuiteFlowProps} from './types'; @@ -20,6 +23,9 @@ function ConnectToNetSuiteFlow({policyID}: ConnectToNetSuiteFlowProps) { const [reuseConnectionPopoverPosition, setReuseConnectionPopoverPosition] = useState({horizontal: 0, vertical: 0}); const {popoverAnchorRefs} = useAccountingContext(); + const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`); + const shouldGoToCredentials = isAuthenticationError(policy, CONST.POLICY.CONNECTIONS.NAME.NETSUITE); + const threeDotsMenuContainerRef = popoverAnchorRefs?.current?.[CONST.POLICY.CONNECTIONS.NAME.NETSUITE]; const connectionOptions = [ @@ -42,7 +48,7 @@ function ConnectToNetSuiteFlow({policyID}: ConnectToNetSuiteFlowProps) { ]; useEffect(() => { - if (!hasPoliciesConnectedToNetSuite) { + if (shouldGoToCredentials || !hasPoliciesConnectedToNetSuite) { Navigation.navigate(ROUTES.POLICY_ACCOUNTING_NETSUITE_TOKEN_INPUT.getRoute(policyID)); return; } diff --git a/src/pages/workspace/accounting/PolicyAccountingPage.tsx b/src/pages/workspace/accounting/PolicyAccountingPage.tsx index a8ca3fc2054f..af5a5be897b8 100644 --- a/src/pages/workspace/accounting/PolicyAccountingPage.tsx +++ b/src/pages/workspace/accounting/PolicyAccountingPage.tsx @@ -84,7 +84,7 @@ function PolicyAccountingPage({policy}: PolicyAccountingPageProps) { // Enter credentials item shouldn't be shown for SageIntacct and NetSuite integrations const shouldShowEnterCredentials = - connectedIntegration && !!synchronizationError && isAuthenticationError(policy, connectedIntegration) && connectedIntegration !== CONST.POLICY.CONNECTIONS.NAME.NETSUITE; + connectedIntegration && !!synchronizationError && isAuthenticationError(policy, connectedIntegration); const policyID = policy?.id ?? '-1'; // Get the last successful date of the integration. Then, if `connectionSyncProgress` is the same integration displayed and the state is 'jobDone', get the more recent update time of the two. @@ -98,7 +98,7 @@ function PolicyAccountingPage({policy}: PolicyAccountingPageProps) { const overflowMenu: ThreeDotsMenuProps['menuItems'] = useMemo( () => [ - ...(shouldShowEnterCredentials + ...(shouldShowEnterCredentials && (connectedIntegration === CONST.POLICY.CONNECTIONS.NAME.SAGE_INTACCT || connectedIntegration === CONST.POLICY.CONNECTIONS.NAME.NETSUITE) ? [ { icon: Expensicons.Key, @@ -107,7 +107,6 @@ function PolicyAccountingPage({policy}: PolicyAccountingPageProps) { shouldCallAfterModalHide: true, disabled: isOffline, iconRight: Expensicons.NewWindow, - shouldShowRightIcon: connectedIntegration !== CONST.POLICY.CONNECTIONS.NAME.SAGE_INTACCT, }, ] : [ diff --git a/src/pages/workspace/accounting/utils.tsx b/src/pages/workspace/accounting/utils.tsx index 45398b21e2d6..1bf944f0f5e5 100644 --- a/src/pages/workspace/accounting/utils.tsx +++ b/src/pages/workspace/accounting/utils.tsx @@ -257,7 +257,6 @@ function getSynchronizationErrorMessage( translate: LocaleContextProps['translate'], styles?: ThemeStyles, ): React.ReactNode | undefined { - if (isAuthenticationError(policy, connectionName)) { return ( From 88b6d3c119761daecf8fd3f509cc49c447dca6f1 Mon Sep 17 00:00:00 2001 From: Manan Jadhav Date: Wed, 11 Sep 2024 00:11:33 +0530 Subject: [PATCH 04/12] feat: allow token input form --- src/pages/workspace/accounting/PolicyAccountingPage.tsx | 3 +-- .../netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx | 6 +++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/pages/workspace/accounting/PolicyAccountingPage.tsx b/src/pages/workspace/accounting/PolicyAccountingPage.tsx index af5a5be897b8..5cd44dfd4161 100644 --- a/src/pages/workspace/accounting/PolicyAccountingPage.tsx +++ b/src/pages/workspace/accounting/PolicyAccountingPage.tsx @@ -83,8 +83,7 @@ function PolicyAccountingPage({policy}: PolicyAccountingPageProps) { const synchronizationError = connectedIntegration && getSynchronizationErrorMessage(policy, connectedIntegration, isSyncInProgress, translate, styles); // Enter credentials item shouldn't be shown for SageIntacct and NetSuite integrations - const shouldShowEnterCredentials = - connectedIntegration && !!synchronizationError && isAuthenticationError(policy, connectedIntegration); + const shouldShowEnterCredentials = connectedIntegration && !!synchronizationError && isAuthenticationError(policy, connectedIntegration); const policyID = policy?.id ?? '-1'; // Get the last successful date of the integration. Then, if `connectionSyncProgress` is the same integration displayed and the state is 'jobDone', get the more recent update time of the two. diff --git a/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx b/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx index 178db5534f49..7a88eab0c054 100644 --- a/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx +++ b/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx @@ -1,3 +1,4 @@ +import {isEmpty} from 'lodash'; import React, {useRef} from 'react'; import type {ComponentType, ForwardedRef} from 'react'; import {View} from 'react-native'; @@ -7,6 +8,7 @@ import type {InteractiveStepSubHeaderHandle} from '@components/InteractiveStepSu import useSubStep from '@hooks/useSubStep'; import type {SubStepProps} from '@hooks/useSubStep/types'; import useThemeStyles from '@hooks/useThemeStyles'; +import {isAuthenticationError} from '@libs/actions/connections'; import Navigation from '@libs/Navigation/Navigation'; import type {WithPolicyConnectionsProps} from '@pages/workspace/withPolicyConnections'; import withPolicyConnections from '@pages/workspace/withPolicyConnections'; @@ -51,6 +53,8 @@ function NetSuiteTokenInputPage({policy}: WithPolicyConnectionsProps) { nextScreen(); }; + const shouldPageBeBlocked = !isEmpty(policy?.connections?.[CONST.POLICY.CONNECTIONS.NAME.NETSUITE]) && !isAuthenticationError(policy, CONST.POLICY.CONNECTIONS.NAME.NETSUITE); + return ( Date: Wed, 11 Sep 2024 00:28:14 +0530 Subject: [PATCH 05/12] refactor: rename variable --- src/components/ConnectToNetSuiteFlow/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/ConnectToNetSuiteFlow/index.tsx b/src/components/ConnectToNetSuiteFlow/index.tsx index 93041f3301c6..5eb548c2acb5 100644 --- a/src/components/ConnectToNetSuiteFlow/index.tsx +++ b/src/components/ConnectToNetSuiteFlow/index.tsx @@ -24,7 +24,7 @@ function ConnectToNetSuiteFlow({policyID}: ConnectToNetSuiteFlowProps) { const {popoverAnchorRefs} = useAccountingContext(); const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`); - const shouldGoToCredentials = isAuthenticationError(policy, CONST.POLICY.CONNECTIONS.NAME.NETSUITE); + const shouldGoToCredentialsPage = isAuthenticationError(policy, CONST.POLICY.CONNECTIONS.NAME.NETSUITE); const threeDotsMenuContainerRef = popoverAnchorRefs?.current?.[CONST.POLICY.CONNECTIONS.NAME.NETSUITE]; @@ -48,7 +48,7 @@ function ConnectToNetSuiteFlow({policyID}: ConnectToNetSuiteFlowProps) { ]; useEffect(() => { - if (shouldGoToCredentials || !hasPoliciesConnectedToNetSuite) { + if (shouldGoToCredentialsPage || !hasPoliciesConnectedToNetSuite) { Navigation.navigate(ROUTES.POLICY_ACCOUNTING_NETSUITE_TOKEN_INPUT.getRoute(policyID)); return; } From cc97c7a25a8a5193bbf5884d8a805a950973947b Mon Sep 17 00:00:00 2001 From: Manan Jadhav Date: Wed, 11 Sep 2024 00:46:00 +0530 Subject: [PATCH 06/12] refactor: fix ts error --- src/pages/workspace/accounting/utils.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/workspace/accounting/utils.tsx b/src/pages/workspace/accounting/utils.tsx index 1bf944f0f5e5..79afefffbd33 100644 --- a/src/pages/workspace/accounting/utils.tsx +++ b/src/pages/workspace/accounting/utils.tsx @@ -264,7 +264,7 @@ function getSynchronizationErrorMessage( {connectionName in CONST.POLICY.CONNECTIONS.AUTH_HELP_LINKS && ( {translate('workspace.common.learnMore')} From 901483c94185965542ca49896cd85c03c67ce16d Mon Sep 17 00:00:00 2001 From: Manan Jadhav Date: Wed, 11 Sep 2024 00:57:26 +0530 Subject: [PATCH 07/12] fix: condition when connection is empty --- .../netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx b/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx index 7a88eab0c054..f9de52069110 100644 --- a/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx +++ b/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx @@ -67,6 +67,7 @@ function NetSuiteTokenInputPage({policy}: WithPolicyConnectionsProps) { connectionName={CONST.POLICY.CONNECTIONS.NAME.NETSUITE} onBackButtonPress={handleBackButtonPress} shouldIncludeSafeAreaPaddingBottom + shouldLoadForEmptyConnection shouldBeBlocked={shouldPageBeBlocked} > From f28eb8b36ae547690c9c71c9d26ad303501e6862 Mon Sep 17 00:00:00 2001 From: Manan Jadhav Date: Wed, 11 Sep 2024 01:07:14 +0530 Subject: [PATCH 08/12] fix: condition when connection is empty --- .../netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx b/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx index f9de52069110..cb8efe4cd509 100644 --- a/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx +++ b/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx @@ -67,7 +67,7 @@ function NetSuiteTokenInputPage({policy}: WithPolicyConnectionsProps) { connectionName={CONST.POLICY.CONNECTIONS.NAME.NETSUITE} onBackButtonPress={handleBackButtonPress} shouldIncludeSafeAreaPaddingBottom - shouldLoadForEmptyConnection + shouldLoadForEmptyConnection={isEmpty(policy?.connections?.[CONST.POLICY.CONNECTIONS.NAME.NETSUITE])} shouldBeBlocked={shouldPageBeBlocked} > From 78dc8f3381ff0bc3870d4c01f6f5a789109baa28 Mon Sep 17 00:00:00 2001 From: Manan Jadhav Date: Wed, 18 Sep 2024 22:46:47 +0400 Subject: [PATCH 09/12] refactor: remove unused props --- src/types/onyx/Policy.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/types/onyx/Policy.ts b/src/types/onyx/Policy.ts index 1b12c2c8da2b..138e1aa932f8 100644 --- a/src/types/onyx/Policy.ts +++ b/src/types/onyx/Policy.ts @@ -998,9 +998,6 @@ type NetSuiteConnection = { /** State of the last synchronization */ lastSync?: ConnectionLastSync; - /** Where did the connection's last sync came from */ - source: JobSourceValues; - /** Config object used solely to store autosync settings */ config: OnyxCommon.OnyxValueWithOfflineFeedback<{ /** NetSuite auto synchronization configs */ From 0c52433938b9e4a2037489b8893c03684ed888ea Mon Sep 17 00:00:00 2001 From: Manan Jadhav Date: Thu, 19 Sep 2024 13:30:24 +0400 Subject: [PATCH 10/12] refactor: remove comment --- src/pages/workspace/accounting/PolicyAccountingPage.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/workspace/accounting/PolicyAccountingPage.tsx b/src/pages/workspace/accounting/PolicyAccountingPage.tsx index 798994402e8c..7ad01eece1da 100644 --- a/src/pages/workspace/accounting/PolicyAccountingPage.tsx +++ b/src/pages/workspace/accounting/PolicyAccountingPage.tsx @@ -87,7 +87,6 @@ function PolicyAccountingPage({policy}: PolicyAccountingPageProps) { const connectedIntegration = getConnectedIntegration(policy, accountingIntegrations) ?? connectionSyncProgress?.connectionName; const synchronizationError = connectedIntegration && getSynchronizationErrorMessage(policy, connectedIntegration, isSyncInProgress, translate, styles); - // Enter credentials item shouldn't be shown for SageIntacct and NetSuite integrations const shouldShowEnterCredentials = connectedIntegration && !!synchronizationError && isAuthenticationError(policy, connectedIntegration); const policyID = policy?.id ?? '-1'; From 4e8e84e247e73f696a74313327078c6bcae08917 Mon Sep 17 00:00:00 2001 From: Manan Jadhav Date: Mon, 23 Sep 2024 02:37:36 +0530 Subject: [PATCH 11/12] refactor: update lib call --- .../netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx b/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx index cb8efe4cd509..ffb2445ef435 100644 --- a/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx +++ b/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx @@ -13,6 +13,7 @@ import Navigation from '@libs/Navigation/Navigation'; import type {WithPolicyConnectionsProps} from '@pages/workspace/withPolicyConnections'; import withPolicyConnections from '@pages/workspace/withPolicyConnections'; import CONST from '@src/CONST'; +import {isEmptyObject} from '@src/types/utils/EmptyObject'; import NetSuiteTokenInputForm from './substeps/NetSuiteTokenInputForm'; import NetSuiteTokenSetupContent from './substeps/NetSuiteTokenSetupContent'; @@ -53,7 +54,7 @@ function NetSuiteTokenInputPage({policy}: WithPolicyConnectionsProps) { nextScreen(); }; - const shouldPageBeBlocked = !isEmpty(policy?.connections?.[CONST.POLICY.CONNECTIONS.NAME.NETSUITE]) && !isAuthenticationError(policy, CONST.POLICY.CONNECTIONS.NAME.NETSUITE); + const shouldPageBeBlocked = !isEmptyObject(policy?.connections?.[CONST.POLICY.CONNECTIONS.NAME.NETSUITE]) && !isAuthenticationError(policy, CONST.POLICY.CONNECTIONS.NAME.NETSUITE); return ( Date: Mon, 23 Sep 2024 14:40:09 +0530 Subject: [PATCH 12/12] refactor: use isEmptyObject --- .../netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx b/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx index ffb2445ef435..556cc589796c 100644 --- a/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx +++ b/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage.tsx @@ -1,4 +1,3 @@ -import {isEmpty} from 'lodash'; import React, {useRef} from 'react'; import type {ComponentType, ForwardedRef} from 'react'; import {View} from 'react-native'; @@ -68,7 +67,7 @@ function NetSuiteTokenInputPage({policy}: WithPolicyConnectionsProps) { connectionName={CONST.POLICY.CONNECTIONS.NAME.NETSUITE} onBackButtonPress={handleBackButtonPress} shouldIncludeSafeAreaPaddingBottom - shouldLoadForEmptyConnection={isEmpty(policy?.connections?.[CONST.POLICY.CONNECTIONS.NAME.NETSUITE])} + shouldLoadForEmptyConnection={isEmptyObject(policy?.connections?.[CONST.POLICY.CONNECTIONS.NAME.NETSUITE])} shouldBeBlocked={shouldPageBeBlocked} >