@zeniai/client-epic-state 5.2.62 → 5.2.63

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 (42) hide show
  1. package/lib/entity/actualMatching/actualMatchingReducer.d.ts +3 -1
  2. package/lib/entity/actualMatching/actualMatchingReducer.js +11 -2
  3. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +1 -0
  4. package/lib/entity/jeSchedules/jeSchedulesPayload.js +1 -0
  5. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +1 -0
  6. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  7. package/lib/entity/snackbar/snackbarTypes.js +1 -0
  8. package/lib/epic.d.ts +2 -1
  9. package/lib/epic.js +2 -0
  10. package/lib/esm/entity/actualMatching/actualMatchingReducer.js +9 -1
  11. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +1 -0
  12. package/lib/esm/entity/snackbar/snackbarTypes.js +1 -0
  13. package/lib/esm/epic.js +2 -0
  14. package/lib/esm/index.js +5 -5
  15. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/actualMatching/fetchActualMatchingMatchEpic.js +4 -2
  16. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/actualMatching/ignoreActualMatchingSuggestionEpic.js +50 -0
  17. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/actualMatching/matchAndReverseAccrualsEpic.js +26 -13
  18. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/actualMatching/searchMatchTransactionsEpic.js +2 -23
  19. package/lib/esm/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +89 -38
  20. package/lib/esm/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +66 -64
  21. package/lib/esm/view/expenseAutomationView/types/actualMatchingViewState.js +15 -0
  22. package/lib/esm/view/spendManagement/billPay/editBillView/editBillViewSelector.js +4 -30
  23. package/lib/index.d.ts +6 -6
  24. package/lib/index.js +57 -49
  25. package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/fetchActualMatchingMatchEpic.d.ts +2 -2
  26. package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/fetchActualMatchingMatchEpic.js +3 -1
  27. package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/ignoreActualMatchingSuggestionEpic.d.ts +10 -0
  28. package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/ignoreActualMatchingSuggestionEpic.js +54 -0
  29. package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/matchAndReverseAccrualsEpic.js +24 -11
  30. package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/searchMatchTransactionsEpic.js +1 -22
  31. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  32. package/lib/view/expenseAutomationView/payload/actualMatchingPayload.d.ts +12 -1
  33. package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.d.ts +19 -8
  34. package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +90 -39
  35. package/lib/view/expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.d.ts +20 -8
  36. package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.d.ts +7 -4
  37. package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +69 -64
  38. package/lib/view/expenseAutomationView/types/actualMatchingViewState.d.ts +20 -4
  39. package/lib/view/expenseAutomationView/types/actualMatchingViewState.js +18 -1
  40. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.d.ts +1 -1
  41. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +4 -30
  42. package/package.json +1 -1
@@ -1,13 +1,12 @@
1
1
  import { FetchStateAndError } from '../../../commonStateTypes/common';
2
2
  import { MonthYearPeriod } from '../../../commonStateTypes/timePeriod';
3
3
  import { DisplayCurrencyFallback } from '../../../entity/actualMatching/actualMatchingPayload';
4
- import { ActualMatchingMatch } from '../../../entity/actualMatching/actualMatchingState';
5
4
  import { ActualMatchingMatchId } from '../../../entity/actualMatching/actualMatchingTypes';
6
5
  import { JEOneTimeAccrual } from '../../../entity/jeSchedules/jeSchedulesSelector';
7
6
  import { JEOneTimeAccrualMatchSuggestion } from '../../../entity/jeSchedules/jeSchedulesState';
8
7
  import { RootState } from '../../../rootStateTypes';
9
8
  import { ZeniDate } from '../../../zeniDayJS';
10
- import { ActualMatchingKpiSummary, ActualMatchingRow, ActualMatchingRowKind, ExpenseAutomationActualMatchingViewSelector } from '../selectorTypes/actualMatchingViewSelectorTypes';
9
+ import { ActualMatchingKpiSummary, ActualMatchingMatchView, ActualMatchingRow, ActualMatchingRowKind, ExpenseAutomationActualMatchingViewSelector } from '../selectorTypes/actualMatchingViewSelectorTypes';
11
10
  import { MatchAndReverseResult, UndoReversalResult } from '../types/actualMatchingViewState';
