@zeniai/client-epic-state 4.11.16 → 4.11.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/lib/entity/billPay/billTransaction/billTransactionPayload.d.ts +9 -0
  2. package/lib/entity/billPay/billTransaction/billTransactionPayload.js +15 -2
  3. package/lib/entity/billPay/billTransaction/billTransactionReducer.d.ts +2 -1
  4. package/lib/entity/billPay/billTransaction/billTransactionReducer.js +25 -2
  5. package/lib/entity/billPay/billTransaction/billTransactionState.d.ts +11 -1
  6. package/lib/entity/billPay/billTransaction/billTransactionState.js +9 -1
  7. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  8. package/lib/entity/snackbar/snackbarTypes.js +6 -0
  9. package/lib/entity/task/taskPayload.d.ts +2 -2
  10. package/lib/entity/task/taskPayload.js +1 -0
  11. package/lib/entity/task/taskState.d.ts +3 -2
  12. package/lib/entity/taskGroup/taskGroupPayload.d.ts +9 -0
  13. package/lib/entity/taskGroup/taskGroupPayload.js +14 -0
  14. package/lib/entity/taskGroup/taskGroupReducer.d.ts +6 -0
  15. package/lib/entity/taskGroup/taskGroupReducer.js +33 -0
  16. package/lib/entity/taskGroup/taskGroupSelector.d.ts +4 -0
  17. package/lib/entity/taskGroup/taskGroupSelector.js +18 -0
  18. package/lib/entity/taskGroup/taskGroupState.d.ts +12 -0
  19. package/lib/entity/taskGroup/taskGroupState.js +2 -0
  20. package/lib/entity/tenant/clearAllEpic.d.ts +5 -2
  21. package/lib/entity/tenant/clearAllEpic.js +8 -0
  22. package/lib/entity/toastNotification/epic/pushToastNotificationEpic.d.ts +1 -1
  23. package/lib/entity/transaction/stateTypes/attachment.d.ts +6 -0
  24. package/lib/entity/transaction/stateTypes/transactionType.d.ts +3 -0
  25. package/lib/entity/transaction/stateTypes/transactionType.js +7 -3
  26. package/lib/entity/vendor/vendorPayload.d.ts +2 -0
  27. package/lib/entity/vendor/vendorPayload.js +5 -1
  28. package/lib/entity/vendor/vendorState.d.ts +2 -0
  29. package/lib/epic.d.ts +12 -1
  30. package/lib/epic.js +12 -1
  31. package/lib/index.d.ts +18 -12
  32. package/lib/index.js +37 -10
  33. package/lib/reducer.d.ts +9 -0
  34. package/lib/reducer.js +9 -0
  35. package/lib/view/companyView/selector/companyManagementViewSelector.js +13 -7
  36. package/lib/view/companyView/selector/companyPortfolioViewSelector.js +1 -6
  37. package/lib/view/fileView/fileUploadHelpers.d.ts +5 -0
  38. package/lib/view/people/changeZeniPersonRolesEpic.d.ts +1 -1
  39. package/lib/view/people/deletePersonEpic.d.ts +1 -1
  40. package/lib/view/people/invitePeopleEpic.d.ts +1 -1
  41. package/lib/view/people/inviteZeniPeopleEpic.d.ts +1 -1
  42. package/lib/view/people/resendInviteEpic.d.ts +1 -1
  43. package/lib/view/reviewCompanyView/reviewCompanyViewSelector.js +26 -9
  44. package/lib/view/scheduleView/scheduleListView/scheduleListSelector.js +1 -1
  45. package/lib/view/settingsView/epic/saveNotificationSettingsEpic.d.ts +1 -1
  46. package/lib/view/spendManagement/billPay/billList/billListReducer.d.ts +3 -2
  47. package/lib/view/spendManagement/billPay/billList/billListReducer.js +9 -3
  48. package/lib/view/spendManagement/billPay/billList/billListSelector.d.ts +19 -2
  49. package/lib/view/spendManagement/billPay/billList/billListSelector.js +150 -3
  50. package/lib/view/spendManagement/billPay/billList/billListState.d.ts +1 -1
  51. package/lib/view/spendManagement/billPay/billPayConfig/billPayConfigPayload.d.ts +1 -0
  52. package/lib/view/spendManagement/billPay/billPayConfig/billPayConfigReducer.js +2 -0
  53. package/lib/view/spendManagement/billPay/billPayConfig/billPayConfigState.d.ts +1 -0
  54. package/lib/view/spendManagement/billPay/billsBulkActionView/billsBulkActionViewPayload.d.ts +32 -0
  55. package/lib/view/spendManagement/billPay/billsBulkActionView/billsBulkActionViewPayload.js +2 -0
  56. package/lib/view/spendManagement/billPay/billsBulkActionView/billsBulkActionViewReducer.d.ts +17 -0
  57. package/lib/view/spendManagement/billPay/billsBulkActionView/billsBulkActionViewReducer.js +166 -0
  58. package/lib/view/spendManagement/billPay/billsBulkActionView/billsBulkActionViewSelector.d.ts +24 -0
  59. package/lib/view/spendManagement/billPay/billsBulkActionView/billsBulkActionViewSelector.js +45 -0
  60. package/lib/view/spendManagement/billPay/billsBulkActionView/billsBulkActionViewState.d.ts +28 -0
  61. package/lib/view/spendManagement/billPay/billsBulkActionView/billsBulkActionViewState.js +7 -0
  62. package/lib/view/spendManagement/billPay/billsBulkActionView/epics/approveOrRejectBillsBulkActionEpic.d.ts +9 -0
  63. package/lib/view/spendManagement/billPay/billsBulkActionView/epics/approveOrRejectBillsBulkActionEpic.js +73 -0
  64. package/lib/view/spendManagement/billPay/billsBulkActionView/epics/cancelOrDeleteBillsBulkActionEpic.d.ts +8 -0
  65. package/lib/view/spendManagement/billPay/billsBulkActionView/epics/cancelOrDeleteBillsBulkActionEpic.js +74 -0
  66. package/lib/view/spendManagement/billPay/billsBulkActionView/epics/reviewDraftBillsBulkActionEpic.ts.d.ts +7 -0
  67. package/lib/view/spendManagement/billPay/billsBulkActionView/epics/reviewDraftBillsBulkActionEpic.ts.js +29 -0
  68. package/lib/view/spendManagement/billPay/billsBulkActionView/epics/submitDraftBillsBulkActionEpic.d.ts +8 -0
  69. package/lib/view/spendManagement/billPay/billsBulkActionView/epics/submitDraftBillsBulkActionEpic.js +62 -0
  70. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.d.ts +9 -8
  71. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +6 -4
  72. package/lib/view/spendManagement/commonHistoryView/commonHistory.d.ts +1 -1
  73. package/lib/view/spendManagement/helpers.d.ts +3 -0
  74. package/lib/view/spendManagement/helpers.js +17 -1
  75. package/lib/view/spendManagement/reimbursement/remiListView/remiListReducer.d.ts +1 -1
  76. package/lib/view/spendManagement/reimbursement/remiListView/remiListState.d.ts +3 -3
  77. package/lib/view/subscriptionView/subscriptionViewSelector.js +5 -1
  78. package/lib/view/tagView/epics/createTagEpic.d.ts +1 -1
  79. package/lib/view/tagView/epics/deleteTagEpic.d.ts +1 -1
  80. package/lib/view/taskManager/taskDetailView/epics/saveTaskDetailEpic.d.ts +2 -1
  81. package/lib/view/taskManager/taskDetailView/epics/saveTaskDetailEpic.js +11 -4
  82. package/lib/view/taskManager/taskDetailView/taskDetailReducer.d.ts +2 -1
  83. package/lib/view/taskManager/taskDetailView/taskDetailReducer.js +2 -1
  84. package/lib/view/taskManager/taskGroupView/epics/createNewTaskGroupEpic.d.ts +10 -0
  85. package/lib/view/taskManager/taskGroupView/epics/createNewTaskGroupEpic.js +57 -0
  86. package/lib/view/taskManager/taskGroupView/epics/deleteTaskGroupEpic.d.ts +10 -0
  87. package/lib/view/taskManager/taskGroupView/epics/deleteTaskGroupEpic.js +41 -0
  88. package/lib/view/taskManager/taskGroupView/epics/fetchAllTaskGroupsEpic.d.ts +8 -0
  89. package/lib/view/taskManager/taskGroupView/epics/fetchAllTaskGroupsEpic.js +33 -0
  90. package/lib/view/taskManager/taskGroupView/epics/updateTaskGroupNameEpic.d.ts +10 -0
  91. package/lib/view/taskManager/taskGroupView/epics/updateTaskGroupNameEpic.js +51 -0
  92. package/lib/view/taskManager/taskGroupView/taskGroupViewPayload.d.ts +6 -0
  93. package/lib/view/taskManager/taskGroupView/taskGroupViewPayload.js +2 -0
  94. package/lib/view/taskManager/taskGroupView/taskGroupViewReducer.d.ts +34 -0
  95. package/lib/view/taskManager/taskGroupView/taskGroupViewReducer.js +123 -0
  96. package/lib/view/taskManager/taskGroupView/taskGroupViewState.d.ts +7 -0
  97. package/lib/view/taskManager/taskGroupView/taskGroupViewState.js +2 -0
  98. package/lib/view/taskManager/taskListView/bulkUpdateTaskListEpic.d.ts +8 -0
  99. package/lib/view/taskManager/taskListView/bulkUpdateTaskListEpic.js +88 -0
  100. package/lib/view/taskManager/taskListView/dragNDropTasksEpic.d.ts +6 -0
  101. package/lib/view/taskManager/taskListView/dragNDropTasksEpic.js +20 -0
  102. package/lib/view/taskManager/taskListView/fetchTaskListPageEpic.d.ts +3 -1
  103. package/lib/view/taskManager/taskListView/fetchTaskListPageEpic.js +12 -0
  104. package/lib/view/taskManager/taskListView/taskList.d.ts +14 -1
  105. package/lib/view/taskManager/taskListView/taskListReducer.d.ts +31 -2
  106. package/lib/view/taskManager/taskListView/taskListReducer.js +136 -9
  107. package/lib/view/taskManager/taskListView/taskListSelector.d.ts +12 -2
  108. package/lib/view/taskManager/taskListView/taskListSelector.js +59 -23
  109. package/lib/view/transactionDetail/epics/updateTransactionDetailEpic.js +22 -5
  110. package/lib/view/vendorReviewView/vendorFirstReviewView/epics/fetchVendorFirstReviewAttachmentsEpic.d.ts +10 -0
  111. package/lib/view/vendorReviewView/vendorFirstReviewView/epics/fetchVendorFirstReviewAttachmentsEpic.js +37 -0
  112. package/lib/view/vendorReviewView/vendorFirstReviewView/epics/fetchVendorFirstReviewViewEpic.js +1 -0
  113. package/lib/view/vendorReviewView/vendorFirstReviewView/epics/saveVendorFirstReviewViewEpic.js +11 -5
  114. package/lib/view/vendorReviewView/vendorFirstReviewView/vendorFirstReviewViewPayload.d.ts +15 -0
  115. package/lib/view/vendorReviewView/vendorFirstReviewView/vendorFirstReviewViewReducer.d.ts +13 -3
  116. package/lib/view/vendorReviewView/vendorFirstReviewView/vendorFirstReviewViewReducer.js +45 -3
  117. package/lib/view/vendorReviewView/vendorFirstReviewView/vendorFirstReviewViewSelector.d.ts +8 -0
  118. package/lib/view/vendorReviewView/vendorFirstReviewView/vendorFirstReviewViewSelector.js +17 -2
  119. package/lib/view/vendorReviewView/vendorFirstReviewView/vendorFirstReviewViewState.d.ts +6 -2
  120. package/lib/view/vendorReviewView/vendorFirstReviewView/vendorFirstReviewViewState.js +2 -1
  121. package/package.json +1 -1
