@zeniai/client-epic-state 5.2.67 → 5.2.69-beta0MM

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/lib/entity/aiCfo/aiCfoState.d.ts +2 -2
  2. package/lib/entity/billPay/billTransaction/billTransactionState.d.ts +2 -2
  3. package/lib/entity/chargeCardTransaction/chargeCardTransaction.d.ts +1 -1
  4. package/lib/entity/depositAccountTransaction/depositAccountTransaction.d.ts +1 -1
  5. package/lib/entity/invoicing/{product/productPayload.d.ts → invoicingCatalog/invoicingCatalogPayload.d.ts} +44 -6
  6. package/lib/entity/invoicing/{product/productPayload.js → invoicingCatalog/invoicingCatalogPayload.js} +50 -6
  7. package/lib/entity/invoicing/invoicingCatalog/invoicingCatalogReducer.d.ts +12 -0
  8. package/lib/entity/invoicing/{plan/planReducer.js → invoicingCatalog/invoicingCatalogReducer.js} +20 -21
  9. package/lib/entity/invoicing/{plan/planSelector.d.ts → invoicingCatalog/invoicingCatalogSelector.d.ts} +5 -6
  10. package/lib/entity/invoicing/{plan/planSelector.js → invoicingCatalog/invoicingCatalogSelector.js} +12 -12
  11. package/lib/entity/invoicing/{product/productState.d.ts → invoicingCatalog/invoicingCatalogState.d.ts} +42 -6
  12. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +1 -0
  13. package/lib/entity/jeSchedules/jeSchedulesPayload.js +1 -0
  14. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +1 -0
  15. package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +4 -4
  16. package/lib/esm/entity/invoicing/{product/productPayload.js → invoicingCatalog/invoicingCatalogPayload.js} +46 -3
  17. package/lib/esm/entity/invoicing/{plan/planReducer.js → invoicingCatalog/invoicingCatalogReducer.js} +19 -20
  18. package/lib/esm/entity/invoicing/{plan/planSelector.js → invoicingCatalog/invoicingCatalogSelector.js} +8 -8
  19. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +1 -0
  20. package/lib/esm/index.js +5 -7
  21. package/lib/esm/reducer.js +4 -7
  22. package/lib/esm/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +19 -16
  23. package/lib/esm/view/invoicing/createInvoice/createInvoiceSelector.js +1 -1
  24. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +5 -3
  25. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/fetchInvoicingCatalogItemDetailEpic.js +2 -2
  26. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/runInvoicingCatalogPlanActionEpic.js +2 -2
  27. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/runInvoicingCatalogProductActionEpic.js +4 -4
  28. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +3 -7
  29. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/seedInvoicingCatalogItemFormDraftEpic.js +2 -2
  30. package/lib/esm/view/invoicing/invoicingCatalogListView/epics/fetchInvoicingCatalogPlanListEpic.js +2 -2
  31. package/lib/esm/view/invoicing/invoicingCatalogListView/epics/fetchInvoicingCatalogProductListEpic.js +2 -2
  32. package/lib/esm/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewSelector.js +4 -4
  33. package/lib/esm/view/onboardingView/customerView/epic/customerDetails/updateOnboardingCustomerViewEpic.js +31 -11
  34. package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewReducer.js +2 -1
  35. package/lib/index.d.ts +10 -13
  36. package/lib/index.js +12 -18
  37. package/lib/reducer.d.ts +1 -2
  38. package/lib/reducer.js +4 -7
  39. package/lib/rootStateTypes.d.ts +3 -5
  40. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +2 -2
  41. package/lib/view/expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.d.ts +2 -1
  42. package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +19 -16
  43. package/lib/view/expenseAutomationView/types/actualMatchingViewState.d.ts +2 -3
  44. package/lib/view/invoicing/createInvoice/createInvoiceSelector.d.ts +2 -2
  45. package/lib/view/invoicing/createInvoice/createInvoiceSelector.js +2 -2
  46. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.d.ts +8 -9
  47. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.d.ts +2 -2
  48. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +5 -3
  49. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/fetchInvoicingCatalogItemDetailEpic.d.ts +2 -2
  50. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/fetchInvoicingCatalogItemDetailEpic.js +2 -2
  51. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogItemFormHelper.d.ts +3 -4
  52. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/runInvoicingCatalogPlanActionEpic.d.ts +2 -2
  53. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/runInvoicingCatalogPlanActionEpic.js +2 -2
  54. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/runInvoicingCatalogProductActionEpic.d.ts +2 -3
  55. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/runInvoicingCatalogProductActionEpic.js +4 -4
  56. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.d.ts +2 -3
  57. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +3 -7
  58. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/seedInvoicingCatalogItemFormDraftEpic.js +2 -2
  59. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewSelector.d.ts +2 -2
  60. package/lib/view/invoicing/invoicingCatalogListView/epics/fetchInvoicingCatalogListPageEpic.d.ts +2 -2
  61. package/lib/view/invoicing/invoicingCatalogListView/epics/fetchInvoicingCatalogPlanListEpic.d.ts +2 -2
  62. package/lib/view/invoicing/invoicingCatalogListView/epics/fetchInvoicingCatalogPlanListEpic.js +2 -2
  63. package/lib/view/invoicing/invoicingCatalogListView/epics/fetchInvoicingCatalogProductListEpic.d.ts +2 -2
  64. package/lib/view/invoicing/invoicingCatalogListView/epics/fetchInvoicingCatalogProductListEpic.js +2 -2
  65. package/lib/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewPayload.d.ts +3 -3
  66. package/lib/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewSelector.d.ts +4 -5
  67. package/lib/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewSelector.js +4 -4
  68. package/lib/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewState.d.ts +1 -1
  69. package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewReducer.d.ts +1 -1
  70. package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewState.d.ts +1 -1
  71. package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewReducer.d.ts +1 -1
  72. package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewState.d.ts +1 -1
  73. package/lib/view/onboardingView/customerView/epic/customerDetails/updateOnboardingCustomerViewEpic.js +31 -11
  74. package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.d.ts +3 -2
  75. package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.js +2 -1
  76. package/lib/view/onboardingView/customerView/onboardingCustomerViewState.d.ts +4 -0
  77. package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
  78. package/lib/view/spendManagement/billPay/billList/billListReducer.d.ts +5 -5
  79. package/lib/view/spendManagement/billPay/billList/billListState.d.ts +1 -1
  80. package/lib/view/spendManagement/billPay/editBillView/editBillViewReducer.d.ts +2 -2
  81. package/lib/view/spendManagement/commonSetup/types/businessVerification.d.ts +2 -1
  82. package/lib/view/spendManagement/reimbursement/editRemiView/editRemiViewReducer.d.ts +2 -2
  83. package/lib/view/spendManagement/reimbursement/remiListView/remiListReducer.d.ts +5 -5
  84. package/lib/view/spendManagement/reimbursement/remiListView/remiListState.d.ts +2 -2
  85. package/package.json +1 -1
  86. package/lib/entity/invoicing/plan/planPayload.d.ts +0 -40
  87. package/lib/entity/invoicing/plan/planPayload.js +0 -51
  88. package/lib/entity/invoicing/plan/planReducer.d.ts +0 -14
  89. package/lib/entity/invoicing/plan/planState.d.ts +0 -43
  90. package/lib/entity/invoicing/product/productReducer.d.ts +0 -9
  91. package/lib/entity/invoicing/product/productReducer.js +0 -50
  92. package/lib/entity/invoicing/product/productSelector.d.ts +0 -4
  93. package/lib/entity/invoicing/product/productSelector.js +0 -17
  94. package/lib/entity/invoicing/product/productState.js +0 -2
  95. package/lib/esm/entity/invoicing/plan/planPayload.js +0 -47
  96. package/lib/esm/entity/invoicing/product/productReducer.js +0 -43
  97. package/lib/esm/entity/invoicing/product/productSelector.js +0 -10
  98. package/lib/esm/entity/invoicing/product/productState.js +0 -1
  99. /package/lib/entity/invoicing/{plan/planState.js → invoicingCatalog/invoicingCatalogState.js} +0 -0
  100. /package/lib/esm/entity/invoicing/{plan/planState.js → invoicingCatalog/invoicingCatalogState.js} +0 -0
