@zeniai/client-epic-state 4.19.96-betaJK8 → 4.19.96-betaJK9

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.
@@ -57,7 +57,7 @@ export const fetchReconciliationViewEpic = (actions$, state$, zeniAPI) => action
57
57
  updateActions.push(updateAccounts(response.data.accounts, 'account_reconciliation'), updateAccounts(response.data.excluded_accounts, 'excluded_account_reconciliation'), updateAllUsers({
58
58
  users: response.data.users ?? [],
59
59
  updateType: 'merge',
60
- }), updateFiles({ files: response.data.files ?? [] }), updateMultipleReconcileTransactions(allTransactionsPerRecon, 'merge'), updateAccountRecon(selectedPeriod, response.data.reconciliation));
60
+ }), updateFiles({ files: response.data.files ?? [] }), updateMultipleReconcileTransactions(allTransactionsPerRecon, 'merge'), updateAccountRecon(selectedPeriod, response.data.reconciliation), updateAccountRecon(selectedPeriod, response.data.excluded_reconciliation));
61
61
  const reviewTabLocalData = prepareReviewTabLocalData(response.data.reconciliation[0]?.transactions?.review ?? []);
62
62
  if (accountId != null) {
63
63
  const selectedTransactionIds = getTransactionIdFromCheckedMatchedTransactionPayload(response.data.reconciliation[0].transactions.reconcile);
@@ -136,6 +136,7 @@ const expenseAutomationReconciliationView = createSlice({
136
136
  updateAllReconciliation(draft, action.payload.reconciliation.accounts, action.payload.selectedPeriod, action.payload.reconciliation.reconciliation, action.payload.refreshViewInBackground);
137
137
  draft.excludedAccountIDs =
138
138
  action.payload.reconciliation.excluded_accounts.map((account) => account.account_id);
139
+ updateExcludedAccountConnectionStatus(draft, action.payload.reconciliation.excluded_accounts, action.payload.reconciliation.excluded_reconciliation);
139
140
  }
140
141
  else if (action.payload.reconciliation.reconciliation.length > 0 &&
141
142
  action.payload.reconciliation.accounts.length > 0) {
@@ -519,3 +520,24 @@ function updateReconciliationByAccountID(draft, accounts, selectedPeriod, accoun
519
520
  };
520
521
  }
521
522
  }
523
+ function updateExcludedAccountConnectionStatus(draft, excludedAccounts, excludedReconciliation) {
524
+ excludedReconciliation.forEach((reconciliation) => {
525
+ const account = excludedAccounts.find((a) => a.account_id === reconciliation.account_id);
526
+ const oldConnectionStatus = draft.accountConnectionStatusByAccountID[reconciliation.account_id];
527
+ if (oldConnectionStatus == null) {
528
+ draft.accountConnectionStatusByAccountID[reconciliation.account_id] = {
529
+ status: toBankStatusCodeType(reconciliation.bank_status.code),
530
+ connectionInProgress: false,
531
+ paymentAccountId: account?.payment_account_id ?? undefined,
532
+ };
533
+ }
534
+ else {
535
+ draft.accountConnectionStatusByAccountID[reconciliation.account_id] = {
536
+ status: toBankStatusCodeType(reconciliation.bank_status.code),
537
+ connectionInProgress: reconciliation.bank_status.code === 'not_connected' &&
538
+ oldConnectionStatus.connectionInProgress === true,
539
+ paymentAccountId: account?.payment_account_id ?? undefined,
540
+ };
541
+ }
542
+ });
543
+ }
@@ -60,7 +60,7 @@ const fetchReconciliationViewEpic = (actions$, state$, zeniAPI) => actions$.pipe
60
60
  updateActions.push((0, accountReducer_1.updateAccounts)(response.data.accounts, 'account_reconciliation'), (0, accountReducer_1.updateAccounts)(response.data.excluded_accounts, 'excluded_account_reconciliation'), (0, userReducer_1.updateAllUsers)({
61
61
  users: response.data.users ?? [],
62
62
  updateType: 'merge',
63
- }), (0, fileReducer_1.updateFiles)({ files: response.data.files ?? [] }), (0, transactionReducer_1.updateMultipleReconcileTransactions)(allTransactionsPerRecon, 'merge'), (0, accountReconReducer_1.updateAccountRecon)(selectedPeriod, response.data.reconciliation));
63
+ }), (0, fileReducer_1.updateFiles)({ files: response.data.files ?? [] }), (0, transactionReducer_1.updateMultipleReconcileTransactions)(allTransactionsPerRecon, 'merge'), (0, accountReconReducer_1.updateAccountRecon)(selectedPeriod, response.data.reconciliation), (0, accountReconReducer_1.updateAccountRecon)(selectedPeriod, response.data.excluded_reconciliation));
64
64
  const reviewTabLocalData = (0, exports.prepareReviewTabLocalData)(response.data.reconciliation[0]?.transactions?.review ?? []);
