@zeniai/client-epic-state 5.2.22-betaAK0 → 5.2.22-betaAM1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/lib/entity/invoicing/creditNote/creditNotePayload.d.ts +1 -0
  2. package/lib/entity/invoicing/creditNote/creditNotePayload.js +1 -0
  3. package/lib/entity/invoicing/creditNote/creditNoteState.d.ts +1 -0
  4. package/lib/entity/invoicing/invoice/invoicePayload.d.ts +1 -0
  5. package/lib/entity/invoicing/invoice/invoicePayload.js +1 -0
  6. package/lib/entity/invoicing/invoice/invoiceState.d.ts +1 -0
  7. package/lib/entity/invoicing/invoicingCommonPayload.d.ts +0 -2
  8. package/lib/entity/invoicing/invoicingCustomer/invoicingCustomerPayload.d.ts +1 -0
  9. package/lib/entity/invoicing/invoicingCustomer/invoicingCustomerPayload.js +1 -0
  10. package/lib/entity/invoicing/invoicingCustomer/invoicingCustomerState.d.ts +1 -0
  11. package/lib/entity/invoicing/invoicingSubscription/invoicingSubscriptionPayload.d.ts +2 -1
  12. package/lib/entity/invoicing/invoicingSubscription/invoicingSubscriptionPayload.js +2 -1
  13. package/lib/entity/invoicing/invoicingSubscription/invoicingSubscriptionState.d.ts +2 -1
  14. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +24 -0
  15. package/lib/entity/jeSchedules/jeSchedulesPayload.js +40 -0
  16. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +26 -0
  17. package/lib/epic.d.ts +6 -1
  18. package/lib/epic.js +10 -0
  19. package/lib/esm/entity/invoicing/creditNote/creditNotePayload.js +1 -0
  20. package/lib/esm/entity/invoicing/invoice/invoicePayload.js +1 -0
  21. package/lib/esm/entity/invoicing/invoicingCustomer/invoicingCustomerPayload.js +1 -0
  22. package/lib/esm/entity/invoicing/invoicingSubscription/invoicingSubscriptionPayload.js +2 -1
  23. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +40 -0
  24. package/lib/esm/epic.js +10 -0
  25. package/lib/esm/index.js +6 -2
  26. package/lib/esm/reducer.js +3 -0
  27. package/lib/esm/view/expenseAutomationView/epics/accountRecon/deleteAccountStatementEpic.js +1 -3
  28. package/lib/esm/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingEpic.js +46 -0
  29. package/lib/esm/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingPageEpic.js +7 -0
  30. package/lib/esm/view/expenseAutomationView/epics/actualMatching/matchAndReverseAccrualsEpic.js +50 -0
  31. package/lib/esm/view/expenseAutomationView/epics/actualMatching/searchMatchAccrualsEpic.js +44 -0
  32. package/lib/esm/view/expenseAutomationView/epics/actualMatching/searchMatchTransactionsEpic.js +44 -0
  33. package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +28 -11
  34. package/lib/esm/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js +9 -1
  35. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +5 -0
  36. package/lib/esm/view/expenseAutomationView/expenseAutomationViewSelector.js +22 -7
  37. package/lib/esm/view/expenseAutomationView/payload/actualMatchingPayload.js +60 -0
  38. package/lib/esm/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +260 -0
  39. package/lib/esm/view/expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.js +1 -0
  40. package/lib/esm/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +200 -0
  41. package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +3 -0
  42. package/lib/esm/view/expenseAutomationView/types/actualMatchingViewState.js +22 -0
  43. package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +5 -1
  44. package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.js +0 -2
  45. package/lib/esm/view/invoicing/invoicingOverview/invoicingOverviewPayload.js +1 -0
  46. package/lib/esm/view/invoicing/invoicingSubscriptionDetailView/invoicingSubscriptionDetailViewSelector.js +1 -2
  47. package/lib/esm/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewSelector.js +0 -1
  48. package/lib/esm/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewState.js +2 -0
  49. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPaySetupApproverViewEpic.js +18 -2
  50. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/initializeBillPaySetupApproverViewUpdateDataEpic.js +0 -1
  51. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/types/commonPayload.js +0 -3
  52. package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/epic/fetchRemiSetupApproverViewEpic.js +18 -2
  53. package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/epic/initializeRemiSetupApproverViewUpdateDataEpic.js +0 -1
  54. package/lib/index.d.ts +9 -5
  55. package/lib/index.js +73 -47
  56. package/lib/reducer.d.ts +1 -0
  57. package/lib/reducer.js +3 -0
  58. package/lib/rootStateTypes.d.ts +2 -0
  59. package/lib/view/expenseAutomationView/epics/accountRecon/deleteAccountStatementEpic.d.ts +1 -2
  60. package/lib/view/expenseAutomationView/epics/accountRecon/deleteAccountStatementEpic.js +1 -3
  61. package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingEpic.d.ts +9 -0
  62. package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingEpic.js +50 -0
  63. package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingPageEpic.d.ts +5 -0
  64. package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingPageEpic.js +11 -0
  65. package/lib/view/expenseAutomationView/epics/actualMatching/matchAndReverseAccrualsEpic.d.ts +8 -0
  66. package/lib/view/expenseAutomationView/epics/actualMatching/matchAndReverseAccrualsEpic.js +54 -0
  67. package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchAccrualsEpic.d.ts +8 -0
  68. package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchAccrualsEpic.js +48 -0
  69. package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchTransactionsEpic.d.ts +8 -0
  70. package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchTransactionsEpic.js +48 -0
  71. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.d.ts +2 -1
  72. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +28 -11
  73. package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.d.ts +2 -1
  74. package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js +9 -1
  75. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.d.ts +2 -1
  76. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +5 -0
  77. package/lib/view/expenseAutomationView/expenseAutomationViewSelector.js +22 -7
  78. package/lib/view/expenseAutomationView/payload/actualMatchingPayload.d.ts +72 -0
  79. package/lib/view/expenseAutomationView/payload/actualMatchingPayload.js +65 -0
  80. package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.d.ts +53 -0
  81. package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +264 -0
  82. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +2 -2
  83. package/lib/view/expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.d.ts +59 -0
  84. package/lib/view/expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.js +2 -0
  85. package/lib/view/expenseAutomationView/selectorTypes/expenseAutomationViewSelectorTypes.d.ts +2 -0
  86. package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.d.ts +11 -0
  87. package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +212 -0
  88. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +3 -0
  89. package/lib/view/expenseAutomationView/types/actualMatchingViewState.d.ts +81 -0
  90. package/lib/view/expenseAutomationView/types/actualMatchingViewState.js +27 -0
  91. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +1 -1
  92. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +5 -1
  93. package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewPayload.d.ts +0 -1
  94. package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.d.ts +1 -1
  95. package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.js +0 -2
  96. package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewState.d.ts +0 -1
  97. package/lib/view/invoicing/invoicingOverview/invoicingOverviewPayload.d.ts +1 -0
  98. package/lib/view/invoicing/invoicingOverview/invoicingOverviewPayload.js +1 -0
  99. package/lib/view/invoicing/invoicingOverview/invoicingOverviewState.d.ts +1 -0
  100. package/lib/view/invoicing/invoicingSubscriptionDetailView/invoicingSubscriptionDetailViewSelector.d.ts +1 -3
  101. package/lib/view/invoicing/invoicingSubscriptionDetailView/invoicingSubscriptionDetailViewSelector.js +0 -1
  102. package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewSelector.d.ts +0 -2
  103. package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewSelector.js +0 -1
  104. package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewState.d.ts +2 -2
  105. package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewState.js +2 -0
  106. package/lib/view/invoicing/issueCreditNote/issueCreditNotePayload.d.ts +1 -0
  107. package/lib/view/invoicing/subscriptionAction/subscriptionActionRequestPayload.d.ts +0 -8
  108. package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPaySetupApproverViewEpic.d.ts +2 -1
  109. package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPaySetupApproverViewEpic.js +18 -2
  110. package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/initializeBillPaySetupApproverViewUpdateDataEpic.js +0 -1
  111. package/lib/view/spendManagement/billPay/billPaySetupApproverView/types/commonPayload.d.ts +0 -1
  112. package/lib/view/spendManagement/billPay/billPaySetupApproverView/types/commonPayload.js +0 -3
  113. package/lib/view/spendManagement/billPay/billPaySetupApproverView/types/commonState.d.ts +0 -1
  114. package/lib/view/spendManagement/reimbursement/remiSetupApproverView/epic/fetchRemiSetupApproverViewEpic.d.ts +2 -1
  115. package/lib/view/spendManagement/reimbursement/remiSetupApproverView/epic/fetchRemiSetupApproverViewEpic.js +18 -2
  116. package/lib/view/spendManagement/reimbursement/remiSetupApproverView/epic/initializeRemiSetupApproverViewUpdateDataEpic.js +0 -1
  117. package/package.json +38 -71
