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

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.
Files changed (38) hide show
  1. package/lib/commonStateTypes/viewAndReport/viewAndReport.d.ts +2 -2
  2. package/lib/commonStateTypes/viewAndReport/viewAndReport.js +0 -1
  3. package/lib/entity/account/accountState.d.ts +1 -1
  4. package/lib/entity/accountGroup/accountGroupState.d.ts +1 -1
  5. package/lib/entity/class/classReducer.d.ts +4 -4
  6. package/lib/entity/class/classState.d.ts +1 -1
  7. package/lib/entity/forecast/forecastState.d.ts +1 -1
  8. package/lib/entity/sectionAccountsView/sectionAccountsView.d.ts +1 -1
  9. package/lib/entity/sectionClassesViewV2/sectionClassesView.d.ts +1 -1
  10. package/lib/entity/sectionClassesViewV2/sectionClassesViewReducer.d.ts +2 -2
  11. package/lib/entity/transaction/payloadTypes/transactionPayload.js +6 -1
  12. package/lib/entity/transaction/stateTypes/transaction.d.ts +2 -0
  13. package/lib/esm/commonStateTypes/viewAndReport/viewAndReport.js +0 -1
  14. package/lib/esm/entity/transaction/payloadTypes/transactionPayload.js +6 -1
  15. package/lib/esm/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js +9 -4
  16. package/lib/esm/view/expenseAutomationView/reducers/reconciliationViewReducer.js +0 -25
  17. package/lib/esm/view/expenseAutomationView/selectors/reconciliationViewSelector.js +1 -178
  18. package/lib/tsconfig.typecheck.tsbuildinfo +1 -0
  19. package/lib/view/auditReportView/auditReportViewState.d.ts +1 -1
  20. package/lib/view/billPayCard/billPayCardSelector.d.ts +1 -1
  21. package/lib/view/cardBalance/cardBalanceSelector.d.ts +1 -1
  22. package/lib/view/cashBalance/cashBalanceSelector.d.ts +1 -1
  23. package/lib/view/cashInCashOut/cashInCashOutSelector.d.ts +1 -1
  24. package/lib/view/cashPosition/cashPositionSelector.d.ts +1 -1
  25. package/lib/view/dashboard/dashboardReducer.d.ts +2 -2
  26. package/lib/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js +9 -4
  27. package/lib/view/expenseAutomationView/payload/reconciliationPayload.d.ts +0 -2
  28. package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.js +0 -25
  29. package/lib/view/expenseAutomationView/selectorTypes/reconciliationViewSelectorTypes.d.ts +0 -2
  30. package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.js +0 -177
  31. package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +0 -1
  32. package/lib/view/financeStatement/financeStatementReducer.d.ts +1 -1
  33. package/lib/view/globalMerchantView/globalMerchantViewReducer.d.ts +2 -2
  34. package/lib/view/reimbursementCard/reimbursementCardSelector.d.ts +1 -1
  35. package/lib/view/reportsResync/reportsResyncReducer.d.ts +2 -2
  36. package/lib/view/tasksCard/tasksCardSelector.d.ts +1 -1
  37. package/lib/view/topEx/topExSelector.d.ts +1 -1
  38. package/package.json +1 -1
@@ -8,5 +8,5 @@ export interface SectionClassesView {
8
8
  sectionId: ID;
9
9
  balancesByPeriod?: COABalanceGroupedByPeriod;
10
10
  }
