@zeniai/client-epic-state 5.2.62-beta1MM → 5.2.62-beta1ND

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 (39) hide show
  1. package/lib/entity/actualMatching/actualMatchingReducer.d.ts +1 -3
  2. package/lib/entity/actualMatching/actualMatchingReducer.js +2 -11
  3. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +0 -1
  4. package/lib/entity/jeSchedules/jeSchedulesPayload.js +0 -1
  5. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +0 -1
  6. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  7. package/lib/entity/snackbar/snackbarTypes.js +0 -1
  8. package/lib/epic.d.ts +1 -2
  9. package/lib/epic.js +0 -2
  10. package/lib/esm/entity/actualMatching/actualMatchingReducer.js +1 -9
  11. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +0 -1
  12. package/lib/esm/entity/snackbar/snackbarTypes.js +0 -1
  13. package/lib/esm/epic.js +0 -2
  14. package/lib/esm/index.js +5 -5
  15. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/actualMatching/fetchActualMatchingMatchEpic.js +2 -4
  16. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/actualMatching/matchAndReverseAccrualsEpic.js +13 -26
  17. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/actualMatching/searchMatchTransactionsEpic.js +23 -2
  18. package/lib/esm/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +38 -89
  19. package/lib/esm/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +64 -61
  20. package/lib/esm/view/expenseAutomationView/types/actualMatchingViewState.js +0 -15
  21. package/lib/index.d.ts +6 -6
  22. package/lib/index.js +49 -57
  23. package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/fetchActualMatchingMatchEpic.d.ts +2 -2
  24. package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/fetchActualMatchingMatchEpic.js +1 -3
  25. package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/matchAndReverseAccrualsEpic.js +11 -24
  26. package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/searchMatchTransactionsEpic.js +22 -1
  27. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  28. package/lib/view/expenseAutomationView/payload/actualMatchingPayload.d.ts +1 -12
  29. package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.d.ts +8 -19
  30. package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +39 -90
  31. package/lib/view/expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.d.ts +8 -20
  32. package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.d.ts +4 -7
  33. package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +64 -64
  34. package/lib/view/expenseAutomationView/types/actualMatchingViewState.d.ts +4 -20
  35. package/lib/view/expenseAutomationView/types/actualMatchingViewState.js +1 -18
  36. package/package.json +1 -26
  37. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/actualMatching/ignoreActualMatchingSuggestionEpic.js +0 -50
  38. package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/ignoreActualMatchingSuggestionEpic.d.ts +0 -10
  39. package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/ignoreActualMatchingSuggestionEpic.js +0 -54
@@ -16,18 +16,15 @@ 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;
22
19
  exports.getExpenseAutomationActualMatchingView = getExpenseAutomationActualMatchingView;
23
20
  const orderBy_1 = __importDefault(require("lodash/orderBy"));
24
- const toolkit_1 = require("@reduxjs/toolkit");
25
21
  const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
26
22
  const actualMatchingSelector_1 = require("../../../entity/actualMatching/actualMatchingSelector");
27
23
  const jeScheduleHelper_1 = require("../../../entity/jeSchedules/jeScheduleHelper");
28
24
  const jeSchedulesSelector_1 = require("../../../entity/jeSchedules/jeSchedulesSelector");
29
25
  const tenantSelector_1 = require("../../../entity/tenant/tenantSelector");
30
26
  const zeniDayJS_1 = require("../../../zeniDayJS");