@@ -3,9 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getBillListOnSort = exports.getApproversOrRejectors = exports.getBillList = void 0;
6
+ exports.getAllowedBulkActions = exports.checkIfBulkActionAllowed = exports.getBillListOnSort = exports.getApproversOrRejectors = exports.getBillList = void 0;
7
7
  const get_1 = __importDefault(require("lodash/get"));
8
8
  const orderBy_1 = __importDefault(require("lodash/orderBy"));
9
+ const difference_1 = __importDefault(require("lodash/difference"));
9
10
  const zeniDayJS_1 = require("../../../../zeniDayJS");
10
11
  const billListState_1 = require("./billListState");
11
12
  const userSelector_1 = require("../../../../entity/user/userSelector");
@@ -13,9 +14,10 @@ const billPayConfigState_1 = require("../billPayConfig/billPayConfigState");
13
14
  const billPayConfigSelector_1 = require("../billPayConfig/billPayConfigSelector");
14
15
  const approvalRuleState_1 = require("../../../../entity/approvalRule/approvalRuleState");
15
16
  const spendManagementFilterHelpers_1 = require("../../spendManagementFilterHelpers");
16
- const getBillList = (state, currentTimePeriod) => {
17
+ const helpers_1 = require("../../helpers");
18
+ const getBillList = (state, currentTimePeriod, isBulkActionFeatureEnabled) => {
17
19
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
18
- const { billListState, billTransactionState, billPayConfigState, entityApprovalStatusState, userState, recurringBillState, } = state;
20
+ const { billListState, billTransactionState, billPayConfigState, entityApprovalStatusState, userState, recurringBillState, billsBulkActionViewState, } = state;
19
21
  const key = (0, billListState_1.getBillListKey)(currentTimePeriod, billListState.currentTab);
20
22
  const pendingApprovalKey = (0, billListState_1.getBillListKey)(currentTimePeriod, 'pending_approval');
21
23
  const billPayBotEmail = (0, billPayConfigSelector_1.getBillPayConfigBotEmail)(billPayConfigState);
@@ -98,7 +100,22 @@ const getBillList = (state, currentTimePeriod) => {
98
100
  }
99
101
  break;
100
102
  }
103
+ const bulkSubmissionFetchState = billsBulkActionViewState.bulkSubmissionFetchState.fetchState;
104
+ let isRecurringBillInBulkActionList = false;
105
+ let isBookClosedForAnySelectedBill = false;
106
+ let billListBulkActionInfo = {
107
+ isBulkActionAllowed: false,
108
+ billsSelectedForBulkAction: [],
109
+ allowedBulkActions: [],
110
+ bulkSubmissionFetchState,
111
+ isRecurringBillInBulkActionList,
112
+ };
113
+ let firstBillInBulkList = undefined;
114
+ const isBulkActionAllowed = isBulkActionFeatureEnabled
115
+ ? (0, exports.checkIfBulkActionAllowed)(billListState.currentTab, billListState.currentSubTab)
116
+ : false;
101
117
  let transactionsView = transactions.map((transaction) => {
118
+ var _a, _b;
102
119
  let approvers = {
103
120
  users: [],
104
121
  attributes: [],
@@ -112,10 +129,54 @@ const getBillList = (state, currentTimePeriod) => {
112
129
  recurringBillDetail = (0, get_1.default)(recurringBillState.recurringBillDetailByConfigId, transaction.recurringBillConfigId, undefined);
113
130
  }
114
131
  const recurringBillConfig = recurringBillDetail === null || recurringBillDetail === void 0 ? void 0 : recurringBillDetail.recurringBillConfig;
132
+ let billBulkSelectInfo;
133
+ if (isBulkActionAllowed) {
134
+ const isProcessing = (0, helpers_1.isBillProcessing)((_a = transaction.bulkProcessingDetail) === null || _a === void 0 ? void 0 : _a.type);
135
+ const isError = ((_b = transaction.bulkProcessingDetail) === null || _b === void 0 ? void 0 : _b.type) === 'error';
136
+ const isBookClosedForBill = transaction.bookCloseDate != null &&
137
+ transaction.date.isBefore(transaction.bookCloseDate);
138
+ const { isSelectableForBulkAction, bulkSelectExceptionInfo } = isProcessing || isError
139
+ ? {
140
+ isSelectableForBulkAction: false,
141
+ bulkSelectExceptionInfo: undefined,
142
+ }
143
+ : isBillSelectableForBulkAction(transaction, billListState.currentTab, isBookClosedForBill, firstBillInBulkList);
144
+ if (isBulkActionAllowed &&
145
+ billsBulkActionViewState.billsSelectedForBulkAction.includes(transaction.id)) {
146
+ if (isRecurring) {
147
+ isRecurringBillInBulkActionList = true;
148
+ }
149
+ if (isBookClosedForBill) {
150
+ isBookClosedForAnySelectedBill = true;
151
+ }
152
+ }
153
+ billBulkSelectInfo = {
154
+ isSelectableForBulkAction,
155
+ bulkSelectExceptionInfo,
156
+ };
157
+ }
115
158
  return Object.assign(Object.assign({}, transaction), { approvers,
116
159
  isRecurring,
160
+ billBulkSelectInfo,
117
161
  recurringBillConfig });
118
162
  });
163
+ if (isBulkActionAllowed) {
164
+ const billsSelectedForBulkAction = billsBulkActionViewState.billsSelectedForBulkAction;
165
+ firstBillInBulkList = (0, get_1.default)(billTransactionState.transactionById, billsSelectedForBulkAction[0], undefined);
166
+ const allBulkBillsAwaitingMyApproval = (0, difference_1.default)(billsSelectedForBulkAction, pendingApprovalTransactionIDs)
167
+ .length === 0;
168
+ const allowedBulkActions = isBulkActionAllowed
169
+ ? (0, exports.getAllowedBulkActions)(billListState.currentTab, billListState.currentSubTab, allBulkBillsAwaitingMyApproval, (firstBillInBulkList === null || firstBillInBulkList === void 0 ? void 0 : firstBillInBulkList.billPayInfo.billPaymentStatus.code) ===
170
+ 'processing', isBookClosedForAnySelectedBill)
171
+ : [];
172
+ billListBulkActionInfo = {
173
+ isBulkActionAllowed,
174
+ billsSelectedForBulkAction,
175
+ allowedBulkActions,
176
+ bulkSubmissionFetchState,
177
+ isRecurringBillInBulkActionList,
178
+ };
179
+ }
119
180
  transactionsView = (0, spendManagementFilterHelpers_1.applyAdvancedFiltersOnList)('bill_pay', transactionsView, billListState.filters);
120
181
  const TransactionsPendingForMyApprovalLength = pendingApprovalTransactionIDs.length;
121
182
  const fetchState = (_f = (_e = billListState.byBillListKey[key]) === null || _e === void 0 ? void 0 : _e.fetchState) !== null && _f !== void 0 ? _f : 'Not-Started';
@@ -139,6 +200,7 @@ const getBillList = (state, currentTimePeriod) => {
139
200
  true);
140
201
  }));