@@ -1,44 +1,43 @@
1
1
  import { createSlice } from '@reduxjs/toolkit';
2
2
  import assignWith from 'lodash/assignWith';
3
3
  import { clearAll } from '../../../rootActions';
4
- import { mapInvoicingProductPayloadToState, } from '../product/productPayload';
5
- import { mapInvoicingPlanPayloadToState, } from './planPayload';
6
- export const initialState = { planByID: {} };
7
- const plan = createSlice({
8
- name: 'invoicingPlan',
4
+ import { mapInvoicingCatalogItemPayloadToState, mapInvoicingCatalogPricePointPayloadToState, } from './invoicingCatalogPayload';
5
+ export const initialState = { itemByID: {} };
6
+ const invoicingCatalog = createSlice({
7
+ name: 'invoicingCatalog',
9
8
  initialState,
10
9
  reducers: {
11
- updateInvoicingPlans: {
10
+ updateInvoicingCatalogItems: {
12
11
  reducer(draft, action) {
13
- doUpdateInvoicingPlans(draft.planByID, action.payload, action.meta.updateType);
12
+ doUpdateInvoicingPlans(draft.itemByID, action.payload, action.meta.updateType);
14
13
  },
15
14
  prepare(payload, updateType = 'replace') {
16
15
  return { payload, meta: { updateType } };
17
16
  },
18
17
  },
19
- removeInvoicingPlan(draft, action) {
20
- delete draft.planByID[action.payload];
18
+ removeInvoicingCatalogItem(draft, action) {
19
+ delete draft.itemByID[action.payload];
21
20
  },
22
- mergeInvoicingPlanSubFamily: {
21
+ mergeInvoicingCatalogPricePoint: {
23
22
  reducer(draft, action) {
24
- const plan = draft.planByID[action.payload.planId];
25
- if (plan == null) {
23
+ const item = draft.itemByID[action.payload.itemId];
24
+ if (item == null) {
26
25
  return;
27
26
  }
28
- const existing = plan.subFamilies ?? [];
27
+ const existing = item.subFamilies ?? [];
29
28
  const index = existing.findIndex((subFamily) => subFamily.id === action.payload.subFamily.id);
30
- plan.subFamilies =
29
+ item.subFamilies =
31
30
  index >= 0
32
31
  ? existing.map((subFamily, subFamilyIndex) => subFamilyIndex === index
33
32
  ? { ...subFamily, ...action.payload.subFamily }
34
33
  : subFamily)
35
34
  : [...existing, action.payload.subFamily];
36
35
  },
37
- prepare(planId, subFamilyPayload) {
36
+ prepare(itemId, subFamilyPayload) {
38
37
  return {
39
38
  payload: {
40
- planId,
41
- subFamily: mapInvoicingProductPayloadToState(subFamilyPayload),
39
+ itemId,
40
+ subFamily: mapInvoicingCatalogPricePointPayloadToState(subFamilyPayload),
42
41
  },
43
42
  };
44
43
  },
@@ -50,14 +49,14 @@ const plan = createSlice({
50
49
  });
51
50
  },
52
51
  });
53
- export const { updateInvoicingPlans, mergeInvoicingPlanSubFamily, removeInvoicingPlan, } = plan.actions;
54
- export default plan.reducer;
52
+ export const { updateInvoicingCatalogItems, mergeInvoicingCatalogPricePoint, removeInvoicingCatalogItem, } = invoicingCatalog.actions;
53
+ export default invoicingCatalog.reducer;
55
54
  /**
56
55
  * Helper functions.
57
56
  */
58
57
  function doUpdateInvoicingPlans(draft, payload, updateType) {
59
58
  payload.forEach((planPayload) => {
60
- const latestPlan = mapInvoicingPlanPayloadToState(planPayload);
59
+ const latestPlan = mapInvoicingCatalogItemPayloadToState(planPayload);
61
60
  if (latestPlan.id in draft && updateType === 'merge') {
62
61
  assignWith(draft[latestPlan.id], latestPlan, (objValue, srcValue) => srcValue == null ? objValue : srcValue);
63
62
  }
@@ -1,12 +1,12 @@
1
1
  import recordGet from 'lodash/get';
2
- export function getInvoicingPlansByIds(planState, ids) {
3
- const plans = ids
4
- .map((id) => getInvoicingPlanById(planState, id))
2
+ export function getInvoicingCatalogItemsByIds(catalogState, ids) {
3
+ const items = ids
4
+ .map((id) => getInvoicingCatalogItemById(catalogState, id))
5
5
  .filter((value) => value != null);
6
- return plans;
6
+ return items;
7
7
  }
8
- export function getInvoicingPlanById(planState, id) {
9
- return recordGet(planState.planByID, id);
8
+ export function getInvoicingCatalogItemById(catalogState, id) {
9
+ return recordGet(catalogState.itemByID, id);
10
10
  }
11
11
  /**
12
12
  * A price point counts while it is active. A missing status is treated as
@@ -30,8 +30,8 @@ export const invoicingPricePointDisplayAmount = (pricePoint) => pricePoint.displ
30
30
  * points are priced in different currencies, where the smallest number is not
31
31
  * the lowest price. A zero is a real price and wins on its merits.
32
32
  */
33
- export const getLowestInvoicingPlanPricePointAmount = (plan) => {
34
- const amounts = (plan?.subFamilies ?? [])
33
+ export const getLowestInvoicingCatalogPricePointAmount = (item) => {
34
+ const amounts = (item?.subFamilies ?? [])
35
35
  .filter(isActiveInvoicingPricePoint)
36
36
  .map(invoicingPricePointDisplayAmount)
37
37
  .filter((amount) => amount != null);
@@ -539,6 +539,7 @@ export function toJEOneTimeAccrual(payload) {
539
539
  transactionId: payload.transaction_id ?? undefined,
540
540
  transactionIntegrationId: payload.transaction_integration_id ?? undefined,
541
541
  reversalTransactionId: payload.reversal_transaction_id ?? undefined,
542
+ reversalTransactionIntegrationId: payload.reversal_transaction_integration_id ?? undefined,
542
543
  createdBy: toJEOneTimeAccrualCreator(payload.created_by_user),
543
544
  reversedBy: toJEOneTimeAccrualCreator(payload.reversed_by_user),
544
545
  };
package/lib/esm/index.js CHANGED
@@ -188,7 +188,7 @@ import { toExpenseAutomationViewType, toExpenseAutomationViewTypeStrict, } from
188
188
  import { computeNewScheduleJeDetails } from './view/expenseAutomationView/helpers/newScheduleLocalDataHelper';
189
189
  import { isReviewTransactionBankTransferType, isReviewTransactionBillPaymentType, isReviewTransactionCreditCardCreditType, isReviewTransactionCreditCardPaymentType, isReviewTransactionDepositType, isReviewTransactionExpenseType, } from './view/expenseAutomationView/helpers/reconciliationHelpers';
190
190
  import { MAX_SELECTION_LIMIT, checkIfAllLineItemsAreCategoryClassFilled, getLineItemsByTransactionIdsFromLocalData, isAnyItemWithUncategorizedExpenseAccount, } from './view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper';
191
- import { ackCloseMatchAfterIgnore, ackCloseMatchAfterUndo, clearActualMatchingView as clearExpenseAutomationActualMatchingView, clearMatchNewModal, closeMatchNewModal, fetchActualMatching as fetchExpenseAutomationActualMatching, fetchActualMatchingMatch, fetchActualMatchingPage as fetchExpenseAutomationActualMatchingPage, ignoreActualMatchingSuggestion, matchAndReverseAccruals, openMatchNewModal, searchMatchAccruals, searchMatchTransactions, undoReversalAccruals, updateActualMatchingUIState as updateExpenseAutomationActualMatchingUIState, } from './view/expenseAutomationView/reducers/actualMatchingViewReducer';
191
+ import { ackCloseMatchAfterIgnore, ackCloseMatchAfterUndo, clearActualMatchingView as clearExpenseAutomationActualMatchingView, clearMatchNewModal, closeMatchNewModal, fetchActualMatchingMatch, fetchActualMatching as fetchExpenseAutomationActualMatching, fetchActualMatchingPage as fetchExpenseAutomationActualMatchingPage, ignoreActualMatchingSuggestion, matchAndReverseAccruals, openMatchNewModal, searchMatchAccruals, searchMatchTransactions, undoReversalAccruals, updateActualMatchingUIState as updateExpenseAutomationActualMatchingUIState, } from './view/expenseAutomationView/reducers/actualMatchingViewReducer';
192
192
  import { clearExpenseAutomationFluxAnalysisView, fetchFluxAnalysisView, reviewFluxAnalysisView, updateFluxAnalysisViewPageMetaData, updateFluxAnalysisViewUIState, updateOperatingExpensesIdsForReview, updateSelectedSectionIdsForReview, } from './view/expenseAutomationView/reducers/fluxAnalysisViewReducer';
193
193
  import { clearJeScheduleLocalData as clearExpenseAutomationJEScheduleLocalData, clearExpenseAutomationJESchedulesView, clearSearchTransactionsForNewSchedule as clearJeSearchTransactionsForNewSchedule, createOneTimeAccrual, createOneTimeAccrualFailure, createOneTimeAccrualSuccess, fetchJeSchedulesPage as fetchExpenseAutomationJESchedulesPage, fetchOneTimeAccrual, ignoreRecommendedJeSchedule as ignoreExpenseAutomationJESchedule, ignoreOneTimeAccrual, initializeAccountSettingsView as initializeJeAccountSettingsView, initializeNewSchedule as initializeJeNewSchedule, initializeJeScheduleLocalData, promoteOneTimeAccrual, removeJeOneTimeAccrualLocalData, removeJeScheduleTransactionKey, resetNewScheduleLocalData as resetJeNewScheduleLocalData, retryJeSchedule as retryExpenseAutomationJESchedule, revertJeSchedule, revertOneTimeAccrual, saveAccountSettings as saveJeAccountSettings, saveAccountSettingsLocalData as saveJeAccountSettingsLocalData, saveNewSchedule as saveJeNewSchedule, saveNewScheduleFailure as saveJeNewScheduleFailure, saveNewScheduleSuccess as saveJeNewScheduleSuccess, searchTransactionsForNewSchedule as searchJeTransactionsForNewSchedule, searchTransactionsForNewScheduleFailure as searchJeTransactionsForNewScheduleFailure, searchTransactionsForNewScheduleSuccess as searchJeTransactionsForNewScheduleSuccess, toggleJECreatedGroupCollapsed, toggleJEFailedGroupCollapsed, toggleJEPendingGroupCollapsed, updateJESchedulesUIState as updateExpenseAutomationJESchedulesUIState, updateJEScheduleTypeFilter, updateNewScheduleLocalData as updateJeNewScheduleLocalData, updateJeOneTimeAccrualLocalData, updateJeScheduleLocalDataById, updateJeScheduleTransactionKeys, } from './view/expenseAutomationView/reducers/jeSchedulesViewReducer';
194
194
  import { acknowledgeBulkUploadConfirmMatchComplete, bulkUploadAutomatchingTimedOut, bulkUploadReceipts, bulkUploadReceiptsFailure, bulkUploadReceiptsSuccess, clearBulkUpload, clearBulkUploadBatchDetailsForScopeChange, clearManualSearchResults, clearMissingReceiptsTabNavigation, confirmBulkUploadMatch, confirmBulkUploadMatchFailure, confirmBulkUploadMatchSuccess, fetchBulkUploadBatchDetails, fetchBulkUploadBatchDetailsFailure, fetchBulkUploadBatchDetailsSuccess, fetchBulkUploadBatches, fetchBulkUploadBatchesFailure, fetchBulkUploadBatchesSuccess, fetchCompletedTransactions, fetchCompletedTransactionsFailure, fetchCompletedTransactionsSuccess, fetchMissingReceipts as fetchExpenseAutomationMissingReceipts, fetchMoreBatchDetails, fetchMoreBatchDetailsComplete, fetchMoreBatchDetailsFailure, markBatchDetailRefreshAttempted, markMissingReceiptAsDone as markExpenseAutomationMissingReceiptAsDone, pusherBatchStatusUpdate, refreshBatchDetailsForBatchId, requestMissingReceiptsTabNavigation, restoreBulkUploadAutomatchingOnMount, restoreBulkUploadMatchingState, searchTransactionsForManualMatch, searchTransactionsForManualMatchFailure, searchTransactionsForManualMatchSuccess, setBulkUploadCompletedSubTab, setBulkUploadResultsTab, setBulkUploadSortConfig, setBulkUploadUploadedFileCount, storeBatchDetails, updateBulkUploadProgress, updateMissingReceiptUploadState as updateExpenseAutomationMissingReceiptUploadState, updateMissingReceiptsUIState as updateExpenseAutomationMissingReceiptsUIState, uploadMissingReceiptSuccess as uploadExpenseAutomationMissingReceiptSuccess, } from './view/expenseAutomationView/reducers/missingReceiptsViewReducer';
@@ -200,7 +200,7 @@ import { getExpenseAutomationReconciliationView, getLedgerAccountIdsWithStatemen
200
200
  import { getExpenseAutomationTransactionView, getLastTransferEntryReplacement, } from './view/expenseAutomationView/selectors/transactionCategorizationSelector';
201
201
  import { applyTransactionFilters } from './view/expenseAutomationView/transactionFilterHelpers';
202
202
  import { TRANSACTION_FILTER_CATEGORIES, } from './view/expenseAutomationView/transactionFilterTypes';
203
- import { MATCH_ACCRUAL_SEARCH_LIMIT, MATCH_SEARCH_DEBOUNCE_MS, MATCH_TRANSACTION_SEARCH_PAGE_SIZE, ALL_ACTUAL_MATCHING_IGNORE_REASONS, actualMatchingTransactionLineKey, toActualMatchingIgnoreReasonType, toActualMatchingSortKey as toExpenseAutomationActualMatchingSortKey, toActualMatchingStatusFilter as toExpenseAutomationActualMatchingStatusFilter, toMatchAndReverseResultStatus, toUndoReversalResultStatus, } from './view/expenseAutomationView/types/actualMatchingViewState';
203
+ import { ALL_ACTUAL_MATCHING_IGNORE_REASONS, MATCH_ACCRUAL_SEARCH_LIMIT, MATCH_SEARCH_DEBOUNCE_MS, MATCH_TRANSACTION_SEARCH_PAGE_SIZE, actualMatchingTransactionLineKey, toActualMatchingIgnoreReasonType, toActualMatchingSortKey as toExpenseAutomationActualMatchingSortKey, toActualMatchingStatusFilter as toExpenseAutomationActualMatchingStatusFilter, toMatchAndReverseResultStatus, toUndoReversalResultStatus, } from './view/expenseAutomationView/types/actualMatchingViewState';
204
204
  import { DEFAULT_COMPLETED_SUB_TAB, toCompletedSubTab, } from './view/expenseAutomationView/types/completedSubTab';
205
205
  import { ALL_JE_PAGE_TABS, toJEScheduleSortKey as toExpenseAutomationJEScheduleSortKey, toJEPageTab, } from './view/expenseAutomationView/types/jeSchedulesViewState';
206
206
  import { BATCH_FILE_STATUSES, isUnmatchedTabFileStatus, toBatchFileStatus, toBatchStatusValue, toBulkUploadPhase, toBulkUploadResultsTab, toBulkUploadSortKey, toMatchSource, toMissingReceiptsTab, } from './view/expenseAutomationView/types/missingReceiptsViewState';
@@ -360,7 +360,7 @@ import { clearAiCardCreationFormDraft, fetchDepositAccountListForCards, fetchIss
360
360
  import { getAiCardCreationFormDraft, getInFlightIssueChargeCardsCount, getIssueChargeCardView, getIssueChargeCardsSaveStatus, getLastIssueChargeCardsSourceChatSessionId, getLastIssuedChargeCardIds, selectIssueChargeCardLocalDataFromDraft, } from './view/spendManagement/chargeCards/issueChargeCard/issueChargeCardSelector';
361
361
  import { toIssueChargeCardLocalDataFromDraft } from './view/spendManagement/chargeCards/issueChargeCard/toIssueChargeCardLocalDataFromDraft';
362
362
  import { parseUploadedKybDocument, parseUploadedKycDocument, } from './view/spendManagement/commonSetup/kycKybAutofillActions';
363
- import { applyKybDocumentAutofillForSetup, applyKycDocumentAutofillForSetup, clearKycKybAutofillForSetup, clearSetupViewDataInLocalStore, enableSetup, clearKycKybResetStatus, resetKycKyb, saveCompnayOfficerAdditionalDocumentsInLocalStore, saveCompnayOfficerPhoneInLocalStore, saveIndustryAndIncDateInLocalStore, saveSetupViewDataInLocalStore, saveTreasuryAdditionalDocumentsInLocalStore, updateBusinessVerificationDetails, updateSelectedCompanyOfficer, updateSetupViewLocalStoreData, } from './view/spendManagement/commonSetup/setupViewReducer';
363
+ import { applyKybDocumentAutofillForSetup, applyKycDocumentAutofillForSetup, clearKycKybAutofillForSetup, clearKycKybResetStatus, clearSetupViewDataInLocalStore, enableSetup, resetKycKyb, saveCompnayOfficerAdditionalDocumentsInLocalStore, saveCompnayOfficerPhoneInLocalStore, saveIndustryAndIncDateInLocalStore, saveSetupViewDataInLocalStore, saveTreasuryAdditionalDocumentsInLocalStore, updateBusinessVerificationDetails, updateSelectedCompanyOfficer, updateSetupViewLocalStoreData, } from './view/spendManagement/commonSetup/setupViewReducer';
364
364
  import { getBusinessVerificationDetails, getCommonSetupViewDetails, } from './view/spendManagement/commonSetup/setupViewSelector';
365
365
  import { COMPANY_ONBOARDING_INDUSTRY_TYPE_CODES, COMPANY_ONBOARDING_SUB_INDUSTRY_CODES_BY_INDUSTRY, COMPANY_PURPOSE_OF_ACCOUNT_CODES, COMPANY_SOURCE_OF_FUNDS_CODES, COMPANY_TRANSACTION_VOLUME_CODES, COMPANY_US_NEXUS_TYPE_CODES, getCompanyOnboardingSubIndustryCodesForIndustry, } from './view/spendManagement/commonSetup/types/businessVerification';
366
366
  import { checkIfLowBalance, getBillListUniqueType, getBulkOperationSuffix, getRemiListUniqueType, getSelectedCompanyOfficer, getSpendManagementEffectiveListPeriod, isAwaitingMarkAsPaid, isBulkProcessing, isPaymentMethodOutsideZeni, isVerifiedPaymentAccountProviderStatusCode, isVerifiedStatusCode, showBillPayPromoPage, showReimbursementPromoPage, toAccountsPromoConfig, toSameDayAchDisablementConfig, } from './view/spendManagement/helpers';
@@ -841,14 +841,12 @@ export { getInvoicingDunningCaseListView } from './view/invoicing/invoicingDunni
841
841
  export { clearInvoicingDunningCaseDetailView, fetchInvoicingDunningCaseDetail, fetchInvoicingDunningCaseDetailPage, fetchInvoicingDunningEmailPreviewPage, invalidateInvoicingDunningEmailPreview, } from './view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewReducer';
842
842
  export { getInvoicingDunningCaseById, getInvoicingDunningCaseDetail, getInvoicingDunningEmailPreview, } from './view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewSelector';
843
843
  // ── Invoicing: catalog (plans + products) ─────────────────────────────────────
844
- export { mergeInvoicingPlanSubFamily, removeInvoicingPlan, updateInvoicingPlans, } from './entity/invoicing/plan/planReducer';
845
- export { removeInvoicingProduct, updateInvoicingProducts, } from './entity/invoicing/product/productReducer';
844
+ export { mergeInvoicingCatalogPricePoint, removeInvoicingCatalogItem, updateInvoicingCatalogItems, } from './entity/invoicing/invoicingCatalog/invoicingCatalogReducer';
846
845
  export { fetchInvoicingCatalogCounts, fetchInvoicingCatalogListPage, fetchInvoicingCatalogPlanList, fetchInvoicingCatalogProductList, updateInvoicingCatalogPlanFilters, updateInvoicingCatalogProductFilters, } from './view/invoicing/invoicingCatalogListView/invoicingCatalogListViewReducer';
847
846
  export { ALL_INVOICING_PRODUCT_SORT_KEYS, INVOICING_PRODUCT_COLUMNS, } from './view/invoicing/invoicingCatalogListView/invoicingCatalogListViewState';
848
847
  export { getInvoicingCatalogListView } from './view/invoicing/invoicingCatalogListView/invoicingCatalogListViewSelector';
849
848
  export { fetchInvoicingCatalogItemDetail } from './view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewReducer';
850
- export { getInvoicingPlanById, getLowestInvoicingPlanPricePointAmount, } from './entity/invoicing/plan/planSelector';
851
- export { getInvoicingProductById } from './entity/invoicing/product/productSelector';
849
+ export { getInvoicingCatalogItemById, getLowestInvoicingCatalogPricePointAmount, } from './entity/invoicing/invoicingCatalog/invoicingCatalogSelector';
852
850
  // ── Invoicing: settings ───────────────────────────────────────────────────────
853
851
  export { connectInvoicingStripe, disconnectInvoicingStripe, fetchInvoicingSettings, resetInvoicingBrandingFormDraft, resetInvoicingQboSettingsDraft, resetSaveInvoicingSettings, saveInvoicingSettings, submitInvoicingBrandingForm, submitInvoicingQboSettings, updateInvoicingBrandingFormDraft, updateInvoicingQboSettingsDraft, updateInvoicingSettings, } from './view/invoicing/settingsView/settingsViewReducer';
854
852
  export { getInvoicingBrandingFormView, getInvoicingQboSettingsFormView, getInvoicingSettings, getInvoicingSettingsFetchState, getInvoicingSettingsHubView, getInvoicingSettingsView, } from './view/invoicing/settingsView/settingsViewSelector';
@@ -2,6 +2,7 @@ import { combineReducers } from 'redux';
2
2
  import account, { initialState as initialAccountState, } from './entity/account/accountReducer';
3
3
  import accountGroup, { initialState as initialAccountGroupState, } from './entity/accountGroup/accountGroupReducer';
4
4
  import accountRecon, { initialState as initialAccountReconState, } from './entity/accountRecon/accountReconReducer';
5
+ import actualMatching, { initialState as initialActualMatchingState, } from './entity/actualMatching/actualMatchingReducer';
5
6
  import address, { initialState as initialAddressState, } from './entity/address/addressReducer';
6
7
  import aiAccountantCustomer, { initialAiAccountantCustomerState, } from './entity/aiAccountantCustomer/aiAccountantCustomerReducer';
7
8
  import aiCfo, { initialAiCfoState } from './entity/aiCfo/aiCfoReducer';
@@ -40,9 +41,7 @@ import invoicingInvoice, { initialState as initialInvoicingInvoiceState, } from
40
41
  import invoicingCustomer, { initialState as initialInvoicingCustomerState, } from './entity/invoicing/invoicingCustomer/invoicingCustomerReducer';
41
42
  import invoicingSubscription, { initialState as initialInvoicingSubscriptionState, } from './entity/invoicing/invoicingSubscription/invoicingSubscriptionReducer';
42
43
  import invoicingTransaction, { initialState as initialInvoicingTransactionState, } from './entity/invoicing/invoicingTransaction/invoicingTransactionReducer';
43
- import invoicingPlan, { initialState as initialInvoicingPlanState, } from './entity/invoicing/plan/planReducer';
44
- import invoicingProduct, { initialState as initialInvoicingProductState, } from './entity/invoicing/product/productReducer';
45
- import actualMatching, { initialState as initialActualMatchingState, } from './entity/actualMatching/actualMatchingReducer';
44
+ import invoicingCatalog, { initialState as initialInvoicingCatalogState, } from './entity/invoicing/invoicingCatalog/invoicingCatalogReducer';
46
45
  import jeSchedules, { initialState as initialJESchedulesState, } from './entity/jeSchedules/jeSchedulesReducer';
47
46
  import merchant, { initialState as initialMerchantState, } from './entity/merchant/merchantReducer';
48
47
  import monthEndCloseChecks, { initialState as initialMonthEndCloseChecksState, } from './entity/monthEndCloseChecks/monthEndCloseChecksReducer';
@@ -316,8 +315,7 @@ const initialEntitiesState = {
316
315
  invoicingCustomerState: initialInvoicingCustomerState,
317
316
  invoicingDunningCaseState: initialInvoicingDunningCaseState,
318
317
  invoicingInvoiceState: initialInvoicingInvoiceState,
319
- invoicingPlanState: initialInvoicingPlanState,
320
- invoicingProductState: initialInvoicingProductState,
318
+ invoicingCatalogState: initialInvoicingCatalogState,
321
319
  invoicingSubscriptionState: initialInvoicingSubscriptionState,
322
320
  invoicingTransactionState: initialInvoicingTransactionState,
323
321
  jeSchedulesState: initialJESchedulesState,
@@ -603,8 +601,7 @@ const entityReducers = {
603
601
  invoicingCustomerState: invoicingCustomer,
604
602
  invoicingDunningCaseState: invoicingDunningCase,
605
603
  invoicingInvoiceState: invoicingInvoice,
606
- invoicingPlanState: invoicingPlan,
607
- invoicingProductState: invoicingProduct,
604
+ invoicingCatalogState: invoicingCatalog,
608
605
  invoicingSubscriptionState: invoicingSubscription,
609
606
  invoicingTransactionState: invoicingTransaction,
610
607
  jeSchedulesState: jeSchedules,
@@ -1,5 +1,5 @@
1
- import orderBy from 'lodash/orderBy';
2
1
  import { createSelector } from '@reduxjs/toolkit';
2
+ import orderBy from 'lodash/orderBy';
3
3
  import { toMonthYearPeriodId, } from '../../../commonStateTypes/timePeriod';
4
4
  import { getActualMatchingMatchById } from '../../../entity/actualMatching/actualMatchingSelector';
5
5
  import { generateJEOneTimeAccrualKey } from '../../../entity/jeSchedules/jeScheduleHelper';
@@ -94,7 +94,11 @@ function collectGroupedMembers(members) {
94
94
  estimatedAmount: member.estimatedAmount,
95
95
  jeDebitAccountName: member.jeDebitAccountName,
96
96
  memo: member.memo,
97
+ reversalTransactionId: member.reversalTransactionId,
98
+ reversalTransactionIntegrationId: member.reversalTransactionIntegrationId,
97
99
  serviceMonth: member.serviceMonth,
100
+ transactionId: member.transactionId,
101
+ transactionIntegrationId: member.transactionIntegrationId,
98
102
  }));
99
103
  }
100
104
  function collectLeftoverMembers(leftovers) {
@@ -312,18 +316,22 @@ function toActualMatchingMatchView(match) {
312
316
  : match.leftovers.map(toMatchModalAccrual),
313
317
  };
314
318
  }
315
- const EMPTY_ACTUAL_MATCHING_ROWS = [];
316
319
  const matchViewSelectorById = new Map();
317
320
  export function getExpenseAutomationActualMatchingMatchView(state, matchId) {
318
321
  let selector = matchViewSelectorById.get(matchId);
319
322
  if (selector == null) {
320
323
  selector = createSelector([
321
- (root) => root.expenseAutomationActualMatchingViewState.detailFetchStateByMatchId[matchId] ?? NOT_STARTED,
324
+ (root) => root.expenseAutomationActualMatchingViewState
325
+ .detailFetchStateByMatchId[matchId] ?? NOT_STARTED,
322
326
  (root) => root.expenseAutomationActualMatchingViewState.ignoreStatusByMatchId[matchId] ?? NOT_STARTED,
323
- (root) => root.expenseAutomationActualMatchingViewState.lastMatchResultsByMatchId?.[matchId],
324
- (root) => root.expenseAutomationActualMatchingViewState.lastUndoResultsByMatchId?.[matchId],
325
- (root) => root.expenseAutomationActualMatchingViewState.detailRefreshStatusByMatchId[matchId] ?? NOT_STARTED,
326
- (root) => root.expenseAutomationActualMatchingViewState.undoReversalStatusByMatchId[matchId] ?? NOT_STARTED,
327
+ (root) => root.expenseAutomationActualMatchingViewState
328
+ .lastMatchResultsByMatchId?.[matchId],
329
+ (root) => root.expenseAutomationActualMatchingViewState
330
+ .lastUndoResultsByMatchId?.[matchId],
331
+ (root) => root.expenseAutomationActualMatchingViewState
332
+ .detailRefreshStatusByMatchId[matchId] ?? NOT_STARTED,
333
+ (root) => root.expenseAutomationActualMatchingViewState
334
+ .undoReversalStatusByMatchId[matchId] ?? NOT_STARTED,
327
335
  (root) => getActualMatchingMatchById(root.actualMatchingState, matchId),
328
336
  ], (detailFetchState, ignoreStatus, lastMatchResults, lastUndoResults, refreshStatus, undoReversalStatus, match) => ({
329
337
  detailFetchState,
@@ -353,7 +361,8 @@ export function getActualMatchingMatchModalConfirmStatus(state, matchId) {
353
361
  if (matchId != null && matchId !== '') {
354
362
  return (state.expenseAutomationActualMatchingViewState.confirmStatusByMatchId[matchId] ?? NOT_STARTED);
355
363
  }
356
- return state.expenseAutomationActualMatchingViewState.matchModal.confirmStatus;
364
+ return state.expenseAutomationActualMatchingViewState.matchModal
365
+ .confirmStatus;
357
366
  }
358
367
  export function getExpenseAutomationActualMatchingView(state) {
359
368
  const { expenseAutomationActualMatchingViewState } = state;
@@ -367,14 +376,8 @@ export function getExpenseAutomationActualMatchingView(state) {
367
376
  .filter((match) => match.members.length > 0)
368
377
  .map(toActualMatchingRow);
369
378
  const rows = allRows.filter((row) => matchesSearch(row, uiState.searchString));
370
- const includePendingReview = uiState.statusFilter !== 'reversed';
371
- const includeReversed = uiState.statusFilter !== 'pending_review';
372
- const reversed = includeReversed
373
- ? sortActualMatchingRows(rows.filter((row) => isReversedMatchKind(row.kind)), uiState)
374
- : EMPTY_ACTUAL_MATCHING_ROWS;
375
- const pendingReview = includePendingReview
376
- ? sortActualMatchingRows(rows.filter((row) => row.kind === 'pending_review'), uiState)
377
- : EMPTY_ACTUAL_MATCHING_ROWS;
379
+ const reversed = sortActualMatchingRows(rows.filter((row) => isReversedMatchKind(row.kind)), uiState);
380
+ const pendingReview = sortActualMatchingRows(rows.filter((row) => row.kind === 'pending_review'), uiState);
378
381
  const kpiSummary = buildActualMatchingKpiSummary(allRows, getTenantDisplayCurrency(state)?.currencyCode);
379
382
  const searchedAccruals = matchModal.accrualSearch.results
380
383
  .map((key) => getJEOneTimeAccrualByKey(key, state.jeSchedulesState))
@@ -1,5 +1,5 @@
1
1
  import { getAddressByAddressId } from '../../../entity/address/addressSelector';
2
- import { invoicingPricePointDisplayAmount } from '../../../entity/invoicing/plan/planSelector';
2
+ import { invoicingPricePointDisplayAmount } from '../../../entity/invoicing/invoicingCatalog/invoicingCatalogSelector';
3
3
  import { getInvoicingCatalogListView, getInvoicingCatalogPrices, } from '../invoicingCatalogListView/invoicingCatalogListViewSelector';
4
4
  import { invoicingFieldHelpForGroup } from '../invoicingConfigView/invoicingConfigViewSelector';
5
5
  import { getInvoicingCustomerListView } from '../invoicingCustomerListView/invoicingCustomerListViewSelector';
@@ -1,6 +1,6 @@
1
1
  import { createSelector } from '@reduxjs/toolkit';
2
2
  import { reduceAllFetchState } from '../../../commonStateTypes/reduceFetchState';
3
- import { getInvoicingPlanById, getInvoicingPlansByIds, } from '../../../entity/invoicing/plan/planSelector';
3
+ import { getInvoicingCatalogItemById, getInvoicingCatalogItemsByIds, } from '../../../entity/invoicing/invoicingCatalog/invoicingCatalogSelector';
4
4
  import { getInvoicingConfigView, invoicingFieldHelpForGroup, } from '../invoicingConfigView/invoicingConfigViewSelector';
5
5
  import { getInvoicingFormDraftLocalData, isInvoicingFormDraftPending, } from '../invoicingFormDraft';
6
6
  import { INVOICING_DEFAULT_INCOME_ACCOUNT_TYPES, INVOICING_INCOME_ACCOUNT_MAPPING_SLOT, NO_INVOICING_ACCOUNT_HIERARCHY, NO_INVOICING_ACCOUNT_IDS, NO_INVOICING_CLASS_HIERARCHY, getInvoicingQboAccountOptions, getInvoicingQboView, invoicingQboAccountIdsForMappingSlot, isInvoicingAccountingPickerDataLoading, isInvoicingQboConnected, } from '../invoicingQboView/invoicingQboViewSelector';
@@ -36,7 +36,7 @@ const buildApplicableCatalogItemOptions = (plans) => {
36
36
  * Kept referentially stable across unrelated dispatches; the form view filters
37
37
  * out the item being edited (see `getInvoicingCatalogItemFormView`).
38
38
  */
39
- export const getInvoicingApplicableCatalogItemOptions = createSelector((state) => state.invoicingPlanState, (state) => state.invoicingCatalogListViewState, (planState, listViewState) => buildApplicableCatalogItemOptions(getInvoicingPlansByIds(planState, [
39
+ export const getInvoicingApplicableCatalogItemOptions = createSelector((state) => state.invoicingCatalogState, (state) => state.invoicingCatalogListViewState, (catalogState, listViewState) => buildApplicableCatalogItemOptions(getInvoicingCatalogItemsByIds(catalogState, [
40
40
  ...listViewState.planIds,
41
41
  ...listViewState.productIds,
42
42
  ])));
@@ -61,7 +61,9 @@ const getInvoicingCatalogIncomeAccountIds = createSelector([
61
61
  : NO_INVOICING_ACCOUNT_IDS);
62
62
  export const getInvoicingCatalogItemFormView = (state, id) => {
63
63
  const { editDraftById, error, fetchState, newItemDraft, savedItemId, savedKind, } = state.editInvoicingCatalogItemDetailViewState;
64
- const plan = id != null ? getInvoicingPlanById(state.invoicingPlanState, id) : undefined;
64
+ const plan = id != null
65
+ ? getInvoicingCatalogItemById(state.invoicingCatalogState, id)
66
+ : undefined;
65
67
  const kind = plan != null ? 'plan' : undefined;
66
68
  // No entity fallback: the draft is the one source of form values, seeded from
67
69
  // the record by `seedInvoicingCatalogItemFormDraftEpic` when the detail load
@@ -1,6 +1,6 @@
1
1
  import { of } from 'rxjs';
2
2
  import { catchError, filter, switchMap } from 'rxjs/operators';
3
- import { updateInvoicingPlans } from '../../../entity/invoicing/plan/planReducer';
3
+ import { updateInvoicingCatalogItems } from '../../../entity/invoicing/invoicingCatalog/invoicingCatalogReducer';
4
4
  import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
5
5
  import { fetchInvoicingCatalogItemDetail, updateInvoicingCatalogItemDetail, updateInvoicingCatalogItemDetailFailure, } from './editInvoicingCatalogItemDetailViewReducer';
6
6
  export const fetchInvoicingCatalogItemDetailEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchInvoicingCatalogItemDetail.match), switchMap((action) => {
@@ -9,7 +9,7 @@ export const fetchInvoicingCatalogItemDetailEpic = (actions$, _state$, zeniAPI)
9
9
  return zeniAPI.getJSON(apiUrl).pipe(switchMap((response) => {
10
10
  if (isSuccessResponse(response) && response.data != null) {
11
11
  return [
12
- updateInvoicingPlans([response.data], 'merge'),
12
+ updateInvoicingCatalogItems([response.data], 'merge'),
13
13
  updateInvoicingCatalogItemDetail({ id: response.data.id, kind }),
14
14
  ];
15
15
  }
@@ -1,6 +1,6 @@
1
1
  import { of } from 'rxjs';
2
2
  import { catchError, filter, mergeMap } from 'rxjs/operators';
3
- import { updateInvoicingPlans } from '../../../entity/invoicing/plan/planReducer';
3
+ import { updateInvoicingCatalogItems } from '../../../entity/invoicing/invoicingCatalog/invoicingCatalogReducer';
4
4
  import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
5
5
  import { runInvoicingCatalogPlanAction, runInvoicingCatalogPlanActionFailure, runInvoicingCatalogPlanActionSuccess, } from './editInvoicingCatalogItemDetailViewReducer';
6
6
  export const runInvoicingCatalogPlanActionEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(runInvoicingCatalogPlanAction.match), mergeMap((action) => {
@@ -12,7 +12,7 @@ export const runInvoicingCatalogPlanActionEpic = (actions$, _state$, zeniAPI) =>
12
12
  .pipe(mergeMap((response) => {
13
13
  if (isSuccessResponse(response) && response.data != null) {
14
14
  return [
15
- updateInvoicingPlans([response.data], 'merge'),
15
+ updateInvoicingCatalogItems([response.data], 'merge'),
16
16
  runInvoicingCatalogPlanActionSuccess({ id }),
17
17
  ];
18
18
  }
@@ -1,7 +1,6 @@
1
1
  import { of } from 'rxjs';
2
2
  import { catchError, filter, mergeMap } from 'rxjs/operators';
3
- import { mergeInvoicingPlanSubFamily } from '../../../entity/invoicing/plan/planReducer';
4
- import { updateInvoicingProducts } from '../../../entity/invoicing/product/productReducer';
3
+ import { mergeInvoicingCatalogPricePoint } from '../../../entity/invoicing/invoicingCatalog/invoicingCatalogReducer';
5
4
  import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
6
5
  import { runInvoicingCatalogProductAction, runInvoicingCatalogProductActionFailure, runInvoicingCatalogProductActionSuccess, } from './editInvoicingCatalogItemDetailViewReducer';
7
6
  export const runInvoicingCatalogProductActionEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(runInvoicingCatalogProductAction.match), mergeMap((action) => {
@@ -16,9 +15,10 @@ export const runInvoicingCatalogProductActionEpic = (actions$, _state$, zeniAPI)
16
15
  .pipe(mergeMap((response) => {
17
16
  if (isSuccessResponse(response) && response.data != null) {
18
17
  return [
19
- updateInvoicingProducts([response.data], 'merge'),
20
18
  ...(parentItemId != null
21
- ? [mergeInvoicingPlanSubFamily(parentItemId, response.data)]
19
+ ? [
20
+ mergeInvoicingCatalogPricePoint(parentItemId, response.data),
21
+ ]
22
22
  : []),
23
23
  runInvoicingCatalogProductActionSuccess({ id: stateKey }),
24
24
  ];
@@ -1,7 +1,6 @@
1
1
  import { forkJoin, from } from 'rxjs';
2
2
  import { catchError, filter, mergeMap } from 'rxjs/operators';
3
- import { mergeInvoicingPlanSubFamily, updateInvoicingPlans, } from '../../../entity/invoicing/plan/planReducer';
4
- import { updateInvoicingProducts } from '../../../entity/invoicing/product/productReducer';
3
+ import { mergeInvoicingCatalogPricePoint, updateInvoicingCatalogItems, } from '../../../entity/invoicing/invoicingCatalog/invoicingCatalogReducer';
5
4
  import { apiErrorSnackbarVariables } from '../../../entity/snackbar/snackbarApiError';
6
5
  import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
7
6
  import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
@@ -51,11 +50,8 @@ export const saveInvoicingCatalogItemEpic = (actions$, state$, zeniAPI) => actio
51
50
  }
52
51
  const savedProducts = productResponses.flatMap((productResponse) => productResponse.data != null ? [productResponse.data] : []);
53
52
  const resultActions = [
54
- updateInvoicingPlans([savedItem], 'merge'),
55
- ...(savedProducts.length > 0
56
- ? [updateInvoicingProducts(savedProducts, 'merge')]
57
- : []),
58
- ...savedProducts.map((product) => mergeInvoicingPlanSubFamily(savedItem.id, product)),
53
+ updateInvoicingCatalogItems([savedItem], 'merge'),
54
+ ...savedProducts.map((product) => mergeInvoicingCatalogPricePoint(savedItem.id, product)),
59
55
  submitInvoicingCatalogItemFormSuccess({
60
56
  itemId: savedItem.id,
61
57
  kind: 'plan',
@@ -1,6 +1,6 @@
1
1
  import { EMPTY, of } from 'rxjs';
2
2
  import { filter, mergeMap, withLatestFrom } from 'rxjs/operators';
3
- import { getInvoicingPlanById } from '../../../entity/invoicing/plan/planSelector';
3
+ import { getInvoicingCatalogItemById } from '../../../entity/invoicing/invoicingCatalog/invoicingCatalogSelector';
4
4
  import { fetchInvoicingCatalogItemDetailPage, seedInvoicingCatalogItemFormDraft, updateInvoicingCatalogItemDetail, } from './editInvoicingCatalogItemDetailViewReducer';
5
5
  import { entityToInvoicingCatalogItemFormLocalData } from './invoicingCatalogItemFormHelper';
6
6
  /**
@@ -34,7 +34,7 @@ export const seedInvoicingCatalogItemFormDraftEpic = (actions$, state$) => actio
34
34
  }
35
35
  // Nothing to seed from on a cold open; the detail response triggers this
36
36
  // again once it lands.
37
- const plan = getInvoicingPlanById(state.invoicingPlanState, id);
37
+ const plan = getInvoicingCatalogItemById(state.invoicingCatalogState, id);
38
38
  if (plan == null) {
39
39
  return EMPTY;
40
40
  }
@@ -1,6 +1,6 @@
1
1
  import { of } from 'rxjs';
2
2
  import { catchError, filter, switchMap } from 'rxjs/operators';
3
- import { updateInvoicingPlans } from '../../../../entity/invoicing/plan/planReducer';
3
+ import { updateInvoicingCatalogItems } from '../../../../entity/invoicing/invoicingCatalog/invoicingCatalogReducer';
4
4
  import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
5
5
  import { INVOICING_LIST_PAGE_SIZE, applyListSortParams, withQuery, } from '../../invoicingApiHelper';
6
6
  import { fetchInvoicingCatalogPlanList, updateInvoicingCatalogPlanList, updateInvoicingCatalogPlanListFailure, } from '../invoicingCatalogListViewReducer';
@@ -29,7 +29,7 @@ export const fetchInvoicingCatalogPlanListEpic = (actions$, _state$, zeniAPI) =>
29
29
  if (isSuccessResponse(response)) {
30
30
  const items = response.data?.items ?? [];
31
31
  return [
32
- updateInvoicingPlans(items, 'merge'),
32
+ updateInvoicingCatalogItems(items, 'merge'),
33
33
  updateInvoicingCatalogPlanList({
34
34
  ids: items.map((item) => item.id),
35
35
  nextCursor: response.data?.next_cursor ?? null,
@@ -1,6 +1,6 @@
1
1
  import { of } from 'rxjs';
2
2
  import { catchError, filter, switchMap } from 'rxjs/operators';
3
- import { updateInvoicingPlans } from '../../../../entity/invoicing/plan/planReducer';
3
+ import { updateInvoicingCatalogItems } from '../../../../entity/invoicing/invoicingCatalog/invoicingCatalogReducer';
4
4
  import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
5
5
  import { INVOICING_LIST_PAGE_SIZE, applyListSortParams, withQuery, } from '../../invoicingApiHelper';
6
6
  import { fetchInvoicingCatalogProductList, updateInvoicingCatalogProductList, updateInvoicingCatalogProductListFailure, } from '../invoicingCatalogListViewReducer';
@@ -29,7 +29,7 @@ export const fetchInvoicingCatalogProductListEpic = (actions$, _state$, zeniAPI)
29
29
  if (isSuccessResponse(response)) {
30
30
  const items = response.data?.items ?? [];
31
31
  return [
32
- updateInvoicingPlans(items, 'merge'),
32
+ updateInvoicingCatalogItems(items, 'merge'),
33
33
  updateInvoicingCatalogProductList({
34
34
  ids: items.map((item) => item.id),
35
35
  nextCursor: response.data?.next_cursor ?? null,
@@ -1,5 +1,5 @@
1
1
  import { createSelector } from '@reduxjs/toolkit';
2
- import { getInvoicingPlansByIds } from '../../../entity/invoicing/plan/planSelector';
2
+ import { getInvoicingCatalogItemsByIds } from '../../../entity/invoicing/invoicingCatalog/invoicingCatalogSelector';
3
3
  import { runningInvoicingActionId } from '../runningInvoicingActionId';
4
4
  import { INVOICING_PRODUCT_COLUMNS, } from './invoicingCatalogListViewState';
5
5
  /**
@@ -28,13 +28,13 @@ export const getInvoicingCatalogPrices = (items) => items.flatMap((item) => (ite
28
28
  * denormalized arrays keep referential identity. The base `fetchState`/`error`
29
29
  * track the plan list; the product list has its own `productFetchState`.
30
30
  */
31
- export const getInvoicingCatalogListView = createSelector((state) => state.invoicingPlanState, (state) => state.invoicingCatalogListViewState, (state) => state.invoicingConfigViewState.catalogItemLifecycleActionOptions, (state) => state.editInvoicingCatalogItemDetailViewState.actionStateById, (planState, listViewState, catalogItemLifecycleActionOptions, actionStateById) => ({
31
+ export const getInvoicingCatalogListView = createSelector((state) => state.invoicingCatalogState, (state) => state.invoicingCatalogListViewState, (state) => state.invoicingConfigViewState.catalogItemLifecycleActionOptions, (state) => state.editInvoicingCatalogItemDetailViewState.actionStateById, (catalogState, listViewState, catalogItemLifecycleActionOptions, actionStateById) => ({
32
32
  catalogItemLifecycleActionOptions,
33
33
  runningActionId: runningInvoicingActionId(actionStateById),
34
- plans: getInvoicingPlansByIds(planState, listViewState.planIds),
34
+ plans: getInvoicingCatalogItemsByIds(catalogState, listViewState.planIds),
35
35
  planSort: listViewState.planSort,
36
36
  productColumns: INVOICING_PRODUCT_COLUMNS,
37
- products: getInvoicingPlansByIds(planState, listViewState.productIds),
37
+ products: getInvoicingCatalogItemsByIds(catalogState, listViewState.productIds),
38
38
  productSort: listViewState.productSort,
39
39
  count: listViewState.counts,
40
40
  countsFetchState: listViewState.countsFetchState,
@@ -16,7 +16,7 @@ import { toBusinessVerificationCompanyDataPayload, toBusinessVerificationOfficer
16
16
  import { updateCurrentStep, updateOnboardingCustomerView, updateOnboardingCustomerViewFailure, updateOnboardingCustomerViewLocalStoreData, updateOnboardingCustomerViewSuccess, } from '../../onboardingCustomerViewReducer';
17
17
  import { getOnboardingCustomerView } from '../../onboardingCustomerViewSelector';
18
18
  export const updateOnboardingCustomerViewEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(updateOnboardingCustomerView.match), mergeMap((action) => {
19
- const { companyId, officerType, sendForVerification, reCalculateCurrentStep = false, isBillingAddressUpdate, } = action.payload;
19
+ const { companyId, officerType, sendForVerification, reCalculateCurrentStep = false, isBillingAddressUpdate, businessProfile, } = action.payload;
20
20
  const { onboardingCustomerViewState } = state$.value;
21
21
  const { companyDetails, primaryContactDetails, companyOfficerUpdateStatus, currentStep, currentSubStep, } = onboardingCustomerViewState;
22
22
  const companyLocalData = companyDetails.localData;
@@ -28,12 +28,17 @@ export const updateOnboardingCustomerViewEpic = (actions$, state$, zeniAPI) => a
28
28
  }
29
29
  const { newAddressState } = state$.value.addressViewState;
30
30
  let payload = {};
31
+ const isSetupBillingSave = isBillingAddressUpdate === true || businessProfile != null;
31
32
  if (companyLocalData != null) {
32
- if (isBillingAddressUpdate === true &&
33
- newAddressState?.subscription_billing_address.addressToCreate != null) {
34
- payload = prepareEditBillingAddressPayload(companyLocalData, newAddressState.subscription_billing_address.addressToCreate);
35
- }
36
33
  const companyView = getCompanyView(state$.value, companyId, []);
34
+ const billingAddressToCreate = isBillingAddressUpdate === true
35
+ ? newAddressState?.subscription_billing_address.addressToCreate
36
+ : undefined;
37
+ if (billingAddressToCreate != null || businessProfile != null) {
38
+ payload = prepareEditBillingAddressPayload(companyLocalData, billingAddressToCreate, businessProfile != null
39
+ ? toBusinessProfilePayload(businessProfile, companyView?.company.company.incInfo)
40
+ : {});
41
+ }
37
42
  const companyAddressToCreate = newAddressState?.company_address?.addressToCreate;
38
43
  const registeredAddressToCreate = newAddressState?.company_registered_address?.addressToCreate;
39
44
  const addressType = officerType
@@ -56,7 +61,7 @@ export const updateOnboardingCustomerViewEpic = (actions$, state$, zeniAPI) => a
56
61
  // different payloads — currentSubStep is the source of truth here.
57
62
  const isOfficerSave = currentStep === 'verification' &&
58
63
  currentSubStep === 'company_officer';
59
- if (isBillingAddressUpdate === false) {
64
+ if (isBillingAddressUpdate === false && businessProfile == null) {
60
65
  if (isOfficerSave) {
61
66
  payload = {
62
67
  company: toBusinessVerificationMinimalCompanyDataPayload(companyLocalData),
@@ -70,7 +75,7 @@ export const updateOnboardingCustomerViewEpic = (actions$, state$, zeniAPI) => a
70
75
  };
71
76
  }
72
77
  }
73
- const section = isBillingAddressUpdate === true
78
+ const section = isSetupBillingSave
74
79
  ? 'setup_billing'
75
80
  : isOfficerSave
76
81
  ? 'company_officer'
@@ -90,7 +95,7 @@ export const updateOnboardingCustomerViewEpic = (actions$, state$, zeniAPI) => a
90
95
  },
91
96
  };
92
97
  let messageSection;
93
- if (isBillingAddressUpdate === true) {
98
+ if (isSetupBillingSave) {
94
99
  messageSection = messageSectionMapper[section].save;
95
100
  }
96
101
  else if (sendForVerification === true) {
@@ -173,13 +178,28 @@ const toBusinessVerificationMinimalCompanyDataPayload = (companyLocalData) => {
173
178
  }
174
179
  return company;
175
180
  };
176
- const prepareEditBillingAddressPayload = (companyDetailsLocalData, address) => {
181
+ const toBusinessProfilePayload = (businessProfile, persistedIncInfo) => {
182
+ const isIndustryTypeChanged = businessProfile.companyIndustryType !==
183
+ persistedIncInfo?.companyIndustryType;
184
+ return {
185
+ company_business_model: businessProfile.companyBusinessModel,
186
+ company_industry_type: businessProfile.companyIndustryType,
187
+ // A sub-industry kept from the old industry would fail the backend subtype check on the next KYB save.
188
+ ...(isIndustryTypeChanged &&
189
+ persistedIncInfo?.companySubIndustry != null && {
190
+ company_industry_sub_type: null,
191
+ }),
192
+ };
193
+ };
194
+ const prepareEditBillingAddressPayload = (companyDetailsLocalData, address, businessProfilePayload) => {
177
195
  const { syncToken } = companyDetailsLocalData;
178
- const addressPayload = toAddressUpdatableInfoPayload(address);
179
196
  return {
180
197
  company: {
181
198
  sync_token: syncToken,
182
- subscription_billing_address: addressPayload,
199
+ ...(address != null && {
200
+ subscription_billing_address: toAddressUpdatableInfoPayload(address),
201
+ }),
202
+ ...businessProfilePayload,
183
203
  },
184
204
  };
185
205
  };
@@ -523,7 +523,7 @@ const onboardingCustomerView = createSlice({
523
523
  reducer(draft) {
524
524
  draft.saveStatus = { fetchState: 'In-Progress', error: undefined };
525
525
  },
526
- prepare(companyId, sendForVerification, reCalculateCurrentStep, isBillingAddressUpdate, officerType) {
526
+ prepare(companyId, sendForVerification, reCalculateCurrentStep, isBillingAddressUpdate, officerType, businessProfile) {
527
527
  return {
528
528
  payload: {
529
529
  companyId,
@@ -531,6 +531,7 @@ const onboardingCustomerView = createSlice({
531
531
  reCalculateCurrentStep,
532
532
  isBillingAddressUpdate,
533
533
  officerType,
534
+ businessProfile,
534
535
  },
535
536
  };
536
537
  },