From 9665c0f8b0112696b9648d10e43a1336291b3d25 Mon Sep 17 00:00:00 2001
From: Hans <visaocuoitroi193@gmail.com>
Date: Mon, 20 May 2024 17:07:33 +0700
Subject: [PATCH 1/3] Fix: QBO briefly shows when syncing Xero

---
 src/CONST.ts                          | 3 ++-
 src/languages/en.ts                   | 4 +++-
 src/languages/es.ts                   | 6 ++++--
 src/libs/actions/connections/index.ts | 7 ++++---
 4 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/src/CONST.ts b/src/CONST.ts
index 99b9cc2c50e1..7bf1d38510cd 100755
--- a/src/CONST.ts
+++ b/src/CONST.ts
@@ -1777,7 +1777,8 @@ const CONST = {
                 XERO: 'xero',
             },
             SYNC_STAGE_NAME: {
-                STARTING_IMPORT: 'startingImport',
+                STARTING_IMPORT_QBO: 'startingImportQBO',
+                STARTING_IMPORT_XERO: 'startingImportXero',
                 QBO_IMPORT_MAIN: 'quickbooksOnlineImportMain',
                 QBO_IMPORT_CUSTOMERS: 'quickbooksOnlineImportCustomers',
                 QBO_IMPORT_EMPLOYEES: 'quickbooksOnlineImportEmployees',
diff --git a/src/languages/en.ts b/src/languages/en.ts
index f5bb3f67fadc..68c1d4120385 100755
--- a/src/languages/en.ts
+++ b/src/languages/en.ts
@@ -2396,7 +2396,9 @@ export default {
                             return 'Checking QuickBooks Online connection';
                         case 'quickbooksOnlineImportMain':
                             return 'Importing your QuickBooks Online data';
-                        case 'startingImport':
+                        case 'startingImportXero':
+                            return 'Importing your Xero data';
+                        case 'startingImportQBO':
                             return 'Importing your QuickBooks Online data';
                         case 'quickbooksOnlineSyncTitle':
                             return 'Synchronizing QuickBooks Online data';
diff --git a/src/languages/es.ts b/src/languages/es.ts
index 1f0722254404..7183a466a0d4 100644
--- a/src/languages/es.ts
+++ b/src/languages/es.ts
@@ -2400,8 +2400,10 @@ export default {
                             return 'Revisando conexión a QuickBooks Online';
                         case 'quickbooksOnlineImportMain':
                             return 'Importando datos desde QuickBooks Online';
-                        case 'startingImport':
-                            return 'Importando datos desde QuickBooks Online';
+                        case 'startingImportXero':
+                            return 'Importing your Xero data';
+                        case 'startingImportQBO':
+                            return 'Importing your QuickBooks Online data';
                         case 'quickbooksOnlineSyncTitle':
                             return 'Sincronizando datos desde QuickBooks Online';
                         case 'quickbooksOnlineSyncLoadData':
diff --git a/src/libs/actions/connections/index.ts b/src/libs/actions/connections/index.ts
index 8fd406f13231..ee858a290849 100644
--- a/src/libs/actions/connections/index.ts
+++ b/src/libs/actions/connections/index.ts
@@ -128,12 +128,13 @@ function updatePolicyConnectionConfig<TConnectionName extends ConnectionName, TS
  * @param connectionName - Name of the connection, QBO/Xero
  */
 function syncConnection(policyID: string, connectionName: PolicyConnectionName | undefined) {
+    const isQBOConnection = connectionName === CONST.POLICY.CONNECTIONS.NAME.QBO;
     const optimisticData: OnyxUpdate[] = [
         {
             onyxMethod: Onyx.METHOD.MERGE,
             key: `${ONYXKEYS.COLLECTION.POLICY_CONNECTION_SYNC_PROGRESS}${policyID}`,
             value: {
-                stageInProgress: CONST.POLICY.CONNECTIONS.SYNC_STAGE_NAME.STARTING_IMPORT,
+                stageInProgress: isQBOConnection ? CONST.POLICY.CONNECTIONS.SYNC_STAGE_NAME.STARTING_IMPORT_QBO : CONST.POLICY.CONNECTIONS.SYNC_STAGE_NAME.STARTING_IMPORT_XERO,
                 connectionName,
             },
         },
@@ -147,7 +148,7 @@ function syncConnection(policyID: string, connectionName: PolicyConnectionName |
     ];
 
     const parameters: SyncPolicyToQuickbooksOnlineParams | SyncPolicyToXeroParams =
-        connectionName === CONST.POLICY.CONNECTIONS.NAME.QBO
+    isQBOConnection
             ? ({
                   policyID,
                   idempotencyKey: policyID,
@@ -157,7 +158,7 @@ function syncConnection(policyID: string, connectionName: PolicyConnectionName |
                   idempotencyKey: policyID,
               } as SyncPolicyToXeroParams);
 
-    API.read(connectionName === CONST.POLICY.CONNECTIONS.NAME.QBO ? READ_COMMANDS.SYNC_POLICY_TO_QUICKBOOKS_ONLINE : READ_COMMANDS.SYNC_POLICY_TO_XERO, parameters, {
+    API.read(isQBOConnection ? READ_COMMANDS.SYNC_POLICY_TO_QUICKBOOKS_ONLINE : READ_COMMANDS.SYNC_POLICY_TO_XERO, parameters, {
         optimisticData,
         failureData,
     });

From 1dde849ed5f794b626805eac0357ce2496c32004 Mon Sep 17 00:00:00 2001
From: Hans <visaocuoitroi193@gmail.com>
Date: Mon, 20 May 2024 17:08:15 +0700
Subject: [PATCH 2/3] fix prettier

---
 src/libs/actions/connections/index.ts | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/src/libs/actions/connections/index.ts b/src/libs/actions/connections/index.ts
index ee858a290849..424016af38af 100644
--- a/src/libs/actions/connections/index.ts
+++ b/src/libs/actions/connections/index.ts
@@ -147,16 +147,15 @@ function syncConnection(policyID: string, connectionName: PolicyConnectionName |
         },
     ];
 
-    const parameters: SyncPolicyToQuickbooksOnlineParams | SyncPolicyToXeroParams =
-    isQBOConnection
-            ? ({
-                  policyID,
-                  idempotencyKey: policyID,
-              } as SyncPolicyToQuickbooksOnlineParams)
-            : ({
-                  policyID,
-                  idempotencyKey: policyID,
-              } as SyncPolicyToXeroParams);
+    const parameters: SyncPolicyToQuickbooksOnlineParams | SyncPolicyToXeroParams = isQBOConnection
+        ? ({
+              policyID,
+              idempotencyKey: policyID,
+          } as SyncPolicyToQuickbooksOnlineParams)
+        : ({
+              policyID,
+              idempotencyKey: policyID,
+          } as SyncPolicyToXeroParams);
 
     API.read(isQBOConnection ? READ_COMMANDS.SYNC_POLICY_TO_QUICKBOOKS_ONLINE : READ_COMMANDS.SYNC_POLICY_TO_XERO, parameters, {
         optimisticData,

From c444695c14feeab15fafa082dc81ac2155a696cf Mon Sep 17 00:00:00 2001
From: Hans <visaocuoitroi193@gmail.com>
Date: Mon, 20 May 2024 17:11:45 +0700
Subject: [PATCH 3/3] update Spanish translation

---
 src/languages/es.ts | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/languages/es.ts b/src/languages/es.ts
index 7183a466a0d4..ef2e27275775 100644
--- a/src/languages/es.ts
+++ b/src/languages/es.ts
@@ -2401,9 +2401,9 @@ export default {
                         case 'quickbooksOnlineImportMain':
                             return 'Importando datos desde QuickBooks Online';
                         case 'startingImportXero':
-                            return 'Importing your Xero data';
+                            return 'Importando datos desde Xero';
                         case 'startingImportQBO':
-                            return 'Importing your QuickBooks Online data';
+                            return 'Importando datos desde QuickBooks Online';
                         case 'quickbooksOnlineSyncTitle':
                             return 'Sincronizando datos desde QuickBooks Online';
                         case 'quickbooksOnlineSyncLoadData':
