@zeniai/client-epic-state 4.12.80 → 4.12.82

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 (71) hide show
  1. package/lib/entity/billPay/billTransaction/billTransactionPayload.d.ts +8 -10
  2. package/lib/entity/billPay/billTransaction/billTransactionPayload.js +14 -16
  3. package/lib/entity/billPay/billTransaction/billTransactionReducer.js +1 -1
  4. package/lib/entity/billPay/billTransaction/billTransactionState.d.ts +12 -13
  5. package/lib/entity/billPay/billTransaction/billTransactionState.js +3 -3
  6. package/lib/entity/reimbursement/reimbursementPayload.d.ts +1 -3
  7. package/lib/entity/reimbursement/reimbursementPayload.js +0 -3
  8. package/lib/entity/reimbursement/reimbursementReducer.d.ts +1 -2
  9. package/lib/entity/reimbursement/reimbursementReducer.js +2 -25
  10. package/lib/entity/reimbursement/reimbursementState.d.ts +1 -2
  11. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  12. package/lib/entity/snackbar/snackbarTypes.js +0 -2
  13. package/lib/entity/tenant/clearAllEpic.d.ts +1 -2
  14. package/lib/entity/tenant/clearAllEpic.js +0 -2
  15. package/lib/entity/toastNotification/epic/pushToastNotificationEpic.d.ts +1 -1
  16. package/lib/epic.d.ts +1 -5
  17. package/lib/epic.js +1 -5
  18. package/lib/index.d.ts +7 -9
  19. package/lib/index.js +14 -30
  20. package/lib/reducer.d.ts +0 -3
  21. package/lib/reducer.js +0 -3
  22. package/lib/view/cardPayment/epic/addCardPaymentSourceEpic.d.ts +1 -1
  23. package/lib/view/cardPayment/epic/confirmCardSetupIntentEpic.d.ts +1 -1
  24. package/lib/view/cardPayment/epic/createCardSetupIntentEpic.d.ts +1 -1
  25. package/lib/view/cardPayment/epic/fetchPaymentSourcesEpic.d.ts +1 -1
  26. package/lib/view/people/changeZeniPersonRolesEpic.d.ts +1 -1
  27. package/lib/view/people/deletePersonEpic.d.ts +1 -1
  28. package/lib/view/people/invitePeopleEpic.d.ts +1 -1
  29. package/lib/view/people/inviteZeniPeopleEpic.d.ts +1 -1
  30. package/lib/view/people/resendInviteEpic.d.ts +1 -1
  31. package/lib/view/settingsView/epic/saveNotificationSettingsEpic.d.ts +1 -1
  32. package/lib/view/spendManagement/billPay/billList/billListSelector.d.ts +4 -4
  33. package/lib/view/spendManagement/billPay/billList/billListSelector.js +4 -4
  34. package/lib/view/spendManagement/billPay/billList/billListState.d.ts +0 -1
  35. package/lib/view/spendManagement/billPay/billsBulkActionView/billsBulkActionViewPayload.d.ts +2 -2
  36. package/lib/view/spendManagement/billPay/billsBulkActionView/billsBulkActionViewSelector.d.ts +1 -2
  37. package/lib/view/spendManagement/billPay/billsBulkActionView/billsBulkActionViewState.d.ts +2 -1
  38. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +1 -1
  39. package/lib/view/spendManagement/helpers.d.ts +1 -6
  40. package/lib/view/spendManagement/helpers.js +3 -24
  41. package/lib/view/spendManagement/reimbursement/editRemiView/editRemiViewSelector.d.ts +0 -1
  42. package/lib/view/spendManagement/reimbursement/editRemiView/editRemiViewSelector.js +10 -13
  43. package/lib/view/spendManagement/reimbursement/reimbursementConfig/reimbursementConfigPayload.d.ts +0 -1
  44. package/lib/view/spendManagement/reimbursement/reimbursementConfig/reimbursementConfigReducer.js +0 -3
  45. package/lib/view/spendManagement/reimbursement/reimbursementConfig/reimbursementConfigState.d.ts +0 -1
  46. package/lib/view/spendManagement/reimbursement/remiListView/remiListReducer.d.ts +1 -2
  47. package/lib/view/spendManagement/reimbursement/remiListView/remiListReducer.js +2 -4
  48. package/lib/view/spendManagement/reimbursement/remiListView/remiListSelector.d.ts +2 -18
  49. package/lib/view/spendManagement/reimbursement/remiListView/remiListSelector.js +3 -159
  50. package/lib/view/spendManagement/reimbursement/remiListView/remiListState.d.ts +0 -1
  51. package/lib/view/tagView/epics/createTagEpic.d.ts +1 -1
  52. package/lib/view/tagView/epics/deleteTagEpic.d.ts +1 -1
  53. package/lib/view/twoFactorAuthentication/resendOtpEpic.js +6 -5
  54. package/lib/view/twoFactorAuthentication/sendOtpEpic.js +6 -5
  55. package/package.json +1 -1
  56. package/lib/view/spendManagement/reimbursement/remisBulkActionView/epics/approveOrRejectRemisBulkActionEpic.d.ts +0 -9
  57. package/lib/view/spendManagement/reimbursement/remisBulkActionView/epics/approveOrRejectRemisBulkActionEpic.js +0 -80
  58. package/lib/view/spendManagement/reimbursement/remisBulkActionView/epics/cancelOrDeleteRemisBulkActionEpic.d.ts +0 -8
  59. package/lib/view/spendManagement/reimbursement/remisBulkActionView/epics/cancelOrDeleteRemisBulkActionEpic.js +0 -81
  60. package/lib/view/spendManagement/reimbursement/remisBulkActionView/epics/reviewDraftRemisBulkActionEpic.ts.d.ts +0 -7
  61. package/lib/view/spendManagement/reimbursement/remisBulkActionView/epics/reviewDraftRemisBulkActionEpic.ts.js +0 -29
  62. package/lib/view/spendManagement/reimbursement/remisBulkActionView/epics/submitDraftRemisBulkActionEpic.d.ts +0 -8
  63. package/lib/view/spendManagement/reimbursement/remisBulkActionView/epics/submitDraftRemisBulkActionEpic.js +0 -74
  64. package/lib/view/spendManagement/reimbursement/remisBulkActionView/remisBulkActionViewPayload.d.ts +0 -14
  65. package/lib/view/spendManagement/reimbursement/remisBulkActionView/remisBulkActionViewPayload.js +0 -2
  66. package/lib/view/spendManagement/reimbursement/remisBulkActionView/remisBulkActionViewReducer.d.ts +0 -17
  67. package/lib/view/spendManagement/reimbursement/remisBulkActionView/remisBulkActionViewReducer.js +0 -166
  68. package/lib/view/spendManagement/reimbursement/remisBulkActionView/remisBulkActionViewSelector.d.ts +0 -25
  69. package/lib/view/spendManagement/reimbursement/remisBulkActionView/remisBulkActionViewSelector.js +0 -46
  70. package/lib/view/spendManagement/reimbursement/remisBulkActionView/remisBulkActionViewState.d.ts +0 -30
  71. package/lib/view/spendManagement/reimbursement/remisBulkActionView/remisBulkActionViewState.js +0 -24
