@zeniai/client-epic-state 5.2.54-betaRD1 → 5.2.55
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/billPay/billTransaction/billTransactionReducer.d.ts +5 -1
- package/lib/entity/billPay/billTransaction/billTransactionReducer.js +17 -2
- package/lib/entity/invoicing/plan/planSelector.d.ts +9 -0
- package/lib/entity/invoicing/plan/planSelector.js +3 -2
- package/lib/entity/invoicing/product/productPayload.d.ts +1 -1
- package/lib/entity/invoicing/product/productPayload.js +1 -1
- package/lib/entity/invoicing/product/productState.d.ts +10 -0
- package/lib/entity/jeSchedules/jeSchedulesReducer.d.ts +1 -4
- package/lib/entity/jeSchedules/jeSchedulesReducer.js +5 -79
- package/lib/epic.d.ts +3 -2
- package/lib/epic.js +8 -6
- package/lib/esm/entity/billPay/billTransaction/billTransactionReducer.js +16 -1
- package/lib/esm/entity/invoicing/plan/planSelector.js +1 -1
- package/lib/esm/entity/invoicing/product/productPayload.js +1 -1
- package/lib/esm/entity/jeSchedules/jeSchedulesReducer.js +4 -78
- package/lib/esm/epic.js +8 -6
- package/lib/esm/index.js +5 -5
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +1 -14
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +13 -10
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/initializeJeScheduleLocalDataEpic.js +17 -38
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/retryJeSchedulesEpic.js +1 -17
- package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +1 -74
- package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +14 -49
- package/lib/esm/view/invoicing/createInvoice/createInvoiceSelector.js +28 -1
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogItemFormHelper.js +1 -7
- package/lib/esm/view/spendManagement/billPay/billDetailView/billDetailViewReducer.js +87 -1
- package/lib/esm/view/spendManagement/billPay/billDetailView/billDetailViewSelector.js +1 -0
- package/lib/esm/view/spendManagement/billPay/billDetailView/billDetailViewState.js +4 -0
- package/lib/esm/view/spendManagement/billPay/billDetailView/epics/fetchBillRecommendationsEpic.js +97 -0
- package/lib/esm/view/spendManagement/billPay/billDetailView/epics/fetchRecommendationsForBill.js +85 -0
- package/lib/esm/view/spendManagement/billPay/editBillView/editBillViewReducer.js +18 -1
- package/lib/esm/view/spendManagement/billPay/editBillView/editBillViewSelector.js +3 -0
- package/lib/esm/view/spendManagement/billPay/editBillView/epics/applyBillRecommendationsToLocalStoreEpic.js +95 -0
- package/lib/index.d.ts +5 -5
- package/lib/index.js +22 -22
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.d.ts +2 -2
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +0 -13
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +11 -8
- package/lib/view/expenseAutomationView/epics/jeSchedule/initializeJeScheduleLocalDataEpic.js +17 -38
- package/lib/view/expenseAutomationView/epics/jeSchedule/retryJeSchedulesEpic.d.ts +2 -2
- package/lib/view/expenseAutomationView/epics/jeSchedule/retryJeSchedulesEpic.js +1 -17
- package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +0 -18
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +3 -10
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +3 -76
- package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +0 -3
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +14 -49
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +0 -16
- package/lib/view/invoicing/createInvoice/createInvoiceSelector.d.ts +7 -2
- package/lib/view/invoicing/createInvoice/createInvoiceSelector.js +28 -1
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogItemFormHelper.d.ts +2 -2
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogItemFormHelper.js +1 -7
- package/lib/view/spendManagement/billPay/billDetailView/billDetailViewPayload.d.ts +19 -0
- package/lib/view/spendManagement/billPay/billDetailView/billDetailViewReducer.d.ts +10 -1
- package/lib/view/spendManagement/billPay/billDetailView/billDetailViewReducer.js +88 -2
- package/lib/view/spendManagement/billPay/billDetailView/billDetailViewSelector.d.ts +1 -0
- package/lib/view/spendManagement/billPay/billDetailView/billDetailViewSelector.js +1 -0
- package/lib/view/spendManagement/billPay/billDetailView/billDetailViewState.d.ts +7 -0
- package/lib/view/spendManagement/billPay/billDetailView/billDetailViewState.js +4 -0
- package/lib/view/spendManagement/billPay/billDetailView/epics/fetchBillRecommendationsEpic.d.ts +37 -0
- package/lib/view/spendManagement/billPay/billDetailView/epics/fetchBillRecommendationsEpic.js +104 -0
- package/lib/view/spendManagement/billPay/billDetailView/epics/fetchRecommendationsForBill.d.ts +24 -0
- package/lib/view/spendManagement/billPay/billDetailView/epics/fetchRecommendationsForBill.js +92 -0
- package/lib/view/spendManagement/billPay/editBillView/editBillViewReducer.d.ts +4 -1
- package/lib/view/spendManagement/billPay/editBillView/editBillViewReducer.js +19 -2
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.d.ts +1 -0
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +3 -0
- package/lib/view/spendManagement/billPay/editBillView/epics/applyBillRecommendationsToLocalStoreEpic.d.ts +18 -0
- package/lib/view/spendManagement/billPay/editBillView/epics/applyBillRecommendationsToLocalStoreEpic.js +102 -0
- package/package.json +1 -1
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchFailedJePostingsEpic.js +0 -39
- package/lib/tsconfig.mocks.tsbuildinfo +0 -1
- package/lib/tsconfig.typecheck.tsbuildinfo +0 -1
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchFailedJePostingsEpic.d.ts +0 -20
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchFailedJePostingsEpic.js +0 -43
|
@@ -78,24 +78,6 @@ interface ExpenseAutomationJESchedulesPayload {
|
|
|
78
78
|
};
|
|
79
79
|
}
|
|
80
80
|
export type ExpenseAutomationJESchedulesResponse = ZeniAPIResponse<ExpenseAutomationJESchedulesPayload>;
|
|
81
|
-
/**
|
|
82
|
-
* `GET /1.0/expenses_automation/failed_je_postings`.
|
|
83
|
-
*
|
|
84
|
-
* Deliberately the same `failed_je_postings` shape the schedules endpoint sends under that key, so
|
|
85
|
-
* both responses feed the same mappers. The difference is what the server does before answering:
|
|
86
|
-
* this endpoint applies no date window, so a posting that failed months ago still comes back.
|
|
87
|
-
*/
|
|
88
|
-
export interface FailedJePostingsPayload {
|
|
89
|
-
je_schedules: JEScheduledTransactionPayload[];
|
|
90
|
-
scheduled_journal_entries: ScheduledJournalEntryPayload[];
|
|
91
|
-
}
|
|
92
|
-
interface ExpenseAutomationFailedJePostingsPayload {
|
|
93
|
-
failed_je_postings: FailedJePostingsPayload;
|
|
94
|
-
query?: {
|
|
95
|
-
expected_post_start_date: string | null;
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
export type ExpenseAutomationFailedJePostingsResponse = ZeniAPIResponse<ExpenseAutomationFailedJePostingsPayload>;
|
|
99
81
|
export declare const SERVICE_MONTH_FORMAT = "YYYY-MM";
|
|
100
82
|
export interface CreateOneTimeAccrualPayload {
|
|
101
83
|
amount: number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ID } from '../../../commonStateTypes/common';
|
|
2
2
|
import { MonthYearPeriod, TimePeriod } from '../../../commonStateTypes/timePeriod';
|
|
3
3
|
import { AccountMetadataPayload } from '../../../entity/account/accountPayload';
|
|
4
|
-
import { JEAccruedScheduledTransactionPayload, JEOneTimeAccrualPayload, JEScheduledTransactionPayload
|
|
4
|
+
import { JEAccruedScheduledTransactionPayload, JEOneTimeAccrualPayload, JEScheduledTransactionPayload } from '../../../entity/jeSchedules/jeSchedulesPayload';
|
|
5
5
|
import { OneTimeAccrualEdits } from '../../../entity/jeSchedules/jeSchedulesState';
|
|
6
6
|
import { JEScheduleKey, JEScheduleTransactionKey, ScheduleTypes } from '../../../entity/jeSchedules/jeSchedulesTypes';
|
|
7
7
|
import { ZeniAPIStatus } from '../../../responsePayload';
|
|
@@ -47,14 +47,7 @@ export declare const clearExpenseAutomationJESchedulesView: import("@reduxjs/too
|
|
|
47
47
|
period: TimePeriod;
|
|
48
48
|
refreshViewInBackground: any;
|
|
49
49
|
selectedPageTab: "schedules" | "actual_matching" | "existing_schedules" | undefined;
|
|
50
|
-
}, "expenseAutomationJESchedulesView/fetchJeSchedules", never, never>,
|
|
51
|
-
refreshInBackground: any;
|
|
52
|
-
}, "expenseAutomationJESchedulesView/fetchFailedJePostings", never, never>, fetchFailedJePostingsFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[status: ZeniAPIStatus<Record<string, unknown>>], {
|
|
53
|
-
status: ZeniAPIStatus<Record<string, unknown>>;
|
|
54
|
-
}, "expenseAutomationJESchedulesView/fetchFailedJePostingsFailure", never, never>, fetchFailedJePostingsSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[failedJeSchedules: JEScheduledTransactionPayload[], failedScheduledJournalEntries: ScheduledJournalEntryPayload[]], {
|
|
55
|
-
failedJeSchedules: JEScheduledTransactionPayload[];
|
|
56
|
-
failedScheduledJournalEntries: ScheduledJournalEntryPayload[];
|
|
57
|
-
}, "expenseAutomationJESchedulesView/fetchFailedJePostingsSuccess", never, never>, fetchJeSchedulesFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
50
|
+
}, "expenseAutomationJESchedulesView/fetchJeSchedules", never, never>, fetchJeSchedulesFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
58
51
|
selectedPageTab: JEPageTab;
|
|
59
52
|
selectedPeriod: MonthYearPeriod;
|
|
60
53
|
status: ZeniAPIStatus;
|
|
@@ -139,7 +132,7 @@ export declare const clearExpenseAutomationJESchedulesView: import("@reduxjs/too
|
|
|
139
132
|
status: ZeniAPIStatus;
|
|
140
133
|
}, "expenseAutomationJESchedulesView/searchTransactionsForNewScheduleFailure">, searchTransactionsForNewScheduleSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
141
134
|
searchResults: JEScheduleTransactionKey[];
|
|
142
|
-
}, "expenseAutomationJESchedulesView/searchTransactionsForNewScheduleSuccess">, toggleJECreatedGroupCollapsed: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationJESchedulesView/toggleJECreatedGroupCollapsed">,
|
|
135
|
+
}, "expenseAutomationJESchedulesView/searchTransactionsForNewScheduleSuccess">, toggleJECreatedGroupCollapsed: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationJESchedulesView/toggleJECreatedGroupCollapsed">, toggleJEPendingGroupCollapsed: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationJESchedulesView/toggleJEPendingGroupCollapsed">, updateAccountSettingsListForAccountTypes: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
143
136
|
accountPayload: AccountMetadataPayload[];
|
|
144
137
|
}, "expenseAutomationJESchedulesView/updateAccountSettingsListForAccountTypes">, updateAccountSettingsListForAccountTypesFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
145
138
|
status: ZeniAPIStatus;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.saveAccountSettingsLocalData = exports.saveAccountSettingsFailure = exports.saveAccountSettings = exports.retryJeScheduleSuccess = exports.retryJeScheduleFailure = exports.retryJeSchedule = exports.resetNewScheduleLocalData = exports.removeJeScheduleTransactionKey = exports.removeJeAccruedScheduleKey = exports.removeJeScheduleLocalDataById = exports.removeJeOneTimeAccrualLocalData = exports.removeFailedJeScheduleTransactionKey = exports.initializeNewSchedule = exports.initializeJeScheduleLocalData = exports.initializeAccountSettingsView = exports.ignoreRecommendedJeScheduleSuccess = exports.ignoreRecommendedJeScheduleFailure = exports.ignoreRecommendedJeSchedule = exports.fetchRecommendationForAccountSettings = exports.fetchOneTimeAccrualSuccess = exports.fetchOneTimeAccrualFailure = exports.fetchOneTimeAccrual = exports.fetchJeSchedulesSuccess = exports.fetchJeSchedulesPage = exports.fetchJeSchedulesFailure = exports.
|
|
5
|
-
exports.updateRecommendationForAccountSettingsFailure = exports.updateRecommendationForAccountSettings = exports.updateNewScheduleLocalData = exports.updateJeScheduleTransactionKeys = exports.updateJeScheduleLocalDataById = exports.updateJeOneTimeAccrualLocalData = exports.updateJEScheduleTypeFilter = exports.updateJESchedulesUIState = exports.updateAccountSettingsListForAccountTypesFailure = exports.updateAccountSettingsListForAccountTypes = exports.toggleJEPendingGroupCollapsed = exports.
|
|
4
|
+
exports.saveNewScheduleFailure = exports.saveNewSchedule = exports.saveAccountSettingsSuccess = exports.saveAccountSettingsLocalData = exports.saveAccountSettingsFailure = exports.saveAccountSettings = exports.retryJeScheduleSuccess = exports.retryJeScheduleFailure = exports.retryJeSchedule = exports.resetNewScheduleLocalData = exports.removeJeScheduleTransactionKey = exports.removeJeAccruedScheduleKey = exports.removeJeScheduleLocalDataById = exports.removeJeOneTimeAccrualLocalData = exports.removeFailedJeScheduleTransactionKey = exports.initializeNewSchedule = exports.initializeJeScheduleLocalData = exports.initializeAccountSettingsView = exports.ignoreRecommendedJeScheduleSuccess = exports.ignoreRecommendedJeScheduleFailure = exports.ignoreRecommendedJeSchedule = exports.fetchRecommendationForAccountSettings = exports.fetchOneTimeAccrualSuccess = exports.fetchOneTimeAccrualFailure = exports.fetchOneTimeAccrual = exports.fetchJeSchedulesSuccess = exports.fetchJeSchedulesPage = exports.fetchJeSchedulesFailure = exports.fetchJeSchedules = exports.fetchAccountSettingsListForAccountTypes = exports.revertOneTimeAccrual = exports.revertJeScheduleSuccess = exports.revertJeScheduleFailure = exports.revertJeSchedule = exports.promoteOneTimeAccrual = exports.oneTimeAccrualActionSuccess = exports.oneTimeAccrualActionFailure = exports.ignoreOneTimeAccrual = exports.createOneTimeAccrualSuccess = exports.createOneTimeAccrualFailure = exports.createOneTimeAccrual = exports.clearSearchTransactionsForNewSchedule = exports.clearJeScheduleLocalData = exports.clearJeAccountSettingsLocalData = exports.clearExpenseAutomationJESchedulesView = exports.initialState = exports.searchTransactionsInitialState = exports.newScheduleInitialState = exports.getBaseNewScheduleLocalData = exports.accountSettingsInitialState = void 0;
|
|
5
|
+
exports.updateRecommendationForAccountSettingsFailure = exports.updateRecommendationForAccountSettings = exports.updateNewScheduleLocalData = exports.updateJeScheduleTransactionKeys = exports.updateJeScheduleLocalDataById = exports.updateJeOneTimeAccrualLocalData = exports.updateJEScheduleTypeFilter = exports.updateJESchedulesUIState = exports.updateAccountSettingsListForAccountTypesFailure = exports.updateAccountSettingsListForAccountTypes = exports.toggleJEPendingGroupCollapsed = exports.toggleJECreatedGroupCollapsed = exports.searchTransactionsForNewScheduleSuccess = exports.searchTransactionsForNewScheduleFailure = exports.searchTransactionsForNewSchedule = exports.saveNewScheduleSuccess = void 0;
|
|
6
6
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
7
7
|
const getNestedAccountIDHierarchyForReport_1 = require("../../../commonStateTypes/accountView/getNestedAccountIDHierarchyForReport");
|
|
8
8
|
const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
|
|
@@ -68,11 +68,6 @@ exports.initialState = {
|
|
|
68
68
|
jeScheduleAccruedKeysByPeriodAndTab: {},
|
|
69
69
|
jeScheduleOneTimeAccrualKeysByPeriodAndTab: {},
|
|
70
70
|
failedJeScheduleTransactionKeysByPeriodAndTab: {},
|
|
71
|
-
failedJePostings: {
|
|
72
|
-
fetchState: { fetchState: 'Not-Started', error: undefined },
|
|
73
|
-
jeScheduleTransactionKeys: [],
|
|
74
|
-
scheduledJournalEntryIDs: [],
|
|
75
|
-
},
|
|
76
71
|
postStatusById: {},
|
|
77
72
|
ignoreStatusById: {},
|
|
78
73
|
revertStatusById: {},
|
|
@@ -82,9 +77,6 @@ exports.initialState = {
|
|
|
82
77
|
oneTimeAccrualFetchStatusById: {},
|
|
83
78
|
uiState: {
|
|
84
79
|
createdGroupCollapsed: false,
|
|
85
|
-
// Expanded, like the other two. A failed posting is the only thing on this page that is
|
|
86
|
-
// actively wrong, so folding it away by default would hide the reason to open the tab.
|
|
87
|
-
failedGroupCollapsed: false,
|
|
88
80
|
pendingGroupCollapsed: false,
|
|
89
81
|
scrollPosition: { scrollTop: 0, scrollLeft: undefined },
|
|
90
82
|
searchString: '',
|
|
@@ -156,59 +148,6 @@ const expenseAutomationJESchedulesView = (0, toolkit_1.createSlice)({
|
|
|
156
148
|
};
|
|
157
149
|
},
|
|
158
150
|
},
|
|
159
|
-
/**
|
|
160
|
-
* The Failed Postings list, fetched separately from the schedules it belongs to.
|
|
161
|
-
*
|
|
162
|
-
* No period and no tab in any of these three: the endpoint applies no date window, so there is
|
|
163
|
-
* one list per tenant and one slot to hold it. `refreshInBackground` keeps a silent refetch
|
|
164
|
-
* from dropping a skeleton over rows already on screen, the same way refreshStatus does for
|
|
165
|
-
* the schedules list.
|
|
166
|
-
*/
|
|
167
|
-
fetchFailedJePostings: {
|
|
168
|
-
reducer(draft, action) {
|
|
169
|
-
if (!action.payload.refreshInBackground) {
|
|
170
|
-
draft.failedJePostings.fetchState = {
|
|
171
|
-
fetchState: 'In-Progress',
|
|
172
|
-
error: undefined,
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
},
|
|
176
|
-
prepare(refreshInBackground = false) {
|
|
177
|
-
return { payload: { refreshInBackground } };
|
|
178
|
-
},
|
|
179
|
-
},
|
|
180
|
-
fetchFailedJePostingsSuccess: {
|
|
181
|
-
reducer(draft, action) {
|
|
182
|
-
// Both lists are replaced, never merged: this response is the whole current answer to
|
|
183
|
-
// "what is failing right now", so an entry it no longer names has stopped failing --
|
|
184
|
-
// resolved by someone else, or posted since -- and must drop out of the group.
|
|
185
|
-
draft.failedJePostings = {
|
|
186
|
-
fetchState: { fetchState: 'Completed', error: undefined },
|
|
187
|
-
jeScheduleTransactionKeys: action.payload.failedJeSchedules.map((schedule) => (0, jeSchedulesPayload_1.getJEScheduleTransactionDetailKeyPayload)(schedule.base_transaction)),
|
|
188
|
-
// `?? ''` mirrors toScheduledJournalEntryState, so an entry the server sent without an
|
|
189
|
-
// id lands on the same value on both sides and still matches itself.
|
|
190
|
-
scheduledJournalEntryIDs: action.payload.failedScheduledJournalEntries.map((journalEntry) => journalEntry.scheduled_journal_entry_id ?? ''),
|
|
191
|
-
};
|
|
192
|
-
},
|
|
193
|
-
prepare(failedJeSchedules, failedScheduledJournalEntries) {
|
|
194
|
-
return { payload: { failedJeSchedules, failedScheduledJournalEntries } };
|
|
195
|
-
},
|
|
196
|
-
},
|
|
197
|
-
fetchFailedJePostingsFailure: {
|
|
198
|
-
reducer(draft, action) {
|
|
199
|
-
// Keys are deliberately left alone. The schedules list clears its buckets on failure so an
|
|
200
|
-
// errored tab cannot read as "these are all the schedules there are", but this list is a
|
|
201
|
-
// set of outstanding problems -- showing the last known ones beside an error beats
|
|
202
|
-
// implying there are none.
|
|
203
|
-
draft.failedJePostings.fetchState = {
|
|
204
|
-
fetchState: 'Error',
|
|
205
|
-
error: action.payload.status,
|
|
206
|
-
};
|
|
207
|
-
},
|
|
208
|
-
prepare(status) {
|
|
209
|
-
return { payload: { status } };
|
|
210
|
-
},
|
|
211
|
-
},
|
|
212
151
|
fetchJeSchedulesSuccess(draft, action) {
|
|
213
152
|
const { jeSchedules, selectedPeriod, selectedPageTab, failedJeSchedules, accruedJeSchedules, oneTimeAccruals, refreshViewInBackground, } = action.payload;
|
|
214
153
|
const periodTabKey = (0, jeSchedulesViewState_1.getJESchedulePeriodTabKey)(selectedPageTab, (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod));
|
|
@@ -271,13 +210,6 @@ const expenseAutomationJESchedulesView = (0, toolkit_1.createSlice)({
|
|
|
271
210
|
error: undefined,
|
|
272
211
|
},
|
|
273
212
|
};
|
|
274
|
-
// This posting has just succeeded, so it is no longer part of the failing set. Removing the
|
|
275
|
-
// entry from the schedule entity is not enough on its own: a later detail or Quick View
|
|
276
|
-
// fetch re-adds that month from the server, and because is_posting_failed is never cleared
|
|
277
|
-
// it can still arrive carrying its old error array. With the id left in place the selector
|
|
278
|
-
// would match it again and put a Retry button back on a posting that already went through.
|
|
279
|
-
draft.failedJePostings.scheduledJournalEntryIDs =
|
|
280
|
-
draft.failedJePostings.scheduledJournalEntryIDs.filter((failedEntryID) => failedEntryID !== scheduledJournalEntryID);
|
|
281
213
|
},
|
|
282
214
|
retryJeScheduleFailure(draft, action) {
|
|
283
215
|
const { status, scheduledJournalEntryID } = action.payload;
|
|
@@ -432,8 +364,6 @@ const expenseAutomationJESchedulesView = (0, toolkit_1.createSlice)({
|
|
|
432
364
|
reducer(draft, action) {
|
|
433
365
|
const { failedJeScheduleKey } = action.payload;
|
|
434
366
|
removeKeyFromEveryTabSlot(draft.failedJeScheduleTransactionKeysByPeriodAndTab, failedJeScheduleKey);
|
|
435
|
-
draft.failedJePostings.jeScheduleTransactionKeys =
|
|
436
|
-
draft.failedJePostings.jeScheduleTransactionKeys.filter((jeScheduleKey) => jeScheduleKey !== failedJeScheduleKey);
|
|
437
367
|
},
|
|
438
368
|
},
|
|
439
369
|
initializeJeScheduleLocalData: {
|
|
@@ -776,9 +706,6 @@ const expenseAutomationJESchedulesView = (0, toolkit_1.createSlice)({
|
|
|
776
706
|
draft.uiState.createdGroupCollapsed =
|
|
777
707
|
!draft.uiState.createdGroupCollapsed;
|
|
778
708
|
},
|
|
779
|
-
toggleJEFailedGroupCollapsed(draft) {
|
|
780
|
-
draft.uiState.failedGroupCollapsed = !draft.uiState.failedGroupCollapsed;
|
|
781
|
-
},
|
|
782
709
|
clearExpenseAutomationJESchedulesView(draft) {
|
|
783
710
|
Object.assign(draft, exports.initialState);
|
|
784
711
|
},
|
|
@@ -789,7 +716,7 @@ const expenseAutomationJESchedulesView = (0, toolkit_1.createSlice)({
|
|
|
789
716
|
});
|
|
790
717
|
},
|
|
791
718
|
});
|
|
792
|
-
_a = expenseAutomationJESchedulesView.actions, exports.clearExpenseAutomationJESchedulesView = _a.clearExpenseAutomationJESchedulesView, exports.clearJeAccountSettingsLocalData = _a.clearJeAccountSettingsLocalData, exports.clearJeScheduleLocalData = _a.clearJeScheduleLocalData, exports.clearSearchTransactionsForNewSchedule = _a.clearSearchTransactionsForNewSchedule, exports.createOneTimeAccrual = _a.createOneTimeAccrual, exports.createOneTimeAccrualFailure = _a.createOneTimeAccrualFailure, exports.createOneTimeAccrualSuccess = _a.createOneTimeAccrualSuccess, exports.ignoreOneTimeAccrual = _a.ignoreOneTimeAccrual, exports.oneTimeAccrualActionFailure = _a.oneTimeAccrualActionFailure, exports.oneTimeAccrualActionSuccess = _a.oneTimeAccrualActionSuccess, exports.promoteOneTimeAccrual = _a.promoteOneTimeAccrual, exports.revertJeSchedule = _a.revertJeSchedule, exports.revertJeScheduleFailure = _a.revertJeScheduleFailure, exports.revertJeScheduleSuccess = _a.revertJeScheduleSuccess, exports.revertOneTimeAccrual = _a.revertOneTimeAccrual, exports.fetchAccountSettingsListForAccountTypes = _a.fetchAccountSettingsListForAccountTypes, exports.fetchJeSchedules = _a.fetchJeSchedules, exports.
|
|
719
|
+
_a = expenseAutomationJESchedulesView.actions, exports.clearExpenseAutomationJESchedulesView = _a.clearExpenseAutomationJESchedulesView, exports.clearJeAccountSettingsLocalData = _a.clearJeAccountSettingsLocalData, exports.clearJeScheduleLocalData = _a.clearJeScheduleLocalData, exports.clearSearchTransactionsForNewSchedule = _a.clearSearchTransactionsForNewSchedule, exports.createOneTimeAccrual = _a.createOneTimeAccrual, exports.createOneTimeAccrualFailure = _a.createOneTimeAccrualFailure, exports.createOneTimeAccrualSuccess = _a.createOneTimeAccrualSuccess, exports.ignoreOneTimeAccrual = _a.ignoreOneTimeAccrual, exports.oneTimeAccrualActionFailure = _a.oneTimeAccrualActionFailure, exports.oneTimeAccrualActionSuccess = _a.oneTimeAccrualActionSuccess, exports.promoteOneTimeAccrual = _a.promoteOneTimeAccrual, exports.revertJeSchedule = _a.revertJeSchedule, exports.revertJeScheduleFailure = _a.revertJeScheduleFailure, exports.revertJeScheduleSuccess = _a.revertJeScheduleSuccess, exports.revertOneTimeAccrual = _a.revertOneTimeAccrual, exports.fetchAccountSettingsListForAccountTypes = _a.fetchAccountSettingsListForAccountTypes, exports.fetchJeSchedules = _a.fetchJeSchedules, exports.fetchJeSchedulesFailure = _a.fetchJeSchedulesFailure, exports.fetchJeSchedulesPage = _a.fetchJeSchedulesPage, exports.fetchJeSchedulesSuccess = _a.fetchJeSchedulesSuccess, exports.fetchOneTimeAccrual = _a.fetchOneTimeAccrual, exports.fetchOneTimeAccrualFailure = _a.fetchOneTimeAccrualFailure, exports.fetchOneTimeAccrualSuccess = _a.fetchOneTimeAccrualSuccess, exports.fetchRecommendationForAccountSettings = _a.fetchRecommendationForAccountSettings, exports.ignoreRecommendedJeSchedule = _a.ignoreRecommendedJeSchedule, exports.ignoreRecommendedJeScheduleFailure = _a.ignoreRecommendedJeScheduleFailure, exports.ignoreRecommendedJeScheduleSuccess = _a.ignoreRecommendedJeScheduleSuccess, exports.initializeAccountSettingsView = _a.initializeAccountSettingsView, exports.initializeJeScheduleLocalData = _a.initializeJeScheduleLocalData, exports.initializeNewSchedule = _a.initializeNewSchedule, exports.removeFailedJeScheduleTransactionKey = _a.removeFailedJeScheduleTransactionKey, exports.removeJeOneTimeAccrualLocalData = _a.removeJeOneTimeAccrualLocalData, exports.removeJeScheduleLocalDataById = _a.removeJeScheduleLocalDataById, exports.removeJeAccruedScheduleKey = _a.removeJeAccruedScheduleKey, exports.removeJeScheduleTransactionKey = _a.removeJeScheduleTransactionKey, exports.resetNewScheduleLocalData = _a.resetNewScheduleLocalData, exports.retryJeSchedule = _a.retryJeSchedule, exports.retryJeScheduleFailure = _a.retryJeScheduleFailure, exports.retryJeScheduleSuccess = _a.retryJeScheduleSuccess, exports.saveAccountSettings = _a.saveAccountSettings, exports.saveAccountSettingsFailure = _a.saveAccountSettingsFailure, exports.saveAccountSettingsLocalData = _a.saveAccountSettingsLocalData, exports.saveAccountSettingsSuccess = _a.saveAccountSettingsSuccess, exports.saveNewSchedule = _a.saveNewSchedule, exports.saveNewScheduleFailure = _a.saveNewScheduleFailure, exports.saveNewScheduleSuccess = _a.saveNewScheduleSuccess, exports.searchTransactionsForNewSchedule = _a.searchTransactionsForNewSchedule, exports.searchTransactionsForNewScheduleFailure = _a.searchTransactionsForNewScheduleFailure, exports.searchTransactionsForNewScheduleSuccess = _a.searchTransactionsForNewScheduleSuccess, exports.toggleJECreatedGroupCollapsed = _a.toggleJECreatedGroupCollapsed, exports.toggleJEPendingGroupCollapsed = _a.toggleJEPendingGroupCollapsed, exports.updateAccountSettingsListForAccountTypes = _a.updateAccountSettingsListForAccountTypes, exports.updateAccountSettingsListForAccountTypesFailure = _a.updateAccountSettingsListForAccountTypesFailure, exports.updateJESchedulesUIState = _a.updateJESchedulesUIState, exports.updateJEScheduleTypeFilter = _a.updateJEScheduleTypeFilter, exports.updateJeOneTimeAccrualLocalData = _a.updateJeOneTimeAccrualLocalData, exports.updateJeScheduleLocalDataById = _a.updateJeScheduleLocalDataById, exports.updateJeScheduleTransactionKeys = _a.updateJeScheduleTransactionKeys, exports.updateNewScheduleLocalData = _a.updateNewScheduleLocalData, exports.updateRecommendationForAccountSettings = _a.updateRecommendationForAccountSettings, exports.updateRecommendationForAccountSettingsFailure = _a.updateRecommendationForAccountSettingsFailure;
|
|
793
720
|
exports.default = expenseAutomationJESchedulesView.reducer;
|
|
794
721
|
const doUpdateRecommendationForAccountSettings = (draft, payload) => {
|
|
795
722
|
const { prepaidExpensesRecommendations, fixedAssetsRecommendations, accruedExpensesRecommendations, } = (0, accountTypeRecommendationPayload_1.mapAccountTypeRecommendationPayloadToAccountRecommendationByType)(payload);
|
|
@@ -47,8 +47,6 @@ export interface ExpenseAutomationJESchedulesViewSelector extends SelectorView {
|
|
|
47
47
|
completionStatus: CompletionStatusType;
|
|
48
48
|
createdSchedules: JEScheduleRow[];
|
|
49
49
|
createdTotal: number;
|
|
50
|
-
failedPostings: JEScheduledTransactionWithFailedEntries[];
|
|
51
|
-
failedPostingsFetchState: FetchStateAndError;
|
|
52
50
|
hasLoadedForSelectedTab: boolean;
|
|
53
51
|
ignoreStatusById: Record<JEScheduleTransactionKey, FetchStateAndError>;
|
|
54
52
|
jeScheduleLocalDataById: Record<ID, JEScheduleLocalData>;
|
|
@@ -63,7 +61,6 @@ export interface ExpenseAutomationJESchedulesViewSelector extends SelectorView {
|
|
|
63
61
|
pendingReviewTotal: number;
|
|
64
62
|
postStatusById: Record<ID, FetchStateAndError>;
|
|
65
63
|
refreshStatus: FetchStateAndError;
|
|
66
|
-
/** @deprecated Alias of `failedPostings`. Remove once webc and app-ui are repointed. */
|
|
67
64
|
resolveSchedules: JEScheduledTransactionWithFailedEntries[];
|
|
68
65
|
revertStatusById: Record<JEScheduleKey | JEScheduleTransactionKey, FetchStateAndError>;
|
|
69
66
|
scheduleCountsByTab: Partial<Record<JEPageTab, number>>;
|
|
@@ -225,7 +225,7 @@ function getExpenseAutomationJESchedulesView(state) {
|
|
|
225
225
|
const accruedSchedules = [];
|
|
226
226
|
const oneTimeAccruals = [];
|
|
227
227
|
const { accountState, accountListState, classState, classListState, expenseAutomationJESchedulesViewState, expenseAutomationViewState, monthEndCloseChecksState, } = state;
|
|
228
|
-
const { jeScheduleTransactionKeysByPeriodAndTab, jeScheduleAccruedKeysByPeriodAndTab, jeScheduleOneTimeAccrualKeysByPeriodAndTab,
|
|
228
|
+
const { jeScheduleTransactionKeysByPeriodAndTab, jeScheduleAccruedKeysByPeriodAndTab, jeScheduleOneTimeAccrualKeysByPeriodAndTab, failedJeScheduleTransactionKeysByPeriodAndTab, jeScheduleLocalDataById, postStatusById, ignoreStatusById, revertStatusById, oneTimeAccrualActionStatusById, uiState, error, fetchState, refreshStatus, newSchedule, } = expenseAutomationJESchedulesViewState;
|
|
229
229
|
const accountSettingsView = (0, jeAccountSettingsViewSelector_1.getJEAccountSettingsView)(state);
|
|
230
230
|
const newScheduleView = newSchedule.selectedDetailScheduleType === 'fixed_assets' ||
|
|
231
231
|
newSchedule.selectedDetailScheduleType === 'prepaid_expenses'
|
|
@@ -264,11 +264,15 @@ function getExpenseAutomationJESchedulesView(state) {
|
|
|
264
264
|
const jeScheduleTransactionKeysForSelectedTab = selectedPeriodTabKey != null
|
|
265
265
|
? jeScheduleTransactionKeysByPeriodAndTab[selectedPeriodTabKey]
|
|
266
266
|
: undefined;
|
|
267
|
+
const failedJeScheduleTransactionKeysForSelectedTab = selectedPeriodTabKey != null
|
|
268
|
+
? failedJeScheduleTransactionKeysByPeriodAndTab[selectedPeriodTabKey]
|
|
269
|
+
: undefined;
|
|
267
270
|
// Distinguishes "this tab has never been fetched for this period" from "fetched and genuinely
|
|
268
271
|
// empty". Without it the page cannot tell a first visit from a real empty state, and renders an
|
|
269
272
|
// empty table where it should render a skeleton.
|
|
270
273
|
const hasLoadedForSelectedTab = jeScheduleTransactionKeysForSelectedTab != null;
|
|
271
274
|
const jeScheduleTransactionKeys = jeScheduleTransactionKeysForSelectedTab ?? [];
|
|
275
|
+
const failedJeScheduleTransactionKeys = failedJeScheduleTransactionKeysForSelectedTab ?? [];
|
|
272
276
|
const jeScheduleAccruedKeys = (selectedPeriodTabKey != null
|
|
273
277
|
? jeScheduleAccruedKeysByPeriodAndTab[selectedPeriodTabKey]
|
|
274
278
|
: undefined) ?? [];
|
|
@@ -291,57 +295,24 @@ function getExpenseAutomationJESchedulesView(state) {
|
|
|
291
295
|
accruedSchedules.push(accruedScheduleDetails);
|
|
292
296
|
}
|
|
293
297
|
});
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
failedJePostings.jeScheduleTransactionKeys.forEach((jeScheduleKey) => {
|
|
298
|
-
// getJEScheduledTransactionByJEScheduleTransactionKey throws three different ways: it
|
|
299
|
-
// destructures the result of recordGet without a null check, and it raises explicitly for a
|
|
300
|
-
// missing vendor and for a missing base transaction. Catching rather than pre-checking each
|
|
301
|
-
// one keeps this correct if a fourth is added, and none of the three is recoverable here --
|
|
302
|
-
// the row cannot be drawn either way.
|
|
303
|
-
//
|
|
304
|
-
// This matters more for this bucket than anywhere else on the page. It is tenant-wide, so it
|
|
305
|
-
// names schedules the close-month list never loaded, and the group is defined by deleted
|
|
306
|
-
// vendors and deleted categories -- precisely the rows whose entities are most likely to be
|
|
307
|
-
// missing. Unguarded, one such key takes down the whole JE tab instead of dropping one row.
|
|
308
|
-
try {
|
|
309
|
-
failedJeScheduledTransaction.push((0, jeSchedulesSelector_1.getJEScheduledTransactionByJEScheduleTransactionKey)(jeScheduleKey, state));
|
|
310
|
-
}
|
|
311
|
-
catch {
|
|
312
|
-
// Intentionally swallowed: a failed posting we cannot resolve is one missing row, and the
|
|
313
|
-
// alternative is a blank page for every other row too.
|
|
314
|
-
}
|
|
298
|
+
failedJeScheduleTransactionKeys.forEach((jeScheduleKey) => {
|
|
299
|
+
const jeScheduleDetails = (0, jeSchedulesSelector_1.getJEScheduledTransactionByJEScheduleTransactionKey)(jeScheduleKey, state);
|
|
300
|
+
failedJeScheduledTransaction.push(jeScheduleDetails);
|
|
315
301
|
});
|
|
316
|
-
// What the endpoint last reported as failing. The entity store keeps every month a schedule
|
|
317
|
-
// has and an entry resolved by someone else keeps its old `error` array, so `error` alone would
|
|
318
|
-
// leave a Retry button on a posting that is no longer failing.
|
|
319
|
-
const failedScheduledJournalEntryIDs = new Set(failedJePostings.scheduledJournalEntryIDs);
|
|
320
302
|
const { sortKey, sortOrder, selectedJETypeFilter } = uiState;
|
|
321
|
-
const matchesTypeFilter = (schedule) => selectedJETypeFilter == null ||
|
|
322
|
-
getJEScheduleRowType(schedule) === selectedJETypeFilter;
|
|
323
303
|
const unsortedResolveSchedules = [];
|
|
324
304
|
failedJeScheduledTransaction.forEach((schedule) => {
|
|
325
|
-
|
|
326
|
-
// opening a schedule's detail page or Quick View replaces it with every month the schedule
|
|
327
|
-
// has, posted ones included, so fanning out over all of them turned one failed posting into a
|
|
328
|
-
// row per month -- and a month that never failed has nothing to resolve, so it rendered with
|
|
329
|
-
// an empty action column.
|
|
330
|
-
//
|
|
331
|
-
// Intersected with the ids the endpoint actually returned, not just `error`: the entry array
|
|
332
|
-
// is a cache of every month, and an entry whose failure someone else resolved keeps its stale
|
|
333
|
-
// error array until something overwrites it. Only what the last fetch named is still failing.
|
|
334
|
-
schedule.scheduledJournalEntry
|
|
335
|
-
.filter((journalEntry) => journalEntry.error.length > 0 &&
|
|
336
|
-
failedScheduledJournalEntryIDs.has(journalEntry.scheduledJournalEntryID))
|
|
337
|
-
.forEach((journalEntry) => {
|
|
305
|
+
schedule.scheduledJournalEntry.forEach((journalEntry) => {
|
|
338
306
|
unsortedResolveSchedules.push({
|
|
339
307
|
...schedule,
|
|
340
308
|
scheduledJournalEntry: journalEntry,
|
|
341
309
|
});
|
|
342
310
|
});
|
|
343
311
|
});
|
|
344
|
-
const resolveSchedules = sortJEScheduledTransactions(unsortedResolveSchedules
|
|
312
|
+
const resolveSchedules = sortJEScheduledTransactions(unsortedResolveSchedules, sortKey, sortOrder);
|
|
313
|
+
const validResolveForPending = unsortedResolveSchedules.filter((r) => jeScheduleLocalDataById[r.scheduledJournalEntry.scheduledJournalEntryID] != null);
|
|
314
|
+
const matchesTypeFilter = (schedule) => selectedJETypeFilter == null ||
|
|
315
|
+
getJEScheduleRowType(schedule) === selectedJETypeFilter;
|
|
345
316
|
const isCreatedStatus = (schedule) => {
|
|
346
317
|
// An accrual is "created" once it is not review work: posted, reversing, reversed, or in a
|
|
347
318
|
// transient posting claim.
|
|
@@ -359,6 +330,7 @@ function getExpenseAutomationJESchedulesView(state) {
|
|
|
359
330
|
];
|
|
360
331
|
const pendingReviewSchedules = sortJEScheduledTransactions([
|
|
361
332
|
...allScheduleRows.filter((schedule) => isPendingReviewRow(schedule) && matchesTypeFilter(schedule)),
|
|
333
|
+
...validResolveForPending,
|
|
362
334
|
], sortKey, sortOrder);
|
|
363
335
|
const createdSchedules = sortJEScheduledTransactions(allScheduleRows.filter((schedule) => isCreatedStatus(schedule) && matchesTypeFilter(schedule)), sortKey, sortOrder);
|
|
364
336
|
// KPI summary — derived from unfiltered schedules so counts are always accurate
|
|
@@ -477,13 +449,6 @@ function getExpenseAutomationJESchedulesView(state) {
|
|
|
477
449
|
kpiSummary,
|
|
478
450
|
pendingReviewSchedules,
|
|
479
451
|
pendingReviewTotal,
|
|
480
|
-
failedPostings: resolveSchedules,
|
|
481
|
-
// Exposed so a consumer can tell "still loading" and "the lookup failed" from "nothing has
|
|
482
|
-
// failed". The bucket keeps its rows on failure precisely so an error can be shown beside
|
|
483
|
-
// them, which is only possible if the state travels with them.
|
|
484
|
-
failedPostingsFetchState: failedJePostings.fetchState,
|
|
485
|
-
// Deprecated alias of failedPostings. Still read by the section's footer-form effect and by
|
|
486
|
-
// app-ui analytics; remove once both are repointed.
|
|
487
452
|
resolveSchedules: resolveSchedules,
|
|
488
453
|
accountSettingsView,
|
|
489
454
|
newScheduleView,
|
|
@@ -19,7 +19,6 @@ export type JESchedulePeriodTabKey = `${JEPageTab}_${MonthYearPeriodId}`;
|
|
|
19
19
|
export declare const getJESchedulePeriodTabKey: (selectedPageTab: JEPageTab, monthYearPeriodId: MonthYearPeriodId) => JESchedulePeriodTabKey;
|
|
20
20
|
export interface JESchedulesViewUIState {
|
|
21
21
|
createdGroupCollapsed: boolean;
|
|
22
|
-
failedGroupCollapsed: boolean;
|
|
23
22
|
pendingGroupCollapsed: boolean;
|
|
24
23
|
scrollPosition: {
|
|
25
24
|
scrollTop: number;
|
|
@@ -42,23 +41,8 @@ export interface JEScheduleLocalData {
|
|
|
42
41
|
updatedClassId?: ID;
|
|
43
42
|
updatedVendor?: VendorBase;
|
|
44
43
|
}
|
|
45
|
-
/**
|
|
46
|
-
* The Failed Postings bucket, and the only list on this page that is not scoped to a period.
|
|
47
|
-
*
|
|
48
|
-
* A failed posting is broken until someone resolves it, whatever month it belongs to, so windowing
|
|
49
|
-
* it the way the schedule lists are windowed is what hid a March failure from the September close.
|
|
50
|
-
* It therefore has no period-tab key, and its own fetch state rather than the slice's: the list is
|
|
51
|
-
* fetched separately from `/1.0/expenses_automation/failed_je_postings`, so a slow or failing
|
|
52
|
-
* lookup here must not blank the schedules table, or vice versa.
|
|
53
|
-
*/
|
|
54
|
-
export interface FailedJePostingsState {
|
|
55
|
-
fetchState: FetchStateAndError;
|
|
56
|
-
jeScheduleTransactionKeys: JEScheduleTransactionKey[];
|
|
57
|
-
scheduledJournalEntryIDs: ID[];
|
|
58
|
-
}
|
|
59
44
|
export interface JESchedulesViewState extends FetchedState {
|
|
60
45
|
accountSettings: AccountSettingsState;
|
|
61
|
-
failedJePostings: FailedJePostingsState;
|
|
62
46
|
failedJeScheduleTransactionKeysByPeriodAndTab: Record<JESchedulePeriodTabKey, JEScheduleTransactionKey[]>;
|
|
63
47
|
ignoreStatusById: Record<JEScheduleTransactionKey, FetchStateAndError>;
|
|
64
48
|
jeScheduleAccruedKeysByPeriodAndTab: Record<JESchedulePeriodTabKey, JEScheduleKey[]>;
|
|
@@ -9,8 +9,13 @@ import { InvoicingCreateInvoiceFormLocalData } from './createInvoiceState';
|
|
|
9
9
|
* One catalog plan price, split into its two naming parts so consumers can
|
|
10
10
|
* compose the label themselves (the plan family name and the price point/price
|
|
11
11
|
* name are separate columns in the catalog). `price` is the price point's
|
|
12
|
-
*
|
|
13
|
-
*
|
|
12
|
+
* per-unit amount in whole USD (never minor units): the service-computed
|
|
13
|
+
* single-unit display price, falling back to the configured price for
|
|
14
|
+
* responses predating it. It is absent when the catalog carries no price for
|
|
15
|
+
* it, and deliberately absent for tiered, volume and stairstep price points —
|
|
16
|
+
* their single-unit figure is a step/band fee, not a rate, so multiplying it
|
|
17
|
+
* by a quantity (which is what the Create Invoice line prefill does) would
|
|
18
|
+
* produce a plausible-looking wrong total. Those lines start unpriced.
|
|
14
19
|
*/
|
|
15
20
|
export interface InvoicingPlanNameOption {
|
|
16
21
|
planName: string;
|
|
@@ -2,10 +2,37 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getCreateInvoiceFormView = void 0;
|
|
4
4
|
const addressSelector_1 = require("../../../entity/address/addressSelector");
|
|
5
|
+
const planSelector_1 = require("../../../entity/invoicing/plan/planSelector");
|
|
5
6
|
const invoicingCatalogListViewSelector_1 = require("../invoicingCatalogListView/invoicingCatalogListViewSelector");
|
|
6
7
|
const invoicingConfigViewSelector_1 = require("../invoicingConfigView/invoicingConfigViewSelector");
|
|
7
8
|
const invoicingCustomerListViewSelector_1 = require("../invoicingCustomerListView/invoicingCustomerListViewSelector");
|
|
8
9
|
const settingsViewSelector_1 = require("../settingsView/settingsViewSelector");
|
|
10
|
+
/**
|
|
11
|
+
* Pricing models whose single-unit amount is a true per-unit rate — the only
|
|
12
|
+
* ones a Create Invoice line may be prefilled from. Typed against the entity
|
|
13
|
+
* union so a misspelt member fails to compile; a model added to the union
|
|
14
|
+
* still has to be classified here by hand (it is left out, so it fails closed:
|
|
15
|
+
* no prefill). The complement is `isTieredCatalogPricingModel`.
|
|
16
|
+
*/
|
|
17
|
+
const PER_UNIT_RATE_PRICING_MODELS = [
|
|
18
|
+
'per_unit',
|
|
19
|
+
'flat_fee',
|
|
20
|
+
];
|
|
21
|
+
/**
|
|
22
|
+
* Whether a price point's single-unit amount is a per-unit rate. A missing
|
|
23
|
+
* model means per-unit: the service defaults `pricing_model` to `per_unit`
|
|
24
|
+
* and older records may omit it.
|
|
25
|
+
*/
|
|
26
|
+
const hasPerUnitRate = (pricingModel) => pricingModel == null ||
|
|
27
|
+
pricingModel === '' ||
|
|
28
|
+
PER_UNIT_RATE_PRICING_MODELS.some((model) => model === pricingModel);
|
|
29
|
+
/**
|
|
30
|
+
* The amount to prefill on a Create Invoice line for a price point, or
|
|
31
|
+
* `undefined` when there is no safe per-unit rate to prefill.
|
|
32
|
+
*/
|
|
33
|
+
const planNamePrefillPrice = (pricePoint) => hasPerUnitRate(pricePoint.pricingModel)
|
|
34
|
+
? (0, planSelector_1.invoicingPricePointDisplayAmount)(pricePoint)?.amount
|
|
35
|
+
: undefined;
|
|
9
36
|
/**
|
|
10
37
|
* Display name for a customer option: company, else the full name, else the
|
|
11
38
|
* email, else the raw id.
|
|
@@ -50,7 +77,7 @@ const getCreateInvoiceFormView = (state) => {
|
|
|
50
77
|
.filter((subFamily) => (subFamily.name ?? '') !== '')
|
|
51
78
|
.map((subFamily) => ({
|
|
52
79
|
planName: plan.name ?? '',
|
|
53
|
-
price: subFamily
|
|
80
|
+
price: planNamePrefillPrice(subFamily),
|
|
54
81
|
subFamilyName: subFamily.name ?? '',
|
|
55
82
|
}))),
|
|
56
83
|
products: (0, invoicingCatalogListViewSelector_1.getInvoicingCatalogPrices)(catalogListView.products),
|
package/lib/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogItemFormHelper.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { InvoicingPlan } from '../../../entity/invoicing/plan/planState';
|
|
2
|
-
import { InvoicingProduct } from '../../../entity/invoicing/product/productState';
|
|
2
|
+
import { InvoicingCatalogPricingModel, InvoicingProduct } from '../../../entity/invoicing/product/productState';
|
|
3
3
|
import { InvoicingCatalogItemFormLocalData, InvoicingCatalogItemFormSubFamily, InvoicingCatalogItemFormTier } from './editInvoicingCatalogItemDetailViewState';
|
|
4
4
|
/**
|
|
5
5
|
* Value sets the catalog item form still owns locally: the backend has no enum
|
|
6
6
|
* for pricing model, tier type, proration or applicability yet, so these stay
|
|
7
7
|
* here until it does. Everything else on this form comes from `/1.0/config`.
|
|
8
8
|
*/
|
|
9
|
-
export declare const INVOICING_CATALOG_PRICING_MODEL_VALUES: readonly [
|
|
9
|
+
export declare const INVOICING_CATALOG_PRICING_MODEL_VALUES: readonly InvoicingCatalogPricingModel[];
|
|
10
10
|
export declare const INVOICING_CATALOG_TIER_TYPE_VALUES: readonly ["per_unit", "flat_fee", "package"];
|
|
11
11
|
export declare const INVOICING_CATALOG_PRORATION_VALUES: readonly ["site_default", "partial_term", "full_term"];
|
|
12
12
|
export declare const INVOICING_CATALOG_APPLICABILITY_VALUES: readonly ["all", "restricted"];
|
package/lib/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogItemFormHelper.js
CHANGED
|
@@ -6,13 +6,7 @@ exports.entityToInvoicingCatalogItemFormLocalData = exports.initialInvoicingCata
|
|
|
6
6
|
* for pricing model, tier type, proration or applicability yet, so these stay
|
|
7
7
|
* here until it does. Everything else on this form comes from `/1.0/config`.
|
|
8
8
|
*/
|
|
9
|
-
exports.INVOICING_CATALOG_PRICING_MODEL_VALUES = [
|
|
10
|
-
'flat_fee',
|
|
11
|
-
'per_unit',
|
|
12
|
-
'tiered',
|
|
13
|
-
'volume',
|
|
14
|
-
'stairstep',
|
|
15
|
-
];
|
|
9
|
+
exports.INVOICING_CATALOG_PRICING_MODEL_VALUES = ['flat_fee', 'per_unit', 'tiered', 'volume', 'stairstep'];
|
|
16
10
|
exports.INVOICING_CATALOG_TIER_TYPE_VALUES = [
|
|
17
11
|
'per_unit',
|
|
18
12
|
'flat_fee',
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { RecommendationPayload } from '../../../../commonPayloadTypes/recommendationPayload';
|
|
2
|
+
import { ID } from '../../../../commonStateTypes/common';
|
|
1
3
|
import { AccountPayload } from '../../../../entity/account/accountPayload';
|
|
2
4
|
import { ApprovalRulePayload } from '../../../../entity/approvalRule/approvalRulePayload';
|
|
3
5
|
import { BankAccountPayload } from '../../../../entity/bankAccount/bankAccountPayload';
|
|
@@ -28,6 +30,22 @@ export interface BillDetailViewPayload extends ApproveOrRejectBillPayload {
|
|
|
28
30
|
transaction: BillTransactionPayload;
|
|
29
31
|
vendors: VendorPayload[];
|
|
30
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Wire shape of the dedicated recommendations endpoint
|
|
35
|
+
* `GET /1.0/bills/transactions/{transaction_id}/recommendations`.
|
|
36
|
+
*
|
|
37
|
+
* `recommendations` is flat here, not nested under `transaction` the way the
|
|
38
|
+
* bill detail response carries it, and is per line — positionally aligned with
|
|
39
|
+
* `transaction.lines` from the bill detail response. The element is the same
|
|
40
|
+
* shape the bill detail response nests under `transaction.recommendations`.
|
|
41
|
+
*
|
|
42
|
+
* Both fields are optional: a bill with nothing to recommend is a success, not
|
|
43
|
+
* an error.
|
|
44
|
+
*/
|
|
45
|
+
export interface BillRecommendationsPayload {
|
|
46
|
+
recommendations?: RecommendationPayload[];
|
|
47
|
+
transaction_id?: ID;
|
|
48
|
+
}
|
|
31
49
|
export interface EligibleActionsPayload {
|
|
32
50
|
is_refund_eligible: boolean | null;
|
|
33
51
|
is_retry_eligible: {
|
|
@@ -41,6 +59,7 @@ export interface BillDetailQuery {
|
|
|
41
59
|
transaction_type: string;
|
|
42
60
|
}
|
|
43
61
|
export type BillDetailViewResponse = ZeniAPIResponse<BillDetailViewPayload>;
|
|
62
|
+
export type BillRecommendationsResponse = ZeniAPIResponse<BillRecommendationsPayload>;
|
|
44
63
|
export type EligibleActionsResponse = ZeniAPIResponse<EligibleActionsPayload>;
|
|
45
64
|
export type ApproveOrRejectBillResponse = ZeniAPIResponse<ApproveOrRejectBillPayload>;
|
|
46
65
|
export interface PreviousBillsPayload {
|
|
@@ -8,7 +8,16 @@ export declare const fetchBillDetail: import("@reduxjs/toolkit").ActionCreatorWi
|
|
|
8
8
|
isShowDeletedBillsEnabled: boolean;
|
|
9
9
|
hasZeniAssistAccess: boolean;
|
|
10
10
|
cacheOverride: any;
|
|
11
|
-
}, "billDetailView/fetchBillDetail", never, never>,
|
|
11
|
+
}, "billDetailView/fetchBillDetail", never, never>, fetchBillRecommendations: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[billId: string, cacheOverride?: any], {
|
|
12
|
+
billId: string;
|
|
13
|
+
cacheOverride: any;
|
|
14
|
+
}, "billDetailView/fetchBillRecommendations", never, never>, fetchBillRecommendationsSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[billId: string, didWriteRecommendations?: any], {
|
|
15
|
+
billId: string;
|
|
16
|
+
didWriteRecommendations: any;
|
|
17
|
+
}, "billDetailView/fetchBillRecommendationsSuccess", never, never>, fetchBillRecommendationsFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[billId: string, error: ZeniAPIStatus<Record<string, unknown>>], {
|
|
18
|
+
billId: string;
|
|
19
|
+
error: ZeniAPIStatus<Record<string, unknown>>;
|
|
20
|
+
}, "billDetailView/fetchBillRecommendationsFailure", never, never>, updateBillDetail: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
12
21
|
billDetail: BillDetailViewPayload;
|
|
13
22
|
billId: ID;
|
|
14
23
|
}, "billDetailView/updateBillDetail">, updateBillDetailFetchState: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[billId: string, fetchState: FetchState, error?: ZeniAPIStatus<Record<string, unknown>> | undefined, vendorId?: string | undefined], {
|