@zeniai/client-epic-state 4.10.39 → 4.10.41

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 (28) hide show
  1. package/lib/entity/billPay/billTransaction/billTransactionPayload.d.ts +3 -0
  2. package/lib/entity/billPay/billTransaction/billTransactionPayload.js +1 -1
  3. package/lib/entity/billPay/billTransaction/billTransactionState.d.ts +1 -0
  4. package/lib/entity/transaction/payloadTypes/transactionLinePayload.d.ts +2 -1
  5. package/lib/entity/transaction/payloadTypes/transactionLinePayload.js +8 -5
  6. package/lib/entity/transaction/payloadTypes/transactionPayload.d.ts +3 -0
  7. package/lib/entity/transaction/payloadTypes/transactionPayload.js +12 -1
  8. package/lib/entity/transaction/stateTypes/transactionLine.d.ts +1 -0
  9. package/lib/view/commonVendorView/vendorView/epics/saveVendorEpic.js +1 -1
  10. package/lib/view/spendManagement/billPay/billDetailView/epics/fetchBillDetailEpic.js +1 -1
  11. package/lib/view/spendManagement/billPay/billPayReview/billPayReviewReducer.d.ts +2 -1
  12. package/lib/view/spendManagement/billPay/billPayReview/billPayReviewReducer.js +2 -1
  13. package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.d.ts +1 -0
  14. package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +9 -3
  15. package/lib/view/spendManagement/billPay/billPayReview/fetchDuplicateBillEpic.js +2 -2
  16. package/lib/view/spendManagement/billPay/editBillView/editBillViewReducer.js +1 -1
  17. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.d.ts +1 -0
  18. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +6 -1
  19. package/lib/view/spendManagement/billPay/editBillView/editBillViewState.d.ts +3 -2
  20. package/lib/view/spendManagement/billPay/editBillView/editBillViewState.js +1 -0
  21. package/lib/view/spendManagement/billPay/editBillView/epics/fetchVendorAndUpdateBillLocalDataEpic.js +5 -1
  22. package/lib/view/spendManagement/billPay/editBillView/epics/initializeBillToLocalStoreEpic.js +3 -0
  23. package/lib/view/spendManagement/billPay/editBillView/epics/parseInvoiceToBillEpic.js +18 -10
  24. package/lib/view/spendManagement/billPay/editBillView/epics/saveBillDetailEpic.js +22 -20
  25. package/lib/view/transactionDetail/transactionDetailLocalDataHelper.d.ts +1 -2
  26. package/lib/view/transactionDetail/transactionDetailLocalDataHelper.js +1 -4
  27. package/lib/view/transactionDetail/transactionDetailReducer.js +1 -1
  28. package/package.json +1 -1
@@ -14,6 +14,9 @@ export interface BillTransactionPayload extends VendorTransactionPayload {
14
14
  home_currency_amount?: number;
15
15
  home_currency_code?: string;
16
16
  home_currency_symbol?: string;
17
+ recipient_total_amount: number;
18
+ recipient_currency_code: string;
19
+ recipient_currency_symbol: string;
17
20
  class_id?: ID | null;
18
21
  class_name?: string | null;
19
22
  qbo_class_id?: ID | null;
@@ -15,7 +15,7 @@ const toBillTransaction = (payload) => {
15
15
  payload.home_currency_code != null &&
16
16
  payload.home_currency_symbol != null
17
17
  ? (0, amount_1.toAmount)(payload.home_currency_amount, payload.home_currency_code, payload.home_currency_symbol)
18
- : undefined });
18
+ : undefined, recipientTotalAmount: (0, amount_1.toAmount)(payload.recipient_total_amount, payload.recipient_currency_code, payload.recipient_currency_symbol) });
19
19
  };
20
20
  exports.toBillTransaction = toBillTransaction;
21
21
  const toBillPayInfo = (payload) => {
@@ -20,6 +20,7 @@ export interface BillTransaction extends VendorTransaction {
20
20
  deletionInfo: DeletionInfo;
21
21
  isRecurring: boolean;
22
22
  totalAmountInUSD?: Amount;
23
+ recipientTotalAmount: Amount;
23
24
  recurringBillConfigId?: ID;
24
25
  recurringBillInstance?: number;
25
26
  bookCloseDate?: ZeniDate;
@@ -34,6 +34,7 @@ export interface TransactionWithAccountAndClassLinePayload extends TransactionLi
34
34
  line_detail: LineDetailPayload;
35
35
  is_category_miscategorized?: boolean;
36
36
  is_class_miscategorized?: boolean;
37
+ recipient_amount?: number;
37
38
  }
38
39
  export declare const toTransactionWithAccountAndClassLine: (payload: TransactionWithAccountAndClassLinePayload, currency: Currency, type?: LineType) => TransactionWithAccountAndClassLine;
39
40
  /**
@@ -82,6 +83,6 @@ export declare type LinePayload = LinkedTransactionLinePayload | TransactionWith
82
83
  * @param payload line paylod
83
84
  */
84
85
  export declare function getLineType(payload: LinePayload): LineType;
85
- export declare function toLine(payload: LinePayload, currency: Currency): Line;
86
+ export declare function toLine(payload: LinePayload, currency: Currency, recipientCurrency?: Currency): Line;
86
87
  export declare const toLinePayload: (line: Line) => LinePayload;
87
88
  export declare const toAccountAndClassLinePayload: (line: TransactionWithAccountAndClassLine) => TransactionWithAccountAndClassLinePayload;
@@ -20,14 +20,14 @@ exports.toTransactionLineBase = toTransactionLineBase;
20
20
  const toLinkedTransactionLine = (payload, currency) => (Object.assign(Object.assign({}, (0, exports.toTransactionLineBase)(payload, 'linked_transaction_line', currency)), { linkedTransactions: payload.linked_transactions.map((transactionIDPayload) => (0, transactionIDPayload_1.toTransactionID)(transactionIDPayload)) }));
21
21
  exports.toLinkedTransactionLine = toLinkedTransactionLine;
22
22
  const toTransactionWithAccountAndClassLine = (payload, currency, type = 'transaction_with_account_and_class_line') => {
23
- var _a, _b, _c, _d;
23
+ var _a, _b, _c, _d, _e;
24
24
  return (Object.assign(Object.assign({}, (0, exports.toTransactionLineBase)(payload, type, currency)), { class: (0, classPayload_1.mapClassBasePayloadToClassBase)((_a = payload.line_detail.class) !== null && _a !== void 0 ? _a : {}), account: (0, accountPayload_1.mapAccountBasePayloadToAccountBase)(payload.line_detail.account), customer: payload.line_detail.customer != null &&
25
25
  payload.line_detail.customer.customer_id != null
26
26
  ? (0, customerPayload_1.toCustomerBase)(payload.line_detail.customer, false)
27
27
  : undefined, vendor: payload.line_detail.vendor != null &&
28
28
  payload.line_detail.vendor.vendor_id != null
29
29
  ? (0, vendorPayload_1.mapVendorBasePayloadToVendorBase)(payload.line_detail.vendor)
30
- : undefined, billable: (_b = payload.line_detail.billable_status) !== null && _b !== void 0 ? _b : 'not_billable', isCategoryMiscategorized: (_c = payload.is_category_miscategorized) !== null && _c !== void 0 ? _c : false, isClassMiscategorized: (_d = payload.is_class_miscategorized) !== null && _d !== void 0 ? _d : false }));
30
+ : undefined, billable: (_b = payload.line_detail.billable_status) !== null && _b !== void 0 ? _b : 'not_billable', isCategoryMiscategorized: (_c = payload.is_category_miscategorized) !== null && _c !== void 0 ? _c : false, isClassMiscategorized: (_d = payload.is_class_miscategorized) !== null && _d !== void 0 ? _d : false, recipientAmount: (0, amount_1.toAmountWC)((_e = payload.recipient_amount) !== null && _e !== void 0 ? _e : 0, currency) }));
31
31
  };
