@zeniai/client-epic-state 5.2.68 → 5.2.69-betaAK0
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.
- package/lib/entity/aiCfo/aiCfoState.d.ts +2 -2
- package/lib/entity/billPay/billTransaction/billTransactionState.d.ts +2 -2
- package/lib/entity/chargeCardTransaction/chargeCardTransaction.d.ts +1 -1
- package/lib/entity/depositAccountTransaction/depositAccountTransaction.d.ts +1 -1
- package/lib/entity/invoicing/{product/productPayload.d.ts → invoicingCatalog/invoicingCatalogPayload.d.ts} +44 -6
- package/lib/entity/invoicing/{product/productPayload.js → invoicingCatalog/invoicingCatalogPayload.js} +50 -6
- package/lib/entity/invoicing/invoicingCatalog/invoicingCatalogReducer.d.ts +12 -0
- package/lib/entity/invoicing/{plan/planReducer.js → invoicingCatalog/invoicingCatalogReducer.js} +20 -21
- package/lib/entity/invoicing/{plan/planSelector.d.ts → invoicingCatalog/invoicingCatalogSelector.d.ts} +5 -6
- package/lib/entity/invoicing/{plan/planSelector.js → invoicingCatalog/invoicingCatalogSelector.js} +12 -12
- package/lib/entity/invoicing/{product/productState.d.ts → invoicingCatalog/invoicingCatalogState.d.ts} +42 -6
- package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +1 -0
- package/lib/entity/jeSchedules/jeSchedulesPayload.js +1 -0
- package/lib/entity/jeSchedules/jeSchedulesState.d.ts +1 -0
- package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +4 -4
- package/lib/entity/transaction/payloadTypes/transactionLinePayload.js +10 -2
- package/lib/esm/entity/invoicing/{product/productPayload.js → invoicingCatalog/invoicingCatalogPayload.js} +46 -3
- package/lib/esm/entity/invoicing/{plan/planReducer.js → invoicingCatalog/invoicingCatalogReducer.js} +19 -20
- package/lib/esm/entity/invoicing/{plan/planSelector.js → invoicingCatalog/invoicingCatalogSelector.js} +8 -8
- package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +1 -0
- package/lib/esm/entity/transaction/payloadTypes/transactionLinePayload.js +10 -2
- package/lib/esm/index.js +2 -4
- package/lib/esm/reducer.js +4 -7
- package/lib/esm/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +2 -1
- package/lib/esm/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +20 -16
- package/lib/esm/view/invoicing/createInvoice/createInvoiceSelector.js +1 -1
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +5 -3
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/fetchInvoicingCatalogItemDetailEpic.js +2 -2
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/runInvoicingCatalogPlanActionEpic.js +2 -2
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/runInvoicingCatalogProductActionEpic.js +4 -4
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +3 -7
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/seedInvoicingCatalogItemFormDraftEpic.js +2 -2
- package/lib/esm/view/invoicing/invoicingCatalogListView/epics/fetchInvoicingCatalogPlanListEpic.js +2 -2
- package/lib/esm/view/invoicing/invoicingCatalogListView/epics/fetchInvoicingCatalogProductListEpic.js +2 -2
- package/lib/esm/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewSelector.js +56 -20
- package/lib/index.d.ts +6 -9
- package/lib/index.js +9 -15
- package/lib/reducer.d.ts +1 -2
- package/lib/reducer.js +4 -7
- package/lib/rootStateTypes.d.ts +3 -5
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +2 -1
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +2 -2
- package/lib/view/expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.d.ts +4 -2
- package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +20 -16
- package/lib/view/expenseAutomationView/types/actualMatchingViewState.d.ts +2 -3
- package/lib/view/invoicing/createInvoice/createInvoiceSelector.d.ts +2 -2
- package/lib/view/invoicing/createInvoice/createInvoiceSelector.js +2 -2
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.d.ts +8 -9
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.d.ts +2 -2
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +5 -3
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/fetchInvoicingCatalogItemDetailEpic.d.ts +2 -2
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/fetchInvoicingCatalogItemDetailEpic.js +2 -2
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogItemFormHelper.d.ts +3 -4
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/runInvoicingCatalogPlanActionEpic.d.ts +2 -2
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/runInvoicingCatalogPlanActionEpic.js +2 -2
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/runInvoicingCatalogProductActionEpic.d.ts +2 -3
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/runInvoicingCatalogProductActionEpic.js +4 -4
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.d.ts +2 -3
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +3 -7
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/seedInvoicingCatalogItemFormDraftEpic.js +2 -2
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewSelector.d.ts +2 -2
- package/lib/view/invoicing/invoicingCatalogListView/epics/fetchInvoicingCatalogListPageEpic.d.ts +2 -2
- package/lib/view/invoicing/invoicingCatalogListView/epics/fetchInvoicingCatalogPlanListEpic.d.ts +2 -2
- package/lib/view/invoicing/invoicingCatalogListView/epics/fetchInvoicingCatalogPlanListEpic.js +2 -2
- package/lib/view/invoicing/invoicingCatalogListView/epics/fetchInvoicingCatalogProductListEpic.d.ts +2 -2
- package/lib/view/invoicing/invoicingCatalogListView/epics/fetchInvoicingCatalogProductListEpic.js +2 -2
- package/lib/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewPayload.d.ts +3 -3
- package/lib/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewSelector.d.ts +29 -5
- package/lib/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewSelector.js +58 -21
- package/lib/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewState.d.ts +1 -1
- package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewReducer.d.ts +1 -1
- package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewState.d.ts +1 -1
- package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewReducer.d.ts +1 -1
- package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewState.d.ts +1 -1
- package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
- package/lib/view/spendManagement/billPay/billList/billListReducer.d.ts +5 -5
- package/lib/view/spendManagement/billPay/billList/billListState.d.ts +1 -1
- package/lib/view/spendManagement/billPay/editBillView/editBillViewReducer.d.ts +2 -2
- package/lib/view/spendManagement/reimbursement/editRemiView/editRemiViewReducer.d.ts +2 -2
- package/lib/view/spendManagement/reimbursement/remiListView/remiListReducer.d.ts +5 -5
- package/lib/view/spendManagement/reimbursement/remiListView/remiListState.d.ts +2 -2
- package/package.json +1 -1
- package/lib/entity/invoicing/plan/planPayload.d.ts +0 -40
- package/lib/entity/invoicing/plan/planPayload.js +0 -51
- package/lib/entity/invoicing/plan/planReducer.d.ts +0 -14
- package/lib/entity/invoicing/plan/planState.d.ts +0 -43
- package/lib/entity/invoicing/product/productReducer.d.ts +0 -9
- package/lib/entity/invoicing/product/productReducer.js +0 -50
- package/lib/entity/invoicing/product/productSelector.d.ts +0 -4
- package/lib/entity/invoicing/product/productSelector.js +0 -17
- package/lib/entity/invoicing/product/productState.js +0 -2
- package/lib/esm/entity/invoicing/plan/planPayload.js +0 -47
- package/lib/esm/entity/invoicing/product/productReducer.js +0 -43
- package/lib/esm/entity/invoicing/product/productSelector.js +0 -10
- package/lib/esm/entity/invoicing/product/productState.js +0 -1
- /package/lib/entity/invoicing/{plan/planState.js → invoicingCatalog/invoicingCatalogState.js} +0 -0
- /package/lib/esm/entity/invoicing/{plan/planState.js → invoicingCatalog/invoicingCatalogState.js} +0 -0
package/lib/esm/entity/invoicing/{plan/planReducer.js → invoicingCatalog/invoicingCatalogReducer.js}
RENAMED
|
@@ -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 {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
10
|
+
updateInvoicingCatalogItems: {
|
|
12
11
|
reducer(draft, action) {
|
|
13
|
-
doUpdateInvoicingPlans(draft.
|
|
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
|
-
|
|
20
|
-
delete draft.
|
|
18
|
+
removeInvoicingCatalogItem(draft, action) {
|
|
19
|
+
delete draft.itemByID[action.payload];
|
|
21
20
|
},
|
|
22
|
-
|
|
21
|
+
mergeInvoicingCatalogPricePoint: {
|
|
23
22
|
reducer(draft, action) {
|
|
24
|
-
const
|
|
25
|
-
if (
|
|
23
|
+
const item = draft.itemByID[action.payload.itemId];
|
|
24
|
+
if (item == null) {
|
|
26
25
|
return;
|
|
27
26
|
}
|
|
28
|
-
const existing =
|
|
27
|
+
const existing = item.subFamilies ?? [];
|
|
29
28
|
const index = existing.findIndex((subFamily) => subFamily.id === action.payload.subFamily.id);
|
|
30
|
-
|
|
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(
|
|
36
|
+
prepare(itemId, subFamilyPayload) {
|
|
38
37
|
return {
|
|
39
38
|
payload: {
|
|
40
|
-
|
|
41
|
-
subFamily:
|
|
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 {
|
|
54
|
-
export default
|
|
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 =
|
|
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
|
|
3
|
-
const
|
|
4
|
-
.map((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
|
|
6
|
+
return items;
|
|
7
7
|
}
|
|
8
|
-
export function
|
|
9
|
-
return recordGet(
|
|
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
|
|
34
|
-
const amounts = (
|
|
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
|
};
|
|
@@ -81,8 +81,13 @@ function getLineType(payload) {
|
|
|
81
81
|
const lineDetailType = payload.line_detail_type;
|
|
82
82
|
switch (lineDetailType) {
|
|
83
83
|
case 'sales_item_line_detail':
|
|
84
|
-
case 'item_based_expense_line_detail':
|
|
85
|
-
|
|
84
|
+
case 'item_based_expense_line_detail': {
|
|
85
|
+
const lineDetail = payload
|
|
86
|
+
.line_detail;
|
|
87
|
+
return lineDetail?.item == null
|
|
88
|
+
? 'transaction_with_account_and_class_line'
|
|
89
|
+
: 'transaction_with_product_or_service_line';
|
|
90
|
+
}
|
|
86
91
|
case 'journal_entry_line_detail':
|
|
87
92
|
return 'journal_entry_transaction_line';
|
|
88
93
|
case 'account_based_expense_line_detail':
|
|
@@ -90,6 +95,9 @@ function getLineType(payload) {
|
|
|
90
95
|
return 'transaction_with_account_and_class_line';
|
|
91
96
|
case 'sub_total_line_detail':
|
|
92
97
|
case 'description_only_line_detail':
|
|
98
|
+
case 'discount_line_detail':
|
|
99
|
+
case 'tax_line_detail':
|
|
100
|
+
case 'group_line_detail':
|
|
93
101
|
return 'transaction_info_line';
|
|
94
102
|
case 'deposit_without_account_line_detail':
|
|
95
103
|
case '':
|
package/lib/esm/index.js
CHANGED
|
@@ -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 {
|
|
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 {
|
|
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';
|
package/lib/esm/reducer.js
CHANGED
|
@@ -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
|
|
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
|
-
|
|
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
|
-
|
|
607
|
-
invoicingProductState: invoicingProduct,
|
|
604
|
+
invoicingCatalogState: invoicingCatalog,
|
|
608
605
|
invoicingSubscriptionState: invoicingSubscription,
|
|
609
606
|
invoicingTransactionState: invoicingTransaction,
|
|
610
607
|
jeSchedulesState: jeSchedules,
|
package/lib/esm/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js
CHANGED
|
@@ -304,7 +304,8 @@ const buildLineItemById = (transaction, recommendations) => {
|
|
|
304
304
|
isClassMiscategorized: false,
|
|
305
305
|
};
|
|
306
306
|
}
|
|
307
|
-
if (line.type === 'transaction_info_line'
|
|
307
|
+
if (line.type === 'transaction_info_line' ||
|
|
308
|
+
line.type === 'transaction_line_base') {
|
|
308
309
|
const infoRecord = line;
|
|
309
310
|
lineItemData[line.id] = {
|
|
310
311
|
...infoRecord,
|
|
@@ -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,13 +94,18 @@ 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) {
|
|
101
105
|
if (leftovers == null || leftovers.length === 0) {
|
|
102
106
|
return undefined;
|
|
103
107
|
}
|
|
108
|
+
// Leftover accruals did not post, so they have no journal-entry ids to open.
|
|
104
109
|
return leftovers.map((member) => ({
|
|
105
110
|
accrualId: member.accrualId,
|
|
106
111
|
estimatedAmount: member.estimatedAmount,
|
|
@@ -312,18 +317,22 @@ function toActualMatchingMatchView(match) {
|
|
|
312
317
|
: match.leftovers.map(toMatchModalAccrual),
|
|
313
318
|
};
|
|
314
319
|
}
|
|
315
|
-
const EMPTY_ACTUAL_MATCHING_ROWS = [];
|
|
316
320
|
const matchViewSelectorById = new Map();
|
|
317
321
|
export function getExpenseAutomationActualMatchingMatchView(state, matchId) {
|
|
318
322
|
let selector = matchViewSelectorById.get(matchId);
|
|
319
323
|
if (selector == null) {
|
|
320
324
|
selector = createSelector([
|
|
321
|
-
(root) => root.expenseAutomationActualMatchingViewState
|
|
325
|
+
(root) => root.expenseAutomationActualMatchingViewState
|
|
326
|
+
.detailFetchStateByMatchId[matchId] ?? NOT_STARTED,
|
|
322
327
|
(root) => root.expenseAutomationActualMatchingViewState.ignoreStatusByMatchId[matchId] ?? NOT_STARTED,
|
|
323
|
-
(root) => root.expenseAutomationActualMatchingViewState
|
|
324
|
-
|
|
325
|
-
(root) => root.expenseAutomationActualMatchingViewState
|
|
326
|
-
|
|
328
|
+
(root) => root.expenseAutomationActualMatchingViewState
|
|
329
|
+
.lastMatchResultsByMatchId?.[matchId],
|
|
330
|
+
(root) => root.expenseAutomationActualMatchingViewState
|
|
331
|
+
.lastUndoResultsByMatchId?.[matchId],
|
|
332
|
+
(root) => root.expenseAutomationActualMatchingViewState
|
|
333
|
+
.detailRefreshStatusByMatchId[matchId] ?? NOT_STARTED,
|
|
334
|
+
(root) => root.expenseAutomationActualMatchingViewState
|
|
335
|
+
.undoReversalStatusByMatchId[matchId] ?? NOT_STARTED,
|
|
327
336
|
(root) => getActualMatchingMatchById(root.actualMatchingState, matchId),
|
|
328
337
|
], (detailFetchState, ignoreStatus, lastMatchResults, lastUndoResults, refreshStatus, undoReversalStatus, match) => ({
|
|
329
338
|
detailFetchState,
|
|
@@ -353,7 +362,8 @@ export function getActualMatchingMatchModalConfirmStatus(state, matchId) {
|
|
|
353
362
|
if (matchId != null && matchId !== '') {
|
|
354
363
|
return (state.expenseAutomationActualMatchingViewState.confirmStatusByMatchId[matchId] ?? NOT_STARTED);
|
|
355
364
|
}
|
|
356
|
-
return state.expenseAutomationActualMatchingViewState.matchModal
|
|
365
|
+
return state.expenseAutomationActualMatchingViewState.matchModal
|
|
366
|
+
.confirmStatus;
|
|
357
367
|
}
|
|
358
368
|
export function getExpenseAutomationActualMatchingView(state) {
|
|
359
369
|
const { expenseAutomationActualMatchingViewState } = state;
|
|
@@ -367,14 +377,8 @@ export function getExpenseAutomationActualMatchingView(state) {
|
|
|
367
377
|
.filter((match) => match.members.length > 0)
|
|
368
378
|
.map(toActualMatchingRow);
|
|
369
379
|
const rows = allRows.filter((row) => matchesSearch(row, uiState.searchString));
|
|
370
|
-
const
|
|
371
|
-
const
|
|
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;
|
|
380
|
+
const reversed = sortActualMatchingRows(rows.filter((row) => isReversedMatchKind(row.kind)), uiState);
|
|
381
|
+
const pendingReview = sortActualMatchingRows(rows.filter((row) => row.kind === 'pending_review'), uiState);
|
|
378
382
|
const kpiSummary = buildActualMatchingKpiSummary(allRows, getTenantDisplayCurrency(state)?.currencyCode);
|
|
379
383
|
const searchedAccruals = matchModal.accrualSearch.results
|
|
380
384
|
.map((key) => getJEOneTimeAccrualByKey(key, state.jeSchedulesState))
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getAddressByAddressId } from '../../../entity/address/addressSelector';
|
|
2
|
-
import { invoicingPricePointDisplayAmount } from '../../../entity/invoicing/
|
|
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 {
|
|
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.
|
|
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
|
|
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 {
|
|
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
|
-
|
|
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 {
|
|
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
|
-
|
|
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 {
|
|
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
|
-
? [
|
|
19
|
+
? [
|
|
20
|
+
mergeInvoicingCatalogPricePoint(parentItemId, response.data),
|
|
21
|
+
]
|
|
22
22
|
: []),
|
|
23
23
|
runInvoicingCatalogProductActionSuccess({ id: stateKey }),
|
|
24
24
|
];
|
package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { forkJoin, from } from 'rxjs';
|
|
2
2
|
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
|
-
import {
|
|
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
|
-
|
|
55
|
-
...
|
|
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 {
|
|
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 =
|
|
37
|
+
const plan = getInvoicingCatalogItemById(state.invoicingCatalogState, id);
|
|
38
38
|
if (plan == null) {
|
|
39
39
|
return EMPTY;
|
|
40
40
|
}
|
package/lib/esm/view/invoicing/invoicingCatalogListView/epics/fetchInvoicingCatalogPlanListEpic.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { of } from 'rxjs';
|
|
2
2
|
import { catchError, filter, switchMap } from 'rxjs/operators';
|
|
3
|
-
import {
|
|
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
|
-
|
|
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 {
|
|
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
|
-
|
|
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 {
|
|
2
|
+
import { getInvoicingCatalogItemsByIds, invoicingPricePointDisplayAmount, } from '../../../entity/invoicing/invoicingCatalog/invoicingCatalogSelector';
|
|
3
3
|
import { runningInvoicingActionId } from '../runningInvoicingActionId';
|
|
4
4
|
import { INVOICING_PRODUCT_COLUMNS, } from './invoicingCatalogListViewState';
|
|
5
5
|
/**
|
|
@@ -22,28 +22,64 @@ export const getInvoicingCatalogPrices = (items) => items.flatMap((item) => (ite
|
|
|
22
22
|
priceCode: subFamily.priceCode,
|
|
23
23
|
productCode: item.productCode,
|
|
24
24
|
})));
|
|
25
|
+
const lowestStartingTier = (tiers) => tiers.reduce((lowest, tier) => lowest == null || tier.startingUnit < lowest.startingUnit ? tier : lowest, undefined);
|
|
26
|
+
export const getInvoicingCatalogPlanRows = (items) => items.flatMap((item) => {
|
|
27
|
+
const pricePoints = item.subFamilies ?? [];
|
|
28
|
+
if (pricePoints.length === 0) {
|
|
29
|
+
return [
|
|
30
|
+
{
|
|
31
|
+
id: item.id,
|
|
32
|
+
item,
|
|
33
|
+
period: item.period,
|
|
34
|
+
periodUnit: item.periodUnit,
|
|
35
|
+
price: item.price,
|
|
36
|
+
productFamily: item.name,
|
|
37
|
+
status: item.status,
|
|
38
|
+
tierCount: item.tiers?.length ?? 0,
|
|
39
|
+
firstTier: lowestStartingTier(item.tiers ?? []),
|
|
40
|
+
},
|
|
41
|
+
];
|
|
42
|
+
}
|
|
43
|
+
return pricePoints.map((pricePoint) => ({
|
|
44
|
+
id: pricePoint.id,
|
|
45
|
+
item,
|
|
46
|
+
period: pricePoint.period,
|
|
47
|
+
periodUnit: pricePoint.periodUnit,
|
|
48
|
+
planName: pricePoint.name,
|
|
49
|
+
price: invoicingPricePointDisplayAmount(pricePoint),
|
|
50
|
+
pricingModel: pricePoint.pricingModel,
|
|
51
|
+
productFamily: item.name,
|
|
52
|
+
status: pricePoint.status,
|
|
53
|
+
tierCount: pricePoint.tiers?.length ?? 0,
|
|
54
|
+
firstTier: lowestStartingTier(pricePoint.tiers ?? []),
|
|
55
|
+
}));
|
|
56
|
+
});
|
|
25
57
|
/**
|
|
26
58
|
* Bundled read view for the single catalog page (plans + products tabs).
|
|
27
59
|
* Memoized over the plan + product entity slices and the list-view slice so the
|
|
28
60
|
* denormalized arrays keep referential identity. The base `fetchState`/`error`
|
|
29
61
|
* track the plan list; the product list has its own `productFetchState`.
|
|
30
62
|
*/
|
|
31
|
-
export const getInvoicingCatalogListView = createSelector((state) => state.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
63
|
+
export const getInvoicingCatalogListView = createSelector((state) => state.invoicingCatalogState, (state) => state.invoicingCatalogListViewState, (state) => state.invoicingConfigViewState.catalogItemLifecycleActionOptions, (state) => state.editInvoicingCatalogItemDetailViewState.actionStateById, (catalogState, listViewState, catalogItemLifecycleActionOptions, actionStateById) => {
|
|
64
|
+
const plans = getInvoicingCatalogItemsByIds(catalogState, listViewState.planIds);
|
|
65
|
+
return {
|
|
66
|
+
catalogItemLifecycleActionOptions,
|
|
67
|
+
runningActionId: runningInvoicingActionId(actionStateById),
|
|
68
|
+
planRows: getInvoicingCatalogPlanRows(plans),
|
|
69
|
+
plans,
|
|
70
|
+
planSort: listViewState.planSort,
|
|
71
|
+
productColumns: INVOICING_PRODUCT_COLUMNS,
|
|
72
|
+
products: getInvoicingCatalogItemsByIds(catalogState, listViewState.productIds),
|
|
73
|
+
productSort: listViewState.productSort,
|
|
74
|
+
count: listViewState.counts,
|
|
75
|
+
countsFetchState: listViewState.countsFetchState,
|
|
76
|
+
planFilters: listViewState.planFilters,
|
|
77
|
+
planNextCursor: listViewState.planNextCursor,
|
|
78
|
+
productFilters: listViewState.productFilters,
|
|
79
|
+
productNextCursor: listViewState.productNextCursor,
|
|
80
|
+
productFetchState: listViewState.productFetchState,
|
|
81
|
+
fetchState: listViewState.fetchState,
|
|
82
|
+
error: listViewState.error,
|
|
83
|
+
version: 1.0,
|
|
84
|
+
};
|
|
85
|
+
});
|