@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
@@ -27,6 +27,7 @@ const commonHistoryReducer_1 = require("../../../commonHistoryView/commonHistory
27
27
  const vendorListReducer_1 = require("../../../../vendorList/vendorListReducer");
28
28
  const billPayReviewReducer_1 = require("../../billPayReview/billPayReviewReducer");
29
29
  const paymentInstrumentReducer_1 = require("../../../../../entity/paymentInstrument/paymentInstrumentReducer");
30
+ const recurringBillsReducer_1 = require("../../../../../entity/billPay/recurringBills/recurringBillsReducer");
30
31
  const fetchBillDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(billDetailViewReducer_1.fetchBillDetail.match), (0, operators_1.mergeMap)((action) => {
31
32
  const { billId, cacheOverride, isShowDeletedBillsEnabled } = action.payload;
32
33
  const detailKey = (0, billDetailViewState_1.getBillTransactionDetailKey)(billId);
@@ -71,6 +72,8 @@ const fetchBillDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, ope
71
72
  : [];
72
73
  const fetchActions = [
73
74
  ...getVendorPreviousBillsActions(response.data.transaction),
75
+ (0, recurringBillsReducer_1.updateRecurringBillConfigs)(response.data.recurring_bill_configs),
76
+ (0, recurringBillsReducer_1.updateRecurringBills)(response.data.recurring_bills),
74
77
  (0, billTransactionReducer_1.updateBillTransaction)(response.data.transaction),
75
78
  (0, paymentAccountReducer_1.updatePaymentAccounts)(response.data.payment_accounts),
76
79
  (0, accountReducer_1.updateAccounts)((_j = response.data.accounts) !== null && _j !== void 0 ? _j : [], 'bill_pay'),
@@ -91,8 +94,8 @@ const fetchBillDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, ope
91
94
  // end: save all vendor related entities
92
95
  ];
93
96
  if (vendorInResponse == null &&
94
- response.data.transaction.candidate_vendor_name != null
95
- && response.data.transaction.candidate_vendor_name.length > 0) {
97
+ response.data.transaction.candidate_vendor_name != null &&
98
+ response.data.transaction.candidate_vendor_name.length > 0) {
96
99
  fetchActions.push((0, vendorListReducer_1.fetchVendorsList)((_l = response.data) === null || _l === void 0 ? void 0 : _l.transaction.candidate_vendor_name));
97
100
  fetchActions.push((0, billDetailViewReducer_1.waitForVendorByNameThenUpdateBillDetail)(billId, response.data, (_m = response.data.vendors[0]) === null || _m === void 0 ? void 0 : _m.vendor_id));
98
101
  }
@@ -6,6 +6,7 @@ import { VendorPayload } from '../../../../entity/vendor/vendorPayload';
6
6
  import { ZeniAPIResponse } from '../../../../responsePayload';
7
7
  import { ID } from '../../../../commonStateTypes/common';
8
8
  import { UserPayload } from '../../../../entity/user/userPayload';
9
+ import { RecurringBillConfigResponsePayload } from '../../../../entity/billPay/recurringBills/recurringBillsPayload';
9
10
  export interface BillListPayload {
10
11
  customers: CustomerPayload[];
11
12
  query_definitions: Record<string, unknown>;
@@ -15,6 +16,7 @@ export interface BillListPayload {
15
16
  vendors: VendorPayload[];
16
17
  accounts: AccountBasePayload[];
17
18
  users: UserPayload[];
19
+ recurring_bill_configs: RecurringBillConfigResponsePayload[];
18
20
  query: {
19
21
  start_date: string;
20
22
  end_date: string;
@@ -9,8 +9,11 @@ import { UserState } from '../../../../entity/user/userState';
9
9
  import { EntityApprovalStatusState } from '../../../../entity/entityApprovalStatus/entityApprovalStatusState';
10
10
  import { SortOrder } from '../../../../commonStateTypes/selectorTypes/sortOrderTypes';
11
11
  import { Approvers } from '../../../../entity/approvalRule/approvalRuleState';
12
+ import { RecurringBillConfig } from '../../../../entity/billPay/recurringBills/recurringBillsState';
12
13
  export interface BillTransactionView extends BillTransaction {
13
14
  approvers: Approvers;
15
+ isRecurring: boolean;
16
+ recurringBillConfig?: RecurringBillConfig;
14
17
  }
15
18
  export interface BillListReport extends SelectorView {
16
19
  billOrder: EntityOrder;
@@ -15,7 +15,7 @@ const approvalRuleState_1 = require("../../../../entity/approvalRule/approvalRul
15
15
  const spendManagementFilterHelpers_1 = require("../../spendManagementFilterHelpers");
16
16
  const getBillList = (state, currentTimePeriod) => {
17
17
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
18
- const { billListState, billTransactionState, billPayConfigState, entityApprovalStatusState, userState, } = state;
18
+ const { billListState, billTransactionState, billPayConfigState, entityApprovalStatusState, userState, recurringBillState, } = state;
19
19
  const key = (0, billListState_1.getBillListKey)(currentTimePeriod, billListState.currentTab);
20
20
  const pendingApprovalKey = (0, billListState_1.getBillListKey)(currentTimePeriod, 'pending_approval');
21
21
  const billPayBotEmail = (0, billPayConfigSelector_1.getBillPayConfigBotEmail)(billPayConfigState);
@@ -106,7 +106,15 @@ const getBillList = (state, currentTimePeriod) => {
106
106
  if (entityApprovalStatusState.entityApprovalStatusById[transaction.entityApprovalId] != null) {
107
107
  approvers = (0, exports.getApproversOrRejectors)(transaction, entityApprovalStatusState, userState);
108
108
  }
109
- return Object.assign(Object.assign({}, transaction), { approvers });
109
+ const isRecurring = transaction.isRecurring;
110
+ let recurringBillDetail = undefined;
111
+ if (isRecurring && transaction.recurringBillConfigId != null) {
112
+ recurringBillDetail = (0, get_1.default)(recurringBillState.recurringBillDetailByConfigId, transaction.recurringBillConfigId, undefined);
113
+ }
114
+ const recurringBillConfig = recurringBillDetail === null || recurringBillDetail === void 0 ? void 0 : recurringBillDetail.recurringBillConfig;
115
+ return Object.assign(Object.assign({}, transaction), { approvers,
116
+ isRecurring,
117
+ recurringBillConfig });
110
118
  });
111
119
  transactionsView = (0, spendManagementFilterHelpers_1.applyAdvancedFiltersOnList)('bill_pay', transactionsView, billListState.filters);
112
120
  const TransactionsPendingForMyApprovalLength = pendingApprovalTransactionIDs.length;
@@ -6,5 +6,6 @@ import { updateBillTransactions } from '../../../../entity/billPay/billTransacti
6
6
  import { RootState } from '../../../../reducer';
7
7
  import { updateEntityApprovalStatus } from '../../../../entity/entityApprovalStatus/entityApprovalStatusReducer';
8
8
  import { updateAllUsers } from '../../../../entity/user/userReducer';
9
- export declare type ActionType = ReturnType<typeof fetchBillListPerTab> | ReturnType<typeof updateBillTransactions> | ReturnType<typeof updateBillListByStatus> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateBillListFailure> | ReturnType<typeof updateEntityApprovalStatus>;
9
+ import { updateRecurringBillConfigs, updateRecurringBills } from '../../../../entity/billPay/recurringBills/recurringBillsReducer';
10
+ export declare type ActionType = ReturnType<typeof fetchBillListPerTab> | ReturnType<typeof updateBillTransactions> | ReturnType<typeof updateBillListByStatus> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateBillListFailure> | ReturnType<typeof updateEntityApprovalStatus> | ReturnType<typeof updateRecurringBillConfigs> | ReturnType<typeof updateRecurringBills>;
10
11
  export declare const fetchBillListPerTabEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -9,6 +9,7 @@ const billListReducer_1 = require("./billListReducer");
9
9
  const billTransactionReducer_1 = require("../../../../entity/billPay/billTransaction/billTransactionReducer");
10
10
  const entityApprovalStatusReducer_1 = require("../../../../entity/entityApprovalStatus/entityApprovalStatusReducer");
11
11
  const userReducer_1 = require("../../../../entity/user/userReducer");
12
+ const recurringBillsReducer_1 = require("../../../../entity/billPay/recurringBills/recurringBillsReducer");
12
13
  const fetchBillListPerTabEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(billListReducer_1.fetchBillListPerTab.match), (0, operators_1.mergeMap)((action) => {
13
14
  const { period, tab, isShowDeletedBillsEnabled } = action.payload;
14
15
  const queryParam = {
@@ -30,7 +31,8 @@ const fetchBillListPerTabEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0
30
31
  if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
31
32
  const updateActions = [];
32
33
  updateActions.push((0, userReducer_1.updateAllUsers)({ users: (_a = response.data.users) !== null && _a !== void 0 ? _a : [] })),
33
- updateActions.push((0, billTransactionReducer_1.updateBillTransactions)(response.data.transactions));
34
+ updateActions.push((0, recurringBillsReducer_1.updateRecurringBillConfigs)(response.data.recurring_bill_configs));
35
+ updateActions.push((0, billTransactionReducer_1.updateBillTransactions)(response.data.transactions));
34
36
  updateActions.push((0, billListReducer_1.updateBillListByStatus)({
35
37
  billList: response.data,
36
38
  tab: tab,
@@ -5,6 +5,7 @@ import { BillTransaction } from '../../../../entity/billPay/billTransaction/bill
5
5
  import { Attachment } from '../../../../entity/transaction/stateTypes/attachment';
6
6
  import { TransactionWithAccountAndClassLine } from '../../../../entity/transaction/stateTypes/transactionLine';
7
7
  import { Vendor } from '../../../../entity/vendor/vendorState';
8
+ import { RecurringBillConfigLocalData } from '../editBillView/editBillViewState';
8
9
  import { PaymentDetailsSectionView } from '../editBillView/editBillViewSelector';
9
10
  import { Amount } from '../../../../commonStateTypes/amount';
10
11
  import { BillPayConfig } from '../billPayConfig/billPayConfigState';
@@ -20,6 +21,9 @@ export interface BillPayReviewSelectorView extends SelectorView {
20
21
  toAccountVendorEmail?: string;
21
22
  isCollectToAccountInfoFromVendorContact: boolean;
22
23
  billPayConfigList: BillPayConfig[];
24
+ isRecurring: boolean;
25
+ recurringBillInstance?: number;
26
+ recurringConfig?: RecurringBillConfigLocalData;
23
27
  }
24
28
  export interface DuplicateBillsSelectorView extends SelectorView {
25
29
  bills: BillTransaction[];
@@ -35,8 +35,8 @@ const getDuplicateBills = (state, billId) => {
35
35
  };
36
36
  exports.getDuplicateBills = getDuplicateBills;
37
37
  const getReviewPageBillDetail = (state, billId) => {
38
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
39
- const { accountListState, accountState, setupViewState, billTransactionState, classListState, editBillDetailViewState, paymentAccountState, vendorState, contactState, billPayConfigState, } = state;
38
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
39
+ const { accountListState, accountState, setupViewState, billTransactionState, classListState, editBillDetailViewState, paymentAccountState, vendorState, contactState, billPayConfigState, recurringBillState, } = state;
40
40
  const key = (0, billDetailViewState_1.getBillTransactionDetailKey)(billId !== null && billId !== void 0 ? billId : '');
41
41
  const sourceBillDetail = billId != null
42
42
  ? (_a = editBillDetailViewState.editBillStateById) === null || _a === void 0 ? void 0 : _a[key]
@@ -49,18 +49,31 @@ const getReviewPageBillDetail = (state, billId) => {
49
49
  const withdrawFromList = (0, paymentAccountSelector_1.getPaymentAccountsByPaymentAccountIds)(paymentAccountState, setupViewState.accountDetails.paymentAccountIds);
50
50
  let fetchState = 'Not-Started';
51
51
  let sourceBillDetailFetchState = 'Not-Started';
52
- const accountList = (0, accountListSelector_1.getAccountList)(accountState, accountListState, 'accountList');
52
+ const accountList = (0, accountListSelector_1.getAccountList)(accountState, accountListState, 'billPayAccountList');
53
53
  let toAccountVendorEmail = undefined;
54
54
  let isCollectToAccountInfoFromVendorContact = false;
55
+ let isRecurring = false;
56
+ let recurringBillInstance;
57
+ let recurringConfig;
55
58
  if (billId != null) {
56
59
  const transaction = (0, get_1.default)(billTransactionState.transactionById, billId, undefined);
57
60
  toAccountVendorEmail = transaction === null || transaction === void 0 ? void 0 : transaction.billPayInfo.toAccountVendorEmail;
58
61
  isCollectToAccountInfoFromVendorContact =
59
62
  (_b = transaction === null || transaction === void 0 ? void 0 : transaction.billPayInfo.isCollectToAccountInfoFromVendorContact) !== null && _b !== void 0 ? _b : false;
63
+ isRecurring = (_c = transaction === null || transaction === void 0 ? void 0 : transaction.isRecurring) !== null && _c !== void 0 ? _c : false;
64
+ if (isRecurring &&
65
+ (transaction === null || transaction === void 0 ? void 0 : transaction.recurringBillConfigId) != null &&
66
+ transaction.recurringBillInstance != null) {
67
+ recurringBillInstance = (_d = transaction === null || transaction === void 0 ? void 0 : transaction.recurringBillInstance) !== null && _d !== void 0 ? _d : 1;
68
+ const recurringBillDetail = (0, get_1.default)(recurringBillState.recurringBillDetailByConfigId, transaction === null || transaction === void 0 ? void 0 : transaction.recurringBillConfigId, undefined);
69
+ if (recurringBillDetail != null) {
70
+ recurringConfig = Object.assign({}, recurringBillDetail.recurringBillConfig);
71
+ }
72
+ }
60
73
  if (sourceBillDetail != null) {
61
74
  sourceBillDetailFetchState = (0, reduceFetchState_1.reduceFetchState)([
62
75
  sourceBillDetail.fetchStatus,
63
- accountListState.byReportId['accountList'],
76
+ accountListState.byReportId['billPayAccountList'],
64
77
  classListState,
65
78
  ]).fetchState;
66
79
  }
@@ -90,6 +103,12 @@ const getReviewPageBillDetail = (state, billId) => {
90
103
  isCollectToAccountInfoFromVendorContact =
91
104
  sourceBillDetail.billDetailLocalData
92
105
  .isCollectToAccountInfoFromVendorContact;
106
+ isRecurring = (_e = sourceBillDetail.billDetailLocalData.isRecurring) !== null && _e !== void 0 ? _e : false;
107
+ recurringConfig = sourceBillDetail.billDetailLocalData.recurringConfig;
108
+ if (isRecurring) {
109
+ recurringBillInstance =
110
+ (_g = (_f = sourceBillDetail.billDetailLocalData.recurringConfig) === null || _f === void 0 ? void 0 : _f.currentInstance) !== null && _g !== void 0 ? _g : 1;
111
+ }
93
112
  //add paymentToOption on initial bill load for collect from email
94
113
  if (isCollectToAccountInfoFromVendorContact &&
95
114
  toAccountVendorEmail != null &&
@@ -102,7 +121,7 @@ const getReviewPageBillDetail = (state, billId) => {
102
121
  }
103
122
  }
104
123
  const lineDetailSection = {};
105
- const lineDetailSectionUpdatesByLineId = (_d = (_c = sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.billDetailLocalData) === null || _c === void 0 ? void 0 : _c.updatesByLineId) !== null && _d !== void 0 ? _d : {};
124
+ const lineDetailSectionUpdatesByLineId = (_j = (_h = sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.billDetailLocalData) === null || _h === void 0 ? void 0 : _h.updatesByLineId) !== null && _j !== void 0 ? _j : {};
106
125
  if (accountList.fetchState === 'Completed') {
107
126
  Object.keys(lineDetailSectionUpdatesByLineId).forEach((lineId) => {
108
127
  var _a;
@@ -120,9 +139,9 @@ const getReviewPageBillDetail = (state, billId) => {
120
139
  const { bills, fetchState: duplicateBillFetchState } = (0, exports.getDuplicateBills)(state, billId);
121
140
  fetchState = duplicateBillFetchState;
122
141
  const totalAmount = {
123
- amount: (_f = (_e = sourceBillDetail.billDetailLocalData.totalAmount) === null || _e === void 0 ? void 0 : _e.amount) !== null && _f !== void 0 ? _f : 0,
124
- currencyCode: (_h = (_g = sourceBillDetail.billDetailLocalData.totalAmount) === null || _g === void 0 ? void 0 : _g.currencyCode) !== null && _h !== void 0 ? _h : 'USD',
125
- currencySymbol: (_k = (_j = sourceBillDetail.billDetailLocalData.totalAmount) === null || _j === void 0 ? void 0 : _j.currencySymbol) !== null && _k !== void 0 ? _k : '$',
142
+ amount: (_l = (_k = sourceBillDetail.billDetailLocalData.totalAmount) === null || _k === void 0 ? void 0 : _k.amount) !== null && _l !== void 0 ? _l : 0,
143
+ currencyCode: (_o = (_m = sourceBillDetail.billDetailLocalData.totalAmount) === null || _m === void 0 ? void 0 : _m.currencyCode) !== null && _o !== void 0 ? _o : 'USD',
144
+ currencySymbol: (_q = (_p = sourceBillDetail.billDetailLocalData.totalAmount) === null || _p === void 0 ? void 0 : _p.currencySymbol) !== null && _q !== void 0 ? _q : '$',
126
145
  };
127
146
  return {
128
147
  version: 0,
@@ -135,9 +154,12 @@ const getReviewPageBillDetail = (state, billId) => {
135
154
  paymentDetailsSection,
136
155
  file: file,
137
156
  billPayConfigList: (0, editBillViewSelector_1.getBillPayConfigList)(billPayConfigState),
138
- saveStatus: (_l = sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.saveStatus) !== null && _l !== void 0 ? _l : undefined,
157
+ saveStatus: (_r = sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.saveStatus) !== null && _r !== void 0 ? _r : undefined,
139
158
  toAccountVendorEmail,
140
159
  isCollectToAccountInfoFromVendorContact,
160
+ isRecurring,
161
+ recurringBillInstance,
162
+ recurringConfig,
141
163
  };
142
164
  };
143
165
  exports.getReviewPageBillDetail = getReviewPageBillDetail;
@@ -9,6 +9,7 @@ import { VendorPayload } from '../../../../entity/vendor/vendorPayload';
9
9
  import { ZeniAPIResponse } from '../../../../responsePayload';
10
10
  import { TransactionWithAccountAndClassLine } from '../../../../entity/transaction/stateTypes/transactionLine';
11
11
  import { LineItemRecommendationsLocalData } from './editBillViewSelector';
12
+ import { RecurringBillConfigResponsePayload, RecurringBillDataPayload } from '../../../../entity/billPay/recurringBills/recurringBillsPayload';
12
13
  export interface BillDetailPayload {
13
14
  transaction: BillTransactionPayload;
14
15
  bank_accounts: BankAccountPayload[];
@@ -27,6 +28,9 @@ export interface BillDetailQuery {
27
28
  }
28
29
  export interface BillSavePayload {
29
30
  transactions: BillTransactionPayload[];
31
+ recurring_bill_configs?: RecurringBillConfigResponsePayload[] | null;
32
+ recurring_bill_instances?: RecurringBillDataPayload[] | null;
33
+ future_recurring_bill_instances?: RecurringBillDataPayload[] | null;
30
34
  }
31
35
  export declare type BillDetailResponse = ZeniAPIResponse<BillDetailPayload>;
32
36
  export declare type BillSaveResponse = ZeniAPIResponse<BillSavePayload>;
@@ -6,6 +6,7 @@ const toolkit_1 = require("@reduxjs/toolkit");
6
6
  const editBillViewState_1 = require("./editBillViewState");
7
7
  const billDetailViewState_1 = require("../billDetailView/billDetailViewState");
8
8
  const amount_1 = require("../../../../commonStateTypes/amount");
9
+ const helpers_1 = require("../../helpers");
9
10
  exports.initialState = {
10
11
  newBillState: editBillViewState_1.initialBillDetail,
11
12
  editBillStateById: {},
@@ -82,14 +83,23 @@ const editBillView = (0, toolkit_1.createSlice)({
82
83
  },
83
84
  },
84
85
  saveBillUpdatesToLocalStore(draft, action) {
86
+ const recurringLocalConfig = action.payload.billDetailLocalData.recurringConfig;
85
87
  if (action.payload.billId != null) {
86
88
  const billId = action.payload.billId;
87
89
  const key = (0, billDetailViewState_1.getBillTransactionDetailKey)(billId);
90
+ const prevRecurringConfig = draft.editBillStateById[key].billDetailLocalData.recurringConfig;
88
91
  draft.editBillStateById[key].billDetailLocalData = Object.assign(Object.assign({}, draft.editBillStateById[key].billDetailLocalData), action.payload.billDetailLocalData);
89
92
  draft.editBillStateById[key].billId = billId;
93
+ if (recurringLocalConfig != null) {
94
+ doUpdateRecurringBillLocalData(draft.editBillStateById[key].billDetailLocalData, recurringLocalConfig, prevRecurringConfig);
95
+ }
90
96
  }
91
97
  else {
98
+ const prevRecurringConfig = draft.newBillState.billDetailLocalData.recurringConfig;
92
99
  draft.newBillState.billDetailLocalData = Object.assign(Object.assign({}, draft.newBillState.billDetailLocalData), action.payload.billDetailLocalData);
100
+ if (recurringLocalConfig != null) {
101
+ doUpdateRecurringBillLocalData(draft.newBillState.billDetailLocalData, recurringLocalConfig, prevRecurringConfig);
102
+ }
93
103
  }
94
104
  },
95
105
  discardBillUpdatesInLocalStore(draft, action) {
@@ -303,3 +313,10 @@ const editBillView = (0, toolkit_1.createSlice)({
303
313
  });
304
314
  _a = editBillView.actions, exports.fetchEditBillDetailPage = _a.fetchEditBillDetailPage, exports.fetchBillAndInitializeLocalStore = _a.fetchBillAndInitializeLocalStore, exports.fetchVendorByNameAndParseInvoice = _a.fetchVendorByNameAndParseInvoice, exports.initializeBillToLocalStore = _a.initializeBillToLocalStore, exports.saveBillUpdatesToLocalStore = _a.saveBillUpdatesToLocalStore, exports.discardBillUpdatesInLocalStore = _a.discardBillUpdatesInLocalStore, exports.saveBillDetail = _a.saveBillDetail, exports.saveBillSuccessOrFailure = _a.saveBillSuccessOrFailure, exports.updateEditBillFetchStateCompleted = _a.updateEditBillFetchStateCompleted, exports.parseInvoiceToBill = _a.parseInvoiceToBill, exports.clearEditBillViewDetail = _a.clearEditBillViewDetail, exports.waitForBillDetailThenInitializeLocalStore = _a.waitForBillDetailThenInitializeLocalStore, exports.waitForVendorByNameThenParsetoLocalStore = _a.waitForVendorByNameThenParsetoLocalStore, exports.updateInternationalTransferFeeBearerPaymentMethodInLocalData = _a.updateInternationalTransferFeeBearerPaymentMethodInLocalData, exports.updateShowAutofill = _a.updateShowAutofill, exports.updateAddBillAutoFields = _a.updateAddBillAutoFields, exports.updateBillUploadFetchState = _a.updateBillUploadFetchState, exports.updateRecommendedVendorId = _a.updateRecommendedVendorId, exports.updateSuggestedVendorIdFromParsedInvoice = _a.updateSuggestedVendorIdFromParsedInvoice, exports.updateVendorContact = _a.updateVendorContact, exports.updateVendorContactSuccessOrFailure = _a.updateVendorContactSuccessOrFailure, exports.convertAmountToHomeCurrency = _a.convertAmountToHomeCurrency, exports.currencyConversionValueSuccessOrFailure = _a.currencyConversionValueSuccessOrFailure, exports.updateHomeCurrencyConversion = _a.updateHomeCurrencyConversion;
305
315
  exports.default = editBillView.reducer;
316
+ function doUpdateRecurringBillLocalData(billDetail, currentConfig, prevConfig) {
317
+ var _a, _b, _c, _d;
318
+ const recurringBillDetail = (0, helpers_1.updateRecurringBillDetails)(currentConfig, prevConfig, billDetail.recurringBillInstances, (_a = billDetail.totalAmount) === null || _a === void 0 ? void 0 : _a.amount);
319
+ billDetail.recurringConfig = Object.assign({ id: (_b = prevConfig === null || prevConfig === void 0 ? void 0 : prevConfig.id) !== null && _b !== void 0 ? _b : (_c = billDetail.recurringConfig) === null || _c === void 0 ? void 0 : _c.id }, recurringBillDetail.recurringConfig);
320
+ billDetail.recurringBillInstances =
321
+ (_d = recurringBillDetail.recurringInstances) !== null && _d !== void 0 ? _d : [];
322
+ }
@@ -2,7 +2,7 @@ import { FetchStateAndError, ID } from '../../../../commonStateTypes/common';
2
2
  import { RootState } from '../../../../reducer';
3
3
  import { SelectorView } from '../../../../commonStateTypes/viewAndReport/viewAndReport';
4
4
  import { Amount } from '../../../../commonStateTypes/amount';
5
- import { BillPayInfo, BillPaymentMethod, BillStageCodeType, InternationalTransferFeeBearerPaymentMethod } from '../../../../entity/billPay/billTransaction/billTransactionState';
5
+ import { BillPayInfo, BillPaymentMethod, BillStageCodeType, BillTransaction, InternationalTransferFeeBearerPaymentMethod } from '../../../../entity/billPay/billTransaction/billTransactionState';
6
6
  import { PaymentAccount } from '../../../../entity/paymentAccount/paymentAccountState';
7
7
  import { Attachment } from '../../../../entity/transaction/stateTypes/attachment';
8
8
  import { TransactionWithAccountAndClassLine } from '../../../../entity/transaction/stateTypes/transactionLine';
@@ -11,7 +11,7 @@ import { ZeniDate } from '../../../../zeniDayJS';
11
11
  import { AccountListSelectorView } from '../../../accountList/accountListSelector';
12
12
  import { ClassListSelectorView } from '../../../classList/classListSelector';
13
13
  import { PreviousBillsSelectorView } from '../previousBills/previousBillsSelector';
14
- import { AddBillAutoFields, WhatForSection, PaymentModeType, PaymentMode } from './editBillViewState';
14
+ import { AddBillAutoFields, WhatForSection, PaymentModeType, PaymentMode, RecurringBillConfigLocalData, RecurringBillInstance } from './editBillViewState';
15
15
  import { BillActivity } from '../billDetailView/billDetailViewSelector';
16
16
  import { BillPaySetupApproverView } from '../billPaySetupApproverView/billPaySetupApproverViewSelectorTypes';
17
17
  import { User } from '../../../../entity/user/userState';
@@ -25,6 +25,7 @@ import { RecommendationByLineId } from '../../../../entity/transaction/stateType
25
25
  import { VendorDetailLocalData } from '../../../commonVendorView/vendorView/vendorViewState';
26
26
  import { AccountBase, RecommendedAccountBase } from '../../../../entity/account/accountState';
27
27
  import { ClassBase, RecommendedClassBase } from '../../../../entity/class/classState';
28
+ import { RecurringBillState } from '../../../../entity/billPay/recurringBills/recurringBillsState';
28
29
  export declare type PaymentToOption = {
29
30
  id: ID;
30
31
  type: PaymentModeType;
@@ -98,6 +99,9 @@ export interface EditBillDetailSelectorView extends SelectorView {
98
99
  recommendationByLineID?: RecommendationByLineId;
99
100
  vendorDetailLocalData?: VendorDetailLocalData;
100
101
  recommendedVendor?: Vendor;
102
+ isRecurring: boolean;
103
+ recurringConfig?: RecurringBillConfigLocalData;
104
+ recurringBillInstances?: RecurringBillInstance[];
101
105
  }
102
106
  export interface EditBillInitialDetails {
103
107
  vendor?: Vendor;
@@ -120,3 +124,7 @@ export interface PaymentDetailsSectionView {
120
124
  internationalTransferFeeBearerPaymentMethod?: InternationalTransferFeeBearerPaymentMethod;
121
125
  conversionRate?: number;
122
126
  }
127
+ export declare const getRecurringBillLocalData: (recurringBillState: RecurringBillState, transaction: BillTransaction) => {
128
+ recurringBillInstancesLocalData: RecurringBillInstance[];
129
+ recurringConfigLocalData?: RecurringBillConfigLocalData | undefined;
130
+ };
@@ -3,7 +3,7 @@ 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.getCurrentPaymentToOption = exports.toPaymentToOption = exports.getPaymentMethodType = exports.getBillPayConfigList = exports.getEditBillDetail = void 0;
6
+ exports.getRecurringBillLocalData = exports.getCurrentPaymentToOption = exports.toPaymentToOption = exports.getPaymentMethodType = exports.getBillPayConfigList = exports.getEditBillDetail = void 0;
7
7
  const get_1 = __importDefault(require("lodash/get"));
8
8
  const has_1 = __importDefault(require("lodash/has"));
9
9
  const reduceFetchState_1 = require("../../../../commonStateTypes/reduceFetchState");
@@ -28,8 +28,8 @@ const billPayReviewSelector_1 = require("../billPayReview/billPayReviewSelector"
28
28
  const paymentInstrumentSelector_1 = require("../../../../entity/paymentInstrument/paymentInstrumentSelector");
29
29
  const billPayConfigPayload_1 = require("../billPayConfig/billPayConfigPayload");
30
30
  const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, billId) => {
31
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
32
- const { accountListState, accountState, bankAccountState, billDetailViewState, setupViewState, billTransactionState, billPayConfigState, classListState, classState, editBillDetailViewState, paymentAccountState, vendorState, tenantState, companyState, userState, commonHistoryState, contactState, paymentInstrumentState, } = state;
31
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2;
32
+ const { accountListState, accountState, bankAccountState, billDetailViewState, setupViewState, billTransactionState, billPayConfigState, classListState, classState, editBillDetailViewState, paymentAccountState, vendorState, tenantState, companyState, userState, commonHistoryState, contactState, paymentInstrumentState, recurringBillState, } = state;
33
33
  let transaction = null;
34
34
  let recommendations = {};
35
35
  if (billId != null) {
@@ -85,10 +85,13 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, billId)
85
85
  paymentDetailsSection: getPaymentSection(state, withdrawFromList, {}),
86
86
  totalAmount: sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.billDetailLocalData.totalAmount,
87
87
  };
88
- const accountList = (0, accountListSelector_1.getAccountList)(accountState, accountListState, 'accountList');
88
+ const accountList = (0, accountListSelector_1.getAccountList)(accountState, accountListState, 'billPayAccountList');
89
89
  let billPayInfo = undefined;
90
90
  let toAccountVendorEmail = undefined;
91
91
  let isCollectToAccountInfoFromVendorContact = false;
92
+ let isRecurring = false;
93
+ let recurringConfig;
94
+ let recurringBillInstances;
92
95
  if (billId != null) {
93
96
  const transaction = (0, get_1.default)(billTransactionState.transactionById, billId, undefined);
94
97
  isDeleted = (_f = transaction === null || transaction === void 0 ? void 0 : transaction.isDeleted) !== null && _f !== void 0 ? _f : false;
@@ -147,17 +150,24 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, billId)
147
150
  if (billViewState != null) {
148
151
  fetchState = (0, reduceFetchState_1.reduceFetchState)([
149
152
  billViewState,
150
- accountListState.byReportId.accountList,
153
+ accountListState.byReportId.billPayAccountList,
151
154
  classListState,
152
155
  ]).fetchState;
153
156
  deleteStatus = billViewState.deleteStatus;
154
157
  billActivities = (0, billDetailViewSelector_1.getBillActivities)(state, billId, billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.stage.code);
155
158
  }
156
159
  }
160
+ //recurringBill Details
161
+ isRecurring = (_r = transaction === null || transaction === void 0 ? void 0 : transaction.isRecurring) !== null && _r !== void 0 ? _r : false;
162
+ if (isRecurring && transaction != null) {
163
+ const { recurringConfigLocalData, recurringBillInstancesLocalData } = (0, exports.getRecurringBillLocalData)(recurringBillState, transaction);
164
+ recurringConfig = recurringConfigLocalData;
165
+ recurringBillInstances = recurringBillInstancesLocalData;
166
+ }
157
167
  }
158
168
  else {
159
169
  fetchState = (0, reduceFetchState_1.reduceFetchState)([
160
- accountListState.byReportId['accountList'],
170
+ accountListState.byReportId.billPayAccountList,
161
171
  classListState,
162
172
  ]).fetchState;
163
173
  }
@@ -177,9 +187,9 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, billId)
177
187
  ? (0, vendorSelector_1.getVendorByVendorId)(vendorState, updatedRecord.vendor.id)
178
188
  : undefined;
179
189
  file = updatedRecord.file != null ? updatedRecord.file : undefined;
180
- const bankAccInBill = (0, bankAccountSelector_1.getBankAccountByBankAccountId)(bankAccountState, (_s = (_r = updatedRecord.paymentDetailsSection) === null || _r === void 0 ? void 0 : _r.paymentTo) !== null && _s !== void 0 ? _s : '');
181
- const vendorBankAccounts = (0, bankAccountSelector_1.getBankAccountsByBankAccountIds)(bankAccountState, (_t = vendorDetails === null || vendorDetails === void 0 ? void 0 : vendorDetails.bankAccountIds) !== null && _t !== void 0 ? _t : []);
182
- const vendorPaymentInstruments = (0, paymentInstrumentSelector_1.getPaymentInstrumentsByIds)(paymentInstrumentState, (_u = vendorDetails === null || vendorDetails === void 0 ? void 0 : vendorDetails.paymentInstrumentIds) !== null && _u !== void 0 ? _u : []);
190
+ const bankAccInBill = (0, bankAccountSelector_1.getBankAccountByBankAccountId)(bankAccountState, (_t = (_s = updatedRecord.paymentDetailsSection) === null || _s === void 0 ? void 0 : _s.paymentTo) !== null && _t !== void 0 ? _t : '');
191
+ const vendorBankAccounts = (0, bankAccountSelector_1.getBankAccountsByBankAccountIds)(bankAccountState, (_u = vendorDetails === null || vendorDetails === void 0 ? void 0 : vendorDetails.bankAccountIds) !== null && _u !== void 0 ? _u : []);
192
+ const vendorPaymentInstruments = (0, paymentInstrumentSelector_1.getPaymentInstrumentsByIds)(paymentInstrumentState, (_v = vendorDetails === null || vendorDetails === void 0 ? void 0 : vendorDetails.paymentInstrumentIds) !== null && _v !== void 0 ? _v : []);
183
193
  const isBankAccInBillExistInVendor = bankAccInBill != null
184
194
  ? vendorBankAccounts
185
195
  .map((bankAc) => bankAc.bankAccountId)
@@ -229,6 +239,10 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, billId)
229
239
  (recommendedVendor === null || recommendedVendor === void 0 ? void 0 : recommendedVendor.vendorCurrencyCode) != null) {
230
240
  whatForSection.currencyCode = recommendedVendor.vendorCurrencyCode;
231
241
  }
242
+ isRecurring = (_w = sourceBillDetail.billDetailLocalData.isRecurring) !== null && _w !== void 0 ? _w : false;
243
+ recurringConfig = sourceBillDetail.billDetailLocalData.recurringConfig;
244
+ recurringBillInstances =
245
+ sourceBillDetail.billDetailLocalData.recurringBillInstances;
232
246
  //add paymentToOption on initial bill load for collect from email
233
247
  if (isCollectToAccountInfoFromVendorContact &&
234
248
  toAccountVendorEmail != null &&
@@ -245,7 +259,7 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, billId)
245
259
  }
246
260
  const vendorContactSaveStatus = editBillDetailViewState.updateVendorContactState;
247
261
  const lineDetailSection = {};
248
- const lineDetailSectionUpdatesByLineId = (_w = (_v = sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.billDetailLocalData) === null || _v === void 0 ? void 0 : _v.updatesByLineId) !== null && _w !== void 0 ? _w : {};
262
+ const lineDetailSectionUpdatesByLineId = (_y = (_x = sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.billDetailLocalData) === null || _x === void 0 ? void 0 : _x.updatesByLineId) !== null && _y !== void 0 ? _y : {};
249
263
  const classList = (0, classListSelector_1.getClassList)(classState, classListState);
250
264
  if (accountList.fetchState === 'Completed') {
251
265
  Object.keys(lineDetailSectionUpdatesByLineId).forEach((lineId) => {
@@ -263,16 +277,16 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, billId)
263
277
  });
264
278
  }
265
279
  const billHistory = (0, commonHistorySelector_1.getActivityHistory)(commonHistoryState, billId !== null && billId !== void 0 ? billId : '', 'bill_pay');
266
- const accountsHeirarchyList = (0, accountListSelector_1.getNestedAccountListHeirarchy)(accountListState, 'accountList');
280
+ const accountsHeirarchyList = (0, accountListSelector_1.getNestedAccountListHeirarchy)(accountListState, 'billPayAccountList');
267
281
  const classHeirarchyList = (0, classListSelector_1.getNestedClassListHeirarchy)(classListState);
268
282
  const duplicateBills = (0, billPayReviewSelector_1.getDuplicateBills)(state, billId);
269
283
  return {
270
284
  recommendedVendor,
271
285
  duplicateBills,
272
286
  fetchState: fetchState,
273
- saveStatus: (_x = sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.saveStatus) !== null && _x !== void 0 ? _x : undefined,
274
- error: (_z = (_y = sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.fetchStatus) === null || _y === void 0 ? void 0 : _y.error) !== null && _z !== void 0 ? _z : undefined,
275
- uploadStatus: (_0 = sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.uploadFetchState) !== null && _0 !== void 0 ? _0 : undefined,
287
+ saveStatus: (_z = sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.saveStatus) !== null && _z !== void 0 ? _z : undefined,
288
+ error: (_1 = (_0 = sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.fetchStatus) === null || _0 === void 0 ? void 0 : _0.error) !== null && _1 !== void 0 ? _1 : undefined,
289
+ uploadStatus: (_2 = sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.uploadFetchState) !== null && _2 !== void 0 ? _2 : undefined,
276
290
  version: 0,
277
291
  createdBy,
278
292
  createTime,
@@ -308,6 +322,9 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, billId)
308
322
  classHeirarchyList,
309
323
  latestApprovedDate: (0, helpers_1.getLatestApprovalDate)(billActivities),
310
324
  recommendationByLineID: recommendations,
325
+ isRecurring,
326
+ recurringBillInstances,
327
+ recurringConfig,
311
328
  };
312
329
  };
313
330
  exports.getEditBillDetail = getEditBillDetail;
@@ -459,3 +476,31 @@ function getCurrentPaymentToOption(state, id) {
459
476
  return selectedOption != null ? toPaymentToOption(selectedOption) : undefined;
460
477
  }
461
478
  exports.getCurrentPaymentToOption = getCurrentPaymentToOption;
479
+ const getRecurringBillLocalData = (recurringBillState, transaction) => {
480
+ let recurringConfigLocalData = undefined;
481
+ let recurringBillInstancesLocalData = [];
482
+ let recurringBillDetail = undefined;
483
+ if (transaction.recurringBillConfigId != null) {
484
+ recurringBillDetail = (0, get_1.default)(recurringBillState.recurringBillDetailByConfigId, transaction.recurringBillConfigId, undefined);
485
+ }
486
+ if (recurringBillDetail != null) {
487
+ const { recurringBillInstances: currentRecurringBillInstances, recurringBillConfig, } = recurringBillDetail;
488
+ recurringBillInstancesLocalData = [...currentRecurringBillInstances]
489
+ .map((recurringBill) => ({
490
+ instance: recurringBill.instance,
491
+ amount: recurringBill.amount,
492
+ stage: recurringBill.stage,
493
+ paymentDate: recurringBill.paymentDate,
494
+ vendorReceiveDate: recurringBill.vendorReceiveDate,
495
+ vendorReceiveDateNotes: recurringBill.vendorReceiveDateNotes,
496
+ readonly: transaction.recurringBillInstance != null
497
+ ? recurringBill.instance < transaction.recurringBillInstance
498
+ : false,
499
+ transactionId: recurringBill.transactionId,
500
+ }))
501
+ .sort((a, b) => a.instance - b.instance);
502
+ recurringConfigLocalData = Object.assign(Object.assign({}, recurringBillConfig), { currentInstance: transaction.recurringBillInstance });
503
+ }
504
+ return { recurringConfigLocalData, recurringBillInstancesLocalData };
505
+ };
506
+ exports.getRecurringBillLocalData = getRecurringBillLocalData;
@@ -11,6 +11,8 @@ import { InternationalTransferFeeBearerPaymentMethod } from '../../../../entity/
11
11
  import { PaymentInstrument } from '../../../../entity/paymentInstrument/paymentInstrument';
12
12
  import { BankAccount } from '../../../../entity/bankAccount/bankAccount';
13
13
  import { Contact } from '../../../../entity/billPay/contact/contact';
14
+ import { RecurringBillFrequency } from '../../../../entity/billPay/recurringBills/recurringBillsState';
15
+ import { BillStage } from '../../../../entity/billPay/billTransaction/billTransactionState';
14
16
  export interface EditBillDetail {
15
17
  fetchStatus: FetchStateAndError;
16
18
  saveStatus: FetchStateAndError;
@@ -28,6 +30,16 @@ export interface EditBillDetailViewState {
28
30
  editBillStateById: Record<BillTransactionDetailKey, EditBillDetail>;
29
31
  updateVendorContactState: FetchStateAndError;
30
32
  }
33
+ export interface RecurringBillInstance {
34
+ instance: number;
35
+ vendorReceiveDate: ZeniDate;
36
+ vendorReceiveDateNotes: string;
37
+ amount?: number;
38
+ stage?: BillStage;
39
+ readonly?: boolean;
40
+ paymentDate?: ZeniDate;
41
+ transactionId?: ID;
42
+ }
31
43
  export interface BillDetailLocalData {
32
44
  vendor?: Vendor;
33
45
  candidateVendorname?: string;
@@ -42,6 +54,9 @@ export interface BillDetailLocalData {
42
54
  isCollectToAccountInfoFromVendorContact: boolean;
43
55
  currencyConversionState?: FetchStateAndError;
44
56
  recommendedVendorId?: ID;
57
+ isRecurring: boolean;
58
+ recurringConfig?: RecurringBillConfigLocalData;
59
+ recurringBillInstances?: RecurringBillInstance[];
45
60
  }
46
61
  export interface WhatForSection {
47
62
  invoiceNumber?: string;
@@ -73,3 +88,16 @@ export declare const PAYMENT_MODE_TYPE: readonly ["BankAccount", "Contact", "Pay
73
88
  export declare const toPaymentModeType: (v: string) => "BankAccount" | "Contact" | "PaymentInstrument";
74
89
  export declare type PaymentModeType = ReturnType<typeof toPaymentModeType>;
75
90
  export declare type PaymentMode = BankAccount | PaymentInstrument | Contact;
91
+ export declare type EditRecurringBillType = 'current' | 'all';
92
+ export interface RecurringBillConfigLocalData {
93
+ isApprovalRequired: boolean;
94
+ frequency?: RecurringBillFrequency;
95
+ totalPaymentCycles: number;
96
+ id?: ID;
97
+ startDate?: ZeniDate;
98
+ endDate?: ZeniDate;
99
+ currentInstance?: number;
100
+ endDateSelectorOptionType?: 'date' | 'payments';
101
+ isActive: boolean;
102
+ updateRecurringBills?: EditRecurringBillType;
103
+ }
@@ -35,6 +35,7 @@ exports.initialBillDetail = {
35
35
  isCancelled: false,
36
36
  toAccountVendorEmail: undefined,
37
37
  isCollectToAccountInfoFromVendorContact: false,
38
+ isRecurring: false,
38
39
  },
39
40
  showSkipAutofill: true,
40
41
  addBillAutoFields: {
@@ -16,7 +16,7 @@ const fetchEditBillDetailPageEpic = (actions$, state$) => actions$.pipe((0, oper
16
16
  const billDetailActions = [];
17
17
  const state = state$.value;
18
18
  if (cacheOverride == true) {
19
- billDetailActions.push((0, accountListReducer_1.fetchAccountList)('accountList', true));
19
+ billDetailActions.push((0, accountListReducer_1.fetchAccountList)('billPayAccountList', true, true, true));
20
20
  billDetailActions.push((0, classListReducer_1.fetchClassList)());
21
21
  billDetailActions.push((0, vendorTypeListReducer_1.fetchVendorTypeList)());
22
22
  billDetailActions.push((0, ownerListReducer_1.fetchOwnerList)());
@@ -35,10 +35,10 @@ const fetchEditBillDetailPageEpic = (actions$, state$) => actions$.pipe((0, oper
35
35
  state.ownerListState.hasValidState() === false) {
36
36
  billDetailActions.push((0, ownerListReducer_1.fetchOwnerList)());
37
37
  }
38
- const accountList = state.accountListState.byReportId.accountList;
38
+ const accountList = state.accountListState.byReportId['billPayAccountList'];
39
39
  if (accountList.hasValidState() === false &&
40
40
  accountList.fetchState !== 'In-Progress') {
41
- billDetailActions.push((0, accountListReducer_1.fetchAccountList)('accountList', true));
41
+ billDetailActions.push((0, accountListReducer_1.fetchAccountList)('billPayAccountList', true, true, true));
42
42
  }
43
43
  const classList = state.classListState;
44
44
  if (classList.hasValidState() === false &&
@@ -94,8 +94,8 @@ const initializeBillToLocalStoreEpic = (actions$, state$) => actions$.pipe((0, o
94
94
  const editBillState = (0, get_1.default)(state.editBillDetailViewState.editBillStateById, detailKey, undefined);
95
95
  const billDetail = (0, get_1.default)(state.billDetailViewState.billDetailById, detailKey, undefined);
96
96
  const transaction = (0, get_1.default)(state.billTransactionState.transactionById, billId, undefined);
97
- const { accountListState, accountState, classListState, classState } = state;
98
- const accountList = (0, accountListSelector_1.getAccountList)(accountState, accountListState, 'accountList');
97
+ const { accountListState, accountState, classListState, classState, recurringBillState, } = state;
98
+ const accountList = (0, accountListSelector_1.getAccountList)(accountState, accountListState, 'billPayAccountList');
99
99
  const classList = (0, classListSelector_1.getClassList)(classState, classListState);
100
100
  const recommendations = transaction === null || transaction === void 0 ? void 0 : transaction.recommendations;
101
101
  /* check vendor info is present in local store or not.
@@ -155,6 +155,14 @@ const initializeBillToLocalStoreEpic = (actions$, state$) => actions$.pipe((0, o
155
155
  const candidateVendorname = transaction.candidateVendorName;
156
156
  const toAccountVendorEmail = transaction.billPayInfo.toAccountVendorEmail;
157
157
  const isCollectToAccountInfoFromVendorContact = transaction.billPayInfo.isCollectToAccountInfoFromVendorContact;
158
+ const isRecurring = transaction.isRecurring;
159
+ let recurringConfig;
160
+ let recurringBillInstances = undefined;
161
+ if (isRecurring) {
162
+ const { recurringConfigLocalData, recurringBillInstancesLocalData } = (0, editBillViewSelector_1.getRecurringBillLocalData)(recurringBillState, transaction);
163
+ recurringConfig = recurringConfigLocalData;
164
+ recurringBillInstances = recurringBillInstancesLocalData;
165
+ }
158
166
  const billDetailLocalData = {
159
167
  vendor,
160
168
  whatForSection,
@@ -166,6 +174,9 @@ const initializeBillToLocalStoreEpic = (actions$, state$) => actions$.pipe((0, o
166
174
  candidateVendorname,
167
175
  toAccountVendorEmail,
168
176
  isCollectToAccountInfoFromVendorContact,
177
+ isRecurring,
178
+ recurringConfig,
179
+ recurringBillInstances,
169
180
  };
170
181
  const actions = [
171
182
  (0, editBillViewReducer_1.saveBillUpdatesToLocalStore)({ billDetailLocalData, billId }),