65
65
  if (accountId != null) {
66
66
  const selectedTransactionIds = (0, saveReconciliationDetailEpic_1.getTransactionIdFromCheckedMatchedTransactionPayload)(response.data.reconciliation[0].transactions.reconcile);
@@ -15,6 +15,7 @@ export interface AccountAndPaymentAccountPayload extends AccountPayload {
15
15
  export interface ReconciliationPayload {
16
16
  accounts: AccountAndPaymentAccountPayload[];
17
17
  excluded_accounts: AccountAndPaymentAccountPayload[];
18
+ excluded_reconciliation: ReconciliationDataPayload[];
18
19
  files: FilePayload[];
19
20
  reconciliation: ReconciliationDataPayload[];
20
21
  users: UserPayload[];
@@ -140,6 +140,7 @@ const expenseAutomationReconciliationView = (0, toolkit_1.createSlice)({
140
140
  updateAllReconciliation(draft, action.payload.reconciliation.accounts, action.payload.selectedPeriod, action.payload.reconciliation.reconciliation, action.payload.refreshViewInBackground);
141
141
  draft.excludedAccountIDs =
142
142
  action.payload.reconciliation.excluded_accounts.map((account) => account.account_id);
143
+ updateExcludedAccountConnectionStatus(draft, action.payload.reconciliation.excluded_accounts, action.payload.reconciliation.excluded_reconciliation);
143
144
  }
144
145
  else if (action.payload.reconciliation.reconciliation.length > 0 &&
145
146
  action.payload.reconciliation.accounts.length > 0) {
@@ -523,3 +524,24 @@ function updateReconciliationByAccountID(draft, accounts, selectedPeriod, accoun
523
524
  };
524
525
  }
525
526
  }
527
+ function updateExcludedAccountConnectionStatus(draft, excludedAccounts, excludedReconciliation) {
528
+ excludedReconciliation.forEach((reconciliation) => {
529
+ const account = excludedAccounts.find((a) => a.account_id === reconciliation.account_id);
530
+ const oldConnectionStatus = draft.accountConnectionStatusByAccountID[reconciliation.account_id];
531
+ if (oldConnectionStatus == null) {
532
+ draft.accountConnectionStatusByAccountID[reconciliation.account_id] = {
533
+ status: (0, accountReconState_1.toBankStatusCodeType)(reconciliation.bank_status.code),
534
+ connectionInProgress: false,
535
+ paymentAccountId: account?.payment_account_id ?? undefined,
536
+ };
537
+ }
538
+ else {
539
+ draft.accountConnectionStatusByAccountID[reconciliation.account_id] = {
540
+ status: (0, accountReconState_1.toBankStatusCodeType)(reconciliation.bank_status.code),
541
+ connectionInProgress: reconciliation.bank_status.code === 'not_connected' &&
542
+ oldConnectionStatus.connectionInProgress === true,
543
+ paymentAccountId: account?.payment_account_id ?? undefined,
544
+ };
545
+ }
546
+ });
547
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.19.96-betaJK8",
3
+ "version": "4.19.96-betaJK9",
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",