@zeniai/client-epic-state 4.7.74 → 4.7.76

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 (155) hide show
  1. package/lib/commonStateTypes/workingDayHelper.d.ts +9 -5
  2. package/lib/commonStateTypes/workingDayHelper.js +36 -12
  3. package/lib/entity/account/accountPayload.d.ts +1 -1
  4. package/lib/entity/billPay/billTransaction/billTransactionPayload.d.ts +3 -0
  5. package/lib/entity/billPay/billTransaction/billTransactionPayload.js +2 -2
  6. package/lib/entity/billPay/billTransaction/billTransactionState.d.ts +3 -0
  7. package/lib/entity/billPay/recurringBills/recurringBillsPayload.d.ts +34 -0
  8. package/lib/entity/billPay/recurringBills/recurringBillsPayload.js +44 -0
  9. package/lib/entity/billPay/recurringBills/recurringBillsReducer.d.ts +6 -0
  10. package/lib/entity/billPay/recurringBills/recurringBillsReducer.js +40 -0
  11. package/lib/entity/billPay/recurringBills/recurringBillsState.d.ts +33 -0
  12. package/lib/entity/billPay/recurringBills/recurringBillsState.js +14 -0
  13. package/lib/entity/chargeCard/chargeCard.d.ts +3 -2
  14. package/lib/entity/chargeCard/chargeCardPayload.d.ts +4 -14
  15. package/lib/entity/chargeCard/chargeCardPayload.js +1 -0
  16. package/lib/entity/depositAccount/depositAccountPayload.d.ts +2 -5
  17. package/lib/entity/entityApprovalStatus/entityApprovalStatusPayload.d.ts +1 -0
  18. package/lib/entity/entityApprovalStatus/entityApprovalStatusPayload.js +1 -0
  19. package/lib/entity/entityApprovalStatus/entityApprovalStatusState.d.ts +1 -0
  20. package/lib/entity/paymentAccount/paymentAccountPayload.d.ts +1 -0
  21. package/lib/entity/paymentAccount/paymentAccountPayload.js +2 -1
  22. package/lib/entity/paymentAccount/paymentAccountSelector.d.ts +2 -0
  23. package/lib/entity/paymentAccount/paymentAccountSelector.js +14 -1
  24. package/lib/entity/paymentAccount/paymentAccountState.d.ts +1 -0
  25. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  26. package/lib/entity/snackbar/snackbarTypes.js +1 -0
  27. package/lib/entity/tenant/clearAllEpic.d.ts +5 -2
  28. package/lib/entity/tenant/clearAllEpic.js +6 -0
  29. package/lib/entity/transaction/payloadTypes/transactionLinePayload.d.ts +2 -2
  30. package/lib/entity/transaction/payloadTypes/transactionLinePayload.js +2 -2
  31. package/lib/entity/transaction/stateTypes/attachment.js +5 -5
  32. package/lib/epic.d.ts +9 -10
  33. package/lib/epic.js +9 -10
  34. package/lib/index.d.ts +26 -14
  35. package/lib/index.js +37 -22
  36. package/lib/reducer.d.ts +9 -0
  37. package/lib/reducer.js +9 -0
  38. package/lib/view/accountList/accountListReducer.js +2 -1
  39. package/lib/view/accountList/accountListState.d.ts +1 -1
  40. package/lib/view/accountList/fetchAccountListEpic.js +16 -7
  41. package/lib/view/commonVendorView/vendorView/epics/saveVendorEpic.js +1 -0
  42. package/lib/view/commonVendorView/vendorView/epics/twoFactorAuth/verifyUserEpic.d.ts +2 -2
  43. package/lib/view/commonVendorView/vendorView/epics/twoFactorAuth/verifyUserEpic.js +2 -2
  44. package/lib/view/commonVendorView/vendorView/vendorViewReducer.d.ts +4 -9
  45. package/lib/view/commonVendorView/vendorView/vendorViewReducer.js +41 -70
  46. package/lib/view/commonVendorView/vendorView/vendorViewSelector.js +2 -2
  47. package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.d.ts +2 -9
  48. package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.js +70 -102
  49. package/lib/view/people/changeZeniPersonRolesEpic.d.ts +1 -1
  50. package/lib/view/people/deletePersonEpic.d.ts +1 -1
  51. package/lib/view/people/invitePeopleEpic.d.ts +1 -1
  52. package/lib/view/people/inviteZeniPeopleEpic.d.ts +1 -1
  53. package/lib/view/people/resendInviteEpic.d.ts +1 -1
  54. package/lib/view/settingsView/epic/fetchBankAccountsListEpic.d.ts +22 -0
  55. package/lib/view/settingsView/epic/fetchBankAccountsListEpic.js +30 -0
  56. package/lib/view/settingsView/epic/fetchBankConnectionsViewEpic.d.ts +6 -0
  57. package/lib/view/settingsView/epic/fetchBankConnectionsViewEpic.js +14 -0
  58. package/lib/view/settingsView/epic/fetchMyProfileEpic.d.ts +43 -0
  59. package/lib/view/settingsView/epic/fetchMyProfileEpic.js +50 -0
  60. package/lib/view/settingsView/epic/fetchMyProfileViewEpic.d.ts +7 -0
  61. package/lib/view/settingsView/epic/fetchMyProfileViewEpic.js +17 -0
  62. package/lib/view/settingsView/settingsViewPayload.d.ts +8 -0
  63. package/lib/view/settingsView/settingsViewReducer.d.ts +13 -0
  64. package/lib/view/settingsView/settingsViewReducer.js +71 -0
  65. package/lib/view/settingsView/settingsViewSelector.d.ts +14 -0
  66. package/lib/view/settingsView/settingsViewSelector.js +119 -0
  67. package/lib/view/settingsView/settingsViewState.d.ts +12 -0
  68. package/lib/view/settingsView/settingsViewState.js +2 -0
  69. package/lib/view/settingsView/types/settingsViewSelectorTypes.d.ts +29 -0
  70. package/lib/view/settingsView/types/settingsViewSelectorTypes.js +2 -0
  71. package/lib/view/spendManagement/billPay/billDetailView/billDetailViewPayload.d.ts +3 -0
  72. package/lib/view/spendManagement/billPay/billDetailView/billDetailViewSelector.d.ts +5 -0
  73. package/lib/view/spendManagement/billPay/billDetailView/billDetailViewSelector.js +13 -2
  74. package/lib/view/spendManagement/billPay/billDetailView/epics/cancelAndDeleteBillEpic.d.ts +2 -1
  75. package/lib/view/spendManagement/billPay/billDetailView/epics/cancelAndDeleteBillEpic.js +19 -8
  76. package/lib/view/spendManagement/billPay/billDetailView/epics/deleteBillEpic.d.ts +2 -1
  77. package/lib/view/spendManagement/billPay/billDetailView/epics/deleteBillEpic.js +14 -4
  78. package/lib/view/spendManagement/billPay/billDetailView/epics/fetchBillDetailEpic.d.ts +2 -1
  79. package/lib/view/spendManagement/billPay/billDetailView/epics/fetchBillDetailEpic.js +5 -2
  80. package/lib/view/spendManagement/billPay/billList/billListPayload.d.ts +2 -0
  81. package/lib/view/spendManagement/billPay/billList/billListSelector.d.ts +3 -0
  82. package/lib/view/spendManagement/billPay/billList/billListSelector.js +10 -2
  83. package/lib/view/spendManagement/billPay/billList/fetchBillListPerTabEpic.d.ts +2 -1
  84. package/lib/view/spendManagement/billPay/billList/fetchBillListPerTabEpic.js +3 -1
  85. package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.d.ts +4 -0
  86. package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +31 -9
  87. package/lib/view/spendManagement/billPay/editBillView/editBillViewPayload.d.ts +4 -0
  88. package/lib/view/spendManagement/billPay/editBillView/editBillViewReducer.js +17 -0
  89. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.d.ts +10 -2
  90. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +59 -14
  91. package/lib/view/spendManagement/billPay/editBillView/editBillViewState.d.ts +28 -0
  92. package/lib/view/spendManagement/billPay/editBillView/editBillViewState.js +1 -0
  93. package/lib/view/spendManagement/billPay/editBillView/epics/fetchEditBillDetailPageEpic.js +3 -3
  94. package/lib/view/spendManagement/billPay/editBillView/epics/initializeBillToLocalStoreEpic.js +13 -2
  95. package/lib/view/spendManagement/billPay/editBillView/epics/parseInvoiceToBillEpic.js +3 -2
  96. package/lib/view/spendManagement/billPay/editBillView/epics/saveBillDetailEpic.d.ts +11 -24
  97. package/lib/view/spendManagement/billPay/editBillView/epics/saveBillDetailEpic.js +100 -14
  98. package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigPayload.d.ts +2 -1
  99. package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer.js +4 -1
  100. package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigState.d.ts +2 -2
  101. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetail.d.ts +1 -0
  102. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetail.js +4 -0
  103. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.d.ts +7 -0
  104. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.js +25 -2
  105. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailSelector.d.ts +3 -0
  106. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailSelector.js +6 -1
  107. package/lib/view/spendManagement/chargeCards/chargeCardDetail/updateChargeCardDetailEpic.d.ts +11 -0
  108. package/lib/view/spendManagement/chargeCards/chargeCardDetail/updateChargeCardDetailEpic.js +60 -0
  109. package/lib/view/spendManagement/commonHistoryView/commonHistory.d.ts +1 -0
  110. package/lib/view/spendManagement/commonHistoryView/commonHistoryPayload.d.ts +1 -0
  111. package/lib/view/spendManagement/commonHistoryView/commonHistoryPayload.js +9 -5
  112. package/lib/view/spendManagement/commonSetup/setupViewReducer.d.ts +2 -9
  113. package/lib/view/spendManagement/commonSetup/setupViewReducer.js +72 -104
  114. package/lib/view/spendManagement/helpers.d.ts +11 -1
  115. package/lib/view/spendManagement/helpers.js +134 -1
  116. package/lib/view/spendManagement/reimbursement/remiDetailView/remiDetailViewSelector.d.ts +1 -0
  117. package/lib/view/spendManagement/zeniAccounts/zeniAccountsConfig/zeniAccountsConfigPayload.d.ts +1 -0
  118. package/lib/view/spendManagement/zeniAccounts/zeniAccountsConfig/zeniAccountsConfigPayload.js +1 -0
  119. package/lib/view/spendManagement/zeniAccounts/zeniAccountsConfig/zeniAccountsConfigReducer.js +3 -1
  120. package/lib/view/spendManagement/zeniAccounts/zeniAccountsConfig/zeniAccountsConfigSelector.d.ts +1 -0
  121. package/lib/view/spendManagement/zeniAccounts/zeniAccountsConfig/zeniAccountsConfigSelector.js +2 -1
  122. package/lib/view/spendManagement/zeniAccounts/zeniAccountsConfig/zeniAccountsConfigState.d.ts +1 -0
  123. package/lib/view/twoFactorAuthentication/resendOtpEpic.d.ts +10 -0
  124. package/lib/view/twoFactorAuthentication/resendOtpEpic.js +90 -0
  125. package/lib/view/twoFactorAuthentication/sendOtpEpic.d.ts +10 -0
  126. package/lib/view/twoFactorAuthentication/sendOtpEpic.js +93 -0
  127. package/lib/view/twoFactorAuthentication/twoFactorAuthentication.d.ts +16 -0
  128. package/lib/view/twoFactorAuthentication/twoFactorAuthentication.js +2 -0
  129. package/lib/view/twoFactorAuthentication/twoFactorAuthenticationPayload.d.ts +19 -0
  130. package/lib/view/twoFactorAuthentication/twoFactorAuthenticationPayload.js +11 -0
  131. package/lib/view/twoFactorAuthentication/twoFactorAuthenticationReducer.d.ts +21 -0
  132. package/lib/view/twoFactorAuthentication/twoFactorAuthenticationReducer.js +101 -0
  133. package/lib/view/twoFactorAuthentication/verifyOtpEpic.d.ts +10 -0
  134. package/lib/view/twoFactorAuthentication/verifyOtpEpic.js +90 -0
  135. package/package.json +5 -4
  136. package/lib/view/commonVendorView/vendorView/epics/twoFactorAuth/vendorViewResendOtpEpic.d.ts +0 -7
  137. package/lib/view/commonVendorView/vendorView/epics/twoFactorAuth/vendorViewResendOtpEpic.js +0 -24
  138. package/lib/view/commonVendorView/vendorView/epics/twoFactorAuth/vendorViewSendOtpEpic.d.ts +0 -7
  139. package/lib/view/commonVendorView/vendorView/epics/twoFactorAuth/vendorViewSendOtpEpic.js +0 -26
  140. package/lib/view/commonVendorView/vendorView/epics/twoFactorAuth/vendorViewVerifyOtpEpic.d.ts +0 -7
  141. package/lib/view/commonVendorView/vendorView/epics/twoFactorAuth/vendorViewVerifyOtpEpic.js +0 -28
  142. package/lib/view/onboardingView/customerView/epic/twoFactorAuthentication/resendOnboardingOfficerOtpEpic.d.ts +0 -7
  143. package/lib/view/onboardingView/customerView/epic/twoFactorAuthentication/resendOnboardingOfficerOtpEpic.js +0 -24
  144. package/lib/view/onboardingView/customerView/epic/twoFactorAuthentication/sendOnboardingOfficerOtpEpic.d.ts +0 -7
  145. package/lib/view/onboardingView/customerView/epic/twoFactorAuthentication/sendOnboardingOfficerOtpEpic.js +0 -27
  146. package/lib/view/onboardingView/customerView/epic/twoFactorAuthentication/verifyOnboardingOfficerOtpEpic.d.ts +0 -7
  147. package/lib/view/onboardingView/customerView/epic/twoFactorAuthentication/verifyOnboardingOfficerOtpEpic.js +0 -30
  148. package/lib/view/spendManagement/commonSetup/epic/twoFactorAuthentication/resendOtpEpic.d.ts +0 -7
  149. package/lib/view/spendManagement/commonSetup/epic/twoFactorAuthentication/resendOtpEpic.js +0 -23
  150. package/lib/view/spendManagement/commonSetup/epic/twoFactorAuthentication/sendOtpEpic.d.ts +0 -7
  151. package/lib/view/spendManagement/commonSetup/epic/twoFactorAuthentication/sendOtpEpic.js +0 -26
  152. package/lib/view/spendManagement/commonSetup/epic/twoFactorAuthentication/verifyOtpEpic.d.ts +0 -7
  153. package/lib/view/spendManagement/commonSetup/epic/twoFactorAuthentication/verifyOtpEpic.js +0 -27
  154. package/lib/view/spendManagement/commonSetup/types/twoFactorAuthentication.d.ts +0 -10
  155. /package/lib/view/{spendManagement/commonSetup/types/twoFactorAuthentication.js → settingsView/settingsViewPayload.js} +0 -0
