@zeniai/client-epic-state 4.19.84-betaVR15 → 4.19.84-betaVR16

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.
@@ -1,4 +1,5 @@
1
1
  import { toURL } from '../../../commonPayloadTypes/urlPayload';
2
+ import { toAmount } from '../../../commonStateTypes/amount';
2
3
  import { getTransactionPayloadAmount, } from '../../../entity/transaction/payloadTypes/transactionPayload';
3
4
  import { toBatchFileStatus, toBatchStatusValue, toMatchSource, } from '../types/missingReceiptsViewState';
4
5
  // -- Converter functions --
@@ -159,9 +160,21 @@ export function toBatchListItem(payload) {
159
160
  totalFiles: payload.total_files,
160
161
  };
161
162
  }
163
+ /**
164
+ * Amount shown in the Unmatched tab manual-search list: **first line only** when `lines` exist.
165
+ * Falls back to transaction-level totals via {@link getTransactionPayloadAmount} when there is
166
+ * no line or no line amount (same currency fields as the rest of the transaction payload).
167
+ */
168
+ function getManualSearchListAmountFromPayload(payload) {
169
+ const lineAmount = payload.lines?.[0]?.amount;
170
+ if (lineAmount != null) {
171
+ return toAmount(lineAmount, payload.currency_code, payload.currency_symbol);
172
+ }
173
+ return getTransactionPayloadAmount(payload);
174
+ }
162
175
  /** Maps expense-automation transaction rows to manual-search list rows (Unmatched tab). */
163
176
  export function supportedTransactionPayloadToManualSearchResult(payload) {
164
- const amountPayload = getTransactionPayloadAmount(payload);
177
+ const amountPayload = getManualSearchListAmountFromPayload(payload);
165
178
  return {
166
179
  amount: amountPayload.amount,
167
180
  currencyCode: amountPayload.currencyCode,
@@ -13,6 +13,7 @@ exports.shouldFetchBatchDetailsForBatchId = shouldFetchBatchDetailsForBatchId;
13
13
  exports.toBatchListItem = toBatchListItem;
14
14
  exports.supportedTransactionPayloadToManualSearchResult = supportedTransactionPayloadToManualSearchResult;
15
15
  const urlPayload_1 = require("../../../commonPayloadTypes/urlPayload");
16
+ const amount_1 = require("../../../commonStateTypes/amount");
16
17
  const transactionPayload_1 = require("../../../entity/transaction/payloadTypes/transactionPayload");
17
18
  const missingReceiptsViewState_1 = require("../types/missingReceiptsViewState");
18
19
  // -- Converter functions --
@@ -173,9 +174,21 @@ function toBatchListItem(payload) {
173
174
  totalFiles: payload.total_files,
174
175
  };
175
176
  }
177
+ /**
178
+ * Amount shown in the Unmatched tab manual-search list: **first line only** when `lines` exist.
179
+ * Falls back to transaction-level totals via {@link getTransactionPayloadAmount} when there is
180
+ * no line or no line amount (same currency fields as the rest of the transaction payload).
181
+ */
182
+ function getManualSearchListAmountFromPayload(payload) {
183
+ const lineAmount = payload.lines?.[0]?.amount;
184
+ if (lineAmount != null) {
185
+ return (0, amount_1.toAmount)(lineAmount, payload.currency_code, payload.currency_symbol);
186
+ }
187
+ return (0, transactionPayload_1.getTransactionPayloadAmount)(payload);
188
+ }
176
189
  /** Maps expense-automation transaction rows to manual-search list rows (Unmatched tab). */
177
190
  function supportedTransactionPayloadToManualSearchResult(payload) {
178
- const amountPayload = (0, transactionPayload_1.getTransactionPayloadAmount)(payload);
191
+ const amountPayload = getManualSearchListAmountFromPayload(payload);
179
192
  return {
180
193
  amount: amountPayload.amount,
181
194
  currencyCode: amountPayload.currencyCode,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.19.84-betaVR15",
3
+ "version": "4.19.84-betaVR16",
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
  "module": "lib/esm/index.js",