@zeniai/client-epic-state 5.2.76-betaNB1 → 5.2.76-betaRD1
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/tenant/epic/deleteConnectionEpic.d.ts +1 -1
- package/lib/entity/tenant/epic/initEmailConnectOAuthEpic.d.ts +3 -3
- package/lib/entity/tenant/epic/initEmailConnectOAuthEpic.js +2 -2
- package/lib/entity/tenant/epic/saveAPIKeyConnectionEpic.d.ts +1 -1
- package/lib/entity/tenant/epic/saveConnectorCredentialsEpic.d.ts +3 -3
- package/lib/entity/tenant/epic/saveOAuthConnectionEpic.d.ts +1 -1
- package/lib/entity/tenant/tenantPayload.d.ts +1 -0
- package/lib/entity/tenant/tenantReducer.d.ts +32 -30
- package/lib/entity/tenant/tenantReducer.js +13 -2
- package/lib/entity/tenant/tenantState.d.ts +1 -0
- package/lib/entity/tenant/tenantTypes.d.ts +1 -1
- package/lib/entity/tenant/tenantTypes.js +1 -0
- package/lib/epic.d.ts +1 -2
- package/lib/epic.js +0 -2
- package/lib/esm/entity/tenant/epic/initEmailConnectOAuthEpic.js +2 -2
- package/lib/esm/entity/tenant/tenantReducer.js +13 -2
- package/lib/esm/entity/tenant/tenantTypes.js +1 -0
- package/lib/esm/epic.js +0 -2
- package/lib/esm/index.js +0 -3
- package/lib/esm/reducer.js +1 -7
- package/lib/index.d.ts +0 -4
- package/lib/index.js +34 -39
- package/lib/reducer.d.ts +0 -2
- package/lib/reducer.js +1 -7
- package/lib/rootStateTypes.d.ts +1 -5
- package/package.json +1 -1
- package/lib/entity/reconciliationReport/reconciliationReportPayload.d.ts +0 -124
- package/lib/entity/reconciliationReport/reconciliationReportPayload.js +0 -2
- package/lib/entity/reconciliationReport/reconciliationReportReducer.d.ts +0 -7
- package/lib/entity/reconciliationReport/reconciliationReportReducer.js +0 -173
- package/lib/entity/reconciliationReport/reconciliationReportSelector.d.ts +0 -3
- package/lib/entity/reconciliationReport/reconciliationReportSelector.js +0 -10
- package/lib/entity/reconciliationReport/reconciliationReportState.d.ts +0 -133
- package/lib/entity/reconciliationReport/reconciliationReportState.js +0 -15
- package/lib/esm/entity/reconciliationReport/reconciliationReportPayload.js +0 -1
- package/lib/esm/entity/reconciliationReport/reconciliationReportReducer.js +0 -168
- package/lib/esm/entity/reconciliationReport/reconciliationReportSelector.js +0 -4
- package/lib/esm/entity/reconciliationReport/reconciliationReportState.js +0 -10
- package/lib/esm/view/reconciliationReportView/epic/fetchReconciliationReportEpic.js +0 -29
- package/lib/esm/view/reconciliationReportView/reconciliationReportViewPayload.js +0 -1
- package/lib/esm/view/reconciliationReportView/reconciliationReportViewReducer.js +0 -44
- package/lib/esm/view/reconciliationReportView/reconciliationReportViewSelector.js +0 -10
- package/lib/esm/view/reconciliationReportView/reconciliationReportViewState.js +0 -1
- package/lib/view/reconciliationReportView/epic/fetchReconciliationReportEpic.d.ts +0 -19
- package/lib/view/reconciliationReportView/epic/fetchReconciliationReportEpic.js +0 -33
- package/lib/view/reconciliationReportView/reconciliationReportViewPayload.d.ts +0 -3
- package/lib/view/reconciliationReportView/reconciliationReportViewPayload.js +0 -2
- package/lib/view/reconciliationReportView/reconciliationReportViewReducer.d.ts +0 -13
- package/lib/view/reconciliationReportView/reconciliationReportViewReducer.js +0 -48
- package/lib/view/reconciliationReportView/reconciliationReportViewSelector.d.ts +0 -9
- package/lib/view/reconciliationReportView/reconciliationReportViewSelector.js +0 -13
- package/lib/view/reconciliationReportView/reconciliationReportViewState.d.ts +0 -4
- package/lib/view/reconciliationReportView/reconciliationReportViewState.js +0 -2
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
-
import { mapCurrencyPayloadToCurrency } from '../../commonPayloadTypes/v2/viewAndReportPayloadv2';
|
|
3
|
-
import { toAmountWC } from '../../commonStateTypes/amount';
|
|
4
|
-
import { clearAll } from '../../rootActions';
|
|
5
|
-
import { date } from '../../zeniDayJS';
|
|
6
|
-
import { toReconciliationStatusCodeType } from '../accountRecon/accountReconState';
|
|
7
|
-
import { toReconciliationReportDataSource, toReconciliationReportMatchType, } from './reconciliationReportState';
|
|
8
|
-
export const initialState = {
|
|
9
|
-
reportsByReconciliationId: {},
|
|
10
|
-
};
|
|
11
|
-
const reconciliationReport = createSlice({
|
|
12
|
-
name: 'reconciliationReport',
|
|
13
|
-
initialState,
|
|
14
|
-
reducers: {
|
|
15
|
-
updateReconciliationReport(draft, action) {
|
|
16
|
-
const report = mapReconciliationReportPayloadToReconciliationReport(action.payload);
|
|
17
|
-
draft.reportsByReconciliationId[report.reconciliationId] = report;
|
|
18
|
-
},
|
|
19
|
-
removeReconciliationReport(draft, action) {
|
|
20
|
-
delete draft.reportsByReconciliationId[action.payload];
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
extraReducers: (builder) => {
|
|
24
|
-
builder.addCase(clearAll, (draft) => {
|
|
25
|
-
Object.assign(draft, initialState);
|
|
26
|
-
});
|
|
27
|
-
},
|
|
28
|
-
});
|
|
29
|
-
export const { updateReconciliationReport, removeReconciliationReport } = reconciliationReport.actions;
|
|
30
|
-
export default reconciliationReport.reducer;
|
|
31
|
-
function toOptionalAmount(amount, currency) {
|
|
32
|
-
if (amount == null) {
|
|
33
|
-
return undefined;
|
|
34
|
-
}
|
|
35
|
-
return toAmountWC(amount, currency);
|
|
36
|
-
}
|
|
37
|
-
function toOptionalDate(value) {
|
|
38
|
-
if (value == null || value === '') {
|
|
39
|
-
return undefined;
|
|
40
|
-
}
|
|
41
|
-
return date(value);
|
|
42
|
-
}
|
|
43
|
-
function mapCountAmount(payload, currency) {
|
|
44
|
-
return {
|
|
45
|
-
count: payload.count,
|
|
46
|
-
amount: toAmountWC(payload.amount, currency),
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
function mapTransactionRow(payload, currency) {
|
|
50
|
-
return {
|
|
51
|
-
transactionId: payload.transaction_id ?? undefined,
|
|
52
|
-
date: toOptionalDate(payload.date),
|
|
53
|
-
type: payload.type,
|
|
54
|
-
payee: payload.payee,
|
|
55
|
-
match: toReconciliationReportMatchType(payload.match),
|
|
56
|
-
amount: toAmountWC(payload.amount, currency),
|
|
57
|
-
clearedBalance: payload.cleared_balance != null
|
|
58
|
-
? toAmountWC(payload.cleared_balance, currency)
|
|
59
|
-
: undefined,
|
|
60
|
-
glAccount: payload.gl_account ?? undefined,
|
|
61
|
-
referenceNumber: payload.reference_number ?? undefined,
|
|
62
|
-
issueDate: toOptionalDate(payload.issue_date),
|
|
63
|
-
ageDays: payload.age_days ?? undefined,
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
function mapBucket(payload, currency) {
|
|
67
|
-
return {
|
|
68
|
-
count: payload.count,
|
|
69
|
-
amount: toAmountWC(payload.amount, currency),
|
|
70
|
-
transactions: payload.transactions.map((transaction) => mapTransactionRow(transaction, currency)),
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
function mapPaymentsDeposits(payload, currency) {
|
|
74
|
-
return {
|
|
75
|
-
payments: mapBucket(payload.payments, currency),
|
|
76
|
-
deposits: mapBucket(payload.deposits, currency),
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
export function mapReconciliationReportPayloadToReconciliationReport(payload) {
|
|
80
|
-
const currency = mapCurrencyPayloadToCurrency(payload.currency);
|
|
81
|
-
return {
|
|
82
|
-
reconciliationId: payload.reconciliation_id,
|
|
83
|
-
companyName: payload.company_name ?? undefined,
|
|
84
|
-
account: {
|
|
85
|
-
accountId: payload.account.account_id,
|
|
86
|
-
accountName: payload.account.account_name ?? undefined,
|
|
87
|
-
accountType: payload.account.account_type ?? undefined,
|
|
88
|
-
accountSubType: payload.account.account_sub_type ?? undefined,
|
|
89
|
-
last4Digits: payload.account.last_4_digits ?? undefined,
|
|
90
|
-
maskedAccountNumber: payload.account.masked_account_number ?? undefined,
|
|
91
|
-
financialInstitution: payload.account.financial_institution ?? undefined,
|
|
92
|
-
glAccountName: payload.account.gl_account_name ?? undefined,
|
|
93
|
-
coaId: payload.account.coa_id ?? undefined,
|
|
94
|
-
},
|
|
95
|
-
period: {
|
|
96
|
-
startDate: toOptionalDate(payload.period.start_date),
|
|
97
|
-
endDate: toOptionalDate(payload.period.end_date),
|
|
98
|
-
},
|
|
99
|
-
statementDate: toOptionalDate(payload.statement_date),
|
|
100
|
-
dataSource: toReconciliationReportDataSource(payload.data_source),
|
|
101
|
-
currency,
|
|
102
|
-
status: {
|
|
103
|
-
code: toReconciliationStatusCodeType(payload.status.code),
|
|
104
|
-
label: payload.status.label,
|
|
105
|
-
},
|
|
106
|
-
reconciledAt: toOptionalDate(payload.reconciled_at),
|
|
107
|
-
reconciledBy: {
|
|
108
|
-
userId: payload.reconciled_by.user_id ?? undefined,
|
|
109
|
-
name: payload.reconciled_by.name ?? undefined,
|
|
110
|
-
},
|
|
111
|
-
disclaimer: payload.disclaimer,
|
|
112
|
-
reportReference: payload.report_reference ?? undefined,
|
|
113
|
-
locked: payload.locked,
|
|
114
|
-
difference: toOptionalAmount(payload.difference.amount, currency),
|
|
115
|
-
aiMatch: {
|
|
116
|
-
autoMatchedCount: payload.ai_match.auto_matched_count,
|
|
117
|
-
manuallyMatchedCount: payload.ai_match.manually_matched_count,
|
|
118
|
-
clearedCount: payload.ai_match.cleared_count,
|
|
119
|
-
},
|
|
120
|
-
afterPeriodEnd: {
|
|
121
|
-
unclearedAmount: toAmountWC(payload.after_period_end.uncleared_amount, currency),
|
|
122
|
-
clearedAmount: toAmountWC(payload.after_period_end.cleared_amount, currency),
|
|
123
|
-
},
|
|
124
|
-
statement: {
|
|
125
|
-
openingBalance: toOptionalAmount(payload.statement.opening_balance, currency),
|
|
126
|
-
paymentsCleared: mapCountAmount(payload.statement.payments_cleared, currency),
|
|
127
|
-
depositsCleared: mapCountAmount(payload.statement.deposits_cleared, currency),
|
|
128
|
-
closingBalance: toOptionalAmount(payload.statement.closing_balance, currency),
|
|
129
|
-
},
|
|
130
|
-
register: {
|
|
131
|
-
balanceAsOfPeriodEnd: toOptionalAmount(payload.register.balance_as_of_period_end, currency),
|
|
132
|
-
outstandingAsOfPeriodEnd: toAmountWC(payload.register.outstanding_as_of_period_end, currency),
|
|
133
|
-
balanceAsOfReconciledAt: toOptionalAmount(payload.register.balance_as_of_reconciled_at, currency),
|
|
134
|
-
},
|
|
135
|
-
summary: {
|
|
136
|
-
openingBalance: toOptionalAmount(payload.summary.opening_balance, currency),
|
|
137
|
-
clearedPayments: mapCountAmount(payload.summary.cleared_payments, currency),
|
|
138
|
-
clearedDeposits: mapCountAmount(payload.summary.cleared_deposits, currency),
|
|
139
|
-
closingBalance: toOptionalAmount(payload.summary.closing_balance, currency),
|
|
140
|
-
unclearedAsOfStatementDate: {
|
|
141
|
-
payments: mapCountAmount(payload.summary.uncleared_as_of_statement_date.payments, currency),
|
|
142
|
-
deposits: mapCountAmount(payload.summary.uncleared_as_of_statement_date.deposits, currency),
|
|
143
|
-
},
|
|
144
|
-
ledgerClosingAsOfStatementDate: toOptionalAmount(payload.summary.ledger_closing_as_of_statement_date, currency),
|
|
145
|
-
clearedAfterStatementDate: payload.summary.cleared_after_statement_date != null
|
|
146
|
-
? mapCountAmount(payload.summary.cleared_after_statement_date, currency)
|
|
147
|
-
: undefined,
|
|
148
|
-
unclearedAfterStatementDate: payload.summary.uncleared_after_statement_date != null
|
|
149
|
-
? mapCountAmount(payload.summary.uncleared_after_statement_date, currency)
|
|
150
|
-
: undefined,
|
|
151
|
-
ledgerBalanceAsOfReconciledOn: toOptionalAmount(payload.summary.ledger_balance_as_of_reconciled_on, currency),
|
|
152
|
-
bridge: {
|
|
153
|
-
bankClosing: toOptionalAmount(payload.summary.bridge.bank_closing, currency),
|
|
154
|
-
unclearedDeposits: toAmountWC(payload.summary.bridge.uncleared_deposits, currency),
|
|
155
|
-
unclearedPayments: toAmountWC(payload.summary.bridge.uncleared_payments, currency),
|
|
156
|
-
computedLedgerClosing: toOptionalAmount(payload.summary.bridge.computed_ledger_closing, currency),
|
|
157
|
-
ledgerClosing: toOptionalAmount(payload.summary.bridge.ledger_closing, currency),
|
|
158
|
-
variance: toOptionalAmount(payload.summary.bridge.variance, currency),
|
|
159
|
-
},
|
|
160
|
-
variance: toOptionalAmount(payload.summary.variance, currency),
|
|
161
|
-
},
|
|
162
|
-
details: {
|
|
163
|
-
cleared: mapPaymentsDeposits(payload.details.cleared, currency),
|
|
164
|
-
carriedForward: mapPaymentsDeposits(payload.details.carried_forward, currency),
|
|
165
|
-
unclearedAsOfStatementDate: mapPaymentsDeposits(payload.details.uncleared_as_of_statement_date, currency),
|
|
166
|
-
},
|
|
167
|
-
};
|
|
168
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { stringToUnion } from '../../commonStateTypes/stringToUnion';
|
|
2
|
-
const RECONCILIATION_REPORT_MATCH_TYPE = ['automatic', 'manual'];
|
|
3
|
-
export const toReconciliationReportMatchType = (value) => {
|
|
4
|
-
if (value === 'auto') {
|
|
5
|
-
return 'automatic';
|
|
6
|
-
}
|
|
7
|
-
return stringToUnion(value, RECONCILIATION_REPORT_MATCH_TYPE);
|
|
8
|
-
};
|
|
9
|
-
const RECONCILIATION_REPORT_DATA_SOURCE = ['Statement', 'Plaid'];
|
|
10
|
-
export const toReconciliationReportDataSource = (value) => stringToUnion(value, RECONCILIATION_REPORT_DATA_SOURCE);
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { of } from 'rxjs';
|
|
2
|
-
import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
|
|
3
|
-
import { updateReconciliationReport } from '../../../entity/reconciliationReport/reconciliationReportReducer';
|
|
4
|
-
import { getReconciliationReportByReconciliationId } from '../../../entity/reconciliationReport/reconciliationReportSelector';
|
|
5
|
-
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
6
|
-
import { fetchReconciliationReport, fetchReconciliationReportFailure, fetchReconciliationReportSuccess, } from '../reconciliationReportViewReducer';
|
|
7
|
-
export const fetchReconciliationReportEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(fetchReconciliationReport.match), switchMap((action) => {
|
|
8
|
-
const { reconciliationId, cacheOverride } = action.payload;
|
|
9
|
-
const cachedReport = getReconciliationReportByReconciliationId(state$.value.reconciliationReportState, reconciliationId);
|
|
10
|
-
if (cacheOverride === true || cachedReport == null) {
|
|
11
|
-
return zeniAPI
|
|
12
|
-
.getJSON(`${zeniAPI.apiEndPoints.reconciliationMicroServiceBaseUrl}/2.0/reconciliation/${reconciliationId}/report`)
|
|
13
|
-
.pipe(mergeMap((response) => {
|
|
14
|
-
if (isSuccessResponse(response) === true &&
|
|
15
|
-
response.data != null) {
|
|
16
|
-
return of(updateReconciliationReport(response.data), fetchReconciliationReportSuccess(reconciliationId));
|
|
17
|
-
}
|
|
18
|
-
return of(fetchReconciliationReportFailure({
|
|
19
|
-
reconciliationId,
|
|
20
|
-
status: response.status,
|
|
21
|
-
}));
|
|
22
|
-
}), catchError((error) => of(fetchReconciliationReportFailure({
|
|
23
|
-
reconciliationId,
|
|
24
|
-
status: createZeniAPIStatus('Unexpected Error', 'Fetch Reconciliation Report REST API call errored out' +
|
|
25
|
-
JSON.stringify(error)),
|
|
26
|
-
}))));
|
|
27
|
-
}
|
|
28
|
-
return of(fetchReconciliationReportSuccess(reconciliationId));
|
|
29
|
-
}));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
-
import { clearAll } from '../../rootActions';
|
|
3
|
-
export const initialState = {
|
|
4
|
-
fetchReconciliationReportState: {},
|
|
5
|
-
};
|
|
6
|
-
const reconciliationReportView = createSlice({
|
|
7
|
-
name: 'reconciliationReportView',
|
|
8
|
-
initialState,
|
|
9
|
-
reducers: {
|
|
10
|
-
fetchReconciliationReport: {
|
|
11
|
-
prepare(reconciliationId, cacheOverride = false) {
|
|
12
|
-
return { payload: { reconciliationId, cacheOverride } };
|
|
13
|
-
},
|
|
14
|
-
reducer(draft, action) {
|
|
15
|
-
const { reconciliationId } = action.payload;
|
|
16
|
-
draft.fetchReconciliationReportState[reconciliationId] = {
|
|
17
|
-
fetchState: 'In-Progress',
|
|
18
|
-
error: undefined,
|
|
19
|
-
};
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
fetchReconciliationReportSuccess(draft, action) {
|
|
23
|
-
const reconciliationId = action.payload;
|
|
24
|
-
draft.fetchReconciliationReportState[reconciliationId] = {
|
|
25
|
-
fetchState: 'Completed',
|
|
26
|
-
error: undefined,
|
|
27
|
-
};
|
|
28
|
-
},
|
|
29
|
-
fetchReconciliationReportFailure(draft, action) {
|
|
30
|
-
const { reconciliationId, status } = action.payload;
|
|
31
|
-
draft.fetchReconciliationReportState[reconciliationId] = {
|
|
32
|
-
fetchState: 'Error',
|
|
33
|
-
error: status,
|
|
34
|
-
};
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
extraReducers: (builder) => {
|
|
38
|
-
builder.addCase(clearAll, (draft) => {
|
|
39
|
-
Object.assign(draft, initialState);
|
|
40
|
-
});
|
|
41
|
-
},
|
|
42
|
-
});
|
|
43
|
-
export const { fetchReconciliationReport, fetchReconciliationReportSuccess, fetchReconciliationReportFailure, } = reconciliationReportView.actions;
|
|
44
|
-
export default reconciliationReportView.reducer;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { getReconciliationReportByReconciliationId } from '../../entity/reconciliationReport/reconciliationReportSelector';
|
|
2
|
-
export function getReconciliationReport(state, reconciliationId) {
|
|
3
|
-
const fetchReconciliationReportState = state.reconciliationReportViewState.fetchReconciliationReportState[reconciliationId];
|
|
4
|
-
const report = getReconciliationReportByReconciliationId(state.reconciliationReportState, reconciliationId);
|
|
5
|
-
return {
|
|
6
|
-
fetchState: fetchReconciliationReportState?.fetchState ?? 'Not-Started',
|
|
7
|
-
fetchError: fetchReconciliationReportState?.error,
|
|
8
|
-
report,
|
|
9
|
-
};
|
|
10
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { updateReconciliationReport } from '../../../entity/reconciliationReport/reconciliationReportReducer';
|
|
3
|
-
import { RootState } from '../../../rootStateTypes';
|
|
4
|
-
import { ZeniAPI } from '../../../zeniAPI';
|
|
5
|
-
import { fetchReconciliationReport, fetchReconciliationReportFailure, fetchReconciliationReportSuccess } from '../reconciliationReportViewReducer';
|
|
6
|
-
export type ActionType = ReturnType<typeof fetchReconciliationReport> | ReturnType<typeof updateReconciliationReport> | ReturnType<typeof fetchReconciliationReportSuccess> | ReturnType<typeof fetchReconciliationReportFailure>;
|
|
7
|
-
export declare const fetchReconciliationReportEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
|
|
8
|
-
payload: import("../../../entity/reconciliationReport/reconciliationReportPayload").ReconciliationReportPayload;
|
|
9
|
-
type: "reconciliationReport/updateReconciliationReport";
|
|
10
|
-
} | {
|
|
11
|
-
payload: string;
|
|
12
|
-
type: "reconciliationReportView/fetchReconciliationReportSuccess";
|
|
13
|
-
} | {
|
|
14
|
-
payload: {
|
|
15
|
-
reconciliationId: import("../../..").ID;
|
|
16
|
-
status: import("../../../zeniAPIStatus").ZeniAPIStatus;
|
|
17
|
-
};
|
|
18
|
-
type: "reconciliationReportView/fetchReconciliationReportFailure";
|
|
19
|
-
}>;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fetchReconciliationReportEpic = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const reconciliationReportReducer_1 = require("../../../entity/reconciliationReport/reconciliationReportReducer");
|
|
7
|
-
const reconciliationReportSelector_1 = require("../../../entity/reconciliationReport/reconciliationReportSelector");
|
|
8
|
-
const responsePayload_1 = require("../../../responsePayload");
|
|
9
|
-
const reconciliationReportViewReducer_1 = require("../reconciliationReportViewReducer");
|
|
10
|
-
const fetchReconciliationReportEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(reconciliationReportViewReducer_1.fetchReconciliationReport.match), (0, operators_1.switchMap)((action) => {
|
|
11
|
-
const { reconciliationId, cacheOverride } = action.payload;
|
|
12
|
-
const cachedReport = (0, reconciliationReportSelector_1.getReconciliationReportByReconciliationId)(state$.value.reconciliationReportState, reconciliationId);
|
|
13
|
-
if (cacheOverride === true || cachedReport == null) {
|
|
14
|
-
return zeniAPI
|
|
15
|
-
.getJSON(`${zeniAPI.apiEndPoints.reconciliationMicroServiceBaseUrl}/2.0/reconciliation/${reconciliationId}/report`)
|
|
16
|
-
.pipe((0, operators_1.mergeMap)((response) => {
|
|
17
|
-
if ((0, responsePayload_1.isSuccessResponse)(response) === true &&
|
|
18
|
-
response.data != null) {
|
|
19
|
-
return (0, rxjs_1.of)((0, reconciliationReportReducer_1.updateReconciliationReport)(response.data), (0, reconciliationReportViewReducer_1.fetchReconciliationReportSuccess)(reconciliationId));
|
|
20
|
-
}
|
|
21
|
-
return (0, rxjs_1.of)((0, reconciliationReportViewReducer_1.fetchReconciliationReportFailure)({
|
|
22
|
-
reconciliationId,
|
|
23
|
-
status: response.status,
|
|
24
|
-
}));
|
|
25
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, reconciliationReportViewReducer_1.fetchReconciliationReportFailure)({
|
|
26
|
-
reconciliationId,
|
|
27
|
-
status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch Reconciliation Report REST API call errored out' +
|
|
28
|
-
JSON.stringify(error)),
|
|
29
|
-
}))));
|
|
30
|
-
}
|
|
31
|
-
return (0, rxjs_1.of)((0, reconciliationReportViewReducer_1.fetchReconciliationReportSuccess)(reconciliationId));
|
|
32
|
-
}));
|
|
33
|
-
exports.fetchReconciliationReportEpic = fetchReconciliationReportEpic;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ID } from '../../commonStateTypes/common';
|
|
2
|
-
import { ZeniAPIStatus } from '../../responsePayload';
|
|
3
|
-
import { ReconciliationReportViewState } from './reconciliationReportViewState';
|
|
4
|
-
export declare const initialState: ReconciliationReportViewState;
|
|
5
|
-
export declare const fetchReconciliationReport: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[reconciliationId: string, cacheOverride?: any], {
|
|
6
|
-
reconciliationId: string;
|
|
7
|
-
cacheOverride: any;
|
|
8
|
-
}, "reconciliationReportView/fetchReconciliationReport", never, never>, fetchReconciliationReportSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "reconciliationReportView/fetchReconciliationReportSuccess">, fetchReconciliationReportFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
9
|
-
reconciliationId: ID;
|
|
10
|
-
status: ZeniAPIStatus;
|
|
11
|
-
}, "reconciliationReportView/fetchReconciliationReportFailure">;
|
|
12
|
-
declare const _default: import("redux").Reducer<ReconciliationReportViewState>;
|
|
13
|
-
export default _default;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var _a;
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.fetchReconciliationReportFailure = exports.fetchReconciliationReportSuccess = exports.fetchReconciliationReport = exports.initialState = void 0;
|
|
5
|
-
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
-
const rootActions_1 = require("../../rootActions");
|
|
7
|
-
exports.initialState = {
|
|
8
|
-
fetchReconciliationReportState: {},
|
|
9
|
-
};
|
|
10
|
-
const reconciliationReportView = (0, toolkit_1.createSlice)({
|
|
11
|
-
name: 'reconciliationReportView',
|
|
12
|
-
initialState: exports.initialState,
|
|
13
|
-
reducers: {
|
|
14
|
-
fetchReconciliationReport: {
|
|
15
|
-
prepare(reconciliationId, cacheOverride = false) {
|
|
16
|
-
return { payload: { reconciliationId, cacheOverride } };
|
|
17
|
-
},
|
|
18
|
-
reducer(draft, action) {
|
|
19
|
-
const { reconciliationId } = action.payload;
|
|
20
|
-
draft.fetchReconciliationReportState[reconciliationId] = {
|
|
21
|
-
fetchState: 'In-Progress',
|
|
22
|
-
error: undefined,
|
|
23
|
-
};
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
fetchReconciliationReportSuccess(draft, action) {
|
|
27
|
-
const reconciliationId = action.payload;
|
|
28
|
-
draft.fetchReconciliationReportState[reconciliationId] = {
|
|
29
|
-
fetchState: 'Completed',
|
|
30
|
-
error: undefined,
|
|
31
|
-
};
|
|
32
|
-
},
|
|
33
|
-
fetchReconciliationReportFailure(draft, action) {
|
|
34
|
-
const { reconciliationId, status } = action.payload;
|
|
35
|
-
draft.fetchReconciliationReportState[reconciliationId] = {
|
|
36
|
-
fetchState: 'Error',
|
|
37
|
-
error: status,
|
|
38
|
-
};
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
extraReducers: (builder) => {
|
|
42
|
-
builder.addCase(rootActions_1.clearAll, (draft) => {
|
|
43
|
-
Object.assign(draft, exports.initialState);
|
|
44
|
-
});
|
|
45
|
-
},
|
|
46
|
-
});
|
|
47
|
-
_a = reconciliationReportView.actions, exports.fetchReconciliationReport = _a.fetchReconciliationReport, exports.fetchReconciliationReportSuccess = _a.fetchReconciliationReportSuccess, exports.fetchReconciliationReportFailure = _a.fetchReconciliationReportFailure;
|
|
48
|
-
exports.default = reconciliationReportView.reducer;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { FetchState, ID } from '../../commonStateTypes/common';
|
|
2
|
-
import { ReconciliationReport } from '../../entity/reconciliationReport/reconciliationReportState';
|
|
3
|
-
import { ZeniAPIStatus } from '../../responsePayload';
|
|
4
|
-
import { RootState } from '../../rootStateTypes';
|
|
5
|
-
export declare function getReconciliationReport(state: RootState, reconciliationId: ID): {
|
|
6
|
-
fetchState: FetchState;
|
|
7
|
-
fetchError?: ZeniAPIStatus;
|
|
8
|
-
report?: ReconciliationReport;
|
|
9
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getReconciliationReport = getReconciliationReport;
|
|
4
|
-
const reconciliationReportSelector_1 = require("../../entity/reconciliationReport/reconciliationReportSelector");
|
|
5
|
-
function getReconciliationReport(state, reconciliationId) {
|
|
6
|
-
const fetchReconciliationReportState = state.reconciliationReportViewState.fetchReconciliationReportState[reconciliationId];
|
|
7
|
-
const report = (0, reconciliationReportSelector_1.getReconciliationReportByReconciliationId)(state.reconciliationReportState, reconciliationId);
|
|
8
|
-
return {
|
|
9
|
-
fetchState: fetchReconciliationReportState?.fetchState ?? 'Not-Started',
|
|
10
|
-
fetchError: fetchReconciliationReportState?.error,
|
|
11
|
-
report,
|
|
12
|
-
};
|
|
13
|
-
}
|