Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#Wave-Control: Add NetSuite]: Settings Configuration in NewDot: Import Mapping #44743

Merged
merged 61 commits into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from 55 commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
10cad3e
feat: route setup
mananjadhav Jun 30, 2024
9f82a3b
fix: import field param
mananjadhav Jun 30, 2024
ede7cc0
feat: page header with selection list
mananjadhav Jun 30, 2024
6d43b7f
feat: populate the list with the options
mananjadhav Jul 1, 2024
2c3923e
feat: added the footer content
mananjadhav Jul 1, 2024
5d6be1c
Merge branch 'mj-netsuite-import-list-screen' into mj-netsuite-import…
mananjadhav Jul 1, 2024
69c36eb
Merge branch 'mj-netsuite-import-list-screen' into mj-netsuite-import…
mananjadhav Jul 1, 2024
c147736
fix: remove duplicate props
mananjadhav Jul 1, 2024
dafdea8
Merge branch 'main' of github.com:mananjadhav/App into mj-netsuite-im…
mananjadhav Jul 1, 2024
94c8da8
Merge branch 'mj-netsuite-import-list-screen' into mj-netsuite-import…
mananjadhav Jul 2, 2024
ffadb40
Merge branch 'mj-netsuite-import-list-screen' into mj-netsuite-import…
mananjadhav Jul 2, 2024
b332bfa
feat: added spanish translations
mananjadhav Jul 2, 2024
e15f141
fix: added api commands
mananjadhav Jul 2, 2024
bb8bcba
feat: added api call and fix footer content
mananjadhav Jul 2, 2024
c82dcb0
feat: added api call
mananjadhav Jul 2, 2024
6d60f4d
refactor: fix types
mananjadhav Jul 2, 2024
7222bac
refactor: adjusted offline types
mananjadhav Jul 2, 2024
2cf060a
fix: offline types for syncTax
mananjadhav Jul 2, 2024
023b21d
refactor: run prettier
mananjadhav Jul 2, 2024
168ff6d
refactor: add pendingFields
mananjadhav Jul 2, 2024
dc648fb
fix: rollback menu item key
mananjadhav Jul 2, 2024
af98de0
Merge branch 'mj-netsuite-import-list-screen' into mj-netsuite-import…
mananjadhav Jul 2, 2024
ab2359e
refactor: run prettier
mananjadhav Jul 2, 2024
6c877b3
refactor: run prettier
mananjadhav Jul 2, 2024
c93a371
feat: added translations
mananjadhav Jul 2, 2024
fd265ee
refactor: update types
mananjadhav Jul 2, 2024
5c00308
feat: update api calls for cross subsidiary
mananjadhav Jul 2, 2024
5fa854d
fix: styling overlap
mananjadhav Jul 2, 2024
2281c0b
Merge branch 'mj-netsuite-import-list-screen' into mj-netsuite-import…
mananjadhav Jul 2, 2024
c48176f
Merge branch 'main' of github.com:mananjadhav/App into mj-netsuite-im…
mananjadhav Jul 2, 2024
ddcfb46
refactor: run prettier
mananjadhav Jul 2, 2024
03e4526
refactor: fix type errors
mananjadhav Jul 2, 2024
6d79e8d
fix: styling issue
mananjadhav Jul 2, 2024
7be1c03
fix: redirect if same value
mananjadhav Jul 2, 2024
2dbcffb
refactor: run prettier
mananjadhav Jul 2, 2024
faccfbc
Merge branch 'main' of github.com:mananjadhav/App into mj-netsuite-im…
mananjadhav Jul 2, 2024
911dace
Merge branch 'main' of github.com:mananjadhav/App into mj-netsuite-im…
mananjadhav Jul 3, 2024
253dca9
feat: split the customers as a new route
mananjadhav Jul 3, 2024
fb66be5
feat: added menu items
mananjadhav Jul 3, 2024
bf06c5a
refactor: code cleanup
mananjadhav Jul 3, 2024
92aa8aa
feat: update toggle api calls
mananjadhav Jul 3, 2024
441ab6f
feat: hide displayed as conditionally
mananjadhav Jul 3, 2024
29d8a83
refactor: rename file
mananjadhav Jul 3, 2024
82056f8
refactor: rename routes
mananjadhav Jul 3, 2024
64c12cf
feat: added displayed as page
mananjadhav Jul 3, 2024
70f82de
fix: api call
mananjadhav Jul 3, 2024
ce909a9
feat: added label translations
mananjadhav Jul 3, 2024
d62f1aa
Merge branch 'main' of github.com:mananjadhav/App into mj-netsuite-im…
mananjadhav Jul 3, 2024
5bacddd
refactor: design updates
mananjadhav Jul 4, 2024
dccc36b
refactor: design updates
mananjadhav Jul 4, 2024
244dff7
fix: added back
mananjadhav Jul 4, 2024
a661387
fix: field lower case
mananjadhav Jul 4, 2024
e1d55ce
refactor: use const
mananjadhav Jul 4, 2024
b2d59e8
Merge branch 'main' of github.com:mananjadhav/App into mj-netsuite-im…
mananjadhav Jul 4, 2024
4ebd514
fix: truncate
mananjadhav Jul 4, 2024
65ead54
Merge branch 'main' of github.com:mananjadhav/App into mj-netsuite-im…
mananjadhav Jul 4, 2024
ee5e345
fix: back handler
mananjadhav Jul 4, 2024
226b0da
Merge branch 'main' of github.com:mananjadhav/App into mj-netsuite-im…
mananjadhav Jul 4, 2024
cddfd35
refactor: rename const
mananjadhav Jul 4, 2024
4608775
refactor: simplify condition
mananjadhav Jul 4, 2024
3acf1ab
refactor: run prettier
mananjadhav Jul 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1373,10 +1373,15 @@ const CONST = {
PROVINCIAL_TAX_POSTING_ACCOUNT: 'provincialTaxPostingAccount',
ALLOW_FOREIGN_CURRENCY: 'allowForeignCurrency',
EXPORT_TO_NEXT_OPEN_PERIOD: 'exportToNextOpenPeriod',
IMPORT_FIELDS: ['departments', 'classes', 'locations', 'customers', 'jobs'],
IMPORT_FIELDS: ['departments', 'classes', 'locations'],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe move the remaining to syncOptions too.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't see any advantage for that. I am anyway looping through these and using as type.

IMPORT_CUSTOM_FIELDS: ['customSegments', 'customLists'],
SYNC_OPTIONS: {
SYNC_TAX: 'syncTax',
CROSS_SUBSIDIARY_CUSTOMERS: 'crossSubsidiaryCustomers',
MAPPING: {
mananjadhav marked this conversation as resolved.
Show resolved Hide resolved
CUSTOMERS: 'customers',
JOBS: 'jobs',
},
},
},

