@zeniai/client-epic-state 5.0.90-betaAR5 → 5.0.90-betaAR7
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/approvalRule/approvalRulePayload.d.ts +5 -34
- package/lib/entity/approvalRule/approvalRulePayload.js +10 -145
- package/lib/entity/approvalRule/approvalRuleSelector.d.ts +1 -25
- package/lib/entity/approvalRule/approvalRuleSelector.js +0 -40
- package/lib/entity/approvalRule/approvalRuleState.d.ts +7 -59
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +0 -2
- package/lib/epic.d.ts +1 -3
- package/lib/epic.js +1 -3
- package/lib/esm/entity/approvalRule/approvalRulePayload.js +10 -145
- package/lib/esm/entity/approvalRule/approvalRuleSelector.js +0 -35
- package/lib/esm/entity/snackbar/snackbarTypes.js +0 -2
- package/lib/esm/epic.js +1 -3
- package/lib/esm/index.js +5 -7
- package/lib/esm/view/expenseAutomationView/transactionFilterHelpers.js +197 -75
- package/lib/esm/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +0 -14
- package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewReducer.js +12 -109
- package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/deleteBillPayApprovalRuleEpic.js +2 -10
- package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPaySetupApproverViewEpic.js +4 -8
- package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/initializeBillPaySetupApproverViewUpdateDataEpic.js +7 -11
- package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/saveBillPaySetupApproverViewUpdatesEpic.js +4 -13
- package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/types/commonPayload.js +16 -140
- package/lib/esm/view/spendManagement/billPay/editBillView/editBillViewSelector.js +4 -60
- package/lib/esm/view/spendManagement/billPay/editBillView/epics/fetchEditBillDetailPageEpic.js +2 -8
- package/lib/esm/view/spendManagement/reimbursement/editRemiView/epics/fetchEditRemiDetailPageEpic.js +1 -5
- package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/epic/deleteRemiApprovalRuleEpic.js +2 -10
- package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/epic/fetchRemiSetupApproverViewEpic.js +2 -8
- package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/epic/initializeRemiSetupApproverViewUpdateDataEpic.js +7 -11
- package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/epic/saveRemiSetupApproverViewUpdatesEpic.js +4 -13
- package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewReducer.js +11 -80
- package/lib/index.d.ts +6 -8
- package/lib/index.js +16 -27
- package/lib/view/companyTaskManagerView/companyTaskManagerViewReducer.d.ts +2 -2
- package/lib/view/companyView/types/cockpitTypes.d.ts +1 -1
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/transactionFilterHelpers.js +197 -75
- package/lib/view/people/peopleTypes.d.ts +1 -1
- package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.d.ts +0 -7
- package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +0 -14
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewReducer.d.ts +3 -14
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewReducer.js +13 -110
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewState.d.ts +0 -16
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/deleteBillPayApprovalRuleEpic.js +2 -10
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPaySetupApproverViewEpic.js +4 -8
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/initializeBillPaySetupApproverViewUpdateDataEpic.js +6 -10
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/saveBillPaySetupApproverViewUpdatesEpic.js +3 -12
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/types/commonPayload.d.ts +1 -59
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/types/commonPayload.js +17 -142
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/types/commonState.d.ts +5 -31
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.d.ts +1 -8
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +4 -60
- package/lib/view/spendManagement/billPay/editBillView/epics/fetchEditBillDetailPageEpic.js +2 -8
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +1 -1
- package/lib/view/spendManagement/reimbursement/editRemiView/epics/fetchEditRemiDetailPageEpic.js +1 -5
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/epic/deleteRemiApprovalRuleEpic.js +2 -10
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/epic/fetchRemiSetupApproverViewEpic.js +2 -8
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/epic/initializeRemiSetupApproverViewUpdateDataEpic.js +6 -10
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/epic/saveRemiSetupApproverViewUpdatesEpic.js +3 -12
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewReducer.d.ts +3 -14
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewReducer.js +12 -81
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewState.d.ts +0 -12
- package/lib/view/taskManager/taskListView/taskList.d.ts +3 -3
- package/lib/view/transactionDetail/journalEntryLinesViewModel.d.ts +1 -1
- package/package.json +1 -1
- package/lib/entity/approvalRule/approvalRuleConflict.d.ts +0 -56
- package/lib/entity/approvalRule/approvalRuleConflict.js +0 -77
- package/lib/esm/entity/approvalRule/approvalRuleConflict.js +0 -74
- package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/reorderBillPayApprovalRulesEpic.js +0 -54
- package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/epic/reorderRemiApprovalRulesEpic.js +0 -61
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/reorderBillPayApprovalRulesEpic.d.ts +0 -23
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/reorderBillPayApprovalRulesEpic.js +0 -58
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/epic/reorderRemiApprovalRulesEpic.d.ts +0 -14
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/epic/reorderRemiApprovalRulesEpic.js +0 -65
|
@@ -24,13 +24,6 @@ export interface BillPayReviewSelectorView extends SelectorView {
|
|
|
24
24
|
vendor: Vendor | undefined;
|
|
25
25
|
zeniAssistRetryStatus: FetchStateAndError | undefined;
|
|
26
26
|
billPayInfo?: BillPayInfo;
|
|
27
|
-
/**
|
|
28
|
-
* Bill-level accounting class id. Approval Rules 3.0 'department'
|
|
29
|
-
* criteria match against this — readers needing it (e.g. the
|
|
30
|
-
* creator-as-approver lookup) should read it off the view rather
|
|
31
|
-
* than digging through 'state.billTransactionState'.
|
|
32
|
-
*/
|
|
33
|
-
classId?: ID;
|
|
34
27
|
invoiceNumber?: string;
|
|
35
28
|
isBillMarkedForRetry?: boolean;
|
|
36
29
|
outsideZeniPaymentInfo?: OutsideZeniPaymentLocalData;
|
|
@@ -59,12 +59,6 @@ const getReviewPageBillDetail = (state, billId) => {
|
|
|
59
59
|
let recurringConfig;
|
|
60
60
|
let billPayInfo;
|
|
61
61
|
let isBillMarkedForRetry = false;
|
|
62
|
-
// Bill-level accounting class id. Approval Rules 3.0 'department'
|
|
63
|
-
// criteria match against this. Sourced from BillTransaction so
|
|
64
|
-
// any selector that needs it (e.g. creator-as-approver lookup)
|
|
65
|
-
// can read it off the view rather than reaching into
|
|
66
|
-
// 'state.billTransactionState' itself.
|
|
67
|
-
let classId;
|
|
68
62
|
const zeniAssistRetryStatus = billId != null
|
|
69
63
|
? billDetailViewState.billDetailById[key].zeniAssist.retryStatus
|
|
70
64
|
: undefined;
|
|
@@ -75,13 +69,6 @@ const getReviewPageBillDetail = (state, billId) => {
|
|
|
75
69
|
transaction?.billPayInfo.isCollectToAccountInfoFromVendorContact ?? false;
|
|
76
70
|
isRecurring = transaction?.isRecurring ?? false;
|
|
77
71
|
billPayInfo = transaction?.billPayInfo;
|
|
78
|
-
// Normalise empty-string to undefined so downstream readers
|
|
79
|
-
// treat "no class" uniformly regardless of whether the wire
|
|
80
|
-
// used '' or omitted the field.
|
|
81
|
-
classId =
|
|
82
|
-
transaction?.classId != null && transaction.classId !== ''
|
|
83
|
-
? transaction.classId
|
|
84
|
-
: undefined;
|
|
85
72
|
if (isRecurring &&
|
|
86
73
|
transaction?.recurringBillConfigId != null &&
|
|
87
74
|
transaction.recurringBillInstance != null) {
|
|
@@ -198,7 +185,6 @@ const getReviewPageBillDetail = (state, billId) => {
|
|
|
198
185
|
zeniAssistRetryStatus,
|
|
199
186
|
billPayInfo,
|
|
200
187
|
outsideZeniPaymentInfo,
|
|
201
|
-
classId,
|
|
202
188
|
};
|
|
203
189
|
};
|
|
204
190
|
exports.getReviewPageBillDetail = getReviewPageBillDetail;
|
|
@@ -2,10 +2,9 @@ import { ZeniAPIStatus } from '../../../../responsePayload';
|
|
|
2
2
|
import { BillPaySetupApproverViewState } from './billPaySetupApproverViewState';
|
|
3
3
|
import { ApprovalRuleCreateData, ApprovalRuleUpdateData } from './types/commonState';
|
|
4
4
|
export declare const initialState: BillPaySetupApproverViewState;
|
|
5
|
-
export declare const fetchBillPaySetupApproverView: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[cacheOverride
|
|
5
|
+
export declare const fetchBillPaySetupApproverView: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[cacheOverride?: any, includeUserRoles?: any], {
|
|
6
6
|
cacheOverride: any;
|
|
7
7
|
includeUserRoles: any;
|
|
8
|
-
useV3: boolean;
|
|
9
8
|
}, "billPaySetupApproverView/fetchBillPaySetupApproverView", never, never>, fetchBillPaySetupApproverViewSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[approvalRuleIds: string[]], {
|
|
10
9
|
approvalRuleIds: string[];
|
|
11
10
|
}, "billPaySetupApproverView/fetchBillPaySetupApproverViewSuccess", never, never>, fetchBillPaySetupApproverViewFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[status: ZeniAPIStatus<Record<string, unknown>>], ZeniAPIStatus<Record<string, unknown>>, "billPaySetupApproverView/fetchBillPaySetupApproverViewFailure", never, never>, fetchBillPayApproversDetails: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[cacheOverride?: any, includeUserRoles?: any], {
|
|
@@ -19,25 +18,15 @@ export declare const fetchBillPaySetupApproverView: import("@reduxjs/toolkit").A
|
|
|
19
18
|
attributes: ("manager" | "vendor_owner" | "manager_of_manager")[];
|
|
20
19
|
}, "billPaySetupApproverView/fetchBillPayApproversListSuccess", never, never>, fetchBillPayApproversListFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[status: ZeniAPIStatus<Record<string, unknown>>], {
|
|
21
20
|
status: ZeniAPIStatus<Record<string, unknown>>;
|
|
22
|
-
}, "billPaySetupApproverView/fetchBillPayApproversListFailure", never, never>, deleteBillPayApprovalRule: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[approvalRuleId: string
|
|
21
|
+
}, "billPaySetupApproverView/fetchBillPayApproversListFailure", never, never>, deleteBillPayApprovalRule: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[approvalRuleId: string], {
|
|
23
22
|
approvalRuleId: string;
|
|
24
|
-
useV3: boolean;
|
|
25
23
|
}, "billPaySetupApproverView/deleteBillPayApprovalRule", never, never>, deleteBillPayApprovalRuleSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[deletedApprovalRuleId: string, approvalRuleIds: string[]], {
|
|
26
24
|
deletedApprovalRuleId: string;
|
|
27
25
|
approvalRuleIds: string[];
|
|
28
26
|
}, "billPaySetupApproverView/deleteBillPayApprovalRuleSuccess", never, never>, deleteBillPayApprovalRuleFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[approvalRuleId: string, status: ZeniAPIStatus<Record<string, unknown>>], {
|
|
29
27
|
approvalRuleId: string;
|
|
30
28
|
status: ZeniAPIStatus<Record<string, unknown>>;
|
|
31
|
-
}, "billPaySetupApproverView/deleteBillPayApprovalRuleFailure", never, never>,
|
|
32
|
-
approvalRuleIds: string[];
|
|
33
|
-
useV3: boolean;
|
|
34
|
-
}, "billPaySetupApproverView/reorderBillPayApprovalRules", never, never>, reorderBillPayApprovalRulesSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[approvalRuleIds: string[]], {
|
|
35
|
-
approvalRuleIds: string[];
|
|
36
|
-
}, "billPaySetupApproverView/reorderBillPayApprovalRulesSuccess", never, never>, reorderBillPayApprovalRulesFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[status: ZeniAPIStatus<Record<string, unknown>>], {
|
|
37
|
-
status: ZeniAPIStatus<Record<string, unknown>>;
|
|
38
|
-
}, "billPaySetupApproverView/reorderBillPayApprovalRulesFailure", never, never>, saveBillPaySetupApproverViewUpdates: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[useV3: boolean], {
|
|
39
|
-
useV3: boolean;
|
|
40
|
-
}, "billPaySetupApproverView/saveBillPaySetupApproverViewUpdates", never, never>, saveBillPaySetupApproverViewUpdatesSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[approvalRuleIds: string[], affectedEntityIds?: string[] | undefined, newApprovalRuleId?: string | undefined], {
|
|
29
|
+
}, "billPaySetupApproverView/deleteBillPayApprovalRuleFailure", never, never>, saveBillPaySetupApproverViewUpdates: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"billPaySetupApproverView/saveBillPaySetupApproverViewUpdates">, saveBillPaySetupApproverViewUpdatesSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[approvalRuleIds: string[], affectedEntityIds?: string[] | undefined, newApprovalRuleId?: string | undefined], {
|
|
41
30
|
approvalRuleIds: string[];
|
|
42
31
|
affectedEntityIds: string[] | undefined;
|
|
43
32
|
newApprovalRuleId: string | undefined;
|
package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewReducer.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.clearBillPaySetupApproverView = exports.setListeningToPusherEvent = exports.clearBillPaySetupApproverViewUpdateData = exports.saveBillPaySetupApproverViewUpdateData = exports.initializeBillPaySetupApproverViewUpdateData = exports.saveBillPaySetupApproverViewUpdatesFailure = exports.saveBillPaySetupApproverViewUpdatesSuccess = exports.saveBillPaySetupApproverViewUpdates = exports.
|
|
4
|
+
exports.clearBillPaySetupApproverView = exports.setListeningToPusherEvent = exports.clearBillPaySetupApproverViewUpdateData = exports.saveBillPaySetupApproverViewUpdateData = exports.initializeBillPaySetupApproverViewUpdateData = exports.saveBillPaySetupApproverViewUpdatesFailure = exports.saveBillPaySetupApproverViewUpdatesSuccess = exports.saveBillPaySetupApproverViewUpdates = exports.deleteBillPayApprovalRuleFailure = exports.deleteBillPayApprovalRuleSuccess = exports.deleteBillPayApprovalRule = exports.fetchBillPayApproversListFailure = exports.fetchBillPayApproversListSuccess = exports.fetchBillPayApproversList = exports.fetchBillPayApproversDetails = exports.fetchBillPaySetupApproverViewFailure = exports.fetchBillPaySetupApproverViewSuccess = exports.fetchBillPaySetupApproverView = exports.initialState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
exports.initialState = {
|
|
7
7
|
fetchState: 'Not-Started',
|
|
@@ -17,7 +17,6 @@ exports.initialState = {
|
|
|
17
17
|
newApprovalRuleId: undefined,
|
|
18
18
|
approvalRulesDeleteStatusById: {},
|
|
19
19
|
billPaySetupApproverViewUpdateData: undefined,
|
|
20
|
-
reorderStatus: { fetchState: 'Not-Started', error: undefined },
|
|
21
20
|
hasValidState() {
|
|
22
21
|
return this.fetchState === 'Completed';
|
|
23
22
|
},
|
|
@@ -31,13 +30,8 @@ const billPaySetupApproverView = (0, toolkit_1.createSlice)({
|
|
|
31
30
|
draft.fetchState = 'In-Progress';
|
|
32
31
|
draft.error = undefined;
|
|
33
32
|
},
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
// vs v2 endpoint in the fetch epic. Required (no default) so a
|
|
37
|
-
// missing screen-connector wire surfaces at compile time rather
|
|
38
|
-
// than silently falling back to v1 on a v3 tenant.
|
|
39
|
-
prepare(cacheOverride = false, includeUserRoles = true, useV3) {
|
|
40
|
-
return { payload: { cacheOverride, includeUserRoles, useV3 } };
|
|
33
|
+
prepare(cacheOverride = false, includeUserRoles = true) {
|
|
34
|
+
return { payload: { cacheOverride, includeUserRoles } };
|
|
41
35
|
},
|
|
42
36
|
},
|
|
43
37
|
fetchBillPaySetupApproverViewSuccess: {
|
|
@@ -122,12 +116,8 @@ const billPaySetupApproverView = (0, toolkit_1.createSlice)({
|
|
|
122
116
|
error: undefined,
|
|
123
117
|
};
|
|
124
118
|
},
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
// can pick the v1 vs v2 endpoint. Required (no default) so a
|
|
128
|
-
// missing connector wire surfaces at compile time.
|
|
129
|
-
prepare(approvalRuleId, useV3) {
|
|
130
|
-
return { payload: { approvalRuleId, useV3 } };
|
|
119
|
+
prepare(approvalRuleId) {
|
|
120
|
+
return { payload: { approvalRuleId } };
|
|
131
121
|
},
|
|
132
122
|
},
|
|
133
123
|
deleteBillPayApprovalRuleSuccess: {
|
|
@@ -159,100 +149,13 @@ const billPaySetupApproverView = (0, toolkit_1.createSlice)({
|
|
|
159
149
|
};
|
|
160
150
|
},
|
|
161
151
|
},
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
* priorities from the response) or recovers (failure — refetches
|
|
170
|
-
* the view so we don't strand a stale local order).
|
|
171
|
-
*/
|
|
172
|
-
reorderBillPayApprovalRules: {
|
|
173
|
-
reducer(draft, action) {
|
|
174
|
-
const { approvalRuleIds } = action.payload;
|
|
175
|
-
const wasReorderInFlight = draft.reorderStatus.fetchState === 'In-Progress';
|
|
176
|
-
draft.reorderStatus = { fetchState: 'In-Progress', error: undefined };
|
|
177
|
-
// Stash the pre-reorder order so 'Failure' can restore it
|
|
178
|
-
// synchronously. The epic's refetch on failure remains as a
|
|
179
|
-
// safety net (covers cases where the server's truth has
|
|
180
|
-
// drifted from the local snapshot), but the snappy UX path
|
|
181
|
-
// is the in-memory rollback.
|
|
182
|
-
//
|
|
183
|
-
// Only capture a fresh snapshot when no reorder is already in
|
|
184
|
-
// flight. If a second drag fires before the first PUT lands,
|
|
185
|
-
// the existing snapshot already holds the last server-backed
|
|
186
|
-
// order; overwriting it with the first reorder's optimistic
|
|
187
|
-
// result would mean a Failure rolls back to an uncommitted
|
|
188
|
-
// intermediate order instead of the last good list.
|
|
189
|
-
if (!wasReorderInFlight) {
|
|
190
|
-
draft.reorderRollbackIds = draft.approvalRuleIds;
|
|
191
|
-
}
|
|
192
|
-
// Optimistic: render new order immediately. On failure, the
|
|
193
|
-
// reducer restores 'reorderRollbackIds' and the epic refetch
|
|
194
|
-
// reconciles any drift.
|
|
195
|
-
draft.approvalRuleIds = approvalRuleIds;
|
|
196
|
-
},
|
|
197
|
-
// Approval Rules 3.0 — `useV3` required so a missing wire
|
|
198
|
-
// surfaces at compile time. The reorder epic always hits the
|
|
199
|
-
// v2 endpoint (v1 has no reorder route), but the payload still
|
|
200
|
-
// carries the flag for the failure-path refetch which needs it.
|
|
201
|
-
prepare(approvalRuleIds, useV3) {
|
|
202
|
-
return { payload: { approvalRuleIds, useV3 } };
|
|
203
|
-
},
|
|
204
|
-
},
|
|
205
|
-
reorderBillPayApprovalRulesSuccess: {
|
|
206
|
-
reducer(draft, action) {
|
|
207
|
-
const { approvalRuleIds } = action.payload;
|
|
208
|
-
draft.reorderStatus = { fetchState: 'Completed', error: undefined };
|
|
209
|
-
// The API response is authoritative — overwrite with the
|
|
210
|
-
// server's reported order in case it normalised anything.
|
|
211
|
-
draft.approvalRuleIds = approvalRuleIds;
|
|
212
|
-
// Reorder succeeded — discard the snapshot so the next
|
|
213
|
-
// reorder starts from this committed order.
|
|
214
|
-
draft.reorderRollbackIds = undefined;
|
|
215
|
-
},
|
|
216
|
-
prepare(approvalRuleIds) {
|
|
217
|
-
return { payload: { approvalRuleIds } };
|
|
218
|
-
},
|
|
219
|
-
},
|
|
220
|
-
reorderBillPayApprovalRulesFailure: {
|
|
221
|
-
reducer(draft, action) {
|
|
222
|
-
const { status } = action.payload;
|
|
223
|
-
draft.reorderStatus = { fetchState: 'Error', error: status };
|
|
224
|
-
// Restore the snapshot taken on the trigger reducer before
|
|
225
|
-
// the optimistic mutation. The epic still fires a refetch
|
|
226
|
-
// alongside the failure action for cross-tab drift recovery,
|
|
227
|
-
// but locally the user sees their last good order instantly.
|
|
228
|
-
if (draft.reorderRollbackIds != null) {
|
|
229
|
-
draft.approvalRuleIds = draft.reorderRollbackIds;
|
|
230
|
-
draft.reorderRollbackIds = undefined;
|
|
231
|
-
}
|
|
232
|
-
},
|
|
233
|
-
prepare(status) {
|
|
234
|
-
return { payload: { status } };
|
|
235
|
-
},
|
|
236
|
-
},
|
|
237
|
-
saveBillPaySetupApproverViewUpdates: {
|
|
238
|
-
// Approval Rules 3.0 — `useV3` is sourced from the
|
|
239
|
-
// `approval_rule_v3_config` dynamic config in the screen
|
|
240
|
-
// connector. The reducer doesn't read it (the field only
|
|
241
|
-
// matters in the save epic), but it must be declared so the
|
|
242
|
-
// action's payload type is correctly inferred for downstream
|
|
243
|
-
// consumers.
|
|
244
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
245
|
-
reducer(draft, _action) {
|
|
246
|
-
if (draft.billPaySetupApproverViewUpdateData != null) {
|
|
247
|
-
draft.billPaySetupApproverViewUpdateData.updateStatus = {
|
|
248
|
-
fetchState: 'In-Progress',
|
|
249
|
-
error: undefined,
|
|
250
|
-
};
|
|
251
|
-
}
|
|
252
|
-
},
|
|
253
|
-
prepare(useV3) {
|
|
254
|
-
return { payload: { useV3 } };
|
|
255
|
-
},
|
|
152
|
+
saveBillPaySetupApproverViewUpdates(draft) {
|
|
153
|
+
if (draft.billPaySetupApproverViewUpdateData != null) {
|
|
154
|
+
draft.billPaySetupApproverViewUpdateData.updateStatus = {
|
|
155
|
+
fetchState: 'In-Progress',
|
|
156
|
+
error: undefined,
|
|
157
|
+
};
|
|
158
|
+
}
|
|
256
159
|
},
|
|
257
160
|
saveBillPaySetupApproverViewUpdatesSuccess: {
|
|
258
161
|
reducer(draft, action) {
|
|
@@ -341,5 +244,5 @@ const billPaySetupApproverView = (0, toolkit_1.createSlice)({
|
|
|
341
244
|
},
|
|
342
245
|
},
|
|
343
246
|
});
|
|
344
|
-
_a = billPaySetupApproverView.actions, exports.fetchBillPaySetupApproverView = _a.fetchBillPaySetupApproverView, exports.fetchBillPaySetupApproverViewSuccess = _a.fetchBillPaySetupApproverViewSuccess, exports.fetchBillPaySetupApproverViewFailure = _a.fetchBillPaySetupApproverViewFailure, exports.fetchBillPayApproversDetails = _a.fetchBillPayApproversDetails, exports.fetchBillPayApproversList = _a.fetchBillPayApproversList, exports.fetchBillPayApproversListSuccess = _a.fetchBillPayApproversListSuccess, exports.fetchBillPayApproversListFailure = _a.fetchBillPayApproversListFailure, exports.deleteBillPayApprovalRule = _a.deleteBillPayApprovalRule, exports.deleteBillPayApprovalRuleSuccess = _a.deleteBillPayApprovalRuleSuccess, exports.deleteBillPayApprovalRuleFailure = _a.deleteBillPayApprovalRuleFailure, exports.
|
|
247
|
+
_a = billPaySetupApproverView.actions, exports.fetchBillPaySetupApproverView = _a.fetchBillPaySetupApproverView, exports.fetchBillPaySetupApproverViewSuccess = _a.fetchBillPaySetupApproverViewSuccess, exports.fetchBillPaySetupApproverViewFailure = _a.fetchBillPaySetupApproverViewFailure, exports.fetchBillPayApproversDetails = _a.fetchBillPayApproversDetails, exports.fetchBillPayApproversList = _a.fetchBillPayApproversList, exports.fetchBillPayApproversListSuccess = _a.fetchBillPayApproversListSuccess, exports.fetchBillPayApproversListFailure = _a.fetchBillPayApproversListFailure, exports.deleteBillPayApprovalRule = _a.deleteBillPayApprovalRule, exports.deleteBillPayApprovalRuleSuccess = _a.deleteBillPayApprovalRuleSuccess, exports.deleteBillPayApprovalRuleFailure = _a.deleteBillPayApprovalRuleFailure, exports.saveBillPaySetupApproverViewUpdates = _a.saveBillPaySetupApproverViewUpdates, exports.saveBillPaySetupApproverViewUpdatesSuccess = _a.saveBillPaySetupApproverViewUpdatesSuccess, exports.saveBillPaySetupApproverViewUpdatesFailure = _a.saveBillPaySetupApproverViewUpdatesFailure, exports.initializeBillPaySetupApproverViewUpdateData = _a.initializeBillPaySetupApproverViewUpdateData, exports.saveBillPaySetupApproverViewUpdateData = _a.saveBillPaySetupApproverViewUpdateData, exports.clearBillPaySetupApproverViewUpdateData = _a.clearBillPaySetupApproverViewUpdateData, exports.setListeningToPusherEvent = _a.setListeningToPusherEvent, exports.clearBillPaySetupApproverView = _a.clearBillPaySetupApproverView;
|
|
345
248
|
exports.default = billPaySetupApproverView.reducer;
|
package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewState.d.ts
CHANGED
|
@@ -9,24 +9,8 @@ export interface BillPaySetupApproverViewState extends FetchedState {
|
|
|
9
9
|
attributes: AttributeType[];
|
|
10
10
|
fetchStatus: FetchStateAndError;
|
|
11
11
|
};
|
|
12
|
-
/**
|
|
13
|
-
* Tracks the in-flight status of the list-page reorder PUT
|
|
14
|
-
* (approval-rules-v2/reorder). The reducer optimistically updates
|
|
15
|
-
* 'approvalRuleIds' on the trigger action. On Failure the reducer
|
|
16
|
-
* restores the snapshot below before the epic's safety-net refetch
|
|
17
|
-
* fires, so the UI bounces back to the user's last good order
|
|
18
|
-
* without waiting for a network roundtrip.
|
|
19
|
-
*/
|
|
20
|
-
reorderStatus: FetchStateAndError;
|
|
21
12
|
affectedEntityIds?: ID[];
|
|
22
13
|
billPaySetupApproverViewUpdateData?: ApproverViewUpdateData;
|
|
23
14
|
listeningToPusherEvent?: boolean;
|
|
24
15
|
newApprovalRuleId?: ID;
|
|
25
|
-
/**
|
|
26
|
-
* Pre-reorder snapshot of 'approvalRuleIds'. Stashed on the trigger
|
|
27
|
-
* reducer right before the optimistic mutation and consumed on
|
|
28
|
-
* Failure to restore the previous order. Cleared on Success so the
|
|
29
|
-
* next reorder starts from a clean slate.
|
|
30
|
-
*/
|
|
31
|
-
reorderRollbackIds?: ID[];
|
|
32
16
|
}
|
|
@@ -9,17 +9,9 @@ const userReducer_1 = require("../../../../../entity/user/userReducer");
|
|
|
9
9
|
const responsePayload_1 = require("../../../../../responsePayload");
|
|
10
10
|
const billPaySetupApproverViewReducer_1 = require("../billPaySetupApproverViewReducer");
|
|
11
11
|
const deleteBillPayApprovalRuleEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(billPaySetupApproverViewReducer_1.deleteBillPayApprovalRule.match), (0, operators_1.switchMap)((action) => {
|
|
12
|
-
const { approvalRuleId
|
|
13
|
-
// Approval Rules 3.0 — flag-gated endpoint selection.
|
|
14
|
-
// Explicit `=== true` keeps `strict-boolean-expressions` happy
|
|
15
|
-
// when RTK's payload type widens to `any` in some configs.
|
|
16
|
-
const endpoint = useV3 === true
|
|
17
|
-
? `${zeniAPI.apiEndPoints.approvalMicroServiceBaseUrl}/1.0/bill-pay/approval-rules-v2`
|
|
18
|
-
: `${zeniAPI.apiEndPoints.approvalMicroServiceBaseUrl}/1.0/bill-pay/approval-rules`;
|
|
12
|
+
const { approvalRuleId } = action.payload;
|
|
19
13
|
return zeniAPI
|
|
20
|
-
.deleteAndGetJSON(
|
|
21
|
-
approval_rule_id: approvalRuleId,
|
|
22
|
-
})
|
|
14
|
+
.deleteAndGetJSON(`${zeniAPI.apiEndPoints.approvalMicroServiceBaseUrl}/1.0/bill-pay/approval-rules`, { approval_rule_id: approvalRuleId })
|
|
23
15
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
24
16
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
25
17
|
const approvalRuleIds = response.data.approval_rules.map((approvalRule) => approvalRule.approval_rule_id);
|
|
@@ -9,7 +9,7 @@ const userReducer_1 = require("../../../../../entity/user/userReducer");
|
|
|
9
9
|
const responsePayload_1 = require("../../../../../responsePayload");
|
|
10
10
|
const billPaySetupApproverViewReducer_1 = require("../billPaySetupApproverViewReducer");
|
|
11
11
|
const fetchBillPaySetupApproverViewEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(billPaySetupApproverViewReducer_1.fetchBillPaySetupApproverView.match), (0, operators_1.switchMap)((action) => {
|
|
12
|
-
const { cacheOverride
|
|
12
|
+
const { cacheOverride } = action.payload;
|
|
13
13
|
const { billPaySetupApproverViewState, approvalRuleState } = state$.value;
|
|
14
14
|
const approvalRules = (0, approvalRuleSelector_1.getApprovalRulesByIds)(approvalRuleState, billPaySetupApproverViewState.approvalRuleIds);
|
|
15
15
|
if (cacheOverride === true ||
|
|
@@ -17,13 +17,9 @@ const fetchBillPaySetupApproverViewEpic = (actions$, state$, zeniAPI) => actions
|
|
|
17
17
|
billPaySetupApproverViewState.approvalRuleIds.length ||
|
|
18
18
|
(billPaySetupApproverViewState.hasValidState() === false &&
|
|
19
19
|
billPaySetupApproverViewState.fetchState !== 'In-Progress')) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const endpoint = useV3 === true
|
|
24
|
-
? `${zeniAPI.apiEndPoints.approvalMicroServiceBaseUrl}/1.0/bill-pay/approval-rules-v2`
|
|
25
|
-
: `${zeniAPI.apiEndPoints.approvalMicroServiceBaseUrl}/1.0/bill-pay/approval-rules`;
|
|
26
|
-
return zeniAPI.getJSON(endpoint).pipe((0, operators_1.mergeMap)((response) => {
|
|
20
|
+
return zeniAPI
|
|
21
|
+
.getJSON(`${zeniAPI.apiEndPoints.approvalMicroServiceBaseUrl}/1.0/bill-pay/approval-rules`)
|
|
22
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
27
23
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
28
24
|
const approvalRuleIds = response.data.approval_rules.map((approvalRule) => approvalRule.approval_rule_id);
|
|
29
25
|
const actions = [
|
|
@@ -11,20 +11,16 @@ const initializeBillPaySetupApproverViewUpdateDataEpic = (actions$, state$) => a
|
|
|
11
11
|
if (approvalRuleId != null) {
|
|
12
12
|
const approvalRule = (0, approvalRuleSelector_1.getApprovalRuleById)(state$.value.approvalRuleState, approvalRuleId);
|
|
13
13
|
if (approvalRule != null) {
|
|
14
|
+
const criteria = approvalRule.criteria[0];
|
|
15
|
+
const range = criteria?.range;
|
|
14
16
|
const billPaySetupApproverViewUpdateData = {
|
|
15
17
|
approvalRuleId,
|
|
16
18
|
steps: approvalRule.steps,
|
|
17
19
|
criteria: {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
rangeType: criteria?.rangeType,
|
|
21
|
+
rangeEntity: criteria?.rangeEntity,
|
|
22
|
+
range,
|
|
21
23
|
},
|
|
22
|
-
// Approval Rules 3.0 — seed rule-level fields so the form can
|
|
23
|
-
// round-trip them on edit. Each may be undefined on legacy rules.
|
|
24
|
-
name: approvalRule.name,
|
|
25
|
-
description: approvalRule.description,
|
|
26
|
-
separationOfDuties: approvalRule.separationOfDuties,
|
|
27
|
-
isFallback: approvalRule.isFallback,
|
|
28
24
|
};
|
|
29
25
|
fetchActions.push((0, billPaySetupApproverViewReducer_1.clearBillPaySetupApproverViewUpdateData)(), (0, billPaySetupApproverViewReducer_1.saveBillPaySetupApproverViewUpdateData)(billPaySetupApproverViewUpdateData));
|
|
30
26
|
}
|
|
@@ -32,7 +28,7 @@ const initializeBillPaySetupApproverViewUpdateDataEpic = (actions$, state$) => a
|
|
|
32
28
|
else {
|
|
33
29
|
const billPaySetupApproverViewCreateData = {
|
|
34
30
|
steps: [],
|
|
35
|
-
criteria:
|
|
31
|
+
criteria: undefined,
|
|
36
32
|
};
|
|
37
33
|
fetchActions.push((0, billPaySetupApproverViewReducer_1.clearBillPaySetupApproverViewUpdateData)(), (0, billPaySetupApproverViewReducer_1.saveBillPaySetupApproverViewUpdateData)(billPaySetupApproverViewCreateData));
|
|
38
34
|
}
|
|
@@ -9,23 +9,14 @@ const userReducer_1 = require("../../../../../entity/user/userReducer");
|
|
|
9
9
|
const responsePayload_1 = require("../../../../../responsePayload");
|
|
10
10
|
const billPaySetupApproverViewReducer_1 = require("../billPaySetupApproverViewReducer");
|
|
11
11
|
const commonPayload_1 = require("../types/commonPayload");
|
|
12
|
-
const saveBillPaySetupApproverViewUpdatesEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(billPaySetupApproverViewReducer_1.saveBillPaySetupApproverViewUpdates.match), (0, operators_1.switchMap)((
|
|
12
|
+
const saveBillPaySetupApproverViewUpdatesEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(billPaySetupApproverViewReducer_1.saveBillPaySetupApproverViewUpdates.match), (0, operators_1.switchMap)(() => {
|
|
13
13
|
const { billPaySetupApproverViewState } = state$.value;
|
|
14
14
|
const billPaySetupApproverViewUpdateData = billPaySetupApproverViewState.billPaySetupApproverViewUpdateData;
|
|
15
15
|
if (billPaySetupApproverViewUpdateData != null &&
|
|
16
16
|
billPaySetupApproverViewUpdateData.data != null) {
|
|
17
|
-
|
|
18
|
-
// the `approval_rule_v3_config` dynamic config. `useV3` arrives
|
|
19
|
-
// on the action payload from the screen connector.
|
|
20
|
-
const { useV3 } = action.payload;
|
|
21
|
-
const payload = useV3
|
|
22
|
-
? (0, commonPayload_1.toApprovalChangableInfoPayload)(billPaySetupApproverViewUpdateData.data)
|
|
23
|
-
: (0, commonPayload_1.toApprovalChangableInfoPayloadV1)(billPaySetupApproverViewUpdateData.data);
|
|
24
|
-
const endpoint = useV3
|
|
25
|
-
? `${zeniAPI.apiEndPoints.approvalMicroServiceBaseUrl}/1.0/bill-pay/approval-rules-v2`
|
|
26
|
-
: `${zeniAPI.apiEndPoints.approvalMicroServiceBaseUrl}/1.0/bill-pay/approval-rules`;
|
|
17
|
+
const payload = (0, commonPayload_1.toApprovalChangableInfoPayload)(billPaySetupApproverViewUpdateData.data);
|
|
27
18
|
return zeniAPI
|
|
28
|
-
.postAndGetJSON(
|
|
19
|
+
.postAndGetJSON(`${zeniAPI.apiEndPoints.approvalMicroServiceBaseUrl}/1.0/bill-pay/approval-rules`, payload)
|
|
29
20
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
30
21
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
31
22
|
const approvalRuleIds = response.data.approval_rules.map((approvalRule) => approvalRule.approval_rule_id);
|
|
@@ -14,67 +14,9 @@ interface ApproverViewStepPayload extends Omit<StepPayload, 'actors'> {
|
|
|
14
14
|
}
|
|
15
15
|
interface ApprovalUpdatableInfoPayload {
|
|
16
16
|
approval_rule_id: ID;
|
|
17
|
-
criteria: CriteriaPayload;
|
|
17
|
+
criteria: CriteriaPayload[];
|
|
18
18
|
is_applicable_on_pending_approval_entity: boolean;
|
|
19
19
|
steps: ApproverViewStepPayload[];
|
|
20
|
-
description?: string;
|
|
21
|
-
is_fallback?: boolean;
|
|
22
|
-
is_separation_of_duty_enabled?: boolean;
|
|
23
|
-
/**
|
|
24
|
-
* Approval Rules 3.0 — rule-level wire fields. The backend accepts these
|
|
25
|
-
* as optional today; once 3.0 ships they become first-class. The SoD
|
|
26
|
-
* field name matches the GET response shape (confirmed with backend),
|
|
27
|
-
* so the same identifier flows both directions on the wire.
|
|
28
|
-
*/
|
|
29
|
-
name?: string;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* V1 / pre-3.0 wire shape. Kept so the rollback flag (gated by
|
|
33
|
-
* 'approval_rule_v3_config' dynamic config) can target the original
|
|
34
|
-
* '/approval-rules' endpoint with the legacy snake_case array of
|
|
35
|
-
* range entries. None of the 3.0 rule-level fields are sent.
|
|
36
|
-
*
|
|
37
|
-
* Reference: 'entityApprovalStatusPayload.json' fixture, which carries
|
|
38
|
-
* a real V1 approval rule from the legacy backend:
|
|
39
|
-
* criteria: [{type: 'range', range_entity: 'currency',
|
|
40
|
-
* min, max, currency_code, currency_symbol}]
|
|
41
|
-
* with 'min' / 'max' as scalar numbers and 'null' representing an
|
|
42
|
-
* absent bound for one-sided rules. The read-side mapper in
|
|
43
|
-
* 'approvalRulePayload.ts' (see 'LegacyAmountRangeCriterionPayload')
|
|
44
|
-
* decodes the same shape — write-side has to match.
|
|
45
|
-
*/
|
|
46
|
-
interface ApprovalUpdatableInfoPayloadV1CriterionEntry {
|
|
47
|
-
currency_code: string;
|
|
48
|
-
currency_symbol: string;
|
|
49
|
-
/** Upper bound. 'null' for a 'greater_than' (open-upper) rule. */
|
|
50
|
-
max: number | null;
|
|
51
|
-
/** Lower bound. 'null' for a 'less_than' (open-lower) rule. */
|
|
52
|
-
min: number | null;
|
|
53
|
-
range_entity: 'currency';
|
|
54
|
-
type: 'range';
|
|
55
|
-
}
|
|
56
|
-
interface ApprovalUpdatableInfoPayloadV1 {
|
|
57
|
-
criteria: ApprovalUpdatableInfoPayloadV1CriterionEntry[];
|
|
58
|
-
is_applicable_on_pending_approval_entity: boolean;
|
|
59
|
-
steps: ApproverViewStepPayload[];
|
|
60
|
-
approval_rule_id?: ID;
|
|
61
20
|
}
|
|
62
21
|
export declare const toApprovalChangableInfoPayload: (approverViewUpdateData: ApprovalRuleUpdateData | ApprovalRuleCreateData) => Partial<ApprovalUpdatableInfoPayload>;
|
|
63
|
-
/**
|
|
64
|
-
* V1 wire mapper — used when 'approval_rule_v3_config' resolves to OFF
|
|
65
|
-
* for the current tenant. Emits the legacy snake_case array shape that
|
|
66
|
-
* '/approval-rules' historically consumed (see the V1 fixture in
|
|
67
|
-
* 'entity/entityApprovalStatus/__mocks__/json/entityApprovalStatusPayload.json'):
|
|
68
|
-
* criteria: [{type: 'range', range_entity: 'currency', min, max,
|
|
69
|
-
* currency_code, currency_symbol}]
|
|
70
|
-
*
|
|
71
|
-
* Open-ended semantics are preserved on the wire: an absent 'min' or
|
|
72
|
-
* 'max' is sent as 'null' rather than synthesised to '0' or
|
|
73
|
-
* 'MAX_SAFE_INTEGER', so a 'greater_than' / 'less_than' rule stays
|
|
74
|
-
* one-sided after rollback rather than collapsing into a closed range.
|
|
75
|
-
*
|
|
76
|
-
* The V1 backend does not understand vendor / department criteria or
|
|
77
|
-
* the rule-level 3.0 fields, so those are dropped on the wire.
|
|
78
|
-
*/
|
|
79
|
-
export declare const toApprovalChangableInfoPayloadV1: (approverViewUpdateData: ApprovalRuleUpdateData | ApprovalRuleCreateData) => Partial<ApprovalUpdatableInfoPayloadV1>;
|
|
80
22
|
export {};
|