Skip to content

Commit

Permalink
Merge pull request #44743 from mananjadhav/mj-netsuite-import-field-p…
Browse files Browse the repository at this point in the history
…ages

[#Wave-Control: Add NetSuite]: Settings Configuration in NewDot: Import Mapping
  • Loading branch information
yuwenmemon authored Jul 4, 2024
2 parents fa75984 + 3acf1ab commit 2d5ede8
Show file tree
Hide file tree
Showing 17 changed files with 723 additions and 81 deletions.
7 changes: 6 additions & 1 deletion src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1372,6 +1372,7 @@ const CONST = {
PROVINCIAL_TAX_POSTING_ACCOUNT: 'provincialTaxPostingAccount',
ALLOW_FOREIGN_CURRENCY: 'allowForeignCurrency',
EXPORT_TO_NEXT_OPEN_PERIOD: 'exportToNextOpenPeriod',
IMPORT_FIELDS: ['departments', 'classes', 'locations'],
AUTO_SYNC: 'autoSync',
REIMBURSEMENT_ACCOUNT_ID: 'reimbursementAccountID',
COLLECTION_ACCOUNT: 'collectionAccount',
Expand All @@ -1386,7 +1387,6 @@ const CONST = {
3: 'createAccessToken',
4: 'enterCredentials',
},
IMPORT_FIELDS: ['departments', 'classes', 'locations', 'customers', 'jobs'],
IMPORT_CUSTOM_FIELDS: ['customSegments', 'customLists'],
SYNC_OPTIONS: {
SYNC_REIMBURSED_REPORTS: 'syncReimbursedReports',
Expand All @@ -1396,6 +1396,11 @@ const CONST = {
EXPORT_VENDOR_BILLS_TO: 'exportVendorBillsTo',
EXPORT_JOURNALS_TO: 'exportJournalsTo',
SYNC_TAX: 'syncTax',
CROSS_SUBSIDIARY_CUSTOMERS: 'crossSubsidiaryCustomers',
CUSTOMER_MAPPINGS: {
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 @@ -968,6 +968,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_TOKEN_INPUT: 'Policy_Accounting_NetSuite_Token_Input',
NETSUITE_SUBSIDIARY_SELECTOR: 'Policy_Accounting_NetSuite_Subsidiary_Selector',
NETSUITE_IMPORT: 'Policy_Accounting_NetSuite_Import',
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 @@ -2374,18 +2375,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 @@ -2416,18 +2416,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 personalizados',
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 @@ -2744,7 +2779,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 @@ -508,6 +514,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 @@ -323,6 +323,11 @@ const SettingsModalStackNavigator = createModalStackNavigator<SettingsNavigatorP
[SCREENS.WORKSPACE.ACCOUNTING.NETSUITE_TOKEN_INPUT]: () =>
require<ReactComponentModule>('../../../../pages/workspace/accounting/netsuite/NetSuiteTokenInput/NetSuiteTokenInputPage').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 @@ -58,6 +58,9 @@ const FULL_SCREEN_TO_RHP_MAPPING: Partial<Record<FullScreenName, string[]>> = {
SCREENS.WORKSPACE.ACCOUNTING.NETSUITE_SUBSIDIARY_SELECTOR,
SCREENS.WORKSPACE.ACCOUNTING.NETSUITE_TOKEN_INPUT,
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 @@ -356,6 +356,9 @@ const config: LinkingOptions<RootStackParamList>['config'] = {
[SCREENS.WORKSPACE.ACCOUNTING.NETSUITE_SUBSIDIARY_SELECTOR]: {path: ROUTES.POLICY_ACCOUNTING_NETSUITE_SUBSIDIARY_SELECTOR.route},
[SCREENS.WORKSPACE.ACCOUNTING.NETSUITE_TOKEN_INPUT]: {path: ROUTES.POLICY_ACCOUNTING_NETSUITE_TOKEN_INPUT.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 @@ -422,6 +422,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
Loading

0 comments on commit 2d5ede8

Please sign in to comment.