27
+ const actualMatchingViewState_1 = require("../types/actualMatchingViewState");
31
28
  function getSelectedMonthYearForCurrentTenant(state) {
32
29
  const tenantId = (0, tenantSelector_1.getCurrentTenant)(state)?.tenantId;
33
30
  if (tenantId == null) {
@@ -56,6 +53,27 @@ function toMatchModalAccrual(member) {
56
53
  jeOneTimeAccrualKey: (0, jeScheduleHelper_1.generateJEOneTimeAccrualKey)(member.accrualId),
57
54
  };
58
55
  }
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
+ }
59
77
  function parseActualMatchingMatchId(matchId) {
60
78
  const separator = matchId.indexOf(':');
61
79
  if (separator <= 0 || separator === matchId.length - 1) {
@@ -228,7 +246,6 @@ function emptyKpiSummary() {
228
246
  actualsReceived: { count: 0, expectedCount: 0, vendorsPending: 0 },
229
247
  autoReversed: { count: 0, percent: 0, clearedAmount: 0 },
230
248
  pendingReview: { count: 0, amount: 0, estimatedMinutesToClear: 0 },
231
- reversed: { count: 0 },
232
249
  variance: { percent: 0, averagePercentPerMatch: 0, netAmount: 0 },
233
250
  };
234
251
  }
@@ -284,7 +301,6 @@ function buildActualMatchingKpiSummary(rows, displayCurrencyCode) {
284
301
  }
285
302
  const autoReversed = kpiRows.filter((row) => row.kind === 'auto_reversed');
286
303
  const pendingReview = kpiRows.filter((row) => row.kind === 'pending_review');
287
- const reversed = kpiRows.filter((row) => isReversedMatchKind(row.kind));
288
304
  const receivedCount = kpiRows.length;
289
305
  const rowsWithActual = kpiRows.filter((row) => row.actualAmount?.amount != null);
290
306
  const accruedTotal = rowsWithActual.reduce((sum, row) => sum + (row.accruedAmount?.amount ?? row.estimatedAmount.amount), 0);
@@ -310,9 +326,6 @@ function buildActualMatchingKpiSummary(rows, displayCurrencyCode) {
310
326
  amount: sumRowAmounts(pendingReview, displayCurrencyCode),
311
327
  estimatedMinutesToClear: pendingReview.length * ESTIMATED_MINUTES_PER_PENDING_MATCH,
312
328
  },
313
- reversed: {
314
- count: reversed.length,
315
- },
316
329
  variance: {
317
330
  percent: accruedTotal === 0
318
331
  ? 0
@@ -325,56 +338,23 @@ function buildActualMatchingKpiSummary(rows, displayCurrencyCode) {
325
338
  },
326
339
  };
327
340
  }
328
- function toActualMatchingMatchView(match) {
341
+ function getExpenseAutomationActualMatchingMatchView(state, matchId) {
342
+ const view = state.expenseAutomationActualMatchingViewState;
329
343
  return {
330
- ...match,
331
- members: match.members.map(toMatchModalAccrual),
332
- leftovers: match.leftovers == null
333
- ? undefined
334
- : match.leftovers.map(toMatchModalAccrual),
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],
335
350
  };
336
351
  }
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,
344
- (root) => (0, actualMatchingSelector_1.getActualMatchingMatchById)(root.actualMatchingState, matchId),
345
- ], (view, match) => ({
346
- detailFetchState: view.detailFetchStateByMatchId[matchId] ?? NOT_STARTED,
347
- ignoreStatus: view.ignoreStatusByMatchId[matchId] ?? NOT_STARTED,
348
- lastMatchResults: view.lastMatchResultsByMatchId?.[matchId],
349
- lastUndoResults: view.lastUndoResultsByMatchId?.[matchId],
350
- match: match == null ? undefined : toActualMatchingMatchView(match),
351
- refreshStatus: view.detailRefreshStatusByMatchId[matchId] ?? NOT_STARTED,
352
- undoReversalStatus: view.undoReversalStatusByMatchId[matchId] ?? NOT_STARTED,
353
- }));
354
- matchViewSelectorById.set(matchId, selector);
355
- }
356
- return selector(state);
357
- }
358
352
  function getCloseMatchAfterUndo(state) {
359
- return state.expenseAutomationActualMatchingViewState
360
- .closeMatchAfterUndoMatchIds[0];
361
- }
362
- function getCloseMatchAfterUndoMatchId(state) {
363
- return getCloseMatchAfterUndo(state);
364
- }
365
- function getCloseMatchAfterIgnoreMatchId(state) {
366
- return state.expenseAutomationActualMatchingViewState
367
- .closeMatchAfterIgnoreMatchIds[0];
368
- }
369
- function getActualMatchingMatchModalConfirmStatus(state, matchId) {
370
- if (matchId != null && matchId !== '') {
371
- return (state.expenseAutomationActualMatchingViewState.confirmStatusByMatchId[matchId] ?? NOT_STARTED);
372
- }
373
- return state.expenseAutomationActualMatchingViewState.matchModal.confirmStatus;
353
+ return state.expenseAutomationActualMatchingViewState.closeMatchAfterUndo;
374
354
  }
