@zeniai/client-epic-state 4.8.70 → 4.8.72

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.
@@ -31,7 +31,7 @@ const transferDetailSelector_1 = require("../../zeniAccounts/transferDetail/tran
31
31
  const depositAccountListSelector_1 = require("../../zeniAccounts/depositAccountList/depositAccountListSelector");
32
32
  const depositAccountSelector_1 = require("../../../../entity/depositAccount/depositAccountSelector");
33
33
  const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAccountsEnabled, billId) => {
34
- 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, _4, _5;
34
+ 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, _4, _5, _6;
35
35
  const { accountListState, accountState, bankAccountState, billDetailViewState, setupViewState, billTransactionState, billPayConfigState, classListState, classState, editBillDetailViewState, paymentAccountState, vendorState, tenantState, companyState, userState, commonHistoryState, contactState, paymentInstrumentState, recurringBillState, depositAccountListState, depositAccountState, } = state;
36
36
  const transaction = (0, get_1.default)(billTransactionState.transactionById, billId !== null && billId !== void 0 ? billId : '', undefined);
37
37
  let recommendations = {};
@@ -53,6 +53,14 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
53
53
  let bankAccountList = [];
54
54
  let paymentInstrumentList = [];
55
55
  let contactDetails = [];
56
+ const { currentTenantId } = tenantState;
57
+ const bookCloseDate = currentTenantId != null
58
+ ? (_d = (_c = tenantState.tenantsById) === null || _c === void 0 ? void 0 : _c[currentTenantId]) === null || _d === void 0 ? void 0 : _d.bookCloseDate
59
+ : undefined;
60
+ const companyId = currentTenantId != null
61
+ ? (_f = (_e = tenantState.tenantsById) === null || _e === void 0 ? void 0 : _e[currentTenantId]) === null || _f === void 0 ? void 0 : _f.companyId
62
+ : undefined;
63
+ const currentCompany = (0, companySelector_1.getCompanyByCompanyId)(companyState, companyId !== null && companyId !== void 0 ? companyId : '');
56
64
  const primaryPaymentAccount = (0, paymentAccountSelector_1.getPaymentAccountsByPaymentAccountIds)(paymentAccountState, (transaction === null || transaction === void 0 ? void 0 : transaction.billPayInfo.fromAccount.billAccountType) ===
57
65
  'paymentAccount' &&
58
66
  (transaction === null || transaction === void 0 ? void 0 : transaction.billPayInfo.fromAccount.billAccountId) != null &&
@@ -67,7 +75,8 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
67
75
  (transaction === null || transaction === void 0 ? void 0 : transaction.billPayInfo.fromAccount.billAccountId) != null
68
76
  ? (0, depositAccountSelector_1.getDepositAccountByDepositAccountId)(depositAccountState, transaction === null || transaction === void 0 ? void 0 : transaction.billPayInfo.fromAccount.billAccountId)
69
77
  : undefined;
70
- const allDepositAccounts = isZeniAccountsEnabled
78
+ const isCompanyZeniAccountsSetUpDone = (_g = currentCompany === null || currentCompany === void 0 ? void 0 : currentCompany.company.companyZeniAccountInfo.isZeniAccountEnabled) !== null && _g !== void 0 ? _g : false;
79
+ const allDepositAccounts = isZeniAccountsEnabled && isCompanyZeniAccountsSetUpDone
71
80
  ? (0, depositAccountListSelector_1.getAllDepostAccounts)(depositAccountState, depositAccountListState)
72
81
  .depositAccounts
73
82
  : [];
@@ -91,14 +100,6 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
91
100
  error: undefined,
92
101
  };
93
102
  let qboId;
94
- const { currentTenantId } = tenantState;
95
- const bookCloseDate = currentTenantId != null
96
- ? (_d = (_c = tenantState.tenantsById) === null || _c === void 0 ? void 0 : _c[currentTenantId]) === null || _d === void 0 ? void 0 : _d.bookCloseDate
97
- : undefined;
98
- const companyId = currentTenantId != null
99
- ? (_f = (_e = tenantState.tenantsById) === null || _e === void 0 ? void 0 : _e[currentTenantId]) === null || _f === void 0 ? void 0 : _f.companyId
100
- : undefined;
101
- const currentCompany = (0, companySelector_1.getCompanyByCompanyId)(companyState, companyId !== null && companyId !== void 0 ? companyId : '');
102
103
  const payNowCutOffTime = currentCompany === null || currentCompany === void 0 ? void 0 : currentCompany.company.companyBillPayInfo.payNowCutOffTimeByMethod.ach;
103
104
  let billActivities = [];
104
105
  let createdBy = undefined;
@@ -118,15 +119,15 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
118
119
  let recurringConfig;
119
120
  let recurringBillInstances;
120
121
  if (billId != null) {
121
- isDeleted = (_g = transaction === null || transaction === void 0 ? void 0 : transaction.isDeleted) !== null && _g !== void 0 ? _g : false;
122
- createdBy = (0, userSelector_1.getUserByUserId)(userState, (_h = transaction === null || transaction === void 0 ? void 0 : transaction.createdBy) !== null && _h !== void 0 ? _h : '');
122
+ isDeleted = (_h = transaction === null || transaction === void 0 ? void 0 : transaction.isDeleted) !== null && _h !== void 0 ? _h : false;
123
+ createdBy = (0, userSelector_1.getUserByUserId)(userState, (_j = transaction === null || transaction === void 0 ? void 0 : transaction.createdBy) !== null && _j !== void 0 ? _j : '');
123
124
  createTime = transaction === null || transaction === void 0 ? void 0 : transaction.createTime;
124
- qboId = (_j = transaction === null || transaction === void 0 ? void 0 : transaction.account) === null || _j === void 0 ? void 0 : _j.qboId;
125
+ qboId = (_k = transaction === null || transaction === void 0 ? void 0 : transaction.account) === null || _k === void 0 ? void 0 : _k.qboId;
125
126
  billPayInfo = transaction === null || transaction === void 0 ? void 0 : transaction.billPayInfo;
126
127
  toAccountVendorEmail = transaction === null || transaction === void 0 ? void 0 : transaction.billPayInfo.toAccountVendorEmail;
127
128
  isCollectToAccountInfoFromVendorContact =
128
- (_k = transaction === null || transaction === void 0 ? void 0 : transaction.billPayInfo.isCollectToAccountInfoFromVendorContact) !== null && _k !== void 0 ? _k : false;
129
- const initialVendor = (0, vendorSelector_1.getVendorByQboId)(vendorState, (_m = (_l = transaction === null || transaction === void 0 ? void 0 : transaction.vendor) === null || _l === void 0 ? void 0 : _l.id) !== null && _m !== void 0 ? _m : '');
129
+ (_l = transaction === null || transaction === void 0 ? void 0 : transaction.billPayInfo.isCollectToAccountInfoFromVendorContact) !== null && _l !== void 0 ? _l : false;
130
+ const initialVendor = (0, vendorSelector_1.getVendorByQboId)(vendorState, (_o = (_m = transaction === null || transaction === void 0 ? void 0 : transaction.vendor) === null || _m === void 0 ? void 0 : _m.id) !== null && _o !== void 0 ? _o : '');
130
131
  const initialWhatForSection = {
131
132
  invoiceNumber: transaction === null || transaction === void 0 ? void 0 : transaction.documentId,
132
133
  invoiceDate: transaction === null || transaction === void 0 ? void 0 : transaction.date,
@@ -136,7 +137,7 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
136
137
  };
137
138
  const updatesByLineId = {};
138
139
  if (accountList.fetchState === 'Completed') {
139
- (_o = transaction === null || transaction === void 0 ? void 0 : transaction.lines) === null || _o === void 0 ? void 0 : _o.forEach((line) => {
140
+ (_p = transaction === null || transaction === void 0 ? void 0 : transaction.lines) === null || _p === void 0 ? void 0 : _p.forEach((line) => {
140
141
  var _a;
141
142
  updatesByLineId[line.id] = Object.assign(Object.assign({}, line), { account: (_a = accountList.accounts.find((account) => {
142
143
  var _a;
@@ -146,10 +147,10 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
146
147
  });
147
148
  }
148
149
  const initialPaymentDetailsSection = {
149
- paymentType: (0, exports.getPaymentMethodType)(billPayConfigState, (_p = billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.fromAccount.billAccountType) !== null && _p !== void 0 ? _p : 'depositAccount', billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.billPaymentMethodType, billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.internationalTransferFeeBearerPaymentMethod),
150
+ paymentType: (0, exports.getPaymentMethodType)(billPayConfigState, (_q = billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.fromAccount.billAccountType) !== null && _q !== void 0 ? _q : 'depositAccount', billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.billPaymentMethodType, billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.internationalTransferFeeBearerPaymentMethod),
150
151
  paymentDate: billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.paymentDate,
151
- withdrawFrom: (0, exports.getWithdrawFrom)(paymentAccountState, depositAccountState, (_q = billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.fromAccount.billAccountId) !== null && _q !== void 0 ? _q : '', (_r = billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.fromAccount.billAccountType) !== null && _r !== void 0 ? _r : ''),
152
- paymentTo: ((_s = billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.toAccount.billAccountId) === null || _s === void 0 ? void 0 : _s.length) != null &&
152
+ withdrawFrom: (0, exports.getWithdrawFrom)(paymentAccountState, depositAccountState, (_r = billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.fromAccount.billAccountId) !== null && _r !== void 0 ? _r : '', (_s = billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.fromAccount.billAccountType) !== null && _s !== void 0 ? _s : ''),
153
+ paymentTo: ((_t = billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.toAccount.billAccountId) === null || _t === void 0 ? void 0 : _t.length) != null &&
153
154
  (billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.toAccount.billAccountId.length) > 0
154
155
  ? billPayInfo.toAccount.billAccountId
155
156
  : undefined,
@@ -166,7 +167,7 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
166
167
  if (sourceBillDetail != null) {
167
168
  const billViewState = billDetailViewState.billDetailById[key];
168
169
  isCancelled = sourceBillDetail.billDetailLocalData.isCancelled;
169
- billStage = (_t = billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.stage.code) !== null && _t !== void 0 ? _t : 'draft';
170
+ billStage = (_u = billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.stage.code) !== null && _u !== void 0 ? _u : 'draft';
170
171
  if (billViewState != null) {
171
172
  fetchState = (0, reduceFetchState_1.reduceFetchState)([
172
173
  sourceBillDetail.fetchStatus,
@@ -178,7 +179,7 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
178
179
  }
179
180
  }
180
181
  //recurringBill Details
181
- isRecurring = (_u = transaction === null || transaction === void 0 ? void 0 : transaction.isRecurring) !== null && _u !== void 0 ? _u : false;
182
+ isRecurring = (_v = transaction === null || transaction === void 0 ? void 0 : transaction.isRecurring) !== null && _v !== void 0 ? _v : false;
182
183
  if (isRecurring && transaction != null) {
183
184
  const { recurringConfigLocalData, recurringBillInstancesLocalData } = (0, exports.getRecurringBillLocalData)(recurringBillState, transaction);
184
185
  recurringConfig = recurringConfigLocalData;
@@ -208,9 +209,9 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
208
209
  ? (0, vendorSelector_1.getVendorByVendorId)(vendorState, updatedRecord.vendor.id)
209
210
  : undefined;
210
211
  file = updatedRecord.file;
211
- const bankAccInBill = (0, bankAccountSelector_1.getBankAccountByBankAccountId)(bankAccountState, (_w = (_v = updatedRecord.paymentDetailsSection) === null || _v === void 0 ? void 0 : _v.paymentTo) !== null && _w !== void 0 ? _w : '');
212
- const vendorBankAccounts = (0, bankAccountSelector_1.getBankAccountsByBankAccountIds)(bankAccountState, (_x = vendorDetails === null || vendorDetails === void 0 ? void 0 : vendorDetails.bankAccountIds) !== null && _x !== void 0 ? _x : []);
213
- const vendorPaymentInstruments = (0, paymentInstrumentSelector_1.getPaymentInstrumentsByIds)(paymentInstrumentState, (_y = vendorDetails === null || vendorDetails === void 0 ? void 0 : vendorDetails.paymentInstrumentIds) !== null && _y !== void 0 ? _y : []);
212
+ const bankAccInBill = (0, bankAccountSelector_1.getBankAccountByBankAccountId)(bankAccountState, (_x = (_w = updatedRecord.paymentDetailsSection) === null || _w === void 0 ? void 0 : _w.paymentTo) !== null && _x !== void 0 ? _x : '');
213
+ const vendorBankAccounts = (0, bankAccountSelector_1.getBankAccountsByBankAccountIds)(bankAccountState, (_y = vendorDetails === null || vendorDetails === void 0 ? void 0 : vendorDetails.bankAccountIds) !== null && _y !== void 0 ? _y : []);
214
+ const vendorPaymentInstruments = (0, paymentInstrumentSelector_1.getPaymentInstrumentsByIds)(paymentInstrumentState, (_z = vendorDetails === null || vendorDetails === void 0 ? void 0 : vendorDetails.paymentInstrumentIds) !== null && _z !== void 0 ? _z : []);
214
215
  const isBankAccInBillExistInVendor = bankAccInBill != null
215
216
  ? vendorBankAccounts
216
217
  .map((bankAc) => bankAc.bankAccountId)
@@ -260,7 +261,7 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
260
261
  (recommendedVendor === null || recommendedVendor === void 0 ? void 0 : recommendedVendor.vendorCurrencyCode) != null) {
261
262
  whatForSection.currencyCode = recommendedVendor.vendorCurrencyCode;
262
263
  }
263
- isRecurring = (_z = sourceBillDetail.billDetailLocalData.isRecurring) !== null && _z !== void 0 ? _z : false;
264
+ isRecurring = (_0 = sourceBillDetail.billDetailLocalData.isRecurring) !== null && _0 !== void 0 ? _0 : false;
264
265
  recurringConfig = sourceBillDetail.billDetailLocalData.recurringConfig;
265
266
  recurringBillInstances =
266
267
  sourceBillDetail.billDetailLocalData.recurringBillInstances;
@@ -280,7 +281,7 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
280
281
  }
281
282
  const vendorContactSaveStatus = editBillDetailViewState.updateVendorContactState;
282
283
  const lineDetailSection = {};
283
- const lineDetailSectionUpdatesByLineId = (_1 = (_0 = sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.billDetailLocalData) === null || _0 === void 0 ? void 0 : _0.updatesByLineId) !== null && _1 !== void 0 ? _1 : {};
284
+ const lineDetailSectionUpdatesByLineId = (_2 = (_1 = sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.billDetailLocalData) === null || _1 === void 0 ? void 0 : _1.updatesByLineId) !== null && _2 !== void 0 ? _2 : {};
284
285
  const classList = (0, classListSelector_1.getClassList)(classState, classListState);
285
286
  if (accountList.fetchState === 'Completed') {
286
287
  Object.keys(lineDetailSectionUpdatesByLineId).forEach((lineId) => {
@@ -307,9 +308,9 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
307
308
  lastRecommendedVendorName,
308
309
  duplicateBills,
309
310
  fetchState: fetchState,
310
- saveStatus: (_2 = sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.saveStatus) !== null && _2 !== void 0 ? _2 : undefined,
311
- error: (_4 = (_3 = sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.fetchStatus) === null || _3 === void 0 ? void 0 : _3.error) !== null && _4 !== void 0 ? _4 : undefined,
312
- uploadStatus: (_5 = sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.uploadFetchState) !== null && _5 !== void 0 ? _5 : undefined,
311
+ saveStatus: (_3 = sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.saveStatus) !== null && _3 !== void 0 ? _3 : undefined,
312
+ error: (_5 = (_4 = sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.fetchStatus) === null || _4 === void 0 ? void 0 : _4.error) !== null && _5 !== void 0 ? _5 : undefined,
313
+ uploadStatus: (_6 = sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.uploadFetchState) !== null && _6 !== void 0 ? _6 : undefined,
313
314
  version: 0,
314
315
  createdBy,
315
316
  createTime,
@@ -12,17 +12,28 @@ const ownerListReducer_1 = require("../../../../ownerList/ownerListReducer");
12
12
  const vendorTypeListReducer_1 = require("../../../../vendorTypeList/vendorTypeListReducer");
13
13
  const billPayConfigReducer_1 = require("../../billPayConfig/billPayConfigReducer");
14
14
  const depositAccountListReducer_1 = require("../../../zeniAccounts/depositAccountList/depositAccountListReducer");
15
+ const companySelector_1 = require("../../../../../entity/company/companySelector");
15
16
  const fetchEditBillDetailPageEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(editBillViewReducer_1.fetchEditBillDetailPage.match), (0, operators_1.mergeMap)((action) => {
17
+ var _a, _b, _c;
16
18
  const { cacheOverride, billId, isShowDeletedBillsEnabled } = action.payload;
17
19
  const billDetailActions = [];
18
20
  const state = state$.value;
21
+ const { tenantState, companyState } = state;
22
+ const { currentTenantId } = tenantState;
23
+ const companyId = currentTenantId != null
24
+ ? (_b = (_a = tenantState.tenantsById) === null || _a === void 0 ? void 0 : _a[currentTenantId]) === null || _b === void 0 ? void 0 : _b.companyId
25
+ : undefined;
26
+ const currentCompany = (0, companySelector_1.getCompanyByCompanyId)(companyState, companyId !== null && companyId !== void 0 ? companyId : '');
27
+ const isCompanyZeniAccountsSetUpDone = (_c = currentCompany === null || currentCompany === void 0 ? void 0 : currentCompany.company.companyZeniAccountInfo.isZeniAccountEnabled) !== null && _c !== void 0 ? _c : false;
19
28
  if (cacheOverride == true) {
20
29
  billDetailActions.push((0, accountListReducer_1.fetchAccountList)('billPayAccountList', true, true, true));
21
30
  billDetailActions.push((0, classListReducer_1.fetchClassList)());
22
31
  billDetailActions.push((0, vendorTypeListReducer_1.fetchVendorTypeList)());
23
32
  billDetailActions.push((0, ownerListReducer_1.fetchOwnerList)());
24
33
  billDetailActions.push((0, billPayConfigReducer_1.fetchBillPayConfig)());
25
- billDetailActions.push((0, depositAccountListReducer_1.fetchDepositAccountList)());
34
+ if (isCompanyZeniAccountsSetUpDone) {
35
+ billDetailActions.push((0, depositAccountListReducer_1.fetchDepositAccountList)());
36
+ }
26
37
  billDetailActions.push((0, setupViewReducer_1.getPaymentAccounts)('bill_pay'));
27
38
  if (billId != null) {
28
39
  billDetailActions.push((0, editBillViewReducer_1.fetchBillAndInitializeLocalStore)(billId, true, isShowDeletedBillsEnabled));
@@ -57,7 +68,8 @@ const fetchEditBillDetailPageEpic = (actions$, state$) => actions$.pipe((0, oper
57
68
  billDetailActions.push((0, billPayConfigReducer_1.fetchBillPayConfig)());
58
69
  }
59
70
  const depositAccounts = state.depositAccountListState;
60
- if (depositAccounts.fetchState !== 'In-Progress' &&
71
+ if (isCompanyZeniAccountsSetUpDone &&
72
+ depositAccounts.fetchState !== 'In-Progress' &&
61
73
  depositAccounts.fetchState !== 'Completed') {
62
74
  billDetailActions.push((0, depositAccountListReducer_1.fetchDepositAccountList)());
63
75
  }
@@ -35,7 +35,7 @@ const saveBillDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, oper
35
35
  const isRecurringBill = billDetail.billDetailLocalData.isRecurring;
36
36
  const saveBillBaseURL = `${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/bills/transactions`;
37
37
  const saveBillApi = billId != null
38
- ? zeniAPI.putAndGetJSON(getSaveBillApiURL(saveBillBaseURL, isRecurringBill, billId), payload)
38
+ ? zeniAPI.putAndGetJSON(getSaveBillApiURL(saveBillBaseURL, isRecurringBill, billId, state.billTransactionState), payload)
39
39
  : zeniAPI.postAndGetJSON(getSaveBillApiURL(saveBillBaseURL, isRecurringBill), payload);
40
40
  return saveBillApi.pipe((0, operators_1.mergeMap)((response) => {
41
41
  var _a, _b, _c, _d;
@@ -72,9 +72,10 @@ const saveBillDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, oper
72
72
  }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, editBillViewReducer_1.saveBillSuccessOrFailure)('Error', action.payload.billId, (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', `REST API call errored out ${JSON.stringify(error)}`)))));
73
73
  }));
74
74
  exports.saveBillDetailEpic = saveBillDetailEpic;
75
- const getSaveBillApiURL = (saveBillBaseURL, isRecurring, billId) => {
75
+ const getSaveBillApiURL = (saveBillBaseURL, isRecurring, billId, billTransactionState) => {
76
76
  if (billId != null) {
77
- return isRecurring
77
+ const originalBillDetail = (0, get_1.default)(billTransactionState === null || billTransactionState === void 0 ? void 0 : billTransactionState.transactionById, billId);
78
+ return isRecurring || (originalBillDetail === null || originalBillDetail === void 0 ? void 0 : originalBillDetail.isRecurring) === true //platform needs this to clear old Recurring details
78
79
  ? `${saveBillBaseURL}/${billId}/recurring`
79
80
  : `${saveBillBaseURL}/${billId}`;
80
81
  }
@@ -164,6 +165,12 @@ function prepareSaveBillPayload(accountState, billTransactionState, paymentAccou
164
165
  detail = (0, get_1.default)(billTransactionState.transactionById, billId, undefined);
165
166
  payload.sync_token = (_19 = detail === null || detail === void 0 ? void 0 : detail.syncToken) !== null && _19 !== void 0 ? _19 : null;
166
167
  payload.update_time = (_20 = detail === null || detail === void 0 ? void 0 : detail.updateTime.format('YYYY-MM-DD')) !== null && _20 !== void 0 ? _20 : null;
168
+ //required by platform to clear old recurring details
169
+ if ((detail === null || detail === void 0 ? void 0 : detail.isRecurring) === true &&
170
+ Boolean(billDetail.billDetailLocalData.isRecurring) === false) {
171
+ payload.is_recurring = false;
172
+ payload.is_update_current_bill = true;
173
+ }
167
174
  }
168
175
  else {
169
176
  payload.are_approvals_serialized = true;
@@ -220,6 +227,10 @@ function prepareSaveBillPayload(accountState, billTransactionState, paymentAccou
220
227
  return (0, exports.toRecurringBillInstancePayload)(instance, (_d = (_c = (_b = (_a = billDetail.billDetailLocalData.paymentDetailsSection) === null || _a === void 0 ? void 0 : _a.paymentType) === null || _b === void 0 ? void 0 : _b.maxPeriod) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : workingDayHelper_1.PAYMENT_BUSINESS_DAYS);
221
228
  });
222
229
  }
230
+ //platform needs this when converting a bill from non-recurring to recurring
231
+ if ((detail === null || detail === void 0 ? void 0 : detail.isRecurring) === false) {
232
+ payload.is_update_current_bill = true;
233
+ }
223
234
  }
224
235
  return payload;
225
236
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.8.70",
3
+ "version": "4.8.72",
4
4
  "description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",