@zeniai/client-epic-state 4.11.17 → 4.11.19
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/view/spendManagement/billPay/billList/billListSelector.d.ts +1 -1
- package/lib/view/spendManagement/billPay/billList/billListSelector.js +3 -9
- package/lib/view/spendManagement/billPay/billsBulkActionView/billsBulkActionViewSelector.js +8 -5
- package/lib/view/spendManagement/billPay/billsBulkActionView/epics/approveOrRejectBillsBulkActionEpic.js +9 -4
- package/lib/view/spendManagement/billPay/billsBulkActionView/epics/cancelOrDeleteBillsBulkActionEpic.js +8 -3
- package/lib/view/spendManagement/billPay/billsBulkActionView/epics/submitDraftBillsBulkActionEpic.js +9 -4
- package/lib/view/vendorReviewView/vendorFirstReviewView/epics/saveVendorFirstReviewViewEpic.js +4 -4
- package/lib/view/vendorReviewView/vendorFirstReviewView/vendorFirstReviewViewReducer.d.ts +2 -1
- package/lib/view/vendorReviewView/vendorFirstReviewView/vendorFirstReviewViewReducer.js +5 -2
- package/package.json +1 -1
|
@@ -49,4 +49,4 @@ export declare const getBillList: (state: RootState, currentTimePeriod: TimePeri
|
|
|
49
49
|
export declare const getApproversOrRejectors: (billTransaction: BillTransaction, entityApprovalStatusState: EntityApprovalStatusState, userState: UserState) => Approvers;
|
|
50
50
|
export declare const getBillListOnSort: (sortKey: BillPayViewSortKey, sortOrder: SortOrder, currentTab: BillTab, transactions: BillTransactionView[]) => BillTransactionView[];
|
|
51
51
|
export declare const checkIfBulkActionAllowed: (selectedTab: BillTab, selectedSubTab: BillsSubTabType) => boolean;
|
|
52
|
-
export declare const getAllowedBulkActions: (selectedTab: BillTab, selectedSubTab: BillsSubTabType, isAllAwaitingMyApproval: boolean, isFirstBillProcessing: boolean
|
|
52
|
+
export declare const getAllowedBulkActions: (selectedTab: BillTab, selectedSubTab: BillsSubTabType, isAllAwaitingMyApproval: boolean, isFirstBillProcessing: boolean) => BulkOperationType[];
|
|
@@ -102,7 +102,6 @@ const getBillList = (state, currentTimePeriod, isBulkActionFeatureEnabled) => {
|
|
|
102
102
|
}
|
|
103
103
|
const bulkSubmissionFetchState = billsBulkActionViewState.bulkSubmissionFetchState.fetchState;
|
|
104
104
|
let isRecurringBillInBulkActionList = false;
|
|
105
|
-
let isBookClosedForAnySelectedBill = false;
|
|
106
105
|
let billListBulkActionInfo = {
|
|
107
106
|
isBulkActionAllowed: false,
|
|
108
107
|
billsSelectedForBulkAction: [],
|
|
@@ -146,9 +145,6 @@ const getBillList = (state, currentTimePeriod, isBulkActionFeatureEnabled) => {
|
|
|
146
145
|
if (isRecurring) {
|
|
147
146
|
isRecurringBillInBulkActionList = true;
|
|
148
147
|
}
|
|
149
|
-
if (isBookClosedForBill) {
|
|
150
|
-
isBookClosedForAnySelectedBill = true;
|
|
151
|
-
}
|
|
152
148
|
}
|
|
153
149
|
billBulkSelectInfo = {
|
|
154
150
|
isSelectableForBulkAction,
|
|
@@ -167,7 +163,7 @@ const getBillList = (state, currentTimePeriod, isBulkActionFeatureEnabled) => {
|
|
|
167
163
|
.length === 0;
|
|
168
164
|
const allowedBulkActions = isBulkActionAllowed
|
|
169
165
|
? (0, exports.getAllowedBulkActions)(billListState.currentTab, billListState.currentSubTab, allBulkBillsAwaitingMyApproval, (firstBillInBulkList === null || firstBillInBulkList === void 0 ? void 0 : firstBillInBulkList.billPayInfo.billPaymentStatus.code) ===
|
|
170
|
-
'processing'
|
|
166
|
+
'processing')
|
|
171
167
|
: [];
|
|
172
168
|
billListBulkActionInfo = {
|
|
173
169
|
isBulkActionAllowed,
|
|
@@ -548,12 +544,10 @@ const isBillSelectableForBulkAction = (bill, selectedTab, isBookClosedForBill, f
|
|
|
548
544
|
}
|
|
549
545
|
return result;
|
|
550
546
|
};
|
|
551
|
-
const getAllowedBulkActions = (selectedTab, selectedSubTab, isAllAwaitingMyApproval, isFirstBillProcessing
|
|
547
|
+
const getAllowedBulkActions = (selectedTab, selectedSubTab, isAllAwaitingMyApproval, isFirstBillProcessing) => {
|
|
552
548
|
switch (selectedTab) {
|
|
553
549
|
case 'draft':
|
|
554
|
-
return
|
|
555
|
-
? ['delete']
|
|
556
|
-
: ['send_for_approval', 'delete'];
|
|
550
|
+
return ['send_for_approval', 'delete'];
|
|
557
551
|
case 'pending_approval': {
|
|
558
552
|
switch (selectedSubTab) {
|
|
559
553
|
case 'all':
|
|
@@ -10,13 +10,15 @@ const getBillsBulkReviewView = (state) => {
|
|
|
10
10
|
const transactionIds = billsBulkActionViewState.billsSelectedForBulkAction;
|
|
11
11
|
const { currentTab, currentSubTab } = billListState;
|
|
12
12
|
let selectedTransactions = transactionIds.map((transactionId) => {
|
|
13
|
-
var _a, _b, _c, _d;
|
|
13
|
+
var _a, _b, _c, _d, _e;
|
|
14
14
|
const transaction = (0, get_1.default)(billTransactionState.transactionById, transactionId, undefined);
|
|
15
15
|
return {
|
|
16
16
|
transactionId,
|
|
17
17
|
isRecurring: (_a = transaction === null || transaction === void 0 ? void 0 : transaction.isRecurring) !== null && _a !== void 0 ? _a : false,
|
|
18
|
-
vendorName: (
|
|
19
|
-
|
|
18
|
+
vendorName: (_d = (Boolean((_b = transaction === null || transaction === void 0 ? void 0 : transaction.vendor) === null || _b === void 0 ? void 0 : _b.name) === true
|
|
19
|
+
? (_c = transaction === null || transaction === void 0 ? void 0 : transaction.vendor) === null || _c === void 0 ? void 0 : _c.name
|
|
20
|
+
: transaction === null || transaction === void 0 ? void 0 : transaction.candidateVendorName)) !== null && _d !== void 0 ? _d : '',
|
|
21
|
+
invoiceNumber: (_e = transaction === null || transaction === void 0 ? void 0 : transaction.documentId) !== null && _e !== void 0 ? _e : '',
|
|
20
22
|
amount: transaction === null || transaction === void 0 ? void 0 : transaction.totalAmountInUSD,
|
|
21
23
|
};
|
|
22
24
|
});
|
|
@@ -24,8 +26,9 @@ const getBillsBulkReviewView = (state) => {
|
|
|
24
26
|
const bulkSubmissionFetchState = billsBulkActionViewState.bulkSubmissionFetchState.fetchState;
|
|
25
27
|
if (bulkReviewFetchState === 'Completed') {
|
|
26
28
|
selectedTransactions = selectedTransactions.map((transaction) => {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
var _a;
|
|
30
|
+
const reviewStateOfBill = billsBulkActionViewState.bulkReviewStateById[transaction.transactionId];
|
|
31
|
+
return Object.assign(Object.assign({}, transaction), { reviewStatus: reviewStateOfBill === null || reviewStateOfBill === void 0 ? void 0 : reviewStateOfBill.status, reviewInfoMessage: (_a = reviewStateOfBill === null || reviewStateOfBill === void 0 ? void 0 : reviewStateOfBill.error) === null || _a === void 0 ? void 0 : _a.message });
|
|
29
32
|
});
|
|
30
33
|
}
|
|
31
34
|
return {
|
|
@@ -18,11 +18,12 @@ const approveOrRejectBillsBulkActionEpic = (actions$, state$, zeniAPI) => action
|
|
|
18
18
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
19
19
|
if ((0, responsePayload_1.isSuccessStatus)(response)) {
|
|
20
20
|
const actions = [];
|
|
21
|
+
const processingBillsCount = (_b = (_a = response.data) === null || _a === void 0 ? void 0 : _a.total_operations_processing) !== null && _b !== void 0 ? _b : 0;
|
|
21
22
|
actions.push((0, billsBulkActionViewReducer_1.billsBulkActionSuccess)({
|
|
22
|
-
billsProcessing: (
|
|
23
|
-
refreshTime: (
|
|
23
|
+
billsProcessing: (_d = (_c = response.data) === null || _c === void 0 ? void 0 : _c.total_operations_processing) !== null && _d !== void 0 ? _d : 0,
|
|
24
|
+
refreshTime: (_f = (_e = response.data) === null || _e === void 0 ? void 0 : _e.hard_refresh_after_sec) !== null && _f !== void 0 ? _f : 0,
|
|
24
25
|
}));
|
|
25
|
-
actions.push((0, billTransactionReducer_1.updateBillTransactionsWithBulkActionStatus)((
|
|
26
|
+
actions.push((0, billTransactionReducer_1.updateBillTransactionsWithBulkActionStatus)((_h = (_g = response.data) === null || _g === void 0 ? void 0 : _g.operations) !== null && _h !== void 0 ? _h : []));
|
|
26
27
|
actions.push((0, snackbarReducer_1.openSnackbar)({
|
|
27
28
|
messageSection: 'bill_pay_bulk_submit',
|
|
28
29
|
messageText: 'success',
|
|
@@ -30,7 +31,11 @@ const approveOrRejectBillsBulkActionEpic = (actions$, state$, zeniAPI) => action
|
|
|
30
31
|
variables: [
|
|
31
32
|
{
|
|
32
33
|
variableName: '_count_',
|
|
33
|
-
variableValue:
|
|
34
|
+
variableValue: processingBillsCount.toString(),
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
variableName: '_bill_',
|
|
38
|
+
variableValue: processingBillsCount > 1 ? 'bills' : 'bill',
|
|
34
39
|
},
|
|
35
40
|
{
|
|
36
41
|
variableName: '_action_',
|
|
@@ -17,11 +17,12 @@ const cancelOrDeleteBillsBulkActionEpic = (actions$, state$, zeniAPI) => actions
|
|
|
17
17
|
? zeniAPI.putAndGetJSON(bulkApiUrl, payload)
|
|
18
18
|
: zeniAPI.deleteAndGetJSON(bulkApiUrl, payload);
|
|
19
19
|
return api.pipe((0, operators_1.mergeMap)((response) => {
|
|
20
|
-
var _a, _b, _c, _d, _e, _f
|
|
20
|
+
var _a, _b, _c, _d, _e, _f;
|
|
21
21
|
if ((0, responsePayload_1.isSuccessStatus)(response)) {
|
|
22
22
|
const actions = [];
|
|
23
|
+
const processingBillsCount = (_b = (_a = response.data) === null || _a === void 0 ? void 0 : _a.total_operations_processing) !== null && _b !== void 0 ? _b : 0;
|
|
23
24
|
actions.push((0, billsBulkActionViewReducer_1.billsBulkActionSuccess)({
|
|
24
|
-
billsProcessing:
|
|
25
|
+
billsProcessing: processingBillsCount,
|
|
25
26
|
refreshTime: (_d = (_c = response.data) === null || _c === void 0 ? void 0 : _c.hard_refresh_after_sec) !== null && _d !== void 0 ? _d : 0,
|
|
26
27
|
}));
|
|
27
28
|
actions.push((0, billTransactionReducer_1.updateBillTransactionsWithBulkActionStatus)((_f = (_e = response.data) === null || _e === void 0 ? void 0 : _e.operations) !== null && _f !== void 0 ? _f : []));
|
|
@@ -32,7 +33,11 @@ const cancelOrDeleteBillsBulkActionEpic = (actions$, state$, zeniAPI) => actions
|
|
|
32
33
|
variables: [
|
|
33
34
|
{
|
|
34
35
|
variableName: '_count_',
|
|
35
|
-
variableValue:
|
|
36
|
+
variableValue: processingBillsCount.toString(),
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
variableName: '_bill_',
|
|
40
|
+
variableValue: processingBillsCount > 1 ? 'bills' : 'bill',
|
|
36
41
|
},
|
|
37
42
|
{
|
|
38
43
|
variableName: '_action_',
|
package/lib/view/spendManagement/billPay/billsBulkActionView/epics/submitDraftBillsBulkActionEpic.js
CHANGED
|
@@ -21,11 +21,12 @@ const submitDraftBillsBulkActionEpic = (actions$, state$, zeniAPI) => actions$.p
|
|
|
21
21
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
22
22
|
if ((0, responsePayload_1.isSuccessStatus)(response)) {
|
|
23
23
|
const actions = [];
|
|
24
|
+
const processingBillsCount = (_b = (_a = response.data) === null || _a === void 0 ? void 0 : _a.total_operations_processing) !== null && _b !== void 0 ? _b : 0;
|
|
24
25
|
actions.push((0, billsBulkActionViewReducer_1.billsBulkActionSuccess)({
|
|
25
|
-
billsProcessing: (
|
|
26
|
-
refreshTime: (
|
|
26
|
+
billsProcessing: (_d = (_c = response.data) === null || _c === void 0 ? void 0 : _c.total_operations_processing) !== null && _d !== void 0 ? _d : 0,
|
|
27
|
+
refreshTime: (_f = (_e = response.data) === null || _e === void 0 ? void 0 : _e.hard_refresh_after_sec) !== null && _f !== void 0 ? _f : 0,
|
|
27
28
|
}));
|
|
28
|
-
actions.push((0, billTransactionReducer_1.updateBillTransactionsWithBulkActionStatus)((
|
|
29
|
+
actions.push((0, billTransactionReducer_1.updateBillTransactionsWithBulkActionStatus)((_h = (_g = response.data) === null || _g === void 0 ? void 0 : _g.operations) !== null && _h !== void 0 ? _h : []));
|
|
29
30
|
actions.push((0, snackbarReducer_1.openSnackbar)({
|
|
30
31
|
messageSection: 'bill_pay_bulk_submit',
|
|
31
32
|
messageText: 'success',
|
|
@@ -33,7 +34,11 @@ const submitDraftBillsBulkActionEpic = (actions$, state$, zeniAPI) => actions$.p
|
|
|
33
34
|
variables: [
|
|
34
35
|
{
|
|
35
36
|
variableName: '_count_',
|
|
36
|
-
variableValue:
|
|
37
|
+
variableValue: processingBillsCount.toString(),
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
variableName: '_bill_',
|
|
41
|
+
variableValue: processingBillsCount > 1 ? 'bills' : 'bill',
|
|
37
42
|
},
|
|
38
43
|
{
|
|
39
44
|
variableName: '_action_',
|
package/lib/view/vendorReviewView/vendorFirstReviewView/epics/saveVendorFirstReviewViewEpic.js
CHANGED
|
@@ -45,7 +45,7 @@ const saveVendorFirstReviewViewEpic = (actions$, state$, zeniAPI) => actions$.pi
|
|
|
45
45
|
vendorId,
|
|
46
46
|
vendors: (_d = response.data.vendors) !== null && _d !== void 0 ? _d : [],
|
|
47
47
|
}));
|
|
48
|
-
actions.push((0, vendorFirstReviewViewReducer_1.saveVendorFirstReviewViewSuccessOrFailure)('Completed', action.payload.vendorId, markAsEmployee, response.status, (_e = response.data.vendors) === null || _e === void 0 ? void 0 : _e[0].status));
|
|
48
|
+
actions.push((0, vendorFirstReviewViewReducer_1.saveVendorFirstReviewViewSuccessOrFailure)('Completed', action.payload.vendorId, markAsEmployee, markAsLocalContractor, response.status, (_e = response.data.vendors) === null || _e === void 0 ? void 0 : _e[0].status));
|
|
49
49
|
if (currentVendor != null) {
|
|
50
50
|
if (((_f = response.data.vendors) === null || _f === void 0 ? void 0 : _f[0].status.code) === 'reviewed') {
|
|
51
51
|
actions.push((0, snackbarReducer_1.openSnackbar)({
|
|
@@ -93,7 +93,7 @@ const saveVendorFirstReviewViewEpic = (actions$, state$, zeniAPI) => actions$.pi
|
|
|
93
93
|
vendorId,
|
|
94
94
|
vendors: (_g = response.data.vendors) !== null && _g !== void 0 ? _g : [],
|
|
95
95
|
}));
|
|
96
|
-
actions.push((0, vendorFirstReviewViewReducer_1.saveVendorFirstReviewViewSuccessOrFailure)('Error', action.payload.vendorId, markAsEmployee, response.status));
|
|
96
|
+
actions.push((0, vendorFirstReviewViewReducer_1.saveVendorFirstReviewViewSuccessOrFailure)('Error', action.payload.vendorId, markAsEmployee, markAsLocalContractor, response.status));
|
|
97
97
|
actions.push((0, vendorReducer_1.updateVendors)((0, fetchVendorFirstReviewViewEpic_1.mapVendorsPayloadFromVendorFirstReviewViewResponse)((_h = response.data.vendors) !== null && _h !== void 0 ? _h : [])), (0, userReducer_1.updateAllUsers)({
|
|
98
98
|
users: (0, fetchVendorFirstReviewViewEpic_1.mapUsersPayloadFromVendorFirstReviewViewResponse)((_j = response.data.vendors) !== null && _j !== void 0 ? _j : []),
|
|
99
99
|
updateType: 'merge',
|
|
@@ -130,7 +130,7 @@ const saveVendorFirstReviewViewEpic = (actions$, state$, zeniAPI) => actions$.pi
|
|
|
130
130
|
return (0, rxjs_1.from)(actions);
|
|
131
131
|
}
|
|
132
132
|
else {
|
|
133
|
-
return (0, rxjs_1.of)((0, vendorFirstReviewViewReducer_1.saveVendorFirstReviewViewSuccessOrFailure)('Error', action.payload.vendorId, markAsEmployee, response.status), (0, snackbarReducer_1.openSnackbar)({
|
|
133
|
+
return (0, rxjs_1.of)((0, vendorFirstReviewViewReducer_1.saveVendorFirstReviewViewSuccessOrFailure)('Error', action.payload.vendorId, markAsEmployee, markAsLocalContractor, response.status), (0, snackbarReducer_1.openSnackbar)({
|
|
134
134
|
messageSection: 'save_vendor_sent_for_review',
|
|
135
135
|
messageText: 'failed',
|
|
136
136
|
type: 'error',
|
|
@@ -142,7 +142,7 @@ const saveVendorFirstReviewViewEpic = (actions$, state$, zeniAPI) => actions$.pi
|
|
|
142
142
|
],
|
|
143
143
|
}));
|
|
144
144
|
}
|
|
145
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, vendorFirstReviewViewReducer_1.saveVendorFirstReviewViewSuccessOrFailure)('Error', action.payload.vendorId, markAsEmployee, (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', `Save Vendor First Review View REST API call errored out ${JSON.stringify(error)}`)))));
|
|
145
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, vendorFirstReviewViewReducer_1.saveVendorFirstReviewViewSuccessOrFailure)('Error', action.payload.vendorId, markAsEmployee, markAsLocalContractor, (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', `Save Vendor First Review View REST API call errored out ${JSON.stringify(error)}`)))));
|
|
146
146
|
}));
|
|
147
147
|
exports.saveVendorFirstReviewViewEpic = saveVendorFirstReviewViewEpic;
|
|
148
148
|
/**
|
|
@@ -45,10 +45,11 @@ export declare const fetchVendorFirstReviewAttachments: import("@reduxjs/toolkit
|
|
|
45
45
|
isQBOMergeError: boolean;
|
|
46
46
|
oldRecommendation?: RecommendedNonExistingGlobalMerchant | undefined;
|
|
47
47
|
newRecommendation?: RecommendedNonExistingGlobalMerchant | undefined;
|
|
48
|
-
}, string>, clearRecentlySavedErroredVendorData: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, saveVendorFirstReviewViewSuccessOrFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[fetchState: FetchState, vendorId: string, markAsEmployee: boolean, error?: ZeniAPIStatus<Record<string, unknown>> | undefined, reviewStatus?: ReviewStatusPayload | undefined], {
|
|
48
|
+
}, string>, clearRecentlySavedErroredVendorData: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, saveVendorFirstReviewViewSuccessOrFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[fetchState: FetchState, vendorId: string, markAsEmployee: boolean, markAsLocalContractor: boolean, error?: ZeniAPIStatus<Record<string, unknown>> | undefined, reviewStatus?: ReviewStatusPayload | undefined], {
|
|
49
49
|
fetchState: FetchState;
|
|
50
50
|
vendorId: string;
|
|
51
51
|
markAsEmployee: boolean;
|
|
52
|
+
markAsLocalContractor: boolean;
|
|
52
53
|
error: ZeniAPIStatus<Record<string, unknown>> | undefined;
|
|
53
54
|
reviewStatus: ReviewStatusPayload | undefined;
|
|
54
55
|
}, string, never, never>, updateVendorFirstReviewViewTransactionAttachments: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
@@ -227,16 +227,19 @@ const vendorFirstReviewView = (0, toolkit_1.createSlice)({
|
|
|
227
227
|
(0, commonTypes_1.toVendorFirstReviewViewStatusesTypeStrict)(action.payload.reviewStatus.code);
|
|
228
228
|
// Note: We need to delete vendor local data when save is success with status code 'reviewed' OR it is marked as en employee
|
|
229
229
|
if (action.payload.fetchState === 'Completed' &&
|
|
230
|
-
(status === 'reviewed' ||
|
|
230
|
+
(status === 'reviewed' ||
|
|
231
|
+
action.payload.markAsEmployee ||
|
|
232
|
+
action.payload.markAsLocalContractor)) {
|
|
231
233
|
delete draft.vendorFirstReviewViewLocalDataById[vendorId];
|
|
232
234
|
}
|
|
233
235
|
},
|
|
234
|
-
prepare(fetchState, vendorId, markAsEmployee, error, reviewStatus) {
|
|
236
|
+
prepare(fetchState, vendorId, markAsEmployee, markAsLocalContractor, error, reviewStatus) {
|
|
235
237
|
return {
|
|
236
238
|
payload: {
|
|
237
239
|
fetchState,
|
|
238
240
|
vendorId,
|
|
239
241
|
markAsEmployee,
|
|
242
|
+
markAsLocalContractor,
|
|
240
243
|
error,
|
|
241
244
|
reviewStatus,
|
|
242
245
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.11.
|
|
3
|
+
"version": "4.11.19",
|
|
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
|
"types": "lib/index.d.ts",
|