375
355
  function getExpenseAutomationActualMatchingView(state) {
376
356
  const { expenseAutomationActualMatchingViewState } = state;
377
- const { matchIdsByPeriod, fetchState, error, refreshStatus, uiState, matchModal, ignoreStatusByMatchId, undoReversalStatusByMatchId, } = expenseAutomationActualMatchingViewState;
357
+ const { matchIdsByPeriod, fetchState, error, refreshStatus, uiState, matchModal, } = expenseAutomationActualMatchingViewState;
378
358
  const selectedPeriod = getSelectedMonthYearForCurrentTenant(state);
379
359
  const monthYearPeriodId = selectedPeriod != null ? (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod) : undefined;
380
360
  const matchIds = monthYearPeriodId != null ? matchIdsByPeriod[monthYearPeriodId] : undefined;
@@ -384,18 +364,38 @@ function getExpenseAutomationActualMatchingView(state) {
384
364
  .filter((match) => match.members.length > 0)
385
365
  .map(toActualMatchingRow);
386
366
  const rows = allRows.filter((row) => matchesSearch(row, uiState.searchString));
387
- const includePendingReview = uiState.statusFilter !== 'reversed';
388
- const includeReversed = uiState.statusFilter !== 'pending_review';
389
- const reversed = includeReversed
390
- ? sortActualMatchingRows(rows.filter((row) => isReversedMatchKind(row.kind)), uiState)
391
- : EMPTY_ACTUAL_MATCHING_ROWS;
392
- const pendingReview = includePendingReview
393
- ? sortActualMatchingRows(rows.filter((row) => row.kind === 'pending_review'), uiState)
394
- : EMPTY_ACTUAL_MATCHING_ROWS;
367
+ const reversed = sortActualMatchingRows(rows.filter((row) => isReversedMatchKind(row.kind)), uiState);
368
+ const pendingReview = sortActualMatchingRows(rows.filter((row) => row.kind === 'pending_review'), uiState);
395
369
  const kpiSummary = buildActualMatchingKpiSummary(allRows, getTenantDisplayCurrency(state)?.currencyCode);
396
370
  const searchedAccruals = matchModal.accrualSearch.results
397
371
  .map((key) => (0, jeSchedulesSelector_1.getJEOneTimeAccrualByKey)(key, state.jeSchedulesState))
398
372
  .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
399
  // `fetchState` is a flat slice field that survives a period switch. Until this
400
400
  // month's ids land, leftover Completed/Error is the previous month. Report
401
401
  // Not-Started so chrome matches Review's "cache slot missing" skeleton, not
@@ -413,16 +413,16 @@ function getExpenseAutomationActualMatchingView(state) {
413
413
  kpiSummary,
414
414
  uiState,
415
415
  refreshStatus,
416
- ignoreStatusByMatchId,
417
- undoReversalStatusByMatchId,
418
416
  hasLoadedForSelectedPeriod: matchIds != null,
419
417
  matchModal: {
420
418
  isOpen: matchModal.isOpen,
419
+ openedFromMatchId: matchModal.openedFromMatchId,
420
+ prefill,
421
421
  confirmStatus: matchModal.confirmStatus,
422
422
  lastBatchResults: matchModal.lastBatchResults,
423
423
  transactionSearch: {
424
424
  query: matchModal.transactionSearch.query,
425
- results: matchModal.transactionSearch.results,
425
+ results: uniqueTransactionSearchResults(matchModal.pinnedTransactionResults, matchModal.transactionSearch.results),
426
426
  fetchState: {
427
427
  fetchState: matchModal.transactionSearch.fetchState,
428
428
  error: matchModal.transactionSearch.error,
@@ -432,7 +432,7 @@ function getExpenseAutomationActualMatchingView(state) {
432
432
  },
433
433
  accrualSearch: {
434
434
  query: matchModal.accrualSearch.query,
435
- results: searchedAccruals,
435
+ results: uniqueMatchModalAccruals(pinnedAccruals, searchedAccruals),
436
436
  fetchState: {
437
437
  fetchState: matchModal.accrualSearch.fetchState,
438
438
  error: matchModal.accrualSearch.error,
@@ -5,8 +5,6 @@ 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>;
10
8
  export declare const MATCH_TRANSACTION_SEARCH_PAGE_SIZE = 50;
11
9
  export declare const MATCH_ACCRUAL_SEARCH_LIMIT = 50;
12
10
  export declare const MATCH_SEARCH_DEBOUNCE_MS = 300;
@@ -20,12 +18,6 @@ export interface ActualMatchingViewUIState {
20
18
  searchString: string;
21
19
  sortKey: ActualMatchingSortKey;
22
20
  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;
29
21
  }
30
22
  /**
31
23
  * Sibling of Missing Receipts `MatchCandidate`. Confirm needs `lineId` and
@@ -77,14 +69,6 @@ export interface UndoReversalAccrualsParams {
77
69
  accrualIds: ID[];
78
70
  matchId: ActualMatchingMatchId;
79
71
  }
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
- }
88
72
  export interface ActualMatchingTransactionSearchState extends FetchStateAndError {
89
73
  isLoadingMore: boolean;
90
74
  nextPageToken: string | null;
@@ -100,18 +84,18 @@ export interface ActualMatchingAccrualSearchState extends FetchStateAndError {
100
84
  export interface ActualMatchingMatchModalState {
101
85
  accrualSearch: ActualMatchingAccrualSearchState;
102
86
  confirmStatus: FetchStateAndError;
87
+ didPinPrefillTransactions: boolean;
103
88
  isOpen: boolean;
89
+ pinnedTransactionResults: ActualMatchingTransactionSearchResult[];
104
90
  transactionSearch: ActualMatchingTransactionSearchState;
105
91
  lastBatchResults?: MatchAndReverseResult[];
92
+ openedFromMatchId?: ActualMatchingMatchId;
106
93
  }
107
94
  export declare function actualMatchingTransactionLineKey(transactionType: string, transactionIntegrationId: string, lineId: string): string;
108
95
  export interface ActualMatchingViewState extends FetchedState {
109
- closeMatchAfterIgnoreMatchIds: ActualMatchingMatchId[];
110
- closeMatchAfterUndoMatchIds: ActualMatchingMatchId[];
111
- confirmStatusByMatchId: Record<ActualMatchingMatchId, FetchStateAndError>;
96
+ closeMatchAfterUndo: boolean;
112
97
  detailFetchStateByMatchId: Record<ActualMatchingMatchId, FetchStateAndError>;
113
98
  detailRefreshStatusByMatchId: Record<ActualMatchingMatchId, FetchStateAndError>;
114
- ignoreStatusByMatchId: Record<ActualMatchingMatchId, FetchStateAndError>;
115
99
  lastMatchResultsByMatchId: Record<ActualMatchingMatchId, MatchAndReverseResult[]>;
116
100
  lastUndoResultsByMatchId: Record<ActualMatchingMatchId, UndoReversalResult[]>;
117
101
  matchIdsByPeriod: Record<MonthYearPeriodId, ActualMatchingMatchId[]>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
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;
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;
4
4
  exports.isMatchAndReverseCompleteStatus = isMatchAndReverseCompleteStatus;
5
5
  exports.actualMatchingTransactionLineKey = actualMatchingTransactionLineKey;
6
6
  const stringToUnion_1 = require("../../../commonStateTypes/stringToUnion");
@@ -19,13 +19,6 @@ 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;
29
22
  exports.MATCH_TRANSACTION_SEARCH_PAGE_SIZE = 50;
30
23
  exports.MATCH_ACCRUAL_SEARCH_LIMIT = 50;
31
24
  exports.MATCH_SEARCH_DEBOUNCE_MS = 300;
@@ -48,16 +41,6 @@ const UNDO_REVERSAL_RESULT_STATUSES = [
48
41
  ];
49
42
  const toUndoReversalResultStatus = (v) => (0, stringToUnion_1.stringToUnion)(v, UNDO_REVERSAL_RESULT_STATUSES);
50
43
  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;
61
44
  function actualMatchingTransactionLineKey(transactionType, transactionIntegrationId, lineId) {
62
45
  return `${transactionType}:${transactionIntegrationId}:${lineId}`;
63
46
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.2.62-beta1MM",
3
+ "version": "5.2.62-beta1ND",
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",
@@ -53,31 +53,6 @@
53
53
  "url": "https://github.com/zeni-ai/client-epic-state/issues"
54
54
  },
55
55
  "homepage": "https://github.com/zeni-ai/client-epic-state#readme",
56
- "devDependencies": {
57
- "@eslint/js": "^9.24.0",
58
- "@liveblocks/client": "^2.23.0",
59
- "@trivago/prettier-plugin-sort-imports": "^5.2.2",
60
- "@types/big.js": "^6.2.2",
61
- "@types/lodash": "^4.17.23",
62
- "@types/node": "^20.19.0",
63
- "@types/url-parse": "^1.4.11",
64
- "@typescript-eslint/eslint-plugin": "^8.56.0",
65
- "@typescript-eslint/parser": "^8.56.0",
66
- "concurrently": "^9.1.2",
67
- "eslint": "^9.24.0",
68
- "eslint-config-prettier": "^10.0.2",
69
- "eslint-plugin-perfectionist": "^4.15.0",
70
- "eslint-plugin-unused-imports": "^4.1.4",
71
- "globals": "^16.0.0",
72
- "knip": "^6.21.0",
73
- "madge": "^8.0.0",
74
- "prettier": "^3.5.3",
75
- "rimraf": "^6.0.1",
76
- "semver": "^7.7.1",
77
- "typescript": "^5.7.3",
78
- "vite": "^7.3.5",
79
- "vitest": "^4.1.11"
80
- },
81
56
  "dependencies": {
82
57
  "@redux-devtools/extension": "^3.3.0",
83
58
  "@reduxjs/toolkit": "^1.6.2",
@@ -1,50 +0,0 @@
1
- import { from, of } from 'rxjs';
2
- import { catchError, exhaustMap, filter, groupBy, mergeMap, takeUntil, } from 'rxjs/operators';
3
- import { removeActualMatchingMatch } from '../../../../../entity/actualMatching/actualMatchingReducer';
4
- import { getActualMatchingMatchById } from '../../../../../entity/actualMatching/actualMatchingSelector';
5
- import { openSnackbar } from '../../../../../entity/snackbar/snackbarReducer';
6
- import { createZeniAPIStatus, isSuccessResponse } from '../../../../../responsePayload';
7
- import { clearAll } from '../../../../../rootActions';
8
- import { ignoreActualMatchingSuggestion, ignoreActualMatchingSuggestionFailure, ignoreActualMatchingSuggestionSuccess, } from '../../../reducers/actualMatchingViewReducer';
9
- import { refreshActualMatchingList } from './refreshActualMatchingList';
10
- function matchVendorName(state, matchId) {
11
- return (getActualMatchingMatchById(state.actualMatchingState, matchId)?.vendorName ??
12
- '');
13
- }
14
- function ignoreSuggestionSnackbar(vendorName, succeeded) {
15
- return openSnackbar({
16
- messageSection: 'actual_matching_ignore_suggestion',
17
- messageText: succeeded ? 'success' : 'failed',
18
- type: succeeded ? 'success' : 'error',
19
- variables: [{ variableName: '_vendor_name_', variableValue: vendorName }],
20
- });
21
- }
22
- export const ignoreActualMatchingSuggestionEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(ignoreActualMatchingSuggestion.match), groupBy((action) => action.payload.matchId), mergeMap((perMatch$) => perMatch$.pipe(exhaustMap((action) => {
23
- const { matchId, reason, note } = action.payload;
24
- const body = {
25
- reason,
26
- ...(note != null && note !== '' ? { note } : {}),
27
- };
28
- const vendorName = matchVendorName(state$.value, matchId);
29
- return zeniAPI
30
- .putAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals/actual-matching/${encodeURIComponent(matchId)}/ignore`, body)
31
- .pipe(mergeMap((response) => {
32
- if (isSuccessResponse(response) && response.data != null) {
33
- const successActions = [
34
- removeActualMatchingMatch(matchId),
35
- ignoreActualMatchingSuggestionSuccess({ matchId }),
36
- ...refreshActualMatchingList(state$.value),
37
- ignoreSuggestionSnackbar(vendorName, true),
38
- ];
39
- return from(successActions);
40
- }
41
- return of(ignoreActualMatchingSuggestionFailure({
42
- matchId,
43
- status: response.status,
44
- }), ignoreSuggestionSnackbar(vendorName, false));
45
- }), catchError((error) => of(ignoreActualMatchingSuggestionFailure({
46
- matchId,
47
- status: createZeniAPIStatus('Unexpected Error', 'Ignore actual matching suggestion REST API call errored out' +
48
- JSON.stringify(error)),
49
- }), ignoreSuggestionSnackbar(vendorName, false))), takeUntil(actions$.pipe(filter(clearAll.match))));
50
- }))));
@@ -1,10 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { Observable } from 'rxjs';
3
- import { removeActualMatchingMatch } from '../../../../../entity/actualMatching/actualMatchingReducer';
4
- import { openSnackbar } from '../../../../../entity/snackbar/snackbarReducer';
5
- import { clearAll } from '../../../../../rootActions';
6
- import { RootState } from '../../../../../rootStateTypes';
7
- import { ZeniAPI } from '../../../../../zeniAPI';
8
- import { fetchActualMatching, ignoreActualMatchingSuggestion, ignoreActualMatchingSuggestionFailure, ignoreActualMatchingSuggestionSuccess } from '../../../reducers/actualMatchingViewReducer';
9
- export type ActionType = ReturnType<typeof clearAll> | ReturnType<typeof fetchActualMatching> | ReturnType<typeof ignoreActualMatchingSuggestion> | ReturnType<typeof ignoreActualMatchingSuggestionFailure> | ReturnType<typeof ignoreActualMatchingSuggestionSuccess> | ReturnType<typeof openSnackbar> | ReturnType<typeof removeActualMatchingMatch>;
10
- export declare const ignoreActualMatchingSuggestionEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -1,54 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ignoreActualMatchingSuggestionEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const actualMatchingReducer_1 = require("../../../../../entity/actualMatching/actualMatchingReducer");
7
- const actualMatchingSelector_1 = require("../../../../../entity/actualMatching/actualMatchingSelector");
8
- const snackbarReducer_1 = require("../../../../../entity/snackbar/snackbarReducer");
9
- const responsePayload_1 = require("../../../../../responsePayload");
10
- const rootActions_1 = require("../../../../../rootActions");
11
- const actualMatchingViewReducer_1 = require("../../../reducers/actualMatchingViewReducer");
12
- const refreshActualMatchingList_1 = require("./refreshActualMatchingList");
13
- function matchVendorName(state, matchId) {
14
- return ((0, actualMatchingSelector_1.getActualMatchingMatchById)(state.actualMatchingState, matchId)?.vendorName ??
15
- '');
16
- }
17
- function ignoreSuggestionSnackbar(vendorName, succeeded) {
18
- return (0, snackbarReducer_1.openSnackbar)({
19
- messageSection: 'actual_matching_ignore_suggestion',
20
- messageText: succeeded ? 'success' : 'failed',
21
- type: succeeded ? 'success' : 'error',
22
- variables: [{ variableName: '_vendor_name_', variableValue: vendorName }],
23
- });
24
- }
25
- const ignoreActualMatchingSuggestionEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(actualMatchingViewReducer_1.ignoreActualMatchingSuggestion.match), (0, operators_1.groupBy)((action) => action.payload.matchId), (0, operators_1.mergeMap)((perMatch$) => perMatch$.pipe((0, operators_1.exhaustMap)((action) => {
26
- const { matchId, reason, note } = action.payload;
27
- const body = {
28
- reason,
29
- ...(note != null && note !== '' ? { note } : {}),
30
- };
31
- const vendorName = matchVendorName(state$.value, matchId);
32
- return zeniAPI
33
- .putAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals/actual-matching/${encodeURIComponent(matchId)}/ignore`, body)
34
- .pipe((0, operators_1.mergeMap)((response) => {
35
- if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
36
- const successActions = [
37
- (0, actualMatchingReducer_1.removeActualMatchingMatch)(matchId),
38
- (0, actualMatchingViewReducer_1.ignoreActualMatchingSuggestionSuccess)({ matchId }),
39
- ...(0, refreshActualMatchingList_1.refreshActualMatchingList)(state$.value),
40
- ignoreSuggestionSnackbar(vendorName, true),
41
- ];
42
- return (0, rxjs_1.from)(successActions);
43
- }
44
- return (0, rxjs_1.of)((0, actualMatchingViewReducer_1.ignoreActualMatchingSuggestionFailure)({
45
- matchId,
46
- status: response.status,
47
- }), ignoreSuggestionSnackbar(vendorName, false));
48
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, actualMatchingViewReducer_1.ignoreActualMatchingSuggestionFailure)({
49
- matchId,
50
- status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Ignore actual matching suggestion REST API call errored out' +
51
- JSON.stringify(error)),
52
- }), ignoreSuggestionSnackbar(vendorName, false))), (0, operators_1.takeUntil)(actions$.pipe((0, operators_1.filter)(rootActions_1.clearAll.match))));
53
- }))));
54
- exports.ignoreActualMatchingSuggestionEpic = ignoreActualMatchingSuggestionEpic;