@zeniai/client-epic-state 5.2.62-beta1MM → 5.2.62-beta2ND
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.
- package/lib/entity/actualMatching/actualMatchingReducer.d.ts +1 -3
- package/lib/entity/actualMatching/actualMatchingReducer.js +2 -11
- package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +0 -1
- package/lib/entity/jeSchedules/jeSchedulesPayload.js +0 -1
- package/lib/entity/jeSchedules/jeSchedulesState.d.ts +0 -1
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +1 -1
- package/lib/epic.d.ts +3 -3
- package/lib/epic.js +3 -3
- package/lib/esm/entity/actualMatching/actualMatchingReducer.js +1 -9
- package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +0 -1
- package/lib/esm/entity/snackbar/snackbarTypes.js +1 -1
- package/lib/esm/epic.js +3 -3
- package/lib/esm/index.js +7 -7
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/actualMatching/fetchActualMatchingMatchEpic.js +2 -4
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/actualMatching/matchAndReverseAccrualsEpic.js +13 -26
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/actualMatching/searchMatchTransactionsEpic.js +23 -2
- package/lib/esm/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +38 -89
- package/lib/esm/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +64 -61
- package/lib/esm/view/expenseAutomationView/types/actualMatchingViewState.js +0 -15
- package/lib/esm/view/spendManagement/commonSetup/epic/setup/resetKycKybEpic.js +37 -0
- package/lib/esm/view/spendManagement/commonSetup/setupViewReducer.js +18 -1
- package/lib/esm/view/spendManagement/commonSetup/setupViewSelector.js +2 -1
- package/lib/index.d.ts +8 -8
- package/lib/index.js +50 -57
- package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/fetchActualMatchingMatchEpic.d.ts +2 -2
- package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/fetchActualMatchingMatchEpic.js +1 -3
- package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/matchAndReverseAccrualsEpic.js +11 -24
- package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/searchMatchTransactionsEpic.js +22 -1
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/payload/actualMatchingPayload.d.ts +1 -12
- package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.d.ts +8 -19
- package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +39 -90
- package/lib/view/expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.d.ts +8 -20
- package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.d.ts +4 -7
- package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +64 -64
- package/lib/view/expenseAutomationView/types/actualMatchingViewState.d.ts +4 -20
- package/lib/view/expenseAutomationView/types/actualMatchingViewState.js +1 -18
- package/lib/view/spendManagement/commonSetup/epic/setup/resetKycKybEpic.d.ts +8 -0
- package/lib/view/spendManagement/commonSetup/epic/setup/resetKycKybEpic.js +41 -0
- package/lib/view/spendManagement/commonSetup/setupViewReducer.d.ts +1 -1
- package/lib/view/spendManagement/commonSetup/setupViewReducer.js +19 -2
- package/lib/view/spendManagement/commonSetup/setupViewSelector.d.ts +1 -0
- package/lib/view/spendManagement/commonSetup/setupViewSelector.js +2 -1
- package/lib/view/spendManagement/commonSetup/setupViewState.d.ts +1 -0
- package/package.json +1 -1
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/actualMatching/ignoreActualMatchingSuggestionEpic.js +0 -50
- package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/ignoreActualMatchingSuggestionEpic.d.ts +0 -10
- 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
|
|
341
|
+
function getExpenseAutomationActualMatchingMatchView(state, matchId) {
|
|
342
|
+
const view = state.expenseAutomationActualMatchingViewState;
|
|
329
343
|
return {
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
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,
|
|
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
|
|
388
|
-
const
|
|
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
|
-
|
|
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.
|
|
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
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { openSnackbar } from '../../../../../entity/snackbar/snackbarReducer';
|
|
4
|
+
import { RootState } from '../../../../../rootStateTypes';
|
|
5
|
+
import { ZeniAPI } from '../../../../../zeniAPI';
|
|
6
|
+
import { resetKycKyb, resetKycKybFailure, resetKycKybSuccess } from '../../setupViewReducer';
|
|
7
|
+
export type ActionType = ReturnType<typeof openSnackbar> | ReturnType<typeof resetKycKyb> | ReturnType<typeof resetKycKybSuccess> | ReturnType<typeof resetKycKybFailure>;
|
|
8
|
+
export declare const resetKycKybEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resetKycKybEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const snackbarReducer_1 = require("../../../../../entity/snackbar/snackbarReducer");
|
|
7
|
+
const responsePayload_1 = require("../../../../../responsePayload");
|
|
8
|
+
const setupViewReducer_1 = require("../../setupViewReducer");
|
|
9
|
+
const resetKycKybEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(setupViewReducer_1.resetKycKyb.match), (0, operators_1.mergeMap)(() => zeniAPI
|
|
10
|
+
.putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/kyc-kyb-reset`, { is_reset_company_officers: false })
|
|
11
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
12
|
+
if ((0, responsePayload_1.isSuccessResponse)(response)) {
|
|
13
|
+
return (0, rxjs_1.from)([
|
|
14
|
+
(0, setupViewReducer_1.resetKycKybSuccess)(),
|
|
15
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
16
|
+
messageSection: 'kyc_kyb_reset',
|
|
17
|
+
messageText: 'success',
|
|
18
|
+
type: 'success',
|
|
19
|
+
}),
|
|
20
|
+
]);
|
|
21
|
+
}
|
|
22
|
+
return (0, rxjs_1.from)([
|
|
23
|
+
(0, setupViewReducer_1.resetKycKybFailure)(response.status),
|
|
24
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
25
|
+
messageSection: 'kyc_kyb_reset',
|
|
26
|
+
messageText: 'failed',
|
|
27
|
+
type: 'error',
|
|
28
|
+
}),
|
|
29
|
+
]);
|
|
30
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
|
|
31
|
+
(0, setupViewReducer_1.resetKycKybFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'Reset KYC/KYB errored out: ' +
|
|
32
|
+
(error instanceof Error
|
|
33
|
+
? error.message
|
|
34
|
+
: JSON.stringify(error)))),
|
|
35
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
36
|
+
messageSection: 'kyc_kyb_reset',
|
|
37
|
+
messageText: 'failed',
|
|
38
|
+
type: 'error',
|
|
39
|
+
}),
|
|
40
|
+
])))));
|
|
41
|
+
exports.resetKycKybEpic = resetKycKybEpic;
|
|
@@ -14,7 +14,7 @@ export declare const enableSetup: import("@reduxjs/toolkit").ActionCreatorWithPr
|
|
|
14
14
|
sendForVerification: any;
|
|
15
15
|
fromBillListScreen: any;
|
|
16
16
|
isSubmittingAdditionalDocuments: any;
|
|
17
|
-
}, "setupView/updateBusinessVerificationDetails", never, never>, updateBusinessVerificationDetailsSuccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"setupView/updateBusinessVerificationDetailsSuccess">, updateBusinessVerificationDetailsFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[error: ZeniAPIStatus<Record<string, unknown>>], ZeniAPIStatus<Record<string, unknown>>, "setupView/updateBusinessVerificationDetailsFailure", never, never>, updateSelectedCompanyOfficer: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[selectedOfficerType: "Officer_1" | "Officer_2" | "Officer_3" | "Officer_4" | "Officer_5" | "Officer_6" | "Officer_7" | "Officer_8" | "Officer_9" | "Officer_10"], {
|
|
17
|
+
}, "setupView/updateBusinessVerificationDetails", never, never>, updateBusinessVerificationDetailsSuccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"setupView/updateBusinessVerificationDetailsSuccess">, updateBusinessVerificationDetailsFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[error: ZeniAPIStatus<Record<string, unknown>>], ZeniAPIStatus<Record<string, unknown>>, "setupView/updateBusinessVerificationDetailsFailure", never, never>, resetKycKyb: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"setupView/resetKycKyb">, resetKycKybSuccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"setupView/resetKycKybSuccess">, resetKycKybFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[error: ZeniAPIStatus<Record<string, unknown>>], ZeniAPIStatus<Record<string, unknown>>, "setupView/resetKycKybFailure", never, never>, updateSelectedCompanyOfficer: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[selectedOfficerType: "Officer_1" | "Officer_2" | "Officer_3" | "Officer_4" | "Officer_5" | "Officer_6" | "Officer_7" | "Officer_8" | "Officer_9" | "Officer_10"], {
|
|
18
18
|
selectedOfficerType: "Officer_1" | "Officer_2" | "Officer_3" | "Officer_4" | "Officer_5" | "Officer_6" | "Officer_7" | "Officer_8" | "Officer_9" | "Officer_10";
|
|
19
19
|
}, "setupView/updateSelectedCompanyOfficer", never, never>, updateSetupViewLocalStoreData: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
20
20
|
companyId: ID;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.clearKycKybAutofillForSetup = exports.applyKybDocumentAutofillForSetup = exports.applyKycDocumentAutofillForSetup = exports.clearSetupViewDataInLocalStore = exports.saveIndustryAndIncDateInLocalStore = exports.verifyOtpFailureSpendManagementSetUp = exports.verifyOtpSuccessSpendManagementSetUp = exports.verifyOtpSpendManagementSetUp = exports.sendOtpFailureSpendManagementSetUp = exports.sendOtpSuccessSpendManagementSetUp = exports.resendOtpSpendManagementSetUp = exports.sendOtpSpendManagementSetUp = exports.saveTreasuryAdditionalDocumentsInLocalStore = exports.saveCompnayOfficerAdditionalDocumentsInLocalStore = exports.saveCompnayOfficerPhoneInLocalStore = exports.saveSetupViewDataInLocalStore = exports.updateSetupViewLocalStoreData = exports.updateSelectedCompanyOfficer = exports.updateBusinessVerificationDetailsFailure = exports.updateBusinessVerificationDetailsSuccess = exports.updateBusinessVerificationDetails = exports.enableSetupFailure = exports.enableSetupSuccess = exports.enableSetup = exports.initialState = void 0;
|
|
4
|
+
exports.clearKycKybAutofillForSetup = exports.applyKybDocumentAutofillForSetup = exports.applyKycDocumentAutofillForSetup = exports.clearSetupViewDataInLocalStore = exports.saveIndustryAndIncDateInLocalStore = exports.verifyOtpFailureSpendManagementSetUp = exports.verifyOtpSuccessSpendManagementSetUp = exports.verifyOtpSpendManagementSetUp = exports.sendOtpFailureSpendManagementSetUp = exports.sendOtpSuccessSpendManagementSetUp = exports.resendOtpSpendManagementSetUp = exports.sendOtpSpendManagementSetUp = exports.saveTreasuryAdditionalDocumentsInLocalStore = exports.saveCompnayOfficerAdditionalDocumentsInLocalStore = exports.saveCompnayOfficerPhoneInLocalStore = exports.saveSetupViewDataInLocalStore = exports.updateSetupViewLocalStoreData = exports.updateSelectedCompanyOfficer = exports.resetKycKybFailure = exports.resetKycKybSuccess = exports.resetKycKyb = exports.updateBusinessVerificationDetailsFailure = exports.updateBusinessVerificationDetailsSuccess = exports.updateBusinessVerificationDetails = exports.enableSetupFailure = exports.enableSetupSuccess = exports.enableSetup = exports.initialState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const rootActions_1 = require("../../../rootActions");
|
|
7
7
|
const kycKybAutofillActions_1 = require("./kycKybAutofillActions");
|
|
@@ -17,6 +17,7 @@ const emptyOfficerSlot = {
|
|
|
17
17
|
};
|
|
18
18
|
exports.initialState = {
|
|
19
19
|
updateStatus: { fetchState: 'Not-Started', error: undefined },
|
|
20
|
+
kycKybResetStatus: { fetchState: 'Not-Started', error: undefined },
|
|
20
21
|
parsingDocumentFileIds: [],
|
|
21
22
|
companyDetails: { autoFilledFields: [] },
|
|
22
23
|
companyOfficerUpdateStatus: {
|
|
@@ -88,6 +89,22 @@ const setupView = (0, toolkit_1.createSlice)({
|
|
|
88
89
|
};
|
|
89
90
|
},
|
|
90
91
|
},
|
|
92
|
+
resetKycKyb(draft) {
|
|
93
|
+
draft.kycKybResetStatus = { fetchState: 'In-Progress', error: undefined };
|
|
94
|
+
},
|
|
95
|
+
resetKycKybSuccess(draft) {
|
|
96
|
+
draft.kycKybResetStatus = { fetchState: 'Completed', error: undefined };
|
|
97
|
+
},
|
|
98
|
+
resetKycKybFailure: {
|
|
99
|
+
reducer(draft, action) {
|
|
100
|
+
draft.kycKybResetStatus = { fetchState: 'Error', error: action.payload };
|
|
101
|
+
},
|
|
102
|
+
prepare(error) {
|
|
103
|
+
return {
|
|
104
|
+
payload: error,
|
|
105
|
+
};
|
|
106
|
+
},
|
|
107
|
+
},
|
|
91
108
|
updateSelectedCompanyOfficer: {
|
|
92
109
|
reducer(draft, action) {
|
|
93
110
|
const { selectedOfficerType } = action.payload;
|
|
@@ -363,5 +380,5 @@ const setupView = (0, toolkit_1.createSlice)({
|
|
|
363
380
|
});
|
|
364
381
|
},
|
|
365
382
|
});
|
|
366
|
-
_a = setupView.actions, exports.enableSetup = _a.enableSetup, exports.enableSetupSuccess = _a.enableSetupSuccess, exports.enableSetupFailure = _a.enableSetupFailure, exports.updateBusinessVerificationDetails = _a.updateBusinessVerificationDetails, exports.updateBusinessVerificationDetailsSuccess = _a.updateBusinessVerificationDetailsSuccess, exports.updateBusinessVerificationDetailsFailure = _a.updateBusinessVerificationDetailsFailure, exports.updateSelectedCompanyOfficer = _a.updateSelectedCompanyOfficer, exports.updateSetupViewLocalStoreData = _a.updateSetupViewLocalStoreData, exports.saveSetupViewDataInLocalStore = _a.saveSetupViewDataInLocalStore, exports.saveCompnayOfficerPhoneInLocalStore = _a.saveCompnayOfficerPhoneInLocalStore, exports.saveCompnayOfficerAdditionalDocumentsInLocalStore = _a.saveCompnayOfficerAdditionalDocumentsInLocalStore, exports.saveTreasuryAdditionalDocumentsInLocalStore = _a.saveTreasuryAdditionalDocumentsInLocalStore, exports.sendOtpSpendManagementSetUp = _a.sendOtp, exports.resendOtpSpendManagementSetUp = _a.resendOtp, exports.sendOtpSuccessSpendManagementSetUp = _a.sendOtpSuccess, exports.sendOtpFailureSpendManagementSetUp = _a.sendOtpFailure, exports.verifyOtpSpendManagementSetUp = _a.verifyOtp, exports.verifyOtpSuccessSpendManagementSetUp = _a.verifyOtpSuccess, exports.verifyOtpFailureSpendManagementSetUp = _a.verifyOtpFailure, exports.saveIndustryAndIncDateInLocalStore = _a.saveIndustryAndIncDateInLocalStore, exports.clearSetupViewDataInLocalStore = _a.clearSetupViewDataInLocalStore, exports.applyKycDocumentAutofillForSetup = _a.applyKycDocumentAutofillForSetup, exports.applyKybDocumentAutofillForSetup = _a.applyKybDocumentAutofillForSetup, exports.clearKycKybAutofillForSetup = _a.clearKycKybAutofillForSetup;
|
|
383
|
+
_a = setupView.actions, exports.enableSetup = _a.enableSetup, exports.enableSetupSuccess = _a.enableSetupSuccess, exports.enableSetupFailure = _a.enableSetupFailure, exports.updateBusinessVerificationDetails = _a.updateBusinessVerificationDetails, exports.updateBusinessVerificationDetailsSuccess = _a.updateBusinessVerificationDetailsSuccess, exports.updateBusinessVerificationDetailsFailure = _a.updateBusinessVerificationDetailsFailure, exports.resetKycKyb = _a.resetKycKyb, exports.resetKycKybSuccess = _a.resetKycKybSuccess, exports.resetKycKybFailure = _a.resetKycKybFailure, exports.updateSelectedCompanyOfficer = _a.updateSelectedCompanyOfficer, exports.updateSetupViewLocalStoreData = _a.updateSetupViewLocalStoreData, exports.saveSetupViewDataInLocalStore = _a.saveSetupViewDataInLocalStore, exports.saveCompnayOfficerPhoneInLocalStore = _a.saveCompnayOfficerPhoneInLocalStore, exports.saveCompnayOfficerAdditionalDocumentsInLocalStore = _a.saveCompnayOfficerAdditionalDocumentsInLocalStore, exports.saveTreasuryAdditionalDocumentsInLocalStore = _a.saveTreasuryAdditionalDocumentsInLocalStore, exports.sendOtpSpendManagementSetUp = _a.sendOtp, exports.resendOtpSpendManagementSetUp = _a.resendOtp, exports.sendOtpSuccessSpendManagementSetUp = _a.sendOtpSuccess, exports.sendOtpFailureSpendManagementSetUp = _a.sendOtpFailure, exports.verifyOtpSpendManagementSetUp = _a.verifyOtp, exports.verifyOtpSuccessSpendManagementSetUp = _a.verifyOtpSuccess, exports.verifyOtpFailureSpendManagementSetUp = _a.verifyOtpFailure, exports.saveIndustryAndIncDateInLocalStore = _a.saveIndustryAndIncDateInLocalStore, exports.clearSetupViewDataInLocalStore = _a.clearSetupViewDataInLocalStore, exports.applyKycDocumentAutofillForSetup = _a.applyKycDocumentAutofillForSetup, exports.applyKybDocumentAutofillForSetup = _a.applyKybDocumentAutofillForSetup, exports.clearKycKybAutofillForSetup = _a.clearKycKybAutofillForSetup;
|
|
367
384
|
exports.default = setupView.reducer;
|
|
@@ -21,6 +21,7 @@ export interface SetupView {
|
|
|
21
21
|
}
|
|
22
22
|
export interface BusinessVerificationDetails extends CompanyAndOfficerLocalData {
|
|
23
23
|
allNationalityCountries: Country[];
|
|
24
|
+
kycKybResetStatus: FetchStateAndError;
|
|
24
25
|
updateStatus: FetchStateAndError;
|
|
25
26
|
companyView?: CompanyView;
|
|
26
27
|
}
|
|
@@ -90,7 +90,7 @@ function getPrimaryAccountForTheProduct(state, companyId, setupViewType) {
|
|
|
90
90
|
}
|
|
91
91
|
function getBusinessVerificationDetails(state, companyId) {
|
|
92
92
|
const { setupViewState, countryListState } = state;
|
|
93
|
-
const { companyDetails, companyOfficerUpdateStatus, primaryContactDetails, updateStatus, } = setupViewState;
|
|
93
|
+
const { companyDetails, companyOfficerUpdateStatus, kycKybResetStatus, primaryContactDetails, updateStatus, } = setupViewState;
|
|
94
94
|
const companyView = (0, getCompanyView_1.getCompanyView)(state, companyId, []);
|
|
95
95
|
const { companyDetailsLocalData, companyOfficerLocalData, parsingDocumentFileIds, } = (0, exports.getCompanyAndIdentityDetails)(state, companyId, {
|
|
96
96
|
companyDetails,
|
|
@@ -105,6 +105,7 @@ function getBusinessVerificationDetails(state, companyId) {
|
|
|
105
105
|
parsingDocumentFileIds,
|
|
106
106
|
companyView,
|
|
107
107
|
updateStatus,
|
|
108
|
+
kycKybResetStatus,
|
|
108
109
|
allNationalityCountries,
|
|
109
110
|
};
|
|
110
111
|
}
|
|
@@ -185,6 +185,7 @@ export interface CompanyAndIdentityDetails {
|
|
|
185
185
|
};
|
|
186
186
|
}
|
|
187
187
|
export interface SetupViewState extends CompanyAndIdentityDetails {
|
|
188
|
+
kycKybResetStatus: FetchStateAndError;
|
|
188
189
|
/**
|
|
189
190
|
* File IDs currently being parsed by the AI autofill epic. Populated when
|
|
190
191
|
* `parseUploadedKyc/KybDocument` dispatches and cleared when the
|
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.62-beta2ND",
|
|
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",
|
|
@@ -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;
|