@@ -3,23 +3,11 @@ import { FetchState, ID } from '../../../../commonStateTypes/common';
3
3
  import { TimePeriod } from '../../../../commonStateTypes/timePeriod';
4
4
  import { SelectorView } from '../../../../commonStateTypes/viewAndReport/viewAndReport';
5
5
  import { Reimbursement } from '../../../../entity/reimbursement/reimbursementState';
6
- import { RemiTabType, SaveRemiStageCode, RemiListUIState, ReimbursementViewSortKey, RemiSubTabType, ReimbursementFilters, RemiBulkSelectExceptionInfoType } from './remiListState';
6
+ import { RemiTabType, SaveRemiStageCode, RemiListUIState, ReimbursementViewSortKey, RemiSubTabType, ReimbursementFilters } from './remiListState';
7
7
  import { User, UserState } from '../../../../entity/user/userState';
8
8
  import { EntityApprovalStatusState } from '../../../../entity/entityApprovalStatus/entityApprovalStatusState';
9
9
  import { SortOrder } from '../../../../commonStateTypes/selectorTypes/sortOrderTypes';
10
10
  import { Approvers } from '../../../../entity/approvalRule/approvalRuleState';
11
- import { BulkOperationType } from '../../helpers';
12
- export interface RemiBulkSelectInfo {
13
- isSelectableForBulkAction: boolean;
14
- isSelectableForBulkActionSelectAll: boolean;
15
- bulkSelectExceptionInfo?: RemiBulkSelectExceptionInfoType;
16
- }
17
- export interface RemiListBulkActionInfo {
18
- isBulkActionAllowed: boolean;
19
- allowedBulkActions: BulkOperationType[];
20
- bulkSubmissionFetchState: FetchState;
21
- remisSelectedForBulkAction: ID[];
22
- }
23
11
  export interface RemiListReport extends SelectorView {
24
12
  reimbursements: ReimbursementView[];
25
13
  createdByUserList: User[];
@@ -35,15 +23,11 @@ export interface RemiListReport extends SelectorView {
35
23
  reimbursementBotEmail: string;
36
24
  isDownloadEnabled: boolean;
37
25
  createdByUserListFetchState: FetchState;
38
- remiBulkSubmissionLimit: number;
39
- remiListBulkActionInfo: RemiListBulkActionInfo;
40
26
  }
41
27
  export interface ReimbursementView extends Reimbursement {
42
28
  submittedBy: User | undefined;
43
29
  approvers: Approvers;
44
- bulkSelectInfo?: RemiBulkSelectInfo;
45
30
  }
46
- export declare const getRemiList: (state: RootState, currentTimePeriod: TimePeriod, isBulkActionFeatureEnabled: boolean) => RemiListReport;
31
+ export declare const getRemiList: (state: RootState, currentTimePeriod: TimePeriod) => RemiListReport;
47
32
  export declare const getApproversOrRejectors: (reimbursement: Reimbursement, entityApprovalStatusState: EntityApprovalStatusState, userState: UserState) => Approvers;
48
33
  export declare const getRemiListOnSort: (sortKey: ReimbursementViewSortKey, sortOrder: SortOrder, currentTab: RemiTabType, reimbursements: ReimbursementView[]) => ReimbursementView[];
49
- export declare const getAllowedBulkActions: (selectedTab: RemiTabType, selectedSubTab: RemiSubTabType, isAllAwaitingMyApproval: boolean, isFirstBillProcessing: boolean) => BulkOperationType[];
@@ -3,10 +3,9 @@ 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.getAllowedBulkActions = exports.getRemiListOnSort = exports.getApproversOrRejectors = exports.getRemiList = void 0;
6
+ exports.getRemiListOnSort = exports.getApproversOrRejectors = exports.getRemiList = 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"));
10
9
  const remiListState_1 = require("./remiListState");
11
10
  const userSelector_1 = require("../../../../entity/user/userSelector");
12
11
  const zeniDayJS_1 = require("../../../../zeniDayJS");
@@ -16,10 +15,9 @@ const approvalRuleState_1 = require("../../../../entity/approvalRule/approvalRul
16
15
  const reimbursementConfigSelector_1 = require("../../reimbursement/reimbursementConfig/reimbursementConfigSelector");
17
16
  const spendManagementFilterHelpers_1 = require("../../spendManagementFilterHelpers");
18
17
  const reduceFetchState_1 = require("../../../../commonStateTypes/reduceFetchState");
19
- const helpers_1 = require("../../helpers");
20
- const getRemiList = (state, currentTimePeriod, isBulkActionFeatureEnabled) => {
18
+ const getRemiList = (state, currentTimePeriod) => {
21
19
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
22
- const { remiListState, reimbursementState, userState, entityApprovalStatusState, tenantState, reimbursementConfigState, remisBulkActionViewState, } = state;
20
+ const { remiListState, reimbursementState, userState, entityApprovalStatusState, tenantState, reimbursementConfigState, } = state;
23
21
  const loggedInUserId = (_b = (_a = tenantState.loggedInUser) === null || _a === void 0 ? void 0 : _a.userId) !== null && _b !== void 0 ? _b : '';
24
22
  const key = (0, remiListState_1.getRemiListKey)(currentTimePeriod, remiListState.currentTab);
25
23
  const pendingApprovalKey = (0, remiListState_1.getRemiListKey)(currentTimePeriod, 'pending_approval');
@@ -71,58 +69,6 @@ const getRemiList = (state, currentTimePeriod, isBulkActionFeatureEnabled) => {
71
69
  lastName.includes(loweredSearchText) ||
72
70
  email.includes(loweredSearchText));
73
71
  }));
74
- //BulkActions
75
- const bulkSubmissionFetchState = remisBulkActionViewState.bulkSubmissionFetchState.fetchState;
76
- let remiListBulkActionInfo = {
77
- isBulkActionAllowed: false,
78
- remisSelectedForBulkAction: [],
79
- allowedBulkActions: [],
80
- bulkSubmissionFetchState,
81
- };
82
- const remisSelectedForBulkAction = remisBulkActionViewState.remisSelectedForBulkAction;
83
- const firstRemiInBulkList = (0, get_1.default)(reimbursementState.reimbursementById, remisSelectedForBulkAction[0], undefined);
84
- const isBulkActionAllowed = isBulkActionFeatureEnabled
85
- ? checkIfBulkActionAllowed(remiListState.currentTab, remiListState.currentSubTab)
86
- : false;
87
- let firstSelectableRemi = undefined;
88
- if (isBulkActionAllowed) {
89
- reimbursementsDetailed = reimbursementsDetailed.map((transaction) => {
90
- var _a, _b;
91
- let bulkSelectInfo;
92
- if (isBulkActionAllowed) {
93
- const isProcessing = (0, helpers_1.isBulkProcessing)((_a = transaction.bulkProcessingDetail) === null || _a === void 0 ? void 0 : _a.type);
94
- const isError = ((_b = transaction.bulkProcessingDetail) === null || _b === void 0 ? void 0 : _b.type) === 'error';
95
- const { isSelectableForBulkAction, isSelectableForBulkActionSelectAll, bulkSelectExceptionInfo, } = isProcessing || isError
96
- ? {
97
- isSelectableForBulkAction: false,
98
- isSelectableForBulkActionSelectAll: false,
99
- bulkSelectExceptionInfo: undefined,
100
- }
101
- : isRemiSelectableForBulkAction(transaction, remiListState.currentTab, firstSelectableRemi, firstRemiInBulkList);
102
- if (firstSelectableRemi == null && isSelectableForBulkAction) {
103
- firstSelectableRemi = transaction;
104
- }
105
- bulkSelectInfo = {
106
- isSelectableForBulkAction,
107
- isSelectableForBulkActionSelectAll,
108
- bulkSelectExceptionInfo,
109
- };
110
- }
111
- return Object.assign(Object.assign({}, transaction), { bulkSelectInfo });
112
- });
113
- const allBulkRemisAwaitingMyApproval = (0, difference_1.default)(remisSelectedForBulkAction, pendingApprovalTransactionIDs)
114
- .length === 0;
115
- const allowedBulkActions = isBulkActionAllowed
116
- ? (0, exports.getAllowedBulkActions)(remiListState.currentTab, remiListState.currentSubTab, allBulkRemisAwaitingMyApproval, (firstRemiInBulkList === null || firstRemiInBulkList === void 0 ? void 0 : firstRemiInBulkList.reimbursementInfo.billPaymentStatus.code) ===
117
- 'processing')
118
- : [];
119
- remiListBulkActionInfo = {
120
- isBulkActionAllowed,
121
- remisSelectedForBulkAction,
122
- allowedBulkActions,
123
- bulkSubmissionFetchState,
124
- };
125
- }
126
72
  const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
127
73
  const isReimbursementUser = Boolean(currentTenant === null || currentTenant === void 0 ? void 0 : currentTenant.userRole) === true
128
74
  ? (0, userRoleType_1.hasReimbursementUserAccess)(currentTenant)
@@ -140,7 +86,6 @@ const getRemiList = (state, currentTimePeriod, isBulkActionFeatureEnabled) => {
140
86
  error: (_b = remiListState.byRemiListKey[key]) === null || _b === void 0 ? void 0 : _b.error,
141
87
  });