32
32
  exports.toTransactionWithAccountAndClassLine = toTransactionWithAccountAndClassLine;
33
33
  const toProductOrServiceItem = (payload, unitPrice, currency, quantity) => ({
@@ -71,7 +71,7 @@ function getLineType(payload) {
71
71
  }
72
72
  }
73
73
  exports.getLineType = getLineType;
74
- function toLine(payload, currency) {
74
+ function toLine(payload, currency, recipientCurrency) {
75
75
  const lineType = getLineType(payload);
76
76
  switch (lineType) {
77
77
  case 'linked_transaction_line':
@@ -81,7 +81,7 @@ function toLine(payload, currency) {
81
81
  case 'journal_entry_transaction_line':
82
82
  return (0, exports.toJournalEntryTransactionLine)(payload, currency);
83
83
  case 'transaction_with_account_and_class_line':
84
- return (0, exports.toTransactionWithAccountAndClassLine)(payload, currency);
84
+ return (0, exports.toTransactionWithAccountAndClassLine)(payload, recipientCurrency !== null && recipientCurrency !== void 0 ? recipientCurrency : currency);
85
85
  case 'transaction_info_line':
86
86
  return (0, exports.toTransactionInfoLine)(payload, currency);
87
87
  case 'transaction_line_base':
@@ -113,7 +113,10 @@ const toProductOrServiceItemPayload = (item) => ({
113
113
  item_id: item.itemId,
114
114
  item_name: item.itemName,
115
115
  });
116
- const toAccountAndClassLinePayload = (line) => (Object.assign(Object.assign({}, toTransactionBaseLinePayload(line)), { line_detail: toLineDetailPayload(line), is_category_miscategorized: line.isCategoryMiscategorized, is_class_miscategorized: line.isClassMiscategorized }));
116
+ const toAccountAndClassLinePayload = (line) => {
117
+ var _a;
118
+ return (Object.assign(Object.assign({}, toTransactionBaseLinePayload(line)), { line_detail: toLineDetailPayload(line), is_category_miscategorized: line.isCategoryMiscategorized, is_class_miscategorized: line.isClassMiscategorized, recipient_amount: (_a = line.recipientAmount) === null || _a === void 0 ? void 0 : _a.amount }));
119
+ };
117
120
  exports.toAccountAndClassLinePayload = toAccountAndClassLinePayload;
118
121
  const toLineDetailPayload = (line) => {
119
122
  var _a, _b;
@@ -29,6 +29,9 @@ export interface TransactionPayload extends TransactionIDPayload, AccountBasePay
29
29
  is_updating_transaction?: boolean;
30
30
  book_close_date: string | null;
31
31
  company_inc_date: string | null;
32
+ recipient_total_amount?: number;
33
+ recipient_currency_code?: string;
34
+ recipient_currency_symbol?: string;
32
35
  }
33
36
  export declare const toTransaction: (payload: TransactionPayload) => Transaction;
34
37
  export declare const toTransactionPayload: (transaction: Transaction) => Partial<TransactionPayload>;
@@ -23,12 +23,23 @@ const getTransactionPayloadAmount = (payload) => {
23
23
  return (0, amount_1.toAmount)(0, payload.currency_code, payload.currency_symbol);
24
24
  }
25
25
  };
26
+ const getTransactionPayloadRecipientAmount = (payload) => {
27
+ if (payload.recipient_total_amount != null &&
28
+ payload.recipient_currency_code != null &&
29
+ payload.recipient_currency_symbol != null) {
30
+ return (0, amount_1.toAmount)(payload.recipient_total_amount, payload.recipient_currency_code, payload.recipient_currency_symbol);
31
+ }
32
+ else {
33
+ return undefined;
34
+ }
35
+ };
26
36
  const toTransaction = (payload) => {
27
37
  var _a, _b, _c, _d, _e, _f, _g, _h;
28
38
  const amount = getTransactionPayloadAmount(payload);
39
+ const recipientAmount = getTransactionPayloadRecipientAmount(payload);
29
40
  return Object.assign(Object.assign({}, (0, transactionIDPayload_1.toTransactionID)(payload)), { typeOfTransaction: 'supported', typeName: payload.transaction_type_name, createTime: (0, zeniDayJS_1.date)(payload.transaction_create_time), updateTime: payload.transaction_update_time != null
30
41
  ? (0, zeniDayJS_1.date)(payload.transaction_update_time)
31
- : undefined, date: (0, zeniDayJS_1.date)(payload.transaction_date), amount: amount, memo: payload.transaction_memo, description: payload.transaction_description, documentId: payload.document_id, logo: (0, urlPayload_1.toURL)(payload.logo), attachments: (_a = payload.attachments) === null || _a === void 0 ? void 0 : _a.map((attachmentPayload) => (0, attachmentPayload_1.toAttachment)(attachmentPayload)), linkedTransactions: (_b = payload.linked_transactions) === null || _b === void 0 ? void 0 : _b.map((transactionIDPayload) => (0, transactionIDPayload_1.toTransactionID)(transactionIDPayload)), lines: (_c = payload === null || payload === void 0 ? void 0 : payload.lines) === null || _c === void 0 ? void 0 : _c.map((linePayload) => (0, transactionLinePayload_1.toLine)(linePayload, amount)), account: payloadHasAccountInfo(payload)
42
+ : undefined, date: (0, zeniDayJS_1.date)(payload.transaction_date), amount: amount, memo: payload.transaction_memo, description: payload.transaction_description, documentId: payload.document_id, logo: (0, urlPayload_1.toURL)(payload.logo), attachments: (_a = payload.attachments) === null || _a === void 0 ? void 0 : _a.map((attachmentPayload) => (0, attachmentPayload_1.toAttachment)(attachmentPayload)), linkedTransactions: (_b = payload.linked_transactions) === null || _b === void 0 ? void 0 : _b.map((transactionIDPayload) => (0, transactionIDPayload_1.toTransactionID)(transactionIDPayload)), lines: (_c = payload === null || payload === void 0 ? void 0 : payload.lines) === null || _c === void 0 ? void 0 : _c.map((linePayload) => (0, transactionLinePayload_1.toLine)(linePayload, amount, recipientAmount)), account: payloadHasAccountInfo(payload)
32
43
  ? (0, accountPayload_1.mapAccountBasePayloadToAccountBase)(payload)
33
44
  : undefined, syncToken: (_d = payload.sync_token) === null || _d === void 0 ? void 0 : _d.toString(), paymentType: (_e = payload.payment_type) !== null && _e !== void 0 ? _e : undefined, paymentTypeName: (_f = payload.payment_type_name) !== null && _f !== void 0 ? _f : undefined, isUpdatingTransaction: (_g = payload === null || payload === void 0 ? void 0 : payload.is_updating_transaction) !== null && _g !== void 0 ? _g : false, bookCloseDate: (payload === null || payload === void 0 ? void 0 : payload.book_close_date) != null
34
45
  ? (0, zeniDayJS_1.date)(payload.book_close_date)
@@ -12,6 +12,7 @@ export interface TransactionLineBase {
12
12
  lineDescription: string;
13
13
  amount: Amount;
14
14
  platformLineDetailType: PlatformLineDetailType;
15
+ recipientAmount?: Amount;
15
16
  }
16
17
  export interface LinkedTransactionLine extends TransactionLineBase {
17
18
  linkedTransactions: TransactionID[];
@@ -138,7 +138,7 @@ const saveVendorEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operator
138
138
  vendor: updatedVendor,
139
139
  isCancelled: isCancelled,
140
140
  updatesByLineId: updatedLines,
141
- whatForSection: Object.assign(Object.assign({}, billInLocalStore.billDetailLocalData.whatForSection), { currencyCode: updatedVendor === null || updatedVendor === void 0 ? void 0 : updatedVendor.vendorCurrencyCode }),
141
+ whatForSection: Object.assign(Object.assign({}, billInLocalStore.billDetailLocalData.whatForSection), { currencyCode: updatedVendor === null || updatedVendor === void 0 ? void 0 : updatedVendor.vendorCurrencyCode, recipientCurrencyCode: updatedVendor === null || updatedVendor === void 0 ? void 0 : updatedVendor.vendorCurrencyCode }),
142
142
  paymentDetailsSection: Object.assign(Object.assign({}, billInLocalStore.billDetailLocalData
143
143
  .paymentDetailsSection), { paymentTo: undefined, internationalTransferFeeBearerPaymentMethod: updatedVendor === null || updatedVendor === void 0 ? void 0 : updatedVendor.preferredInternationalTransferFeeBearerPaymentMethod, paymentDate: (_u = (_t = billInLocalStore.billDetailLocalData
144
144
  .paymentDetailsSection) === null || _t === void 0 ? void 0 : _t.paymentDate) !== null && _u !== void 0 ? _u :
@@ -108,7 +108,7 @@ const fetchBillDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, ope
108
108
  if (transactionInResponse != null &&
109
109
  transactionInResponse.total_amount != null &&
110
110
  Boolean(vendorInResponse) === true) {
111
- fetchActions.push((0, billPayReviewReducer_1.fetchDuplicateBill)(vendorInResponse.vendor_name, vendorInResponse.vendor_id, transactionInResponse.total_amount, transactionInResponse.document_id, billId));
111
+ fetchActions.push((0, billPayReviewReducer_1.fetchDuplicateBill)(vendorInResponse.vendor_name, vendorInResponse.vendor_id, transactionInResponse.total_amount, transactionInResponse.recipient_total_amount, transactionInResponse.document_id, billId));
112
112
  }
113
113
  }
114
114
  return (0, rxjs_1.from)(fetchActions);
@@ -2,10 +2,11 @@ import { BillPayReviewState } from './billPayReviewState';
2
2
  import { BillTransactionPayload } from '../../../../entity/billPay/billTransaction/billTransactionPayload';
3
3
  import { ZeniAPIStatus } from '../../../../responsePayload';
4
4
  export declare const initialState: BillPayReviewState;
5
- export declare const fetchDuplicateBill: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[vendorName: string, vendorId: string, totalAmount: number, invoiceId?: string | undefined, transactionId?: string | undefined], {
5
+ export declare const fetchDuplicateBill: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[vendorName: string, vendorId: string, totalAmount: number, recipientTotalAmount: number, invoiceId?: string | undefined, transactionId?: string | undefined], {
6
6
  vendorName: string;
7
7
  vendorId: string;
8
8
  totalAmount: number;
9
+ recipientTotalAmount: number;
9
10
  invoiceId: string | undefined;
10
11
  transactionId: string | undefined;
11
12
  }, string, never, never>, updateDuplicateBillPaySuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
@@ -29,12 +29,13 @@ const billPayReview = (0, toolkit_1.createSlice)({
29
29
  } });
30
30
  }
31
31
  },
32
- prepare(vendorName, vendorId, totalAmount, invoiceId, transactionId) {
32
+ prepare(vendorName, vendorId, totalAmount, recipientTotalAmount, invoiceId, transactionId) {
33
33
  return {
34
34
  payload: {
35
35
  vendorName,
36
36
  vendorId,
37
37
  totalAmount,
38
+ recipientTotalAmount,
38
39
  invoiceId,
39
40
  transactionId,
40
41
  },
@@ -15,6 +15,7 @@ export interface BillPayReviewSelectorView extends SelectorView {
15
15
  invoiceNumber?: string;
16
16
  lineDetailSection: Record<ID, Partial<TransactionWithAccountAndClassLine>>;
17
17
  totalAmount: Amount;
18
+ recipientTotalAmount: Amount;
18
19
  paymentDetailsSection: PaymentDetailsSectionView | undefined;
19
20
  file: Attachment | undefined;
20
21
  saveStatus: FetchStateAndError | undefined;
@@ -36,7 +36,7 @@ const getDuplicateBills = (state, billId) => {
36
36
  };
37
37
  exports.getDuplicateBills = getDuplicateBills;
38
38
  const getReviewPageBillDetail = (state, billId) => {
39
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
39
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
40
40
  const { accountListState, accountState, setupViewState, billTransactionState, classListState, editBillDetailViewState, paymentAccountState, vendorState, contactState, billPayConfigState, recurringBillState, depositAccountState, depositAccountListState, } = state;
41
41
  const key = (0, billDetailViewState_1.getBillTransactionDetailKey)(billId !== null && billId !== void 0 ? billId : '');
42
42
  const sourceBillDetail = billId != null
@@ -146,24 +146,30 @@ const getReviewPageBillDetail = (state, billId) => {
146
146
  currencyCode: (_o = (_m = sourceBillDetail.billDetailLocalData.totalAmount) === null || _m === void 0 ? void 0 : _m.currencyCode) !== null && _o !== void 0 ? _o : 'USD',
147
147
  currencySymbol: (_q = (_p = sourceBillDetail.billDetailLocalData.totalAmount) === null || _p === void 0 ? void 0 : _p.currencySymbol) !== null && _q !== void 0 ? _q : '$',
148
148
  };
149
+ const recipientTotalAmount = {
150
+ amount: (_s = (_r = sourceBillDetail.billDetailLocalData.recipientTotalAmount) === null || _r === void 0 ? void 0 : _r.amount) !== null && _s !== void 0 ? _s : 0,
151
+ currencyCode: (_u = (_t = sourceBillDetail.billDetailLocalData.recipientTotalAmount) === null || _t === void 0 ? void 0 : _t.currencyCode) !== null && _u !== void 0 ? _u : 'USD',
152
+ currencySymbol: (_w = (_v = sourceBillDetail.billDetailLocalData.recipientTotalAmount) === null || _v === void 0 ? void 0 : _v.currencySymbol) !== null && _w !== void 0 ? _w : '$',
153
+ };
149
154
  return {
150
155
  version: 0,
151
156
  duplicateBillTransactions: bills,
152
157
  fetchState,
153
158
  vendor: vendorDetails != null ? vendorDetails : undefined,
154
159
  totalAmount,
160
+ recipientTotalAmount,
155
161
  invoiceNumber: whatForSection.invoiceNumber,
156
162
  lineDetailSection: lineDetailSection,
157
163
  paymentDetailsSection,
158
164
  file: file,
159
165
  billPayConfigList: (0, editBillViewSelector_1.getBillPayConfigList)(billPayConfigState),
160
- saveStatus: (_r = sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.saveStatus) !== null && _r !== void 0 ? _r : undefined,
166
+ saveStatus: (_x = sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.saveStatus) !== null && _x !== void 0 ? _x : undefined,
161
167
  toAccountVendorEmail,
162
168
  isCollectToAccountInfoFromVendorContact,
163
169
  isRecurring,
164
170
  recurringBillInstance,
165
171
  recurringConfig,
166
- isInvoiceDateAutoUpdated: (_s = whatForSection.isInvoiceDateAutoUpdated) !== null && _s !== void 0 ? _s : false,
172
+ isInvoiceDateAutoUpdated: (_y = whatForSection.isInvoiceDateAutoUpdated) !== null && _y !== void 0 ? _y : false,
167
173
  };
168
174
  };
169
175
  exports.getReviewPageBillDetail = getReviewPageBillDetail;
@@ -9,10 +9,10 @@ const billTransactionReducer_1 = require("../../../../entity/billPay/billTransac
9
9
  const vendorSelector_1 = require("../../../../entity/vendor/vendorSelector");
10
10
  const fetchDuplicateBillPayReviewEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(billPayReviewReducer_1.fetchDuplicateBill.match), (0, operators_1.switchMap)((action) => {
11
11
  var _a;
12
- const { invoiceId, totalAmount, vendorName, vendorId } = action.payload;
12
+ const { invoiceId, recipientTotalAmount, vendorName, vendorId } = action.payload;
13
13
  const state = state$.value;
14
14
  const vendor = (0, vendorSelector_1.getVendorByVendorId)(state.vendorState, vendorId);
15
- const queryParam = Object.assign({ sort_order: 'desc', sort_by: 'transaction_date', transaction_type: 'bill', bill_pay_provider: 'zeni', is_include_attachment: true, limit: 3, entity_type: 'vendor', entity_name: vendorName, entity_id: (_a = vendor === null || vendor === void 0 ? void 0 : vendor.qboId) !== null && _a !== void 0 ? _a : '', total_amount: totalAmount }, (Boolean(invoiceId) && { document_id: invoiceId }));
15
+ const queryParam = Object.assign({ sort_order: 'desc', sort_by: 'transaction_date', transaction_type: 'bill', bill_pay_provider: 'zeni', is_include_attachment: true, limit: 3, entity_type: 'vendor', entity_name: vendorName, entity_id: (_a = vendor === null || vendor === void 0 ? void 0 : vendor.qboId) !== null && _a !== void 0 ? _a : '', recipient_total_amount: recipientTotalAmount }, (Boolean(invoiceId) && { document_id: invoiceId }));
16
16
  return zeniAPI
17
17
  .getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/transactions?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
18
18
  .pipe((0, operators_1.mergeMap)((response) => {
@@ -334,7 +334,7 @@ _a = editBillView.actions, exports.fetchEditBillDetailPage = _a.fetchEditBillDet
334
334
  exports.default = editBillView.reducer;
335
335
  function doUpdateRecurringBillLocalData(billDetail, currentConfig, prevConfig) {
336
336
  var _a, _b, _c, _d;
337
- const recurringBillDetail = (0, helpers_1.updateRecurringBillDetails)(currentConfig, prevConfig, billDetail.recurringBillInstances, (_a = billDetail.totalAmount) === null || _a === void 0 ? void 0 : _a.amount);
337
+ const recurringBillDetail = (0, helpers_1.updateRecurringBillDetails)(currentConfig, prevConfig, billDetail.recurringBillInstances, (_a = billDetail.recipientTotalAmount) === null || _a === void 0 ? void 0 : _a.amount);
338
338
  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);
339
339
  billDetail.recurringBillInstances =
340
340
  (_d = recurringBillDetail.recurringInstances) !== null && _d !== void 0 ? _d : [];
@@ -114,6 +114,7 @@ export interface EditBillInitialDetails {
114
114
  lineDetailSection: Record<ID, Partial<TransactionWithAccountAndClassLine>>;
115
115
  paymentDetailsSection?: PaymentDetailsSectionView;
116
116
  totalAmount?: Amount;
117
+ recipientTotalAmount?: Amount;
117
118
  }
118
119
  export declare const getEditBillDetail: (state: RootState, isVendorRecommendationFeatureEnabled: boolean, isZeniAccountsEnabled: boolean, billId?: string | undefined) => EditBillDetailSelectorView;
119
120
  export declare const getBillPayConfigList: (billPayConfigState: BillPayConfigState) => BillPayConfig[];
@@ -110,6 +110,7 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
110
110
  whatForSection: getWhatForSection(undefined),
111
111
  paymentDetailsSection: getPaymentSection(state, withdrawFromList, {}),
112
112
  totalAmount: sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.billDetailLocalData.totalAmount,
113
+ recipientTotalAmount: sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.billDetailLocalData.recipientTotalAmount,
113
114
  };
114
115
  const accountList = (0, accountListSelector_1.getAccountList)(accountState, accountListState, 'billPayAccountList');
115
116
  let billPayInfo = undefined;
@@ -163,6 +164,7 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
163
164
  lineDetailSection: updatesByLineId,
164
165
  paymentDetailsSection: initialPaymentDetailsSectionView,
165
166
  totalAmount: sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.billDetailLocalData.totalAmount,
167
+ recipientTotalAmount: sourceBillDetail === null || sourceBillDetail === void 0 ? void 0 : sourceBillDetail.billDetailLocalData.recipientTotalAmount,
166
168
  };
167
169
  if (sourceBillDetail != null) {
168
170
  const billViewState = billDetailViewState.billDetailById[key];
@@ -256,10 +258,13 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
256
258
  .isCollectToAccountInfoFromVendorContact;
257
259
  if ((vendorDetails === null || vendorDetails === void 0 ? void 0 : vendorDetails.vendorCurrencyCode) != null) {
258
260
  whatForSection.currencyCode = vendorDetails.vendorCurrencyCode;
261
+ whatForSection.recipientCurrencyCode = vendorDetails.vendorCurrencyCode;
259
262
  }
260
263
  else if (isVendorRecommendationFeatureEnabled &&
261
264
  (recommendedVendor === null || recommendedVendor === void 0 ? void 0 : recommendedVendor.vendorCurrencyCode) != null) {
262
265
  whatForSection.currencyCode = recommendedVendor.vendorCurrencyCode;
266
+ whatForSection.recipientCurrencyCode =
267
+ recommendedVendor.vendorCurrencyCode;
263
268
  }
264
269
  isRecurring = (_0 = sourceBillDetail.billDetailLocalData.isRecurring) !== null && _0 !== void 0 ? _0 : false;
265
270
  recurringConfig = sourceBillDetail.billDetailLocalData.recurringConfig;
@@ -423,7 +428,7 @@ function getWhatForSection(updatedWhatForSection) {
423
428
  ((_d = updatedWhatForSection.memo) === null || _d === void 0 ? void 0 : _d.length) > 0
424
429
  ? updatedWhatForSection.memo
425
430
  : '',
426
- currencyCode: (_e = updatedWhatForSection === null || updatedWhatForSection === void 0 ? void 0 : updatedWhatForSection.currencyCode) !== null && _e !== void 0 ? _e : 'USD',
431
+ recipientCurrencyCode: (_e = updatedWhatForSection === null || updatedWhatForSection === void 0 ? void 0 : updatedWhatForSection.recipientCurrencyCode) !== null && _e !== void 0 ? _e : 'USD',
427
432
  isInvoiceDateAutoUpdated: (_f = updatedWhatForSection === null || updatedWhatForSection === void 0 ? void 0 : updatedWhatForSection.isInvoiceDateAutoUpdated) !== null && _f !== void 0 ? _f : false,
428
433
  };
429
434
  }
@@ -7,12 +7,11 @@ import { Vendor } from '../../../../entity/vendor/vendorState';
7
7
  import { ZeniDate } from '../../../../zeniDayJS';
8
8
  import { BillTransactionDetailKey } from '../billDetailView/billDetailViewState';
9
9
  import { LineItemOnlyRecommendationsLocalData, LineItemRecommendationsLocalData } from './editBillViewSelector';
10
- import { InternationalTransferFeeBearerPaymentMethod } from '../../../../entity/billPay/billTransaction/billTransactionState';
10
+ import { InternationalTransferFeeBearerPaymentMethod, BillStage } from '../../../../entity/billPay/billTransaction/billTransactionState';
11
11
  import { PaymentInstrument } from '../../../../entity/paymentInstrument/paymentInstrument';
12
12
  import { BankAccount } from '../../../../entity/bankAccount/bankAccount';
13
13
  import { Contact } from '../../../../entity/billPay/contact/contact';
14
14
  import { RecurringBillFrequency, RecurringBillPaymentStatus, RecurringBillStatus } from '../../../../entity/billPay/recurringBills/recurringBillsState';
15
- import { BillStage } from '../../../../entity/billPay/billTransaction/billTransactionState';
16
15
  import { TransferMoneyParty } from '../../zeniAccounts/transferDetail/transferDetailState';
17
16
  import { RecurringDatePickerOptions } from '../../../common/recurringViewHelper';
18
17
  export interface EditBillDetail {
@@ -53,6 +52,7 @@ export interface BillDetailLocalData {
53
52
  updatesByLineId: Record<ID, LineItemRecommendationsLocalData>;
54
53
  paymentDetailsSection?: PaymentDetailsSection;
55
54
  totalAmount?: Amount;
55
+ recipientTotalAmount?: Amount;
56
56
  totalAmountAfterConversion?: Amount;
57
57
  file?: Attachment;
58
58
  isCancelled: boolean;
@@ -71,6 +71,7 @@ export interface WhatForSection {
71
71
  billDueDate?: ZeniDate;
72
72
  memo?: string;
73
73
  currencyCode?: string;
74
+ recipientCurrencyCode?: string;
74
75
  isInvoiceDateAutoUpdated?: boolean;
75
76
  }
76
77
  export interface PaymentDetailsSection {
@@ -33,6 +33,7 @@ exports.initialBillDetail = {
33
33
  paymentTo: undefined,
34
34
  },
35
35
  totalAmount: undefined,
36
+ recipientTotalAmount: undefined,
36
37
  file: undefined,
37
38
  isCancelled: false,
38
39
  toAccountVendorEmail: undefined,
@@ -126,6 +126,10 @@ function prepareBillLocalData(state, billInLocalStore, vendor) {
126
126
  amount: 0,
127
127
  currencyCode: vendorCurrencyCode !== null && vendorCurrencyCode !== void 0 ? vendorCurrencyCode : 'USD',
128
128
  currencySymbol: vendorCurrencySymbol !== null && vendorCurrencySymbol !== void 0 ? vendorCurrencySymbol : '$',
129
+ }, recipientAmount: {
130
+ amount: 0,
131
+ currencyCode: vendorCurrencyCode !== null && vendorCurrencyCode !== void 0 ? vendorCurrencyCode : 'USD',
132
+ currencySymbol: vendorCurrencySymbol !== null && vendorCurrencySymbol !== void 0 ? vendorCurrencySymbol : '$',
129
133
  }, id: '1', lineDescription: '', platformLineDetailType: 'account_based_expense_line_detail', type: 'transaction_with_account_and_class_line', billable: 'not_billable', isCategoryMiscategorized: false, isClassMiscategorized: false }, editBillViewState_1.defaultRecommendationStateObj);
130
134
  }
131
135
  return {
@@ -133,7 +137,7 @@ function prepareBillLocalData(state, billInLocalStore, vendor) {
133
137
  vendor: vendor,
134
138
  isCancelled: isCancelled,
135
139
  updatesByLineId: updatedLines,
136
- whatForSection: Object.assign(Object.assign({}, billInLocalStore.billDetailLocalData.whatForSection), { currencyCode: vendor === null || vendor === void 0 ? void 0 : vendor.vendorCurrencyCode }),
140
+ whatForSection: Object.assign(Object.assign({}, billInLocalStore.billDetailLocalData.whatForSection), { currencyCode: vendor === null || vendor === void 0 ? void 0 : vendor.vendorCurrencyCode, recipientCurrencyCode: vendor === null || vendor === void 0 ? void 0 : vendor.vendorCurrencyCode }),
137
141
  paymentDetailsSection: Object.assign(Object.assign({}, billInLocalStore.billDetailLocalData.paymentDetailsSection), { paymentTo: undefined, internationalTransferFeeBearerPaymentMethod: vendor === null || vendor === void 0 ? void 0 : vendor.preferredInternationalTransferFeeBearerPaymentMethod, paymentDate: (_d = (_c = billInLocalStore.billDetailLocalData.paymentDetailsSection) === null || _c === void 0 ? void 0 : _c.paymentDate) !== null && _d !== void 0 ? _d :
138
142
  //in case paymentDate is not present in the billDetailLocalData, then today/next working date will be considered.
139
143
  //this is done beacuse we are doing similar calcualtion in getDefaultValues of editBillDetailPage.
@@ -143,6 +143,7 @@ const initializeBillToLocalStoreEpic = (actions$, state$) => actions$.pipe((0, o
143
143
  invoiceDate: (0, editBillViewSelector_1.getInvoiceDate)(transaction.billPayInfo.stage.code, transaction.date, bookCloseDate),
144
144
  memo: transaction.memo,
145
145
  currencyCode: transaction.amount.currencyCode,
146
+ recipientCurrencyCode: transaction.recipientTotalAmount.currencyCode,
146
147
  isInvoiceDateAutoUpdated: transaction.billPayInfo.stage.code === 'draft' &&
147
148
  transaction.date != null &&
148
149
  bookCloseDate != null
@@ -168,6 +169,7 @@ const initializeBillToLocalStoreEpic = (actions$, state$) => actions$.pipe((0, o
168
169
  internationalTransferFeeBearerPaymentMethod: transaction.billPayInfo.internationalTransferFeeBearerPaymentMethod,
169
170
  };
170
171
  const totalAmount = transaction.amount;
172
+ const recipientTotalAmount = transaction.recipientTotalAmount;
171
173
  const isCancelled = transaction.billPayInfo.isCancelled;
172
174
  const file = (_m = transaction.attachments) === null || _m === void 0 ? void 0 : _m[0];
173
175
  const candidateVendorname = transaction.candidateVendorName;
@@ -188,6 +190,7 @@ const initializeBillToLocalStoreEpic = (actions$, state$) => actions$.pipe((0, o
188
190
  updatesByLineId,
189
191
  paymentDetailsSection,
190
192
  totalAmount,
193
+ recipientTotalAmount,
191
194
  isCancelled,
192
195
  file,
193
196
  candidateVendorname,
@@ -29,7 +29,7 @@ const billTransactionState_1 = require("../../../../../entity/billPay/billTransa
29
29
  const workingDayHelper_1 = require("../../../../../commonStateTypes/workingDayHelper");
30
30
  const companySelector_1 = require("../../../../../entity/company/companySelector");
31
31
  const parseInvoiceToBillEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(editBillViewReducer_1.parseInvoiceToBill.match), (0, operators_1.mergeMap)((action) => {
32
- var _a, _b, _c, _d, _e, _f, _g, _h;
32
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
33
33
  const { invoiceProcessingPayload, isVendorRecommendationFeatureEnabled } = action.payload;
34
34
  const state = state$.value;
35
35
  const showSkipAutofill = state.editBillDetailViewState.newBillState.showSkipAutofill;
@@ -106,7 +106,7 @@ const parseInvoiceToBillEpic = (actions$, state$) => actions$.pipe((0, operators
106
106
  if (finalVendor.vendorCurrencyCode != null &&
107
107
  finalVendor.vendorCurrencyCode !== 'USD') {
108
108
  actions.push((0, editBillViewReducer_1.convertAmountToHomeCurrency)(true, {
109
- amount: (_e = (_d = finalBill.totalAmount) === null || _d === void 0 ? void 0 : _d.amount) !== null && _e !== void 0 ? _e : 0,
109
+ amount: (_e = (_d = finalBill.recipientTotalAmount) === null || _d === void 0 ? void 0 : _d.amount) !== null && _e !== void 0 ? _e : 0,
110
110
  currencyCode: finalVendor.vendorCurrencyCode,
111
111
  currencySymbol: finalVendor.vendorCurrencySymbol,
112
112
  }, 'USD'));
@@ -115,7 +115,7 @@ const parseInvoiceToBillEpic = (actions$, state$) => actions$.pipe((0, operators
115
115
  ...actions,
116
116
  (0, editBillViewReducer_1.saveBillUpdatesToLocalStore)({ billDetailLocalData: finalBill }),
117
117
  (0, previousBillsReducer_1.fetchPreviousBills)(finalVendor.qboId, false),
118
- (0, billPayReviewReducer_1.fetchDuplicateBill)(finalVendor.name, finalVendor.id, (_g = (_f = finalBill.totalAmount) === null || _f === void 0 ? void 0 : _f.amount) !== null && _g !== void 0 ? _g : 0, (_h = finalBill.whatForSection) === null || _h === void 0 ? void 0 : _h.invoiceNumber),
118
+ (0, billPayReviewReducer_1.fetchDuplicateBill)(finalVendor.name, finalVendor.id, (_g = (_f = finalBill.totalAmount) === null || _f === void 0 ? void 0 : _f.amount) !== null && _g !== void 0 ? _g : 0, (_j = (_h = finalBill.recipientTotalAmount) === null || _h === void 0 ? void 0 : _h.amount) !== null && _j !== void 0 ? _j : 0, (_k = finalBill.whatForSection) === null || _k === void 0 ? void 0 : _k.invoiceNumber),
119
119
  (0, editBillViewReducer_1.updateShowAutofill)(false),
120
120
  (0, editBillViewReducer_1.updateAddBillAutoFields)(addBillAutoFields),
121
121
  (0, editBillViewReducer_1.updateBillUploadFetchState)({
@@ -144,10 +144,10 @@ const parseInvoiceToBillEpic = (actions$, state$) => actions$.pipe((0, operators
144
144
  }));
145
145
  exports.parseInvoiceToBillEpic = parseInvoiceToBillEpic;
146
146
  const toBillDetailLocalData = (state, showVendorGptRecommendationText, billPayload, vendor, recommendedVendorId) => {
147
- 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;
147
+ 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;
148
148
  const currency = {
149
- currencyCode: (_a = billPayload.currency_code) !== null && _a !== void 0 ? _a : '',
150
- currencySymbol: (_b = billPayload.currency_symbol) !== null && _b !== void 0 ? _b : '', //api not returning symbol
149
+ currencyCode: (_a = billPayload.recipient_currency_code) !== null && _a !== void 0 ? _a : '',
150
+ currencySymbol: (_b = billPayload.recipient_currency_symbol) !== null && _b !== void 0 ? _b : '', //api not returning symbol
151
151
  };
152
152
  const linesById = {};
153
153
  const vendorCategoryId = vendor === null || vendor === void 0 ? void 0 : vendor.accountId;
@@ -239,6 +239,7 @@ const toBillDetailLocalData = (state, showVendorGptRecommendationText, billPaylo
239
239
  ? (0, zeniDayJS_1.date)(billPayload.transaction_date).isBefore(bookCloseDate)
240
240
  : false,
241
241
  currencyCode: billPayload.currency_code,
242
+ recipientCurrencyCode: billPayload.recipient_currency_code,
242
243
  },
243
244
  updatesByLineId: linesById,
244
245
  paymentDetailsSection: {
@@ -258,10 +259,16 @@ const toBillDetailLocalData = (state, showVendorGptRecommendationText, billPaylo
258
259
  currencySymbol: (_x = billPayload.currency_symbol) !== null && _x !== void 0 ? _x : '$',
259
260
  })
260
261
  : undefined,
262
+ recipientTotalAmount: billPayload.recipient_total_amount != null
263
+ ? (0, amount_1.toAmountWC)(billPayload.recipient_total_amount, {
264
+ currencyCode: (_y = billPayload.recipient_currency_code) !== null && _y !== void 0 ? _y : 'USD',
265
+ currencySymbol: (_z = billPayload.recipient_currency_symbol) !== null && _z !== void 0 ? _z : '$',
266
+ })
267
+ : undefined,
261
268
  isCancelled: false,
262
- toAccountVendorEmail: (_z = (_y = billPayload.bill_pay_info) === null || _y === void 0 ? void 0 : _y.to_account_vendor_email) !== null && _z !== void 0 ? _z : undefined,
263
- isCollectToAccountInfoFromVendorContact: (_1 = (_0 = billPayload.bill_pay_info) === null || _0 === void 0 ? void 0 : _0.is_collect_to_account_info_from_vendor_contact) !== null && _1 !== void 0 ? _1 : false,
264
- isRecurring: (_2 = billPayload.is_recurring) !== null && _2 !== void 0 ? _2 : false,
269
+ toAccountVendorEmail: (_1 = (_0 = billPayload.bill_pay_info) === null || _0 === void 0 ? void 0 : _0.to_account_vendor_email) !== null && _1 !== void 0 ? _1 : undefined,
270
+ isCollectToAccountInfoFromVendorContact: (_3 = (_2 = billPayload.bill_pay_info) === null || _2 === void 0 ? void 0 : _2.is_collect_to_account_info_from_vendor_contact) !== null && _3 !== void 0 ? _3 : false,
271
+ isRecurring: (_4 = billPayload.is_recurring) !== null && _4 !== void 0 ? _4 : false,
265
272
  };
266
273
  };
267
274
  exports.toBillDetailLocalData = toBillDetailLocalData;
@@ -327,7 +334,7 @@ const getAutoFieldsData = (finalBill, isVendorWithNewCurrency, tentativeVendorNa
327
334
  var _a, _b, _c, _d, _e, _f, _g;
328
335
  const singleLine = [];
329
336
  const lineDetail = finalBill.updatesByLineId[lineId];
330
- if ((_b = (_a = lineDetail.amount) === null || _a === void 0 ? void 0 : _a.amount) !== null && _b !== void 0 ? _b : 0) {
337
+ if ((_b = (_a = lineDetail.recipientAmount) === null || _a === void 0 ? void 0 : _a.amount) !== null && _b !== void 0 ? _b : 0) {
331
338
  singleLine.push('amount');
332
339
  }
333
340
  if (lineDetail.lineDescription != null) {
@@ -409,6 +416,7 @@ const addLineItem = (taxAmount, currency, description, isCategorySameAcrossLineI
409
416
  class: classData,
410
417
  account: accountData,
411
418
  amount: (0, amount_1.toAmountWC)(taxAmount, currency),
419
+ recipientAmount: (0, amount_1.toAmountWC)(taxAmount, currency),
412
420
  billable: 'not_billable',
413
421
  lineDescription: description,
414
422
  isCategoryMiscategorized: false,
@@ -83,7 +83,7 @@ const getSaveBillApiURL = (saveBillBaseURL, isRecurring, billId, billTransaction
83
83
  }
84
84
  };
85
85
  function prepareSaveBillPayload(accountState, billTransactionState, paymentAccountState, recurringBillState, billDetail, billStageCode) {
86
- 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, _23, _24;
86
+ 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, _23, _24, _25, _26, _27, _28;
87
87
  const billId = billDetail.billId;
88
88
  let detail;
89
89
  const withdrawFromAccount = (_a = billDetail.billDetailLocalData.paymentDetailsSection) === null || _a === void 0 ? void 0 : _a.withdrawFrom;
@@ -109,41 +109,43 @@ function prepareSaveBillPayload(accountState, billTransactionState, paymentAccou
109
109
  transaction_date: (_p = (_o = (_m = billDetail.billDetailLocalData.whatForSection) === null || _m === void 0 ? void 0 : _m.invoiceDate) === null || _o === void 0 ? void 0 : _o.format('YYYY-MM-DD')) !== null && _p !== void 0 ? _p : (0, zeniDayJS_1.dateNow)().format('YYYY-MM-DD'),
110
110
  due_date: (_s = (_r = (_q = billDetail.billDetailLocalData.whatForSection) === null || _q === void 0 ? void 0 : _q.billDueDate) === null || _r === void 0 ? void 0 : _r.format('YYYY-MM-DD')) !== null && _s !== void 0 ? _s : null,
111
111
  total_amount: (_u = (_t = billDetail.billDetailLocalData.totalAmount) === null || _t === void 0 ? void 0 : _t.amount) !== null && _u !== void 0 ? _u : 0,
112
+ recipient_total_amount: (_w = (_v = billDetail.billDetailLocalData.recipientTotalAmount) === null || _v === void 0 ? void 0 : _v.amount) !== null && _w !== void 0 ? _w : 0,
112
113
  bill_pay_info: {
113
114
  stage: {
114
115
  code: billStageCode,
115
116
  },
116
- payment_date: (_x = (_w = (_v = billDetail.billDetailLocalData.paymentDetailsSection) === null || _v === void 0 ? void 0 : _v.paymentDate) === null || _w === void 0 ? void 0 : _w.format('YYYY-MM-DD')) !== null && _x !== void 0 ? _x : null,
117
+ payment_date: (_z = (_y = (_x = billDetail.billDetailLocalData.paymentDetailsSection) === null || _x === void 0 ? void 0 : _x.paymentDate) === null || _y === void 0 ? void 0 : _y.format('YYYY-MM-DD')) !== null && _z !== void 0 ? _z : null,
117
118
  from_account: {
118
- account_id: (_0 = (_z = (_y = billDetail.billDetailLocalData.paymentDetailsSection) === null || _y === void 0 ? void 0 : _y.withdrawFrom) === null || _z === void 0 ? void 0 : _z.id) !== null && _0 !== void 0 ? _0 : '',
119
- account_type: (_3 = (0, helpers_1.accountTypeSubConfigCodeToAccType)((_2 = (_1 = billDetail.billDetailLocalData.paymentDetailsSection) === null || _1 === void 0 ? void 0 : _1.withdrawFrom) === null || _2 === void 0 ? void 0 : _2.accType)) !== null && _3 !== void 0 ? _3 : '',
119
+ account_id: (_2 = (_1 = (_0 = billDetail.billDetailLocalData.paymentDetailsSection) === null || _0 === void 0 ? void 0 : _0.withdrawFrom) === null || _1 === void 0 ? void 0 : _1.id) !== null && _2 !== void 0 ? _2 : '',
120
+ account_type: (_5 = (0, helpers_1.accountTypeSubConfigCodeToAccType)((_4 = (_3 = billDetail.billDetailLocalData.paymentDetailsSection) === null || _3 === void 0 ? void 0 : _3.withdrawFrom) === null || _4 === void 0 ? void 0 : _4.accType)) !== null && _5 !== void 0 ? _5 : '',
120
121
  },
121
- to_account: Object.assign({}, (((_5 = (_4 = billDetail.billDetailLocalData.paymentDetailsSection) === null || _4 === void 0 ? void 0 : _4.paymentType) === null || _5 === void 0 ? void 0 : _5.method.includes('international')) === true
122
+ to_account: Object.assign({}, (((_7 = (_6 = billDetail.billDetailLocalData.paymentDetailsSection) === null || _6 === void 0 ? void 0 : _6.paymentType) === null || _7 === void 0 ? void 0 : _7.method.includes('international')) === true
122
123
  ? {
123
124
  payment_instrument_id: Boolean(billDetail.billDetailLocalData
124
125
  .isCollectToAccountInfoFromVendorContact) === false
125
- ? (_7 = (_6 = billDetail.billDetailLocalData.paymentDetailsSection) === null || _6 === void 0 ? void 0 : _6.paymentTo) !== null && _7 !== void 0 ? _7 : null
126
+ ? (_9 = (_8 = billDetail.billDetailLocalData.paymentDetailsSection) === null || _8 === void 0 ? void 0 : _8.paymentTo) !== null && _9 !== void 0 ? _9 : null
126
127
  : null,
127
128
  }
128
129
  : {
129
130
  account_id: Boolean(billDetail.billDetailLocalData
130
131
  .isCollectToAccountInfoFromVendorContact) === false
131
- ? (_9 = (_8 = billDetail.billDetailLocalData.paymentDetailsSection) === null || _8 === void 0 ? void 0 : _8.paymentTo) !== null && _9 !== void 0 ? _9 : null
132
+ ? (_11 = (_10 = billDetail.billDetailLocalData.paymentDetailsSection) === null || _10 === void 0 ? void 0 : _10.paymentTo) !== null && _11 !== void 0 ? _11 : null
132
133
  : null,
133
134
  })),
134
- to_account_vendor_email: (_10 = billDetail.billDetailLocalData.toAccountVendorEmail) !== null && _10 !== void 0 ? _10 : null,
135
+ to_account_vendor_email: (_12 = billDetail.billDetailLocalData.toAccountVendorEmail) !== null && _12 !== void 0 ? _12 : null,
135
136
  is_collect_to_account_info_from_vendor_contact: billDetail.billDetailLocalData.isCollectToAccountInfoFromVendorContact,
136
137
  is_cancelled: false,
137
- bill_payment_method_type: getBillPaymentMethodTypePayload((_11 = billDetail.billDetailLocalData.paymentDetailsSection) === null || _11 === void 0 ? void 0 : _11.paymentType),
138
- international_transfer_fee_bearer_payment_method: ((_13 = (_12 = billDetail.billDetailLocalData.paymentDetailsSection) === null || _12 === void 0 ? void 0 : _12.paymentType) === null || _13 === void 0 ? void 0 : _13.method.includes('international')) === true &&
139
- ((_14 = billDetail.billDetailLocalData.vendor) === null || _14 === void 0 ? void 0 : _14.vendorCurrencyCode) === 'USD'
140
- ? (_15 = billDetail.billDetailLocalData.paymentDetailsSection
141
- .internationalTransferFeeBearerPaymentMethod) !== null && _15 !== void 0 ? _15 : 'swift_our' //default value for international method and USD currency
138
+ bill_payment_method_type: getBillPaymentMethodTypePayload((_13 = billDetail.billDetailLocalData.paymentDetailsSection) === null || _13 === void 0 ? void 0 : _13.paymentType),
139
+ international_transfer_fee_bearer_payment_method: ((_15 = (_14 = billDetail.billDetailLocalData.paymentDetailsSection) === null || _14 === void 0 ? void 0 : _14.paymentType) === null || _15 === void 0 ? void 0 : _15.method.includes('international')) === true &&
140
+ ((_16 = billDetail.billDetailLocalData.vendor) === null || _16 === void 0 ? void 0 : _16.vendorCurrencyCode) === 'USD'
141
+ ? (_17 = billDetail.billDetailLocalData.paymentDetailsSection
142
+ .internationalTransferFeeBearerPaymentMethod) !== null && _17 !== void 0 ? _17 : 'swift_our' //default value for international method and USD currency
142
143
  : null,
143
144
  },
144
- document_id: (_16 = billDetail.billDetailLocalData.whatForSection) === null || _16 === void 0 ? void 0 : _16.invoiceNumber,
145
- transaction_memo: (_17 = billDetail.billDetailLocalData.whatForSection) === null || _17 === void 0 ? void 0 : _17.memo,
146
- currency_code: (_19 = (_18 = billDetail.billDetailLocalData.whatForSection) === null || _18 === void 0 ? void 0 : _18.currencyCode) !== null && _19 !== void 0 ? _19 : 'USD',
145
+ document_id: (_18 = billDetail.billDetailLocalData.whatForSection) === null || _18 === void 0 ? void 0 : _18.invoiceNumber,
146
+ transaction_memo: (_19 = billDetail.billDetailLocalData.whatForSection) === null || _19 === void 0 ? void 0 : _19.memo,
147
+ currency_code: (_21 = (_20 = billDetail.billDetailLocalData.whatForSection) === null || _20 === void 0 ? void 0 : _20.currencyCode) !== null && _21 !== void 0 ? _21 : 'USD',
148
+ recipient_currency_code: (_23 = (_22 = billDetail.billDetailLocalData.whatForSection) === null || _22 === void 0 ? void 0 : _22.recipientCurrencyCode) !== null && _23 !== void 0 ? _23 : 'USD',
147
149
  lines: Object.keys(billDetail.billDetailLocalData.updatesByLineId).map((lineId) => {
148
150
  const line = billDetail.billDetailLocalData.updatesByLineId[lineId];
149
151
  const lineAsTransactionLinePayload = (0, editBillViewPayload_1.fromLineLocalDataToTransactionLinePayload)(line);
@@ -151,12 +153,12 @@ function prepareSaveBillPayload(accountState, billTransactionState, paymentAccou
151
153
  }),
152
154
  };
153
155
  if (!isRecurring) {
154
- payload.vendor_name = (_21 = (_20 = billDetail.billDetailLocalData.vendor) === null || _20 === void 0 ? void 0 : _20.name) !== null && _21 !== void 0 ? _21 : '';
156
+ payload.vendor_name = (_25 = (_24 = billDetail.billDetailLocalData.vendor) === null || _24 === void 0 ? void 0 : _24.name) !== null && _25 !== void 0 ? _25 : '';
155
157
  }
156
158
  if (billId != null) {
157
159
  detail = (0, get_1.default)(billTransactionState.transactionById, billId, undefined);
158
- payload.sync_token = (_22 = detail === null || detail === void 0 ? void 0 : detail.syncToken) !== null && _22 !== void 0 ? _22 : null;
159
- payload.update_time = (_23 = detail === null || detail === void 0 ? void 0 : detail.updateTime.format('YYYY-MM-DD')) !== null && _23 !== void 0 ? _23 : null;
160
+ payload.sync_token = (_26 = detail === null || detail === void 0 ? void 0 : detail.syncToken) !== null && _26 !== void 0 ? _26 : null;
161
+ payload.update_time = (_27 = detail === null || detail === void 0 ? void 0 : detail.updateTime.format('YYYY-MM-DD')) !== null && _27 !== void 0 ? _27 : null;
160
162
  //required by platform to clear old recurring details
161
163
  if ((detail === null || detail === void 0 ? void 0 : detail.isRecurring) === true &&
162
164
  Boolean(billDetail.billDetailLocalData.isRecurring) === false) {
@@ -167,7 +169,7 @@ function prepareSaveBillPayload(accountState, billTransactionState, paymentAccou
167
169
  payload.are_approvals_serialized = true;
168
170
  }
169
171
  if (billStageCode === 'pending_approval' &&
170
- ((_24 = billDetail.billDetailLocalData.paymentDetailsSection) === null || _24 === void 0 ? void 0 : _24.conversionRate) != null) {
172
+ ((_28 = billDetail.billDetailLocalData.paymentDetailsSection) === null || _28 === void 0 ? void 0 : _28.conversionRate) != null) {
171
173
  // required by platform
172
174
  payload.exchange_rate =
173
175
  1 / billDetail.billDetailLocalData.paymentDetailsSection.conversionRate;
@@ -1,5 +1,4 @@
1
1
  import { ID } from '../../commonStateTypes/common';
2
- import { Recommendation } from '../../commonStateTypes/recommendationBase';
3
2
  import { AccountBase } from '../../entity/account/accountState';
4
3
  import { ClassBase } from '../../entity/class/classState';
5
4
  import { Entity } from '../../entity/genericEntity/entity';
@@ -15,7 +14,7 @@ export declare const toSetAllLineItemsToCategoryClass: (transaction: SupportedTr
15
14
  } | undefined, chosenClass?: {
16
15
  classBase: ClassBase;
17
16
  updateOrRetain: 'update' | 'retain';
18
- } | undefined, recommendations?: Recommendation[] | undefined) => TransactionDetailLocalData;
17
+ } | undefined) => TransactionDetailLocalData;
19
18
  export declare const toSetAllLineItemsLocalDataIsUpdateAllChecked: (transaction: SupportedTransaction, transactionDetailLocalData: TransactionDetailLocalData, isUpdateAll: boolean, entity?: Entity | undefined) => TransactionDetailLocalData;
20
19
  export declare const setEntityRecommendationForLineIdInLocalData: (transaction: SupportedTransaction, transactionDetailLocalData: TransactionDetailLocalData, entity: Entity, recommendationLineIds: ID[], recommendationByLineId?: RecommendationByLineId | undefined, uncategorizedIncomeExpense?: UncategorizedAccounts | undefined) => TransactionDetailLocalData;
21
20
  export declare const removeEntityRecommendationForLineIdInLocalData: (transaction: SupportedTransaction, transactionDetailLocalData: TransactionDetailLocalData, recommendationLineIds: ID[]) => TransactionDetailLocalData;
@@ -326,7 +326,7 @@ const toUpdateLineItemsOriginalCategoryClass = (transaction, transactionDetailLo
326
326
  return newLocalData;
327
327
  };
328
328
  exports.toUpdateLineItemsOriginalCategoryClass = toUpdateLineItemsOriginalCategoryClass;
329
- const toSetAllLineItemsToCategoryClass = (transaction, transactionDetailLocalData, isUpdateAll, lineEntity, chosenAccount, chosenClass, recommendations) => {
329
+ const toSetAllLineItemsToCategoryClass = (transaction, transactionDetailLocalData, isUpdateAll, lineEntity, chosenAccount, chosenClass) => {
330
330
  const newLineItems = {};
331
331
  const updateAllLines = (0, vendorTransaction_1.isVendorTransaction)(transaction) === true ||
332
332
  (0, customerTransaction_1.isCustomerTransaction)(transaction) === true;
@@ -340,9 +340,6 @@ const toSetAllLineItemsToCategoryClass = (transaction, transactionDetailLocalDat
340
340
  const lineId = line.id;
341
341
  const record = Object.assign({}, transactionDetailLocalData.lineItemById[lineId]);
342
342
  if (updateAllLines === true || isEntityMatching(lineEntity, record)) {
343
- if (updateAllLines !== true) {
344
- record.recommendations = recommendations;
345
- }
346
343
  if ((chosenAccount === null || chosenAccount === void 0 ? void 0 : chosenAccount.account) != null) {
347
344
  record.account = chosenAccount === null || chosenAccount === void 0 ? void 0 : chosenAccount.account;
348
345
  }
@@ -230,7 +230,7 @@ const transactionDetail = (0, toolkit_1.createSlice)({
230
230
  const key = (0, transactionDetailState_1.getTransactionDetailKey)(action.payload.transactionId);
231
231
  const detail = (0, get_1.default)(draft.transactionDetailById, key, undefined);
232
232
  if (detail != null) {
233
- const newLocalData = (0, transactionDetailLocalDataHelper_1.toSetAllLineItemsToCategoryClass)(action.payload.transaction, detail.transactionDetailLocalData, action.payload.isUpdateAll, action.payload.lineEntity, action.payload.chosenAccount, action.payload.chosenClass, action.payload.recommendations);
233
+ const newLocalData = (0, transactionDetailLocalDataHelper_1.toSetAllLineItemsToCategoryClass)(action.payload.transaction, detail.transactionDetailLocalData, action.payload.isUpdateAll, action.payload.lineEntity, action.payload.chosenAccount, action.payload.chosenClass);
234
234
  draft.transactionDetailById[key] = Object.assign(Object.assign({}, detail), { transactionDetailLocalData: newLocalData });
235
235
  }
236
236
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.10.39",
3
+ "version": "4.10.41",
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",