11
- export declare function getSectionClassesViewKey(sectionId: ID, reportId: ReportID): `${string}-cash_balance` | `${string}-card_balance` | `${string}-expense_automation_card` | `${string}-operating_expenses` | `${string}-operating_expenses_by_classes` | `${string}-revenue` | `${string}-revenue_by_classes` | `${string}-net_burn_or_income` | `${string}-net_burn_or_income_story_card` | `${string}-net_burn_or_income_by_classes` | `${string}-cash_position` | `${string}-top_expenses` | `${string}-profit_and_loss` | `${string}-profit_and_loss_by_classes` | `${string}-balance_sheet` | `${string}-cash_flow` | `${string}-dashboard` | `${string}-finance_statement` | `${string}-transaction_list_of_account` | `${string}-transaction_list_missing_receipt` | `${string}-transaction_list_of_account_by_class` | `${string}-transaction_detail` | `${string}-cash_in_cash_out` | `${string}-insights_dashboard` | `${string}-company_details` | `${string}-class_list` | `${string}-account_list` | `${string}-account_list_by_type` | `${string}-vendor` | `${string}-task_card` | `${string}-bill_pay` | `${string}-reimbursement` | `${string}-bill_pay_card` | `${string}-reimbursement_card` | `${string}-bill_pay_promo_card` | `${string}-zeni_accounts` | `${string}-zeni_accounts_promo_card` | `${string}-zeni_treasury` | `${string}-charge_cards` | `${string}-other_connection` | `${string}-reimbursement_promo_card` | `${string}-onboarding` | `${string}-operating_expenses_by_vendor` | `${string}-operating_expenses_by_vendor_summary` | `${string}-vendors_tab` | `${string}-accounts_payable_aging` | `${string}-accounts_receivable_aging` | `${string}-vendor_global_review` | `${string}-prepaid_expenses` | `${string}-fixed_assets` | `${string}-notification` | `${string}-rewards_card` | `${string}-billing` | `${string}-flux_analysis_operating_expense` | `${string}-account_reconciliation` | `${string}-zeni_credit_promo_card` | `${string}-treasury_promo_card` | `${string}-excluded_account_reconciliation`;
11
+ export declare function getSectionClassesViewKey(sectionId: ID, reportId: ReportID): `${string}-cash_balance` | `${string}-card_balance` | `${string}-expense_automation_card` | `${string}-operating_expenses` | `${string}-operating_expenses_by_classes` | `${string}-revenue` | `${string}-revenue_by_classes` | `${string}-net_burn_or_income` | `${string}-net_burn_or_income_story_card` | `${string}-net_burn_or_income_by_classes` | `${string}-cash_position` | `${string}-top_expenses` | `${string}-profit_and_loss` | `${string}-profit_and_loss_by_classes` | `${string}-balance_sheet` | `${string}-cash_flow` | `${string}-dashboard` | `${string}-finance_statement` | `${string}-transaction_list_of_account` | `${string}-transaction_list_missing_receipt` | `${string}-transaction_list_of_account_by_class` | `${string}-transaction_detail` | `${string}-cash_in_cash_out` | `${string}-insights_dashboard` | `${string}-company_details` | `${string}-class_list` | `${string}-account_list` | `${string}-account_list_by_type` | `${string}-vendor` | `${string}-task_card` | `${string}-bill_pay` | `${string}-reimbursement` | `${string}-bill_pay_card` | `${string}-reimbursement_card` | `${string}-bill_pay_promo_card` | `${string}-zeni_accounts` | `${string}-zeni_accounts_promo_card` | `${string}-zeni_treasury` | `${string}-charge_cards` | `${string}-other_connection` | `${string}-reimbursement_promo_card` | `${string}-onboarding` | `${string}-operating_expenses_by_vendor` | `${string}-operating_expenses_by_vendor_summary` | `${string}-vendors_tab` | `${string}-accounts_payable_aging` | `${string}-accounts_receivable_aging` | `${string}-vendor_global_review` | `${string}-prepaid_expenses` | `${string}-fixed_assets` | `${string}-notification` | `${string}-rewards_card` | `${string}-billing` | `${string}-flux_analysis_operating_expense` | `${string}-account_reconciliation` | `${string}-zeni_credit_promo_card` | `${string}-treasury_promo_card`;
12
12
  export type SectionClassesKey = ReturnType<typeof getSectionClassesViewKey>;
@@ -4,9 +4,9 @@ import { AccountMetadataPayload } from '../account/accountPayload';
4
4
  import { ClassMetadataPayload } from '../class/classPayload';
5
5
  import { SectionClassesViewStateV2 } from './sectionClassesViewState';
6
6
  export declare const initialState: SectionClassesViewStateV2;
