@zeniai/client-epic-state 4.7.74 → 4.7.75

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 (66) hide show
  1. package/lib/commonStateTypes/workingDayHelper.d.ts +9 -5
  2. package/lib/commonStateTypes/workingDayHelper.js +36 -12
  3. package/lib/entity/billPay/billTransaction/billTransactionPayload.d.ts +3 -0
  4. package/lib/entity/billPay/billTransaction/billTransactionPayload.js +2 -2
  5. package/lib/entity/billPay/billTransaction/billTransactionState.d.ts +3 -0
  6. package/lib/entity/billPay/recurringBills/recurringBillsPayload.d.ts +34 -0
  7. package/lib/entity/billPay/recurringBills/recurringBillsPayload.js +44 -0
  8. package/lib/entity/billPay/recurringBills/recurringBillsReducer.d.ts +6 -0
  9. package/lib/entity/billPay/recurringBills/recurringBillsReducer.js +40 -0
  10. package/lib/entity/billPay/recurringBills/recurringBillsState.d.ts +33 -0
  11. package/lib/entity/billPay/recurringBills/recurringBillsState.js +14 -0
  12. package/lib/entity/chargeCard/chargeCard.d.ts +2 -2
  13. package/lib/entity/entityApprovalStatus/entityApprovalStatusPayload.d.ts +1 -0
  14. package/lib/entity/entityApprovalStatus/entityApprovalStatusPayload.js +1 -0
  15. package/lib/entity/entityApprovalStatus/entityApprovalStatusState.d.ts +1 -0
  16. package/lib/entity/tenant/clearAllEpic.d.ts +2 -1
  17. package/lib/entity/tenant/clearAllEpic.js +2 -0
  18. package/lib/entity/transaction/stateTypes/attachment.js +5 -5
  19. package/lib/index.d.ts +6 -4
  20. package/lib/index.js +10 -4
  21. package/lib/reducer.d.ts +3 -0
  22. package/lib/reducer.js +3 -0
  23. package/lib/view/accountList/accountListReducer.js +2 -1
  24. package/lib/view/accountList/accountListState.d.ts +1 -1
  25. package/lib/view/commonVendorView/vendorView/epics/saveVendorEpic.js +1 -0
  26. package/lib/view/commonVendorView/vendorView/vendorViewSelector.js +2 -2
  27. package/lib/view/spendManagement/billPay/billDetailView/billDetailViewPayload.d.ts +3 -0
  28. package/lib/view/spendManagement/billPay/billDetailView/billDetailViewSelector.d.ts +5 -0
  29. package/lib/view/spendManagement/billPay/billDetailView/billDetailViewSelector.js +13 -2
  30. package/lib/view/spendManagement/billPay/billDetailView/epics/cancelAndDeleteBillEpic.d.ts +2 -1
  31. package/lib/view/spendManagement/billPay/billDetailView/epics/cancelAndDeleteBillEpic.js +19 -8
  32. package/lib/view/spendManagement/billPay/billDetailView/epics/deleteBillEpic.d.ts +2 -1
  33. package/lib/view/spendManagement/billPay/billDetailView/epics/deleteBillEpic.js +14 -4
  34. package/lib/view/spendManagement/billPay/billDetailView/epics/fetchBillDetailEpic.d.ts +2 -1
  35. package/lib/view/spendManagement/billPay/billDetailView/epics/fetchBillDetailEpic.js +5 -2
  36. package/lib/view/spendManagement/billPay/billList/billListPayload.d.ts +2 -0
  37. package/lib/view/spendManagement/billPay/billList/billListSelector.d.ts +3 -0
  38. package/lib/view/spendManagement/billPay/billList/billListSelector.js +10 -2
  39. package/lib/view/spendManagement/billPay/billList/fetchBillListPerTabEpic.d.ts +2 -1
  40. package/lib/view/spendManagement/billPay/billList/fetchBillListPerTabEpic.js +3 -1
  41. package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.d.ts +4 -0
  42. package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +31 -9
  43. package/lib/view/spendManagement/billPay/editBillView/editBillViewPayload.d.ts +4 -0
  44. package/lib/view/spendManagement/billPay/editBillView/editBillViewReducer.js +17 -0
  45. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.d.ts +10 -2
  46. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +59 -14
  47. package/lib/view/spendManagement/billPay/editBillView/editBillViewState.d.ts +28 -0
  48. package/lib/view/spendManagement/billPay/editBillView/editBillViewState.js +1 -0
  49. package/lib/view/spendManagement/billPay/editBillView/epics/fetchEditBillDetailPageEpic.js +3 -3
  50. package/lib/view/spendManagement/billPay/editBillView/epics/initializeBillToLocalStoreEpic.js +13 -2
  51. package/lib/view/spendManagement/billPay/editBillView/epics/parseInvoiceToBillEpic.js +3 -2
  52. package/lib/view/spendManagement/billPay/editBillView/epics/saveBillDetailEpic.d.ts +11 -24
  53. package/lib/view/spendManagement/billPay/editBillView/epics/saveBillDetailEpic.js +100 -14
  54. package/lib/view/spendManagement/commonHistoryView/commonHistory.d.ts +1 -0
  55. package/lib/view/spendManagement/commonHistoryView/commonHistoryPayload.d.ts +1 -0
  56. package/lib/view/spendManagement/commonHistoryView/commonHistoryPayload.js +9 -5
  57. package/lib/view/spendManagement/helpers.d.ts +11 -1
  58. package/lib/view/spendManagement/helpers.js +134 -1
  59. package/lib/view/spendManagement/reimbursement/remiDetailView/remiDetailViewSelector.d.ts +1 -0
  60. package/lib/view/spendManagement/zeniAccounts/zeniAccountsConfig/zeniAccountsConfigPayload.d.ts +1 -0
  61. package/lib/view/spendManagement/zeniAccounts/zeniAccountsConfig/zeniAccountsConfigPayload.js +1 -0
  62. package/lib/view/spendManagement/zeniAccounts/zeniAccountsConfig/zeniAccountsConfigReducer.js +3 -1
  63. package/lib/view/spendManagement/zeniAccounts/zeniAccountsConfig/zeniAccountsConfigSelector.d.ts +1 -0
  64. package/lib/view/spendManagement/zeniAccounts/zeniAccountsConfig/zeniAccountsConfigSelector.js +2 -1
  65. package/lib/view/spendManagement/zeniAccounts/zeniAccountsConfig/zeniAccountsConfigState.d.ts +1 -0
  66. package/package.json +5 -4