142
88
  }));
143
- const remiBulkSubmissionLimit = reimbursementConfigState.reimbursementBulkSubmissionLimit;
144
89
  return {
145
90
  reportTitle: 'Reimbursements',
146
91
  version: 0,
@@ -161,8 +106,6 @@ const getRemiList = (state, currentTimePeriod, isBulkActionFeatureEnabled) => {
161
106
  isDownloadEnabled,
162
107
  createdByUserList,
163
108
  createdByUserListFetchState: createdByUserListFetchState.fetchState,
164
- remiBulkSubmissionLimit,
165
- remiListBulkActionInfo,
166
109
  };
167
110
  };
168
111
  exports.getRemiList = getRemiList;
@@ -449,102 +392,3 @@ const getRemiListOnSort = (sortKey, sortOrder, currentTab, reimbursements) => {
449
392
  ];
450
393
  };
451
394
  exports.getRemiListOnSort = getRemiListOnSort;
452
- const checkIfBulkActionAllowed = (selectedTab, selectedSubTab) => {
453
- if (selectedTab === 'paid' || selectedSubTab === 'deleted') {
454
- return false;
455
- }
456
- return true;
457
- };
458
- const isRemiSelectableForBulkAction = (reimbursement, selectedTab, firstSelectableRemi, firstRemiSelected) => {
459
- const result = {
460
- isSelectableForBulkAction: true,
461
- isSelectableForBulkActionSelectAll: true,
462
- bulkSelectExceptionInfo: undefined,
463
- };
464
- if (selectedTab === 'scheduled') {
465
- //for cases where user attempts select all on scheduled tab
466
- if (firstRemiSelected == null && firstSelectableRemi != null) {
467
- if (firstSelectableRemi.reimbursementInfo.billPaymentStatus.code ===
468
- 'processing') {
469
- if (reimbursement.reimbursementInfo.billPaymentStatus.code !==
470
- 'processing') {
471
- return {
472
- isSelectableForBulkAction: true,
473
- isSelectableForBulkActionSelectAll: false,
474
- bulkSelectExceptionInfo: undefined,
475
- };
476
- }
477
- }
478
- if (reimbursement.reimbursementInfo.billPaymentStatus.code === 'processing') {
479
- if (firstSelectableRemi.reimbursementInfo.billPaymentStatus.code !==
480
- 'processing') {
481
- return {
482
- isSelectableForBulkAction: true,
483
- isSelectableForBulkActionSelectAll: false,
484
- bulkSelectExceptionInfo: undefined,
485
- };
486
- }
487
- }
488
- }
489
- if ((firstRemiSelected === null || firstRemiSelected === void 0 ? void 0 : firstRemiSelected.reimbursementInfo.billPaymentStatus.code) ===
490
- 'processing') {
491
- if (reimbursement.reimbursementInfo.billPaymentStatus.code !== 'processing') {
492
- return {
493
- isSelectableForBulkAction: false,
494
- isSelectableForBulkActionSelectAll: true,
495
- bulkSelectExceptionInfo: 'processingSelectTogether',
496
- };
497
- }
498
- }
499
- if (firstRemiSelected != null &&
500
- reimbursement.reimbursementInfo.billPaymentStatus.code === 'processing') {
501
- if (firstRemiSelected.reimbursementInfo.billPaymentStatus.code !==
502
- 'processing') {
503
- return {
504
- isSelectableForBulkAction: false,
505
- isSelectableForBulkActionSelectAll: true,
506
- bulkSelectExceptionInfo: 'processingWithOthers',
507
- };
508
- }
509
- }
510
- }
511
- return result;
512
- };
513
- const getAllowedBulkActions = (selectedTab, selectedSubTab, isAllAwaitingMyApproval, isFirstBillProcessing) => {
514
- switch (selectedTab) {
515
- case 'draft':
516
- return ['send_for_approval', 'delete'];
517
- case 'pending_approval': {
518
- switch (selectedSubTab) {
519
- case 'all':
520
- case 'awaitingApproval':
521
- case 'awaitingAllApproval':
522
- case 'overdue':
523
- if (isAllAwaitingMyApproval) {
524
- return ['approve', 'reject', 'delete'];
525
- }
526
- return ['delete'];
527
- case 'awaitingMyApproval':
528
- return ['approve', 'reject', 'delete'];
529
- case 'rejected':
530
- return ['delete'];
531
- default:
532
- return [];
533
- }
534
- }
535
- case 'scheduled': {
536
- switch (selectedSubTab) {
537
- case 'all':
538
- return isFirstBillProcessing ? ['cancel'] : ['delete'];
539
- case 'failed':
540
- case 'cancelled':
541
- return ['delete'];
542
- default:
543
- return [];
544
- }
545
- }
546
- default:
547
- return [];
548
- }
549
- };
550
- exports.getAllowedBulkActions = getAllowedBulkActions;
@@ -53,5 +53,4 @@ export interface ReimbursementFilterCategory {
53
53
  export declare type RemiListViewFilterCategoryField = 'createdBy' | 'status' | 'amount' | 'receiptDate' | 'creationDate' | 'paymentMethod';
54
54
  export declare const REIMBURSEMENT_FILTER_CATEGORIES: ReimbursementFilterCategoryDropdownOption[];
55
55
  export declare const REIMBURSEMENT_FILTER_CATEGORIES_RESTRICTED: ReimbursementFilterCategoryDropdownOption[];
56
- export declare type RemiBulkSelectExceptionInfoType = 'processingSelectTogether' | 'processingWithOthers';
57
56
  export {};
@@ -8,7 +8,7 @@ import { updateCreatedTagToLocalStore } from '../../taskManager/taskDetailView/t
8
8
  export declare type ActionType = ReturnType<typeof createTag> | ReturnType<typeof updateTagCreateStatus> | ReturnType<typeof openSnackbar> | ReturnType<typeof updateCreatedTagToLocalStore> | ReturnType<typeof updateTags>;
9
9
  export declare const createTagEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
10
10
  payload: {
11
- messageSection: "bill_pay_setup" | "reimbursement_setup" | "charge_card_setup" | "common" | "transactionDetails_updatingPastTransactions" | "transactionDetails_transactionUpdated" | "cockpit_month_end_email_sent" | "cockpit_month_end_email_save" | "cockpit_month_end_email_attachment_upload" | "je_bill_link" | "audit_score_updated" | "people_invite_people" | "people_invite_multiple_people" | "people_delete_person" | "people_update_person" | "reimbursement_updated" | "reimbursement_deleted" | "reimbursement_cancelled_deleted" | "reimbursement_cancelled" | "reimbursement_approved" | "reimbursement_rejected" | "reimbursement_sent_for_approval" | "account_added" | "business_verification_save" | "business_verification_submit" | "business_verification_from_bills_submit" | "plaid_connection" | "unlink_deposit_account" | "reimbursement_approval_create" | "reimbursement_duplicate_approval_create" | "reimbursement_approval_update" | "reimbursement_duplicate_approval_update" | "reimbursement_approval_delete" | "reimbursement_create_mileage" | "reimbursement_update_mileage" | "reimbursement_accept_term" | "reimbursement_accept_employee_term" | "reimbursement_bulk_submit" | "reimbursement_bulk_processed" | "zeni_accounts_setup" | "bill_pay_approval_create" | "bill_pay_duplicate_approval_create" | "bill_pay_approval_update" | "bill_pay_duplicate_approval_update" | "bill_pay_approval_delete" | "bill_pay_updated" | "bill_pay_deleted" | "bill_pay_cancelled_deleted" | "bill_pay_cancelled" | "bill_pay_approved" | "real_time_approver_added" | "bill_pay_rejected" | "bill_pay_sent_for_approval" | "bill_pay_accept_term" | "bill_pay_bulk_submit" | "bill_pay_bulk_processed" | "bill_pay_refund" | "bill_pay_retry" | "zeni_account_accept_term" | "update_vendor" | "data_refresh_update" | "delete_bank_account" | "create_bank_account" | "create_bank_account_ach" | "create_bank_account_wire" | "create_bank_account_international" | "transfer_money" | "update_zeni_account_nickname" | "create_checking_account" | "deposit_check" | "create_vendor" | "onboarding_customer_view" | "onboarding_customer_view_complete" | "onboarding_customer_identity_verification_save" | "onboarding_customer_identity_verification_submit" | "onboarding_customer_business_verification_save" | "onboarding_customer_business_verification_submit" | "retry_bank_account_connection" | "dashboard_invite_sent" | "onboarding_info_saved" | "approve_original_merchant" | "approve_global_merchant" | "reject_global_merchant" | "create_global_merchant" | "fetch_global_merchant_no_recommendation" | "save_vendor_renamed" | "save_vendor_sent_for_review" | "save_vendor_marked_as_employee" | "save_vendor_marked_as_local_contractor" | "charge_card_accept_term" | "charge_card_receipt_upload" | "charge_card_resend_invite" | "charge_card_revoke_invite" | "create_schedule" | "save_schedule" | "delete_schedule" | "save_task_detail" | "fetch_task_detail" | "delete_task" | "archive_task" | "create_tag" | "delete_tag" | "update_charge_card" | "issue_charge_card" | "notification_settings_saved" | "referral_invite_sent" | "notification_mark_as_read" | "mark_as_complete_schedule" | "cancel_journal_entry" | "settings_accounting_accounts_updated" | "create_card_setup" | "confirm_card_setup" | "add_card_payment_source" | "fetch_payment_sources" | "task_assigned_toast_notification" | "task_due_tomorrow_toast_notification" | "task_deleted_toast_notification" | "task_archived_toast_notification" | "task_overdue_toast_notification" | "task_overdue_toast_notification_creator" | "task_notification_count" | "task_activities_toast_notification" | "task_created_toast_notification" | "task_group_creation_success" | "task_group_deletion_success" | "task_group_update_success" | "primary_funding_account_updated" | "task_time_spent_validation";
11
+ messageSection: "bill_pay_setup" | "reimbursement_setup" | "charge_card_setup" | "common" | "transactionDetails_updatingPastTransactions" | "transactionDetails_transactionUpdated" | "cockpit_month_end_email_sent" | "cockpit_month_end_email_save" | "cockpit_month_end_email_attachment_upload" | "je_bill_link" | "audit_score_updated" | "people_invite_people" | "people_invite_multiple_people" | "people_delete_person" | "people_update_person" | "reimbursement_updated" | "reimbursement_deleted" | "reimbursement_cancelled_deleted" | "reimbursement_cancelled" | "reimbursement_approved" | "reimbursement_rejected" | "reimbursement_sent_for_approval" | "account_added" | "business_verification_save" | "business_verification_submit" | "business_verification_from_bills_submit" | "plaid_connection" | "unlink_deposit_account" | "reimbursement_approval_create" | "reimbursement_duplicate_approval_create" | "reimbursement_approval_update" | "reimbursement_duplicate_approval_update" | "reimbursement_approval_delete" | "reimbursement_create_mileage" | "reimbursement_update_mileage" | "reimbursement_accept_term" | "reimbursement_accept_employee_term" | "zeni_accounts_setup" | "bill_pay_approval_create" | "bill_pay_duplicate_approval_create" | "bill_pay_approval_update" | "bill_pay_duplicate_approval_update" | "bill_pay_approval_delete" | "bill_pay_updated" | "bill_pay_deleted" | "bill_pay_cancelled_deleted" | "bill_pay_cancelled" | "bill_pay_approved" | "real_time_approver_added" | "bill_pay_rejected" | "bill_pay_sent_for_approval" | "bill_pay_accept_term" | "bill_pay_bulk_submit" | "bill_pay_bulk_processed" | "bill_pay_refund" | "bill_pay_retry" | "zeni_account_accept_term" | "update_vendor" | "data_refresh_update" | "delete_bank_account" | "create_bank_account" | "create_bank_account_ach" | "create_bank_account_wire" | "create_bank_account_international" | "transfer_money" | "update_zeni_account_nickname" | "create_checking_account" | "deposit_check" | "create_vendor" | "onboarding_customer_view" | "onboarding_customer_view_complete" | "onboarding_customer_identity_verification_save" | "onboarding_customer_identity_verification_submit" | "onboarding_customer_business_verification_save" | "onboarding_customer_business_verification_submit" | "retry_bank_account_connection" | "dashboard_invite_sent" | "onboarding_info_saved" | "approve_original_merchant" | "approve_global_merchant" | "reject_global_merchant" | "create_global_merchant" | "fetch_global_merchant_no_recommendation" | "save_vendor_renamed" | "save_vendor_sent_for_review" | "save_vendor_marked_as_employee" | "save_vendor_marked_as_local_contractor" | "charge_card_accept_term" | "charge_card_receipt_upload" | "charge_card_resend_invite" | "charge_card_revoke_invite" | "create_schedule" | "save_schedule" | "delete_schedule" | "save_task_detail" | "fetch_task_detail" | "delete_task" | "archive_task" | "create_tag" | "delete_tag" | "update_charge_card" | "issue_charge_card" | "notification_settings_saved" | "referral_invite_sent" | "notification_mark_as_read" | "mark_as_complete_schedule" | "cancel_journal_entry" | "settings_accounting_accounts_updated" | "create_card_setup" | "confirm_card_setup" | "add_card_payment_source" | "fetch_payment_sources" | "task_assigned_toast_notification" | "task_due_tomorrow_toast_notification" | "task_deleted_toast_notification" | "task_archived_toast_notification" | "task_overdue_toast_notification" | "task_overdue_toast_notification_creator" | "task_notification_count" | "task_activities_toast_notification" | "task_created_toast_notification" | "task_group_creation_success" | "task_group_deletion_success" | "task_group_update_success" | "primary_funding_account_updated" | "task_time_spent_validation";
12
12
  messageText: "failed" | "success" | "notification";
13
13
  type: import("../../..").SnackbarMessageType;
14
14
  showStatusIcon?: boolean | undefined;
@@ -9,7 +9,7 @@ export declare const deleteTagEpic: (actions$: ActionsObservable<ActionType>, _s
9
9
  type: string;
10
10
  } | {
11
11
  payload: {
12
- messageSection: "bill_pay_setup" | "reimbursement_setup" | "charge_card_setup" | "common" | "transactionDetails_updatingPastTransactions" | "transactionDetails_transactionUpdated" | "cockpit_month_end_email_sent" | "cockpit_month_end_email_save" | "cockpit_month_end_email_attachment_upload" | "je_bill_link" | "audit_score_updated" | "people_invite_people" | "people_invite_multiple_people" | "people_delete_person" | "people_update_person" | "reimbursement_updated" | "reimbursement_deleted" | "reimbursement_cancelled_deleted" | "reimbursement_cancelled" | "reimbursement_approved" | "reimbursement_rejected" | "reimbursement_sent_for_approval" | "account_added" | "business_verification_save" | "business_verification_submit" | "business_verification_from_bills_submit" | "plaid_connection" | "unlink_deposit_account" | "reimbursement_approval_create" | "reimbursement_duplicate_approval_create" | "reimbursement_approval_update" | "reimbursement_duplicate_approval_update" | "reimbursement_approval_delete" | "reimbursement_create_mileage" | "reimbursement_update_mileage" | "reimbursement_accept_term" | "reimbursement_accept_employee_term" | "reimbursement_bulk_submit" | "reimbursement_bulk_processed" | "zeni_accounts_setup" | "bill_pay_approval_create" | "bill_pay_duplicate_approval_create" | "bill_pay_approval_update" | "bill_pay_duplicate_approval_update" | "bill_pay_approval_delete" | "bill_pay_updated" | "bill_pay_deleted" | "bill_pay_cancelled_deleted" | "bill_pay_cancelled" | "bill_pay_approved" | "real_time_approver_added" | "bill_pay_rejected" | "bill_pay_sent_for_approval" | "bill_pay_accept_term" | "bill_pay_bulk_submit" | "bill_pay_bulk_processed" | "bill_pay_refund" | "bill_pay_retry" | "zeni_account_accept_term" | "update_vendor" | "data_refresh_update" | "delete_bank_account" | "create_bank_account" | "create_bank_account_ach" | "create_bank_account_wire" | "create_bank_account_international" | "transfer_money" | "update_zeni_account_nickname" | "create_checking_account" | "deposit_check" | "create_vendor" | "onboarding_customer_view" | "onboarding_customer_view_complete" | "onboarding_customer_identity_verification_save" | "onboarding_customer_identity_verification_submit" | "onboarding_customer_business_verification_save" | "onboarding_customer_business_verification_submit" | "retry_bank_account_connection" | "dashboard_invite_sent" | "onboarding_info_saved" | "approve_original_merchant" | "approve_global_merchant" | "reject_global_merchant" | "create_global_merchant" | "fetch_global_merchant_no_recommendation" | "save_vendor_renamed" | "save_vendor_sent_for_review" | "save_vendor_marked_as_employee" | "save_vendor_marked_as_local_contractor" | "charge_card_accept_term" | "charge_card_receipt_upload" | "charge_card_resend_invite" | "charge_card_revoke_invite" | "create_schedule" | "save_schedule" | "delete_schedule" | "save_task_detail" | "fetch_task_detail" | "delete_task" | "archive_task" | "create_tag" | "delete_tag" | "update_charge_card" | "issue_charge_card" | "notification_settings_saved" | "referral_invite_sent" | "notification_mark_as_read" | "mark_as_complete_schedule" | "cancel_journal_entry" | "settings_accounting_accounts_updated" | "create_card_setup" | "confirm_card_setup" | "add_card_payment_source" | "fetch_payment_sources" | "task_assigned_toast_notification" | "task_due_tomorrow_toast_notification" | "task_deleted_toast_notification" | "task_archived_toast_notification" | "task_overdue_toast_notification" | "task_overdue_toast_notification_creator" | "task_notification_count" | "task_activities_toast_notification" | "task_created_toast_notification" | "task_group_creation_success" | "task_group_deletion_success" | "task_group_update_success" | "primary_funding_account_updated" | "task_time_spent_validation";
12
+ messageSection: "bill_pay_setup" | "reimbursement_setup" | "charge_card_setup" | "common" | "transactionDetails_updatingPastTransactions" | "transactionDetails_transactionUpdated" | "cockpit_month_end_email_sent" | "cockpit_month_end_email_save" | "cockpit_month_end_email_attachment_upload" | "je_bill_link" | "audit_score_updated" | "people_invite_people" | "people_invite_multiple_people" | "people_delete_person" | "people_update_person" | "reimbursement_updated" | "reimbursement_deleted" | "reimbursement_cancelled_deleted" | "reimbursement_cancelled" | "reimbursement_approved" | "reimbursement_rejected" | "reimbursement_sent_for_approval" | "account_added" | "business_verification_save" | "business_verification_submit" | "business_verification_from_bills_submit" | "plaid_connection" | "unlink_deposit_account" | "reimbursement_approval_create" | "reimbursement_duplicate_approval_create" | "reimbursement_approval_update" | "reimbursement_duplicate_approval_update" | "reimbursement_approval_delete" | "reimbursement_create_mileage" | "reimbursement_update_mileage" | "reimbursement_accept_term" | "reimbursement_accept_employee_term" | "zeni_accounts_setup" | "bill_pay_approval_create" | "bill_pay_duplicate_approval_create" | "bill_pay_approval_update" | "bill_pay_duplicate_approval_update" | "bill_pay_approval_delete" | "bill_pay_updated" | "bill_pay_deleted" | "bill_pay_cancelled_deleted" | "bill_pay_cancelled" | "bill_pay_approved" | "real_time_approver_added" | "bill_pay_rejected" | "bill_pay_sent_for_approval" | "bill_pay_accept_term" | "bill_pay_bulk_submit" | "bill_pay_bulk_processed" | "bill_pay_refund" | "bill_pay_retry" | "zeni_account_accept_term" | "update_vendor" | "data_refresh_update" | "delete_bank_account" | "create_bank_account" | "create_bank_account_ach" | "create_bank_account_wire" | "create_bank_account_international" | "transfer_money" | "update_zeni_account_nickname" | "create_checking_account" | "deposit_check" | "create_vendor" | "onboarding_customer_view" | "onboarding_customer_view_complete" | "onboarding_customer_identity_verification_save" | "onboarding_customer_identity_verification_submit" | "onboarding_customer_business_verification_save" | "onboarding_customer_business_verification_submit" | "retry_bank_account_connection" | "dashboard_invite_sent" | "onboarding_info_saved" | "approve_original_merchant" | "approve_global_merchant" | "reject_global_merchant" | "create_global_merchant" | "fetch_global_merchant_no_recommendation" | "save_vendor_renamed" | "save_vendor_sent_for_review" | "save_vendor_marked_as_employee" | "save_vendor_marked_as_local_contractor" | "charge_card_accept_term" | "charge_card_receipt_upload" | "charge_card_resend_invite" | "charge_card_revoke_invite" | "create_schedule" | "save_schedule" | "delete_schedule" | "save_task_detail" | "fetch_task_detail" | "delete_task" | "archive_task" | "create_tag" | "delete_tag" | "update_charge_card" | "issue_charge_card" | "notification_settings_saved" | "referral_invite_sent" | "notification_mark_as_read" | "mark_as_complete_schedule" | "cancel_journal_entry" | "settings_accounting_accounts_updated" | "create_card_setup" | "confirm_card_setup" | "add_card_payment_source" | "fetch_payment_sources" | "task_assigned_toast_notification" | "task_due_tomorrow_toast_notification" | "task_deleted_toast_notification" | "task_archived_toast_notification" | "task_overdue_toast_notification" | "task_overdue_toast_notification_creator" | "task_notification_count" | "task_activities_toast_notification" | "task_created_toast_notification" | "task_group_creation_success" | "task_group_deletion_success" | "task_group_update_success" | "primary_funding_account_updated" | "task_time_spent_validation";
13
13
  messageText: "failed" | "success" | "notification";
14
14
  type: import("../../..").SnackbarMessageType;
15
15
  showStatusIcon?: boolean | undefined;
@@ -15,13 +15,14 @@ const resendOtpEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators
15
15
  const resendOtpActions = [];
16
16
  const { otpChallenge, twoFASource } = action.payload;
17
17
  const tenantState = state$.value.tenantState;
18
+ const companyState = state$.value.companyState;
18
19
  const { currentTenantId } = tenantState;
19
- const productSettings = currentTenantId != null
20
- ? (_a = tenantState.tenantsById[currentTenantId]) === null || _a === void 0 ? void 0 : _a.productSettings
20
+ const companyId = currentTenantId != null
21
+ ? (_a = tenantState.tenantsById[currentTenantId]) === null || _a === void 0 ? void 0 : _a.companyId
21
22
  : undefined;
22
- const isCardsEnabled = productSettings != null
23
- ? productSettings.isBookkeepingEnabled ||
24
- productSettings.isCardsEnabled
23
+ const isCardsEnabled = companyId != null
24
+ ? companyState.companiesById[companyId].companyChargeCardInfo
25
+ .isChargeCardEnabled
25
26
  : false;
26
27
  const payload = {
27
28
  otp_challenge: otpChallenge,
@@ -15,13 +15,14 @@ const sendOtpEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1
15
15
  const sendOtpActions = [];
16
16
  const { phoneNumber, twoFASource } = action.payload;
17
17
  const tenantState = state$.value.tenantState;
18
+ const companyState = state$.value.companyState;
18
19
  const { currentTenantId } = tenantState;
19
- const productSettings = currentTenantId != null
20
- ? (_a = tenantState.tenantsById[currentTenantId]) === null || _a === void 0 ? void 0 : _a.productSettings
20
+ const companyId = currentTenantId != null
21
+ ? (_a = tenantState.tenantsById[currentTenantId]) === null || _a === void 0 ? void 0 : _a.companyId
21
22
  : undefined;
22
- const isCardsEnabled = productSettings != null
23
- ? productSettings.isBookkeepingEnabled ||
24
- productSettings.isCardsEnabled
23
+ const isCardsEnabled = companyId != null
24
+ ? companyState.companiesById[companyId].companyChargeCardInfo
25
+ .isChargeCardEnabled
25
26
  : false;
26
27
  const queryPayload = {
27
28
  channel_type: 'phone',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.12.80",
3
+ "version": "4.12.82",
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",
@@ -1,9 +0,0 @@
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 { approveOrRejectRemisBulkAction, remisBulkActionFailure, remisBulkActionSuccess } from '../remisBulkActionViewReducer';
7
- import { updateReimbursementsWithBulkActionStatus } from '../../../../../entity/reimbursement/reimbursementReducer';
8
- export declare type ActionType = ReturnType<typeof approveOrRejectRemisBulkAction> | ReturnType<typeof updateReimbursementsWithBulkActionStatus> | ReturnType<typeof openSnackbar> | ReturnType<typeof remisBulkActionFailure> | ReturnType<typeof remisBulkActionSuccess>;
9
- export declare const approveOrRejectRemisBulkActionEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -1,80 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.approveOrRejectRemisBulkActionEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const responsePayload_1 = require("../../../../../responsePayload");
7
- const snackbarReducer_1 = require("../../../../../entity/snackbar/snackbarReducer");
8
- const remisBulkActionViewReducer_1 = require("../remisBulkActionViewReducer");
9
- const reimbursementReducer_1 = require("../../../../../entity/reimbursement/reimbursementReducer");
10
- const approveOrRejectRemisBulkActionEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(remisBulkActionViewReducer_1.approveOrRejectRemisBulkAction.match), (0, operators_1.mergeMap)((action) => {
11
- const { approvalType, description } = action.payload;
12
- const { remisBulkActionViewState } = state$.value;
13
- const transactionIds = remisBulkActionViewState.remisSelectedForBulkAction;
14
- const payload = prepareBulkApproveOrRejectPayload(transactionIds, approvalType, description);
15
- return zeniAPI
16
- .putAndGetJSON(`${zeniAPI.apiEndPoints.spendManagementMicroServiceBaseUrl}/1.0/bulk/reimbursements/transactions`, payload)
17
- .pipe((0, operators_1.mergeMap)((response) => {
18
- var _a, _b, _c, _d, _e, _f;
19
- if ((0, responsePayload_1.isSuccessStatus)(response)) {
20
- const actions = [];
21
- const processingRemisCount = (_b = (_a = response.data) === null || _a === void 0 ? void 0 : _a.total_operations_processing) !== null && _b !== void 0 ? _b : 0;
22
- actions.push((0, remisBulkActionViewReducer_1.remisBulkActionSuccess)({
23
- remisProcessing: processingRemisCount,
24
- refreshTime: (_d = (_c = response.data) === null || _c === void 0 ? void 0 : _c.hard_refresh_after_sec) !== null && _d !== void 0 ? _d : 0,
25
- }));
26
- actions.push((0, reimbursementReducer_1.updateReimbursementsWithBulkActionStatus)((_f = (_e = response.data) === null || _e === void 0 ? void 0 : _e.operations) !== null && _f !== void 0 ? _f : []));
27
- if (processingRemisCount > 0) {
28
- actions.push((0, snackbarReducer_1.openSnackbar)({
29
- messageSection: 'reimbursement_bulk_submit',
30
- messageText: 'success',
31
- type: 'success',
32
- variables: [
33
- {
34
- variableName: '_count_',
35
- variableValue: processingRemisCount.toString(),
36
- },
37
- {
38
- variableName: '_report_',
39
- variableValue: processingRemisCount > 1 ? 'reports' : 'report',
40
- },
41
- {
42
- variableName: '_action_',
43
- variableValue: approvalType,
44
- },
45
- ],
46
- }));
47
- }
48
- return (0, rxjs_1.from)(actions);
49
- }
50
- else {
51
- return (0, rxjs_1.of)((0, remisBulkActionViewReducer_1.remisBulkActionFailure)(response.status), (0, snackbarReducer_1.openSnackbar)({
52
- messageSection: 'reimbursement_bulk_submit',
53
- messageText: 'failed',
54
- type: 'error',
55
- variables: [
56
- {
57
- variableName: '_api-error_',
58
- variableValue: response.status.message,
59
- },
60
- ],
61
- }));
62
- }
63
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, remisBulkActionViewReducer_1.remisBulkActionFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Remi Approve or Reject bulk action REST API call errored out ' +
64
- JSON.stringify(error))))));
65
- }));
66
- exports.approveOrRejectRemisBulkActionEpic = approveOrRejectRemisBulkActionEpic;
67
- function prepareBulkApproveOrRejectPayload(transactionIds, approvalType, description) {
68
- const bulkApproveOrRejectItems = transactionIds.map((id) => ({
69
- entity_id: id,
70
- request_data: {
71
- approval_status: approvalType,
72
- is_include_entity_approval: true,
73
- description: description !== null && description !== void 0 ? description : '',
74
- },
75
- }));
76
- return {
77
- operation_type: approvalType === 'approved' ? 'approve' : 'reject',
78
- operations: bulkApproveOrRejectItems,
79
- };
80
- }
@@ -1,8 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { ZeniAPI } from '../../../../../zeniAPI';
3
- import { RootState } from '../../../../../reducer';
4
- import { updateReimbursementsWithBulkActionStatus } from '../../../../../entity/reimbursement/reimbursementReducer';
5
- import { openSnackbar } from '../../../../../entity/snackbar/snackbarReducer';
6
- import { cancelOrDeleteRemisBulkAction, remisBulkActionFailure, remisBulkActionSuccess } from '../remisBulkActionViewReducer';
7
- export declare type ActionType = ReturnType<typeof cancelOrDeleteRemisBulkAction> | ReturnType<typeof updateReimbursementsWithBulkActionStatus> | ReturnType<typeof openSnackbar> | ReturnType<typeof remisBulkActionFailure> | ReturnType<typeof remisBulkActionSuccess>;
8
- export declare const cancelOrDeleteRemisBulkActionEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<ActionType>;
@@ -1,81 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.cancelOrDeleteRemisBulkActionEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const responsePayload_1 = require("../../../../../responsePayload");
7
- const reimbursementReducer_1 = require("../../../../../entity/reimbursement/reimbursementReducer");
8
- const snackbarReducer_1 = require("../../../../../entity/snackbar/snackbarReducer");
9
- const remisBulkActionViewReducer_1 = require("../remisBulkActionViewReducer");
10
- const cancelOrDeleteRemisBulkActionEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(remisBulkActionViewReducer_1.cancelOrDeleteRemisBulkAction.match), (0, operators_1.mergeMap)((action) => {
11
- const { operationType, description } = action.payload;
12
- const { remisBulkActionViewState } = state$.value;
13
- const transactionIds = remisBulkActionViewState.remisSelectedForBulkAction;
14
- const payload = prepareBulkCancelOrDeletePayload(transactionIds, operationType, description);
15
- const bulkApiUrl = `${zeniAPI.apiEndPoints.spendManagementMicroServiceBaseUrl}/1.0/bulk/reimbursements/transactions`;
16
- const api = operationType === 'cancel'
17
- ? zeniAPI.putAndGetJSON(bulkApiUrl, payload)
18
- : zeniAPI.deleteAndGetJSON(bulkApiUrl, payload);
19
- return api.pipe((0, operators_1.mergeMap)((response) => {
20
- var _a, _b, _c, _d, _e, _f;
21
- if ((0, responsePayload_1.isSuccessStatus)(response)) {
22
- const actions = [];
23
- const processingRemisCount = (_b = (_a = response.data) === null || _a === void 0 ? void 0 : _a.total_operations_processing) !== null && _b !== void 0 ? _b : 0;
24
- actions.push((0, remisBulkActionViewReducer_1.remisBulkActionSuccess)({
25
- remisProcessing: processingRemisCount,
26
- refreshTime: (_d = (_c = response.data) === null || _c === void 0 ? void 0 : _c.hard_refresh_after_sec) !== null && _d !== void 0 ? _d : 0,
27
- }));
28
- actions.push((0, reimbursementReducer_1.updateReimbursementsWithBulkActionStatus)((_f = (_e = response.data) === null || _e === void 0 ? void 0 : _e.operations) !== null && _f !== void 0 ? _f : []));
29
- if (processingRemisCount > 0) {
30
- actions.push((0, snackbarReducer_1.openSnackbar)({
31
- messageSection: 'reimbursement_bulk_submit',
32
- messageText: 'success',
33
- type: 'success',
34
- variables: [
35
- {
36
- variableName: '_count_',
37
- variableValue: processingRemisCount.toString(),
38
- },
39
- {
40
- variableName: '_report_',
41
- variableValue: processingRemisCount > 1 ? 'reports' : 'report',
42
- },
43
- {
44
- variableName: '_action_',
45
- variableValue: operationType === 'cancel' ? 'canceled' : 'deleted',
46
- },
47
- ],
48
- }));
49
- }
50
- return (0, rxjs_1.from)(actions);
51
- }
52
- else {
53
- return (0, rxjs_1.of)((0, remisBulkActionViewReducer_1.remisBulkActionFailure)(response.status), (0, snackbarReducer_1.openSnackbar)({
54
- messageSection: 'reimbursement_bulk_submit',
55
- messageText: 'failed',
56
- type: 'error',
57
- variables: [
58
- {
59
- variableName: '_api-error_',
60
- variableValue: response.status.message,
61
- },
62
- ],
63
- }));
64
- }
65
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, remisBulkActionViewReducer_1.remisBulkActionFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Remi Cancel or Delete bulk action REST API call errored out ' +
66
- JSON.stringify(error))))));
67
- }));
68
- exports.cancelOrDeleteRemisBulkActionEpic = cancelOrDeleteRemisBulkActionEpic;
69
- function prepareBulkCancelOrDeletePayload(transactionIds, operationType, description) {
70
- const bulkCancelOrDeleteItems = transactionIds.map((id) => ({
71
- entity_id: id,
72
- request_data: {
73
- reimbursement_provider: 'zeni',
74
- description,
75
- },
76
- }));
77
- return {
78
- operation_type: operationType,
79
- operations: bulkCancelOrDeleteItems,
80
- };
81
- }
@@ -1,7 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { Observable } from 'rxjs';
3
- import { ZeniAPI } from '../../../../../zeniAPI';
4
- import { RootState } from '../../../../../reducer';
5
- import { reviewDraftRemisBulkAction, reviewDraftRemisBulkActionFailure, reviewDraftRemisBulkActionSuccess } from '../remisBulkActionViewReducer';
6
- export declare type ActionType = ReturnType<typeof reviewDraftRemisBulkAction> | ReturnType<typeof reviewDraftRemisBulkActionSuccess> | ReturnType<typeof reviewDraftRemisBulkActionFailure>;
7
- export declare const reviewDraftRemisBulkActionEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.reviewDraftRemisBulkActionEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const responsePayload_1 = require("../../../../../responsePayload");
7
- const remisBulkActionViewReducer_1 = require("../remisBulkActionViewReducer");
8
- const reviewDraftRemisBulkActionEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(remisBulkActionViewReducer_1.reviewDraftRemisBulkAction.match), (0, operators_1.mergeMap)(() => {
9
- const { remisBulkActionViewState } = state$.value;
10
- const transactionIds = remisBulkActionViewState.remisSelectedForBulkAction;
11
- const queryParam = {
12
- entity_ids: transactionIds,
13
- };
14
- return zeniAPI
15
- .getJSON(`${zeniAPI.apiEndPoints.spendManagementMicroServiceBaseUrl}/1.0/bulk/reimbursements/transactions/validate?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
16
- .pipe((0, operators_1.mergeMap)((response) => {
17
- var _a, _b;
18
- if ((0, responsePayload_1.isSuccessStatus)(response)) {
19
- const actions = [];
20
- actions.push((0, remisBulkActionViewReducer_1.reviewDraftRemisBulkActionSuccess)((_b = (_a = response.data) === null || _a === void 0 ? void 0 : _a.validation_results) !== null && _b !== void 0 ? _b : []));
21
- return (0, rxjs_1.from)(actions);
22
- }
23
- else {
24
- return (0, rxjs_1.of)((0, remisBulkActionViewReducer_1.reviewDraftRemisBulkActionFailure)(response.status));
25
- }
26
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, remisBulkActionViewReducer_1.reviewDraftRemisBulkActionFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Remi bulk review action REST API call errored out ' +
27
- JSON.stringify(error))))));
28
- }));
29
- exports.reviewDraftRemisBulkActionEpic = reviewDraftRemisBulkActionEpic;
@@ -1,8 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { ZeniAPI } from '../../../../../zeniAPI';
3
- import { RootState } from '../../../../../reducer';
4
- import { updateReimbursementsWithBulkActionStatus } from '../../../../../entity/reimbursement/reimbursementReducer';
5
- import { openSnackbar } from '../../../../../entity/snackbar/snackbarReducer';
6
- import { remisBulkActionFailure, submitDraftRemisBulkAction, remisBulkActionSuccess } from '../remisBulkActionViewReducer';
7
- export declare type ActionType = ReturnType<typeof submitDraftRemisBulkAction> | ReturnType<typeof updateReimbursementsWithBulkActionStatus> | ReturnType<typeof openSnackbar> | ReturnType<typeof remisBulkActionFailure> | ReturnType<typeof remisBulkActionSuccess>;
8
- export declare const submitDraftRemisBulkActionEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<ActionType>;