12
11
  export declare function getSelectedMonthYearForCurrentTenant(state: RootState): MonthYearPeriod | undefined;
13
12
  export declare function getTenantDisplayCurrency(state: RootState): DisplayCurrencyFallback | undefined;
@@ -27,12 +26,16 @@ export declare function getActualMatchingReversalDate(accrual: JEOneTimeAccrual,
27
26
  export declare function buildActualMatchingKpiSummary(rows: ActualMatchingRow[], displayCurrencyCode?: string): ActualMatchingKpiSummary;
28
27
  export interface ExpenseAutomationActualMatchingMatchView {
29
28
  detailFetchState: FetchStateAndError;
29
+ ignoreStatus: FetchStateAndError;
30
30
  refreshStatus: FetchStateAndError;
31
31
  undoReversalStatus: FetchStateAndError;
32
32
  lastMatchResults?: MatchAndReverseResult[];
33
33
  lastUndoResults?: UndoReversalResult[];
34
- match?: ActualMatchingMatch;
34
+ match?: ActualMatchingMatchView;
35
35
  }
36
36
  export declare function getExpenseAutomationActualMatchingMatchView(state: RootState, matchId: ActualMatchingMatchId): ExpenseAutomationActualMatchingMatchView;
37
- export declare function getCloseMatchAfterUndo(state: RootState): boolean;
37
+ export declare function getCloseMatchAfterUndo(state: RootState): ActualMatchingMatchId | undefined;
38
+ export declare function getCloseMatchAfterUndoMatchId(state: RootState): ActualMatchingMatchId | undefined;
39
+ export declare function getCloseMatchAfterIgnoreMatchId(state: RootState): ActualMatchingMatchId | undefined;
40
+ export declare function getActualMatchingMatchModalConfirmStatus(state: RootState, matchId?: ActualMatchingMatchId): FetchStateAndError;
38
41
  export declare function getExpenseAutomationActualMatchingView(state: RootState): ExpenseAutomationActualMatchingViewSelector;
@@ -16,15 +16,18 @@ exports.getActualMatchingReversalDate = getActualMatchingReversalDate;
16
16
  exports.buildActualMatchingKpiSummary = buildActualMatchingKpiSummary;
17
17
  exports.getExpenseAutomationActualMatchingMatchView = getExpenseAutomationActualMatchingMatchView;
18
18
  exports.getCloseMatchAfterUndo = getCloseMatchAfterUndo;
19
+ exports.getCloseMatchAfterUndoMatchId = getCloseMatchAfterUndoMatchId;
20
+ exports.getCloseMatchAfterIgnoreMatchId = getCloseMatchAfterIgnoreMatchId;
21
+ exports.getActualMatchingMatchModalConfirmStatus = getActualMatchingMatchModalConfirmStatus;
19
22
  exports.getExpenseAutomationActualMatchingView = getExpenseAutomationActualMatchingView;
20
23
  const orderBy_1 = __importDefault(require("lodash/orderBy"));
24
+ const toolkit_1 = require("@reduxjs/toolkit");
21
25
  const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
22
26
  const actualMatchingSelector_1 = require("../../../entity/actualMatching/actualMatchingSelector");
23
27
  const jeScheduleHelper_1 = require("../../../entity/jeSchedules/jeScheduleHelper");
24
28
  const jeSchedulesSelector_1 = require("../../../entity/jeSchedules/jeSchedulesSelector");
25
29
  const tenantSelector_1 = require("../../../entity/tenant/tenantSelector");
26
30
  const zeniDayJS_1 = require("../../../zeniDayJS");
27
- const actualMatchingViewState_1 = require("../types/actualMatchingViewState");
28
31
  function getSelectedMonthYearForCurrentTenant(state) {
29
32
  const tenantId = (0, tenantSelector_1.getCurrentTenant)(state)?.tenantId;
30
33
  if (tenantId == null) {
@@ -53,27 +56,6 @@ function toMatchModalAccrual(member) {
53
56
  jeOneTimeAccrualKey: (0, jeScheduleHelper_1.generateJEOneTimeAccrualKey)(member.accrualId),
54
57
  };
55
58
  }
56
- function uniqueMatchModalAccruals(pinned, searched) {
57
- const byId = new Map();
58
- pinned.forEach((row) => byId.set(row.accrualId, row));
59
- searched.forEach((row) => {
60
- if (!byId.has(row.accrualId)) {
61
- byId.set(row.accrualId, row);
62
- }
63
- });
64
- return Array.from(byId.values());
65
- }
66
- function uniqueTransactionSearchResults(pinned, searched) {
67
- const byKey = new Map();
68
- pinned.forEach((row) => byKey.set((0, actualMatchingViewState_1.actualMatchingTransactionLineKey)(row.transactionType, row.transactionIntegrationId, row.lineId), row));
69
- searched.forEach((row) => {
70
- const key = (0, actualMatchingViewState_1.actualMatchingTransactionLineKey)(row.transactionType, row.transactionIntegrationId, row.lineId);
71
- if (!byKey.has(key)) {
72
- byKey.set(key, row);
73
- }
74
- });
75
- return Array.from(byKey.values());
76
- }
77
59
  function parseActualMatchingMatchId(matchId) {
78
60
  const separator = matchId.indexOf(':');
79
61
  if (separator <= 0 || separator === matchId.length - 1) {
@@ -246,6 +228,7 @@ function emptyKpiSummary() {
246
228
  actualsReceived: { count: 0, expectedCount: 0, vendorsPending: 0 },
247
229
  autoReversed: { count: 0, percent: 0, clearedAmount: 0 },
248
230
  pendingReview: { count: 0, amount: 0, estimatedMinutesToClear: 0 },
231
+ reversed: { count: 0 },
249
232
  variance: { percent: 0, averagePercentPerMatch: 0, netAmount: 0 },
250
233
  };
251
234
  }
@@ -301,6 +284,7 @@ function buildActualMatchingKpiSummary(rows, displayCurrencyCode) {
301
284
  }
302
285
  const autoReversed = kpiRows.filter((row) => row.kind === 'auto_reversed');
303
286
  const pendingReview = kpiRows.filter((row) => row.kind === 'pending_review');
287
+ const reversed = kpiRows.filter((row) => isReversedMatchKind(row.kind));
304
288
  const receivedCount = kpiRows.length;
305
289
  const rowsWithActual = kpiRows.filter((row) => row.actualAmount?.amount != null);
306
290
  const accruedTotal = rowsWithActual.reduce((sum, row) => sum + (row.accruedAmount?.amount ?? row.estimatedAmount.amount), 0);
@@ -326,6 +310,9 @@ function buildActualMatchingKpiSummary(rows, displayCurrencyCode) {
326
310
  amount: sumRowAmounts(pendingReview, displayCurrencyCode),
327
311
  estimatedMinutesToClear: pendingReview.length * ESTIMATED_MINUTES_PER_PENDING_MATCH,
328
312
  },
313
+ reversed: {
314
+ count: reversed.length,
315
+ },
329
316
  variance: {
330
317
  percent: accruedTotal === 0
331
318
  ? 0
@@ -338,23 +325,61 @@ function buildActualMatchingKpiSummary(rows, displayCurrencyCode) {
338
325
  },
339
326
  };
340
327
  }
341
- function getExpenseAutomationActualMatchingMatchView(state, matchId) {
342
- const view = state.expenseAutomationActualMatchingViewState;
328
+ function toActualMatchingMatchView(match) {
343
329
  return {
344
- match: (0, actualMatchingSelector_1.getActualMatchingMatchById)(state.actualMatchingState, matchId),
345
- detailFetchState: view.detailFetchStateByMatchId[matchId] ?? NOT_STARTED,
346
- refreshStatus: view.detailRefreshStatusByMatchId[matchId] ?? NOT_STARTED,
347
- undoReversalStatus: view.undoReversalStatusByMatchId[matchId] ?? NOT_STARTED,
348
- lastMatchResults: view.lastMatchResultsByMatchId?.[matchId],
349
- lastUndoResults: view.lastUndoResultsByMatchId?.[matchId],
330
+ ...match,
331
+ members: match.members.map(toMatchModalAccrual),
332
+ leftovers: match.leftovers == null
333
+ ? undefined
334
+ : match.leftovers.map(toMatchModalAccrual),
350
335
  };
351
336
  }
337
+ const EMPTY_ACTUAL_MATCHING_ROWS = [];
338
+ const matchViewSelectorById = new Map();
339
+ function getExpenseAutomationActualMatchingMatchView(state, matchId) {
340
+ let selector = matchViewSelectorById.get(matchId);
341
+ if (selector == null) {
342
+ selector = (0, toolkit_1.createSelector)([
343
+ (root) => root.expenseAutomationActualMatchingViewState.detailFetchStateByMatchId[matchId] ?? NOT_STARTED,
344
+ (root) => root.expenseAutomationActualMatchingViewState.ignoreStatusByMatchId[matchId] ?? NOT_STARTED,
345
+ (root) => root.expenseAutomationActualMatchingViewState.lastMatchResultsByMatchId?.[matchId],
346
+ (root) => root.expenseAutomationActualMatchingViewState.lastUndoResultsByMatchId?.[matchId],
347
+ (root) => root.expenseAutomationActualMatchingViewState.detailRefreshStatusByMatchId[matchId] ?? NOT_STARTED,
348
+ (root) => root.expenseAutomationActualMatchingViewState.undoReversalStatusByMatchId[matchId] ?? NOT_STARTED,
349
+ (root) => (0, actualMatchingSelector_1.getActualMatchingMatchById)(root.actualMatchingState, matchId),
350
+ ], (detailFetchState, ignoreStatus, lastMatchResults, lastUndoResults, refreshStatus, undoReversalStatus, match) => ({
351
+ detailFetchState,
352
+ ignoreStatus,
353
+ lastMatchResults,
354
+ lastUndoResults,
355
+ match: match == null ? undefined : toActualMatchingMatchView(match),
356
+ refreshStatus,
357
+ undoReversalStatus,
358
+ }));
359
+ matchViewSelectorById.set(matchId, selector);
360
+ }
361
+ return selector(state);
362
+ }
352
363
  function getCloseMatchAfterUndo(state) {
353
- return state.expenseAutomationActualMatchingViewState.closeMatchAfterUndo;
364
+ return state.expenseAutomationActualMatchingViewState
365
+ .closeMatchAfterUndoMatchIds[0];
366
+ }
367
+ function getCloseMatchAfterUndoMatchId(state) {
368
+ return getCloseMatchAfterUndo(state);
369
+ }
370
+ function getCloseMatchAfterIgnoreMatchId(state) {
371
+ return state.expenseAutomationActualMatchingViewState
372
+ .closeMatchAfterIgnoreMatchIds[0];
373
+ }
374
+ function getActualMatchingMatchModalConfirmStatus(state, matchId) {
375
+ if (matchId != null && matchId !== '') {
376
+ return (state.expenseAutomationActualMatchingViewState.confirmStatusByMatchId[matchId] ?? NOT_STARTED);
377
+ }
378
+ return state.expenseAutomationActualMatchingViewState.matchModal.confirmStatus;
354
379
  }
355
380
  function getExpenseAutomationActualMatchingView(state) {
356
381
  const { expenseAutomationActualMatchingViewState } = state;
357
- const { matchIdsByPeriod, fetchState, error, refreshStatus, uiState, matchModal, } = expenseAutomationActualMatchingViewState;
382
+ const { matchIdsByPeriod, fetchState, error, refreshStatus, uiState, matchModal, ignoreStatusByMatchId, undoReversalStatusByMatchId, } = expenseAutomationActualMatchingViewState;
358
383
  const selectedPeriod = getSelectedMonthYearForCurrentTenant(state);
359
384
  const monthYearPeriodId = selectedPeriod != null ? (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod) : undefined;
360
385
  const matchIds = monthYearPeriodId != null ? matchIdsByPeriod[monthYearPeriodId] : undefined;
@@ -364,38 +389,18 @@ function getExpenseAutomationActualMatchingView(state) {
364
389
  .filter((match) => match.members.length > 0)
365
390
  .map(toActualMatchingRow);
366
391
  const rows = allRows.filter((row) => matchesSearch(row, uiState.searchString));
367
- const reversed = sortActualMatchingRows(rows.filter((row) => isReversedMatchKind(row.kind)), uiState);
368
- const pendingReview = sortActualMatchingRows(rows.filter((row) => row.kind === 'pending_review'), uiState);
392
+ const includePendingReview = uiState.statusFilter !== 'reversed';
393
+ const includeReversed = uiState.statusFilter !== 'pending_review';
394
+ const reversed = includeReversed
395
+ ? sortActualMatchingRows(rows.filter((row) => isReversedMatchKind(row.kind)), uiState)
396
+ : EMPTY_ACTUAL_MATCHING_ROWS;
397
+ const pendingReview = includePendingReview
398
+ ? sortActualMatchingRows(rows.filter((row) => row.kind === 'pending_review'), uiState)
399
+ : EMPTY_ACTUAL_MATCHING_ROWS;
369
400
  const kpiSummary = buildActualMatchingKpiSummary(allRows, getTenantDisplayCurrency(state)?.currencyCode);
370
401
  const searchedAccruals = matchModal.accrualSearch.results
371
402
  .map((key) => (0, jeSchedulesSelector_1.getJEOneTimeAccrualByKey)(key, state.jeSchedulesState))
372
403
  .filter((accrual) => accrual != null);
373
- const openedMatch = matchModal.openedFromMatchId != null
374
- ? (0, actualMatchingSelector_1.getActualMatchingMatchById)(state.actualMatchingState, matchModal.openedFromMatchId)
375
- : undefined;
376
- const pinnedAccruals = [
377
- ...(openedMatch?.members ?? []),
378
- ...(openedMatch?.leftovers ?? []),
379
- ].map(toMatchModalAccrual);
380
- const firstMember = openedMatch?.members[0];
381
- const cleared = firstMember?.cleared;
382
- const suggestion = firstMember?.matchSuggestion;
383
- const stamp = cleared ?? suggestion;
384
- const consumedLineIds = cleared?.consumedLineIds;
385
- const prefill = openedMatch == null
386
- ? undefined
387
- : {
388
- selectedAccrualIds: [
389
- ...openedMatch.members.map((member) => member.accrualId),
390
- ...(openedMatch.leftovers ?? []).map((leftover) => leftover.accrualId),
391
- ],
392
- actualAmount: openedMatch.actualAmount.amount,
393
- matchedTransactionId: stamp?.matchedTransactionId,
394
- matchedLineId: cleared == null ? suggestion?.matchedLineId : undefined,
395
- ...(consumedLineIds != null && consumedLineIds.length > 0
396
- ? { consumedLineIds }
397
- : {}),
398
- };
399
404
  // `fetchState` is a flat slice field that survives a period switch. Until this
400
405
  // month's ids land, leftover Completed/Error is the previous month. Report
401
406
  // Not-Started so chrome matches Review's "cache slot missing" skeleton, not
@@ -413,16 +418,16 @@ function getExpenseAutomationActualMatchingView(state) {
413
418
  kpiSummary,
414
419
  uiState,
415
420
  refreshStatus,
421
+ ignoreStatusByMatchId,
422
+ undoReversalStatusByMatchId,
416
423
  hasLoadedForSelectedPeriod: matchIds != null,
417
424
  matchModal: {
418
425
  isOpen: matchModal.isOpen,
419
- openedFromMatchId: matchModal.openedFromMatchId,
420
- prefill,
421
426
  confirmStatus: matchModal.confirmStatus,
422
427
  lastBatchResults: matchModal.lastBatchResults,
423
428
  transactionSearch: {
424
429
  query: matchModal.transactionSearch.query,
425
- results: uniqueTransactionSearchResults(matchModal.pinnedTransactionResults, matchModal.transactionSearch.results),
430
+ results: matchModal.transactionSearch.results,
426
431
  fetchState: {
427
432
  fetchState: matchModal.transactionSearch.fetchState,
428
433
  error: matchModal.transactionSearch.error,
@@ -432,7 +437,7 @@ function getExpenseAutomationActualMatchingView(state) {
432
437
  },
433
438
  accrualSearch: {
434
439
  query: matchModal.accrualSearch.query,
435
- results: uniqueMatchModalAccruals(pinnedAccruals, searchedAccruals),
440
+ results: searchedAccruals,
436
441
  fetchState: {
437
442
  fetchState: matchModal.accrualSearch.fetchState,
438
443
  error: matchModal.accrualSearch.error,
@@ -5,6 +5,8 @@ import { ActualMatchingMatchId } from '../../../entity/actualMatching/actualMatc
5
5
  import { JEOneTimeAccrualKey } from '../../../entity/jeSchedules/jeSchedulesTypes';
6
6
  export declare const toActualMatchingSortKey: (v: string) => "type" | "date" | "vendor" | "category" | "class" | "amount" | "variance" | "lifecycle" | "service" | "accrued" | "actual";
7
7
  export type ActualMatchingSortKey = ReturnType<typeof toActualMatchingSortKey>;
8
+ export declare const toActualMatchingStatusFilter: (v: string) => "pending_review" | "reversed" | "all";
9
+ export type ActualMatchingStatusFilter = ReturnType<typeof toActualMatchingStatusFilter>;
8
10
  export declare const MATCH_TRANSACTION_SEARCH_PAGE_SIZE = 50;
9
11
  export declare const MATCH_ACCRUAL_SEARCH_LIMIT = 50;
10
12
  export declare const MATCH_SEARCH_DEBOUNCE_MS = 300;
@@ -18,6 +20,12 @@ export interface ActualMatchingViewUIState {
18
20
  searchString: string;
19
21
  sortKey: ActualMatchingSortKey;
20
22
  sortOrder: SortOrder;
23
+ /**
24
+ * List-only filter. `all` shows both groups; `pending_review` / `reversed`
25
+ * empty the other group (`reversed` includes auto and manual). KPI summary
26
+ * stays on the unfiltered period.
27
+ */
28
+ statusFilter: ActualMatchingStatusFilter;
21
29
  }
22
30
  /**
23
31
  * Sibling of Missing Receipts `MatchCandidate`. Confirm needs `lineId` and
@@ -69,6 +77,14 @@ export interface UndoReversalAccrualsParams {
69
77
  accrualIds: ID[];
70
78
  matchId: ActualMatchingMatchId;
71
79
  }
80
+ export declare const toActualMatchingIgnoreReasonType: (v: string) => "other_ignore" | "already_handled" | "amount_off" | "wrong_period" | "wrong_bill";
81
+ export type ActualMatchingIgnoreReasonType = ReturnType<typeof toActualMatchingIgnoreReasonType>;
82
+ export declare const ALL_ACTUAL_MATCHING_IGNORE_REASONS: readonly ActualMatchingIgnoreReasonType[];
83
+ export interface IgnoreActualMatchingSuggestionParams {
84
+ matchId: ActualMatchingMatchId;
85
+ reason: ActualMatchingIgnoreReasonType;
86
+ note?: string;
87
+ }
72
88
  export interface ActualMatchingTransactionSearchState extends FetchStateAndError {
73
89
  isLoadingMore: boolean;
74
90
  nextPageToken: string | null;
@@ -84,18 +100,18 @@ export interface ActualMatchingAccrualSearchState extends FetchStateAndError {
84
100
  export interface ActualMatchingMatchModalState {
85
101
  accrualSearch: ActualMatchingAccrualSearchState;
86
102
  confirmStatus: FetchStateAndError;
87
- didPinPrefillTransactions: boolean;
88
103
  isOpen: boolean;
89
- pinnedTransactionResults: ActualMatchingTransactionSearchResult[];
90
104
  transactionSearch: ActualMatchingTransactionSearchState;
91
105
  lastBatchResults?: MatchAndReverseResult[];
92
- openedFromMatchId?: ActualMatchingMatchId;
93
106
  }
94
107
  export declare function actualMatchingTransactionLineKey(transactionType: string, transactionIntegrationId: string, lineId: string): string;
95
108
  export interface ActualMatchingViewState extends FetchedState {
96
- closeMatchAfterUndo: boolean;
109
+ closeMatchAfterIgnoreMatchIds: ActualMatchingMatchId[];
110
+ closeMatchAfterUndoMatchIds: ActualMatchingMatchId[];
111
+ confirmStatusByMatchId: Record<ActualMatchingMatchId, FetchStateAndError>;
97
112
  detailFetchStateByMatchId: Record<ActualMatchingMatchId, FetchStateAndError>;
98
113
  detailRefreshStatusByMatchId: Record<ActualMatchingMatchId, FetchStateAndError>;
114
+ ignoreStatusByMatchId: Record<ActualMatchingMatchId, FetchStateAndError>;
99
115
  lastMatchResultsByMatchId: Record<ActualMatchingMatchId, MatchAndReverseResult[]>;
100
116
  lastUndoResultsByMatchId: Record<ActualMatchingMatchId, UndoReversalResult[]>;
101
117
  matchIdsByPeriod: Record<MonthYearPeriodId, ActualMatchingMatchId[]>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toUndoReversalResultStatus = exports.toMatchAndReverseResultStatus = exports.MATCH_SEARCH_DEBOUNCE_MS = exports.MATCH_ACCRUAL_SEARCH_LIMIT = exports.MATCH_TRANSACTION_SEARCH_PAGE_SIZE = exports.toActualMatchingSortKey = void 0;
3
+ exports.ALL_ACTUAL_MATCHING_IGNORE_REASONS = exports.toActualMatchingIgnoreReasonType = exports.toUndoReversalResultStatus = exports.toMatchAndReverseResultStatus = exports.MATCH_SEARCH_DEBOUNCE_MS = exports.MATCH_ACCRUAL_SEARCH_LIMIT = exports.MATCH_TRANSACTION_SEARCH_PAGE_SIZE = exports.toActualMatchingStatusFilter = exports.toActualMatchingSortKey = void 0;
4
4
  exports.isMatchAndReverseCompleteStatus = isMatchAndReverseCompleteStatus;
5
5
  exports.actualMatchingTransactionLineKey = actualMatchingTransactionLineKey;
6
6
  const stringToUnion_1 = require("../../../commonStateTypes/stringToUnion");
@@ -19,6 +19,13 @@ const ACTUAL_MATCHING_SORT_KEYS = [
19
19
  ];
20
20
  const toActualMatchingSortKey = (v) => (0, stringToUnion_1.stringToUnion)(v, ACTUAL_MATCHING_SORT_KEYS);
21
21
  exports.toActualMatchingSortKey = toActualMatchingSortKey;
22
+ const ACTUAL_MATCHING_STATUS_FILTERS = [
23
+ 'all',
24
+ 'pending_review',
25
+ 'reversed',
26
+ ];
27
+ const toActualMatchingStatusFilter = (v) => (0, stringToUnion_1.stringToUnion)(v, ACTUAL_MATCHING_STATUS_FILTERS);
28
+ exports.toActualMatchingStatusFilter = toActualMatchingStatusFilter;
22
29
  exports.MATCH_TRANSACTION_SEARCH_PAGE_SIZE = 50;
23
30
  exports.MATCH_ACCRUAL_SEARCH_LIMIT = 50;
24
31
  exports.MATCH_SEARCH_DEBOUNCE_MS = 300;
@@ -41,6 +48,16 @@ const UNDO_REVERSAL_RESULT_STATUSES = [
41
48
  ];
42
49
  const toUndoReversalResultStatus = (v) => (0, stringToUnion_1.stringToUnion)(v, UNDO_REVERSAL_RESULT_STATUSES);
43
50
  exports.toUndoReversalResultStatus = toUndoReversalResultStatus;
51
+ const ACTUAL_MATCHING_IGNORE_REASONS = [
52
+ 'wrong_bill',
53
+ 'wrong_period',
54
+ 'amount_off',
55
+ 'already_handled',
56
+ 'other_ignore',
57
+ ];
58
+ const toActualMatchingIgnoreReasonType = (v) => (0, stringToUnion_1.stringToUnion)(v, ACTUAL_MATCHING_IGNORE_REASONS);
59
+ exports.toActualMatchingIgnoreReasonType = toActualMatchingIgnoreReasonType;
60
+ exports.ALL_ACTUAL_MATCHING_IGNORE_REASONS = ACTUAL_MATCHING_IGNORE_REASONS;
44
61
  function actualMatchingTransactionLineKey(transactionType, transactionIntegrationId, lineId) {
45
62
  return `${transactionType}:${transactionIntegrationId}:${lineId}`;
46
63
  }
@@ -141,7 +141,7 @@ export declare const getWithdrawFrom: (state: RootState, fromAccountId?: ID, fro
141
141
  accountId: ID;
142
142
  accountType: AccountTypeSubConfigCodeKeyType;
143
143
  }) => FundingAccount | undefined;
144
- export declare const getDefaultWithdrawFromAccount: (state: RootState, depositAccounts: ID[], companyId: ID, lastSelectedFromAccount?: {
144
+ export declare const getDefaultWithdrawFromAccount: (state: RootState, companyId: ID, lastSelectedFromAccount?: {
145
145
  accountId: ID;
146
146
  accountType: AccountTypeSubConfigCodeKeyType;
147
147
  }) => FundingAccount | undefined;
@@ -640,7 +640,7 @@ const getDueDate = (billStageCode, dueDate, invoiceDate, bookCloseDate) => {
640
640
  };
641
641
  exports.getDueDate = getDueDate;
642
642
  const getWithdrawFrom = (state, fromAccountId, fromAccountType, companyId, lastSelectedFromAccount) => {
643
- const { paymentAccountState, depositAccountState, depositAccountListState, paymentAccountListState, } = state;
643
+ const { paymentAccountState, depositAccountState, paymentAccountListState } = state;
644
644
  if (fromAccountId != null) {
645
645
  const withdrawFromAsDepositAcc = (0, depositAccountSelector_1.getDepositAccountByDepositAccountId)(depositAccountState, fromAccountId);
646
646
  const withdrawFromAsPaymentAcc = (0, paymentAccountSelector_1.getPaymentAccountByPaymentAccountId)(paymentAccountState, fromAccountId);
@@ -654,42 +654,16 @@ const getWithdrawFrom = (state, fromAccountId, fromAccountType, companyId, lastS
654
654
  }
655
655
  }
656
656
  else {
657
- return (0, exports.getDefaultWithdrawFromAccount)(state, depositAccountListState.accountIds, companyId ?? '', lastSelectedFromAccount);
657
+ return (0, exports.getDefaultWithdrawFromAccount)(state, companyId ?? '', lastSelectedFromAccount);
658
658
  }
659
659
  return undefined;
660
660
  };
661
661
  exports.getWithdrawFrom = getWithdrawFrom;
662
- const getDefaultWithdrawFromAccount = (state, depositAccounts, companyId, lastSelectedFromAccount) => {
662
+ const getDefaultWithdrawFromAccount = (state, companyId, lastSelectedFromAccount) => {
663
663
  const { depositAccountState, paymentAccountState, paymentAccountListState } = state;
664
664
  const companyView = (0, getCompanyView_1.getCompanyView)(state, companyId, []);
665
665
  const primaryAccount = companyView?.company.company.companyBillPayInfo.primaryFundingAccount;
666
- let defaultAccount = undefined;
667
- // User paying bill for first time or previously paid with external account
668
- if (lastSelectedFromAccount == null ||
669
- lastSelectedFromAccount?.accountType === 'paymentAccount') {
670
- if (depositAccounts.length === 0) {
671
- defaultAccount = primaryAccount;
672
- }
673
- else {
674
- if (primaryAccount?.accountType === 'depositAccount') {
675
- defaultAccount = primaryAccount;
676
- }
677
- }
678
- }
679
- else {
680
- // User paid with Zeni account previously
681
- if (depositAccounts.length === 1) {
682
- defaultAccount = lastSelectedFromAccount;
683
- }
684
- else {
685
- if (primaryAccount?.accountType === 'depositAccount') {
686
- defaultAccount = primaryAccount;
687
- }
688
- else {
689
- defaultAccount = lastSelectedFromAccount;
690
- }
691
- }
692
- }
666
+ const defaultAccount = primaryAccount ?? lastSelectedFromAccount;
693
667
  if (defaultAccount != null) {
694
668
  const defaultAccAsDepositAcc = (0, depositAccountSelector_1.getDepositAccountByDepositAccountId)(depositAccountState, defaultAccount?.accountId);
695
669
  const defaultAccAsPaymentAcc = (0, paymentAccountSelector_1.getPaymentAccountByPaymentAccountId)(paymentAccountState, defaultAccount?.accountId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.2.62",
3
+ "version": "5.2.63",
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",