Expand Down
15 changes: 14 additions & 1 deletion src/ROUTES.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type {ValueOf} from 'type-fest';
import type {TupleToUnion, ValueOf} from 'type-fest';
import type CONST from './CONST';
import type {IOUAction, IOUType} from './CONST';
import type {IOURequestType} from './libs/actions/IOU';
Expand Down Expand Up @@ -964,6 +964,19 @@ const ROUTES = {
route: 'settings/workspaces/:policyID/accounting/netsuite/import',
getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/netsuite/import` as const,
},
POLICY_ACCOUNTING_NETSUITE_IMPORT_MAPPING: {
route: 'settings/workspaces/:policyID/accounting/netsuite/import/mapping/:importField',
getRoute: (policyID: string, importField: TupleToUnion<typeof CONST.NETSUITE_CONFIG.IMPORT_FIELDS>) =>
`settings/workspaces/${policyID}/accounting/netsuite/import/mapping/${importField}` as const,
},
POLICY_ACCOUNTING_NETSUITE_IMPORT_CUSTOMERS_OR_PROJECTS: {
route: 'settings/workspaces/:policyID/accounting/netsuite/import/customer-projects',
getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/netsuite/import/customer-projects` as const,
},
POLICY_ACCOUNTING_NETSUITE_IMPORT_CUSTOMERS_OR_PROJECTS_SELECT: {
route: 'settings/workspaces/:policyID/accounting/netsuite/import/customer-projects/select',
getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/netsuite/import/customer-projects/select` as const,
},
POLICY_ACCOUNTING_NETSUITE_EXPORT: {
route: 'settings/workspaces/:policyID/connections/netsuite/export/',
getRoute: (policyID: string) => `settings/workspaces/${policyID}/connections/netsuite/export/` as const,
Expand Down
3 changes: 3 additions & 0 deletions src/SCREENS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,9 @@ const SCREENS = {
XERO_EXPORT_PREFERRED_EXPORTER_SELECT: 'Workspace_Accounting_Xero_Export_Preferred_Exporter_Select',
XERO_BILL_PAYMENT_ACCOUNT_SELECTOR: 'Policy_Accounting_Xero_Bill_Payment_Account_Selector',
XERO_EXPORT_BANK_ACCOUNT_SELECT: 'Policy_Accounting_Xero_Export_Bank_Account_Select',
NETSUITE_IMPORT_MAPPING: 'Policy_Accounting_NetSuite_Import_Mapping',
NETSUITE_IMPORT_CUSTOMERS_OR_PROJECTS: 'Policy_Accounting_NetSuite_Import_CustomersOrProjects',
NETSUITE_IMPORT_CUSTOMERS_OR_PROJECTS_SELECT: 'Policy_Accounting_NetSuite_Import_CustomersOrProjects_Select',
NETSUITE_SUBSIDIARY_SELECTOR: 'Policy_Accounting_NetSuite_Subsidiary_Selector',
NETSUITE_IMPORT: 'Policy_Accounting_NetSuite_Import',
NETSUITE_EXPORT: 'Policy_Accounting_NetSuite_Export',
Expand Down
46 changes: 41 additions & 5 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {CONST as COMMON_CONST, Str} from 'expensify-common';
import {startCase} from 'lodash';
import CONST from '@src/CONST';
import type {Country} from '@src/CONST';
import type {ConnectionName, PolicyConnectionSyncStage} from '@src/types/onyx/Policy';
Expand Down Expand Up @@ -2306,18 +2307,53 @@ export default {
import: {
expenseCategories: 'Expense categories',
expenseCategoriesDescription: 'NetSuite expense categories import into Expensify as categories.',
crossSubsidiaryCustomers: 'Cross-subsidiary customer/projects',
importFields: {
departments: 'Departments',
classes: 'Classes',
locations: 'Locations',
customers: 'Customers',
jobs: 'Projects (jobs)',
departments: {
title: 'Departments',
subtitle: 'Choose how to handle the NetSuite *departments* in Expensify.',
},
classes: {
title: 'Classes',
subtitle: 'Choose how to handle *classes* in Expensify.',
},
locations: {
title: 'Locations',
subtitle: 'Choose how to handle *locations* in Expensify.',
},
},
customersOrJobs: {
title: 'Customers / projects',
subtitle: 'Choose how to handle NetSuite *customers* and *projects* in Expensify.',
importCustomers: 'Import customers',
importJobs: 'Import projects',
customers: 'customers',
jobs: 'projects',
label: (importFields: string[], importType: string) => `${importFields.join(' and ')}, ${importType}`,
},
importTaxDescription: 'Import tax groups from NetSuite',
importCustomFields: {
customSegments: 'Custom segments/records',
customLists: 'Custom lists',
},
importTypes: {
[CONST.INTEGRATION_ENTITY_MAP_TYPES.NETSUITE_DEFAULT]: {
label: 'NetSuite employee default',
description: 'Not imported into Expensify, applied on export',
footerContent: (importField: string) =>
`If you use ${importField} in NetSuite, we'll apply the default set on the employee record upon export to Expense Report or Journal Entry.`,
},
[CONST.INTEGRATION_ENTITY_MAP_TYPES.TAG]: {
label: 'Tags',
description: 'Line-item level',
footerContent: (importField: string) => `${startCase(importField)} will be selectable for each individual expense on an employee's report.`,
},
[CONST.INTEGRATION_ENTITY_MAP_TYPES.REPORT_FIELD]: {
label: 'Report fields',
description: 'Report level',
footerContent: (importField: string) => `${startCase(importField)} selection will apply to all expense on an employee's report.`,
},
},
},
},
intacct: {
Expand Down
47 changes: 41 additions & 6 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2347,18 +2347,53 @@ export default {
import: {
expenseCategories: 'Categorías de gastos',
expenseCategoriesDescription: 'Las categorías de gastos de NetSuite se importan a Expensify como categorías.',
crossSubsidiaryCustomers: 'Clientes/proyectos entre subsidiaria',
importFields: {
departments: 'Departamentos',
classes: 'Clases',
locations: 'Ubicaciones',
customers: 'Clientes',
jobs: 'Proyectos (trabajos)',
departments: {
title: 'Departamentos',
subtitle: 'Elige cómo manejar los *departamentos* de NetSuite en Expensify.',
},
classes: {
title: 'Clases',
subtitle: 'Elige cómo manejar las *clases* en Expensify.',
},
locations: {
title: 'Ubicaciones',
subtitle: 'Elija cómo manejar *ubicaciones* en Expensify.',
},
},
customersOrJobs: {
title: 'Clientes / proyectos',
subtitle: 'Elija cómo manejar los *clientes* y *proyectos* de NetSuite en Expensify.',
importCustomers: 'Importar clientes',
importJobs: 'Importar proyectos',
customers: 'clientes',
jobs: 'proyectos',
label: (importFields: string[], importType: string) => `${importFields.join(' y ')}, ${importType}`,
},
importTaxDescription: 'Importar grupos de impuestos desde NetSuite',
importCustomFields: {
customSegments: 'Segmentos/registros personalizado',
customLists: 'Listas personalizado',
},
importTypes: {
[CONST.INTEGRATION_ENTITY_MAP_TYPES.NETSUITE_DEFAULT]: {
label: 'Predeterminado del empleado NetSuite',
description: 'No importado a Expensify, aplicado en exportación',
footerContent: (importField: string) =>
`Si usa ${importField} en NetSuite, aplicaremos el conjunto predeterminado en el registro del empleado al exportarlo a Informe de gastos o Entrada de diario.`,
},
[CONST.INTEGRATION_ENTITY_MAP_TYPES.TAG]: {
label: 'Etiquetas',
description: 'Nivel de línea de pedido',
footerContent: (importField: string) => `Se podrán seleccionar ${importField} para cada gasto individual en el informe de un empleado.`,
},
[CONST.INTEGRATION_ENTITY_MAP_TYPES.REPORT_FIELD]: {
label: 'Campos de informe',
description: 'Nivel de informe',
footerContent: (importField: string) => `La selección de ${importField} se aplicará a todos los gastos en el informe de un empleado.`,
},
},
},
},
intacct: {
Expand Down Expand Up @@ -2675,7 +2710,7 @@ export default {
[CONST.INTEGRATION_ENTITY_MAP_TYPES.NOT_IMPORTED]: 'No importado',
[CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE]: 'No importado',
[CONST.INTEGRATION_ENTITY_MAP_TYPES.REPORT_FIELD]: 'Importado como campos de informe',
[CONST.INTEGRATION_ENTITY_MAP_TYPES.NETSUITE_DEFAULT]: 'NetSuite employee default',
[CONST.INTEGRATION_ENTITY_MAP_TYPES.NETSUITE_DEFAULT]: 'Predeterminado del empleado NetSuite',
},
disconnectPrompt: (currentIntegration?: ConnectionName): string => {
const integrationName =
Expand Down
12 changes: 12 additions & 0 deletions src/libs/API/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,12 @@ const WRITE_COMMANDS = {
UPDATE_NETSUITE_SUBSIDIARY: 'UpdateNetSuiteSubsidiary',
CREATE_WORKSPACE_REPORT_FIELD: 'CreatePolicyReportField',
UPDATE_NETSUITE_SYNC_TAX_CONFIGURATION: 'UpdateNetSuiteSyncTaxConfiguration',
UPDATE_NETSUITE_CROSS_SUBSIDIARY_CUSTOMER_CONFIGURATION: 'UpdateNetSuiteCrossSubsidiaryCustomerConfiguration',
UPDATE_NETSUITE_DEPARTMENTS_MAPPING: 'UpdateNetSuiteDepartmentsMapping',
UPDATE_NETSUITE_CLASSES_MAPPING: 'UpdateNetSuiteClassesMapping',
UPDATE_NETSUITE_LOCATIONS_MAPPING: 'UpdateNetSuiteLocationsMapping',
UPDATE_NETSUITE_CUSTOMERS_MAPPING: 'UpdateNetSuiteCustomersMapping',
UPDATE_NETSUITE_JOBS_MAPPING: 'UpdateNetSuiteJobsMapping',
UPDATE_NETSUITE_EXPORTER: 'UpdateNetSuiteExporter',
UPDATE_NETSUITE_EXPORT_DATE: 'UpdateNetSuiteExportDate',
UPDATE_NETSUITE_REIMBURSABLE_EXPENSES_EXPORT_DESTINATION: 'UpdateNetSuiteReimbursableExpensesExportDestination',
Expand Down Expand Up @@ -500,6 +506,12 @@ type WriteCommandParameters = {
[WRITE_COMMANDS.CREATE_WORKSPACE_REPORT_FIELD]: Parameters.CreateWorkspaceReportFieldParams;

[WRITE_COMMANDS.UPDATE_NETSUITE_SYNC_TAX_CONFIGURATION]: Parameters.UpdateNetSuiteGenericTypeParams<'enabled', boolean>;
[WRITE_COMMANDS.UPDATE_NETSUITE_CROSS_SUBSIDIARY_CUSTOMER_CONFIGURATION]: Parameters.UpdateNetSuiteGenericTypeParams<'enabled', boolean>;
[WRITE_COMMANDS.UPDATE_NETSUITE_DEPARTMENTS_MAPPING]: Parameters.UpdateNetSuiteGenericTypeParams<'mapping', ValueOf<typeof CONST.INTEGRATION_ENTITY_MAP_TYPES>>;
[WRITE_COMMANDS.UPDATE_NETSUITE_CLASSES_MAPPING]: Parameters.UpdateNetSuiteGenericTypeParams<'mapping', ValueOf<typeof CONST.INTEGRATION_ENTITY_MAP_TYPES>>;
[WRITE_COMMANDS.UPDATE_NETSUITE_LOCATIONS_MAPPING]: Parameters.UpdateNetSuiteGenericTypeParams<'mapping', ValueOf<typeof CONST.INTEGRATION_ENTITY_MAP_TYPES>>;
[WRITE_COMMANDS.UPDATE_NETSUITE_CUSTOMERS_MAPPING]: Parameters.UpdateNetSuiteGenericTypeParams<'mapping', ValueOf<typeof CONST.INTEGRATION_ENTITY_MAP_TYPES>>;
[WRITE_COMMANDS.UPDATE_NETSUITE_JOBS_MAPPING]: Parameters.UpdateNetSuiteGenericTypeParams<'mapping', ValueOf<typeof CONST.INTEGRATION_ENTITY_MAP_TYPES>>;
[WRITE_COMMANDS.UPDATE_NETSUITE_EXPORTER]: Parameters.UpdateNetSuiteGenericTypeParams<'email', string>;
[WRITE_COMMANDS.UPDATE_NETSUITE_EXPORT_DATE]: Parameters.UpdateNetSuiteGenericTypeParams<'value', ValueOf<typeof CONST.NETSUITE_EXPORT_DATE>>;
[WRITE_COMMANDS.UPDATE_NETSUITE_REIMBURSABLE_EXPENSES_EXPORT_DESTINATION]: Parameters.UpdateNetSuiteGenericTypeParams<'value', ValueOf<typeof CONST.NETSUITE_EXPORT_DESTINATION>>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,11 @@ const SettingsModalStackNavigator = createModalStackNavigator<SettingsNavigatorP

[SCREENS.WORKSPACE.ACCOUNTING.NETSUITE_SUBSIDIARY_SELECTOR]: () => require<ReactComponentModule>('../../../../pages/workspace/accounting/netsuite/NetSuiteSubsidiarySelector').default,
[SCREENS.WORKSPACE.ACCOUNTING.NETSUITE_IMPORT]: () => require<ReactComponentModule>('../../../../pages/workspace/accounting/netsuite/import/NetSuiteImportPage').default,
[SCREENS.WORKSPACE.ACCOUNTING.NETSUITE_IMPORT_MAPPING]: () => require<ReactComponentModule>('../../../../pages/workspace/accounting/netsuite/import/NetSuiteImportMappingPage').default,
[SCREENS.WORKSPACE.ACCOUNTING.NETSUITE_IMPORT_CUSTOMERS_OR_PROJECTS]: () =>
require<ReactComponentModule>('../../../../pages/workspace/accounting/netsuite/import/NetSuiteImportCustomersOrProjectsPage').default,
[SCREENS.WORKSPACE.ACCOUNTING.NETSUITE_IMPORT_CUSTOMERS_OR_PROJECTS_SELECT]: () =>
require<ReactComponentModule>('../../../../pages/workspace/accounting/netsuite/import/NetSuiteImportCustomersOrProjectSelectPage').default,
[SCREENS.WORKSPACE.ACCOUNTING.NETSUITE_EXPORT]: () => require<ReactComponentModule>('../../../../pages/workspace/accounting/netsuite/export/NetSuiteExportConfigurationPage').default,
[SCREENS.WORKSPACE.ACCOUNTING.NETSUITE_PREFERRED_EXPORTER_SELECT]: () =>
require<ReactComponentModule>('../../../../pages/workspace/accounting/netsuite/export/NetSuitePreferredExporterSelectPage').default,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ const FULL_SCREEN_TO_RHP_MAPPING: Partial<Record<FullScreenName, string[]>> = {
SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT_BANK_ACCOUNT_SELECT,
SCREENS.WORKSPACE.ACCOUNTING.NETSUITE_SUBSIDIARY_SELECTOR,
SCREENS.WORKSPACE.ACCOUNTING.NETSUITE_IMPORT,
SCREENS.WORKSPACE.ACCOUNTING.NETSUITE_IMPORT_MAPPING,
SCREENS.WORKSPACE.ACCOUNTING.NETSUITE_IMPORT_CUSTOMERS_OR_PROJECTS,
SCREENS.WORKSPACE.ACCOUNTING.NETSUITE_IMPORT_CUSTOMERS_OR_PROJECTS_SELECT,
SCREENS.WORKSPACE.ACCOUNTING.NETSUITE_EXPORT,
SCREENS.WORKSPACE.ACCOUNTING.NETSUITE_PREFERRED_EXPORTER_SELECT,
SCREENS.WORKSPACE.ACCOUNTING.NETSUITE_DATE_SELECT,
Expand Down
3 changes: 3 additions & 0 deletions src/libs/Navigation/linkingConfig/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,9 @@ const config: LinkingOptions<RootStackParamList>['config'] = {
[SCREENS.WORKSPACE.ACCOUNTING.XERO_BILL_PAYMENT_ACCOUNT_SELECTOR]: {path: ROUTES.POLICY_ACCOUNTING_XERO_BILL_PAYMENT_ACCOUNT_SELECTOR.route},
[SCREENS.WORKSPACE.ACCOUNTING.NETSUITE_SUBSIDIARY_SELECTOR]: {path: ROUTES.POLICY_ACCOUNTING_NETSUITE_SUBSIDIARY_SELECTOR.route},
[SCREENS.WORKSPACE.ACCOUNTING.NETSUITE_IMPORT]: {path: ROUTES.POLICY_ACCOUNTING_NETSUITE_IMPORT.route},
[SCREENS.WORKSPACE.ACCOUNTING.NETSUITE_IMPORT_MAPPING]: {path: ROUTES.POLICY_ACCOUNTING_NETSUITE_IMPORT_MAPPING.route},
[SCREENS.WORKSPACE.ACCOUNTING.NETSUITE_IMPORT_CUSTOMERS_OR_PROJECTS]: {path: ROUTES.POLICY_ACCOUNTING_NETSUITE_IMPORT_CUSTOMERS_OR_PROJECTS.route},
[SCREENS.WORKSPACE.ACCOUNTING.NETSUITE_IMPORT_CUSTOMERS_OR_PROJECTS_SELECT]: {path: ROUTES.POLICY_ACCOUNTING_NETSUITE_IMPORT_CUSTOMERS_OR_PROJECTS_SELECT.route},
[SCREENS.WORKSPACE.ACCOUNTING.NETSUITE_EXPORT]: {
path: ROUTES.POLICY_ACCOUNTING_NETSUITE_EXPORT.route,
},
Expand Down
12 changes: 11 additions & 1 deletion src/libs/Navigation/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type {
PartialState,
Route,
} from '@react-navigation/native';
import type {ValueOf} from 'type-fest';
import type {TupleToUnion, ValueOf} from 'type-fest';
import type {IOURequestType} from '@libs/actions/IOU';
import type {SearchColumnType, SortOrder} from '@libs/SearchUtils';
import type CONST from '@src/CONST';
Expand Down Expand Up @@ -419,6 +419,16 @@ type SettingsNavigatorParamList = {
[SCREENS.WORKSPACE.ACCOUNTING.NETSUITE_IMPORT]: {
policyID: string;
};
[SCREENS.WORKSPACE.ACCOUNTING.NETSUITE_IMPORT_CUSTOMERS_OR_PROJECTS]: {
policyID: string;
};
[SCREENS.WORKSPACE.ACCOUNTING.NETSUITE_IMPORT_CUSTOMERS_OR_PROJECTS_SELECT]: {
policyID: string;
};
[SCREENS.WORKSPACE.ACCOUNTING.NETSUITE_IMPORT_MAPPING]: {
policyID: string;
importField: TupleToUnion<typeof CONST.NETSUITE_CONFIG.IMPORT_FIELDS>;
};
[SCREENS.WORKSPACE.ACCOUNTING.NETSUITE_EXPORT]: {
policyID: string;
};
Expand Down
28 changes: 28 additions & 0 deletions src/libs/PolicyUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {Str} from 'expensify-common';
import type {OnyxCollection, OnyxEntry} from 'react-native-onyx';
import Onyx from 'react-native-onyx';
import type {ValueOf} from 'type-fest';
import type {LocaleContextProps} from '@components/LocaleContextProvider';
import type {SelectorType} from '@components/SelectionScreen';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
Expand Down Expand Up @@ -536,6 +537,32 @@ function canUseProvincialTaxNetSuite(subsidiaryCountry?: string) {
return subsidiaryCountry === '_canada';
}

function getCustomersOrJobsLabelNetSuite(policy: Policy | undefined, translate: LocaleContextProps['translate']): string | undefined {
const importMapping = policy?.connections?.netsuite?.options?.config?.syncOptions?.mapping;
if (!importMapping?.customers && !importMapping?.jobs) {
return undefined;
}
const importFields: string[] = [];
const importCustomer = importMapping?.customers ?? CONST.INTEGRATION_ENTITY_MAP_TYPES.NETSUITE_DEFAULT;
const importJobs = importMapping?.jobs ?? CONST.INTEGRATION_ENTITY_MAP_TYPES.NETSUITE_DEFAULT;
const importedValue = importMapping?.customers !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NETSUITE_DEFAULT ? importCustomer : importJobs;

if (!importedValue || importedValue === CONST.INTEGRATION_ENTITY_MAP_TYPES.NETSUITE_DEFAULT) {
mananjadhav marked this conversation as resolved.
Show resolved Hide resolved
return undefined;
}

if (importCustomer !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NETSUITE_DEFAULT) {
importFields.push(translate('workspace.netsuite.import.customersOrJobs.customers'));
}

if (importJobs !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NETSUITE_DEFAULT) {
importFields.push(translate('workspace.netsuite.import.customersOrJobs.jobs'));
}

const importedValueLabel = translate(`workspace.netsuite.import.customersOrJobs.label`, importFields, translate(`workspace.accounting.importTypes.${importedValue}`).toLowerCase());
return importedValueLabel.charAt(0).toUpperCase() + importedValueLabel.slice(1);
}

function getIntegrationLastSuccessfulDate(connection?: Connections[keyof Connections]) {
if (!connection) {
return undefined;
Expand Down Expand Up @@ -652,6 +679,7 @@ export {
navigateWhenEnableFeature,
getIntegrationLastSuccessfulDate,
getCurrentConnectionName,
getCustomersOrJobsLabelNetSuite,
};

export type {MemberEmailsToAccountIDs};
Loading
Loading