@zeniai/client-epic-state 4.11.18 → 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.
@@ -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, isBookClosedForAnySelectedBill: boolean) => BulkOperationType[];
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', isBookClosedForAnySelectedBill)
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, isBookClosedForAnySelectedBill) => {
547
+ const getAllowedBulkActions = (selectedTab, selectedSubTab, isAllAwaitingMyApproval, isFirstBillProcessing) => {
552
548
  switch (selectedTab) {
553
549
  case 'draft':
554
- return isBookClosedForAnySelectedBill
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: (_c = (_b = transaction === null || transaction === void 0 ? void 0 : transaction.vendor) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : '',
19
- invoiceNumber: (_d = transaction === null || transaction === void 0 ? void 0 : transaction.documentId) !== null && _d !== void 0 ? _d : '',
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
- const { status, error } = billsBulkActionViewState.bulkReviewStateById[transaction.transactionId];
28
- return Object.assign(Object.assign({}, transaction), { reviewStatus: status, reviewInfoMessage: error === null || error === void 0 ? void 0 : error.message });
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: (_b = (_a = response.data) === null || _a === void 0 ? void 0 : _a.total_operations_processing) !== null && _b !== void 0 ? _b : 0,
23
- refreshTime: (_d = (_c = response.data) === null || _c === void 0 ? void 0 : _c.hard_refresh_after_sec) !== null && _d !== void 0 ? _d : 0,
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)((_f = (_e = response.data) === null || _e === void 0 ? void 0 : _e.operations) !== null && _f !== void 0 ? _f : []));
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: (_h = (_g = response.data) === null || _g === void 0 ? void 0 : _g.total_operations_processing.toString()) !== null && _h !== void 0 ? _h : '',
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, _g, _h;
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: (_b = (_a = response.data) === null || _a === void 0 ? void 0 : _a.total_operations_processing) !== null && _b !== void 0 ? _b : 0,
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: (_h = (_g = response.data) === null || _g === void 0 ? void 0 : _g.total_operations_processing.toString()) !== null && _h !== void 0 ? _h : '',
36
+ variableValue: processingBillsCount.toString(),
37
+ },
38
+ {
39
+ variableName: '_bill_',
40
+ variableValue: processingBillsCount > 1 ? 'bills' : 'bill',
36
41
  },
37
42
  {
38
43
  variableName: '_action_',
@@ -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: (_b = (_a = response.data) === null || _a === void 0 ? void 0 : _a.total_operations_processing) !== null && _b !== void 0 ? _b : 0,
26
- refreshTime: (_d = (_c = response.data) === null || _c === void 0 ? void 0 : _c.hard_refresh_after_sec) !== null && _d !== void 0 ? _d : 0,
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)((_f = (_e = response.data) === null || _e === void 0 ? void 0 : _e.operations) !== null && _f !== void 0 ? _f : []));
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: (_h = (_g = response.data) === null || _g === void 0 ? void 0 : _g.total_operations_processing.toString()) !== null && _h !== void 0 ? _h : '',
37
+ variableValue: processingBillsCount.toString(),
38
+ },
39
+ {
40
+ variableName: '_bill_',
41
+ variableValue: processingBillsCount > 1 ? 'bills' : 'bill',
37
42
  },
38
43
  {
39
44
  variableName: '_action_',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.11.18",
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",