@zeniai/client-epic-state 5.1.62-betaRD6 → 5.1.62-betaRD7

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.
@@ -8,6 +8,9 @@ import { searchTransactionsForNewSchedule, searchTransactionsForNewScheduleFailu
8
8
  import { MIN_NEW_SCHEDULE_SEARCH_LENGTH } from '../../../types/jeSchedulesViewState';
9
9
  /** Dropdown-sized result set — no pagination for Base Transaction search. */
10
10
  const NEW_SCHEDULE_SEARCH_PAGE_SIZE = 10;
11
+ /** Fallback when the backend sends a null currency for a search result. */
12
+ const DEFAULT_CURRENCY_CODE = 'USD';
13
+ const DEFAULT_CURRENCY_SYMBOL = '$';
11
14
  export const searchTransactionsForNewScheduleEpic = (actions$, _state$, zeniAPI) => {
12
15
  const searchActions$ = actions$.pipe(filter(searchTransactionsForNewSchedule.match));
13
16
  /** No API for empty or 1-char queries; immediate merge so switchMap cancels any in-flight HTTP. */
@@ -31,15 +34,18 @@ export const searchTransactionsForNewScheduleEpic = (actions$, _state$, zeniAPI)
31
34
  const transactionsPerCurrency = {};
32
35
  transactions.forEach((transaction) => {
33
36
  const { currency_code, currency_symbol } = transaction;
34
- const existing = transactionsPerCurrency[currency_code];
35
- transactionsPerCurrency[currency_code] =
37
+ const currencyCode = currency_code ?? DEFAULT_CURRENCY_CODE;
38
+ const existing = transactionsPerCurrency[currencyCode];
39
+ transactionsPerCurrency[currencyCode] =
36
40
  existing != null
37
41
  ? {
38
42
  currencySymbol: existing.currencySymbol,
39
43
  transactions: [...existing.transactions, transaction],
40
44
  }
41
45
  : {
42
- currencySymbol: currency_symbol,
46
+ currencySymbol: currency_code == null
47
+ ? DEFAULT_CURRENCY_SYMBOL
48
+ : currency_symbol,
43
49
  transactions: [transaction],
44
50
  };
45
51
  });
@@ -11,6 +11,9 @@ const jeSchedulesViewReducer_1 = require("../../../reducers/jeSchedulesViewReduc
11
11
  const jeSchedulesViewState_1 = require("../../../types/jeSchedulesViewState");
12
12
  /** Dropdown-sized result set — no pagination for Base Transaction search. */
13
13
  const NEW_SCHEDULE_SEARCH_PAGE_SIZE = 10;
14
+ /** Fallback when the backend sends a null currency for a search result. */
15
+ const DEFAULT_CURRENCY_CODE = 'USD';
16
+ const DEFAULT_CURRENCY_SYMBOL = '$';
14
17
  const searchTransactionsForNewScheduleEpic = (actions$, _state$, zeniAPI) => {
15
18
  const searchActions$ = actions$.pipe((0, operators_1.filter)(jeSchedulesViewReducer_1.searchTransactionsForNewSchedule.match));
16
19
  /** No API for empty or 1-char queries; immediate merge so switchMap cancels any in-flight HTTP. */
@@ -34,15 +37,18 @@ const searchTransactionsForNewScheduleEpic = (actions$, _state$, zeniAPI) => {
34
37
  const transactionsPerCurrency = {};
35
38
  transactions.forEach((transaction) => {
36
39
  const { currency_code, currency_symbol } = transaction;
37
- const existing = transactionsPerCurrency[currency_code];
38
- transactionsPerCurrency[currency_code] =
40
+ const currencyCode = currency_code ?? DEFAULT_CURRENCY_CODE;
41
+ const existing = transactionsPerCurrency[currencyCode];
42
+ transactionsPerCurrency[currencyCode] =
39
43
  existing != null
40
44
  ? {
41
45
  currencySymbol: existing.currencySymbol,
42
46
  transactions: [...existing.transactions, transaction],
43
47
  }
44
48
  : {
45
- currencySymbol: currency_symbol,
49
+ currencySymbol: currency_code == null
50
+ ? DEFAULT_CURRENCY_SYMBOL
51
+ : currency_symbol,
46
52
  transactions: [transaction],
47
53
  };
48
54
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.1.62-betaRD6",
3
+ "version": "5.1.62-betaRD7",
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",