141
202
  const isDownloadEnabled = (0, spendManagementFilterHelpers_1.isBillListDownloadable)(state, currentTimePeriod);
203
+ const billBulkSubmissionLimit = billPayConfigState.billBulkSubmissionLimit;
142
204
  return {
143
205
  reportTitle: 'Bills',
144
206
  version: 0,
@@ -158,6 +220,8 @@ const getBillList = (state, currentTimePeriod) => {
158
220
  filters: billListState.filters,
159
221
  billPayBotEmail,
160
222
  isDownloadEnabled,
223
+ billBulkSubmissionLimit,
224
+ billListBulkActionInfo,
161
225
  };
162
226
  };
163
227
  exports.getBillList = getBillList;
@@ -439,3 +503,86 @@ const getBillListOnSort = (sortKey, sortOrder, currentTab, transactions) => {
439
503
  ];
440
504
  };
441
505
  exports.getBillListOnSort = getBillListOnSort;
506
+ const checkIfBulkActionAllowed = (selectedTab, selectedSubTab) => {
507
+ if (selectedTab === 'paid' || selectedSubTab === 'deleted') {
508
+ return false;
509
+ }
510
+ return true;
511
+ };
512
+ exports.checkIfBulkActionAllowed = checkIfBulkActionAllowed;
513
+ const isBillSelectableForBulkAction = (bill, selectedTab, isBookClosedForBill, firstBillSelected) => {
514
+ const result = {
515
+ isSelectableForBulkAction: true,
516
+ bulkSelectExceptionInfo: undefined,
517
+ };
518
+ if (isBookClosedForBill && selectedTab !== 'draft') {
519
+ return {
520
+ isSelectableForBulkAction: false,
521
+ bulkSelectExceptionInfo: 'bookCloseDateProcessing',
522
+ };
523
+ }
524
+ if (selectedTab === 'scheduled') {
525
+ if ((firstBillSelected === null || firstBillSelected === void 0 ? void 0 : firstBillSelected.billPayInfo.billPaymentStatus.code) === 'processing') {
526
+ if (bill.isRecurring) {
527
+ return {
528
+ isSelectableForBulkAction: false,
529
+ bulkSelectExceptionInfo: 'cancelRecurring',
530
+ };
531
+ }
532
+ if (bill.billPayInfo.billPaymentStatus.code !== 'processing') {
533
+ return {
534
+ isSelectableForBulkAction: false,
535
+ bulkSelectExceptionInfo: 'processingSelectTogether',
536
+ };
537
+ }
538
+ }
539
+ if (firstBillSelected != null &&
540
+ bill.billPayInfo.billPaymentStatus.code === 'processing') {
541
+ if (firstBillSelected.billPayInfo.billPaymentStatus.code !== 'processing') {
542
+ return {
543
+ isSelectableForBulkAction: false,
544
+ bulkSelectExceptionInfo: 'processingWithOthers',
545
+ };
546
+ }
547
+ }
548
+ }
549
+ return result;
550
+ };
551
+ const getAllowedBulkActions = (selectedTab, selectedSubTab, isAllAwaitingMyApproval, isFirstBillProcessing, isBookClosedForAnySelectedBill) => {
552
+ switch (selectedTab) {
553
+ case 'draft':
554
+ return isBookClosedForAnySelectedBill
555
+ ? ['delete']
556
+ : ['send_for_approval', 'delete'];
557
+ case 'pending_approval': {
558
+ switch (selectedSubTab) {
559
+ case 'all':
560
+ case 'awaiting_approval':
561
+ case 'overdue':
562
+ return isAllAwaitingMyApproval
563
+ ? ['approve', 'reject', 'delete']
564
+ : ['delete'];
565
+ case 'awaiting_my_approval':
566
+ return ['approve', 'reject', 'delete'];
567
+ case 'rejected':
568
+ return ['delete'];
569
+ default:
570
+ return [];
571
+ }
572
+ }
573
+ case 'scheduled': {
574
+ switch (selectedSubTab) {
575
+ case 'all':
576
+ return isFirstBillProcessing ? ['cancel'] : ['delete'];
577
+ case 'failed':
578
+ case 'cancelled':
579
+ return ['delete'];
580
+ default:
581
+ return [];
582
+ }
583
+ }
584
+ default:
585
+ return [];
586
+ }
587
+ };
588
+ exports.getAllowedBulkActions = getAllowedBulkActions;
@@ -35,7 +35,7 @@ export declare type SaveBillStageCode = 'draft' | 'pending_approval' | undefined
35
35
  export declare const ALL_BILL_TABS: readonly ["paid", "pending_approval", "scheduled", "draft"];
