Skip to content

Commit 5ab455b

Browse files
committed
Code reverts
1 parent e261fc0 commit 5ab455b

5 files changed

Lines changed: 21 additions & 58 deletions

File tree

src/CONST/index.ts

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2912,10 +2912,6 @@ const CONST = {
29122912
XERO: 'xero',
29132913
NETSUITE: 'netsuite',
29142914
SAGE_INTACCT: 'intacct',
2915-
ORACLE: 'oracle',
2916-
SAP: 'sap',
2917-
MICROSOFT_DYNAMICS: 'microsoftDynamics',
2918-
OTHER: 'other',
29192915
},
29202916
ROUTE: {
29212917
QBO: 'quickbooks-online',
@@ -2938,6 +2934,7 @@ const CONST = {
29382934
microsoftDynamics: 'Microsoft Dynamics',
29392935
other: 'Other',
29402936
},
2937+
CORPORATE: ['quickbooksDesktop', 'netsuite', 'intacct', 'oracle', 'sap', 'microsoftDynamics', 'other'],
29412938
AUTH_HELP_LINKS: {
29422939
intacct:
29432940
"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.",
@@ -3016,20 +3013,7 @@ const CONST = {
30163013
},
30173014
SYNC_STAGE_TIMEOUT_MINUTES: 20,
30183015
},
3019-
get POLICY_CONNECTIONS_TYPE_CORPORATE() {
3020-
return [
3021-
this.CONNECTIONS.NAME.QBD,
3022-
this.CONNECTIONS.NAME.NETSUITE,
3023-
this.CONNECTIONS.NAME.SAGE_INTACCT,
3024-
this.CONNECTIONS.NAME.ORACLE,
3025-
this.CONNECTIONS.NAME.SAP,
3026-
this.CONNECTIONS.NAME.MICROSOFT_DYNAMICS,
3027-
this.CONNECTIONS.NAME.OTHER,
3028-
];
3029-
},
3030-
get POLICY_CONNECTIONS_SUPPORTED() {
3031-
return [this.CONNECTIONS.NAME.QBO, this.CONNECTIONS.NAME.XERO, this.CONNECTIONS.NAME.NETSUITE, this.CONNECTIONS.NAME.SAGE_INTACCT, this.CONNECTIONS.NAME.QBD];
3032-
},
3016+
30333017
ACCESS_VARIANTS: {
30343018
PAID: 'paid',
30353019
ADMIN: 'admin',

src/libs/actions/Policy/Policy.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1900,9 +1900,7 @@ function buildPolicyData(options: BuildPolicyDataOptions = {}) {
19001900

19011901
// Determine workspace type based on user reported integration
19021902
const workspaceType =
1903-
userReportedIntegration && (CONST.POLICY.POLICY_CONNECTIONS_TYPE_CORPORATE as readonly string[]).includes(userReportedIntegration)
1904-
? CONST.POLICY.TYPE.CORPORATE
1905-
: CONST.POLICY.TYPE.TEAM;
1903+
userReportedIntegration && (CONST.POLICY.CONNECTIONS.CORPORATE as readonly string[]).includes(userReportedIntegration) ? CONST.POLICY.TYPE.CORPORATE : CONST.POLICY.TYPE.TEAM;
19061904

19071905
// WARNING: The data below should be kept in sync with the API so we create the policy with the correct configuration.
19081906
const optimisticData: OnyxUpdate[] = [

src/pages/workspace/accounting/PolicyAccountingPage.tsx

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -91,16 +91,9 @@ function PolicyAccountingPage({policy}: PolicyAccountingPageProps) {
9191
const allCardSettings = useExpensifyCardFeeds(policyID);
9292
const isSyncInProgress = isConnectionInProgress(connectionSyncProgress, policy);
9393

94-
// Type guard to ensure we only use supported connections
95-
const accountingIntegrations = CONST.POLICY.POLICY_CONNECTIONS_SUPPORTED;
96-
const getSupportedConnection = (connectionName: string | undefined): ConnectionName | undefined => {
97-
if (!connectionName || !(accountingIntegrations as readonly string[]).includes(connectionName)) {
98-
return undefined;
99-
}
100-
return connectionName as ConnectionName;
101-
};
102-
103-
const connectedIntegration = getSupportedConnection(getConnectedIntegration(policy, accountingIntegrations)) ?? getSupportedConnection(connectionSyncProgress?.connectionName);
94+
const connectionNames = CONST.POLICY.CONNECTIONS.NAME;
95+
const accountingIntegrations = Object.values(connectionNames);
96+
const connectedIntegration = getConnectedIntegration(policy, accountingIntegrations) ?? connectionSyncProgress?.connectionName;
10497
const synchronizationError = connectedIntegration && getSynchronizationErrorMessage(policy, connectedIntegration, isSyncInProgress, translate, styles);
10598

10699
const shouldShowEnterCredentials = connectedIntegration && !!synchronizationError && isAuthenticationError(policy, connectedIntegration);
@@ -109,7 +102,7 @@ function PolicyAccountingPage({policy}: PolicyAccountingPageProps) {
109102
const successfulDate = getIntegrationLastSuccessfulDate(
110103
getLocalDateFromDatetime,
111104
connectedIntegration ? policy?.connections?.[connectedIntegration] : undefined,
112-
connectedIntegration === getSupportedConnection(connectionSyncProgress?.connectionName) ? connectionSyncProgress : undefined,
105+
connectedIntegration === connectionSyncProgress?.connectionName ? connectionSyncProgress : undefined,
113106
);
114107

115108
const hasSyncError = shouldShowSyncError(policy, isSyncInProgress);
@@ -521,7 +514,7 @@ function PolicyAccountingPage({policy}: PolicyAccountingPageProps) {
521514
}
522515
// Else, display the following and link to their Concierge DM.
523516
return [translate('workspace.accounting.talkToConcierge'), conciergeReportID];
524-
}, [account, conciergeReportID, policy?.chatReportIDAdmins, translate]);
517+
}, [account, conciergeReportID, translate]);
525518

526519
return (
527520
<AccessOrNotFoundWrapper

src/pages/workspace/accounting/utils.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,12 +337,11 @@ function getSynchronizationErrorMessage(
337337
const syncError = translateLocal('workspace.accounting.syncError', {connectionName});
338338

339339
const connection = policy?.connections?.[connectionName];
340-
const lastSync = connection?.lastSync;
341-
if (isSyncInProgress || isEmptyObject(lastSync) || lastSync?.isSuccessful !== false || !lastSync?.errorDate) {
340+
if (isSyncInProgress || isEmptyObject(connection?.lastSync) || connection?.lastSync?.isSuccessful !== false || !connection?.lastSync?.errorDate) {
342341
return;
343342
}
344343

345-
return `${syncError} ("${lastSync?.errorMessage}")`;
344+
return `${syncError} ("${connection?.lastSync?.errorMessage}")`;
346345
}
347346

348347
function getQBDReimbursableAccounts(

src/types/onyx/Policy.ts

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1384,31 +1384,20 @@ type Connections = {
13841384

13851385
/** QuickBooks Desktop integration connection */
13861386
[CONST.POLICY.CONNECTIONS.NAME.QBD]: Connection<QBDConnectionData, QBDConnectionConfig>;
1387+
};
13871388

1388-
/** Other connection for onboarding flow */
1389-
other?: Connection<Record<string, unknown>, Record<string, unknown>>;
1390-
1391-
/** SAP connection for onboarding flow */
1392-
sap?: Connection<Record<string, unknown>, Record<string, unknown>>;
1393-
1394-
/** Oracle connection for onboarding flow */
1395-
oracle?: Connection<Record<string, unknown>, Record<string, unknown>>;
1396-
1397-
/** Microsoft Dynamics connection for onboarding flow */
1398-
microsoftDynamics?: Connection<Record<string, unknown>, Record<string, unknown>>;
1399-
1400-
/** Bill.com connection for onboarding flow */
1401-
billCom?: Connection<Record<string, unknown>, Record<string, unknown>>;
1402-
1403-
/** Zenefits connection for onboarding flow */
1404-
zenefits?: Connection<Record<string, unknown>, Record<string, unknown>>;
1389+
/** All integration connections, including unsupported ones */
1390+
type AllConnections = Connections & {
1391+
/** Quickbooks Desktop integration connection */
1392+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
1393+
quickbooksDesktop: any;
14051394
};
14061395

1407-
/** Names of officially supported integration connections */
1408-
type ConnectionName = ValueOf<typeof CONST.POLICY.CONNECTIONS.NAME>;
1396+
/** Names of integration connections */
1397+
type ConnectionName = keyof Connections;
14091398

1410-
/** Names of all integration connections including onboarding types */
1411-
type AllConnectionName = ConnectionName | keyof typeof CONST.POLICY.CONNECTIONS.NAME_USER_FRIENDLY;
1399+
/** Names of all integration connections */
1400+
type AllConnectionName = keyof AllConnections;
14121401

14131402
/** Merchant Category Code. This is a way to identify the type of merchant (and type of spend) when a credit card is swiped. */
14141403
type MccGroup = {
@@ -1921,7 +1910,7 @@ type Policy = OnyxCommon.OnyxValueWithOfflineFeedback<
19211910
type PolicyConnectionSyncStage = ValueOf<typeof CONST.POLICY.CONNECTIONS.SYNC_STAGE_NAME>;
19221911

19231912
/** Names of policy connection services */
1924-
type PolicyConnectionName = ValueOf<typeof CONST.POLICY.CONNECTIONS.NAME>;
1913+
type PolicyConnectionName = ConnectionName;
19251914

19261915
/** Policy connection sync progress state */
19271916
type PolicyConnectionSyncProgress = {

0 commit comments

Comments
 (0)