@zeniai/client-epic-state 4.15.25 → 4.15.27
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/view/expenseAutomationView/payload/reconciliationPayload.d.ts +4 -1
- package/lib/view/expenseAutomationView/payload/reconciliationPayload.js +1 -1
- package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.d.ts +2 -2
- package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.js +24 -15
- package/lib/view/expenseAutomationView/selectorTypes/reconciliationViewSelectorTypes.d.ts +1 -0
- package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.js +1 -0
- package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +1 -0
- package/package.json +1 -1
|
@@ -7,8 +7,11 @@ import { UserPayload } from '../../../entity/user/userPayload';
|
|
|
7
7
|
import { RootState } from '../../../reducer';
|
|
8
8
|
import { ZeniAPIResponse } from '../../../responsePayload';
|
|
9
9
|
import { BalancesLocalData, SaveReconcileDetailActionPayload } from '../types/reconciliationViewState';
|
|
10
|
+
export interface AccountAndPaymentAccountPayload extends AccountPayload {
|
|
11
|
+
payment_account_id: string | null;
|
|
12
|
+
}
|
|
10
13
|
export interface ReconciliationPayload {
|
|
11
|
-
accounts:
|
|
14
|
+
accounts: AccountAndPaymentAccountPayload[];
|
|
12
15
|
reconciliation: ReconciliationDataPayload[];
|
|
13
16
|
users: UserPayload[];
|
|
14
17
|
}
|
|
@@ -12,7 +12,7 @@ function createSaveReconciliationPayloadBasedOnActionAndMethod(state, selectedPe
|
|
|
12
12
|
let payload = {};
|
|
13
13
|
payload = Object.assign({ action: action.reconcileAction === 'save_reconcile_for_later'
|
|
14
14
|
? 'save_for_later'
|
|
15
|
-
: action.reconcileAction, account_type: 'bank', bank_balance: (_a = balance === null || balance === void 0 ? void 0 : balance.amount) !== null && _a !== void 0 ? _a : 0, cleared_balance: localData.clearedBalance.amount, variance: localData.variance.amount, currency_code: balance === null || balance === void 0 ? void 0 : balance.currencyCode }, (initialClearedBalance
|
|
15
|
+
: action.reconcileAction, account_type: 'bank', bank_balance: (_a = balance === null || balance === void 0 ? void 0 : balance.amount) !== null && _a !== void 0 ? _a : 0, cleared_balance: localData.clearedBalance.amount, variance: localData.variance.amount, currency_code: balance === null || balance === void 0 ? void 0 : balance.currencyCode }, ((initialClearedBalance === null || initialClearedBalance === void 0 ? void 0 : initialClearedBalance.amount) != null
|
|
16
16
|
? {
|
|
17
17
|
initial_cleared_balance: initialClearedBalance.amount,
|
|
18
18
|
}
|
|
@@ -21,9 +21,9 @@ export declare const fetchReconciliation: import("@reduxjs/toolkit").ActionCreat
|
|
|
21
21
|
reconciliationId?: ID;
|
|
22
22
|
}, "expenseAutomationReconciliationView/fetchReconciliationFailure">, fetchReconciliationSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[selectedPeriod: MonthYearPeriod, reconciliation: ReconciliationPayload, refreshViewInBackground?: any, accountId?: string | undefined, reconciliationId?: string | undefined], {
|
|
23
23
|
selectedPeriod: MonthYearPeriod;
|
|
24
|
-
accountId: string | undefined;
|
|
25
|
-
refreshViewInBackground: any;
|
|
26
24
|
reconciliation: ReconciliationPayload;
|
|
25
|
+
refreshViewInBackground: any;
|
|
26
|
+
accountId: string | undefined;
|
|
27
27
|
reconciliationId: string | undefined;
|
|
28
28
|
}, "expenseAutomationReconciliationView/fetchReconciliationSuccess", never, never>, saveReconciliationDetail: import("@reduxjs/toolkit").ActionCreatorWithPayload<SaveReconcileDetailActionPayload, "expenseAutomationReconciliationView/saveReconciliationDetail">, saveReconciliationDetailFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<SaveReconciliationDetailFailurePayload, "expenseAutomationReconciliationView/saveReconciliationDetailFailure">, updateSelectedAccountId: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
29
29
|
selectedAccountId?: ID;
|
|
@@ -115,19 +115,20 @@ const expenseAutomationReconciliationView = (0, toolkit_1.createSlice)({
|
|
|
115
115
|
fetchReconciliationSuccess: {
|
|
116
116
|
reducer(draft, action) {
|
|
117
117
|
if (action.payload.accountId == null) {
|
|
118
|
-
updateAllReconciliation(draft, action.payload.selectedPeriod, action.payload.reconciliation.reconciliation, action.payload.refreshViewInBackground);
|
|
118
|
+
updateAllReconciliation(draft, action.payload.reconciliation.accounts, action.payload.selectedPeriod, action.payload.reconciliation.reconciliation, action.payload.refreshViewInBackground);
|
|
119
119
|
}
|
|
120
|
-
else if (action.payload.reconciliation.reconciliation.length > 0
|
|
121
|
-
|
|
120
|
+
else if (action.payload.reconciliation.reconciliation.length > 0 &&
|
|
121
|
+
action.payload.reconciliation.accounts.length > 0) {
|
|
122
|
+
updateReconciliationByAccountID(draft, action.payload.reconciliation.accounts[0], action.payload.selectedPeriod, action.payload.accountId, action.payload.reconciliation.reconciliation[0], action.payload.refreshViewInBackground);
|
|
122
123
|
}
|
|
123
124
|
},
|
|
124
125
|
prepare(selectedPeriod, reconciliation, refreshViewInBackground = false, accountId, reconciliationId) {
|
|
125
126
|
return {
|
|
126
127
|
payload: {
|
|
127
128
|
selectedPeriod,
|
|
128
|
-
accountId,
|
|
129
|
-
refreshViewInBackground,
|
|
130
129
|
reconciliation,
|
|
130
|
+
refreshViewInBackground,
|
|
131
|
+
accountId,
|
|
131
132
|
reconciliationId,
|
|
132
133
|
},
|
|
133
134
|
};
|
|
@@ -318,31 +319,34 @@ const expenseAutomationReconciliationView = (0, toolkit_1.createSlice)({
|
|
|
318
319
|
_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;
|
|
319
320
|
// Export reducer
|
|
320
321
|
exports.default = expenseAutomationReconciliationView.reducer;
|
|
321
|
-
function updateAllReconciliation(draft, selectedPeriod, reconciliationData, refreshViewInBackground) {
|
|
322
|
+
function updateAllReconciliation(draft, accounts, selectedPeriod, reconciliationData, refreshViewInBackground) {
|
|
322
323
|
draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)] = {
|
|
323
324
|
accountIDs: [],
|
|
324
325
|
reconciliationByAccountID: {},
|
|
325
326
|
};
|
|
326
327
|
const accountReconciliationRecords = draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)];
|
|
327
328
|
reconciliationData.forEach((reconciliation) => {
|
|
328
|
-
var _a;
|
|
329
|
+
var _a, _b, _c;
|
|
330
|
+
const account = accounts.find((account) => account.account_id === reconciliation.account_id);
|
|
329
331
|
const oldConnectionStatus = draft.accountConnectionStatusByAccountID[reconciliation.account_id];
|
|
330
332
|
if (oldConnectionStatus == null) {
|
|
331
333
|
draft.accountConnectionStatusByAccountID[reconciliation.account_id] = {
|
|
332
334
|
status: (0, accountReconState_1.toBankStatusCodeType)(reconciliation.bank_status.code),
|
|
333
335
|
connectionInProgress: false,
|
|
336
|
+
paymentAccountId: (_a = account === null || account === void 0 ? void 0 : account.payment_account_id) !== null && _a !== void 0 ? _a : undefined,
|
|
334
337
|
};
|
|
335
338
|
}
|
|
336
339
|
else {
|
|
337
340
|
draft.accountConnectionStatusByAccountID[reconciliation.account_id] = {
|
|
338
341
|
status: (0, accountReconState_1.toBankStatusCodeType)(reconciliation.bank_status.code),
|
|
339
|
-
connectionInProgress:
|
|
340
|
-
oldConnectionStatus.connectionInProgress === true
|
|
342
|
+
connectionInProgress: reconciliation.bank_status.code === 'not_connected' &&
|
|
343
|
+
oldConnectionStatus.connectionInProgress === true,
|
|
344
|
+
paymentAccountId: (_b = account === null || account === void 0 ? void 0 : account.payment_account_id) !== null && _b !== void 0 ? _b : undefined,
|
|
341
345
|
};
|
|
342
346
|
}
|
|
343
347
|
accountReconciliationRecords.reconciliationByAccountID[reconciliation.account_id] = {
|
|
344
348
|
accountId: reconciliation.account_id,
|
|
345
|
-
reconciliationId: (
|
|
349
|
+
reconciliationId: (_c = reconciliation.reconciliation_id) !== null && _c !== void 0 ? _c : undefined,
|
|
346
350
|
transactionFetchState: { fetchState: 'Not-Started', error: undefined },
|
|
347
351
|
refreshStatus: { fetchState: 'Not-Started', error: undefined },
|
|
348
352
|
};
|
|
@@ -359,17 +363,22 @@ function updateAllReconciliation(draft, selectedPeriod, reconciliationData, refr
|
|
|
359
363
|
draft.error = undefined;
|
|
360
364
|
}
|
|
361
365
|
}
|
|
362
|
-
function updateReconciliationByAccountID(draft, selectedPeriod, accountId, reconciliationData, refreshViewInBackground) {
|
|
363
|
-
var _a, _b;
|
|
366
|
+
function updateReconciliationByAccountID(draft, accounts, selectedPeriod, accountId, reconciliationData, refreshViewInBackground) {
|
|
367
|
+
var _a, _b, _c;
|
|
364
368
|
const oldRecord = draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)].reconciliationByAccountID[accountId];
|
|
369
|
+
const oldConnectionStatus = draft.accountConnectionStatusByAccountID[accountId];
|
|
365
370
|
draft.accountConnectionStatusByAccountID[accountId] = {
|
|
366
371
|
status: (0, accountReconState_1.toBankStatusCodeType)(reconciliationData.bank_status.code),
|
|
367
|
-
connectionInProgress:
|
|
372
|
+
connectionInProgress: oldConnectionStatus != null
|
|
373
|
+
? reconciliationData.bank_status.code === 'not_connected' &&
|
|
374
|
+
oldConnectionStatus.connectionInProgress === true
|
|
375
|
+
: false,
|
|
376
|
+
paymentAccountId: (_a = accounts.payment_account_id) !== null && _a !== void 0 ? _a : undefined,
|
|
368
377
|
};
|
|
369
378
|
if (refreshViewInBackground === true) {
|
|
370
|
-
draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)].reconciliationByAccountID[accountId] = Object.assign(Object.assign({}, oldRecord), { reconciliationId: (
|
|
379
|
+
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 } });
|
|
371
380
|
}
|
|
372
381
|
else {
|
|
373
|
-
draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)].reconciliationByAccountID[accountId] = Object.assign(Object.assign({}, oldRecord), { reconciliationId: (
|
|
382
|
+
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 } });
|
|
374
383
|
}
|
|
375
384
|
}
|
|
@@ -130,6 +130,7 @@ exports.getExpenseAutomationReconciliationView = (0, toolkit_1.createSelector)((
|
|
|
130
130
|
}
|
|
131
131
|
reconList[accountID] = {
|
|
132
132
|
accountConnectionStatus: accountConnectionStatus.status,
|
|
133
|
+
paymentAccountId: accountConnectionStatus.paymentAccountId,
|
|
133
134
|
connectionInProgress: accountConnectionStatus.connectionInProgress,
|
|
134
135
|
accountReconEntity: accountRecon,
|
|
135
136
|
refreshStatus: accountReconForMonthYearPeriod.reconciliationByAccountID[accountID]
|
|
@@ -88,6 +88,7 @@ export interface ReconciliationViewState extends FetchStateAndError {
|
|
|
88
88
|
export interface BankConnectionStatus {
|
|
89
89
|
status: BankStatusCodeType;
|
|
90
90
|
connectionInProgress: boolean;
|
|
91
|
+
paymentAccountId?: ID;
|
|
91
92
|
}
|
|
92
93
|
export interface AccountReconciliationRecords {
|
|
93
94
|
accountIDs: ID[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.15.
|
|
3
|
+
"version": "4.15.27",
|
|
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",
|