@zeniai/client-epic-state 4.8.40 → 4.8.42

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.
@@ -57,7 +57,7 @@ const saveVendorEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operator
57
57
  : zeniAPI.postAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/vendors`, payload);
58
58
  const userId = (_g = (_f = state.tenantState.loggedInUser) === null || _f === void 0 ? void 0 : _f.userId) !== null && _g !== void 0 ? _g : '';
59
59
  return saveVendorApi.pipe((0, operators_1.mergeMap)((response) => {
60
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
60
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
61
61
  if ((0, responsePayload_1.isSuccessResponse)(response)) {
62
62
  const updatedVendor = ((_a = response.data) === null || _a === void 0 ? void 0 : _a.vendors[0]) != null
63
63
  ? (0, vendorPayload_1.mapVendorPayloadToVendor)((_b = response.data) === null || _b === void 0 ? void 0 : _b.vendors[0])
@@ -112,15 +112,42 @@ const saveVendorEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operator
112
112
  currencySymbol: (_r = updatedVendor.vendorCurrencySymbol) !== null && _r !== void 0 ? _r : '$',
113
113
  }, 'USD', action.payload.billId));
114
114
  }
115
+ const originalShowVendorGptRecommendationText = billInLocalStore.billDetailLocalData
116
+ .showVendorGptRecommendationText;
117
+ const recommendedVendorId = billInLocalStore.billDetailLocalData.recommendedVendorId;
118
+ const vendorId = (_s = billInLocalStore.billDetailLocalData.vendor) === null || _s === void 0 ? void 0 : _s.id;
119
+ const tentativeVendorName = billInLocalStore.addBillAutoFields.tentativeVendorName;
120
+ let showVendorGptRecommendationText;
121
+ // recommended vendor is same as updated Vendor
122
+ if (recommendedVendorId != null &&
123
+ recommendedVendorId === (updatedVendor === null || updatedVendor === void 0 ? void 0 : updatedVendor.id)) {
124
+ showVendorGptRecommendationText = true;
125
+ }
126
+ // updated vendor is not same as current vendor in bill
127
+ else if (vendorId != null &&
128
+ (updatedVendor === null || updatedVendor === void 0 ? void 0 : updatedVendor.id) != null &&
129
+ vendorId !== updatedVendor.id) {
130
+ showVendorGptRecommendationText = false;
131
+ }
132
+ //updated vendor name is not same as tentativeVendorName in case of setup vendor
133
+ else if (Boolean(tentativeVendorName) === true &&
134
+ tentativeVendorName === (updatedVendor === null || updatedVendor === void 0 ? void 0 : updatedVendor.name)) {
135
+ showVendorGptRecommendationText = true;
136
+ }
137
+ else {
138
+ showVendorGptRecommendationText =
139
+ originalShowVendorGptRecommendationText;
140
+ }
115
141
  actions.push((0, editBillViewReducer_1.saveBillUpdatesToLocalStore)({
116
142
  billDetailLocalData: {
143
+ showVendorGptRecommendationText,
117
144
  vendor: updatedVendor,
118
145
  isCancelled: isCancelled,
119
146
  updatesByLineId: updatedLines,
120
147
  whatForSection: Object.assign(Object.assign({}, billInLocalStore.billDetailLocalData.whatForSection), { currencyCode: updatedVendor === null || updatedVendor === void 0 ? void 0 : updatedVendor.vendorCurrencyCode }),
121
148
  paymentDetailsSection: Object.assign(Object.assign({}, billInLocalStore.billDetailLocalData
122
- .paymentDetailsSection), { paymentTo: undefined, internationalTransferFeeBearerPaymentMethod: updatedVendor === null || updatedVendor === void 0 ? void 0 : updatedVendor.preferredInternationalTransferFeeBearerPaymentMethod, paymentDate: (_t = (_s = billInLocalStore.billDetailLocalData
123
- .paymentDetailsSection) === null || _s === void 0 ? void 0 : _s.paymentDate) !== null && _t !== void 0 ? _t :
149
+ .paymentDetailsSection), { paymentTo: undefined, internationalTransferFeeBearerPaymentMethod: updatedVendor === null || updatedVendor === void 0 ? void 0 : updatedVendor.preferredInternationalTransferFeeBearerPaymentMethod, paymentDate: (_u = (_t = billInLocalStore.billDetailLocalData
150
+ .paymentDetailsSection) === null || _t === void 0 ? void 0 : _t.paymentDate) !== null && _u !== void 0 ? _u :
124
151
  //in case paymentDate is not present in the billDetailLocalData, then today/next working date will be considered.
125
152
  //this is done beacuse we are doing similar calcualtion in getDefaultValues of editBillDetailPage.
126
153
  (0, zeniDayJS_1.date)((0, workingDayHelper_1.getNextNthWorkingDay)((0, zeniDayJS_1.dateNow)().toDate(), [0, 6], isPayNowEnabled ? 0 : 1).toISOString()) }),
@@ -145,7 +172,7 @@ const saveVendorEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operator
145
172
  return (0, rxjs_1.from)(actions);
146
173
  }
147
174
  else {
148
- if (((_u = response.data) === null || _u === void 0 ? void 0 : _u.error_code) === 1001) {
175
+ if (((_v = response.data) === null || _v === void 0 ? void 0 : _v.error_code) === 1001) {
149
176
  return (0, rxjs_1.of)((0, vendorViewReducer_1.saveVendorSuccessOrFailure)('Error', action.payload.vendorId, response.status, true), (0, vendorViewReducer_1.fetchUserDetails)({ userId: userId }));
150
177
  }
151
178
  return (0, rxjs_1.of)((0, vendorViewReducer_1.saveVendorSuccessOrFailure)('Error', action.payload.vendorId, response.status), (0, snackbarReducer_1.openSnackbar)({
@@ -74,6 +74,7 @@ export interface EditBillDetailSelectorView extends SelectorView {
74
74
  billPayConfigList: BillPayConfig[];
75
75
  file: Attachment | undefined;
76
76
  previousBills: PreviousBillsSelectorView;
77
+ showVendorGptRecommendationText: boolean;
77
78
  isCancelled: boolean;
78
79
  isDeleted: boolean;
79
80
  showAutofill: boolean;
@@ -30,7 +30,7 @@ const transferDetailSelector_1 = require("../../zeniAccounts/transferDetail/tran
30
30
  const depositAccountListSelector_1 = require("../../zeniAccounts/depositAccountList/depositAccountListSelector");
31
31
  const depositAccountSelector_1 = require("../../../../entity/depositAccount/depositAccountSelector");
32
32
  const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAccountsEnabled, billId) => {
33
- 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;
33
+ 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
34
  const { accountListState, accountState, bankAccountState, billDetailViewState, setupViewState, billTransactionState, billPayConfigState, classListState, classState, editBillDetailViewState, paymentAccountState, vendorState, tenantState, companyState, userState, commonHistoryState, contactState, paymentInstrumentState, recurringBillState, depositAccountListState, depositAccountState, } = state;
35
35
  const transaction = (0, get_1.default)(billTransactionState.transactionById, billId !== null && billId !== void 0 ? billId : '', undefined);
36
36
  let recommendations = {};
@@ -41,6 +41,7 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
41
41
  const sourceBillDetail = billId != null
42
42
  ? (_a = editBillDetailViewState.editBillStateById) === null || _a === void 0 ? void 0 : _a[key]
43
43
  : editBillDetailViewState.newBillState;
44
+ const showVendorGptRecommendationText = (_b = sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.billDetailLocalData.showVendorGptRecommendationText) !== null && _b !== void 0 ? _b : false;
44
45
  let vendorDetails;
45
46
  let recommendedVendor;
46
47
  let lastRecommendedVendorName;
@@ -91,10 +92,10 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
91
92
  let qboId;
92
93
  const { currentTenantId } = tenantState;
93
94
  const bookCloseDate = currentTenantId != null
94
- ? (_c = (_b = tenantState.tenantsById) === null || _b === void 0 ? void 0 : _b[currentTenantId]) === null || _c === void 0 ? void 0 : _c.bookCloseDate
95
+ ? (_d = (_c = tenantState.tenantsById) === null || _c === void 0 ? void 0 : _c[currentTenantId]) === null || _d === void 0 ? void 0 : _d.bookCloseDate
95
96
  : undefined;
96
97
  const companyId = currentTenantId != null
97
- ? (_e = (_d = tenantState.tenantsById) === null || _d === void 0 ? void 0 : _d[currentTenantId]) === null || _e === void 0 ? void 0 : _e.companyId
98
+ ? (_f = (_e = tenantState.tenantsById) === null || _e === void 0 ? void 0 : _e[currentTenantId]) === null || _f === void 0 ? void 0 : _f.companyId
98
99
  : undefined;
99
100
  const currentCompany = (0, companySelector_1.getCompanyByCompanyId)(companyState, companyId !== null && companyId !== void 0 ? companyId : '');
100
101
  const payNowCutOffTime = currentCompany === null || currentCompany === void 0 ? void 0 : currentCompany.company.companyBillPayInfo.payNowCutOffTimeByMethod.ach;
@@ -116,15 +117,15 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
116
117
  let recurringConfig;
117
118
  let recurringBillInstances;
118
119
  if (billId != null) {
119
- isDeleted = (_f = transaction === null || transaction === void 0 ? void 0 : transaction.isDeleted) !== null && _f !== void 0 ? _f : false;
120
- createdBy = (0, userSelector_1.getUserByUserId)(userState, (_g = transaction === null || transaction === void 0 ? void 0 : transaction.createdBy) !== null && _g !== void 0 ? _g : '');
120
+ isDeleted = (_g = transaction === null || transaction === void 0 ? void 0 : transaction.isDeleted) !== null && _g !== void 0 ? _g : false;
121
+ createdBy = (0, userSelector_1.getUserByUserId)(userState, (_h = transaction === null || transaction === void 0 ? void 0 : transaction.createdBy) !== null && _h !== void 0 ? _h : '');
121
122
  createTime = transaction === null || transaction === void 0 ? void 0 : transaction.createTime;
122
- qboId = (_h = transaction === null || transaction === void 0 ? void 0 : transaction.account) === null || _h === void 0 ? void 0 : _h.qboId;
123
+ qboId = (_j = transaction === null || transaction === void 0 ? void 0 : transaction.account) === null || _j === void 0 ? void 0 : _j.qboId;
123
124
  billPayInfo = transaction === null || transaction === void 0 ? void 0 : transaction.billPayInfo;
124
125
  toAccountVendorEmail = transaction === null || transaction === void 0 ? void 0 : transaction.billPayInfo.toAccountVendorEmail;
125
126
  isCollectToAccountInfoFromVendorContact =
126
- (_j = transaction === null || transaction === void 0 ? void 0 : transaction.billPayInfo.isCollectToAccountInfoFromVendorContact) !== null && _j !== void 0 ? _j : false;
127
- const initialVendor = (0, vendorSelector_1.getVendorByQboId)(vendorState, (_l = (_k = transaction === null || transaction === void 0 ? void 0 : transaction.vendor) === null || _k === void 0 ? void 0 : _k.id) !== null && _l !== void 0 ? _l : '');
127
+ (_k = transaction === null || transaction === void 0 ? void 0 : transaction.billPayInfo.isCollectToAccountInfoFromVendorContact) !== null && _k !== void 0 ? _k : false;
128
+ 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 : '');
128
129
  const initialWhatForSection = {
129
130
  invoiceNumber: transaction === null || transaction === void 0 ? void 0 : transaction.documentId,
130
131
  invoiceDate: transaction === null || transaction === void 0 ? void 0 : transaction.date,
@@ -133,7 +134,7 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
133
134
  };
134
135
  const updatesByLineId = {};
135
136
  if (accountList.fetchState === 'Completed') {
136
- (_m = transaction === null || transaction === void 0 ? void 0 : transaction.lines) === null || _m === void 0 ? void 0 : _m.forEach((line) => {
137
+ (_o = transaction === null || transaction === void 0 ? void 0 : transaction.lines) === null || _o === void 0 ? void 0 : _o.forEach((line) => {
137
138
  var _a;
138
139
  updatesByLineId[line.id] = Object.assign(Object.assign({}, line), { account: (_a = accountList.accounts.find((account) => {
139
140
  var _a;
@@ -143,10 +144,10 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
143
144
  });
144
145
  }
145
146
  const initialPaymentDetailsSection = {
146
- paymentType: (0, exports.getPaymentMethodType)(billPayConfigState, (_o = billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.fromAccount.billAccountType) !== null && _o !== void 0 ? _o : 'depositAccount', billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.billPaymentMethodType, billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.internationalTransferFeeBearerPaymentMethod),
147
+ 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),
147
148
  paymentDate: billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.paymentDate,
148
- withdrawFrom: (0, exports.getWithdrawFrom)(paymentAccountState, depositAccountState, (_p = billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.fromAccount.billAccountId) !== null && _p !== void 0 ? _p : '', (_q = billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.fromAccount.billAccountType) !== null && _q !== void 0 ? _q : ''),
149
- paymentTo: ((_r = billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.toAccount.billAccountId) === null || _r === void 0 ? void 0 : _r.length) != null &&
149
+ 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 : ''),
150
+ paymentTo: ((_s = billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.toAccount.billAccountId) === null || _s === void 0 ? void 0 : _s.length) != null &&
150
151
  (billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.toAccount.billAccountId.length) > 0
151
152
  ? billPayInfo.toAccount.billAccountId
152
153
  : undefined,
@@ -163,7 +164,7 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
163
164
  if (sourceBillDetail != null) {
164
165
  const billViewState = billDetailViewState.billDetailById[key];
165
166
  isCancelled = sourceBillDetail.billDetailLocalData.isCancelled;
166
- billStage = (_s = billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.stage.code) !== null && _s !== void 0 ? _s : 'draft';
167
+ billStage = (_t = billPayInfo === null || billPayInfo === void 0 ? void 0 : billPayInfo.stage.code) !== null && _t !== void 0 ? _t : 'draft';
167
168
  if (billViewState != null) {
168
169
  fetchState = (0, reduceFetchState_1.reduceFetchState)([
169
170
  sourceBillDetail.fetchStatus,
@@ -175,7 +176,7 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
175
176
  }
176
177
  }
177
178
  //recurringBill Details
178
- isRecurring = (_t = transaction === null || transaction === void 0 ? void 0 : transaction.isRecurring) !== null && _t !== void 0 ? _t : false;
179
+ isRecurring = (_u = transaction === null || transaction === void 0 ? void 0 : transaction.isRecurring) !== null && _u !== void 0 ? _u : false;
179
180
  if (isRecurring && transaction != null) {
180
181
  const { recurringConfigLocalData, recurringBillInstancesLocalData } = (0, exports.getRecurringBillLocalData)(recurringBillState, transaction);
181
182
  recurringConfig = recurringConfigLocalData;
@@ -205,9 +206,9 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
205
206
  ? (0, vendorSelector_1.getVendorByVendorId)(vendorState, updatedRecord.vendor.id)
206
207
  : undefined;
207
208
  file = updatedRecord.file;
208
- const bankAccInBill = (0, bankAccountSelector_1.getBankAccountByBankAccountId)(bankAccountState, (_v = (_u = updatedRecord.paymentDetailsSection) === null || _u === void 0 ? void 0 : _u.paymentTo) !== null && _v !== void 0 ? _v : '');
209
- const vendorBankAccounts = (0, bankAccountSelector_1.getBankAccountsByBankAccountIds)(bankAccountState, (_w = vendorDetails === null || vendorDetails === void 0 ? void 0 : vendorDetails.bankAccountIds) !== null && _w !== void 0 ? _w : []);
210
- const vendorPaymentInstruments = (0, paymentInstrumentSelector_1.getPaymentInstrumentsByIds)(paymentInstrumentState, (_x = vendorDetails === null || vendorDetails === void 0 ? void 0 : vendorDetails.paymentInstrumentIds) !== null && _x !== void 0 ? _x : []);
209
+ const bankAccInBill = (0, bankAccountSelector_1.getBankAccountByBankAccountId)(bankAccountState, (_w = (_v = updatedRecord.paymentDetailsSection) === null || _v === void 0 ? void 0 : _v.paymentTo) !== null && _w !== void 0 ? _w : '');
210
+ const vendorBankAccounts = (0, bankAccountSelector_1.getBankAccountsByBankAccountIds)(bankAccountState, (_x = vendorDetails === null || vendorDetails === void 0 ? void 0 : vendorDetails.bankAccountIds) !== null && _x !== void 0 ? _x : []);
211
+ const vendorPaymentInstruments = (0, paymentInstrumentSelector_1.getPaymentInstrumentsByIds)(paymentInstrumentState, (_y = vendorDetails === null || vendorDetails === void 0 ? void 0 : vendorDetails.paymentInstrumentIds) !== null && _y !== void 0 ? _y : []);
211
212
  const isBankAccInBillExistInVendor = bankAccInBill != null
212
213
  ? vendorBankAccounts
213
214
  .map((bankAc) => bankAc.bankAccountId)
@@ -257,7 +258,7 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
257
258
  (recommendedVendor === null || recommendedVendor === void 0 ? void 0 : recommendedVendor.vendorCurrencyCode) != null) {
258
259
  whatForSection.currencyCode = recommendedVendor.vendorCurrencyCode;
259
260
  }
260
- isRecurring = (_y = sourceBillDetail.billDetailLocalData.isRecurring) !== null && _y !== void 0 ? _y : false;
261
+ isRecurring = (_z = sourceBillDetail.billDetailLocalData.isRecurring) !== null && _z !== void 0 ? _z : false;
261
262
  recurringConfig = sourceBillDetail.billDetailLocalData.recurringConfig;
262
263
  recurringBillInstances =
263
264
  sourceBillDetail.billDetailLocalData.recurringBillInstances;
@@ -277,7 +278,7 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
277
278
  }
278
279
  const vendorContactSaveStatus = editBillDetailViewState.updateVendorContactState;
279
280
  const lineDetailSection = {};
280
- const lineDetailSectionUpdatesByLineId = (_0 = (_z = sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.billDetailLocalData) === null || _z === void 0 ? void 0 : _z.updatesByLineId) !== null && _0 !== void 0 ? _0 : {};
281
+ 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 : {};
281
282
  const classList = (0, classListSelector_1.getClassList)(classState, classListState);
282
283
  if (accountList.fetchState === 'Completed') {
283
284
  Object.keys(lineDetailSectionUpdatesByLineId).forEach((lineId) => {
@@ -299,13 +300,14 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
299
300
  const classHeirarchyList = (0, classListSelector_1.getNestedClassListHeirarchy)(classListState);
300
301
  const duplicateBills = (0, billPayReviewSelector_1.getDuplicateBills)(state, billId);
301
302
  return {
303
+ showVendorGptRecommendationText,
302
304
  recommendedVendor,
303
305
  lastRecommendedVendorName,
304
306
  duplicateBills,
305
307
  fetchState: fetchState,
306
- saveStatus: (_1 = sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.saveStatus) !== null && _1 !== void 0 ? _1 : undefined,
307
- error: (_3 = (_2 = sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.fetchStatus) === null || _2 === void 0 ? void 0 : _2.error) !== null && _3 !== void 0 ? _3 : undefined,
308
- uploadStatus: (_4 = sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.uploadFetchState) !== null && _4 !== void 0 ? _4 : undefined,
308
+ saveStatus: (_2 = sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.saveStatus) !== null && _2 !== void 0 ? _2 : undefined,
309
+ 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,
310
+ uploadStatus: (_5 = sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.uploadFetchState) !== null && _5 !== void 0 ? _5 : undefined,
309
311
  version: 0,
310
312
  createdBy,
311
313
  createTime,
@@ -45,6 +45,7 @@ export interface RecurringBillInstance {
45
45
  billPaymentStatus?: RecurringBillPaymentStatus;
46
46
  }
47
47
  export interface BillDetailLocalData {
48
+ showVendorGptRecommendationText: boolean;
48
49
  vendor?: Vendor;
49
50
  candidateVendorname?: string;
50
51
  whatForSection?: WhatForSection;
@@ -16,6 +16,7 @@ exports.initialBillDetail = {
16
16
  error: undefined,
17
17
  },
18
18
  billDetailLocalData: {
19
+ showVendorGptRecommendationText: false,
19
20
  vendor: undefined,
20
21
  whatForSection: {
21
22
  invoiceNumber: '',
@@ -174,6 +174,7 @@ const initializeBillToLocalStoreEpic = (actions$, state$) => actions$.pipe((0, o
174
174
  recurringBillInstances = recurringBillInstancesLocalData;
175
175
  }
176
176
  const billDetailLocalData = {
177
+ showVendorGptRecommendationText: false,
177
178
  vendor,
178
179
  whatForSection,
179
180
  updatesByLineId,
@@ -10,5 +10,5 @@ import { fetchPreviousBills } from '../../previousBills/previousBillsReducer';
10
10
  import { fetchDuplicateBill } from '../../billPayReview/billPayReviewReducer';
11
11
  export declare type ActionType = ReturnType<typeof parseInvoiceToBill> | ReturnType<typeof saveBillUpdatesToLocalStore> | ReturnType<typeof fetchClassList> | ReturnType<typeof fetchPreviousBills> | ReturnType<typeof fetchDuplicateBill> | ReturnType<typeof updateShowAutofill> | ReturnType<typeof updateAddBillAutoFields> | ReturnType<typeof updateBillUploadFetchState>;
12
12
  export declare const parseInvoiceToBillEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
13
- export declare const toBillDetailLocalData: (state: RootState, billPayload: Partial<BillTransactionPayload>, vendor: Vendor | undefined, recommendedVendorId?: string | undefined) => BillDetailLocalData;
13
+ export declare const toBillDetailLocalData: (state: RootState, showVendorGptRecommendationText: boolean, billPayload: Partial<BillTransactionPayload>, vendor: Vendor | undefined, recommendedVendorId?: string | undefined) => BillDetailLocalData;
14
14
  export declare const getAutoFieldsData: (finalBill: BillDetailLocalData, isVendorWithNewCurrency: boolean, tentativeVendorName?: string | undefined, currencyInInvoice?: string | undefined, vendorCurrency?: string | undefined) => AddBillAutoFields;
@@ -54,6 +54,7 @@ const parseInvoiceToBillEpic = (actions$, state$) => actions$.pipe((0, operators
54
54
  let vendorCurrency = '';
55
55
  const vendors = (0, vendorListSelector_1.getVendorList)(state).vendors;
56
56
  let recommendedVendorId;
57
+ let showVendorGptRecommendationText = false;
57
58
  let suggestedVendor;
58
59
  if (vendorNameFromInvoice != null && vendorNameFromInvoice.length > 0) {
59
60
  finalVendor = vendors.filter((vendor) => vendor.name.toLowerCase() === vendorNameFromInvoice.toLowerCase())[0];
@@ -71,6 +72,7 @@ const parseInvoiceToBillEpic = (actions$, state$) => actions$.pipe((0, operators
71
72
  if (matchScore > 85) {
72
73
  if (vendorCurrency === currencyInInvoice) {
73
74
  finalVendor = suggestedVendor;
75
+ showVendorGptRecommendationText = true;
74
76
  }
75
77
  else {
76
78
  isVendorWithNewCurrency = true;
@@ -81,6 +83,7 @@ const parseInvoiceToBillEpic = (actions$, state$) => actions$.pipe((0, operators
81
83
  vendorNameFromInvoice.toLowerCase()) {
82
84
  if (vendorCurrency === currencyInInvoice) {
83
85
  finalVendor = suggestedVendor;
86
+ showVendorGptRecommendationText = true;
84
87
  }
85
88
  else {
86
89
  isVendorWithNewCurrency = true;
@@ -89,12 +92,13 @@ const parseInvoiceToBillEpic = (actions$, state$) => actions$.pipe((0, operators
89
92
  else {
90
93
  recommendedVendorId = suggestedVendor === null || suggestedVendor === void 0 ? void 0 : suggestedVendor.id;
91
94
  finalVendor = suggestedVendor;
95
+ showVendorGptRecommendationText = true;
92
96
  }
93
97
  }
94
98
  }
95
99
  }
96
100
  const file = (0, attachmentPayload_1.mapFiletoAttachment)(invoiceProcessingPayload.files[0]);
97
- const finalBill = Object.assign(Object.assign({}, (0, exports.toBillDetailLocalData)(state, invoiceProcessingPayload.bills[0], finalVendor, recommendedVendorId)), { file: file });
101
+ const finalBill = Object.assign(Object.assign({}, (0, exports.toBillDetailLocalData)(state, showVendorGptRecommendationText, invoiceProcessingPayload.bills[0], finalVendor, recommendedVendorId)), { file: file });
98
102
  const addBillAutoFields = (0, exports.getAutoFieldsData)(finalBill, isVendorWithNewCurrency, vendorNameFromInvoice, currencyInInvoice, vendorCurrency);
99
103
  if (finalVendor != null) {
100
104
  return (0, rxjs_1.of)((0, editBillViewReducer_1.saveBillUpdatesToLocalStore)({ billDetailLocalData: finalBill }), (0, previousBillsReducer_1.fetchPreviousBills)(finalVendor.qboId, false), (0, billPayReviewReducer_1.fetchDuplicateBill)(finalVendor.name, finalVendor.id, (_e = (_d = finalBill.totalAmount) === null || _d === void 0 ? void 0 : _d.amount) !== null && _e !== void 0 ? _e : 0, (_f = finalBill.whatForSection) === null || _f === void 0 ? void 0 : _f.invoiceNumber), (0, editBillViewReducer_1.updateShowAutofill)(false), (0, editBillViewReducer_1.updateAddBillAutoFields)(addBillAutoFields), (0, editBillViewReducer_1.updateBillUploadFetchState)({
@@ -120,7 +124,7 @@ const parseInvoiceToBillEpic = (actions$, state$) => actions$.pipe((0, operators
120
124
  }
121
125
  }));
122
126
  exports.parseInvoiceToBillEpic = parseInvoiceToBillEpic;
123
- const toBillDetailLocalData = (state, billPayload, vendor, recommendedVendorId) => {
127
+ const toBillDetailLocalData = (state, showVendorGptRecommendationText, billPayload, vendor, recommendedVendorId) => {
124
128
  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;
125
129
  const currency = {
126
130
  currencyCode: (_a = billPayload.currency_code) !== null && _a !== void 0 ? _a : '',
@@ -186,6 +190,7 @@ const toBillDetailLocalData = (state, billPayload, vendor, recommendedVendorId)
186
190
  const fromAccountType = (0, billPayConfigPayload_1.getAccountTypeSubConfigCodeKey)((0, billPayConfigState_1.toAccType)((_m = (_l = billPayload.bill_pay_info) === null || _l === void 0 ? void 0 : _l.from_account.account_type) !== null && _m !== void 0 ? _m : ''));
187
191
  return {
188
192
  recommendedVendorId,
193
+ showVendorGptRecommendationText,
189
194
  lastRecommendedVendorName: recommendedVendorId != null ? vendor === null || vendor === void 0 ? void 0 : vendor.name : undefined,
190
195
  vendor: vendor,
191
196
  whatForSection: {
@@ -7,3 +7,4 @@ export interface PaymentAccountListSelectorView extends SelectorView {
7
7
  unlinkingAccountStatus: Record<ID, FetchStateAndError>;
8
8
  }
9
9
  export declare const getAllPaymentAccounts: (paymentAccountState: PaymentAccountState, paymentAccountListState: PaymentAccountListState) => PaymentAccountListSelectorView;
10
+ export declare const getPrimaryPaymentAccount: (paymentAccountState: PaymentAccountState, paymentAccountListState: PaymentAccountListState) => PaymentAccount | undefined;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getAllPaymentAccounts = void 0;
3
+ exports.getPrimaryPaymentAccount = exports.getAllPaymentAccounts = void 0;
4
4
  const paymentAccountSelector_1 = require("../../../../entity/paymentAccount/paymentAccountSelector");
5
5
  const getAllPaymentAccounts = (paymentAccountState, paymentAccountListState) => {
6
6
  return {
@@ -12,3 +12,8 @@ const getAllPaymentAccounts = (paymentAccountState, paymentAccountListState) =>
12
12
  };
13
13
  };
14
14
  exports.getAllPaymentAccounts = getAllPaymentAccounts;
15
+ const getPrimaryPaymentAccount = (paymentAccountState, paymentAccountListState) => {
16
+ const paymentAccounts = (0, paymentAccountSelector_1.getPaymentAccountsByPaymentAccountIds)(paymentAccountState, paymentAccountListState.paymentAccountIds);
17
+ return paymentAccounts.find((account) => account.isPrimaryForBillPay === true);
18
+ };
19
+ exports.getPrimaryPaymentAccount = getPrimaryPaymentAccount;
@@ -8,6 +8,7 @@ export interface TransferDetailSelectorView extends SelectorView {
8
8
  transferDetailLocalData: TransferDetailLocalData;
9
9
  transferMoneyParties: TransferMoneyParty[];
10
10
  transferMoneyPartiesFetchState: FetchState;
11
+ primaryPaymentAccount?: PaymentAccount;
11
12
  }
12
13
  export declare const getTransferDetail: (state: RootState) => TransferDetailSelectorView;
13
14
  export declare const getTransferMoneyParties: (depositAccounts: DepositAccount[], paymentAccounts: PaymentAccount[]) => TransferMoneyParty[];
@@ -19,6 +19,7 @@ const getTransferDetail = (state) => {
19
19
  paymentAccountsView.fetchState === 'Completed') {
20
20
  transferParties = (0, exports.getTransferMoneyParties)(depositAccountsView.depositAccounts, paymentAccountsView.paymentAccounts);
21
21
  }
22
+ const primaryPaymentAccount = (0, paymentAccountListSelector_1.getPrimaryPaymentAccount)(paymentAccountState, paymentAccountListState);
22
23
  return {
23
24
  transferDetailLocalData: localData,
24
25
  fetchState,
@@ -26,6 +27,7 @@ const getTransferDetail = (state) => {
26
27
  transferMoneyParties: transferParties,
27
28
  version: 0,
28
29
  transferMoneyPartiesFetchState,
30
+ primaryPaymentAccount,
29
31
  };
30
32
  };
31
33
  exports.getTransferDetail = getTransferDetail;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.8.40",
3
+ "version": "4.8.42",
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",