@zeniai/client-epic-state 4.8.90 → 4.8.92

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.
@@ -5,7 +5,6 @@ const rxjs_1 = require("rxjs");
5
5
  const operators_1 = require("rxjs/operators");
6
6
  const responsePayload_1 = require("../../responsePayload");
7
7
  const companyMonthEndReportViewReducer_1 = require("./companyMonthEndReportViewReducer");
8
- const fileReducer_1 = require("../../entity/file/fileReducer");
9
8
  const fetchCompanyMonthEndReportViewEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(companyMonthEndReportViewReducer_1.fetchCompanyMonthEndReportView.match), (0, operators_1.switchMap)((action) => {
10
9
  const { cacheOverride, companyId } = action.payload;
11
10
  const state = state$.value;
@@ -21,7 +20,6 @@ const fetchCompanyMonthEndReportViewEpic = (actions$, state$, zeniAPI) => action
21
20
  if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
22
21
  const actions = [
23
22
  (0, companyMonthEndReportViewReducer_1.updateCompanyMonthEndReportViewOnSuccess)(companyId, response.data),
24
- (0, fileReducer_1.updateAttachmentFiles)({ files: response.data.files }),
25
23
  ];
26
24
  return (0, rxjs_1.from)(actions);
27
25
  }
@@ -35,7 +35,6 @@ const saveCompanyMonthEndReportEpic = (actions$, state$, zeniAPI) => actions$.pi
35
35
  last_report_sent_business_day: lastReportSentBusinessDay,
36
36
  last_report_sent_date: lastReportSentDate.format('YYYY-MM-DD'),
37
37
  zeni_requests_html: zeniRequestsHtml,
38
- files: filePayload,
39
38
  };
40
39
  const query = { is_preview: isPreview };
41
40
  return zeniAPI
@@ -38,7 +38,6 @@ const sendCompanyMonthEndReportEpic = (actions$, state$, zeniAPI) => actions$.pi
38
38
  last_report_sent_business_day: lastReportSentBusinessDay,
39
39
  last_report_sent_date: lastReportSentDate.format('YYYY-MM-DD'),
40
40
  zeni_requests_html: zeniRequestsHtml,
41
- files: filePayload,
42
41
  };
43
42
  return zeniAPI