@@ -0,0 +1,43 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { fetchMyProfile, updateMyProfileOnSuccess, updateMyProfileOnFailure } from '../settingsViewReducer';
3
+ import { ZeniAPI } from '../../../zeniAPI';
4
+ import { UserPayload } from '../../../entity/user/userPayload';
5
+ import { RootState } from '../../../reducer';
6
+ import { updateUserRoles } from '../../../entity/userRole/userRoleReducer';
7
+ import { updateAllUsers } from '../../../entity/user/userReducer';
8
+ import { updateUserIds } from '../../userListView/userListViewReducer';
9
+ import { UserRolePayload } from '../../../entity/userRole/userRolePayload';
10
+ import { ID } from '../../../commonStateTypes/common';
11
+ export declare type ActionType = ReturnType<typeof fetchMyProfile> | ReturnType<typeof updateUserRoles> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateMyProfileOnSuccess> | ReturnType<typeof updateUserIds> | ReturnType<typeof updateMyProfileOnFailure>;
12
+ export declare const fetchMyProfileEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
13
+ payload: undefined;
14
+ type: string;
15
+ } | {
16
+ payload: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>>;
17
+ type: string;
18
+ } | {
19
+ payload: {
20
+ users: UserPayload[];
21
+ updateType?: import("../../../commonStateTypes/common").UpdateType | undefined;
22
+ };
23
+ type: string;
24
+ } | {
25
+ payload: UserRolePayload[];
26
+ type: string;
27
+ } | {
28
+ payload: {
29
+ userType: import("../../userListView/userListViewState").UserListType;
30
+ usersPayload: UserPayload[];
31
+ };
32
+ type: string;
33
+ } | {
34
+ payload: {
35
+ userId: string;
36
+ };
37
+ type: string;
38
+ }>;
39
+ /**
40
+ * Helpers
41
+ */
42
+ export declare function getUserPayloadByUserId(userId: ID | undefined, usersPayload: UserPayload[]): UserPayload[] | undefined;
43
+ export declare function getManagerUserIdFromUserRolesPayloadByUserId(userId: ID | undefined, userRolesPayload: UserRolePayload[]): ID | undefined;
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getManagerUserIdFromUserRolesPayloadByUserId = exports.getUserPayloadByUserId = exports.fetchMyProfileEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const settingsViewReducer_1 = require("../settingsViewReducer");
7
+ const responsePayload_1 = require("../../../responsePayload");
8
+ const userRoleReducer_1 = require("../../../entity/userRole/userRoleReducer");
9
+ const userReducer_1 = require("../../../entity/user/userReducer");
10
+ const userListViewReducer_1 = require("../../userListView/userListViewReducer");
11
+ const fetchMyProfileEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(settingsViewReducer_1.fetchMyProfile.match), (0, operators_1.switchMap)(() => {
12
+ const URL = `${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/settings/user-profile`;
13
+ const loggedInUser = state$.value.tenantState.loggedInUser;
14
+ return zeniAPI.getJSON(URL).pipe((0, operators_1.mergeMap)((response) => {
15
+ if ((0, responsePayload_1.isSuccessResponse)(response) &&
16
+ response.data != null &&
17
+ (loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.userId) != null) {
18
+ const loggedInUserPayload = getUserPayloadByUserId(loggedInUser.userId, response.data.users);
19
+ const managerUserPayload = getUserPayloadByUserId(getManagerUserIdFromUserRolesPayloadByUserId(loggedInUser.userId, response.data.user_roles), response.data.users);
20
+ const updateActions = [];
21
+ updateActions.push((0, userRoleReducer_1.updateUserRoles)(response.data.user_roles), (0, userReducer_1.updateAllUsers)({ users: response.data.users }), (0, settingsViewReducer_1.updateMyProfileOnSuccess)(loggedInUser.userId));
22
+ if (managerUserPayload && loggedInUserPayload != null) {
23
+ updateActions.push((0, userListViewReducer_1.updateUserIds)({
24
+ userType: 'manager',
25
+ usersPayload: managerUserPayload,
26
+ }));
27
+ }
28
+ return (0, rxjs_1.of)(...updateActions);
29
+ }
30
+ else {
31
+ return (0, rxjs_1.of)((0, settingsViewReducer_1.updateMyProfileOnFailure)(response.status));
32
+ }
33
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, settingsViewReducer_1.updateMyProfileOnFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'Fetch My Profile REST API call errored out' +
34
+ JSON.stringify(error))))));
35
+ }));
36
+ exports.fetchMyProfileEpic = fetchMyProfileEpic;
37
+ /**
38
+ * Helpers
39
+ */
40
+ function getUserPayloadByUserId(userId, usersPayload) {
41
+ const user = usersPayload.find((user) => user.user_id === userId);
42
+ return user ? [user] : undefined;
43
+ }
44
+ exports.getUserPayloadByUserId = getUserPayloadByUserId;
45
+ function getManagerUserIdFromUserRolesPayloadByUserId(userId, userRolesPayload) {
46
+ const userRoles = userRolesPayload.find((user) => user.user_id === userId);
47
+ const manager_user_id = userRoles === null || userRoles === void 0 ? void 0 : userRoles.manager_user_id;
48
+ return manager_user_id !== null && manager_user_id !== void 0 ? manager_user_id : undefined;
49
+ }
50
+ exports.getManagerUserIdFromUserRolesPayloadByUserId = getManagerUserIdFromUserRolesPayloadByUserId;
@@ -0,0 +1,7 @@
1
+ import { ActionsObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { fetchMyProfile } from '../settingsViewReducer';
4
+ import { fetchCompanyPassportView } from '../../companyView/companyViewReducer';
5
+ import { fetchClassList } from '../../classList/classListReducer';
6
+ export declare type ActionType = ReturnType<typeof fetchCompanyPassportView> | ReturnType<typeof fetchMyProfile> | ReturnType<typeof fetchClassList>;
7
+ export declare const fetchMyProfileViewEpic: (actions$: ActionsObservable<ActionType>) => Observable<ActionType>;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchMyProfileViewEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const settingsViewReducer_1 = require("../settingsViewReducer");
7
+ const companyViewReducer_1 = require("../../companyView/companyViewReducer");
8
+ const classListReducer_1 = require("../../classList/classListReducer");
9
+ const fetchMyProfileViewEpic = (actions$) => actions$.pipe((0, operators_1.filter)(settingsViewReducer_1.fetchMyProfileView.match), (0, operators_1.switchMap)((action) => {
10
+ const { companyId } = action.payload;
11
+ return (0, rxjs_1.from)([
12
+ (0, companyViewReducer_1.fetchCompanyPassportView)(companyId),
13
+ (0, classListReducer_1.fetchClassList)(),
14
+ (0, settingsViewReducer_1.fetchMyProfile)(),
15
+ ]);
16
+ }));
17
+ exports.fetchMyProfileViewEpic = fetchMyProfileViewEpic;
@@ -0,0 +1,8 @@
1
+ import { UserPayload } from '../../entity/user/userPayload';
2
+ import { UserRolePayload } from '../../entity/userRole/userRolePayload';
3
+ import { ZeniAPIResponse } from '../../responsePayload';
4
+ export interface MyProfilePeoplePayload {
5
+ user_roles: UserRolePayload[];
6
+ users: UserPayload[];
7
+ }
8
+ export declare type MyProfilePeopleResponse = ZeniAPIResponse<MyProfilePeoplePayload>;
@@ -0,0 +1,13 @@
1
+ import { ZeniAPIStatus } from '../../responsePayload';
2
+ import { SettingsViewState } from './settingsViewState';
3
+ import { ID } from '../../commonStateTypes/common';
4
+ export declare const initialState: SettingsViewState;
5
+ export declare const fetchMyProfileView: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[companyId: string], {
6
+ companyId: string;
7
+ }, string, never, never>, fetchMyProfile: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, updateMyProfileOnSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[userId: string], {
8
+ userId: string;
9
+ }, string, never, never>, updateMyProfileOnFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, string>, fetchBankConnectionsView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, updateBankConnectionOnSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
10
+ bankAccountIds: ID[];
11
+ }, string>, updateBankConnectionOnFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, string>, fetchBankAccountsList: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, clearSettingsView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
12
+ declare const _default: import("@reduxjs/toolkit").Reducer<SettingsViewState, import("@reduxjs/toolkit").AnyAction>;
13
+ export default _default;
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ var _a;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.clearSettingsView = exports.fetchBankAccountsList = exports.updateBankConnectionOnFailure = exports.updateBankConnectionOnSuccess = exports.fetchBankConnectionsView = exports.updateMyProfileOnFailure = exports.updateMyProfileOnSuccess = exports.fetchMyProfile = exports.fetchMyProfileView = exports.initialState = void 0;
5
+ const toolkit_1 = require("@reduxjs/toolkit");
6
+ exports.initialState = {
7
+ profile: {
8
+ fetchState: 'Not-Started',
9
+ error: undefined,
10
+ userId: null,
11
+ },
12
+ bankConnection: {
13
+ fetchState: 'Not-Started',
14
+ error: undefined,
15
+ bankAccountIds: [],
16
+ },
17
+ };
18
+ const settings = (0, toolkit_1.createSlice)({
19
+ name: 'settings',
20
+ initialState: exports.initialState,
21
+ reducers: {
22
+ fetchMyProfileView: {
23
+ reducer() {
24
+ // Do nothing.
25
+ },
26
+ // eslint-disable-next-line @typescript-eslint/no-inferrable-types
27
+ prepare(companyId) {
28
+ return { payload: { companyId } };
29
+ },
30
+ },
31
+ fetchMyProfile(draft) {
32
+ draft.profile.fetchState = 'In-Progress';
33
+ draft.profile.error = undefined;
34
+ },
35
+ updateMyProfileOnSuccess: {
36
+ prepare(userId) {
37
+ return { payload: { userId } };
38
+ },
39
+ reducer(draft, action) {
40
+ draft.profile.fetchState = 'Completed';
41
+ draft.profile.error = undefined;
42
+ draft.profile.userId = action.payload.userId;
43
+ },
44
+ },
45
+ updateMyProfileOnFailure(draft, action) {
46
+ draft.profile.fetchState = 'Error';
47
+ draft.profile.error = action.payload;
48
+ },
49
+ fetchBankConnectionsView() {
50
+ // Do nothing.
51
+ },
52
+ fetchBankAccountsList(draft) {
53
+ draft.bankConnection.fetchState = 'In-Progress';
54
+ draft.bankConnection.error = undefined;
55
+ },
56
+ updateBankConnectionOnSuccess(draft, action) {
57
+ draft.bankConnection.fetchState = 'Completed';
58
+ draft.bankConnection.error = undefined;
59
+ draft.bankConnection.bankAccountIds = action.payload.bankAccountIds;
60
+ },
61
+ updateBankConnectionOnFailure(draft, action) {
62
+ draft.bankConnection.fetchState = 'Error';
63
+ draft.bankConnection.error = action.payload;
64
+ },
65
+ clearSettingsView(draft) {
66
+ Object.assign(draft, exports.initialState);
67
+ },
68
+ },
69
+ });
70
+ _a = settings.actions, exports.fetchMyProfileView = _a.fetchMyProfileView, exports.fetchMyProfile = _a.fetchMyProfile, exports.updateMyProfileOnSuccess = _a.updateMyProfileOnSuccess, exports.updateMyProfileOnFailure = _a.updateMyProfileOnFailure, exports.fetchBankConnectionsView = _a.fetchBankConnectionsView, exports.updateBankConnectionOnSuccess = _a.updateBankConnectionOnSuccess, exports.updateBankConnectionOnFailure = _a.updateBankConnectionOnFailure, exports.fetchBankAccountsList = _a.fetchBankAccountsList, exports.clearSettingsView = _a.clearSettingsView;
71
+ exports.default = settings.reducer;
@@ -0,0 +1,14 @@
1
+ import { RootState } from '../../reducer';
2
+ import { FetchStateAndError, ID } from '../../commonStateTypes/common';
3
+ import { TenantExternalConnections } from '../../entity/tenant/tenantState';
4
+ import { Company } from '../../entity/company/companyStateTypes';
5
+ import { MyBankConnectionsView, BankConnectionsSetupView, MyProfileSelectorView } from './types/settingsViewSelectorTypes';
6
+ export declare function getApprovalRuleViewDetails(state: RootState): FetchStateAndError;
7
+ export declare function getBankConnectionsSetupViewDetails(state: RootState, companyId: ID): BankConnectionsSetupView;
8
+ export declare function getMyBankConnectionsDetails(state: RootState, userId: ID): MyBankConnectionsView;
9
+ export interface IntegrationsView {
10
+ externalConnections: TenantExternalConnections | undefined;
11
+ companyView: Company | undefined;
12
+ }
13
+ export declare function getIntegrationsView(state: RootState, companyId: ID): IntegrationsView;
14
+ export declare const getMyProfileView: (state: RootState) => MyProfileSelectorView;
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getMyProfileView = exports.getIntegrationsView = exports.getMyBankConnectionsDetails = exports.getBankConnectionsSetupViewDetails = exports.getApprovalRuleViewDetails = void 0;
4
+ const toolkit_1 = require("@reduxjs/toolkit");
5
+ const tenantSelector_1 = require("../../entity/tenant/tenantSelector");
6
+ const companySelector_1 = require("../../entity/company/companySelector");
7
+ const userRoleSelector_1 = require("../../entity/userRole/userRoleSelector");
8
+ const userSelector_1 = require("../../entity/user/userSelector");
9
+ const accountSelector_1 = require("../../entity/account/accountSelector");
10
+ const paymentAccountSelector_1 = require("../../entity/paymentAccount/paymentAccountSelector");
11
+ const classSelector_1 = require("../../entity/class/classSelector");
12
+ const classSelectorV2_1 = require("../../entity/class/classSelectorV2");
13
+ const userListViewSelector_1 = require("../userListView/userListViewSelector");
14
+ const reduceFetchState_1 = require("../../commonStateTypes/reduceFetchState");
15
+ const companyPassportViewSelector_1 = require("../companyView/selector/companyPassportViewSelector");
16
+ const userFinancialAccountSelector_1 = require("../userFinancialAccount/userFinancialAccountSelector");
17
+ const setupViewSelector_1 = require("../../view/spendManagement/commonSetup/setupViewSelector");
18
+ function getApprovalRuleViewDetails(state) {
19
+ const { billPaySetupApproverViewState, remiSetupApproverViewState } = state;
20
+ const fetchState = (0, reduceFetchState_1.reduceAnyFetchState)([
21
+ billPaySetupApproverViewState,
22
+ remiSetupApproverViewState,
23
+ ]);
24
+ return {
25
+ fetchState: fetchState.fetchState,
26
+ };
27
+ }
28
+ exports.getApprovalRuleViewDetails = getApprovalRuleViewDetails;
29
+ function getBankConnectionsSetupViewDetails(state, companyId) {
30
+ const { accountState, setupViewState, settingsViewState } = state;
31
+ const { bankConnection } = settingsViewState;
32
+ const allBankAccounts = bankConnection.bankAccountIds
33
+ .map((accountId) => (0, accountSelector_1.getAccountBase)(accountState, accountId, 'bill_pay'))
34
+ .filter((account) => account != null);
35
+ const fetchState = (0, reduceFetchState_1.reduceAnyFetchState)([
36
+ settingsViewState.bankConnection,
37
+ setupViewState.accountDetails.fetchStatus,
38
+ ]);
39
+ return {
40
+ setupView: Object.assign(Object.assign({}, (0, setupViewSelector_1.getCommonSetupViewDetails)(state, companyId, 'bill_pay')), { allBankAccounts }),
41
+ fetchState: fetchState.fetchState,
42
+ };
43
+ }
44
+ exports.getBankConnectionsSetupViewDetails = getBankConnectionsSetupViewDetails;
45
+ function getMyBankConnectionsDetails(state, userId) {
46
+ var _a, _b;
47
+ const userFinancialAccount = (0, userFinancialAccountSelector_1.getUserFinancialAccount)(state, userId);
48
+ const paymentAccounts = (0, paymentAccountSelector_1.getPaymentAccountsByBankAccountIds)(state.paymentAccountState, (_b = (_a = state.userFinancialAccountState.financialAccountByUserId[userId]) === null || _a === void 0 ? void 0 : _a.bankAccountIds) !== null && _b !== void 0 ? _b : []);
49
+ return Object.assign(Object.assign({}, userFinancialAccount), { paymentAccounts });
50
+ }
51
+ exports.getMyBankConnectionsDetails = getMyBankConnectionsDetails;
52
+ function getIntegrationsView(state, companyId) {
53
+ var _a;
54
+ const externalConnections = (0, tenantSelector_1.getCurrentTenantExternalConnections)(state.tenantState, state.companyState);
55
+ const companyView = (_a = (0, companySelector_1.getCompanyByCompanyId)(state.companyState, companyId)) === null || _a === void 0 ? void 0 : _a.company;
56
+ return {
57
+ externalConnections,
58
+ companyView,
59
+ };
60
+ }
61
+ exports.getIntegrationsView = getIntegrationsView;
62
+ exports.getMyProfileView = (0, toolkit_1.createSelector)((state) => state.tenantState, (state) => state.userState, (state) => state.userRoleState, (state) => state.settingsViewState, (state) => state.classState, (state) => state.classListState, (state) => (0, companyPassportViewSelector_1.getCompanyPassportView)(state), (state) => (0, userListViewSelector_1.getUserList)(state, 'manager'), (tenantState, userState, userRoleState, settingsViewState, classState, classListState, companyPassportView, managersListView) => {
63
+ var _a, _b, _c, _d;
64
+ const userId = (_a = tenantState.loggedInUser) === null || _a === void 0 ? void 0 : _a.userId;
65
+ if (userId == null) {
66
+ throw new Error(`User not logged in`);
67
+ }
68
+ const user = (0, userSelector_1.getUserByUserId)(userState, userId);
69
+ const userRole = (0, userRoleSelector_1.getUserRoleByUserId)(userRoleState, userId);
70
+ const person = {
71
+ userId,
72
+ user,
73
+ userRole,
74
+ };
75
+ const isZeniUser = (_b = userRole === null || userRole === void 0 ? void 0 : userRole.isZeni) !== null && _b !== void 0 ? _b : true;
76
+ const departmentIds = (_c = userRole === null || userRole === void 0 ? void 0 : userRole.accountingClassIDs) !== null && _c !== void 0 ? _c : [];
77
+ const classList = (0, classSelectorV2_1.getClassesByIds)(classState, {
78
+ classIds: classListState.classIds,
79
+ reportId: 'class_list',
80
+ });
81
+ const department = departmentIds.length > 0
82
+ ? (0, classSelector_1.getClassById)(classState, {
83
+ classId: departmentIds[0],
84
+ reportId: 'class_list',
85
+ })
86
+ : undefined;
87
+ const fetchState = (0, reduceFetchState_1.reduceAnyFetchState)([
88
+ settingsViewState.profile,
89
+ companyPassportView,
90
+ classListState,
91
+ ]);
92
+ const controllersList = ((_d = companyPassportView.companyView) === null || _d === void 0 ? void 0 : _d.controllers) != null
93
+ ? companyPassportView.companyView.controllers.map((controller) => controller.user)
94
+ : [];
95
+ const myProfilePeopleView = {
96
+ fetchState: fetchState.fetchState,
97
+ error: fetchState.error,
98
+ isZeniUser,
99
+ person,
100
+ department,
101
+ classList,
102
+ controllersList,
103
+ managersList: managersListView.users,
104
+ };
105
+ const managerId = userRole === null || userRole === void 0 ? void 0 : userRole.managerUserId;
106
+ if (managerId != null) {
107
+ const managerUser = (0, userSelector_1.getUserByUserId)(userState, managerId);
108
+ const managerUserRole = (0, userRoleSelector_1.getUserRoleByUserId)(userRoleState, managerId);
109
+ if (managerUser != null) {
110
+ const manager = {
111
+ userId: managerId,
112
+ user: managerUser,
113
+ userRole: managerUserRole,
114
+ };
115
+ return Object.assign(Object.assign({}, myProfilePeopleView), { manager });
116
+ }
117
+ }
118
+ return myProfilePeopleView;
119
+ });
@@ -0,0 +1,12 @@
1
+ import { ID, FetchStateAndError } from '../../commonStateTypes/common';
2
+ interface MyProfile extends FetchStateAndError {
3
+ userId: ID | null;
4
+ }
5
+ interface BankConnection extends FetchStateAndError {
6
+ bankAccountIds: ID[];
7
+ }
8
+ export interface SettingsViewState {
9
+ profile: MyProfile;
10
+ bankConnection: BankConnection;
11
+ }
12
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,29 @@
1
+ import { ID, FetchStateAndError } from '../../../commonStateTypes/common';
2
+ import { SelectorView } from '../../../commonStateTypes/viewAndReport/viewAndReport';
3
+ import { Class } from '../../../entity/class/classState';
4
+ import { PaymentAccount } from '../../../entity/paymentAccount/paymentAccountState';
5
+ import { User } from '../../../entity/user/userState';
6
+ import { UserRole } from '../../../entity/userRole/userRoleState';
7
+ import { Person } from '../../people/peopleSelectorTypes';
8
+ import { SetupView } from '../../spendManagement/commonSetup/setupViewSelector';
9
+ import { UserFinancialAccountSelectorView } from '../../userFinancialAccount/userFinancialAccountSelector';
10
+ export interface MyProfileSelectorView extends SelectorView {
11
+ isZeniUser: boolean;
12
+ person: MyProfile;
13
+ classList: Class[];
14
+ managersList: Person[];
15
+ controllersList: User[];
16
+ manager?: MyProfile;
17
+ department?: Class;
18
+ }
19
+ export interface MyProfile {
20
+ userId: ID;
21
+ user: User | undefined;
22
+ userRole: UserRole | undefined;
23
+ }
24
+ export interface MyBankConnectionsView extends UserFinancialAccountSelectorView {
25
+ paymentAccounts: PaymentAccount[];
26
+ }
27
+ export interface BankConnectionsSetupView extends FetchStateAndError {
28
+ setupView: SetupView;
29
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -8,6 +8,7 @@ import { UserPayload } from '../../../../entity/user/userPayload';
8
8
  import { ZeniAPIResponse } from '../../../../responsePayload';
9
9
  import { VendorPayload } from '../../../../entity/vendor/vendorPayload';
10
10
  import { PaymentInstrumentPayload } from '../../../../entity/paymentInstrument/paymentInstrumentPayload';
11
+ import { RecurringBillConfigResponsePayload, RecurringBillDataPayload } from '../../../../entity/billPay/recurringBills/recurringBillsPayload';
11
12
  export interface ApproveOrRejectBillPayload {
12
13
  approval_rules: ApprovalRulePayload[];
13
14
  users: UserPayload[];
@@ -20,6 +21,8 @@ export interface BillDetailViewPayload extends ApproveOrRejectBillPayload {
20
21
  payment_accounts: PaymentAccountPayload[];
21
22
  accounts: AccountPayload[];
22
23
  vendors: VendorPayload[];
24
+ recurring_bill_configs: RecurringBillConfigResponsePayload[];
25
+ recurring_bills: RecurringBillDataPayload[];
23
26
  query: BillDetailQuery;
24
27
  query_definitions: Record<string, unknown>;
25
28
  }
@@ -18,6 +18,7 @@ import { ActivityRealTimeApprovalSelectorView } from '../../realTimeApprovalView
18
18
  import { UserAndRole } from '../../../companyView/types/userAndRole';
19
19
  import { Class } from '../../../../entity/class/classState';
20
20
  import { PaymentInstrument } from '../../../../entity/paymentInstrument/paymentInstrument';
21
+ import { RecurringBillConfig, RecurringBillData } from '../../../../entity/billPay/recurringBills/recurringBillsState';
21
22
  export interface BillDetailViewSelector extends SelectorView {
22
23
  transactionDetails: BillTransaction | undefined;
23
24
  createdBy: User | undefined;
@@ -43,6 +44,9 @@ export interface BillDetailViewSelector extends SelectorView {
43
44
  approvalType?: BillApprovalType;
44
45
  paymentMethodType?: BillPayConfig;
45
46
  latestApprovedDate?: ZeniDate;
47
+ isRecurring: boolean;
48
+ recurringBillInstances?: RecurringBillData[];
49
+ recurringBillConfigDetail?: RecurringBillConfig;
46
50
  }
47
51
  export interface StepWithStatus extends StepWithUser {
48
52
  actorsActivity: ActorActivityWithUser[];
@@ -56,6 +60,7 @@ export interface ActorActivityWithUser {
56
60
  userId: ID;
57
61
  type: string;
58
62
  subType?: string;
63
+ isRecurringAutoApprove: boolean;
59
64
  }
60
65
  export interface BillActivity {
61
66
  approvalRuleId?: ID;
@@ -83,8 +83,8 @@ const getBillActivities = (state, billId, billStageCode) => {
83
83
  };
84
84
  exports.getBillActivities = getBillActivities;
85
85
  const getBillDetailView = (state, billId) => {
86
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
87
- const { accountState, bankAccountState, paymentInstrumentState, billDetailViewState, billTransactionState, paymentAccountState, userState, billPayConfigState, userRoleState, classListState, classState, commonHistoryState, realTimeApprovalState, entityApprovalStatusState, billPaySetupApproverViewState, vendorState, } = state;
86
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
87
+ const { accountState, bankAccountState, paymentInstrumentState, billDetailViewState, billTransactionState, paymentAccountState, userState, billPayConfigState, userRoleState, classListState, classState, commonHistoryState, realTimeApprovalState, entityApprovalStatusState, billPaySetupApproverViewState, vendorState, recurringBillState, } = state;
88
88
  const { approverListState } = billPaySetupApproverViewState;
89
89
  const detailKey = (0, billDetailViewState_1.getBillTransactionDetailKey)(billId !== null && billId !== void 0 ? billId : '');
90
90
  const billTransactionDetails = (0, get_1.default)(billDetailViewState.billDetailById, detailKey, undefined);
@@ -184,6 +184,14 @@ const getBillDetailView = (state, billId) => {
184
184
  reportId: 'class_list',
185
185
  });
186
186
  const currentVendorDetails = (0, get_1.default)(vendorState.vendorByID, (_o = billTransactionDetails === null || billTransactionDetails === void 0 ? void 0 : billTransactionDetails.vendorId) !== null && _o !== void 0 ? _o : '', undefined);
187
+ const isRecurring = (_p = transaction === null || transaction === void 0 ? void 0 : transaction.isRecurring) !== null && _p !== void 0 ? _p : false;
188
+ let recurringBillConfigDetail = undefined;
189
+ let recurringBillInstances = undefined;
190
+ if (isRecurring && (transaction === null || transaction === void 0 ? void 0 : transaction.recurringBillConfigId) != null) {
191
+ const recurringBillDetail = (0, get_1.default)(recurringBillState.recurringBillDetailByConfigId, transaction === null || transaction === void 0 ? void 0 : transaction.recurringBillConfigId, undefined);
192
+ recurringBillConfigDetail = recurringBillDetail === null || recurringBillDetail === void 0 ? void 0 : recurringBillDetail.recurringBillConfig;
193
+ recurringBillInstances = recurringBillDetail === null || recurringBillDetail === void 0 ? void 0 : recurringBillDetail.recurringBillInstances;
194
+ }
187
195
  return {
188
196
  fetchState: fetchState.fetchState,
189
197
  error: fetchState.error,
@@ -212,6 +220,9 @@ const getBillDetailView = (state, billId) => {
212
220
  approvalType,
213
221
  paymentMethodType: paymentMethodWithBillFees,
214
222
  latestApprovedDate: (0, helpers_1.getLatestApprovalDate)(billActivities),
223
+ isRecurring,
224
+ recurringBillInstances,
225
+ recurringBillConfigDetail,
215
226
  };
216
227
  };
217
228
  exports.getBillDetailView = getBillDetailView;
@@ -5,7 +5,8 @@ import { cancelAndDeleteBill, cancelAndDeleteBillSuccessOrFailure } from '../bil
5
5
  import { removeTransactionIdFromBillTabList } from '../../billList/billListReducer';
6
6
  import { removeBillTransaction } from '../../../../../entity/billPay/billTransaction/billTransactionReducer';
7
7
  import { openSnackbar } from '../../../../../entity/snackbar/snackbarReducer';
8
- export declare type ActionType = ReturnType<typeof cancelAndDeleteBill> | ReturnType<typeof removeBillTransaction> | ReturnType<typeof openSnackbar> | ReturnType<typeof cancelAndDeleteBillSuccessOrFailure> | ReturnType<typeof removeTransactionIdFromBillTabList>;
8
+ import { removeRecurringBill } from '../../../../../entity/billPay/recurringBills/recurringBillsReducer';
9
+ export declare type ActionType = ReturnType<typeof cancelAndDeleteBill> | ReturnType<typeof removeBillTransaction> | ReturnType<typeof openSnackbar> | ReturnType<typeof cancelAndDeleteBillSuccessOrFailure> | ReturnType<typeof removeTransactionIdFromBillTabList> | ReturnType<typeof removeRecurringBill>;
9
10
  export declare const cancelAndDeleteBillEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
10
11
  payload: import("../../../../../entity/billPay/billTransaction/billTransactionPayload").BillTransactionPayload;
11
12
  type: string;
@@ -9,22 +9,30 @@ const responsePayload_1 = require("../../../../../responsePayload");
9
9
  const billTransactionReducer_1 = require("../../../../../entity/billPay/billTransaction/billTransactionReducer");
10
10
  const billDetailViewState_1 = require("../billDetailViewState");
11
11
  const snackbarReducer_1 = require("../../../../../entity/snackbar/snackbarReducer");
12
+ const recurringBillsReducer_1 = require("../../../../../entity/billPay/recurringBills/recurringBillsReducer");
12
13
  const cancelAndDeleteBillEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(billDetailViewReducer_1.cancelAndDeleteBill.match), (0, operators_1.mergeMap)((action) => {
14
+ var _a;
13
15
  const query = {
14
16
  bill_pay_provider: 'zeni',
15
17
  is_delete_bill: action.payload.isDeleteBill,
16
18
  };
17
19
  const { billTransactionState } = state$.value;
18
20
  const transaction = billTransactionState.transactionById[action.payload.billId];
19
- return zeniAPI
20
- .putAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/bills/transactions/${action.payload.billId}/cancel-payment`, query)
21
- .pipe((0, operators_1.mergeMap)((response) => {
22
- var _a, _b;
21
+ const isRecurring = (_a = transaction === null || transaction === void 0 ? void 0 : transaction.isRecurring) !== null && _a !== void 0 ? _a : false;
22
+ const recurringConfigId = transaction === null || transaction === void 0 ? void 0 : transaction.recurringBillConfigId;
23
+ let cancelApiUrl = `${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/bills/transactions/${action.payload.billId}`;
24
+ if (isRecurring === true) {
25
+ cancelApiUrl = `${cancelApiUrl}/recurring/cancel-payment`;
26
+ }
27
+ else {
28
+ cancelApiUrl = `${cancelApiUrl}/cancel-payment`;
29
+ }
30
+ return zeniAPI.putAndGetJSON(cancelApiUrl, query).pipe((0, operators_1.mergeMap)((response) => {
31
+ var _a;
23
32
  if (action.payload.isDeleteBill === true &&
24
33
  (0, responsePayload_1.isSuccessStatus)(response)) {
25
- const actions = [
26
- (0, billDetailViewReducer_1.cancelAndDeleteBillSuccessOrFailure)('Completed', action.payload.billId, action.payload.isDeleteBill),
27
- ];
34
+ const actions = [];
35
+ actions.push((0, billDetailViewReducer_1.cancelAndDeleteBillSuccessOrFailure)('Completed', action.payload.billId, action.payload.isDeleteBill));
28
36
  if (transaction != null) {
29
37
  actions.push((0, billListReducer_1.removeTransactionIdFromBillTabList)({
30
38
  billId: action.payload.billId,
@@ -32,6 +40,9 @@ const cancelAndDeleteBillEpic = (actions$, state$, zeniAPI) => actions$.pipe((0,
32
40
  }));
33
41
  }
34
42
  actions.push((0, billTransactionReducer_1.removeBillTransaction)((0, billDetailViewState_1.getBillTransactionDetailKey)(action.payload.billId)));
43
+ if (isRecurring === true && recurringConfigId != null) {
44
+ actions.push((0, recurringBillsReducer_1.removeRecurringBill)(recurringConfigId));
45
+ }
35
46
  actions.push((0, snackbarReducer_1.openSnackbar)({
36
47
  messageSection: 'bill_pay_cancelled_deleted',
37
48
  messageText: 'success',
@@ -41,7 +52,7 @@ const cancelAndDeleteBillEpic = (actions$, state$, zeniAPI) => actions$.pipe((0,
41
52
  }
42
53
  else if ((0, responsePayload_1.isSuccessResponse)(response) &&
43
54
  response.data != null &&
44
- ((_b = (_a = response.data) === null || _a === void 0 ? void 0 : _a.transactions[0]) === null || _b === void 0 ? void 0 : _b.transaction_id) != null) {
55
+ ((_a = response.data.transactions[0]) === null || _a === void 0 ? void 0 : _a.transaction_id) != null) {
45
56
  return (0, rxjs_1.of)((0, billTransactionReducer_1.updateBillTransaction)(response.data.transactions[0]), (0, billDetailViewReducer_1.cancelAndDeleteBillSuccessOrFailure)('Completed', action.payload.billId, action.payload.isDeleteBill), (0, snackbarReducer_1.openSnackbar)({
46
57
  messageSection: 'bill_pay_cancelled',
47
58
  messageText: 'success',
@@ -5,5 +5,6 @@ import { deleteBill, deleteBillSuccessOrFailure } from '../billDetailViewReducer
5
5
  import { removeTransactionIdFromBillTabList } from '../../billList/billListReducer';
6
6
  import { removeBillTransaction } from '../../../../../entity/billPay/billTransaction/billTransactionReducer';
7
7
  import { openSnackbar } from '../../../../../entity/snackbar/snackbarReducer';
8
- export declare type ActionType = ReturnType<typeof deleteBill> | ReturnType<typeof removeBillTransaction> | ReturnType<typeof openSnackbar> | ReturnType<typeof removeTransactionIdFromBillTabList> | ReturnType<typeof deleteBillSuccessOrFailure>;
8
+ import { removeRecurringBill } from '../../../../../entity/billPay/recurringBills/recurringBillsReducer';
9
+ export declare type ActionType = ReturnType<typeof deleteBill> | ReturnType<typeof removeBillTransaction> | ReturnType<typeof openSnackbar> | ReturnType<typeof removeTransactionIdFromBillTabList> | ReturnType<typeof deleteBillSuccessOrFailure> | ReturnType<typeof removeRecurringBill>;
9
10
  export declare const deleteBillEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<ActionType>;
@@ -9,20 +9,27 @@ const responsePayload_1 = require("../../../../../responsePayload");
9
9
  const billTransactionReducer_1 = require("../../../../../entity/billPay/billTransaction/billTransactionReducer");
10
10
  const billDetailViewState_1 = require("../billDetailViewState");
11
11
  const snackbarReducer_1 = require("../../../../../entity/snackbar/snackbarReducer");
12
+ const recurringBillsReducer_1 = require("../../../../../entity/billPay/recurringBills/recurringBillsReducer");
12
13
  const deleteBillEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(billDetailViewReducer_1.deleteBill.match), (0, operators_1.mergeMap)((action) => {
14
+ var _a;
13
15
  const query = {
14
16
  transaction_type: 'bill',
15
17
  bill_pay_provider: 'zeni',
16
18
  };
17
19
  const { billTransactionState } = state$.value;
18
20
  const transaction = billTransactionState.transactionById[action.payload.billId];
21
+ const isRecurring = (_a = transaction === null || transaction === void 0 ? void 0 : transaction.isRecurring) !== null && _a !== void 0 ? _a : false;
22
+ const recurringConfigId = transaction === null || transaction === void 0 ? void 0 : transaction.recurringBillConfigId;
23
+ let deleteApiUrl = `${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/bills/transactions/${action.payload.billId}`;
24
+ if (isRecurring === true) {
25
+ deleteApiUrl = `${deleteApiUrl}/recurring`;
26
+ }
19
27
  return zeniAPI
20
- .deleteAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/bills/transactions/${action.payload.billId}?query=${encodeURIComponent(JSON.stringify(query))}`)
28
+ .deleteAndGetJSON(`${deleteApiUrl}?query=${encodeURIComponent(JSON.stringify(query))}`)
21
29
  .pipe((0, operators_1.mergeMap)((response) => {
22
30
  if ((0, responsePayload_1.isSuccessStatus)(response)) {
23
- const actions = [
24
- (0, billDetailViewReducer_1.deleteBillSuccessOrFailure)('Completed', action.payload.billId),
25
- ];
31
+ const actions = [];
32
+ actions.push((0, billDetailViewReducer_1.deleteBillSuccessOrFailure)('Completed', action.payload.billId));
26
33
  if (transaction != null) {
27
34
  actions.push((0, billListReducer_1.removeTransactionIdFromBillTabList)({
28
35
  billId: action.payload.billId,
@@ -30,6 +37,9 @@ const deleteBillEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operator
30
37
  }));
31
38
  }
32
39
  actions.push((0, billTransactionReducer_1.removeBillTransaction)((0, billDetailViewState_1.getBillTransactionDetailKey)(action.payload.billId)));
40
+ if (isRecurring === true && recurringConfigId != null) {
41
+ actions.push((0, recurringBillsReducer_1.removeRecurringBill)(recurringConfigId));
42
+ }
33
43
  actions.push((0, snackbarReducer_1.openSnackbar)({
34
44
  messageSection: 'bill_pay_deleted',
35
45
  messageText: 'success',
@@ -20,7 +20,8 @@ import { fetchVendorsList } from '../../../../vendorList/vendorListReducer';
20
20
  import { fetchDuplicateBill } from '../../billPayReview/billPayReviewReducer';
21
21
  import { updatePaymentInstruments } from '../../../../../entity/paymentInstrument/paymentInstrumentReducer';
22
22
  import { convertAmountToHomeCurrency } from '../../editBillView/editBillViewReducer';
23
- export declare type ActionType = ReturnType<typeof fetchBillDetail> | ReturnType<typeof updateBillTransaction> | ReturnType<typeof updateBankAccounts> | ReturnType<typeof updatePaymentInstruments> | ReturnType<typeof updateBillDetailFetchState> | ReturnType<typeof removeBillTransaction> | ReturnType<typeof removeBillDetail> | ReturnType<typeof updatePaymentAccounts> | ReturnType<typeof updateAccounts> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateApprovalRules> | ReturnType<typeof updateEntityApprovalStatus> | ReturnType<typeof fetchPreviousBills> | ReturnType<typeof updateBillDetail> | ReturnType<typeof updateClasses> | ReturnType<typeof updateVendors> | ReturnType<typeof updateContacts> | ReturnType<typeof updateAddresses> | ReturnType<typeof fetchEntityHistory> | ReturnType<typeof fetchVendorsList> | ReturnType<typeof fetchDuplicateBill> | ReturnType<typeof convertAmountToHomeCurrency> | ReturnType<typeof waitForVendorByNameThenUpdateBillDetail>;
23
+ import { updateRecurringBillConfigs, updateRecurringBills } from '../../../../../entity/billPay/recurringBills/recurringBillsReducer';
24
+ export declare type ActionType = ReturnType<typeof fetchBillDetail> | ReturnType<typeof updateBillTransaction> | ReturnType<typeof updateBankAccounts> | ReturnType<typeof updatePaymentInstruments> | ReturnType<typeof updateBillDetailFetchState> | ReturnType<typeof removeBillTransaction> | ReturnType<typeof removeBillDetail> | ReturnType<typeof updatePaymentAccounts> | ReturnType<typeof updateAccounts> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateApprovalRules> | ReturnType<typeof updateEntityApprovalStatus> | ReturnType<typeof fetchPreviousBills> | ReturnType<typeof updateBillDetail> | ReturnType<typeof updateClasses> | ReturnType<typeof updateVendors> | ReturnType<typeof updateContacts> | ReturnType<typeof updateAddresses> | ReturnType<typeof fetchEntityHistory> | ReturnType<typeof fetchVendorsList> | ReturnType<typeof fetchDuplicateBill> | ReturnType<typeof convertAmountToHomeCurrency> | ReturnType<typeof waitForVendorByNameThenUpdateBillDetail> | ReturnType<typeof updateRecurringBillConfigs> | ReturnType<typeof updateRecurringBills>;
24
25
  export declare const fetchBillDetailEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
25
26
  export declare const waitForVendorByNameThenUpdateBillDetailEpic: (actions$: ActionsObservable<ActionType>, _: StateObservable<RootState>) => Observable<{
26
27
  payload: {