@zeniai/client-epic-state 4.16.75 → 4.16.76
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/account/accountPayload.d.ts +0 -1
- package/lib/entity/account/accountPayload.js +0 -3
- package/lib/entity/account/accountState.d.ts +0 -4
- package/lib/entity/account/accountState.js +1 -6
- package/lib/entity/accountRecon/accountReconPayload.d.ts +0 -7
- package/lib/entity/accountRecon/accountReconPayload.js +0 -16
- package/lib/entity/accountRecon/accountReconReducer.d.ts +1 -8
- package/lib/entity/accountRecon/accountReconReducer.js +2 -57
- package/lib/entity/accountRecon/accountReconSelector.d.ts +2 -15
- package/lib/entity/accountRecon/accountReconSelector.js +1 -11
- package/lib/entity/accountRecon/accountReconState.d.ts +1 -17
- package/lib/entity/accountRecon/accountReconState.js +2 -21
- package/lib/entity/file/filePayload.d.ts +9 -9
- package/lib/entity/file/fileState.d.ts +4 -4
- package/lib/index.d.ts +5 -7
- package/lib/index.js +28 -37
- package/lib/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.d.ts +1 -2
- package/lib/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js +2 -4
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +1 -27
- package/lib/view/expenseAutomationView/payload/reconciliationPayload.d.ts +1 -29
- package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.d.ts +4 -37
- package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.js +4 -80
- package/lib/view/expenseAutomationView/selectorTypes/reconciliationViewSelectorTypes.d.ts +4 -10
- package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.js +0 -12
- package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +6 -16
- package/lib/view/spendManagement/billPay/billList/billListReducer.d.ts +1 -1
- package/lib/view/spendManagement/billPay/billList/billListState.d.ts +1 -1
- package/lib/view/spendManagement/reimbursement/remiListView/remiListReducer.d.ts +1 -1
- package/lib/view/spendManagement/reimbursement/remiListView/remiListState.d.ts +3 -3
- package/lib/view/vendorReviewView/vendorGlobalReviewView/vendorGlobalReviewViewState.d.ts +1 -1
- package/package.json +1 -1
- package/lib/view/expenseAutomationView/epics/accountRecon/deleteAccountStatementEpic.d.ts +0 -9
- package/lib/view/expenseAutomationView/epics/accountRecon/deleteAccountStatementEpic.js +0 -41
- package/lib/view/expenseAutomationView/epics/accountRecon/uploadAccountStatementDocumentAIHelper.d.ts +0 -12
- package/lib/view/expenseAutomationView/epics/accountRecon/uploadAccountStatementDocumentAIHelper.js +0 -54
- package/lib/view/expenseAutomationView/epics/accountRecon/uploadAccountStatementEpic.d.ts +0 -15
- package/lib/view/expenseAutomationView/epics/accountRecon/uploadAccountStatementEpic.js +0 -46
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.updateReconListScrollPosition = exports.updateSaveReconciliationReviewFetchStatus = exports.saveReconciliationReview = exports.updateReviewTabLocalData = exports.initializeReconciliationReviewTabLocalData = exports.updateReviewTabSortState = exports.updateSelectedDrawerAccountId = exports.clearExpenseAutomationReconciliationView = exports.initialiseLocalDataForSelectedAccountId = exports.updateBalancesLocalData = exports.updateSelectedTab = exports.saveReconciliationDetailSuccess = exports.updateReconcileTabListScrollState = exports.updateReconcileTabListSortState = exports.updateReconcileTabLocalData = exports.setConnectionInProgressForAccount = exports.updateSelectedAccountId = exports.saveReconciliationDetailFailure = exports.saveReconciliationDetail = exports.fetchReconciliationSuccess = exports.fetchReconciliationFailure = exports.fetchReconciliation = exports.initialState = exports.initialActionFetchState = exports.initialReconciliationTabsState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
|
|
7
|
-
const accountState_1 = require("../../../entity/account/accountState");
|
|
8
7
|
const accountReconState_1 = require("../../../entity/accountRecon/accountReconState");
|
|
9
8
|
// Initial state
|
|
10
9
|
exports.initialReconciliationTabsState = {
|
|
@@ -62,7 +61,6 @@ exports.initialState = {
|
|
|
62
61
|
refreshStatus: { fetchState: 'Not-Started', error: undefined },
|
|
63
62
|
actionFetchState: exports.initialActionFetchState,
|
|
64
63
|
selectedAccountId: undefined,
|
|
65
|
-
statementUploadChosen: false,
|
|
66
64
|
reconListUIState: {
|
|
67
65
|
scrollPosition: {
|
|
68
66
|
scrollTop: 0,
|
|
@@ -324,75 +322,13 @@ const expenseAutomationReconciliationView = (0, toolkit_1.createSlice)({
|
|
|
324
322
|
draft.accountConnectionStatusByAccountID[action.payload.accountId] = Object.assign(Object.assign({}, draft.accountConnectionStatusByAccountID[action.payload.accountId]), { connectionInProgress: action.payload.connectionInProgress });
|
|
325
323
|
}
|
|
326
324
|
},
|
|
327
|
-
setStatementParseInProgress: (draft, action) => {
|
|
328
|
-
const { accountId, selectedPeriod, statementParseInProgress } = action.payload;
|
|
329
|
-
draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)].reconciliationByAccountID[accountId].statementParseInProgress =
|
|
330
|
-
statementParseInProgress;
|
|
331
|
-
},
|
|
332
|
-
uploadAccountStatement: (draft, action) => {
|
|
333
|
-
const { accountId, selectedPeriod } = action.payload;
|
|
334
|
-
draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)].reconciliationByAccountID[accountId].statementUploadStatus = {
|
|
335
|
-
fetchState: 'In-Progress',
|
|
336
|
-
error: undefined,
|
|
337
|
-
};
|
|
338
|
-
},
|
|
339
|
-
uploadAccountStatementSuccess: (draft, action) => {
|
|
340
|
-
const { accountId, selectedPeriod } = action.payload;
|
|
341
|
-
draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)].reconciliationByAccountID[accountId].statementUploadStatus = {
|
|
342
|
-
fetchState: 'Completed',
|
|
343
|
-
error: undefined,
|
|
344
|
-
};
|
|
345
|
-
draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)].reconciliationByAccountID[accountId].statementParseInProgress = true;
|
|
346
|
-
},
|
|
347
|
-
uploadAccountStatementFailure: (draft, action) => {
|
|
348
|
-
const { accountId, selectedPeriod } = action.payload;
|
|
349
|
-
draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)].reconciliationByAccountID[accountId].statementUploadStatus = {
|
|
350
|
-
fetchState: 'Error',
|
|
351
|
-
error: action.payload.error,
|
|
352
|
-
};
|
|
353
|
-
},
|
|
354
|
-
deleteAccountStatement: (draft, action) => {
|
|
355
|
-
const { accountId, selectedPeriod } = action.payload;
|
|
356
|
-
draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)].reconciliationByAccountID[accountId].statementDeleteStatus = {
|
|
357
|
-
fetchState: 'In-Progress',
|
|
358
|
-
error: undefined,
|
|
359
|
-
};
|
|
360
|
-
},
|
|
361
|
-
deleteAccountStatementSuccess: (draft, action) => {
|
|
362
|
-
const { accountId, selectedPeriod } = action.payload;
|
|
363
|
-
draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)].reconciliationByAccountID[accountId].statementDeleteStatus = {
|
|
364
|
-
fetchState: 'Completed',
|
|
365
|
-
error: undefined,
|
|
366
|
-
};
|
|
367
|
-
},
|
|
368
|
-
deleteAccountStatementFailure: (draft, action) => {
|
|
369
|
-
const { accountId, selectedPeriod } = action.payload;
|
|
370
|
-
draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)].reconciliationByAccountID[accountId].statementDeleteStatus = {
|
|
371
|
-
fetchState: 'Error',
|
|
372
|
-
error: action.payload.error,
|
|
373
|
-
};
|
|
374
|
-
},
|
|
375
|
-
updateAccountReconciliationLocalData: (draft, action) => {
|
|
376
|
-
const { accountId, selectedPeriod, localData } = action.payload;
|
|
377
|
-
const oldLocalData = draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)].reconciliationByAccountID[accountId].localData;
|
|
378
|
-
if (oldLocalData == null) {
|
|
379
|
-
draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)].reconciliationByAccountID[accountId].localData = localData;
|
|
380
|
-
}
|
|
381
|
-
else {
|
|
382
|
-
draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)].reconciliationByAccountID[accountId].localData = Object.assign(Object.assign({}, oldLocalData), localData);
|
|
383
|
-
}
|
|
384
|
-
draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)].reconciliationByAccountID[accountId].localData = Object.assign(Object.assign({}, oldLocalData), localData);
|
|
385
|
-
},
|
|
386
|
-
updateStatementUploadChosen: (draft, action) => {
|
|
387
|
-
draft.statementUploadChosen = action.payload.statementUploadChosen;
|
|
388
|
-
},
|
|
389
325
|
clearExpenseAutomationReconciliationView: (draft) => {
|
|
390
326
|
Object.assign(draft, exports.initialState);
|
|
391
327
|
},
|
|
392
328
|
},
|
|
393
329
|
});
|
|
394
330
|
// Export actions
|
|
395
|
-
_a = expenseAutomationReconciliationView.actions, exports.fetchReconciliation = _a.fetchReconciliation, exports.fetchReconciliationFailure = _a.fetchReconciliationFailure, exports.fetchReconciliationSuccess = _a.fetchReconciliationSuccess, exports.saveReconciliationDetail = _a.saveReconciliationDetail, exports.saveReconciliationDetailFailure = _a.saveReconciliationDetailFailure, exports.updateSelectedAccountId = _a.updateSelectedAccountId, exports.setConnectionInProgressForAccount = _a.setConnectionInProgressForAccount, exports.
|
|
331
|
+
_a = expenseAutomationReconciliationView.actions, exports.fetchReconciliation = _a.fetchReconciliation, exports.fetchReconciliationFailure = _a.fetchReconciliationFailure, exports.fetchReconciliationSuccess = _a.fetchReconciliationSuccess, exports.saveReconciliationDetail = _a.saveReconciliationDetail, exports.saveReconciliationDetailFailure = _a.saveReconciliationDetailFailure, exports.updateSelectedAccountId = _a.updateSelectedAccountId, exports.setConnectionInProgressForAccount = _a.setConnectionInProgressForAccount, exports.updateReconcileTabLocalData = _a.updateReconcileTabLocalData, exports.updateReconcileTabListSortState = _a.updateReconcileTabListSortState, exports.updateReconcileTabListScrollState = _a.updateReconcileTabListScrollState, exports.saveReconciliationDetailSuccess = _a.saveReconciliationDetailSuccess, exports.updateSelectedTab = _a.updateSelectedTab, exports.updateBalancesLocalData = _a.updateBalancesLocalData, exports.initialiseLocalDataForSelectedAccountId = _a.initialiseLocalDataForSelectedAccountId, exports.clearExpenseAutomationReconciliationView = _a.clearExpenseAutomationReconciliationView, exports.updateSelectedDrawerAccountId = _a.updateSelectedDrawerAccountId, exports.updateReviewTabSortState = _a.updateReviewTabSortState, exports.initializeReconciliationReviewTabLocalData = _a.initializeReconciliationReviewTabLocalData, exports.updateReviewTabLocalData = _a.updateReviewTabLocalData, exports.saveReconciliationReview = _a.saveReconciliationReview, exports.updateSaveReconciliationReviewFetchStatus = _a.updateSaveReconciliationReviewFetchStatus, exports.updateReconListScrollPosition = _a.updateReconListScrollPosition;
|
|
396
332
|
// Export reducer
|
|
397
333
|
exports.default = expenseAutomationReconciliationView.reducer;
|
|
398
334
|
function updateAllReconciliation(draft, accounts, selectedPeriod, reconciliationData, refreshViewInBackground) {
|
|
@@ -425,15 +361,6 @@ function updateAllReconciliation(draft, accounts, selectedPeriod, reconciliation
|
|
|
425
361
|
reconciliationId: (_c = reconciliation.reconciliation_id) !== null && _c !== void 0 ? _c : undefined,
|
|
426
362
|
transactionFetchState: { fetchState: 'Not-Started', error: undefined },
|
|
427
363
|
refreshStatus: { fetchState: 'Not-Started', error: undefined },
|
|
428
|
-
statementDeleteStatus: { fetchState: 'Not-Started', error: undefined },
|
|
429
|
-
statementUploadStatus: { fetchState: 'Not-Started', error: undefined },
|
|
430
|
-
statementUpdateStatus: { fetchState: 'Not-Started', error: undefined },
|
|
431
|
-
statementParseInProgress: reconciliation.bank_status.code === 'parsing',
|
|
432
|
-
localData: {
|
|
433
|
-
accountSource: (account === null || account === void 0 ? void 0 : account.reconciliation_source) != null
|
|
434
|
-
? (0, accountState_1.toReconciliationAccountSource)(account.reconciliation_source)
|
|
435
|
-
: undefined,
|
|
436
|
-
},
|
|
437
364
|
};
|
|
438
365
|
accountReconciliationRecords.accountIDs.push(reconciliation.account_id);
|
|
439
366
|
});
|
|
@@ -460,13 +387,10 @@ function updateReconciliationByAccountID(draft, accounts, selectedPeriod, accoun
|
|
|
460
387
|
: false,
|
|
461
388
|
paymentAccountId: (_a = accounts.payment_account_id) !== null && _a !== void 0 ? _a : undefined,
|
|
462
389
|
};
|
|
463
|
-
const oldStatementParseInProgress = oldRecord.statementParseInProgress;
|
|
464
|
-
const statementParseInProgress = reconciliationData.bank_status.code === 'parsing' ||
|
|
465
|
-
oldStatementParseInProgress === true;
|
|
466
390
|
if (refreshViewInBackground === true) {
|
|
467
|
-
draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)].reconciliationByAccountID[accountId] = Object.assign(Object.assign({}, oldRecord), { reconciliationId: (_b = reconciliationData.reconciliation_id) !== null && _b !== void 0 ? _b : undefined, refreshStatus: { fetchState: 'Completed', error: undefined }
|
|
391
|
+
draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)].reconciliationByAccountID[accountId] = Object.assign(Object.assign({}, oldRecord), { reconciliationId: (_b = reconciliationData.reconciliation_id) !== null && _b !== void 0 ? _b : undefined, refreshStatus: { fetchState: 'Completed', error: undefined } });
|
|
468
392
|
}
|
|
469
393
|
else {
|
|
470
|
-
draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)].reconciliationByAccountID[accountId] = Object.assign(Object.assign({}, oldRecord), {
|
|
394
|
+
draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)].reconciliationByAccountID[accountId] = Object.assign(Object.assign({}, oldRecord), { reconciliationId: (_c = reconciliationData.reconciliation_id) !== null && _c !== void 0 ? _c : undefined, transactionFetchState: { fetchState: 'Completed', error: undefined } });
|
|
471
395
|
}
|
|
472
396
|
}
|
|
@@ -9,7 +9,7 @@ import { BankStatusCodeType } from '../../../entity/accountRecon/accountReconSta
|
|
|
9
9
|
import { ClassBase } from '../../../entity/class/classState';
|
|
10
10
|
import { Vendor } from '../../../entity/vendor/vendorState';
|
|
11
11
|
import { PlaidConnectionDetails } from '../../spendManagement/plaidAccount/plaidAccountViewState';
|
|
12
|
-
import {
|
|
12
|
+
import { ActionFetchStates, ReconListUIState, ReconciliationTabsState, ReconciliationViewTabType } from '../types/reconciliationViewState';
|
|
13
13
|
export declare const ALL_ACCOUNT_RECON_SECTION_IDS: readonly ["assets", "liabilities"];
|
|
14
14
|
declare const toAccountReconSectionID: (v: string) => "assets" | "liabilities";
|
|
15
15
|
export type AccountReconSectionID = ReturnType<typeof toAccountReconSectionID>;
|
|
@@ -24,18 +24,17 @@ export interface ExpenseAutomationReconciliationViewSelector {
|
|
|
24
24
|
accountReconciliationsByAccountID: Record<ID, AccountReconciliationByAccount>;
|
|
25
25
|
reconciliationTabsState: ReconciliationTabsState;
|
|
26
26
|
reconListUIState: ReconListUIState;
|
|
27
|
+
selectedAccountId?: ID;
|
|
28
|
+
selectedReconAccount?: AccountReconciliationByAccount;
|
|
29
|
+
selectedDrawerAccountId?: ID;
|
|
27
30
|
actionFetchStates: ActionFetchStates;
|
|
28
31
|
accountListNestedAccountHierarchy: NestedAccountHierarchyForReport[];
|
|
29
32
|
classListNestedAccountHierarchy: NestedClassHierarchyForReport[];
|
|
30
33
|
allAccountList: AccountBase[];
|
|
31
34
|
allClassList: ClassBase[];
|
|
32
35
|
reviewTabSelectedVendorByTransactionId: Record<ID, Vendor>;
|
|
33
|
-
statementUploadChosen: boolean;
|
|
34
36
|
bankAccounts: AccountBase[];
|
|
35
37
|
creditCards: AccountBase[];
|
|
36
|
-
selectedAccountId?: ID;
|
|
37
|
-
selectedReconAccount?: AccountReconciliationByAccount;
|
|
38
|
-
selectedDrawerAccountId?: ID;
|
|
39
38
|
}
|
|
40
39
|
export interface AccountReconciliationBySection {
|
|
41
40
|
sectionId: AccountReconSectionID;
|
|
@@ -52,11 +51,6 @@ export interface AccountReconciliationByAccount {
|
|
|
52
51
|
accountReconEntity: AccountReconciliationEntity;
|
|
53
52
|
transactionFetchState: FetchStateAndError;
|
|
54
53
|
refreshStatus: FetchStateAndError;
|
|
55
|
-
statementDeleteStatus: FetchStateAndError;
|
|
56
|
-
statementUploadStatus: FetchStateAndError;
|
|
57
|
-
statementUpdateStatus: FetchStateAndError;
|
|
58
|
-
localData: AccountReconciliationLocalData;
|
|
59
|
-
statementParseInProgress: boolean;
|
|
60
54
|
paymentAccountId?: ID;
|
|
61
55
|
}
|
|
62
56
|
export {};
|
|
@@ -62,7 +62,6 @@ exports.getExpenseAutomationReconciliationView = (0, toolkit_1.createSelector)((
|
|
|
62
62
|
selectedTab: reconciliationViewState.selectedTab,
|
|
63
63
|
monthYearPeriod: selectedPeriod,
|
|
64
64
|
selectedAccountId: reconciliationViewState.selectedAccountId,
|
|
65
|
-
statementUploadChosen: reconciliationViewState.statementUploadChosen,
|
|
66
65
|
accountReconciliationsByAccountID: {},
|
|
67
66
|
reconciliationTabsState: reconciliationViewReducer_1.initialReconciliationTabsState,
|
|
68
67
|
actionFetchStates: reconciliationViewReducer_1.initialActionFetchState,
|
|
@@ -200,16 +199,6 @@ exports.getExpenseAutomationReconciliationView = (0, toolkit_1.createSelector)((
|
|
|
200
199
|
accountReconEntity: accountRecon,
|
|
201
200
|
refreshStatus: accountReconForMonthYearPeriod.reconciliationByAccountID[accountID]
|
|
202
201
|
.refreshStatus,
|
|
203
|
-
statementDeleteStatus: accountReconForMonthYearPeriod.reconciliationByAccountID[accountID]
|
|
204
|
-
.statementDeleteStatus,
|
|
205
|
-
statementUpdateStatus: accountReconForMonthYearPeriod.reconciliationByAccountID[accountID]
|
|
206
|
-
.statementUpdateStatus,
|
|
207
|
-
statementUploadStatus: accountReconForMonthYearPeriod.reconciliationByAccountID[accountID]
|
|
208
|
-
.statementUploadStatus,
|
|
209
|
-
localData: accountReconForMonthYearPeriod.reconciliationByAccountID[accountID]
|
|
210
|
-
.localData,
|
|
211
|
-
statementParseInProgress: accountReconForMonthYearPeriod.reconciliationByAccountID[accountID]
|
|
212
|
-
.statementParseInProgress,
|
|
213
202
|
transactionFetchState: (0, reduceFetchState_1.reduceAnyFetchState)([
|
|
214
203
|
accountReconForMonthYearPeriod.reconciliationByAccountID[accountID]
|
|
215
204
|
.transactionFetchState,
|
|
@@ -280,7 +269,6 @@ exports.getExpenseAutomationReconciliationView = (0, toolkit_1.createSelector)((
|
|
|
280
269
|
refreshStatus: reconciliationViewState.refreshStatus,
|
|
281
270
|
selectedTab: reconciliationViewState.selectedTab,
|
|
282
271
|
selectedDrawerAccountId: reconciliationViewState.selectedDrawerAccountId,
|
|
283
|
-
statementUploadChosen: reconciliationViewState.statementUploadChosen,
|
|
284
272
|
monthYearPeriod: selectedPeriod,
|
|
285
273
|
accountReconciliationBySectionID,
|
|
286
274
|
selectedAccountId: reconciliationViewState.selectedAccountId,
|
|
@@ -2,7 +2,6 @@ import { Amount } from '../../../commonStateTypes/amount';
|
|
|
2
2
|
import { FetchStateAndError, ID } from '../../../commonStateTypes/common';
|
|
3
3
|
import { SortOrder } from '../../../commonStateTypes/selectorTypes/sortOrderTypes';
|
|
4
4
|
import { MonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
|
|
5
|
-
import { ReconciliationAccountSourceType } from '../../../entity/account/accountState';
|
|
6
5
|
import { BankStatusCodeType } from '../../../entity/accountRecon/accountReconState';
|
|
7
6
|
import { CustomerBase } from '../../../entity/customer/customerState';
|
|
8
7
|
import { VendorBase } from '../../../entity/vendor/vendorState';
|
|
@@ -28,9 +27,9 @@ export interface ReconciliationReconcileTabLocalData {
|
|
|
28
27
|
selectedTransactionIds: ID[];
|
|
29
28
|
}
|
|
30
29
|
export interface ReconciliationReconcileTabViewUiState {
|
|
30
|
+
scrollYOffset?: number;
|
|
31
31
|
sortKey: ReconReconcileSortKey;
|
|
32
32
|
sortOrder: SortOrder;
|
|
33
|
-
scrollYOffset?: number;
|
|
34
33
|
}
|
|
35
34
|
export interface TransactionSummary {
|
|
36
35
|
count: number;
|
|
@@ -39,9 +38,9 @@ export interface TransactionSummary {
|
|
|
39
38
|
export interface BalancesLocalData {
|
|
40
39
|
variance: Amount;
|
|
41
40
|
clearedBalance: Amount;
|
|
41
|
+
variancePercentage?: number;
|
|
42
42
|
payments: TransactionSummary;
|
|
43
43
|
deposits: TransactionSummary;
|
|
44
|
-
variancePercentage?: number;
|
|
45
44
|
}
|
|
46
45
|
export interface ReconciliationTabsState {
|
|
47
46
|
reconcile: {
|
|
@@ -54,7 +53,7 @@ export interface ReconciliationTabsState {
|
|
|
54
53
|
};
|
|
55
54
|
balances: BalancesLocalData;
|
|
56
55
|
}
|
|
57
|
-
declare const toReconReviewSortKey: (v: string) => "date" | "amount" | "memo" | "
|
|
56
|
+
declare const toReconReviewSortKey: (v: string) => "date" | "amount" | "memo" | "direction" | "match" | "payee";
|
|
58
57
|
export type ReconReviewSortKey = ReturnType<typeof toReconReviewSortKey>;
|
|
59
58
|
export interface ReconciliationReviewTabViewUiState {
|
|
60
59
|
scrollPosition: {
|
|
@@ -91,12 +90,11 @@ export interface ReconciliationViewState extends FetchStateAndError {
|
|
|
91
90
|
refreshStatus: FetchStateAndError;
|
|
92
91
|
accountConnectionStatusByAccountID: Record<ID, BankConnectionStatus>;
|
|
93
92
|
selectedTab: ReconciliationViewTabType;
|
|
93
|
+
selectedAccountId?: ID;
|
|
94
|
+
selectedDrawerAccountId?: ID;
|
|
94
95
|
reconListUIState: ReconListUIState;
|
|
95
96
|
reconTabsState: ReconciliationTabsState;
|
|
96
97
|
actionFetchState: ActionFetchStates;
|
|
97
|
-
statementUploadChosen: boolean;
|
|
98
|
-
selectedAccountId?: ID;
|
|
99
|
-
selectedDrawerAccountId?: ID;
|
|
100
98
|
}
|
|
101
99
|
export interface BankConnectionStatus {
|
|
102
100
|
status: BankStatusCodeType;
|
|
@@ -107,18 +105,10 @@ export interface AccountReconciliationRecords {
|
|
|
107
105
|
accountIDs: ID[];
|
|
108
106
|
reconciliationByAccountID: Record<ID, AccountReconciliationDataWithTransactionFetchState>;
|
|
109
107
|
}
|
|
110
|
-
export interface AccountReconciliationLocalData {
|
|
111
|
-
accountSource?: ReconciliationAccountSourceType;
|
|
112
|
-
}
|
|
113
108
|
export interface AccountReconciliationDataWithTransactionFetchState {
|
|
114
109
|
accountId: ID;
|
|
110
|
+
reconciliationId?: ID;
|
|
115
111
|
transactionFetchState: FetchStateAndError;
|
|
116
112
|
refreshStatus: FetchStateAndError;
|
|
117
|
-
statementDeleteStatus: FetchStateAndError;
|
|
118
|
-
statementUploadStatus: FetchStateAndError;
|
|
119
|
-
statementUpdateStatus: FetchStateAndError;
|
|
120
|
-
localData: AccountReconciliationLocalData;
|
|
121
|
-
statementParseInProgress: boolean;
|
|
122
|
-
reconciliationId?: ID;
|
|
123
113
|
}
|
|
124
114
|
export {};
|
|
@@ -21,7 +21,7 @@ export declare const fetchBillList: import("@reduxjs/toolkit").ActionCreatorWith
|
|
|
21
21
|
period: TimePeriod;
|
|
22
22
|
tab: "paid" | "pending_approval" | "scheduled" | "draft";
|
|
23
23
|
error: ZeniAPIStatus<Record<string, unknown>>;
|
|
24
|
-
}, "billList/updateBillListFailure", never, never>, updateTab: import("@reduxjs/toolkit").ActionCreatorWithPayload<"paid" | "pending_approval" | "scheduled" | "draft", "billList/updateTab">, updateSubTab: import("@reduxjs/toolkit").ActionCreatorWithPayload<"rejected" | "ach" | "wire" | "failed" | "cancelled" | "
|
|
24
|
+
}, "billList/updateBillListFailure", never, never>, updateTab: import("@reduxjs/toolkit").ActionCreatorWithPayload<"paid" | "pending_approval" | "scheduled" | "draft", "billList/updateTab">, updateSubTab: import("@reduxjs/toolkit").ActionCreatorWithPayload<"rejected" | "ach" | "wire" | "failed" | "cancelled" | "all" | "overdue" | "awaiting_approval" | "awaiting_my_approval" | "deleted" | "offline", "billList/updateSubTab">, updateSelectedBillId: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "billList/updateSelectedBillId">, clearBillList: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"billList/clearBillList">, updateBillDetailSaveBillCode: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<SaveBillStageCode, "billList/updateBillDetailSaveBillCode">, updateBillListUIState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
25
25
|
uiState: Partial<BillListUIState>;
|
|
26
26
|
period: TimePeriod;
|
|
27
27
|
}, "billList/updateBillListUIState">, updateSearchResult: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "billList/updateSearchResult">, updateFilterResult: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
@@ -35,7 +35,7 @@ export type SaveBillStageCode = 'draft' | 'pending_approval' | undefined;
|
|
|
35
35
|
export declare const ALL_BILL_TABS: readonly ["paid", "pending_approval", "scheduled", "draft"];
|
|
36
36
|
declare const toBillTabType: (v: string) => "paid" | "pending_approval" | "scheduled" | "draft";
|
|
37
37
|
export type BillTab = ReturnType<typeof toBillTabType>;
|
|
38
|
-
declare const toBillsSubTabType: (v: string) => "rejected" | "ach" | "wire" | "failed" | "cancelled" | "
|
|
38
|
+
declare const toBillsSubTabType: (v: string) => "rejected" | "ach" | "wire" | "failed" | "cancelled" | "all" | "overdue" | "awaiting_approval" | "awaiting_my_approval" | "deleted" | "offline";
|
|
39
39
|
export type BillsSubTabType = ReturnType<typeof toBillsSubTabType>;
|
|
40
40
|
declare const toBillPaySortKeyType: (v: string) => "status" | "amount" | "name" | "dueDate" | "paymentMethod" | "invoiceDate";
|
|
41
41
|
export declare type BillPayViewSortKey = ReturnType<typeof toBillPaySortKeyType>;
|
|
@@ -25,7 +25,7 @@ export declare const fetchRemiList: import("@reduxjs/toolkit").ActionCreatorWith
|
|
|
25
25
|
}, "remiList/updateRemiListFailure", never, never>, updateRemiListUIState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
26
26
|
uiState: Partial<RemiListUIState>;
|
|
27
27
|
period: TimePeriod;
|
|
28
|
-
}, "remiList/updateRemiListUIState">, updateTab: import("@reduxjs/toolkit").ActionCreatorWithPayload<"paid" | "pending_approval" | "scheduled" | "draft", "remiList/updateTab">, updateSubTab: import("@reduxjs/toolkit").ActionCreatorWithPayload<"rejected" | "ach" | "wire" | "failed" | "cancelled" | "
|
|
28
|
+
}, "remiList/updateRemiListUIState">, updateTab: import("@reduxjs/toolkit").ActionCreatorWithPayload<"paid" | "pending_approval" | "scheduled" | "draft", "remiList/updateTab">, updateSubTab: import("@reduxjs/toolkit").ActionCreatorWithPayload<"rejected" | "ach" | "wire" | "failed" | "cancelled" | "all" | "overdue" | "deleted" | "myDrafts" | "awaitingApproval" | "awaitingMyApproval" | "awaitingAllApproval", "remiList/updateSubTab">, updateSelectedRemiId: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "remiList/updateSelectedRemiId">, clearRemiList: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"remiList/clearRemiList">, updateRemiDetailSaveRemiCode: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<SaveRemiStageCode, "remiList/updateRemiDetailSaveRemiCode">, updateSearchResult: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "remiList/updateSearchResult">, updateFilterResult: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
29
29
|
filters: ReimbursementFilters;
|
|
30
30
|
}, "remiList/updateFilterResult">, updateRemiListDownloadUIState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
31
31
|
uiState: Partial<RemiListDownloadUIState>;
|
|
@@ -33,10 +33,10 @@ export declare const ALL_REMI_TABS: readonly ["paid", "pending_approval", "sched
|
|
|
33
33
|
export declare const toRemiTabType: (v: string) => "paid" | "pending_approval" | "scheduled" | "draft";
|
|
34
34
|
export declare const toRemiTabTypeStrict: (v: string) => "paid" | "pending_approval" | "scheduled" | "draft" | undefined;
|
|
35
35
|
export type RemiTabType = ReturnType<typeof toRemiTabType>;
|
|
36
|
-
export declare const toRemiSubTabType: (v: string) => "rejected" | "ach" | "wire" | "failed" | "cancelled" | "
|
|
37
|
-
export declare const toRemiSubTabTypeStrict: (v: string) => "rejected" | "ach" | "wire" | "failed" | "cancelled" | "
|
|
36
|
+
export declare const toRemiSubTabType: (v: string) => "rejected" | "ach" | "wire" | "failed" | "cancelled" | "all" | "overdue" | "deleted" | "myDrafts" | "awaitingApproval" | "awaitingMyApproval" | "awaitingAllApproval";
|
|
37
|
+
export declare const toRemiSubTabTypeStrict: (v: string) => "rejected" | "ach" | "wire" | "failed" | "cancelled" | "all" | "overdue" | "deleted" | "myDrafts" | "awaitingApproval" | "awaitingMyApproval" | "awaitingAllApproval" | undefined;
|
|
38
38
|
export type RemiSubTabType = ReturnType<typeof toRemiSubTabType>;
|
|
39
|
-
export declare const toRemiSubTabUnderScoreType: (v: string) => "rejected" | "ach" | "wire" | "failed" | "cancelled" | "
|
|
39
|
+
export declare const toRemiSubTabUnderScoreType: (v: string) => "rejected" | "ach" | "wire" | "failed" | "cancelled" | "all" | "overdue" | "awaiting_approval" | "awaiting_my_approval" | "deleted" | "my_drafts" | "awaiting_all_approval";
|
|
40
40
|
export type RemiSubTabUnderScoreType = ReturnType<typeof toRemiSubTabUnderScoreType>;
|
|
41
41
|
declare const toReimbursementSortKeyType: (v: string) => "status" | "amount" | "type" | "submittedOn" | "reportName";
|
|
42
42
|
export type ReimbursementViewSortKey = ReturnType<typeof toReimbursementSortKeyType>;
|
|
@@ -3,7 +3,7 @@ import { SortOrder } from '../../../commonStateTypes/selectorTypes/sortOrderType
|
|
|
3
3
|
import { PageToken } from '../../../commonStateTypes/viewAndReport/viewAndReport';
|
|
4
4
|
import { GlobalVendorReviewRowCurrentSelection } from '../common/state/commonTypes';
|
|
5
5
|
import { RecommendedNonExistingGlobalMerchant } from '../vendorFirstReviewView/vendorFirstReviewViewState';
|
|
6
|
-
export declare const toVendorGlobalReviewColumnSortKeyType: (v: string) => "
|
|
6
|
+
export declare const toVendorGlobalReviewColumnSortKeyType: (v: string) => "tenants" | "recommended" | "originalVendor" | "requestedVendor";
|
|
7
7
|
export type VendorGlobalReviewViewColumnSortKey = ReturnType<typeof toVendorGlobalReviewColumnSortKeyType>;
|
|
8
8
|
export interface GlobalReviewPageCurrentSelectionByColumn {
|
|
9
9
|
requested: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.16.
|
|
3
|
+
"version": "4.16.76",
|
|
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
|
"types": "lib/index.d.ts",
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { updateAccountReconDeleteStatement } from '../../../../entity/accountRecon/accountReconReducer';
|
|
4
|
-
import { removeFiles } from '../../../../entity/file/fileReducer';
|
|
5
|
-
import { RootState } from '../../../../reducer';
|
|
6
|
-
import { ZeniAPI } from '../../../../zeniAPI';
|
|
7
|
-
import { deleteAccountStatement, deleteAccountStatementFailure, deleteAccountStatementSuccess } from '../../reducers/reconciliationViewReducer';
|
|
8
|
-
export type ActionType = ReturnType<typeof deleteAccountStatement> | ReturnType<typeof removeFiles> | ReturnType<typeof updateAccountReconDeleteStatement> | ReturnType<typeof deleteAccountStatementFailure> | ReturnType<typeof deleteAccountStatementSuccess>;
|
|
9
|
-
export declare const deleteAccountStatementEpic: (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.deleteAccountStatementEpic = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const accountReconReducer_1 = require("../../../../entity/accountRecon/accountReconReducer");
|
|
7
|
-
const accountReconState_1 = require("../../../../entity/accountRecon/accountReconState");
|
|
8
|
-
const fileReducer_1 = require("../../../../entity/file/fileReducer");
|
|
9
|
-
const responsePayload_1 = require("../../../../responsePayload");
|
|
10
|
-
const reconciliationViewReducer_1 = require("../../reducers/reconciliationViewReducer");
|
|
11
|
-
const deleteAccountStatementEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(reconciliationViewReducer_1.deleteAccountStatement.match), (0, operators_1.switchMap)((action) => {
|
|
12
|
-
const { accountId, selectedPeriod, statementUploadId, fileId } = action.payload;
|
|
13
|
-
const request = zeniAPI.deleteAndGetJSON(`${zeniAPI.apiEndPoints.reconciliationMicroServiceBaseUrl}/1.0/reconciliation/bank-statements/${statementUploadId}`);
|
|
14
|
-
return request.pipe((0, operators_1.mergeMap)((response) => {
|
|
15
|
-
if ((0, responsePayload_1.isSuccessResponse)(response)) {
|
|
16
|
-
const actions = [];
|
|
17
|
-
const accountReconKey = (0, accountReconState_1.toAccountReconKey)(accountId, selectedPeriod);
|
|
18
|
-
actions.push((0, fileReducer_1.removeFiles)([fileId]));
|
|
19
|
-
if (response.data != null) {
|
|
20
|
-
actions.push((0, accountReconReducer_1.updateAccountReconDeleteStatement)(accountReconKey, response.data));
|
|
21
|
-
}
|
|
22
|
-
actions.push((0, reconciliationViewReducer_1.deleteAccountStatementSuccess)({ accountId, selectedPeriod }));
|
|
23
|
-
return (0, rxjs_1.of)(...actions);
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
return (0, rxjs_1.of)((0, reconciliationViewReducer_1.deleteAccountStatementFailure)({
|
|
27
|
-
accountId,
|
|
28
|
-
selectedPeriod,
|
|
29
|
-
error: response.status,
|
|
30
|
-
}));
|
|
31
|
-
}
|
|
32
|
-
}), (0, operators_1.catchError)((error) => {
|
|
33
|
-
return (0, rxjs_1.of)((0, reconciliationViewReducer_1.deleteAccountStatementFailure)({
|
|
34
|
-
accountId,
|
|
35
|
-
selectedPeriod,
|
|
36
|
-
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Delete Statement File REST API call errored out ' +
|
|
37
|
-
JSON.stringify(error)),
|
|
38
|
-
}));
|
|
39
|
-
}));
|
|
40
|
-
}));
|
|
41
|
-
exports.deleteAccountStatementEpic = deleteAccountStatementEpic;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { UploadStatementDocumentAIPayload } from '../../payload/reconciliationPayload';
|
|
2
|
-
export interface AuthParams {
|
|
3
|
-
sessionId: string;
|
|
4
|
-
userId: string;
|
|
5
|
-
tenantId: string;
|
|
6
|
-
}
|
|
7
|
-
export interface AuthParamsPayload {
|
|
8
|
-
zeni_session_id: string;
|
|
9
|
-
zeni_user_id: string;
|
|
10
|
-
zeni_tenant_id: string;
|
|
11
|
-
}
|
|
12
|
-
export default function uploadAccountStatementIntoDocumentAI(fileBlob: Blob, authParams: AuthParams): Promise<UploadStatementDocumentAIPayload | undefined>;
|
package/lib/view/expenseAutomationView/epics/accountRecon/uploadAccountStatementDocumentAIHelper.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.default = uploadAccountStatementIntoDocumentAI;
|
|
16
|
-
const cross_fetch_1 = __importDefault(require("cross-fetch"));
|
|
17
|
-
const init_1 = require("../../../../init");
|
|
18
|
-
function uploadAccountStatementIntoDocumentAI(fileBlob, authParams) {
|
|
19
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
let statementUpload;
|
|
21
|
-
const urlEndPoint = `${init_1.zeniAPI.apiEndPoints.documentAIMicroServiceBaseUrl}/1.0/processors/bank-statement`;
|
|
22
|
-
const data = new FormData();
|
|
23
|
-
data.append('attachment_file_0', fileBlob);
|
|
24
|
-
const attachment_json = JSON.stringify({
|
|
25
|
-
document_type: 'reconciliation_bank_statement_upload',
|
|
26
|
-
purpose_id: 'reconciliation',
|
|
27
|
-
});
|
|
28
|
-
data.append('attachment_json_0', attachment_json);
|
|
29
|
-
try {
|
|
30
|
-
yield (0, cross_fetch_1.default)(urlEndPoint, {
|
|
31
|
-
method: 'POST',
|
|
32
|
-
body: data,
|
|
33
|
-
headers: {
|
|
34
|
-
'zeni-user-id': authParams.userId,
|
|
35
|
-
'zeni-tenant-id': authParams.tenantId,
|
|
36
|
-
'zeni-session-id': authParams.sessionId,
|
|
37
|
-
},
|
|
38
|
-
})
|
|
39
|
-
.then((response) => response.json())
|
|
40
|
-
.then((response) => {
|
|
41
|
-
if (response.status.code >= 200 && response.status.code < 300) {
|
|
42
|
-
statementUpload = response.data;
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
throw new Error(`Upload statement file failed with ${response.statusText}`);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
catch (error) {
|
|
50
|
-
throw new Error(`Upload statement file failed with ${JSON.stringify(error)}`);
|
|
51
|
-
}
|
|
52
|
-
return statementUpload;
|
|
53
|
-
});
|
|
54
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { updateAccountReconUploadStatement } from '../../../../entity/accountRecon/accountReconReducer';
|
|
3
|
-
import { updateFiles } from '../../../../entity/file/fileReducer';
|
|
4
|
-
import { RootState } from '../../../../reducer';
|
|
5
|
-
import { ZeniAPI } from '../../../../zeniAPI';
|
|
6
|
-
import { uploadAccountStatement, uploadAccountStatementSuccess } from '../../reducers/reconciliationViewReducer';
|
|
7
|
-
export type ActionType = ReturnType<typeof uploadAccountStatement> | ReturnType<typeof updateAccountReconUploadStatement> | ReturnType<typeof uploadAccountStatementSuccess> | ReturnType<typeof updateFiles>;
|
|
8
|
-
export declare const uploadAccountStatementEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<ActionType | {
|
|
9
|
-
payload: {
|
|
10
|
-
accountId: import("../../../..").ID;
|
|
11
|
-
selectedPeriod: import("../../../../commonStateTypes/timePeriod").MonthYearPeriod;
|
|
12
|
-
error: import("../../../../responsePayload").ZeniAPIStatus;
|
|
13
|
-
};
|
|
14
|
-
type: "expenseAutomationReconciliationView/uploadAccountStatementFailure";
|
|
15
|
-
}>;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.uploadAccountStatementEpic = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
|
|
7
|
-
const accountReconReducer_1 = require("../../../../entity/accountRecon/accountReconReducer");
|
|
8
|
-
const accountReconState_1 = require("../../../../entity/accountRecon/accountReconState");
|
|
9
|
-
const fileReducer_1 = require("../../../../entity/file/fileReducer");
|
|
10
|
-
const responsePayload_1 = require("../../../../responsePayload");
|
|
11
|
-
const reconciliationViewReducer_1 = require("../../reducers/reconciliationViewReducer");
|
|
12
|
-
const uploadAccountStatementEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(reconciliationViewReducer_1.uploadAccountStatement.match), (0, operators_1.mergeMap)((action) => {
|
|
13
|
-
const { accountId, selectedPeriod, payload } = action.payload;
|
|
14
|
-
const { start, end } = (0, timePeriod_1.convertToPeriod)(selectedPeriod, true);
|
|
15
|
-
const requestPayload = {
|
|
16
|
-
account_id: accountId,
|
|
17
|
-
statement_start_date: start.toString(),
|
|
18
|
-
statement_end_date: end.toString(),
|
|
19
|
-
processor_run_id: payload.processor_run_id,
|
|
20
|
-
file_id: payload.files[0].file_id,
|
|
21
|
-
};
|
|
22
|
-
const uploadAccountStatementApi$ = zeniAPI.postAndGetJSON(`${zeniAPI.apiEndPoints.reconciliationMicroServiceBaseUrl}/1.0/reconciliation/bank-statements`, requestPayload);
|
|
23
|
-
return uploadAccountStatementApi$.pipe((0, operators_1.mergeMap)((response) => {
|
|
24
|
-
if ((0, responsePayload_1.isSuccessResponse)(response) === true && response.data != null) {
|
|
25
|
-
const actions = [];
|
|
26
|
-
const accountReconKey = (0, accountReconState_1.toAccountReconKey)(accountId, selectedPeriod);
|
|
27
|
-
actions.push((0, accountReconReducer_1.updateAccountReconUploadStatement)(accountReconKey, response.data));
|
|
28
|
-
actions.push((0, fileReducer_1.updateFiles)({ files: [response.data.file] }));
|
|
29
|
-
actions.push((0, reconciliationViewReducer_1.uploadAccountStatementSuccess)({ accountId, selectedPeriod }));
|
|
30
|
-
return (0, rxjs_1.from)(actions);
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
return (0, rxjs_1.of)((0, reconciliationViewReducer_1.uploadAccountStatementFailure)({
|
|
34
|
-
accountId,
|
|
35
|
-
selectedPeriod,
|
|
36
|
-
error: response.status,
|
|
37
|
-
}));
|
|
38
|
-
}
|
|
39
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, reconciliationViewReducer_1.uploadAccountStatementFailure)({
|
|
40
|
-
accountId,
|
|
41
|
-
selectedPeriod,
|
|
42
|
-
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Upload Account Statement REST API call errored out ' +
|
|
43
|
-
JSON.stringify(error)),
|
|
44
|
-
}))));
|
|
45
|
-
}));
|
|
46
|
-
exports.uploadAccountStatementEpic = uploadAccountStatementEpic;
|