@@ -0,0 +1,212 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.isAutoReversedAccrual = isAutoReversedAccrual;
7
+ exports.isManuallyReversedAccrual = isManuallyReversedAccrual;
8
+ exports.isPendingReviewAccrual = isPendingReviewAccrual;
9
+ exports.getClearedAllocatedActualAmount = getClearedAllocatedActualAmount;
10
+ exports.getActualMatchingAmount = getActualMatchingAmount;
11
+ exports.getActualMatchingReversalDate = getActualMatchingReversalDate;
12
+ exports.getExpenseAutomationActualMatchingView = getExpenseAutomationActualMatchingView;
13
+ const orderBy_1 = __importDefault(require("lodash/orderBy"));
14
+ const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
15
+ const jeSchedulesSelector_1 = require("../../../entity/jeSchedules/jeSchedulesSelector");
16
+ const tenantSelector_1 = require("../../../entity/tenant/tenantSelector");
17
+ function isAutoReversedAccrual(accrual) {
18
+ return (accrual.accrualStatus === 'reversed' &&
19
+ accrual.reversalTrigger === 'bill_match');
20
+ }
21
+ function isManuallyReversedAccrual(accrual) {
22
+ return (accrual.accrualStatus === 'reversed' &&
23
+ accrual.reversalTrigger === 'manual_reverse');
24
+ }
25
+ function isPendingReviewAccrual(accrual) {
26
+ if (accrual.accrualStatus !== 'posted' || accrual.matchSuggestion == null) {
27
+ return false;
28
+ }
29
+ const resolution = accrual.matchSuggestion.resolution;
30
+ return resolution == null || resolution.length === 0;
31
+ }
32
+ function isGroupedClearedMatch(accrual) {
33
+ const groupSum = accrual.cleared?.groupSum?.amount;
34
+ if (groupSum == null || groupSum <= 0) {
35
+ return false;
36
+ }
37
+ const matchShape = accrual.cleared?.matchShape;
38
+ const accrualIdsLength = accrual.cleared?.accrualIds?.length ?? 0;
39
+ return matchShape === '1:N' || matchShape === 'N:1' || accrualIdsLength > 1;
40
+ }
41
+ function getClearedAllocatedActualAmount(accrual) {
42
+ const matchedAmount = accrual.cleared?.matchedAmount?.amount;
43
+ if (matchedAmount == null) {
44
+ return undefined;
45
+ }
46
+ if (!isGroupedClearedMatch(accrual)) {
47
+ return matchedAmount;
48
+ }
49
+ const groupSum = accrual.cleared?.groupSum?.amount;
50
+ if (groupSum == null || groupSum <= 0) {
51
+ return matchedAmount;
52
+ }
53
+ return matchedAmount * (accrual.estimatedAmount.amount / groupSum);
54
+ }
55
+ function getActualMatchingAmount(accrual) {
56
+ if (isPendingReviewAccrual(accrual)) {
57
+ return (accrual.matchSuggestion?.matchedAmount?.amount ??
58
+ accrual.estimatedAmount.amount);
59
+ }
60
+ if (isAutoReversedAccrual(accrual) || isManuallyReversedAccrual(accrual)) {
61
+ return (getClearedAllocatedActualAmount(accrual) ?? accrual.estimatedAmount.amount);
62
+ }
63
+ return accrual.estimatedAmount.amount;
64
+ }
65
+ function getActualMatchingReversalDate(accrual) {
66
+ if (!isAutoReversedAccrual(accrual) && !isManuallyReversedAccrual(accrual)) {
67
+ return undefined;
68
+ }
69
+ return accrual.actualReversalPostDate ?? accrual.cleared?.reversedAt;
70
+ }
71
+ function toActualMatchingRow(accrual, kind) {
72
+ return {
73
+ ...accrual,
74
+ kind,
75
+ reversalDate: kind === 'pending_review'
76
+ ? undefined
77
+ : getActualMatchingReversalDate(accrual),
78
+ };
79
+ }
80
+ function matchesSearch(accrual, searchString) {
81
+ const trimmed = searchString.trim().toLowerCase();
82
+ if (trimmed.length === 0) {
83
+ return true;
84
+ }
85
+ return (accrual.vendorName.toLowerCase().includes(trimmed) ||
86
+ accrual.memo.toLowerCase().includes(trimmed));
87
+ }
88
+ function getActualMatchingSortValue(row, sortKey) {
89
+ switch (sortKey) {
90
+ case 'vendor':
91
+ return row.vendorName.toLowerCase();
92
+ case 'date':
93
+ return row.reversalDate?.valueOf();
94
+ case 'amount':
95
+ return getActualMatchingAmount(row);
96
+ case 'category':
97
+ return row.jeDebitAccountName?.toLowerCase();
98
+ case 'class':
99
+ return row.jeDebitAccountingClassName?.toLowerCase();
100
+ case 'type':
101
+ return (row.cleared?.matchedTransactionType ??
102
+ row.matchSuggestion?.matchedTransactionType)?.toLowerCase();
103
+ case 'lifecycle':
104
+ return row.kind;
105
+ default:
106
+ return undefined;
107
+ }
108
+ }
109
+ function sortActualMatchingRows(rows, uiState) {
110
+ const lodashOrder = uiState.sortOrder === 'ascending' ? 'asc' : 'desc';
111
+ return (0, orderBy_1.default)(rows, [(row) => getActualMatchingSortValue(row, uiState.sortKey)], [lodashOrder]);
112
+ }
113
+ function emptyKpiSummary() {
114
+ return {
115
+ autoReversed: { count: 0, amount: 0 },
116
+ pendingReview: { count: 0, amount: 0 },
117
+ totalThisClose: { count: 0, amount: 0 },
118
+ ai: { count: 0 },
119
+ manual: { count: 0 },
120
+ };
121
+ }
122
+ function getExpenseAutomationActualMatchingView(state) {
123
+ const { expenseAutomationActualMatchingViewState, expenseAutomationViewState } = state;
124
+ const { accrualKeysByPeriod, fetchState, error, refreshStatus, uiState, matchModal, } = expenseAutomationActualMatchingViewState;
125
+ const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
126
+ const selectedPeriod = expenseAutomationViewState.selectedPeriodByTenantId[currentTenant.tenantId];
127
+ const monthYearPeriodId = selectedPeriod != null ? (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod) : undefined;
128
+ const accrualKeys = monthYearPeriodId != null
129
+ ? accrualKeysByPeriod[monthYearPeriodId]
130
+ : undefined;
131
+ const accruals = (accrualKeys ?? [])
132
+ .map((key) => (0, jeSchedulesSelector_1.getJEOneTimeAccrualByKey)(key, state.jeSchedulesState))
133
+ .filter((accrual) => accrual != null);
134
+ const filtered = accruals.filter((accrual) => matchesSearch(accrual, uiState.searchString));
135
+ const autoReversed = sortActualMatchingRows(filtered
136
+ .filter(isAutoReversedAccrual)
137
+ .map((accrual) => toActualMatchingRow(accrual, 'auto_reversed')), uiState);
138
+ const pendingReview = sortActualMatchingRows(filtered
139
+ .filter(isPendingReviewAccrual)
140
+ .map((accrual) => toActualMatchingRow(accrual, 'pending_review')), uiState);
141
+ const manuallyReversed = sortActualMatchingRows(filtered
142
+ .filter(isManuallyReversedAccrual)
143
+ .map((accrual) => toActualMatchingRow(accrual, 'manually_reversed')), uiState);
144
+ const listedAccruals = accruals.filter((accrual) => isAutoReversedAccrual(accrual) ||
145
+ isPendingReviewAccrual(accrual) ||
146
+ isManuallyReversedAccrual(accrual));
147
+ const kpiSummary = listedAccruals.length === 0
148
+ ? emptyKpiSummary()
149
+ : {
150
+ autoReversed: {
151
+ count: listedAccruals.filter(isAutoReversedAccrual).length,
152
+ amount: listedAccruals
153
+ .filter(isAutoReversedAccrual)
154
+ .reduce((sum, accrual) => sum + getActualMatchingAmount(accrual), 0),
155
+ },
156
+ pendingReview: {
157
+ count: listedAccruals.filter(isPendingReviewAccrual).length,
158
+ amount: listedAccruals
159
+ .filter(isPendingReviewAccrual)
160
+ .reduce((sum, accrual) => sum + getActualMatchingAmount(accrual), 0),
161
+ },
162
+ totalThisClose: {
163
+ count: listedAccruals.length,
164
+ amount: listedAccruals.reduce((sum, accrual) => sum + getActualMatchingAmount(accrual), 0),
165
+ },
166
+ ai: {
167
+ count: listedAccruals.filter((accrual) => accrual.origin === 'agent').length,
168
+ },
169
+ manual: {
170
+ count: listedAccruals.filter((accrual) => accrual.origin === 'human').length,
171
+ },
172
+ };
173
+ const accrualSearchResults = matchModal.accrualSearch.results
174
+ .map((key) => (0, jeSchedulesSelector_1.getJEOneTimeAccrualByKey)(key, state.jeSchedulesState))
175
+ .filter((accrual) => accrual != null);
176
+ return {
177
+ fetchState,
178
+ error,
179
+ autoReversed,
180
+ pendingReview,
181
+ manuallyReversed,
182
+ kpiSummary,
183
+ uiState,
184
+ refreshStatus,
185
+ hasLoadedForSelectedPeriod: accrualKeys != null,
186
+ matchModal: {
187
+ isOpen: matchModal.isOpen,
188
+ confirmStatus: matchModal.confirmStatus,
189
+ lastBatchResults: matchModal.lastBatchResults,
190
+ transactionSearch: {
191
+ query: matchModal.transactionSearch.query,
192
+ results: matchModal.transactionSearch.results,
193
+ fetchState: {
194
+ fetchState: matchModal.transactionSearch.fetchState,
195
+ error: matchModal.transactionSearch.error,
196
+ },
197
+ nextPageToken: matchModal.transactionSearch.nextPageToken,
198
+ isLoadingMore: matchModal.transactionSearch.isLoadingMore,
199
+ },
200
+ accrualSearch: {
201
+ query: matchModal.accrualSearch.query,
202
+ results: accrualSearchResults,
203
+ fetchState: {
204
+ fetchState: matchModal.accrualSearch.fetchState,
205
+ error: matchModal.accrualSearch.error,
206
+ },
207
+ nextPageToken: matchModal.accrualSearch.nextPageToken,
208
+ isLoadingMore: matchModal.accrualSearch.isLoadingMore,
209
+ },
210
+ },
211
+ };
212
+ }
@@ -382,6 +382,9 @@ function getExpenseAutomationJESchedulesView(state) {
382
382
  // reports undefined rather than 0, so the UI can hide the badge instead of asserting "none".
383
383
  const scheduleCountsByTab = {};
384
384
  jeSchedulesViewState_1.ALL_JE_PAGE_TABS.forEach((pageTab) => {
385
+ if (pageTab === 'actual_matching') {
386
+ return;
387
+ }
385
388
  const periodTabKey = monthYearPeriodId != null
386
389
  ? (0, jeSchedulesViewState_1.getJESchedulePeriodTabKey)(pageTab, monthYearPeriodId)
387
390
  : null;
@@ -0,0 +1,81 @@
1
+ import { FetchStateAndError, FetchedState, ID } from '../../../commonStateTypes/common';
2
+ import { SortOrder } from '../../../commonStateTypes/selectorTypes/sortOrderTypes';
3
+ import { MonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
4
+ import { JEOneTimeAccrualKey } from '../../../entity/jeSchedules/jeSchedulesTypes';
5
+ export declare const toActualMatchingSortKey: (v: string) => "type" | "date" | "vendor" | "category" | "class" | "amount" | "lifecycle";
6
+ export type ActualMatchingSortKey = ReturnType<typeof toActualMatchingSortKey>;
7
+ export declare const MATCH_TRANSACTION_SEARCH_PAGE_SIZE = 50;
8
+ export declare const MATCH_ACCRUAL_SEARCH_LIMIT = 50;
9
+ export declare const MATCH_SEARCH_DEBOUNCE_MS = 300;
10
+ export declare const toMatchAndReverseResultStatus: (v: string) => "error" | "reversed" | "noop" | "conflict" | "claim_lost";
11
+ export type MatchAndReverseResultStatus = ReturnType<typeof toMatchAndReverseResultStatus>;
12
+ export interface ActualMatchingViewUIState {
13
+ scrollPosition: {
14
+ scrollTop: number;
15
+ scrollLeft?: number;
16
+ } | undefined;
17
+ searchString: string;
18
+ sortKey: ActualMatchingSortKey;
19
+ sortOrder: SortOrder;
20
+ }
21
+ /**
22
+ * Sibling of Missing Receipts `MatchCandidate`. Confirm needs `lineId` and
23
+ * `transactionIntegrationId` on every row — those fields are required here.
24
+ */
25
+ export interface ActualMatchingTransactionSearchResult {
26
+ amount: number;
27
+ currencyCode: string;
28
+ currencySymbol: string;
29
+ lineId: string;
30
+ transactionDate: string;
31
+ transactionId: ID;
32
+ transactionIntegrationId: string;
33
+ transactionType: string;
34
+ vendorName: string;
35
+ accountDescription?: string;
36
+ accountId?: ID;
37
+ accountingClassId?: ID;
38
+ accountingClassName?: string;
39
+ accountName?: string;
40
+ transactionDescription?: string;
41
+ transactionMemo?: string;
42
+ transactionTypeName?: string;
43
+ vendorId?: ID;
44
+ }
45
+ export interface MatchAndReverseResult {
46
+ accrualId: ID;
47
+ status: MatchAndReverseResultStatus;
48
+ reason?: string;
49
+ }
50
+ export interface MatchAndReverseAccrualsParams {
51
+ accrualIds: ID[];
52
+ lineId: string;
53
+ transactionId: ID;
54
+ transactionIntegrationId: string;
55
+ transactionType: string;
56
+ }
57
+ export interface ActualMatchingTransactionSearchState extends FetchStateAndError {
58
+ isLoadingMore: boolean;
59
+ nextPageToken: string | null;
60
+ query: string;
61
+ results: ActualMatchingTransactionSearchResult[];
62
+ }
63
+ export interface ActualMatchingAccrualSearchState extends FetchStateAndError {
64
+ isLoadingMore: boolean;
65
+ nextPageToken: string | null;
66
+ query: string;
67
+ results: JEOneTimeAccrualKey[];
68
+ }
69
+ export interface ActualMatchingMatchModalState {
70
+ accrualSearch: ActualMatchingAccrualSearchState;
71
+ confirmStatus: FetchStateAndError;
72
+ isOpen: boolean;
73
+ transactionSearch: ActualMatchingTransactionSearchState;
74
+ lastBatchResults?: MatchAndReverseResult[];
75
+ }
76
+ export interface ActualMatchingViewState extends FetchedState {
77
+ accrualKeysByPeriod: Record<MonthYearPeriodId, JEOneTimeAccrualKey[]>;
78
+ matchModal: ActualMatchingMatchModalState;
79
+ refreshStatus: FetchStateAndError;
80
+ uiState: ActualMatchingViewUIState;
81
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toMatchAndReverseResultStatus = exports.MATCH_SEARCH_DEBOUNCE_MS = exports.MATCH_ACCRUAL_SEARCH_LIMIT = exports.MATCH_TRANSACTION_SEARCH_PAGE_SIZE = exports.toActualMatchingSortKey = void 0;
4
+ const stringToUnion_1 = require("../../../commonStateTypes/stringToUnion");
5
+ const ACTUAL_MATCHING_SORT_KEYS = [
6
+ 'vendor',
7
+ 'date',
8
+ 'amount',
9
+ 'category',
10
+ 'class',
11
+ 'type',
12
+ 'lifecycle',
13
+ ];
14
+ const toActualMatchingSortKey = (v) => (0, stringToUnion_1.stringToUnion)(v, ACTUAL_MATCHING_SORT_KEYS);
15
+ exports.toActualMatchingSortKey = toActualMatchingSortKey;
16
+ exports.MATCH_TRANSACTION_SEARCH_PAGE_SIZE = 50;
17
+ exports.MATCH_ACCRUAL_SEARCH_LIMIT = 50;
18
+ exports.MATCH_SEARCH_DEBOUNCE_MS = 300;
19
+ const MATCH_AND_REVERSE_RESULT_STATUSES = [
20
+ 'reversed',
21
+ 'noop',
22
+ 'conflict',
23
+ 'claim_lost',
24
+ 'error',
25
+ ];
26
+ const toMatchAndReverseResultStatus = (v) => (0, stringToUnion_1.stringToUnion)(v, MATCH_AND_REVERSE_RESULT_STATUSES);
27
+ exports.toMatchAndReverseResultStatus = toMatchAndReverseResultStatus;
@@ -11,7 +11,7 @@ import { ZeniDate } from '../../../zeniDayJS';
11
11
  import { JETransactionLink } from '../../scheduleView/scheduleDetailView/scheduleDetailState';
12
12
  export declare const toJEScheduleSortKey: (v: string) => "type" | "vendor" | "category" | "class" | "memo" | "jePostingDate" | "runningBalance" | "depCategory" | "scheduleCategory" | "startMonth" | "amortizationPeriod" | "remainingMonths" | "totalAmount" | "transactionDate";
13
13
  export type JEScheduleSortKey = ReturnType<typeof toJEScheduleSortKey>;
14
- export declare const toJEPageTab: (v: string) => "schedules" | "existing_schedules";
14
+ export declare const toJEPageTab: (v: string) => "schedules" | "actual_matching" | "existing_schedules";
15
15
  export type JEPageTab = ReturnType<typeof toJEPageTab>;
16
16
  export declare const ALL_JE_PAGE_TABS: readonly JEPageTab[];
17
17
  export type JESchedulePeriodTabKey = `${JEPageTab}_${MonthYearPeriodId}`;
@@ -20,7 +20,11 @@ const JE_SCHEDULE_SORT_KEYS = [
20
20
  ];
21
21
  const toJEScheduleSortKey = (v) => (0, stringToUnion_1.stringToUnion)(v, JE_SCHEDULE_SORT_KEYS);
22
22
  exports.toJEScheduleSortKey = toJEScheduleSortKey;
23
- const JE_PAGE_TABS = ['schedules', 'existing_schedules'];
23
+ const JE_PAGE_TABS = [
24
+ 'schedules',
25
+ 'actual_matching',
26
+ 'existing_schedules',
27
+ ];
24
28
  const toJEPageTab = (v) => (0, stringToUnion_1.stringToUnion)(v, JE_PAGE_TABS);
25
29
  exports.toJEPageTab = toJEPageTab;
26
30
  exports.ALL_JE_PAGE_TABS = JE_PAGE_TABS;
@@ -54,7 +54,6 @@ export interface InvoicingConfigPayload {
54
54
  qbo_account_mapping_kind_options?: InvoicingQboAccountMappingKindOptionWire[];
55
55
  qbo_customer_matching_options?: InvoicingNamedOptionWire[];
56
56
  qbo_sync_status_options?: InvoicingNamedOptionWire[];
57
- subscription_cancel_reason_code_options?: InvoicingNamedOptionWire[];
58
57
  subscription_status_options?: InvoicingNamedOptionWire[];
59
58
  taxability_options?: InvoicingNamedOptionWire[];
60
59
  transaction_status_options?: InvoicingNamedOptionWire[];
@@ -2,7 +2,7 @@ import { ZeniAPIStatus } from '../../../responsePayload';
2
2
  import { InvoicingConfigPayload } from './invoicingConfigViewPayload';
3
3
  import { InvoicingConfigViewState } from './invoicingConfigViewState';
4
4
  export declare const initialState: InvoicingConfigViewState;
5
- export declare function mapInvoicingConfigPayloadToState(payload: InvoicingConfigPayload): Pick<InvoicingConfigViewState, 'auditLogEntityRouteOptions' | 'auditLogListSortFieldOptions' | 'auditLogSourceLabels' | 'autoCollectionOptions' | 'billingPeriodUnitOptions' | 'catalogTierTypeOptionsByPricingModel' | 'catalogTrialEndActionOptions' | 'catalogTrialUnitOptions' | 'customerTypeOptions' | 'dateFormatOptions' | 'fieldHelp' | 'discountApplyOnOptions' | 'discountDurationTypeOptions' | 'discountTypeOptions' | 'manualPaymentMethodOptions' | 'netTermDayOptions' | 'paymentGatewayOptions' | 'taxabilityOptions' | 'cardStatusOptions' | 'catalogItemStatusOptions' | 'catalogItemTypeOptions' | 'creditNoteReasonCodeOptions' | 'creditNoteStatusOptions' | 'creditNoteTypeOptions' | 'customerStatusOptions' | 'discountStatusOptions' | 'dunningCaseStatusOptions' | 'invoiceStatusOptions' | 'subscriptionCancelReasonCodeOptions' | 'subscriptionStatusOptions' | 'transactionStatusOptions' | 'transactionTypeOptions' | 'createdAt' | 'updatedAt' | 'dunningScheduleActionOptions' | 'subscriptionLifecycleActionOptions' | 'subscriptionCommercialEditAllowedFromStatuses' | 'subscriptionMetadataEditAllowedFromStatuses' | 'subscriptionEditFieldOptions' | 'subscriptionCancelTimingOptions' | 'subscriptionChangeOptionOptions' | 'catalogItemLifecycleActionOptions' | 'catalogProductLifecycleActionOptions' | 'discountLifecycleActionOptions' | 'qboAccountMappingKindOptions' | 'qboCustomerMatchingOptions' | 'qboSyncStatusOptions' | 'isInvoicingEnabled' | 'isInvoicingTosAccepted' | 'invoicingTosAcceptanceIp' | 'invoicingTosAcceptanceTime' | 'invoicingTosAcceptanceUserAgent' | 'invoicingTosAcceptanceUserId' | 'isInvoicingSettingsSeeded'>;
5
+ export declare function mapInvoicingConfigPayloadToState(payload: InvoicingConfigPayload): Pick<InvoicingConfigViewState, 'auditLogEntityRouteOptions' | 'auditLogListSortFieldOptions' | 'auditLogSourceLabels' | 'autoCollectionOptions' | 'billingPeriodUnitOptions' | 'catalogTierTypeOptionsByPricingModel' | 'catalogTrialEndActionOptions' | 'catalogTrialUnitOptions' | 'customerTypeOptions' | 'dateFormatOptions' | 'fieldHelp' | 'discountApplyOnOptions' | 'discountDurationTypeOptions' | 'discountTypeOptions' | 'manualPaymentMethodOptions' | 'netTermDayOptions' | 'paymentGatewayOptions' | 'taxabilityOptions' | 'cardStatusOptions' | 'catalogItemStatusOptions' | 'catalogItemTypeOptions' | 'creditNoteReasonCodeOptions' | 'creditNoteStatusOptions' | 'creditNoteTypeOptions' | 'customerStatusOptions' | 'discountStatusOptions' | 'dunningCaseStatusOptions' | 'invoiceStatusOptions' | 'subscriptionStatusOptions' | 'transactionStatusOptions' | 'transactionTypeOptions' | 'createdAt' | 'updatedAt' | 'dunningScheduleActionOptions' | 'subscriptionLifecycleActionOptions' | 'subscriptionCommercialEditAllowedFromStatuses' | 'subscriptionMetadataEditAllowedFromStatuses' | 'subscriptionEditFieldOptions' | 'subscriptionCancelTimingOptions' | 'subscriptionChangeOptionOptions' | 'catalogItemLifecycleActionOptions' | 'catalogProductLifecycleActionOptions' | 'discountLifecycleActionOptions' | 'qboAccountMappingKindOptions' | 'qboCustomerMatchingOptions' | 'qboSyncStatusOptions' | 'isInvoicingEnabled' | 'isInvoicingTosAccepted' | 'invoicingTosAcceptanceIp' | 'invoicingTosAcceptanceTime' | 'invoicingTosAcceptanceUserAgent' | 'invoicingTosAcceptanceUserId' | 'isInvoicingSettingsSeeded'>;
6
6
  export declare const fetchInvoicingConfig: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[payload?: {
7
7
  cacheOverride?: boolean;
8
8
  } | undefined], {
@@ -39,7 +39,6 @@ exports.initialState = {
39
39
  discountStatusOptions: [],
40
40
  dunningCaseStatusOptions: [],
41
41
  invoiceStatusOptions: [],
42
- subscriptionCancelReasonCodeOptions: [],
43
42
  subscriptionStatusOptions: [],
44
43
  transactionStatusOptions: [],
45
44
  transactionTypeOptions: [],
@@ -109,7 +108,6 @@ function mapInvoicingConfigPayloadToState(payload) {
109
108
  discountStatusOptions: (payload.discount_status_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
110
109
  dunningCaseStatusOptions: (payload.dunning_case_status_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
111
110
  invoiceStatusOptions: (payload.invoice_status_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
112
- subscriptionCancelReasonCodeOptions: (payload.subscription_cancel_reason_code_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
113
111
  subscriptionStatusOptions: (payload.subscription_status_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
114
112
  transactionStatusOptions: (payload.transaction_status_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
115
113
  transactionTypeOptions: (payload.transaction_type_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
@@ -38,7 +38,6 @@ export interface InvoicingConfigViewState extends FetchedState {
38
38
  qboAccountMappingKindOptions: InvoicingQboAccountMappingKindOption[];
39
39
  qboCustomerMatchingOptions: InvoicingNamedOption[];
40
40
  qboSyncStatusOptions: InvoicingNamedOption[];
41
- subscriptionCancelReasonCodeOptions: InvoicingNamedOption[];
42
41
  subscriptionCancelTimingOptions: InvoicingNamedOption[];
43
42
  subscriptionChangeOptionOptions: InvoicingNamedOption[];
44
43
  subscriptionCommercialEditAllowedFromStatuses: string[];
@@ -35,6 +35,7 @@ export interface InvoicingPlanRevenuePointPayload {
35
35
  mrr: number;
36
36
  pct: number;
37
37
  plan: string;
38
+ product_code?: string;
38
39
  }
39
40
  export interface InvoicingDashboardSummaryPayload {
40
41
  customer_movement: {
@@ -44,6 +44,7 @@ const mapInvoicingPlanRevenuePointPayloadToState = (payload) => ({
44
44
  mrr: (0, amount_1.toAmount)(payload.mrr, 'USD', '$'),
45
45
  pct: payload.pct,
46
46
  planID: payload.plan,
47
+ productCode: payload.product_code,
47
48
  });
48
49
  exports.mapInvoicingPlanRevenuePointPayloadToState = mapInvoicingPlanRevenuePointPayloadToState;
49
50
  const mapInvoicingDashboardSummaryPayloadToState = (payload) => ({
@@ -39,6 +39,7 @@ export interface InvoicingPlanRevenuePoint {
39
39
  mrr: Amount;
40
40
  pct: number;
41
41
  planID: ID;
42
+ productCode?: string;
42
43
  }
43
44
  export interface InvoicingDashboardSummary {
44
45
  customerMovement: {
@@ -1,6 +1,6 @@
1
1
  import { FetchStateAndError, ID } from '../../../commonStateTypes/common';
2
2
  import { SelectorView } from '../../../commonStateTypes/viewAndReport/viewAndReport';
3
- import type { InvoicingFieldHelpByCode, InvoicingNamedOption } from '../../../entity/invoicing/invoicingCommonPayload';
3
+ import type { InvoicingFieldHelpByCode } from '../../../entity/invoicing/invoicingCommonPayload';
4
4
  import { InvoicingSubscription } from '../../../entity/invoicing/invoicingSubscription/invoicingSubscriptionState';
5
5
  import { RootState } from '../../../rootStateTypes';
6
6
  /**
@@ -10,8 +10,6 @@ import { RootState } from '../../../rootStateTypes';
10
10
  */
11
11
  export interface InvoicingSubscriptionDetailView extends SelectorView {
12
12
  actionState: FetchStateAndError;
13
- /** Cancel reasons from `/1.0/config`, so the dialog hardcodes nothing. */
14
- cancelReasonCodeOptions: InvoicingNamedOption[];
15
13
  /**
16
14
  * Backend help copy for this screen's field group, keyed by field code.
17
15
  * Folded in here so the screen never reaches for the config view itself.
@@ -10,7 +10,6 @@ const getInvoicingSubscriptionDetail = (state, invoicingSubscriptionID) => {
10
10
  const { error, fetchState } = state.invoicingSubscriptionDetailViewState;
11
11
  return {
12
12
  fieldHelp: (0, invoicingConfigViewSelector_1.invoicingFieldHelpForGroup)(state, 'subscription'),
13
- cancelReasonCodeOptions: (0, invoicingConfigViewSelector_1.getInvoicingConfigView)(state).subscriptionCancelReasonCodeOptions,
14
13
  actionState: (0, subscriptionActionSelector_1.getInvoicingSubscriptionActionState)(invoicingSubscriptionID)(state),
15
14
  subscription: (0, exports.getInvoicingSubscriptionById)(state, invoicingSubscriptionID),
16
15
  fetchState,
@@ -7,8 +7,6 @@ import { InvoicingListSort } from '../invoicingApiHelper';
7
7
  import { InvoicingSubscriptionColumnConfig, InvoicingSubscriptionFilters, InvoicingSubscriptionTabId } from './invoicingSubscriptionListViewState';
8
8
  export interface InvoicingSubscriptionListView extends SelectorView {
9
9
  activeTab: InvoicingSubscriptionTabId;
10
- /** Cancel reasons from `/1.0/config`, so the dialog hardcodes nothing. */
11
- cancelReasonCodeOptions: InvoicingNamedOption[];
12
10
  columns: InvoicingSubscriptionColumnConfig[];
13
11
  count: InvoicingListCounts;
14
12
  countsFetchState: FetchStateAndError;
@@ -31,7 +31,6 @@ exports.getInvoicingSubscriptionListView = (0, toolkit_1.createSelector)((state)
31
31
  count: listViewState.counts,
32
32
  countsFetchState: listViewState.countsFetchState,
33
33
  subscriptionCommercialEditAllowedFromStatuses: configState.subscriptionCommercialEditAllowedFromStatuses,
34
- cancelReasonCodeOptions: configState.subscriptionCancelReasonCodeOptions,
35
34
  subscriptionLifecycleActionOptions: configState.subscriptionLifecycleActionOptions,
36
35
  subscriptionMetadataEditAllowedFromStatuses: configState.subscriptionMetadataEditAllowedFromStatuses,
37
36
  statusOptions,
@@ -7,8 +7,8 @@ export interface InvoicingSubscriptionFilters {
7
7
  startedFrom?: string;
8
8
  startedTo?: string;
9
9
  }
10
- export declare const ALL_INVOICING_SUBSCRIPTION_SORT_KEYS: readonly ["subscription", "customer", "plan", "term_end", "next_billing", "auto_collect", "status", "mrr"];
11
- export declare const toInvoicingSubscriptionSortKey: (v: string) => "status" | "customer" | "subscription" | "plan" | "term_end" | "next_billing" | "auto_collect" | "mrr";
10
+ export declare const ALL_INVOICING_SUBSCRIPTION_SORT_KEYS: readonly ["subscription", "customer", "plan", "product_code", "term_end", "next_billing", "auto_collect", "status", "mrr"];
11
+ export declare const toInvoicingSubscriptionSortKey: (v: string) => "status" | "customer" | "subscription" | "plan" | "product_code" | "term_end" | "next_billing" | "auto_collect" | "mrr";
12
12
  export type InvoicingSubscriptionSortKey = ReturnType<typeof toInvoicingSubscriptionSortKey>;
13
13
  /**
14
14
  * Structural column descriptor owned by CES so the subscription-list column set,
@@ -6,6 +6,7 @@ exports.ALL_INVOICING_SUBSCRIPTION_SORT_KEYS = [
6
6
  'subscription',
7
7
  'customer',
8
8
  'plan',
9
+ 'product_code',
9
10
  'term_end',
10
11
  'next_billing',
11
12
  'auto_collect',
@@ -18,6 +19,7 @@ exports.INVOICING_SUBSCRIPTION_COLUMNS = [
18
19
  { key: 'subscription', sortable: true },
19
20
  { key: 'customer', sortable: false },
20
21
  { key: 'plan', sortable: true },
22
+ { key: 'product_code', sortable: true },
21
23
  { key: 'term_end', sortable: true },
22
24
  { key: 'next_billing', sortable: true },
23
25
  { key: 'auto_collect', sortable: true },
@@ -9,6 +9,7 @@ export interface IssueCreditNoteLineItemRequest {
9
9
  amount?: number;
10
10
  entity_type?: string;
11
11
  id?: string;
12
+ product_code?: string;
12
13
  }
13
14
  export interface IssueCreditNoteRequest {
14
15
  line_items: IssueCreditNoteLineItemRequest[];
@@ -18,14 +18,6 @@ export type PauseSubscriptionBody = {
18
18
  pause_reason?: string;
19
19
  resume_date?: string;
20
20
  };
21
- /**
22
- * What the cancel dialog collects. Form values, not the request body: the screen
23
- * turns these into {@link CancelSubscriptionBody}.
24
- */
25
- export type InvoicingCancelSubscriptionValues = {
26
- cancelReasonCode: string;
27
- cancelReason?: string;
28
- };
29
21
  export type CancelSubscriptionBody = {
30
22
  cancel_reason?: string;
31
23
  cancel_reason_code?: string;
@@ -4,6 +4,7 @@ import { updateApprovalRules } from '../../../../../entity/approvalRule/approval
4
4
  import { updateAllUsers } from '../../../../../entity/user/userReducer';
5
5
  import { RootState } from '../../../../../rootStateTypes';
6
6
  import { ZeniAPI } from '../../../../../zeniAPI';
7
+ import { fetchClassList } from '../../../../classList/classListReducer';
7
8
  import { fetchBillPaySetupApproverView, fetchBillPaySetupApproverViewFailure, fetchBillPaySetupApproverViewSuccess } from '../billPaySetupApproverViewReducer';
8
- export type ActionType = ReturnType<typeof fetchBillPaySetupApproverView> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateApprovalRules> | ReturnType<typeof fetchBillPaySetupApproverViewSuccess> | ReturnType<typeof fetchBillPaySetupApproverViewFailure>;
9
+ export type ActionType = ReturnType<typeof fetchBillPaySetupApproverView> | ReturnType<typeof fetchClassList> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateApprovalRules> | ReturnType<typeof fetchBillPaySetupApproverViewSuccess> | ReturnType<typeof fetchBillPaySetupApproverViewFailure>;
9
10
  export declare const fetchBillPaySetupApproverViewEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -5,13 +5,20 @@ const rxjs_1 = require("rxjs");
5
5
  const operators_1 = require("rxjs/operators");
6
6
  const approvalRuleReducer_1 = require("../../../../../entity/approvalRule/approvalRuleReducer");
7
7
  const approvalRuleSelector_1 = require("../../../../../entity/approvalRule/approvalRuleSelector");
8
+ const tenantSelector_1 = require("../../../../../entity/tenant/tenantSelector");
8
9
  const userReducer_1 = require("../../../../../entity/user/userReducer");
9
10
  const responsePayload_1 = require("../../../../../responsePayload");
11
+ const classListReducer_1 = require("../../../../classList/classListReducer");
10
12
  const billPaySetupApproverViewReducer_1 = require("../billPaySetupApproverViewReducer");
11
13
  const fetchBillPaySetupApproverViewEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(billPaySetupApproverViewReducer_1.fetchBillPaySetupApproverView.match), (0, operators_1.switchMap)((action) => {
12
14
  const { cacheOverride, useV3 } = action.payload;
13
- const { billPaySetupApproverViewState, approvalRuleState } = state$.value;
15
+ const { billPaySetupApproverViewState, approvalRuleState, classListState } = state$.value;
16
+ const isAccountingClassesEnabled = (0, tenantSelector_1.getIsAccountingClassesEnabled)(state$.value);
14
17
  const approvalRules = (0, approvalRuleSelector_1.getApprovalRulesByIds)(approvalRuleState, billPaySetupApproverViewState.approvalRuleIds);
18
+ const shouldFetchClassList = isAccountingClassesEnabled &&
19
+ (cacheOverride === true ||
20
+ (classListState.hasValidState() === false &&
21
+ classListState.fetchState !== 'In-Progress'));
15
22
  if (cacheOverride === true ||
16
23
  approvalRules.length !==
17
24
  billPaySetupApproverViewState.approvalRuleIds.length ||
@@ -31,6 +38,9 @@ const fetchBillPaySetupApproverViewEpic = (actions$, state$, zeniAPI) => actions
31
38
  (0, approvalRuleReducer_1.updateApprovalRules)(response.data.approval_rules),
32
39
  (0, billPaySetupApproverViewReducer_1.fetchBillPaySetupApproverViewSuccess)(approvalRuleIds),
33
40
  ];
41
+ if (shouldFetchClassList) {
42
+ actions.push((0, classListReducer_1.fetchClassList)());
43
+ }
34
44
  return (0, rxjs_1.from)(actions);
35
45
  }
36
46
  else {
@@ -40,7 +50,13 @@ const fetchBillPaySetupApproverViewEpic = (actions$, state$, zeniAPI) => actions
40
50
  }
41
51
  else {
42
52
  const { approvalRuleIds } = billPaySetupApproverViewState;
43
- return (0, rxjs_1.of)((0, billPaySetupApproverViewReducer_1.fetchBillPaySetupApproverViewSuccess)(approvalRuleIds));
53
+ const actions = [
54
+ (0, billPaySetupApproverViewReducer_1.fetchBillPaySetupApproverViewSuccess)(approvalRuleIds),
55
+ ];
56
+ if (shouldFetchClassList) {
57
+ actions.push((0, classListReducer_1.fetchClassList)());
58
+ }
59
+ return (0, rxjs_1.from)(actions);
44
60
  }
45
61
  }));
46
62
  exports.fetchBillPaySetupApproverViewEpic = fetchBillPaySetupApproverViewEpic;
@@ -24,7 +24,6 @@ const initializeBillPaySetupApproverViewUpdateDataEpic = (actions$, state$) => a
24
24
  name: approvalRule.name,
25
25
  description: approvalRule.description,
26
26
  separationOfDuties: approvalRule.separationOfDuties,
27
- isFallback: approvalRule.isFallback,
28
27
  };
29
28
  fetchActions.push((0, billPaySetupApproverViewReducer_1.clearBillPaySetupApproverViewUpdateData)(), (0, billPaySetupApproverViewReducer_1.saveBillPaySetupApproverViewUpdateData)(billPaySetupApproverViewUpdateData));
30
29
  }
@@ -18,7 +18,6 @@ interface ApprovalUpdatableInfoPayload {
18
18
  is_applicable_on_pending_approval_entity: boolean;
19
19
  steps: ApproverViewStepPayload[];
20
20
  description?: string;
21
- is_fallback?: boolean;
22
21
  is_separation_of_duty_enabled?: boolean;
23
22
  /**
24
23
  * Approval Rules 3.0 — rule-level wire fields. The backend accepts these
@@ -89,9 +89,6 @@ const toApprovalChangableInfoPayload = (approverViewUpdateData) => {
89
89
  payload.is_separation_of_duty_enabled =
90
90
  approverViewUpdateData.separationOfDuties;
91
91
  }
92
- if (approverViewUpdateData.isFallback != null) {
93
- payload.is_fallback = approverViewUpdateData.isFallback;
94
- }
95
92
  if (isUpdate) {
96
93
  payload.approval_rule_id = approverViewUpdateData.approvalRuleId;
97
94
  }
@@ -28,7 +28,6 @@ export interface ApprovalRuleFormCriteria {
28
28
  */
29
29
  export interface ApprovalRuleFormBase {
30
30
  description?: string;
31
- isFallback?: boolean;
32
31
  name?: string;
33
32
  separationOfDuties?: boolean;
34
33
  }