44
43
  .postAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/companies/${companyId}/emails/month-end`, payload, {
@@ -84,7 +84,7 @@ const getSaveBillApiURL = (saveBillBaseURL, isRecurring, billId, billTransaction
84
84
  }
85
85
  };
86
86
  function prepareSaveBillPayload(accountState, billTransactionState, paymentAccountState, vendorState, recurringBillState, billDetail, billStageCode, isVendorRecommendationEnabled, isLocalCurrencyEnabled) {
87
- 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, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21;
87
+ 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, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22;
88
88
  const billId = billDetail.billId;
89
89
  let detail;
90
90
  const withdrawFromAccount = (_a = billDetail.billDetailLocalData.paymentDetailsSection) === null || _a === void 0 ? void 0 : _a.withdrawFrom;
@@ -104,57 +104,59 @@ function prepareSaveBillPayload(accountState, billTransactionState, paymentAccou
104
104
  vendor_name: isRecommendedVendor
105
105
  ? recommendedVendor.name
106
106
  : (_e = billDetail.billDetailLocalData.vendor) === null || _e === void 0 ? void 0 : _e.name,
107
- candidate_vendor_name: isRecommendedVendor
107
+ //pass candidate_vendor_name only when we are not adding vendor(recommended or actual) to the bill
108
+ candidate_vendor_name: isRecommendedVendor ||
109
+ ((_f = billDetail.billDetailLocalData.vendor) === null || _f === void 0 ? void 0 : _f.qboId) != null
108
110
  ? undefined
109
- : (_f = billDetail.addBillAutoFields.tentativeVendorName) !== null && _f !== void 0 ? _f : billDetail.billDetailLocalData.candidateVendorname,
111
+ : (_g = billDetail.addBillAutoFields.tentativeVendorName) !== null && _g !== void 0 ? _g : billDetail.billDetailLocalData.candidateVendorname,
110
112
  ocr_parsed_vendor_term: Boolean(billDetail.addBillAutoFields.tentativeVendorName) === true
111
113
  ? billDetail.addBillAutoFields.tentativeVendorName
112
114
  : null,
113
115
  transaction_type: 'bill',
114
116
  bill_pay_provider: 'zeni',
115
117
  account_id: zeniAccountId != null
116
- ? (_g = (0, accountSelector_1.getAccountBase)(accountState, zeniAccountId, 'bill_pay')) === null || _g === void 0 ? void 0 : _g.qboId
118
+ ? (_h = (0, accountSelector_1.getAccountBase)(accountState, zeniAccountId, 'bill_pay')) === null || _h === void 0 ? void 0 : _h.qboId
117
119
  : '',
118
- file_id: (_h = billDetail.billDetailLocalData.file) === null || _h === void 0 ? void 0 : _h.fileId,
119
- transaction_date: (_l = (_k = (_j = billDetail.billDetailLocalData.whatForSection) === null || _j === void 0 ? void 0 : _j.invoiceDate) === null || _k === void 0 ? void 0 : _k.format('YYYY-MM-DD')) !== null && _l !== void 0 ? _l : (0, zeniDayJS_1.dateNow)().format('YYYY-MM-DD'),
120
- due_date: (_p = (_o = (_m = billDetail.billDetailLocalData.whatForSection) === null || _m === void 0 ? void 0 : _m.billDueDate) === null || _o === void 0 ? void 0 : _o.format('YYYY-MM-DD')) !== null && _p !== void 0 ? _p : null,
121
- total_amount: (_r = (_q = billDetail.billDetailLocalData.totalAmount) === null || _q === void 0 ? void 0 : _q.amount) !== null && _r !== void 0 ? _r : 0,
120
+ file_id: (_j = billDetail.billDetailLocalData.file) === null || _j === void 0 ? void 0 : _j.fileId,
121
+ transaction_date: (_m = (_l = (_k = billDetail.billDetailLocalData.whatForSection) === null || _k === void 0 ? void 0 : _k.invoiceDate) === null || _l === void 0 ? void 0 : _l.format('YYYY-MM-DD')) !== null && _m !== void 0 ? _m : (0, zeniDayJS_1.dateNow)().format('YYYY-MM-DD'),
122
+ due_date: (_q = (_p = (_o = billDetail.billDetailLocalData.whatForSection) === null || _o === void 0 ? void 0 : _o.billDueDate) === null || _p === void 0 ? void 0 : _p.format('YYYY-MM-DD')) !== null && _q !== void 0 ? _q : null,
123
+ total_amount: (_s = (_r = billDetail.billDetailLocalData.totalAmount) === null || _r === void 0 ? void 0 : _r.amount) !== null && _s !== void 0 ? _s : 0,
122
124
  bill_pay_info: {
123
125
  stage: {
124
126
  code: billStageCode,
125
127
  },
126
- payment_date: (_u = (_t = (_s = billDetail.billDetailLocalData.paymentDetailsSection) === null || _s === void 0 ? void 0 : _s.paymentDate) === null || _t === void 0 ? void 0 : _t.format('YYYY-MM-DD')) !== null && _u !== void 0 ? _u : null,
128
+ payment_date: (_v = (_u = (_t = billDetail.billDetailLocalData.paymentDetailsSection) === null || _t === void 0 ? void 0 : _t.paymentDate) === null || _u === void 0 ? void 0 : _u.format('YYYY-MM-DD')) !== null && _v !== void 0 ? _v : null,
127
129
  from_account: {
128
- account_id: (_x = (_w = (_v = billDetail.billDetailLocalData.paymentDetailsSection) === null || _v === void 0 ? void 0 : _v.withdrawFrom) === null || _w === void 0 ? void 0 : _w.id) !== null && _x !== void 0 ? _x : '',
129
- account_type: (_0 = (0, helpers_1.accountTypeSubConfigCodeToAccType)((_z = (_y = billDetail.billDetailLocalData.paymentDetailsSection) === null || _y === void 0 ? void 0 : _y.withdrawFrom) === null || _z === void 0 ? void 0 : _z.accType)) !== null && _0 !== void 0 ? _0 : '',
130
+ account_id: (_y = (_x = (_w = billDetail.billDetailLocalData.paymentDetailsSection) === null || _w === void 0 ? void 0 : _w.withdrawFrom) === null || _x === void 0 ? void 0 : _x.id) !== null && _y !== void 0 ? _y : '',
131
+ account_type: (_1 = (0, helpers_1.accountTypeSubConfigCodeToAccType)((_0 = (_z = billDetail.billDetailLocalData.paymentDetailsSection) === null || _z === void 0 ? void 0 : _z.withdrawFrom) === null || _0 === void 0 ? void 0 : _0.accType)) !== null && _1 !== void 0 ? _1 : '',
130
132
  },
131
133
  to_account: Object.assign({}, (isLocalCurrencyEnabled === true &&
132
- ((_2 = (_1 = billDetail.billDetailLocalData.paymentDetailsSection) === null || _1 === void 0 ? void 0 : _1.paymentType) === null || _2 === void 0 ? void 0 : _2.method.includes('international')) === true
134
+ ((_3 = (_2 = billDetail.billDetailLocalData.paymentDetailsSection) === null || _2 === void 0 ? void 0 : _2.paymentType) === null || _3 === void 0 ? void 0 : _3.method.includes('international')) === true
133
135
  ? {
134
136
  payment_instrument_id: Boolean(billDetail.billDetailLocalData
135
137
  .isCollectToAccountInfoFromVendorContact) === false
136
- ? (_4 = (_3 = billDetail.billDetailLocalData.paymentDetailsSection) === null || _3 === void 0 ? void 0 : _3.paymentTo) !== null && _4 !== void 0 ? _4 : null
138
+ ? (_5 = (_4 = billDetail.billDetailLocalData.paymentDetailsSection) === null || _4 === void 0 ? void 0 : _4.paymentTo) !== null && _5 !== void 0 ? _5 : null
137
139
  : null,
138
140
  }
139
141
  : {
140
142
  account_id: Boolean(billDetail.billDetailLocalData
141
143
  .isCollectToAccountInfoFromVendorContact) === false
142
- ? (_6 = (_5 = billDetail.billDetailLocalData.paymentDetailsSection) === null || _5 === void 0 ? void 0 : _5.paymentTo) !== null && _6 !== void 0 ? _6 : null
144
+ ? (_7 = (_6 = billDetail.billDetailLocalData.paymentDetailsSection) === null || _6 === void 0 ? void 0 : _6.paymentTo) !== null && _7 !== void 0 ? _7 : null
143
145
  : null,
144
146
  })),
145
- to_account_vendor_email: (_7 = billDetail.billDetailLocalData.toAccountVendorEmail) !== null && _7 !== void 0 ? _7 : null,
147
+ to_account_vendor_email: (_8 = billDetail.billDetailLocalData.toAccountVendorEmail) !== null && _8 !== void 0 ? _8 : null,
146
148
  is_collect_to_account_info_from_vendor_contact: billDetail.billDetailLocalData.isCollectToAccountInfoFromVendorContact,
147
149
  is_cancelled: false,
148
- bill_payment_method_type: getBillPaymentMethodTypePayload((_8 = billDetail.billDetailLocalData.paymentDetailsSection) === null || _8 === void 0 ? void 0 : _8.paymentType),
149
- international_transfer_fee_bearer_payment_method: ((_10 = (_9 = billDetail.billDetailLocalData.paymentDetailsSection) === null || _9 === void 0 ? void 0 : _9.paymentType) === null || _10 === void 0 ? void 0 : _10.method.includes('international')) === true &&
150
- ((_11 = billDetail.billDetailLocalData.vendor) === null || _11 === void 0 ? void 0 : _11.vendorCurrencyCode) === 'USD'
151
- ? (_12 = billDetail.billDetailLocalData.paymentDetailsSection
152
- .internationalTransferFeeBearerPaymentMethod) !== null && _12 !== void 0 ? _12 : 'swift_our' //default value for international method and USD currency
150
+ bill_payment_method_type: getBillPaymentMethodTypePayload((_9 = billDetail.billDetailLocalData.paymentDetailsSection) === null || _9 === void 0 ? void 0 : _9.paymentType),
151
+ international_transfer_fee_bearer_payment_method: ((_11 = (_10 = billDetail.billDetailLocalData.paymentDetailsSection) === null || _10 === void 0 ? void 0 : _10.paymentType) === null || _11 === void 0 ? void 0 : _11.method.includes('international')) === true &&
152
+ ((_12 = billDetail.billDetailLocalData.vendor) === null || _12 === void 0 ? void 0 : _12.vendorCurrencyCode) === 'USD'
153
+ ? (_13 = billDetail.billDetailLocalData.paymentDetailsSection
154
+ .internationalTransferFeeBearerPaymentMethod) !== null && _13 !== void 0 ? _13 : 'swift_our' //default value for international method and USD currency
153
155
  : null,
154
156
  },
155
- document_id: (_13 = billDetail.billDetailLocalData.whatForSection) === null || _13 === void 0 ? void 0 : _13.invoiceNumber,
156
- transaction_memo: (_14 = billDetail.billDetailLocalData.whatForSection) === null || _14 === void 0 ? void 0 : _14.memo,
157
- currency_code: (_16 = (_15 = billDetail.billDetailLocalData.whatForSection) === null || _15 === void 0 ? void 0 : _15.currencyCode) !== null && _16 !== void 0 ? _16 : 'USD',
157
+ document_id: (_14 = billDetail.billDetailLocalData.whatForSection) === null || _14 === void 0 ? void 0 : _14.invoiceNumber,
158
+ transaction_memo: (_15 = billDetail.billDetailLocalData.whatForSection) === null || _15 === void 0 ? void 0 : _15.memo,
159
+ currency_code: (_17 = (_16 = billDetail.billDetailLocalData.whatForSection) === null || _16 === void 0 ? void 0 : _16.currencyCode) !== null && _17 !== void 0 ? _17 : 'USD',
158
160
  lines: Object.keys(billDetail.billDetailLocalData.updatesByLineId).map((lineId) => {
159
161
  const line = billDetail.billDetailLocalData.updatesByLineId[lineId];
160
162
  const lineAsTransactionLinePayload = (0, editBillViewPayload_1.fromLineLocalDataToTransactionLinePayload)(line);
@@ -162,12 +164,12 @@ function prepareSaveBillPayload(accountState, billTransactionState, paymentAccou
162
164
  }),
163
165
  };
164
166
  if (!isRecurring) {
165
- payload.vendor_name = (_18 = (_17 = billDetail.billDetailLocalData.vendor) === null || _17 === void 0 ? void 0 : _17.name) !== null && _18 !== void 0 ? _18 : '';
167
+ payload.vendor_name = (_19 = (_18 = billDetail.billDetailLocalData.vendor) === null || _18 === void 0 ? void 0 : _18.name) !== null && _19 !== void 0 ? _19 : '';
166
168
  }
167
169
  if (billId != null) {
168
170
  detail = (0, get_1.default)(billTransactionState.transactionById, billId, undefined);
169
- payload.sync_token = (_19 = detail === null || detail === void 0 ? void 0 : detail.syncToken) !== null && _19 !== void 0 ? _19 : null;
170
- payload.update_time = (_20 = detail === null || detail === void 0 ? void 0 : detail.updateTime.format('YYYY-MM-DD')) !== null && _20 !== void 0 ? _20 : null;
171
+ payload.sync_token = (_20 = detail === null || detail === void 0 ? void 0 : detail.syncToken) !== null && _20 !== void 0 ? _20 : null;
172
+ payload.update_time = (_21 = detail === null || detail === void 0 ? void 0 : detail.updateTime.format('YYYY-MM-DD')) !== null && _21 !== void 0 ? _21 : null;
171
173
  //required by platform to clear old recurring details
172
174
  if ((detail === null || detail === void 0 ? void 0 : detail.isRecurring) === true &&
173
175
  Boolean(billDetail.billDetailLocalData.isRecurring) === false) {
@@ -178,7 +180,7 @@ function prepareSaveBillPayload(accountState, billTransactionState, paymentAccou
178
180
  payload.are_approvals_serialized = true;
179
181
  }
180
182
  if (billStageCode === 'pending_approval' &&
181
- ((_21 = billDetail.billDetailLocalData.paymentDetailsSection) === null || _21 === void 0 ? void 0 : _21.conversionRate) != null) {
183
+ ((_22 = billDetail.billDetailLocalData.paymentDetailsSection) === null || _22 === void 0 ? void 0 : _22.conversionRate) != null) {
182
184
  // required by platform
183
185
  payload.exchange_rate =
184
186
  1 / billDetail.billDetailLocalData.paymentDetailsSection.conversionRate;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.8.90",
3
+ "version": "4.8.92",
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",