36
36
  export declare const toBillTabType: (v: string) => "paid" | "pending_approval" | "scheduled" | "draft";
37
37
  export declare type BillTab = ReturnType<typeof toBillTabType>;
38
- export declare const toBillsSubTabType: (v: string) => "all" | "failed" | "rejected" | "ach" | "wire" | "cancelled" | "overdue" | "awaiting_approval" | "awaiting_my_approval" | "deleted";
38
+ export declare const toBillsSubTabType: (v: string) => "all" | "failed" | "rejected" | "ach" | "wire" | "cancelled" | "deleted" | "overdue" | "awaiting_approval" | "awaiting_my_approval";
39
39
  export declare type BillsSubTabType = ReturnType<typeof toBillsSubTabType>;
40
40
  export declare const ALL_BILL_PAY_SORT_KEYS: readonly ["dueDate", "status", "amount", "invoiceDate", "name", "paymentMethod"];
41
41
  export declare const toBillPaySortKeyType: (v: string) => "name" | "status" | "amount" | "dueDate" | "invoiceDate" | "paymentMethod";
@@ -11,6 +11,7 @@ export interface BillPayConfigPayload {
11
11
  is_international_wire_enabled: boolean;
12
12
  is_international_wires_verified: boolean;
13
13
  payment_processor: BillPayConfigPaymentProcessorPayload;
14
+ bill_bulk_operation_max_count: number;
14
15
  required_fields: {
15
16
  ach: Record<PaymentAchSubConfigCodeType, string[]>;
16
17
  wire: Record<BillPaymentWireSubConfigCodeType, string[]>;
@@ -19,6 +19,7 @@ exports.initialState = {
19
19
  hasValidState() {
20
20
  return this.fetchState == 'Completed';
21
21
  },
22
+ billBulkSubmissionLimit: 10,
22
23
  };
23
24
  const billPayConfig = (0, toolkit_1.createSlice)({
24
25
  name: 'billPayConfig',
@@ -77,6 +78,7 @@ const billPayConfig = (0, toolkit_1.createSlice)({
77
78
  draft.fetchState = 'Completed';
78
79
  draft.error = undefined;
79
80
  draft.billPayBotEmail = payload.bill_pay_bot_email;
81
+ draft.billBulkSubmissionLimit = payload.bill_bulk_operation_max_count;
80
82
  draft.vendor.supportedCountries = vendor.supported_countries.map((country) => {
81
83
  return {
82
84
  countryCode: country.country_code,
@@ -18,6 +18,7 @@ export interface BillPayConfigState extends FetchedState {
18
18
  currencyListByCountryId: Record<ID, VendorCurrency[]>;
19
19
  };
20
20
  billPayBotEmail: string;
21
+ billBulkSubmissionLimit: number;
21
22
  }
22
23
  export interface VendorCurrency extends Currency {
23
24
  currencyName: string;
@@ -0,0 +1,32 @@
1
+ import { ZeniAPIResponse } from '../../../../responsePayload';
2
+ export interface BulkActionItemResponseBasePayload {
3
+ entity_id: string;
4
+ status: string;
5
+ error: {
6
+ error_code: string;
7
+ error_message: string;
8
+ } | null;
9
+ }
10
+ export interface BulkActionItemResponsePayload extends BulkActionItemResponseBasePayload {
11
+ processing_message: string | null;
12
+ }
13
+ export interface BulkActionResponsePayload {
14
+ total_operations_requested: number;
15
+ total_operations_processing: number;
16
+ bulk_operation_id: string;
17
+ operation_type: string;
18
+ hard_refresh_after_sec: number;
19
+ operations: BulkActionItemResponsePayload[];
20
+ }
21
+ export declare type BillsBulkActionResponse = ZeniAPIResponse<BulkActionResponsePayload>;
22
+ export interface BulkActionReviewItemResponsePayload extends BulkActionItemResponseBasePayload {
23
+ error: {
24
+ error_code: string;
25
+ error_message: string;
26
+ duplicate_entity_ids?: string[];
27
+ } | null;
28
+ }
29
+ export interface BillsReviewBulkActionResponsePayload {
30
+ validation_results: BulkActionReviewItemResponsePayload[];
31
+ }
32
+ export declare type BillsReviewBulkActionResponse = ZeniAPIResponse<BillsReviewBulkActionResponsePayload>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,17 @@
1
+ import { BillsBulkActionViewState } from './billsBulkActionViewState';
2
+ import { ZeniAPIStatus } from '../../../../responsePayload';
3
+ import { BillApprovalType } from '../billDetailView/billDetailViewState';
4
+ import { BulkActionReviewItemResponsePayload } from './billsBulkActionViewPayload';
5
+ export declare const initialState: BillsBulkActionViewState;
6
+ export declare const updateBillsBulkActionList: import("@reduxjs/toolkit").ActionCreatorWithPayload<string[], string>, removeBillFromBulkActionList: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, string>, clearAllBillsFromBulkActionList: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, reviewDraftBillsBulkAction: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, reviewDraftBillsBulkActionSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<BulkActionReviewItemResponsePayload[], string>, reviewDraftBillsBulkActionFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, string>, submitDraftBillsBulkAction: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, approveOrRejectBillsBulkAction: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[approvalType: BillApprovalType, description: string], {
7
+ approvalType: BillApprovalType;
8
+ description: string;
9
+ }, string, never, never>, cancelOrDeleteBillsBulkAction: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[operationType: "cancel" | "delete", description: string], {
10
+ operationType: "cancel" | "delete";
11
+ description: string;
12
+ }, string, never, never>, billsBulkActionFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, string>, autoReviewPendingApprovalBills: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, incrementBulkActionProcessedCount: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, billsBulkActionSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
13
+ billsProcessing: number;
14
+ refreshTime: number;
15
+ }, string>, clearBillPayBulkActionView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
16
+ declare const _default: import("@reduxjs/toolkit").Reducer<BillsBulkActionViewState, import("@reduxjs/toolkit").AnyAction>;
17
+ export default _default;
@@ -0,0 +1,166 @@
1
+ "use strict";
2
+ var _a;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.clearBillPayBulkActionView = exports.billsBulkActionSuccess = exports.incrementBulkActionProcessedCount = exports.autoReviewPendingApprovalBills = exports.billsBulkActionFailure = exports.cancelOrDeleteBillsBulkAction = exports.approveOrRejectBillsBulkAction = exports.submitDraftBillsBulkAction = exports.reviewDraftBillsBulkActionFailure = exports.reviewDraftBillsBulkActionSuccess = exports.reviewDraftBillsBulkAction = exports.clearAllBillsFromBulkActionList = exports.removeBillFromBulkActionList = exports.updateBillsBulkActionList = exports.initialState = void 0;
5
+ const toolkit_1 = require("@reduxjs/toolkit");
6
+ const billsBulkActionViewState_1 = require("./billsBulkActionViewState");
7
+ exports.initialState = {
8
+ billsSelectedForBulkAction: [],
9
+ bulkReviewStateById: {},
10
+ bulkReviewFetchState: {
11
+ fetchState: 'Not-Started',
12
+ error: undefined,
13
+ },
14
+ bulkSubmissionFetchState: {
15
+ fetchState: 'Not-Started',
16
+ error: undefined,
17
+ },
18
+ bulkOperationTypeSelected: 'delete',
19
+ bulkOperationProgress: {
20
+ billsProcessed: 0,
21
+ billsProcessing: 0,
22
+ refreshTimeInSeconds: 0,
23
+ },
24
+ };
25
+ const billsBulkActionView = (0, toolkit_1.createSlice)({
26
+ name: 'billsBulkActionView',
27
+ initialState: exports.initialState,
28
+ reducers: {
29
+ updateBillsBulkActionList(draft, action) {
30
+ draft.billsSelectedForBulkAction = action.payload;
31
+ },
32
+ removeBillFromBulkActionList(draft, action) {
33
+ var _a, _b, _c;
34
+ draft.billsSelectedForBulkAction =
35
+ draft.billsSelectedForBulkAction.filter((billId) => billId !== action.payload);
36
+ //remove warning if duplicates within batch
37
+ if (draft.bulkOperationTypeSelected === 'send_for_approval' &&
38
+ draft.bulkReviewFetchState.fetchState === 'Completed') {
39
+ const duplicateIds = (_c = (_b = (_a = draft.bulkReviewStateById[action.payload]) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.duplicateTransactionIds) !== null && _c !== void 0 ? _c : [];
40
+ duplicateIds.forEach((id) => {
41
+ var _a, _b, _c, _d;
42
+ if (id in draft.bulkReviewStateById) {
43
+ if (((_b = (_a = draft.bulkReviewStateById[id].error) === null || _a === void 0 ? void 0 : _a.duplicateTransactionIds) === null || _b === void 0 ? void 0 : _b.length) === 1 &&
44
+ ((_d = (_c = draft.bulkReviewStateById[id].error) === null || _c === void 0 ? void 0 : _c.duplicateTransactionIds) === null || _d === void 0 ? void 0 : _d[0]) === action.payload) {
45
+ draft.bulkReviewStateById[id].status = 'valid';
46
+ draft.bulkReviewStateById[id].error = undefined;
47
+ }
48
+ }
49
+ });
50
+ }
51
+ },
52
+ clearAllBillsFromBulkActionList(draft) {
53
+ draft.billsSelectedForBulkAction = [];
54
+ },
55
+ reviewDraftBillsBulkAction(draft) {
56
+ draft.bulkReviewFetchState = {
57
+ fetchState: 'In-Progress',
58
+ error: undefined,
59
+ };
60
+ draft.bulkSubmissionFetchState = {
61
+ fetchState: 'Not-Started',
62
+ error: undefined,
63
+ };
64
+ draft.bulkOperationTypeSelected = 'send_for_approval';
65
+ },
66
+ reviewDraftBillsBulkActionSuccess(draft, action) {
67
+ draft.bulkReviewFetchState = {
68
+ fetchState: 'Completed',
69
+ error: undefined,
70
+ };
71
+ action.payload.forEach((result) => {
72
+ var _a;
73
+ const transactionId = result.entity_id;
74
+ const status = (0, billsBulkActionViewState_1.toBulkReviewStatusCode)(result.status);
75
+ draft.bulkReviewStateById[transactionId] = {
76
+ transactionId,
77
+ status,
78
+ error: status !== 'valid' && result.error != null
79
+ ? {
80
+ code: result.error.error_code,
81
+ message: result.error.error_message,
82
+ duplicateTransactionIds: (_a = result.error.duplicate_entity_ids) !== null && _a !== void 0 ? _a : [],
83
+ }
84
+ : undefined,
85
+ };
86
+ });
87
+ },
88
+ reviewDraftBillsBulkActionFailure(draft, action) {
89
+ draft.bulkReviewFetchState = {
90
+ fetchState: 'Error',
91
+ error: action.payload,
92
+ };
93
+ },
94
+ autoReviewPendingApprovalBills(draft) {
95
+ draft.bulkOperationTypeSelected = 'approve'; //or reject
96
+ draft.billsSelectedForBulkAction.forEach((id) => {
97
+ draft.bulkReviewStateById[id] = {
98
+ transactionId: id,
99
+ status: 'valid',
100
+ };
101
+ });
102
+ draft.bulkReviewFetchState = {
103
+ fetchState: 'Completed',
104
+ error: undefined,
105
+ };
106
+ draft.bulkSubmissionFetchState = {
107
+ fetchState: 'Not-Started',
108
+ error: undefined,
109
+ };
110
+ },
111
+ submitDraftBillsBulkAction(draft) {
112
+ draft.bulkOperationTypeSelected = 'send_for_approval';
113
+ draft.bulkSubmissionFetchState = {
114
+ fetchState: 'In-Progress',
115
+ error: undefined,
116
+ };
117
+ },
118
+ approveOrRejectBillsBulkAction: {
119
+ reducer(draft, action) {
120
+ draft.bulkOperationTypeSelected =
121
+ action.payload.approvalType === 'approved' ? 'approve' : 'reject';
122
+ draft.bulkSubmissionFetchState = {
123
+ fetchState: 'In-Progress',
124
+ error: undefined,
125
+ };
126
+ },
127
+ prepare(approvalType, description) {
128
+ return { payload: { approvalType, description } };
129
+ },
130
+ },
131
+ cancelOrDeleteBillsBulkAction: {
132
+ reducer(draft, action) {
133
+ draft.bulkOperationTypeSelected = action.payload.operationType;
134
+ draft.bulkSubmissionFetchState.fetchState = 'In-Progress';
135
+ },
136
+ prepare(operationType, description) {
137
+ return { payload: { operationType, description } };
138
+ },
139
+ },
140
+ billsBulkActionFailure(draft, action) {
141
+ draft.bulkSubmissionFetchState = {
142
+ fetchState: 'Error',
143
+ error: action.payload,
144
+ };
145
+ },
146
+ billsBulkActionSuccess(draft, action) {
147
+ Object.assign(draft, exports.initialState, {
148
+ bulkSubmissionFetchState: {
149
+ fetchState: 'Completed',
150
+ error: undefined,
151
+ },
152
+ }, {
153
+ bulkOperationProgress: Object.assign(Object.assign({}, draft.bulkOperationProgress), { billsProcessing: action.payload.billsProcessing, refreshTimeInSeconds: action.payload.refreshTime }),
154
+ });
155
+ },
156
+ incrementBulkActionProcessedCount(draft) {
157
+ draft.bulkOperationProgress.billsProcessed =
158
+ draft.bulkOperationProgress.billsProcessed + 1;
159
+ },
160
+ clearBillPayBulkActionView(draft) {
161
+ Object.assign(draft, exports.initialState);
162
+ },
163
+ },
164
+ });
165
+ _a = billsBulkActionView.actions, exports.updateBillsBulkActionList = _a.updateBillsBulkActionList, exports.removeBillFromBulkActionList = _a.removeBillFromBulkActionList, exports.clearAllBillsFromBulkActionList = _a.clearAllBillsFromBulkActionList, exports.reviewDraftBillsBulkAction = _a.reviewDraftBillsBulkAction, exports.reviewDraftBillsBulkActionSuccess = _a.reviewDraftBillsBulkActionSuccess, exports.reviewDraftBillsBulkActionFailure = _a.reviewDraftBillsBulkActionFailure, exports.submitDraftBillsBulkAction = _a.submitDraftBillsBulkAction, exports.approveOrRejectBillsBulkAction = _a.approveOrRejectBillsBulkAction, exports.cancelOrDeleteBillsBulkAction = _a.cancelOrDeleteBillsBulkAction, exports.billsBulkActionFailure = _a.billsBulkActionFailure, exports.autoReviewPendingApprovalBills = _a.autoReviewPendingApprovalBills, exports.incrementBulkActionProcessedCount = _a.incrementBulkActionProcessedCount, exports.billsBulkActionSuccess = _a.billsBulkActionSuccess, exports.clearBillPayBulkActionView = _a.clearBillPayBulkActionView;
166
+ exports.default = billsBulkActionView.reducer;
@@ -0,0 +1,24 @@
1
+ import { RootState } from '../../../../reducer';
2
+ import { FetchState, ID } from '../../../../commonStateTypes/common';
3
+ import { SelectorView } from '../../../../commonStateTypes/viewAndReport/viewAndReport';
4
+ import { Amount } from '../../../../commonStateTypes/amount';
5
+ import { BulkOperationProgress, BulkOperationType, BulkReviewStatusCode } from './billsBulkActionViewState';
6
+ import { BillsSubTabType, BillTab } from '../billList/billListState';
7
+ export interface BillForReview {
8
+ transactionId: ID;
9
+ vendorName: string;
10
+ invoiceNumber: string;
11
+ isRecurring: boolean;
12
+ amount?: Amount;
13
+ reviewStatus?: BulkReviewStatusCode;
14
+ reviewInfoMessage?: string;
15
+ }
16
+ export interface BillsBulkReviewView extends SelectorView {
17
+ billsForReview: BillForReview[];
18
+ bulkSubmissionFetchState: FetchState;
19
+ bulkOperationTypeSelected: BulkOperationType;
20
+ currentTab: BillTab;
21
+ currentSubTab: BillsSubTabType;
22
+ }
23
+ export declare const getBillsBulkReviewView: (state: RootState) => BillsBulkReviewView;
24
+ export declare const getBillsBulkOperationProgress: (state: RootState) => BulkOperationProgress;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getBillsBulkOperationProgress = exports.getBillsBulkReviewView = void 0;
7
+ const get_1 = __importDefault(require("lodash/get"));
8
+ const getBillsBulkReviewView = (state) => {
9
+ const { billTransactionState, billsBulkActionViewState, billListState } = state;
10
+ const transactionIds = billsBulkActionViewState.billsSelectedForBulkAction;
11
+ const { currentTab, currentSubTab } = billListState;
12
+ let selectedTransactions = transactionIds.map((transactionId) => {
13
+ var _a, _b, _c, _d;
14
+ const transaction = (0, get_1.default)(billTransactionState.transactionById, transactionId, undefined);
15
+ return {
16
+ transactionId,
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 : '',
20
+ amount: transaction === null || transaction === void 0 ? void 0 : transaction.totalAmountInUSD,
21
+ };
22
+ });
23
+ const bulkReviewFetchState = billsBulkActionViewState.bulkReviewFetchState.fetchState;
24
+ const bulkSubmissionFetchState = billsBulkActionViewState.bulkSubmissionFetchState.fetchState;
25
+ if (bulkReviewFetchState === 'Completed') {
26
+ 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
+ });
30
+ }
31
+ return {
32
+ fetchState: bulkReviewFetchState,
33
+ billsForReview: selectedTransactions,
34
+ bulkSubmissionFetchState,
35
+ bulkOperationTypeSelected: billsBulkActionViewState.bulkOperationTypeSelected,
36
+ currentTab,
37
+ currentSubTab,
38
+ };
39
+ };
40
+ exports.getBillsBulkReviewView = getBillsBulkReviewView;
41
+ const getBillsBulkOperationProgress = (state) => {
42
+ const { billsBulkActionViewState } = state;
43
+ return billsBulkActionViewState.bulkOperationProgress;
44
+ };
45
+ exports.getBillsBulkOperationProgress = getBillsBulkOperationProgress;
@@ -0,0 +1,28 @@
1
+ import { FetchStateAndError, ID } from '../../../../commonStateTypes/common';
2
+ export interface BulkOperationProgress {
3
+ billsProcessed: number;
4
+ billsProcessing: number;
5
+ refreshTimeInSeconds: number;
6
+ }
7
+ export interface BillsBulkActionViewState {
8
+ billsSelectedForBulkAction: ID[];
9
+ bulkReviewStateById: Record<ID, BulkReviewState>;
10
+ bulkReviewFetchState: FetchStateAndError;
11
+ bulkSubmissionFetchState: FetchStateAndError;
12
+ bulkOperationTypeSelected: BulkOperationType;
13
+ bulkOperationProgress: BulkOperationProgress;
14
+ }
15
+ export interface BulkReviewState {
16
+ transactionId: ID;
17
+ status: BulkReviewStatusCode;
18
+ error?: {
19
+ code: string;
20
+ message: string;
21
+ duplicateTransactionIds: ID[];
22
+ };
23
+ }
24
+ export declare type BulkOperationType = 'approve' | 'reject' | 'send_for_approval' | 'delete' | 'cancel' | 'review';
25
+ export declare type BulkSelectExceptionInfoType = 'bookCloseDateDelete' | 'bookCloseDateProcessing' | 'processingSelectTogether' | 'processingWithOthers' | 'cancelProcessing' | 'cancelRecurring';
26
+ export declare const BULK_REVIEW_STATUS_CODES: readonly ["valid", "error", "warning"];
27
+ export declare const toBulkReviewStatusCode: (v: string) => "error" | "valid" | "warning";
28
+ export declare type BulkReviewStatusCode = ReturnType<typeof toBulkReviewStatusCode>;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toBulkReviewStatusCode = exports.BULK_REVIEW_STATUS_CODES = void 0;
4
+ const stringToUnion_1 = require("../../../../commonStateTypes/stringToUnion");
5
+ exports.BULK_REVIEW_STATUS_CODES = ['valid', 'error', 'warning'];
6
+ const toBulkReviewStatusCode = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.BULK_REVIEW_STATUS_CODES);
7
+ exports.toBulkReviewStatusCode = toBulkReviewStatusCode;
@@ -0,0 +1,9 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { ZeniAPI } from '../../../../../zeniAPI';
4
+ import { RootState } from '../../../../../reducer';
5
+ import { openSnackbar } from '../../../../../entity/snackbar/snackbarReducer';
6
+ import { approveOrRejectBillsBulkAction, billsBulkActionFailure, billsBulkActionSuccess } from '../billsBulkActionViewReducer';
7
+ import { updateBillTransactionsWithBulkActionStatus } from '../../../../../entity/billPay/billTransaction/billTransactionReducer';
8
+ export declare type ActionType = ReturnType<typeof approveOrRejectBillsBulkAction> | ReturnType<typeof updateBillTransactionsWithBulkActionStatus> | ReturnType<typeof openSnackbar> | ReturnType<typeof billsBulkActionFailure> | ReturnType<typeof billsBulkActionSuccess>;
9
+ export declare const approveOrRejectBillsBulkActionEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;