7
- export declare const updateSectionClassesView: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[timeframe: "month" | "year" | "quarter", sectionId: string, reportId: "cash_balance" | "card_balance" | "expense_automation_card" | "operating_expenses" | "operating_expenses_by_classes" | "revenue" | "revenue_by_classes" | "net_burn_or_income" | "net_burn_or_income_story_card" | "net_burn_or_income_by_classes" | "cash_position" | "top_expenses" | "profit_and_loss" | "profit_and_loss_by_classes" | "balance_sheet" | "cash_flow" | "dashboard" | "finance_statement" | "transaction_list_of_account" | "transaction_list_missing_receipt" | "transaction_list_of_account_by_class" | "transaction_detail" | "cash_in_cash_out" | "insights_dashboard" | "company_details" | "class_list" | "account_list" | "account_list_by_type" | "vendor" | "task_card" | "bill_pay" | "reimbursement" | "bill_pay_card" | "reimbursement_card" | "bill_pay_promo_card" | "zeni_accounts" | "zeni_accounts_promo_card" | "zeni_treasury" | "charge_cards" | "other_connection" | "reimbursement_promo_card" | "onboarding" | "operating_expenses_by_vendor" | "operating_expenses_by_vendor_summary" | "vendors_tab" | "accounts_payable_aging" | "accounts_receivable_aging" | "vendor_global_review" | "prepaid_expenses" | "fixed_assets" | "notification" | "rewards_card" | "billing" | "flux_analysis_operating_expense" | "account_reconciliation" | "zeni_credit_promo_card" | "treasury_promo_card" | "excluded_account_reconciliation", sectionPayload: SectionByClassCOABalanceGroupedPayloadV2, classesMetadataPayload: ClassMetadataPayload[], accountsMetadataPayload: AccountMetadataPayload[], currencyPayload: CurrencyPayload], {
7
+ export declare const updateSectionClassesView: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[timeframe: "month" | "year" | "quarter", sectionId: string, reportId: "cash_balance" | "card_balance" | "expense_automation_card" | "operating_expenses" | "operating_expenses_by_classes" | "revenue" | "revenue_by_classes" | "net_burn_or_income" | "net_burn_or_income_story_card" | "net_burn_or_income_by_classes" | "cash_position" | "top_expenses" | "profit_and_loss" | "profit_and_loss_by_classes" | "balance_sheet" | "cash_flow" | "dashboard" | "finance_statement" | "transaction_list_of_account" | "transaction_list_missing_receipt" | "transaction_list_of_account_by_class" | "transaction_detail" | "cash_in_cash_out" | "insights_dashboard" | "company_details" | "class_list" | "account_list" | "account_list_by_type" | "vendor" | "task_card" | "bill_pay" | "reimbursement" | "bill_pay_card" | "reimbursement_card" | "bill_pay_promo_card" | "zeni_accounts" | "zeni_accounts_promo_card" | "zeni_treasury" | "charge_cards" | "other_connection" | "reimbursement_promo_card" | "onboarding" | "operating_expenses_by_vendor" | "operating_expenses_by_vendor_summary" | "vendors_tab" | "accounts_payable_aging" | "accounts_receivable_aging" | "vendor_global_review" | "prepaid_expenses" | "fixed_assets" | "notification" | "rewards_card" | "billing" | "flux_analysis_operating_expense" | "account_reconciliation" | "zeni_credit_promo_card" | "treasury_promo_card", sectionPayload: SectionByClassCOABalanceGroupedPayloadV2, classesMetadataPayload: ClassMetadataPayload[], accountsMetadataPayload: AccountMetadataPayload[], currencyPayload: CurrencyPayload], {
8
8
  timeframe: "month" | "year" | "quarter";
9
- reportId: "cash_balance" | "card_balance" | "expense_automation_card" | "operating_expenses" | "operating_expenses_by_classes" | "revenue" | "revenue_by_classes" | "net_burn_or_income" | "net_burn_or_income_story_card" | "net_burn_or_income_by_classes" | "cash_position" | "top_expenses" | "profit_and_loss" | "profit_and_loss_by_classes" | "balance_sheet" | "cash_flow" | "dashboard" | "finance_statement" | "transaction_list_of_account" | "transaction_list_missing_receipt" | "transaction_list_of_account_by_class" | "transaction_detail" | "cash_in_cash_out" | "insights_dashboard" | "company_details" | "class_list" | "account_list" | "account_list_by_type" | "vendor" | "task_card" | "bill_pay" | "reimbursement" | "bill_pay_card" | "reimbursement_card" | "bill_pay_promo_card" | "zeni_accounts" | "zeni_accounts_promo_card" | "zeni_treasury" | "charge_cards" | "other_connection" | "reimbursement_promo_card" | "onboarding" | "operating_expenses_by_vendor" | "operating_expenses_by_vendor_summary" | "vendors_tab" | "accounts_payable_aging" | "accounts_receivable_aging" | "vendor_global_review" | "prepaid_expenses" | "fixed_assets" | "notification" | "rewards_card" | "billing" | "flux_analysis_operating_expense" | "account_reconciliation" | "zeni_credit_promo_card" | "treasury_promo_card" | "excluded_account_reconciliation";
9
+ reportId: "cash_balance" | "card_balance" | "expense_automation_card" | "operating_expenses" | "operating_expenses_by_classes" | "revenue" | "revenue_by_classes" | "net_burn_or_income" | "net_burn_or_income_story_card" | "net_burn_or_income_by_classes" | "cash_position" | "top_expenses" | "profit_and_loss" | "profit_and_loss_by_classes" | "balance_sheet" | "cash_flow" | "dashboard" | "finance_statement" | "transaction_list_of_account" | "transaction_list_missing_receipt" | "transaction_list_of_account_by_class" | "transaction_detail" | "cash_in_cash_out" | "insights_dashboard" | "company_details" | "class_list" | "account_list" | "account_list_by_type" | "vendor" | "task_card" | "bill_pay" | "reimbursement" | "bill_pay_card" | "reimbursement_card" | "bill_pay_promo_card" | "zeni_accounts" | "zeni_accounts_promo_card" | "zeni_treasury" | "charge_cards" | "other_connection" | "reimbursement_promo_card" | "onboarding" | "operating_expenses_by_vendor" | "operating_expenses_by_vendor_summary" | "vendors_tab" | "accounts_payable_aging" | "accounts_receivable_aging" | "vendor_global_review" | "prepaid_expenses" | "fixed_assets" | "notification" | "rewards_card" | "billing" | "flux_analysis_operating_expense" | "account_reconciliation" | "zeni_credit_promo_card" | "treasury_promo_card";
10
10
  sectionId: string;
11
11
  sectionPayload: SectionByClassCOABalanceGroupedPayloadV2;
12
12
  classesMetadataPayload: ClassMetadataPayload[];
@@ -37,6 +37,9 @@ const getTransactionPayloadRecipientAmount = (payload) => {
37
37
  const toTransaction = (payload) => {
38
38
  const amount = (0, exports.getTransactionPayloadAmount)(payload);
39
39
  const recipientAmount = getTransactionPayloadRecipientAmount(payload);
40
+ const lines = payload?.lines?.map((linePayload) => (0, transactionLinePayload_1.toLine)(linePayload, amount, recipientAmount));
41
+ const firstLineWithClass = lines?.find((line) => 'class' in line &&
42
+ line.class?.classId != null);
40
43
  return {
41
44
  ...(0, transactionIDPayload_1.toTransactionID)(payload),
42
45
  typeOfTransaction: 'supported',
@@ -77,10 +80,12 @@ const toTransaction = (payload) => {
77
80
  ? { targetAccountName: payload.target_account_name }
78
81
  : {}),
79
82
  linkedTransactions: payload.linked_transactions?.map((transactionIDPayload) => (0, transactionIDPayload_1.toTransactionID)(transactionIDPayload)),
80
- lines: payload?.lines?.map((linePayload) => (0, transactionLinePayload_1.toLine)(linePayload, amount, recipientAmount)),
83
+ lines,
81
84
  account: payloadHasAccountInfo(payload)
82
85
  ? (0, accountPayload_1.mapAccountBasePayloadToAccountBase)(payload)
83
86
  : undefined,
87
+ classId: firstLineWithClass?.class?.classId,
88
+ className: firstLineWithClass?.class?.className,
84
89
  syncToken: payload.sync_token?.toString(),
85
90
  paymentType: payload.payment_type ?? undefined,
86
91
  paymentTypeName: payload.payment_type_name ?? undefined,
@@ -27,6 +27,8 @@ export interface Transaction extends BaseTransaction {
27
27
  isUpdatingTransaction: boolean;
28
28
  attachments?: Attachment[];
29
29
  bookCloseDate?: ZeniDate;
30
+ classId?: ID;
31
+ className?: string;
30
32
  companyIncDate?: ZeniDate;
31
33
  customerId?: ID;
32
34
  customerName?: string;
@@ -57,7 +57,6 @@ export const ALL_REPORT_IDS = [
57
57
  'account_reconciliation',
58
58
  'zeni_credit_promo_card',
59
59
  'treasury_promo_card',
60
- 'excluded_account_reconciliation',
61
60
  ];
62
61
  export const toReportID = (v) => stringToUnion(v, ALL_REPORT_IDS);
63
62
  const ALL_REPORT_FORMAT = ['summary', 'detailed', 'more_detailed'];
@@ -33,6 +33,9 @@ const getTransactionPayloadRecipientAmount = (payload) => {
33
33
  export const toTransaction = (payload) => {
34
34
  const amount = getTransactionPayloadAmount(payload);
35
35
  const recipientAmount = getTransactionPayloadRecipientAmount(payload);
36
+ const lines = payload?.lines?.map((linePayload) => toLine(linePayload, amount, recipientAmount));
37
+ const firstLineWithClass = lines?.find((line) => 'class' in line &&
38
+ line.class?.classId != null);
36
39
  return {
37
40
  ...toTransactionID(payload),
38
41
  typeOfTransaction: 'supported',
@@ -73,10 +76,12 @@ export const toTransaction = (payload) => {
73
76
  ? { targetAccountName: payload.target_account_name }
74
77
  : {}),
75
78
  linkedTransactions: payload.linked_transactions?.map((transactionIDPayload) => toTransactionID(transactionIDPayload)),
76
- lines: payload?.lines?.map((linePayload) => toLine(linePayload, amount, recipientAmount)),
79
+ lines,
77
80
  account: payloadHasAccountInfo(payload)
78
81
  ? mapAccountBasePayloadToAccountBase(payload)
79
82
  : undefined,
83
+ classId: firstLineWithClass?.class?.classId,
84
+ className: firstLineWithClass?.class?.className,
80
85
  syncToken: payload.sync_token?.toString(),
81
86
  paymentType: payload.payment_type ?? undefined,
82
87
  paymentTypeName: payload.payment_type_name ?? undefined,
@@ -53,17 +53,22 @@ export const fetchReconciliationViewEpic = (actions$, state$, zeniAPI) => action
53
53
  return zeniAPI.getJSON(apiUrl).pipe(mergeMap((response) => {
54
54
  if (isSuccessResponse(response) && response.data != null) {
55
55
  const updateActions = [];
56
- const allTransactionsPerRecon = getAllReviewTransactionsFromReconcilePayload(response.data.reconciliation);
57
- updateActions.push(updateAccounts(response.data.accounts, 'account_reconciliation'), updateAccounts(response.data.excluded_accounts, 'excluded_account_reconciliation'), updateAllUsers({
56
+ updateActions.push(updateAccounts(response.data.accounts, 'account_reconciliation'));
57
+ updateActions.push(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), updateAccountRecon(selectedPeriod, response.data.excluded_reconciliation));
60
+ }));
61
+ updateActions.push(updateFiles({ files: response.data.files ?? [] }));
62
+ const allTransactionsPerRecon = getAllReviewTransactionsFromReconcilePayload(response.data.reconciliation);
63
+ updateActions.push(updateMultipleReconcileTransactions(allTransactionsPerRecon, 'merge'));
64
+ updateActions.push(updateAccountRecon(selectedPeriod, response.data.reconciliation));
61
65
  const reviewTabLocalData = prepareReviewTabLocalData(response.data.reconciliation[0]?.transactions?.review ?? []);
62
66
  if (accountId != null) {
63
67
  const selectedTransactionIds = getTransactionIdFromCheckedMatchedTransactionPayload(response.data.reconciliation[0].transactions.reconcile);
64
68
  updateActions.push(updateReconcileTabLocalData({
65
69
  selectedTransactionIds: selectedTransactionIds,
66
- }), initializeReconciliationReviewTabLocalData(reviewTabLocalData));
70
+ }));
71
+ updateActions.push(initializeReconciliationReviewTabLocalData(reviewTabLocalData));
67
72
  }
68
73
  updateActions.push(fetchReconciliationSuccess(selectedPeriod, response.data, refreshViewInBackground, accountId));
69
74
  return from(updateActions);
@@ -51,7 +51,6 @@ export const initialActionFetchState = {
51
51
  export const initialState = {
52
52
  accountReconciliationRecordsBySelectedPeriod: {},
53
53
  accountConnectionStatusByAccountID: {},
54
- excludedAccountIDs: [],
55
54
  fetchState: 'Not-Started',
56
55
  error: undefined,
57
56
  selectedTab: 'review',
@@ -134,9 +133,6 @@ const expenseAutomationReconciliationView = createSlice({
134
133
  reducer(draft, action) {
135
134
  if (action.payload.accountId == null) {
136
135
  updateAllReconciliation(draft, action.payload.reconciliation.accounts, action.payload.selectedPeriod, action.payload.reconciliation.reconciliation, action.payload.refreshViewInBackground);
137
- draft.excludedAccountIDs =
138
- action.payload.reconciliation.excluded_accounts.map((account) => account.account_id);
139
- updateExcludedAccountConnectionStatus(draft, action.payload.reconciliation.excluded_accounts, action.payload.reconciliation.excluded_reconciliation);
140
136
  }
141
137
  else if (action.payload.reconciliation.reconciliation.length > 0 &&
142
138
  action.payload.reconciliation.accounts.length > 0) {
@@ -520,24 +516,3 @@ function updateReconciliationByAccountID(draft, accounts, selectedPeriod, accoun
520
516
  };
521
517
  }
522
518
  }
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
- }
@@ -5,7 +5,7 @@ import omit from 'lodash/omit';
5
5
  import orderBy from 'lodash/orderBy';
6
6
  import { reduceAnyFetchState } from '../../../commonStateTypes/reduceFetchState';
7
7
  import { toMonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
8
- import { getAccountBase, getAccountsByType, } from '../../../entity/account/accountSelector';
8
+ import { getAccountsByType } from '../../../entity/account/accountSelector';
9
9
  import { getAccountReconByAccountIdAndSelectedPeriod } from '../../../entity/accountRecon/accountReconSelector';
10
10
  import { getCurrentTenant } from '../../../entity/tenant/tenantSelector';
11
11
  import { getVendorByVendorId } from '../../../entity/vendor/vendorSelector';
@@ -60,7 +60,6 @@ export const getExpenseAutomationReconciliationView = createSelector((state) =>
60
60
  reconciliationTabsState: initialReconciliationTabsState,
61
61
  actionFetchStates: initialActionFetchState,
62
62
  reviewTabSelectedVendorByTransactionId: {},
63
- excludedAccountReconciliationByAccountID: {},
64
63
  accountReconciliationBySectionID: {
65
64
  assets: {
66
65
  sectionId: 'assets',
@@ -81,26 +80,6 @@ export const getExpenseAutomationReconciliationView = createSelector((state) =>
81
80
  totalVariancePercentage: undefined,
82
81
  },
83
82
  },
84
- excludedAccountReconciliationBySectionID: {
85
- assets: {
86
- sectionId: 'assets',
87
- accountIDs: [],
88
- totalBankBalance: undefined,
89
- totalClearedBalance: undefined,
90
- totalReconciledBalance: undefined,
91
- totalVariance: undefined,
92
- totalVariancePercentage: undefined,
93
- },
94
- liabilities: {
95
- sectionId: 'liabilities',
96
- accountIDs: [],
97
- totalBankBalance: undefined,
98
- totalClearedBalance: undefined,
99
- totalReconciledBalance: undefined,
100
- totalVariance: undefined,
101
- totalVariancePercentage: undefined,
102
- },
103
- },
104
83
  };
105
84
  }
106
85
  const allAccountIDs = accountReconForMonthYearPeriod.accountIDs;
@@ -260,160 +239,6 @@ export const getExpenseAutomationReconciliationView = createSelector((state) =>
260
239
  totalVariancePercentage: liabilityTotals.variancePercentage,
261
240
  },
262
241
  };
263
- const excludedReconList = {};
264
- const excludedAssetAccountIDs = [];
265
- const excludedLiabilityAccountIDs = [];
266
- const excludedAssetTotals = {};
267
- const excludedLiabilityTotals = {};
268
- reconciliationViewState.excludedAccountIDs.forEach((accountID) => {
269
- const excludedAccount = getAccountBase(accountState, accountID, 'excluded_account_reconciliation');
270
- if (excludedAccount == null) {
271
- return;
272
- }
273
- const isAsset = excludedAccount.accountType === 'bank';
274
- const isLiability = excludedAccount.accountType === 'credit_card';
275
- if (!isAsset && !isLiability) {
276
- return;
277
- }
278
- const accountRecon = getAccountReconByAccountIdAndSelectedPeriod(state, accountID, selectedPeriod);
279
- let balanceTotal = undefined;
280
- let clearedTotal = undefined;
281
- let varianceTotal = undefined;
282
- const total = {};
283
- if (isAsset) {
284
- balanceTotal =
285
- excludedAssetTotals.balanceTotal != null
286
- ? Big(excludedAssetTotals.balanceTotal.amount)
287
- : undefined;
288
- clearedTotal =
289
- excludedAssetTotals.clearedTotal != null
290
- ? Big(excludedAssetTotals.clearedTotal.amount)
291
- : undefined;
292
- varianceTotal =
293
- excludedAssetTotals.varianceTotal != null
294
- ? Big(excludedAssetTotals.varianceTotal.amount)
295
- : undefined;
296
- }
297
- else {
298
- balanceTotal =
299
- excludedLiabilityTotals.balanceTotal != null
300
- ? Big(excludedLiabilityTotals.balanceTotal.amount)
301
- : undefined;
302
- clearedTotal =
303
- excludedLiabilityTotals.clearedTotal != null
304
- ? Big(excludedLiabilityTotals.clearedTotal.amount)
305
- : undefined;
306
- varianceTotal =
307
- excludedLiabilityTotals.varianceTotal != null
308
- ? Big(excludedLiabilityTotals.varianceTotal.amount)
309
- : undefined;
310
- }
311
- if (accountRecon?.balance != null && balanceTotal != null) {
312
- balanceTotal = balanceTotal.plus(accountRecon.balance.amount);
313
- }
314
- else if (accountRecon?.balance != null && balanceTotal == null) {
315
- balanceTotal = Big(accountRecon.balance.amount);
316
- }
317
- if (accountRecon?.clearedBalance != null && clearedTotal != null) {
318
- clearedTotal = clearedTotal.plus(accountRecon.clearedBalance.amount);
319
- }
320
- else if (accountRecon?.clearedBalance != null && clearedTotal == null) {
321
- clearedTotal = Big(accountRecon.clearedBalance.amount);
322
- }
323
- const currency = accountRecon?.currency;
324
- if (balanceTotal != null && currency != null) {
325
- total.balanceTotal = {
326
- ...currency,
327
- amount: parseFloat(balanceTotal.toFixed(2)),
328
- };
329
- }
330
- if (clearedTotal != null && currency != null) {
331
- total.clearedTotal = {
332
- ...currency,
333
- amount: parseFloat(clearedTotal.toFixed(2)),
334
- };
335
- }
336
- if (clearedTotal != null && balanceTotal != null) {
337
- varianceTotal = clearedTotal.minus(balanceTotal).abs();
338
- }
339
- else if (clearedTotal != null) {
340
- varianceTotal = clearedTotal.abs();
341
- }
342
- else if (balanceTotal != null) {
343
- varianceTotal = Big(0).minus(balanceTotal).abs();
344
- }
345
- if (varianceTotal != null && currency != null) {
346
- total.varianceTotal = {
347
- ...currency,
348
- amount: parseFloat(varianceTotal.toFixed(2)),
349
- };
350
- }
351
- total.variancePercentage =
352
- total.varianceTotal != null &&
353
- total.balanceTotal != null &&
354
- total.balanceTotal.amount !== 0
355
- ? Math.abs((total.varianceTotal.amount / total.balanceTotal.amount) * 100)
356
- : undefined;
357
- if (isAsset) {
358
- excludedAssetAccountIDs.push(accountID);
359
- excludedAssetTotals.balanceTotal = total.balanceTotal;
360
- excludedAssetTotals.clearedTotal = total.clearedTotal;
361
- excludedAssetTotals.varianceTotal = total.varianceTotal;
362
- excludedAssetTotals.variancePercentage = total.variancePercentage;
363
- }
364
- else {
365
- excludedLiabilityAccountIDs.push(accountID);
366
- excludedLiabilityTotals.balanceTotal = total.balanceTotal;
367
- excludedLiabilityTotals.clearedTotal = total.clearedTotal;
368
- excludedLiabilityTotals.varianceTotal = total.varianceTotal;
369
- excludedLiabilityTotals.variancePercentage = total.variancePercentage;
370
- }
371
- if (accountRecon != null) {
372
- const excludedAccountConnectionStatus = reconciliationViewState.accountConnectionStatusByAccountID[accountID];
373
- const excludedReconciliationRecord = accountReconForMonthYearPeriod?.reconciliationByAccountID[accountID];
374
- const defaultFetchState = {
375
- error: undefined,
376
- fetchState: 'Not-Started',
377
- };
378
- excludedReconList[accountID] = {
379
- accountConnectionStatus: excludedAccountConnectionStatus?.status ?? 'not_connected',
380
- paymentAccountId: excludedAccountConnectionStatus?.paymentAccountId,
381
- connectionInProgress: excludedAccountConnectionStatus?.connectionInProgress ?? false,
382
- accountReconEntity: accountRecon,
383
- refreshStatus: excludedReconciliationRecord?.refreshStatus ?? defaultFetchState,
384
- statementDeleteStatus: excludedReconciliationRecord?.statementDeleteStatus ??
385
- defaultFetchState,
386
- statementUpdateStatus: excludedReconciliationRecord?.statementUpdateStatus ??
387
- defaultFetchState,
388
- statementUploadStatus: excludedReconciliationRecord?.statementUploadStatus ??
389
- defaultFetchState,
390
- localData: excludedReconciliationRecord?.localData ?? {},
391
- statementParseInProgress: excludedReconciliationRecord?.statementParseInProgress ?? false,
392
- transactionFetchState: excludedReconciliationRecord?.transactionFetchState ??
393
- defaultFetchState,
394
- };
395
- }
396
- });
397
- const excludedAccountReconciliationBySectionID = {
398
- assets: {
399
- sectionId: 'assets',
400
- accountIDs: excludedAssetAccountIDs,
401
- totalBankBalance: excludedAssetTotals.balanceTotal,
402
- totalClearedBalance: excludedAssetTotals.clearedTotal,
403
- totalReconciledBalance: excludedAssetTotals.varianceTotal,
404
- totalVariance: excludedAssetTotals.varianceTotal,
405
- totalVariancePercentage: excludedAssetTotals.variancePercentage,
406
- },
407
- liabilities: {
408
- sectionId: 'liabilities',
409
- accountIDs: excludedLiabilityAccountIDs,
410
- totalBankBalance: excludedLiabilityTotals.balanceTotal,
411
- totalClearedBalance: excludedLiabilityTotals.clearedTotal,
412
- totalReconciledBalance: excludedLiabilityTotals.varianceTotal,
413
- totalVariance: excludedLiabilityTotals.varianceTotal,
414
- totalVariancePercentage: excludedLiabilityTotals.variancePercentage,
415
- },
416
- };
417
242
  const accountListNestedAccountHierarchy = getNestedAccountListHierarchy(accountListState, 'accountList');
418
243
  const classListNestedAccountHierarchy = getNestedClassListHierarchy(classListState);
419
244
  const accountsList = getAccountList(accountState, accountListState, 'accountList');
@@ -459,8 +284,6 @@ export const getExpenseAutomationReconciliationView = createSelector((state) =>
459
284
  statementUploadChosen: reconciliationViewState.statementUploadChosen,
460
285
  monthYearPeriod: selectedPeriod,
461
286
  accountReconciliationBySectionID,
462
- excludedAccountReconciliationByAccountID: excludedReconList,
463
- excludedAccountReconciliationBySectionID,
464
287
  selectedAccountId: reconciliationViewState.selectedAccountId,
465
288
  selectedReconAccount: reconciliationViewState.selectedAccountId != null &&
466
289
  reconList[reconciliationViewState.selectedAccountId] != null