@zeniai/client-epic-state 5.2.62-beta2ND → 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.
- package/lib/entity/actualMatching/actualMatchingReducer.d.ts +3 -1
- package/lib/entity/actualMatching/actualMatchingReducer.js +11 -2
- package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +1 -0
- package/lib/entity/jeSchedules/jeSchedulesPayload.js +1 -0
- package/lib/entity/jeSchedules/jeSchedulesState.d.ts +1 -0
- 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 +9 -1
- package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +1 -0
- 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 +4 -2
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/actualMatching/ignoreActualMatchingSuggestionEpic.js +50 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/actualMatching/matchAndReverseAccrualsEpic.js +26 -13
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/actualMatching/searchMatchTransactionsEpic.js +2 -23
- package/lib/esm/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +89 -38
- package/lib/esm/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +66 -64
- package/lib/esm/view/expenseAutomationView/types/actualMatchingViewState.js +15 -0
- package/lib/esm/view/spendManagement/commonSetup/setupViewReducer.js +1 -18
- package/lib/esm/view/spendManagement/commonSetup/setupViewSelector.js +1 -2
- package/lib/index.d.ts +8 -8
- package/lib/index.js +57 -50
- package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/fetchActualMatchingMatchEpic.d.ts +2 -2
- package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/fetchActualMatchingMatchEpic.js +3 -1
- package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/ignoreActualMatchingSuggestionEpic.d.ts +10 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/ignoreActualMatchingSuggestionEpic.js +54 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/matchAndReverseAccrualsEpic.js +24 -11
- package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/searchMatchTransactionsEpic.js +1 -22
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/payload/actualMatchingPayload.d.ts +12 -1
- package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.d.ts +19 -8
- package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +90 -39
- package/lib/view/expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.d.ts +20 -8
- package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.d.ts +7 -4
- package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +69 -64
- package/lib/view/expenseAutomationView/types/actualMatchingViewState.d.ts +20 -4
- package/lib/view/expenseAutomationView/types/actualMatchingViewState.js +18 -1
- package/lib/view/spendManagement/commonSetup/setupViewReducer.d.ts +1 -1
- package/lib/view/spendManagement/commonSetup/setupViewReducer.js +2 -19
- package/lib/view/spendManagement/commonSetup/setupViewSelector.d.ts +0 -1
- package/lib/view/spendManagement/commonSetup/setupViewSelector.js +1 -2
- package/lib/view/spendManagement/commonSetup/setupViewState.d.ts +0 -1
- package/package.json +1 -1
- package/lib/esm/view/spendManagement/commonSetup/epic/setup/resetKycKybEpic.js +0 -37
- package/lib/view/spendManagement/commonSetup/epic/setup/resetKycKybEpic.d.ts +0 -8
- package/lib/view/spendManagement/commonSetup/epic/setup/resetKycKybEpic.js +0 -41
|
@@ -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?:
|
|
34
|
+
match?: ActualMatchingMatchView;
|
|
35
35
|
}
|
|
36
36
|
export declare function getExpenseAutomationActualMatchingMatchView(state: RootState, matchId: ActualMatchingMatchId): ExpenseAutomationActualMatchingMatchView;
|
|
37
|
-
export declare function getCloseMatchAfterUndo(state: RootState):
|
|
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
|
|
342
|
-
const view = state.expenseAutomationActualMatchingViewState;
|
|
328
|
+
function toActualMatchingMatchView(match) {
|
|
343
329
|
return {
|
|
344
|
-
match
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
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
|
|
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
|
|
368
|
-
const
|
|
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:
|
|
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:
|
|
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
|
-
|
|
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
|
}
|
|
@@ -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>,
|
|
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"], {
|
|
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.
|
|
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;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const rootActions_1 = require("../../../rootActions");
|
|
7
7
|
const kycKybAutofillActions_1 = require("./kycKybAutofillActions");
|
|
@@ -17,7 +17,6 @@ const emptyOfficerSlot = {
|
|
|
17
17
|
};
|
|
18
18
|
exports.initialState = {
|
|
19
19
|
updateStatus: { fetchState: 'Not-Started', error: undefined },
|
|
20
|
-
kycKybResetStatus: { fetchState: 'Not-Started', error: undefined },
|
|
21
20
|
parsingDocumentFileIds: [],
|
|
22
21
|
companyDetails: { autoFilledFields: [] },
|
|
23
22
|
companyOfficerUpdateStatus: {
|
|
@@ -89,22 +88,6 @@ const setupView = (0, toolkit_1.createSlice)({
|
|
|
89
88
|
};
|
|
90
89
|
},
|
|
91
90
|
},
|
|
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
|
-
},
|
|
108
91
|
updateSelectedCompanyOfficer: {
|
|
109
92
|
reducer(draft, action) {
|
|
110
93
|
const { selectedOfficerType } = action.payload;
|
|
@@ -380,5 +363,5 @@ const setupView = (0, toolkit_1.createSlice)({
|
|
|
380
363
|
});
|
|
381
364
|
},
|
|
382
365
|
});
|
|
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.
|
|
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;
|
|
384
367
|
exports.default = setupView.reducer;
|
|
@@ -21,7 +21,6 @@ export interface SetupView {
|
|
|
21
21
|
}
|
|
22
22
|
export interface BusinessVerificationDetails extends CompanyAndOfficerLocalData {
|
|
23
23
|
allNationalityCountries: Country[];
|
|
24
|
-
kycKybResetStatus: FetchStateAndError;
|
|
25
24
|
updateStatus: FetchStateAndError;
|
|
26
25
|
companyView?: CompanyView;
|
|
27
26
|
}
|
|
@@ -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,
|
|
93
|
+
const { companyDetails, companyOfficerUpdateStatus, 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,7 +105,6 @@ function getBusinessVerificationDetails(state, companyId) {
|
|
|
105
105
|
parsingDocumentFileIds,
|
|
106
106
|
companyView,
|
|
107
107
|
updateStatus,
|
|
108
|
-
kycKybResetStatus,
|
|
109
108
|
allNationalityCountries,
|
|
110
109
|
};
|
|
111
110
|
}
|
|
@@ -185,7 +185,6 @@ export interface CompanyAndIdentityDetails {
|
|
|
185
185
|
};
|
|
186
186
|
}
|
|
187
187
|
export interface SetupViewState extends CompanyAndIdentityDetails {
|
|
188
|
-
kycKybResetStatus: FetchStateAndError;
|
|
189
188
|
/**
|
|
190
189
|
* File IDs currently being parsed by the AI autofill epic. Populated when
|
|
191
190
|
* `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.
|
|
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",
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { from } from 'rxjs';
|
|
2
|
-
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
|
-
import { openSnackbar } from '../../../../../entity/snackbar/snackbarReducer';
|
|
4
|
-
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../../responsePayload';
|
|
5
|
-
import { resetKycKyb, resetKycKybFailure, resetKycKybSuccess, } from '../../setupViewReducer';
|
|
6
|
-
export const resetKycKybEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(resetKycKyb.match), mergeMap(() => zeniAPI
|
|
7
|
-
.putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/kyc-kyb-reset`, { is_reset_company_officers: false })
|
|
8
|
-
.pipe(mergeMap((response) => {
|
|
9
|
-
if (isSuccessResponse(response)) {
|
|
10
|
-
return from([
|
|
11
|
-
resetKycKybSuccess(),
|
|
12
|
-
openSnackbar({
|
|
13
|
-
messageSection: 'kyc_kyb_reset',
|
|
14
|
-
messageText: 'success',
|
|
15
|
-
type: 'success',
|
|
16
|
-
}),
|
|
17
|
-
]);
|
|
18
|
-
}
|
|
19
|
-
return from([
|
|
20
|
-
resetKycKybFailure(response.status),
|
|
21
|
-
openSnackbar({
|
|
22
|
-
messageSection: 'kyc_kyb_reset',
|
|
23
|
-
messageText: 'failed',
|
|
24
|
-
type: 'error',
|
|
25
|
-
}),
|
|
26
|
-
]);
|
|
27
|
-
}), catchError((error) => from([
|
|
28
|
-
resetKycKybFailure(createZeniAPIStatus('Unexpected error', 'Reset KYC/KYB errored out: ' +
|
|
29
|
-
(error instanceof Error
|
|
30
|
-
? error.message
|
|
31
|
-
: JSON.stringify(error)))),
|
|
32
|
-
openSnackbar({
|
|
33
|
-
messageSection: 'kyc_kyb_reset',
|
|
34
|
-
messageText: 'failed',
|
|
35
|
-
type: 'error',
|
|
36
|
-
}),
|
|
37
|
-
])))));
|
|
@@ -1,8 +0,0 @@
|
|
|
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>;
|
|
@@ -1,41 +0,0 @@
|
|
|
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;
|