@@ -27,6 +27,7 @@ exports.initialState = {
27
27
  byReportId: {
28
28
  accountList: exports.initialAccountList,
29
29
  reimbursementAccountList: exports.initialAccountList,
30
+ billPayAccountList: exports.initialAccountList,
30
31
  },
31
32
  };
32
33
  const accountList = (0, toolkit_1.createSlice)({
@@ -40,7 +41,7 @@ const accountList = (0, toolkit_1.createSlice)({
40
41
  const existingData = draft.byReportId[action.payload.accountListKey];
41
42
  draft.byReportId[action.payload.accountListKey] = Object.assign(Object.assign({}, existingData), { fetchState: 'In-Progress', error: undefined });
42
43
  },
43
- prepare(accountListKey, fetchFullResponse = false, excludeAccountPayableAccounts = true, excludeAccountReceivableAccounts = true, isLimitedCategoryEnabled = false) {
44
+ prepare(accountListKey, fetchFullResponse = false, excludeAccountPayableAccounts = false, excludeAccountReceivableAccounts = false, isLimitedCategoryEnabled = false) {
44
45
  return {
45
46
  payload: {
46
47
  accountListKey,
@@ -1,7 +1,7 @@
1
1
  import { NestedAccountHeirarchyForReport } from '../../commonStateTypes/accountView/nestedAccountID';
2
2
  import { FetchedState, ID } from '../../commonStateTypes/common';
3
3
  import { AccountLabel } from '../../entity/account/accountState';
4
- export declare type AccountListKeyType = 'accountList' | 'reimbursementAccountList';
4
+ export declare type AccountListKeyType = 'accountList' | 'reimbursementAccountList' | 'billPayAccountList';
5
5
  export interface AccountList extends FetchedState {
6
6
  accountIds: ID[];
7
7
  accountIdsByLabel: Record<AccountLabel, ID[]>;
@@ -108,6 +108,7 @@ const saveVendorEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operator
108
108
  paymentDetailsSection: Object.assign(Object.assign({}, billInLocalStore.billDetailLocalData
109
109
  .paymentDetailsSection), { paymentTo: undefined, internationalTransferFeeBearerPaymentMethod: updatedVendor === null || updatedVendor === void 0 ? void 0 : updatedVendor.preferredInternationalTransferFeeBearerPaymentMethod }),
110
110
  isCollectToAccountInfoFromVendorContact: false,
111
+ isRecurring: false,
111
112
  },
112
113
  billId: action.payload.billId,
113
114
  }), (0, editBillViewReducer_1.updateRecommendedVendorId)());
@@ -22,7 +22,7 @@ const recommendationSelector_1 = require("../../recommendation/recommendationSel
22
22
  const getVendorView = (state, vendorIdFromUrl) => {
23
23
  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, _3;
24
24
  const { accountListState, accountState, addressViewState, bankAccountState, classListState, billPayConfigState, classState, vendorTypeListState, vendorState, vendorViewState, addressState, userState, paymentInstrumentState, } = state;
25
- const accountList = (0, accountListSelector_1.getAccountList)(accountState, accountListState, 'accountList');
25
+ const accountList = (0, accountListSelector_1.getAccountList)(accountState, accountListState, 'billPayAccountList');
26
26
  const classList = (0, classListSelector_1.getClassList)(classState, classListState);
27
27
  const vendorTypeList = vendorTypeListState.vendorTypes;
28
28
  const ownerList = (0, userSelector_1.getUsersByUserIds)(state.userState, state.ownerListState.ownerIds);
@@ -112,7 +112,7 @@ const getVendorView = (state, vendorIdFromUrl) => {
112
112
  (configDetails.method.includes('international') === true &&
113
113
  configDetails.isEnabled === true));
114
114
  }, false);
115
- const accountsHeirarchyList = (0, accountListSelector_1.getNestedAccountListHeirarchy)(accountListState, 'accountList');
115
+ const accountsHeirarchyList = (0, accountListSelector_1.getNestedAccountListHeirarchy)(accountListState, 'billPayAccountList');
116
116
  const classHeirarchyList = (0, classListSelector_1.getNestedClassListHeirarchy)(classListState);
117
117
  const loggedInUserVerification = Object.assign(Object.assign({}, vendorViewState.loggedInUserVerification), { phone: (_1 = vendorViewState.loggedInUserVerification.phone) !== null && _1 !== void 0 ? _1 : (_3 = (0, userSelector_1.getUserByUserId)(userState, (_2 = vendorViewState.loggedInUserVerification.userId) !== null && _2 !== void 0 ? _2 : '')) === null || _3 === void 0 ? void 0 : _3.phone });
118
118
  return Object.assign(Object.assign({}, bankAccount), { bankAccountCreationState: {
@@ -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: {
@@ -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
+ }