@zeniai/client-epic-state 5.0.90-betaAR5 → 5.0.90-betaAS10
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/commonPayloadTypes/commonPayload.d.ts +25 -4
- 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 +12 -9
- 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/billPay/internationalWireVerification/epics/fetchIntlVerificationFormEpic.js +7 -3
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/epics/initializeIntlVerificationFormEpic.js +33 -34
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/epics/submitIntlVerificationEpic.js +2 -7
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireOnboardingDetailsToLocalData.js +146 -0
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationFieldConstants.js +40 -0
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationLocalDataHelpers.js +86 -0
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationPayload.js +55 -8
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationReducer.js +5 -6
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSelector.js +39 -15
- package/lib/esm/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSubmitPayload.js +154 -0
- 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 +15 -11
- package/lib/index.js +38 -30
- 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/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/billPay/internationalWireVerification/epics/fetchIntlVerificationFormEpic.d.ts +3 -3
- package/lib/view/spendManagement/billPay/internationalWireVerification/epics/fetchIntlVerificationFormEpic.js +6 -2
- package/lib/view/spendManagement/billPay/internationalWireVerification/epics/initializeIntlVerificationFormEpic.d.ts +2 -1
- package/lib/view/spendManagement/billPay/internationalWireVerification/epics/initializeIntlVerificationFormEpic.js +32 -33
- package/lib/view/spendManagement/billPay/internationalWireVerification/epics/submitIntlVerificationEpic.js +2 -7
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireOnboardingDetailsToLocalData.d.ts +4 -0
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireOnboardingDetailsToLocalData.js +150 -0
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationFieldConstants.d.ts +38 -0
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationFieldConstants.js +43 -0
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationLocalDataHelpers.d.ts +27 -0
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationLocalDataHelpers.js +96 -0
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationPayload.d.ts +24 -1
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationPayload.js +59 -9
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationReducer.js +4 -5
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSelector.js +39 -15
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationState.d.ts +20 -1
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSubmitPayload.d.ts +32 -0
- package/lib/view/spendManagement/billPay/internationalWireVerification/internationalWireVerificationSubmitPayload.js +159 -0
- 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
package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewReducer.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.clearRemiSetupApproverView = exports.clearRemiSetupApproverViewUpdateData = exports.setListeningToPusherEvent = exports.saveRemiSetupApproverViewUpdateData = exports.initializeRemiSetupApproverViewUpdateData = exports.saveRemiSetupApproverViewUpdatesFailure = exports.saveRemiSetupApproverViewUpdatesSuccess = exports.saveRemiSetupApproverViewUpdates = exports.
|
|
4
|
+
exports.clearRemiSetupApproverView = exports.clearRemiSetupApproverViewUpdateData = exports.setListeningToPusherEvent = exports.saveRemiSetupApproverViewUpdateData = exports.initializeRemiSetupApproverViewUpdateData = exports.saveRemiSetupApproverViewUpdatesFailure = exports.saveRemiSetupApproverViewUpdatesSuccess = exports.saveRemiSetupApproverViewUpdates = exports.deleteRemiApprovalRuleFailure = exports.deleteRemiApprovalRuleSuccess = exports.deleteRemiApprovalRule = exports.fetchRemiApproversListFailure = exports.fetchRemiApproversListSuccess = exports.fetchRemiApproversList = exports.fetchRemiApproversDetails = exports.fetchRemiSetupApproverViewFailure = exports.fetchRemiSetupApproverViewSuccess = exports.fetchRemiSetupApproverView = 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
|
remiSetupApproverViewUpdateData: undefined,
|
|
20
|
-
reorderStatus: { fetchState: 'Not-Started', error: undefined },
|
|
21
20
|
hasValidState() {
|
|
22
21
|
return this.fetchState === 'Completed';
|
|
23
22
|
},
|
|
@@ -31,17 +30,12 @@ const remiSetupApproverView = (0, toolkit_1.createSlice)({
|
|
|
31
30
|
draft.fetchState = 'In-Progress';
|
|
32
31
|
draft.error = undefined;
|
|
33
32
|
},
|
|
34
|
-
|
|
35
|
-
// ('approval_rule_v3_config' dynamic config) and picks v1 vs v2
|
|
36
|
-
// endpoint in the fetch epic. Required (no default) so a missing
|
|
37
|
-
// connector wire surfaces at compile time.
|
|
38
|
-
prepare(cacheOverride = false, resolveAttributeToUser = false, includeImplicitActors = false, useV3) {
|
|
33
|
+
prepare(cacheOverride = false, resolveAttributeToUser = false, includeImplicitActors = false) {
|
|
39
34
|
return {
|
|
40
35
|
payload: {
|
|
41
36
|
cacheOverride,
|
|
42
37
|
resolveAttributeToUser,
|
|
43
38
|
includeImplicitActors,
|
|
44
|
-
useV3,
|
|
45
39
|
},
|
|
46
40
|
};
|
|
47
41
|
},
|
|
@@ -144,12 +138,8 @@ const remiSetupApproverView = (0, toolkit_1.createSlice)({
|
|
|
144
138
|
error: undefined,
|
|
145
139
|
};
|
|
146
140
|
},
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
// can pick the v1 vs v2 endpoint. Required (no default) so a
|
|
150
|
-
// missing connector wire surfaces at compile time.
|
|
151
|
-
prepare(approvalRuleId, useV3) {
|
|
152
|
-
return { payload: { approvalRuleId, useV3 } };
|
|
141
|
+
prepare(approvalRuleId) {
|
|
142
|
+
return { payload: { approvalRuleId } };
|
|
153
143
|
},
|
|
154
144
|
},
|
|
155
145
|
deleteRemiApprovalRuleSuccess: {
|
|
@@ -181,72 +171,13 @@ const remiSetupApproverView = (0, toolkit_1.createSlice)({
|
|
|
181
171
|
};
|
|
182
172
|
},
|
|
183
173
|
},
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
const wasReorderInFlight = draft.reorderStatus.fetchState === 'In-Progress';
|
|
192
|
-
draft.reorderStatus = { fetchState: 'In-Progress', error: undefined };
|
|
193
|
-
// Stash the pre-reorder order for synchronous rollback on
|
|
194
|
-
// 'Failure'. See the BillPay reducer for the rationale,
|
|
195
|
-
// including the in-flight guard: a second drag before the
|
|
196
|
-
// first PUT lands must not overwrite the snapshot.
|
|
197
|
-
if (!wasReorderInFlight) {
|
|
198
|
-
draft.reorderRollbackIds = draft.approvalRuleIds;
|
|
199
|
-
}
|
|
200
|
-
draft.approvalRuleIds = approvalRuleIds;
|
|
201
|
-
},
|
|
202
|
-
// Approval Rules 3.0 — `useV3` required so a missing wire
|
|
203
|
-
// surfaces at compile time. Mirror of BillPay's reorder.prepare.
|
|
204
|
-
prepare(approvalRuleIds, useV3) {
|
|
205
|
-
return { payload: { approvalRuleIds, useV3 } };
|
|
206
|
-
},
|
|
207
|
-
},
|
|
208
|
-
reorderRemiApprovalRulesSuccess: {
|
|
209
|
-
reducer(draft, action) {
|
|
210
|
-
const { approvalRuleIds } = action.payload;
|
|
211
|
-
draft.reorderStatus = { fetchState: 'Completed', error: undefined };
|
|
212
|
-
draft.approvalRuleIds = approvalRuleIds;
|
|
213
|
-
draft.reorderRollbackIds = undefined;
|
|
214
|
-
},
|
|
215
|
-
prepare(approvalRuleIds) {
|
|
216
|
-
return { payload: { approvalRuleIds } };
|
|
217
|
-
},
|
|
218
|
-
},
|
|
219
|
-
reorderRemiApprovalRulesFailure: {
|
|
220
|
-
reducer(draft, action) {
|
|
221
|
-
const { status } = action.payload;
|
|
222
|
-
draft.reorderStatus = { fetchState: 'Error', error: status };
|
|
223
|
-
if (draft.reorderRollbackIds != null) {
|
|
224
|
-
draft.approvalRuleIds = draft.reorderRollbackIds;
|
|
225
|
-
draft.reorderRollbackIds = undefined;
|
|
226
|
-
}
|
|
227
|
-
},
|
|
228
|
-
prepare(status) {
|
|
229
|
-
return { payload: { status } };
|
|
230
|
-
},
|
|
231
|
-
},
|
|
232
|
-
saveRemiSetupApproverViewUpdates: {
|
|
233
|
-
// Approval Rules 3.0 — `useV3` sourced from
|
|
234
|
-
// `approval_rule_v3_config` dynamic config in the screen
|
|
235
|
-
// connector; epic uses it to pick v1 vs v2 URL + mapper. The
|
|
236
|
-
// reducer doesn't read the action but the parameter must be
|
|
237
|
-
// declared so the action payload type carries downstream.
|
|
238
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
239
|
-
reducer(draft, _action) {
|
|
240
|
-
if (draft.remiSetupApproverViewUpdateData != null) {
|
|
241
|
-
draft.remiSetupApproverViewUpdateData.updateStatus = {
|
|
242
|
-
fetchState: 'In-Progress',
|
|
243
|
-
error: undefined,
|
|
244
|
-
};
|
|
245
|
-
}
|
|
246
|
-
},
|
|
247
|
-
prepare(useV3) {
|
|
248
|
-
return { payload: { useV3 } };
|
|
249
|
-
},
|
|
174
|
+
saveRemiSetupApproverViewUpdates(draft) {
|
|
175
|
+
if (draft.remiSetupApproverViewUpdateData != null) {
|
|
176
|
+
draft.remiSetupApproverViewUpdateData.updateStatus = {
|
|
177
|
+
fetchState: 'In-Progress',
|
|
178
|
+
error: undefined,
|
|
179
|
+
};
|
|
180
|
+
}
|
|
250
181
|
},
|
|
251
182
|
saveRemiSetupApproverViewUpdatesSuccess: {
|
|
252
183
|
reducer(draft, action) {
|
|
@@ -335,5 +266,5 @@ const remiSetupApproverView = (0, toolkit_1.createSlice)({
|
|
|
335
266
|
},
|
|
336
267
|
},
|
|
337
268
|
});
|
|
338
|
-
_a = remiSetupApproverView.actions, exports.fetchRemiSetupApproverView = _a.fetchRemiSetupApproverView, exports.fetchRemiSetupApproverViewSuccess = _a.fetchRemiSetupApproverViewSuccess, exports.fetchRemiSetupApproverViewFailure = _a.fetchRemiSetupApproverViewFailure, exports.fetchRemiApproversDetails = _a.fetchRemiApproversDetails, exports.fetchRemiApproversList = _a.fetchRemiApproversList, exports.fetchRemiApproversListSuccess = _a.fetchRemiApproversListSuccess, exports.fetchRemiApproversListFailure = _a.fetchRemiApproversListFailure, exports.deleteRemiApprovalRule = _a.deleteRemiApprovalRule, exports.deleteRemiApprovalRuleSuccess = _a.deleteRemiApprovalRuleSuccess, exports.deleteRemiApprovalRuleFailure = _a.deleteRemiApprovalRuleFailure, exports.
|
|
269
|
+
_a = remiSetupApproverView.actions, exports.fetchRemiSetupApproverView = _a.fetchRemiSetupApproverView, exports.fetchRemiSetupApproverViewSuccess = _a.fetchRemiSetupApproverViewSuccess, exports.fetchRemiSetupApproverViewFailure = _a.fetchRemiSetupApproverViewFailure, exports.fetchRemiApproversDetails = _a.fetchRemiApproversDetails, exports.fetchRemiApproversList = _a.fetchRemiApproversList, exports.fetchRemiApproversListSuccess = _a.fetchRemiApproversListSuccess, exports.fetchRemiApproversListFailure = _a.fetchRemiApproversListFailure, exports.deleteRemiApprovalRule = _a.deleteRemiApprovalRule, exports.deleteRemiApprovalRuleSuccess = _a.deleteRemiApprovalRuleSuccess, exports.deleteRemiApprovalRuleFailure = _a.deleteRemiApprovalRuleFailure, exports.saveRemiSetupApproverViewUpdates = _a.saveRemiSetupApproverViewUpdates, exports.saveRemiSetupApproverViewUpdatesSuccess = _a.saveRemiSetupApproverViewUpdatesSuccess, exports.saveRemiSetupApproverViewUpdatesFailure = _a.saveRemiSetupApproverViewUpdatesFailure, exports.initializeRemiSetupApproverViewUpdateData = _a.initializeRemiSetupApproverViewUpdateData, exports.saveRemiSetupApproverViewUpdateData = _a.saveRemiSetupApproverViewUpdateData, exports.setListeningToPusherEvent = _a.setListeningToPusherEvent, exports.clearRemiSetupApproverViewUpdateData = _a.clearRemiSetupApproverViewUpdateData, exports.clearRemiSetupApproverView = _a.clearRemiSetupApproverView;
|
|
339
270
|
exports.default = remiSetupApproverView.reducer;
|
package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewState.d.ts
CHANGED
|
@@ -10,20 +10,8 @@ export interface RemiSetupApproverViewState extends FetchedState {
|
|
|
10
10
|
fetchStatus: FetchStateAndError;
|
|
11
11
|
attributeSubTypeToUserIdMapping?: Record<AttributeType, ID>;
|
|
12
12
|
};
|
|
13
|
-
/**
|
|
14
|
-
* List-page reorder PUT status. See BillPay equivalent for the
|
|
15
|
-
* longer rationale.
|
|
16
|
-
*/
|
|
17
|
-
reorderStatus: FetchStateAndError;
|
|
18
13
|
affectedEntityIds?: ID[];
|
|
19
14
|
listeningToPusherEvent?: boolean;
|
|
20
15
|
newApprovalRuleId?: ID;
|
|
21
16
|
remiSetupApproverViewUpdateData?: ApproverViewUpdateData;
|
|
22
|
-
/**
|
|
23
|
-
* Pre-reorder snapshot of 'approvalRuleIds'. Stashed on the trigger
|
|
24
|
-
* reducer right before the optimistic mutation and consumed on
|
|
25
|
-
* Failure to restore the previous order without waiting for the
|
|
26
|
-
* epic's safety-net refetch. Cleared on Success.
|
|
27
|
-
*/
|
|
28
|
-
reorderRollbackIds?: ID[];
|
|
29
17
|
}
|
|
@@ -50,15 +50,15 @@ export interface TaskFilterCategory {
|
|
|
50
50
|
}
|
|
51
51
|
export type TaskListFilterCategoryField = 'status' | 'dueDate' | 'assignee' | 'creationDate' | 'priority' | 'tag';
|
|
52
52
|
export declare const TASK_LIST_GROUP_BY_KEYS: readonly ["groupName", "status", "dueDate", "assignee", "priority", "tag"];
|
|
53
|
-
export declare const toTaskListGroupByKeyType: (v: string) => "status" | "
|
|
54
|
-
export declare const toTaskListGroupByKeyTypeStrict: (v: string) => "status" | "
|
|
53
|
+
export declare const toTaskListGroupByKeyType: (v: string) => "status" | "dueDate" | "groupName" | "tag" | "priority" | "assignee";
|
|
54
|
+
export declare const toTaskListGroupByKeyTypeStrict: (v: string) => "status" | "dueDate" | "groupName" | "tag" | "priority" | "assignee" | undefined;
|
|
55
55
|
export declare type TaskGroupKey = ReturnType<typeof toTaskListGroupByKeyType>;
|
|
56
56
|
export interface TaskListUIState extends SpendManagementUIState {
|
|
57
57
|
groupByKey: TaskGroupKey;
|
|
58
58
|
searchText: string;
|
|
59
59
|
sortKey: TaskListViewSortKey;
|
|
60
60
|
}
|
|
61
|
-
declare const toTaskListSortKeyType: (v: string) => "status" | "name" | "
|
|
61
|
+
declare const toTaskListSortKeyType: (v: string) => "status" | "name" | "dueDate" | "tag" | "priority" | "timeSpent" | "assignee" | "creationDate" | "visibility";
|
|
62
62
|
export declare type TaskListViewSortKey = ReturnType<typeof toTaskListSortKeyType>;
|
|
63
63
|
export declare const TASK_LIST_FILTER_CATEGORIES: TaskListFilterCategoryOption[];
|
|
64
64
|
interface TaskListFilterCategoryOption {
|
|
@@ -8,7 +8,7 @@ import { JournalEntryTransactionLine, Line, TransactionLineBase } from '../../en
|
|
|
8
8
|
* is testable and reusable.
|
|
9
9
|
*/
|
|
10
10
|
export declare const JOURNAL_ENTRY_SORT_KEYS: readonly ["description", "name", "category", "class", "debit", "credit"];
|
|
11
|
-
export declare const toJournalEntrySortKey: (v: string) => "
|
|
11
|
+
export declare const toJournalEntrySortKey: (v: string) => "name" | "description" | "category" | "class" | "credit" | "debit";
|
|
12
12
|
export type JournalEntrySortKey = ReturnType<typeof toJournalEntrySortKey>;
|
|
13
13
|
export interface JournalEntryRowSortConfig {
|
|
14
14
|
sortKey: JournalEntrySortKey;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.0.90-
|
|
3
|
+
"version": "5.0.90-betaAS10",
|
|
4
4
|
"description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/esm/index.js",
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { ID } from '../../commonStateTypes/common';
|
|
2
|
-
import { ApprovalRule, Criteria } from './approvalRuleState';
|
|
3
|
-
/**
|
|
4
|
-
* Approval Rules 3.0 — frontend overlap detection.
|
|
5
|
-
*
|
|
6
|
-
* Per product spec, two rules overlap iff:
|
|
7
|
-
* 1. Their vendor criteria are exactly equal (same operator and
|
|
8
|
-
* the same set of vendor IDs, or both absent), AND
|
|
9
|
-
* 2. Their department criteria are exactly equal (same shape), AND
|
|
10
|
-
* 3. Their amount intervals intersect.
|
|
11
|
-
*
|
|
12
|
-
* The intuition: we only flag overlap when the non-amount criteria
|
|
13
|
-
* are identical, because the typical mistake is "I tried to create a
|
|
14
|
-
* second rule for the same vendor / department slice at a different
|
|
15
|
-
* amount threshold and forgot the existing one". Subset / superset
|
|
16
|
-
* overlaps (e.g. one rule has a department condition and the other
|
|
17
|
-
* does not) are intentionally not flagged in this iteration.
|
|
18
|
-
*
|
|
19
|
-
* Amount intervals are:
|
|
20
|
-
* - greater_than(N) → [N, +∞)
|
|
21
|
-
* - less_than(N) → (-∞, N]
|
|
22
|
-
* - range(min, max) → [min, max]
|
|
23
|
-
* - amount absent → (-∞, +∞)
|
|
24
|
-
*
|
|
25
|
-
* Two intervals overlap iff max(lo) <= min(hi).
|
|
26
|
-
*
|
|
27
|
-
* Exclusions from the comparison pool:
|
|
28
|
-
* - The rule being edited (caller passes `excludeRuleId`).
|
|
29
|
-
* - Fallback rules — they are a separate concept (match-all-others)
|
|
30
|
-
* and not subject to the per-criteria overlap check.
|
|
31
|
-
*
|
|
32
|
-
* Callers should filter `existingRules` to the relevant entityType
|
|
33
|
-
* (BillPay vs Reimbursement) before passing — the function does not
|
|
34
|
-
* cross-check entityType.
|
|
35
|
-
*
|
|
36
|
-
* Pure function: no side effects, deterministic. Returns the list of
|
|
37
|
-
* overlapping rules. Empty list means no overlap.
|
|
38
|
-
*/
|
|
39
|
-
/**
|
|
40
|
-
* Structural shape of a rule the algorithm needs. The detector only
|
|
41
|
-
* reads `criteria`, `isFallback`, and `approvalRuleId`; it never
|
|
42
|
-
* touches `steps`, so callers may pass any 'ApprovalRule' subtype
|
|
43
|
-
* (e.g. `ApprovalRuleWithUser`) and we keep the richer type in the
|
|
44
|
-
* output.
|
|
45
|
-
*/
|
|
46
|
-
export type RuleForOverlapCheck = Pick<ApprovalRule, 'approvalRuleId' | 'criteria' | 'isFallback'>;
|
|
47
|
-
export interface RuleOverlap<TRule extends RuleForOverlapCheck = ApprovalRule> {
|
|
48
|
-
conflictingRule: TRule;
|
|
49
|
-
}
|
|
50
|
-
export interface DetectRuleOverlapInput<TRule extends RuleForOverlapCheck = ApprovalRule> {
|
|
51
|
-
candidateCriteria: Criteria[];
|
|
52
|
-
existingRules: TRule[];
|
|
53
|
-
/** When editing an existing rule, exclude it from the comparison. */
|
|
54
|
-
excludeRuleId?: ID;
|
|
55
|
-
}
|
|
56
|
-
export declare function detectRuleOverlap<TRule extends RuleForOverlapCheck>({ candidateCriteria, existingRules, excludeRuleId, }: DetectRuleOverlapInput<TRule>): RuleOverlap<TRule>[];
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.detectRuleOverlap = detectRuleOverlap;
|
|
4
|
-
function detectRuleOverlap({ candidateCriteria, existingRules, excludeRuleId, }) {
|
|
5
|
-
const candidateAmount = pickAmount(candidateCriteria);
|
|
6
|
-
const candidateVendor = pickVendor(candidateCriteria);
|
|
7
|
-
const candidateDepartment = pickDepartment(candidateCriteria);
|
|
8
|
-
const overlaps = [];
|
|
9
|
-
for (const rule of existingRules) {
|
|
10
|
-
if (rule.approvalRuleId === excludeRuleId) {
|
|
11
|
-
continue;
|
|
12
|
-
}
|
|
13
|
-
if (rule.isFallback === true) {
|
|
14
|
-
continue;
|
|
15
|
-
}
|
|
16
|
-
const ruleVendor = pickVendor(rule.criteria);
|
|
17
|
-
const ruleDepartment = pickDepartment(rule.criteria);
|
|
18
|
-
if (!areVendorCriteriaEqual(candidateVendor, ruleVendor)) {
|
|
19
|
-
continue;
|
|
20
|
-
}
|
|
21
|
-
if (!areDepartmentCriteriaEqual(candidateDepartment, ruleDepartment)) {
|
|
22
|
-
continue;
|
|
23
|
-
}
|
|
24
|
-
const ruleAmount = pickAmount(rule.criteria);
|
|
25
|
-
if (amountsOverlap(candidateAmount, ruleAmount)) {
|
|
26
|
-
overlaps.push({ conflictingRule: rule });
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return overlaps;
|
|
30
|
-
}
|
|
31
|
-
const pickAmount = (criteria) => criteria.find((c) => c.type === 'amount');
|
|
32
|
-
const pickVendor = (criteria) => criteria.find((c) => c.type === 'vendor');
|
|
33
|
-
const pickDepartment = (criteria) => criteria.find((c) => c.type === 'department');
|
|
34
|
-
const areVendorCriteriaEqual = (a, b) => {
|
|
35
|
-
if (a == null && b == null) {
|
|
36
|
-
return true;
|
|
37
|
-
}
|
|
38
|
-
if (a == null || b == null) {
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
if (a.operator !== b.operator) {
|
|
42
|
-
return false;
|
|
43
|
-
}
|
|
44
|
-
return idsEqual(a.vendorIds, b.vendorIds);
|
|
45
|
-
};
|
|
46
|
-
const areDepartmentCriteriaEqual = (a, b) => {
|
|
47
|
-
if (a == null && b == null) {
|
|
48
|
-
return true;
|
|
49
|
-
}
|
|
50
|
-
if (a == null || b == null) {
|
|
51
|
-
return false;
|
|
52
|
-
}
|
|
53
|
-
if (a.operator !== b.operator) {
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
return idsEqual(a.departmentIds, b.departmentIds);
|
|
57
|
-
};
|
|
58
|
-
const idsEqual = (a, b) => {
|
|
59
|
-
if (a.length !== b.length) {
|
|
60
|
-
return false;
|
|
61
|
-
}
|
|
62
|
-
const aSorted = [...a].sort();
|
|
63
|
-
const bSorted = [...b].sort();
|
|
64
|
-
return aSorted.every((id, i) => id === bSorted[i]);
|
|
65
|
-
};
|
|
66
|
-
const amountsOverlap = (a, b) => {
|
|
67
|
-
// Absent amount criteria covers the whole real line, so any
|
|
68
|
-
// pairing involving an absent one is a guaranteed overlap.
|
|
69
|
-
if (a == null || b == null) {
|
|
70
|
-
return true;
|
|
71
|
-
}
|
|
72
|
-
const aLow = a.min?.amount ?? Number.NEGATIVE_INFINITY;
|
|
73
|
-
const aHigh = a.max?.amount ?? Number.POSITIVE_INFINITY;
|
|
74
|
-
const bLow = b.min?.amount ?? Number.NEGATIVE_INFINITY;
|
|
75
|
-
const bHigh = b.max?.amount ?? Number.POSITIVE_INFINITY;
|
|
76
|
-
return Math.max(aLow, bLow) <= Math.min(aHigh, bHigh);
|
|
77
|
-
};
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
export function detectRuleOverlap({ candidateCriteria, existingRules, excludeRuleId, }) {
|
|
2
|
-
const candidateAmount = pickAmount(candidateCriteria);
|
|
3
|
-
const candidateVendor = pickVendor(candidateCriteria);
|
|
4
|
-
const candidateDepartment = pickDepartment(candidateCriteria);
|
|
5
|
-
const overlaps = [];
|
|
6
|
-
for (const rule of existingRules) {
|
|
7
|
-
if (rule.approvalRuleId === excludeRuleId) {
|
|
8
|
-
continue;
|
|
9
|
-
}
|
|
10
|
-
if (rule.isFallback === true) {
|
|
11
|
-
continue;
|
|
12
|
-
}
|
|
13
|
-
const ruleVendor = pickVendor(rule.criteria);
|
|
14
|
-
const ruleDepartment = pickDepartment(rule.criteria);
|
|
15
|
-
if (!areVendorCriteriaEqual(candidateVendor, ruleVendor)) {
|
|
16
|
-
continue;
|
|
17
|
-
}
|
|
18
|
-
if (!areDepartmentCriteriaEqual(candidateDepartment, ruleDepartment)) {
|
|
19
|
-
continue;
|
|
20
|
-
}
|
|
21
|
-
const ruleAmount = pickAmount(rule.criteria);
|
|
22
|
-
if (amountsOverlap(candidateAmount, ruleAmount)) {
|
|
23
|
-
overlaps.push({ conflictingRule: rule });
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
return overlaps;
|
|
27
|
-
}
|
|
28
|
-
const pickAmount = (criteria) => criteria.find((c) => c.type === 'amount');
|
|
29
|
-
const pickVendor = (criteria) => criteria.find((c) => c.type === 'vendor');
|
|
30
|
-
const pickDepartment = (criteria) => criteria.find((c) => c.type === 'department');
|
|
31
|
-
const areVendorCriteriaEqual = (a, b) => {
|
|
32
|
-
if (a == null && b == null) {
|
|
33
|
-
return true;
|
|
34
|
-
}
|
|
35
|
-
if (a == null || b == null) {
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
if (a.operator !== b.operator) {
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
return idsEqual(a.vendorIds, b.vendorIds);
|
|
42
|
-
};
|
|
43
|
-
const areDepartmentCriteriaEqual = (a, b) => {
|
|
44
|
-
if (a == null && b == null) {
|
|
45
|
-
return true;
|
|
46
|
-
}
|
|
47
|
-
if (a == null || b == null) {
|
|
48
|
-
return false;
|
|
49
|
-
}
|
|
50
|
-
if (a.operator !== b.operator) {
|
|
51
|
-
return false;
|
|
52
|
-
}
|
|
53
|
-
return idsEqual(a.departmentIds, b.departmentIds);
|
|
54
|
-
};
|
|
55
|
-
const idsEqual = (a, b) => {
|
|
56
|
-
if (a.length !== b.length) {
|
|
57
|
-
return false;
|
|
58
|
-
}
|
|
59
|
-
const aSorted = [...a].sort();
|
|
60
|
-
const bSorted = [...b].sort();
|
|
61
|
-
return aSorted.every((id, i) => id === bSorted[i]);
|
|
62
|
-
};
|
|
63
|
-
const amountsOverlap = (a, b) => {
|
|
64
|
-
// Absent amount criteria covers the whole real line, so any
|
|
65
|
-
// pairing involving an absent one is a guaranteed overlap.
|
|
66
|
-
if (a == null || b == null) {
|
|
67
|
-
return true;
|
|
68
|
-
}
|
|
69
|
-
const aLow = a.min?.amount ?? Number.NEGATIVE_INFINITY;
|
|
70
|
-
const aHigh = a.max?.amount ?? Number.POSITIVE_INFINITY;
|
|
71
|
-
const bLow = b.min?.amount ?? Number.NEGATIVE_INFINITY;
|
|
72
|
-
const bHigh = b.max?.amount ?? Number.POSITIVE_INFINITY;
|
|
73
|
-
return Math.max(aLow, bLow) <= Math.min(aHigh, bHigh);
|
|
74
|
-
};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { from } from 'rxjs';
|
|
2
|
-
import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
|
|
3
|
-
import { updateApprovalRules } from '../../../../../entity/approvalRule/approvalRuleReducer';
|
|
4
|
-
import { openSnackbar } from '../../../../../entity/snackbar/snackbarReducer';
|
|
5
|
-
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../../responsePayload';
|
|
6
|
-
import { fetchBillPaySetupApproverView, reorderBillPayApprovalRules, reorderBillPayApprovalRulesFailure, reorderBillPayApprovalRulesSuccess, } from '../billPaySetupApproverViewReducer';
|
|
7
|
-
export const reorderBillPayApprovalRulesEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(reorderBillPayApprovalRules.match), switchMap((action) => {
|
|
8
|
-
const { approvalRuleIds, useV3 } = action.payload;
|
|
9
|
-
// Approval Rules 3.0 — flag-gated endpoint selection. Mirrors
|
|
10
|
-
// the pattern used by delete + fetch epics: the v3 dev host
|
|
11
|
-
// until the production base URL ships the v2 reorder route.
|
|
12
|
-
const endpoint = `${zeniAPI.apiEndPoints.approvalMicroServiceBaseUrl}/1.0/bill-pay/approval-rules-v2/reorder`;
|
|
13
|
-
return zeniAPI
|
|
14
|
-
.putAndGetJSON(endpoint, {
|
|
15
|
-
rule_ids: approvalRuleIds,
|
|
16
|
-
})
|
|
17
|
-
.pipe(mergeMap((response) => {
|
|
18
|
-
if (isSuccessResponse(response) && response.data != null) {
|
|
19
|
-
const serverOrderedIds = response.data.approval_rules.map((approvalRule) => approvalRule.approval_rule_id);
|
|
20
|
-
const actions = [
|
|
21
|
-
updateApprovalRules(response.data.approval_rules),
|
|
22
|
-
reorderBillPayApprovalRulesSuccess(serverOrderedIds),
|
|
23
|
-
openSnackbar({
|
|
24
|
-
messageSection: `bill_pay_approval_reorder`,
|
|
25
|
-
messageText: 'success',
|
|
26
|
-
type: 'success',
|
|
27
|
-
}),
|
|
28
|
-
];
|
|
29
|
-
return from(actions);
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
const recovery = [
|
|
33
|
-
reorderBillPayApprovalRulesFailure(response.status),
|
|
34
|
-
openSnackbar({
|
|
35
|
-
messageSection: `bill_pay_approval_reorder`,
|
|
36
|
-
messageText: 'failed',
|
|
37
|
-
type: 'error',
|
|
38
|
-
}),
|
|
39
|
-
// Refetch to revert the optimistic order to server truth.
|
|
40
|
-
fetchBillPaySetupApproverView(true, true, useV3),
|
|
41
|
-
];
|
|
42
|
-
return from(recovery);
|
|
43
|
-
}
|
|
44
|
-
}), catchError((error) => from([
|
|
45
|
-
reorderBillPayApprovalRulesFailure(createZeniAPIStatus('Unexpected Error', 'Reorder Bill Pay Approval Rules errored out' +
|
|
46
|
-
JSON.stringify(error))),
|
|
47
|
-
openSnackbar({
|
|
48
|
-
messageSection: `bill_pay_approval_reorder`,
|
|
49
|
-
messageText: 'failed',
|
|
50
|
-
type: 'error',
|
|
51
|
-
}),
|
|
52
|
-
fetchBillPaySetupApproverView(true, true, useV3),
|
|
53
|
-
])));
|
|
54
|
-
}));
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { from } from 'rxjs';
|
|
2
|
-
import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
|
|
3
|
-
import { updateApprovalRules } from '../../../../../entity/approvalRule/approvalRuleReducer';
|
|
4
|
-
import { openSnackbar } from '../../../../../entity/snackbar/snackbarReducer';
|
|
5
|
-
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../../responsePayload';
|
|
6
|
-
import { fetchRemiSetupApproverView, reorderRemiApprovalRules, reorderRemiApprovalRulesFailure, reorderRemiApprovalRulesSuccess, } from '../remiSetupApproverViewReducer';
|
|
7
|
-
export const reorderRemiApprovalRulesEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(reorderRemiApprovalRules.match), switchMap((action) => {
|
|
8
|
-
const { approvalRuleIds, useV3 } = action.payload;
|
|
9
|
-
const endpoint = `${zeniAPI.apiEndPoints.approvalMicroServiceBaseUrl}/1.0/reimbursements/approval-rules-v2/reorder`;
|
|
10
|
-
return zeniAPI
|
|
11
|
-
.putAndGetJSON(endpoint, {
|
|
12
|
-
rule_ids: approvalRuleIds,
|
|
13
|
-
})
|
|
14
|
-
.pipe(mergeMap((response) => {
|
|
15
|
-
if (isSuccessResponse(response) && response.data != null) {
|
|
16
|
-
const serverOrderedIds = response.data.approval_rules.map((approvalRule) => approvalRule.approval_rule_id);
|
|
17
|
-
const actions = [
|
|
18
|
-
updateApprovalRules(response.data.approval_rules),
|
|
19
|
-
reorderRemiApprovalRulesSuccess(serverOrderedIds),
|
|
20
|
-
openSnackbar({
|
|
21
|
-
messageSection: `reimbursement_approval_reorder`,
|
|
22
|
-
messageText: 'success',
|
|
23
|
-
type: 'success',
|
|
24
|
-
}),
|
|
25
|
-
];
|
|
26
|
-
return from(actions);
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
return from([
|
|
30
|
-
reorderRemiApprovalRulesFailure(response.status),
|
|
31
|
-
openSnackbar({
|
|
32
|
-
messageSection: `reimbursement_approval_reorder`,
|
|
33
|
-
messageText: 'failed',
|
|
34
|
-
type: 'error',
|
|
35
|
-
}),
|
|
36
|
-
// Failure-recovery refetch — match the screen connector
|
|
37
|
-
// convention '(cacheOverride, resolveAttributeToUser,
|
|
38
|
-
// includeImplicitActors, useV3)' rather than copying BillPay's
|
|
39
|
-
// 3-arg shape. With the previous useV3-as-default-false the
|
|
40
|
-
// V3 flag was being smuggled in as 'includeImplicitActors',
|
|
41
|
-
// which silently broke V3 recovery refetches.
|
|
42
|
-
fetchRemiSetupApproverView(true, false, false, useV3),
|
|
43
|
-
]);
|
|
44
|
-
}
|
|
45
|
-
}), catchError((error) => from([
|
|
46
|
-
reorderRemiApprovalRulesFailure(createZeniAPIStatus('Unexpected Error', 'Reorder Reimbursement Approval Rules errored out' +
|
|
47
|
-
JSON.stringify(error))),
|
|
48
|
-
openSnackbar({
|
|
49
|
-
messageSection: `reimbursement_approval_reorder`,
|
|
50
|
-
messageText: 'failed',
|
|
51
|
-
type: 'error',
|
|
52
|
-
}),
|
|
53
|
-
// Failure-recovery refetch — match the screen connector
|
|
54
|
-
// convention '(cacheOverride, resolveAttributeToUser,
|
|
55
|
-
// includeImplicitActors, useV3)' rather than copying BillPay's
|
|
56
|
-
// 3-arg shape. With the previous useV3-as-default-false the
|
|
57
|
-
// V3 flag was being smuggled in as 'includeImplicitActors',
|
|
58
|
-
// which silently broke V3 recovery refetches.
|
|
59
|
-
fetchRemiSetupApproverView(true, false, false, useV3),
|
|
60
|
-
])));
|
|
61
|
-
}));
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { updateApprovalRules } from '../../../../../entity/approvalRule/approvalRuleReducer';
|
|
4
|
-
import { openSnackbar } from '../../../../../entity/snackbar/snackbarReducer';
|
|
5
|
-
import { RootState } from '../../../../../reducer';
|
|
6
|
-
import { ZeniAPI } from '../../../../../zeniAPI';
|
|
7
|
-
import { fetchBillPaySetupApproverView, reorderBillPayApprovalRules, reorderBillPayApprovalRulesFailure, reorderBillPayApprovalRulesSuccess } from '../billPaySetupApproverViewReducer';
|
|
8
|
-
/**
|
|
9
|
-
* Approval Rules 3.0 — list-page drag-and-drop reorder.
|
|
10
|
-
*
|
|
11
|
-
* PUT /bill-pay/approval-rules-v2/reorder with the new ID order in
|
|
12
|
-
* 'rule_ids'. Returns the updated 'approval_rules' (with refreshed
|
|
13
|
-
* priorities). The reducer optimistically updated 'approvalRuleIds'
|
|
14
|
-
* on the trigger action, so:
|
|
15
|
-
* - on success: dispatch the updated approval rule payloads into
|
|
16
|
-
* the entity slice, then 'Success' to normalise the slice's
|
|
17
|
-
* ordered ID list to whatever the server returned.
|
|
18
|
-
* - on failure: snackbar + dispatch 'fetchBillPaySetupApproverView'
|
|
19
|
-
* with cacheOverride to roll the optimistic state back to server
|
|
20
|
-
* truth.
|
|
21
|
-
*/
|
|
22
|
-
export type ActionType = ReturnType<typeof reorderBillPayApprovalRules> | ReturnType<typeof reorderBillPayApprovalRulesSuccess> | ReturnType<typeof reorderBillPayApprovalRulesFailure> | ReturnType<typeof updateApprovalRules> | ReturnType<typeof fetchBillPaySetupApproverView> | ReturnType<typeof openSnackbar>;
|
|
23
|
-
export declare const reorderBillPayApprovalRulesEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.reorderBillPayApprovalRulesEpic = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const approvalRuleReducer_1 = require("../../../../../entity/approvalRule/approvalRuleReducer");
|
|
7
|
-
const snackbarReducer_1 = require("../../../../../entity/snackbar/snackbarReducer");
|
|
8
|
-
const responsePayload_1 = require("../../../../../responsePayload");
|
|
9
|
-
const billPaySetupApproverViewReducer_1 = require("../billPaySetupApproverViewReducer");
|
|
10
|
-
const reorderBillPayApprovalRulesEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(billPaySetupApproverViewReducer_1.reorderBillPayApprovalRules.match), (0, operators_1.switchMap)((action) => {
|
|
11
|
-
const { approvalRuleIds, useV3 } = action.payload;
|
|
12
|
-
// Approval Rules 3.0 — flag-gated endpoint selection. Mirrors
|
|
13
|
-
// the pattern used by delete + fetch epics: the v3 dev host
|
|
14
|
-
// until the production base URL ships the v2 reorder route.
|
|
15
|
-
const endpoint = `${zeniAPI.apiEndPoints.approvalMicroServiceBaseUrl}/1.0/bill-pay/approval-rules-v2/reorder`;
|
|
16
|
-
return zeniAPI
|
|
17
|
-
.putAndGetJSON(endpoint, {
|
|
18
|
-
rule_ids: approvalRuleIds,
|
|
19
|
-
})
|
|
20
|
-
.pipe((0, operators_1.mergeMap)((response) => {
|
|
21
|
-
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
22
|
-
const serverOrderedIds = response.data.approval_rules.map((approvalRule) => approvalRule.approval_rule_id);
|
|
23
|
-
const actions = [
|
|
24
|
-
(0, approvalRuleReducer_1.updateApprovalRules)(response.data.approval_rules),
|
|
25
|
-
(0, billPaySetupApproverViewReducer_1.reorderBillPayApprovalRulesSuccess)(serverOrderedIds),
|
|
26
|
-
(0, snackbarReducer_1.openSnackbar)({
|
|
27
|
-
messageSection: `bill_pay_approval_reorder`,
|
|
28
|
-
messageText: 'success',
|
|
29
|
-
type: 'success',
|
|
30
|
-
}),
|
|
31
|
-
];
|
|
32
|
-
return (0, rxjs_1.from)(actions);
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
const recovery = [
|
|
36
|
-
(0, billPaySetupApproverViewReducer_1.reorderBillPayApprovalRulesFailure)(response.status),
|
|
37
|
-
(0, snackbarReducer_1.openSnackbar)({
|
|
38
|
-
messageSection: `bill_pay_approval_reorder`,
|
|
39
|
-
messageText: 'failed',
|
|
40
|
-
type: 'error',
|
|
41
|
-
}),
|
|
42
|
-
// Refetch to revert the optimistic order to server truth.
|
|
43
|
-
(0, billPaySetupApproverViewReducer_1.fetchBillPaySetupApproverView)(true, true, useV3),
|
|
44
|
-
];
|
|
45
|
-
return (0, rxjs_1.from)(recovery);
|
|
46
|
-
}
|
|
47
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
|
|
48
|
-
(0, billPaySetupApproverViewReducer_1.reorderBillPayApprovalRulesFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Reorder Bill Pay Approval Rules errored out' +
|
|
49
|
-
JSON.stringify(error))),
|
|
50
|
-
(0, snackbarReducer_1.openSnackbar)({
|
|
51
|
-
messageSection: `bill_pay_approval_reorder`,
|
|
52
|
-
messageText: 'failed',
|
|
53
|
-
type: 'error',
|
|
54
|
-
}),
|
|
55
|
-
(0, billPaySetupApproverViewReducer_1.fetchBillPaySetupApproverView)(true, true, useV3),
|
|
56
|
-
])));
|
|
57
|
-
}));
|
|
58
|
-
exports.reorderBillPayApprovalRulesEpic = reorderBillPayApprovalRulesEpic;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { updateApprovalRules } from '../../../../../entity/approvalRule/approvalRuleReducer';
|
|
4
|
-
import { openSnackbar } from '../../../../../entity/snackbar/snackbarReducer';
|
|
5
|
-
import { RootState } from '../../../../../reducer';
|
|
6
|
-
import { ZeniAPI } from '../../../../../zeniAPI';
|
|
7
|
-
import { fetchRemiSetupApproverView, reorderRemiApprovalRules, reorderRemiApprovalRulesFailure, reorderRemiApprovalRulesSuccess } from '../remiSetupApproverViewReducer';
|
|
8
|
-
/**
|
|
9
|
-
* Approval Rules 3.0 — list-page drag-and-drop reorder for
|
|
10
|
-
* reimbursements. Mirrors the BillPay reorder epic — see that file
|
|
11
|
-
* for the longer rationale.
|
|
12
|
-
*/
|
|
13
|
-
export type ActionType = ReturnType<typeof reorderRemiApprovalRules> | ReturnType<typeof reorderRemiApprovalRulesSuccess> | ReturnType<typeof reorderRemiApprovalRulesFailure> | ReturnType<typeof updateApprovalRules> | ReturnType<typeof fetchRemiSetupApproverView> | ReturnType<typeof openSnackbar>;
|
|
14
|
-
export declare const reorderRemiApprovalRulesEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|