@zeniai/client-epic-state 4.20.3-betaML22 → 4.20.3-betaML4

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 (83) 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/accountPayload.d.ts +0 -2
  4. package/lib/entity/account/accountReducer.d.ts +2 -5
  5. package/lib/entity/account/accountReducer.js +2 -7
  6. package/lib/entity/account/accountState.d.ts +1 -1
  7. package/lib/entity/accountGroup/accountGroupState.d.ts +1 -1
  8. package/lib/entity/class/classReducer.d.ts +4 -4
  9. package/lib/entity/class/classState.d.ts +1 -1
  10. package/lib/entity/forecast/forecastState.d.ts +1 -1
  11. package/lib/entity/sectionAccountsView/sectionAccountsView.d.ts +1 -1
  12. package/lib/entity/sectionClassesViewV2/sectionClassesView.d.ts +1 -1
  13. package/lib/entity/sectionClassesViewV2/sectionClassesViewReducer.d.ts +2 -2
  14. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  15. package/lib/entity/snackbar/snackbarTypes.js +0 -1
  16. package/lib/entity/tenant/tenantReducer.d.ts +2 -5
  17. package/lib/entity/tenant/tenantReducer.js +2 -8
  18. package/lib/entity/transaction/payloadTypes/transactionPayload.d.ts +0 -6
  19. package/lib/entity/transaction/payloadTypes/transactionPayload.js +0 -62
  20. package/lib/entity/transaction/stateTypes/transaction.d.ts +0 -6
  21. package/lib/epic.d.ts +7 -10
  22. package/lib/epic.js +7 -10
  23. package/lib/esm/commonStateTypes/viewAndReport/viewAndReport.js +0 -1
  24. package/lib/esm/entity/account/accountReducer.js +1 -6
  25. package/lib/esm/entity/snackbar/snackbarTypes.js +0 -1
  26. package/lib/esm/entity/tenant/tenantReducer.js +1 -7
  27. package/lib/esm/entity/transaction/payloadTypes/transactionPayload.js +0 -62
  28. package/lib/esm/epic.js +7 -10
  29. package/lib/esm/index.js +6 -6
  30. package/lib/esm/view/companyView/companyViewReducer.js +1 -26
  31. package/lib/esm/view/companyView/types/companyPassport/companyPassportViewState.js +0 -4
  32. package/lib/esm/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js +9 -4
  33. package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +1 -5
  34. package/lib/esm/view/expenseAutomationView/reducers/reconciliationViewReducer.js +3 -167
  35. package/lib/esm/view/expenseAutomationView/selectorTypes/reconciliationViewSelectorTypes.js +2 -1
  36. package/lib/esm/view/expenseAutomationView/selectors/reconciliationViewSelector.js +0 -114
  37. package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +6 -10
  38. package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +0 -6
  39. package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +2 -4
  40. package/lib/index.d.ts +6 -6
  41. package/lib/index.js +32 -38
  42. package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
  43. package/lib/view/auditReportView/auditReportViewState.d.ts +1 -1
  44. package/lib/view/billPayCard/billPayCardSelector.d.ts +1 -1
  45. package/lib/view/cardBalance/cardBalanceSelector.d.ts +1 -1
  46. package/lib/view/cashBalance/cashBalanceSelector.d.ts +1 -1
  47. package/lib/view/cashInCashOut/cashInCashOutSelector.d.ts +1 -1
  48. package/lib/view/cashPosition/cashPositionSelector.d.ts +1 -1
  49. package/lib/view/companyView/companyViewReducer.d.ts +1 -6
  50. package/lib/view/companyView/companyViewReducer.js +2 -28
  51. package/lib/view/companyView/types/companyPassport/companyPassportViewState.d.ts +0 -1
  52. package/lib/view/companyView/types/companyPassport/companyPassportViewState.js +0 -4
  53. package/lib/view/dashboard/dashboardReducer.d.ts +2 -2
  54. package/lib/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js +9 -4
  55. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  56. package/lib/view/expenseAutomationView/payload/reconciliationPayload.d.ts +0 -45
  57. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +1 -5
  58. package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.d.ts +4 -18
  59. package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.js +4 -168
  60. package/lib/view/expenseAutomationView/selectorTypes/reconciliationViewSelectorTypes.d.ts +2 -7
  61. package/lib/view/expenseAutomationView/selectorTypes/reconciliationViewSelectorTypes.js +2 -2
  62. package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.js +0 -114
  63. package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +5 -9
  64. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +0 -3
  65. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +1 -8
  66. package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +0 -14
  67. package/lib/view/financeStatement/financeStatementReducer.d.ts +1 -1
  68. package/lib/view/globalMerchantView/globalMerchantViewReducer.d.ts +2 -2
  69. package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +2 -4
  70. package/lib/view/reimbursementCard/reimbursementCardSelector.d.ts +1 -1
  71. package/lib/view/reportsResync/reportsResyncReducer.d.ts +2 -2
  72. package/lib/view/tasksCard/tasksCardSelector.d.ts +1 -1
  73. package/lib/view/topEx/topExSelector.d.ts +1 -1
  74. package/package.json +1 -1
  75. package/lib/esm/view/companyView/epic/companyPassport/updateAccountingClassesEnabledEpic.js +0 -61
  76. package/lib/esm/view/expenseAutomationView/epics/accountRecon/excludeAccountFromReconciliationEpic.js +0 -44
  77. package/lib/esm/view/expenseAutomationView/epics/accountRecon/includeAccountInReconciliationEpic.js +0 -44
  78. package/lib/view/companyView/epic/companyPassport/updateAccountingClassesEnabledEpic.d.ts +0 -10
  79. package/lib/view/companyView/epic/companyPassport/updateAccountingClassesEnabledEpic.js +0 -65
  80. package/lib/view/expenseAutomationView/epics/accountRecon/excludeAccountFromReconciliationEpic.d.ts +0 -8
  81. package/lib/view/expenseAutomationView/epics/accountRecon/excludeAccountFromReconciliationEpic.js +0 -48
  82. package/lib/view/expenseAutomationView/epics/accountRecon/includeAccountInReconciliationEpic.d.ts +0 -9
  83. package/lib/view/expenseAutomationView/epics/accountRecon/includeAccountInReconciliationEpic.js +0 -48
@@ -2,8 +2,8 @@ import { ReportID } from '../../commonStateTypes/viewAndReport/viewAndReport';
2
2
  import { ZeniAPIStatus } from '../../responsePayload';
3
3
  import { ReportsResyncState } from './reportsResyncState';
4
4
  export declare const initialReportsResyncState: ReportsResyncState;
5
- export declare const initiateReportsResync: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[reportIdToResync: "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"], {
6
- reportIdToResync: "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";
5
+ export declare const initiateReportsResync: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[reportIdToResync: "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"], {
6
+ reportIdToResync: "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";
7
7
  }, "initiateReportsResync/initiateReportsResync", never, never>, initiateReportsClassViewRefetching: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
8
8
  reportIdToResync: ReportID;
9
9
  }, "initiateReportsResync/initiateReportsClassViewRefetching">, reportsResyncSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
@@ -1,6 +1,6 @@
1
1
  import { RootState } from '../../reducer';
2
2
  export declare const getTasksCardReport: (state: RootState) => {
3
- 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";
3
+ 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";
4
4
  reportTitle: string;
5
5
  version: string | number | undefined;
6
6
  status: import("../..").Status | undefined;
@@ -4,7 +4,7 @@ import { RootState } from '../../reducer';
4
4
  import { TopExReport, TopExTimePeriodWithMetaData } from './topExSelectorTypes';
5
5
  import { TopExState } from './topExState';
6
6
  export declare const getTopExpenses: (accountState: AccountState, topExState: TopExState, numberOfExpenses?: number) => {
7
- 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";
7
+ 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";
8
8
  reportTitle: string;
9
9
  version: string | number | undefined;
10
10
  status: import("../..").Status | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.20.3-betaML22",
3
+ "version": "4.20.3-betaML4",
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",
@@ -1,61 +0,0 @@
1
- import { from } from 'rxjs';
2
- import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
3
- import { updateCompanies } from '../../../../entity/company/companyReducer';
4
- import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
5
- import { updateTenantAccountingClassesEnabled } from '../../../../entity/tenant/tenantReducer';
6
- import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
7
- import { updateAccountingClassesEnabled, updateAccountingClassesEnabledFailure, updateAccountingClassesEnabledSuccess, } from '../../companyViewReducer';
8
- export const updateAccountingClassesEnabledEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(updateAccountingClassesEnabled.match), switchMap((action) => {
9
- const { companyId, enabled } = action.payload;
10
- const tenantId = Object.values(state$.value.tenantState.tenantsById).find((t) => t.companyId === companyId)?.tenantId;
11
- return zeniAPI
12
- .putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/companies/${companyId}`, { is_accounting_classes_enabled: enabled })
13
- .pipe(mergeMap((response) => {
14
- const companies = response.data?.companies ?? [];
15
- if (isSuccessResponse(response) && companies.length > 0) {
16
- const actions = [
17
- updateCompanies({
18
- payload: companies,
19
- schema: {},
20
- }),
21
- ];
22
- if (tenantId != null) {
23
- actions.push(updateTenantAccountingClassesEnabled({
24
- enabled,
25
- tenantId,
26
- }));
27
- }
28
- actions.push(updateAccountingClassesEnabledSuccess());
29
- actions.push(openSnackbar({
30
- messageSection: 'accounting_classes_enabled_update',
31
- messageText: 'success',
32
- type: 'success',
33
- }));
34
- return from(actions);
35
- }
36
- else {
37
- return from([
38
- updateAccountingClassesEnabledFailure({
39
- status: response.status,
40
- }),
41
- openSnackbar({
42
- messageSection: 'accounting_classes_enabled_update',
43
- messageText: 'failed',
44
- type: 'error',
45
- }),
46
- ]);
47
- }
48
- }), catchError((error) => from([
49
- updateAccountingClassesEnabledFailure({
50
- status: createZeniAPIStatus('Unexpected error', 'Update Accounting Classes Enabled errored out' +
51
- (error instanceof Error
52
- ? error.message
53
- : JSON.stringify(error))),
54
- }),
55
- openSnackbar({
56
- messageSection: 'accounting_classes_enabled_update',
57
- messageText: 'failed',
58
- type: 'error',
59
- }),
60
- ])));
61
- }));
@@ -1,44 +0,0 @@
1
- import { of } from 'rxjs';
2
- import { catchError, filter, mergeMap } from 'rxjs/operators';
3
- import { changeAccountKey } from '../../../../entity/account/accountReducer';
4
- import { getAccountKey } from '../../../../entity/account/accountState';
5
- import { getAccountReconByAccountIdAndSelectedPeriod } from '../../../../entity/accountRecon/accountReconSelector';
6
- import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
7
- import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
8
- import { excludeAccountFromReconciliation, excludeAccountFromReconciliationFailure, excludeAccountFromReconciliationSuccess, } from '../../reducers/reconciliationViewReducer';
9
- export const excludeAccountFromReconciliationEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(excludeAccountFromReconciliation.match), mergeMap((action) => {
10
- const { accountId } = action.payload;
11
- const state = state$.value;
12
- const currentTenant = getCurrentTenant(state);
13
- const selectedPeriod = state.expenseAutomationViewState.selectedPeriodByTenantId[currentTenant.tenantId];
14
- const reconciliationData = getAccountReconByAccountIdAndSelectedPeriod(state, accountId, selectedPeriod);
15
- const payload = {
16
- account_id: accountId,
17
- bank_balance: reconciliationData?.balance?.amount ?? null,
18
- cleared_balance: reconciliationData?.clearedBalance?.amount ?? null,
19
- variance: reconciliationData?.variance?.amount ?? null,
20
- };
21
- const apiUrl = `${zeniAPI.apiEndPoints.reconciliationMicroServiceBaseUrl}/1.0/reconciliation/excluded-accounts`;
22
- return zeniAPI
23
- .postAndGetJSON(apiUrl, payload)
24
- .pipe(mergeMap((response) => {
25
- if (isSuccessResponse(response)) {
26
- const newAccountKey = getAccountKey('excluded_account_reconciliation', accountId);
27
- const oldAccountKey = getAccountKey('account_reconciliation', accountId);
28
- return of(excludeAccountFromReconciliationSuccess({
29
- account: response.data?.excluded_account ?? undefined,
30
- selectedPeriod,
31
- }), changeAccountKey({
32
- oldKey: oldAccountKey,
33
- newKey: newAccountKey,
34
- }));
35
- }
36
- else {
37
- return of(excludeAccountFromReconciliationFailure({
38
- error: response.status,
39
- }));
40
- }
41
- }), catchError((error) => of(excludeAccountFromReconciliationFailure({
42
- error: createZeniAPIStatus('Unexpected Error', `Exclude account from reconciliation REST API call errored out ${JSON.stringify(error)}`),
43
- }))));
44
- }));
@@ -1,44 +0,0 @@
1
- import { of } from 'rxjs';
2
- import { catchError, filter, mergeMap } from 'rxjs/operators';
3
- import { convertToPeriod } from '../../../../commonStateTypes/timePeriod';
4
- import { changeAccountKey } from '../../../../entity/account/accountReducer';
5
- import { getAccountKey } from '../../../../entity/account/accountState';
6
- import { updateAccountRecon } from '../../../../entity/accountRecon/accountReconReducer';
7
- import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
8
- import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
9
- import { includeAccountInReconciliation, includeAccountInReconciliationFailure, includeAccountInReconciliationSuccess, } from '../../reducers/reconciliationViewReducer';
10
- export const includeAccountInReconciliationEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(includeAccountInReconciliation.match), mergeMap((action) => {
11
- const { accountId } = action.payload;
12
- const state = state$.value;
13
- const currentTenant = getCurrentTenant(state);
14
- const selectedPeriod = state.expenseAutomationViewState.selectedPeriodByTenantId[currentTenant.tenantId];
15
- const period = convertToPeriod(selectedPeriod, true);
16
- const query = JSON.stringify({
17
- start_date: period.start,
18
- end_date: period.end,
19
- });
20
- const apiUrl = `${zeniAPI.apiEndPoints.reconciliationMicroServiceBaseUrl}/1.0/reconciliation/excluded-accounts/${accountId}?query=${encodeURIComponent(query)}`;
21
- return zeniAPI
22
- .deleteAndGetJSON(apiUrl)
23
- .pipe(mergeMap((response) => {
24
- if (isSuccessResponse(response) && response.data != null) {
25
- const reconciliation = response.data.reconciliation;
26
- const oldAccountKey = getAccountKey('excluded_account_reconciliation', reconciliation.account_id);
27
- const newAccountKey = getAccountKey('account_reconciliation', reconciliation.account_id);
28
- return of(updateAccountRecon(selectedPeriod, [reconciliation]), includeAccountInReconciliationSuccess({
29
- reconciliation,
30
- selectedPeriod,
31
- }), changeAccountKey({
32
- oldKey: oldAccountKey,
33
- newKey: newAccountKey,
34
- }));
35
- }
36
- else {
37
- return of(includeAccountInReconciliationFailure({
38
- error: response.status,
39
- }));
40
- }
41
- }), catchError((error) => of(includeAccountInReconciliationFailure({
42
- error: createZeniAPIStatus('Unexpected Error', `Include account in reconciliation REST API call errored out ${JSON.stringify(error)}`),
43
- }))));
44
- }));
@@ -1,10 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { Observable } from 'rxjs';
3
- import { updateCompanies } from '../../../../entity/company/companyReducer';
4
- import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
5
- import { updateTenantAccountingClassesEnabled } from '../../../../entity/tenant/tenantReducer';
6
- import { RootState } from '../../../../reducer';
7
- import { ZeniAPI } from '../../../../zeniAPI';
8
- import { updateAccountingClassesEnabled, updateAccountingClassesEnabledFailure, updateAccountingClassesEnabledSuccess } from '../../companyViewReducer';
9
- export type ActionType = ReturnType<typeof updateCompanies> | ReturnType<typeof updateTenantAccountingClassesEnabled> | ReturnType<typeof openSnackbar> | ReturnType<typeof updateAccountingClassesEnabled> | ReturnType<typeof updateAccountingClassesEnabledSuccess> | ReturnType<typeof updateAccountingClassesEnabledFailure>;
10
- export declare const updateAccountingClassesEnabledEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -1,65 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.updateAccountingClassesEnabledEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const companyReducer_1 = require("../../../../entity/company/companyReducer");
7
- const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer");
8
- const tenantReducer_1 = require("../../../../entity/tenant/tenantReducer");
9
- const responsePayload_1 = require("../../../../responsePayload");
10
- const companyViewReducer_1 = require("../../companyViewReducer");
11
- const updateAccountingClassesEnabledEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(companyViewReducer_1.updateAccountingClassesEnabled.match), (0, operators_1.switchMap)((action) => {
12
- const { companyId, enabled } = action.payload;
13
- const tenantId = Object.values(state$.value.tenantState.tenantsById).find((t) => t.companyId === companyId)?.tenantId;
14
- return zeniAPI
15
- .putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/companies/${companyId}`, { is_accounting_classes_enabled: enabled })
16
- .pipe((0, operators_1.mergeMap)((response) => {
17
- const companies = response.data?.companies ?? [];
18
- if ((0, responsePayload_1.isSuccessResponse)(response) && companies.length > 0) {
19
- const actions = [
20
- (0, companyReducer_1.updateCompanies)({
21
- payload: companies,
22
- schema: {},
23
- }),
24
- ];
25
- if (tenantId != null) {
26
- actions.push((0, tenantReducer_1.updateTenantAccountingClassesEnabled)({
27
- enabled,
28
- tenantId,
29
- }));
30
- }
31
- actions.push((0, companyViewReducer_1.updateAccountingClassesEnabledSuccess)());
32
- actions.push((0, snackbarReducer_1.openSnackbar)({
33
- messageSection: 'accounting_classes_enabled_update',
34
- messageText: 'success',
35
- type: 'success',
36
- }));
37
- return (0, rxjs_1.from)(actions);
38
- }
39
- else {
40
- return (0, rxjs_1.from)([
41
- (0, companyViewReducer_1.updateAccountingClassesEnabledFailure)({
42
- status: response.status,
43
- }),
44
- (0, snackbarReducer_1.openSnackbar)({
45
- messageSection: 'accounting_classes_enabled_update',
46
- messageText: 'failed',
47
- type: 'error',
48
- }),
49
- ]);
50
- }
51
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
52
- (0, companyViewReducer_1.updateAccountingClassesEnabledFailure)({
53
- status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'Update Accounting Classes Enabled errored out' +
54
- (error instanceof Error
55
- ? error.message
56
- : JSON.stringify(error))),
57
- }),
58
- (0, snackbarReducer_1.openSnackbar)({
59
- messageSection: 'accounting_classes_enabled_update',
60
- messageText: 'failed',
61
- type: 'error',
62
- }),
63
- ])));
64
- }));
65
- exports.updateAccountingClassesEnabledEpic = updateAccountingClassesEnabledEpic;
@@ -1,8 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { Observable } from 'rxjs';
3
- import { changeAccountKey } from '../../../../entity/account/accountReducer';
4
- import { RootState } from '../../../../reducer';
5
- import { ZeniAPI } from '../../../../zeniAPI';
6
- import { excludeAccountFromReconciliation, excludeAccountFromReconciliationFailure, excludeAccountFromReconciliationSuccess } from '../../reducers/reconciliationViewReducer';
7
- export type ActionType = ReturnType<typeof excludeAccountFromReconciliation> | ReturnType<typeof changeAccountKey> | ReturnType<typeof excludeAccountFromReconciliationSuccess> | ReturnType<typeof excludeAccountFromReconciliationFailure>;
8
- export declare const excludeAccountFromReconciliationEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -1,48 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.excludeAccountFromReconciliationEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const accountReducer_1 = require("../../../../entity/account/accountReducer");
7
- const accountState_1 = require("../../../../entity/account/accountState");
8
- const accountReconSelector_1 = require("../../../../entity/accountRecon/accountReconSelector");
9
- const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
10
- const responsePayload_1 = require("../../../../responsePayload");
11
- const reconciliationViewReducer_1 = require("../../reducers/reconciliationViewReducer");
12
- const excludeAccountFromReconciliationEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(reconciliationViewReducer_1.excludeAccountFromReconciliation.match), (0, operators_1.mergeMap)((action) => {
13
- const { accountId } = action.payload;
14
- const state = state$.value;
15
- const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
16
- const selectedPeriod = state.expenseAutomationViewState.selectedPeriodByTenantId[currentTenant.tenantId];
17
- const reconciliationData = (0, accountReconSelector_1.getAccountReconByAccountIdAndSelectedPeriod)(state, accountId, selectedPeriod);
18
- const payload = {
19
- account_id: accountId,
20
- bank_balance: reconciliationData?.balance?.amount ?? null,
21
- cleared_balance: reconciliationData?.clearedBalance?.amount ?? null,
22
- variance: reconciliationData?.variance?.amount ?? null,
23
- };
24
- const apiUrl = `${zeniAPI.apiEndPoints.reconciliationMicroServiceBaseUrl}/1.0/reconciliation/excluded-accounts`;
25
- return zeniAPI
26
- .postAndGetJSON(apiUrl, payload)
27
- .pipe((0, operators_1.mergeMap)((response) => {
28
- if ((0, responsePayload_1.isSuccessResponse)(response)) {
29
- const newAccountKey = (0, accountState_1.getAccountKey)('excluded_account_reconciliation', accountId);
30
- const oldAccountKey = (0, accountState_1.getAccountKey)('account_reconciliation', accountId);
31
- return (0, rxjs_1.of)((0, reconciliationViewReducer_1.excludeAccountFromReconciliationSuccess)({
32
- account: response.data?.excluded_account ?? undefined,
33
- selectedPeriod,
34
- }), (0, accountReducer_1.changeAccountKey)({
35
- oldKey: oldAccountKey,
36
- newKey: newAccountKey,
37
- }));
38
- }
39
- else {
40
- return (0, rxjs_1.of)((0, reconciliationViewReducer_1.excludeAccountFromReconciliationFailure)({
41
- error: response.status,
42
- }));
43
- }
44
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, reconciliationViewReducer_1.excludeAccountFromReconciliationFailure)({
45
- error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', `Exclude account from reconciliation REST API call errored out ${JSON.stringify(error)}`),
46
- }))));
47
- }));
48
- exports.excludeAccountFromReconciliationEpic = excludeAccountFromReconciliationEpic;
@@ -1,9 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { Observable } from 'rxjs';
3
- import { changeAccountKey } from '../../../../entity/account/accountReducer';
4
- import { updateAccountRecon } from '../../../../entity/accountRecon/accountReconReducer';
5
- import { RootState } from '../../../../reducer';
6
- import { ZeniAPI } from '../../../../zeniAPI';
7
- import { includeAccountInReconciliation, includeAccountInReconciliationFailure, includeAccountInReconciliationSuccess } from '../../reducers/reconciliationViewReducer';
8
- export type ActionType = ReturnType<typeof includeAccountInReconciliation> | ReturnType<typeof includeAccountInReconciliationSuccess> | ReturnType<typeof includeAccountInReconciliationFailure> | ReturnType<typeof changeAccountKey> | ReturnType<typeof updateAccountRecon>;
9
- export declare const includeAccountInReconciliationEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -1,48 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.includeAccountInReconciliationEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
7
- const accountReducer_1 = require("../../../../entity/account/accountReducer");
8
- const accountState_1 = require("../../../../entity/account/accountState");
9
- const accountReconReducer_1 = require("../../../../entity/accountRecon/accountReconReducer");
10
- const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
11
- const responsePayload_1 = require("../../../../responsePayload");
12
- const reconciliationViewReducer_1 = require("../../reducers/reconciliationViewReducer");
13
- const includeAccountInReconciliationEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(reconciliationViewReducer_1.includeAccountInReconciliation.match), (0, operators_1.mergeMap)((action) => {
14
- const { accountId } = action.payload;
15
- const state = state$.value;
16
- const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
17
- const selectedPeriod = state.expenseAutomationViewState.selectedPeriodByTenantId[currentTenant.tenantId];
18
- const period = (0, timePeriod_1.convertToPeriod)(selectedPeriod, true);
19
- const query = JSON.stringify({
20
- start_date: period.start,
21
- end_date: period.end,
22
- });
23
- const apiUrl = `${zeniAPI.apiEndPoints.reconciliationMicroServiceBaseUrl}/1.0/reconciliation/excluded-accounts/${accountId}?query=${encodeURIComponent(query)}`;
24
- return zeniAPI
25
- .deleteAndGetJSON(apiUrl)
26
- .pipe((0, operators_1.mergeMap)((response) => {
27
- if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
28
- const reconciliation = response.data.reconciliation;
29
- const oldAccountKey = (0, accountState_1.getAccountKey)('excluded_account_reconciliation', reconciliation.account_id);
30
- const newAccountKey = (0, accountState_1.getAccountKey)('account_reconciliation', reconciliation.account_id);
31
- return (0, rxjs_1.of)((0, accountReconReducer_1.updateAccountRecon)(selectedPeriod, [reconciliation]), (0, reconciliationViewReducer_1.includeAccountInReconciliationSuccess)({
32
- reconciliation,
33
- selectedPeriod,
34
- }), (0, accountReducer_1.changeAccountKey)({
35
- oldKey: oldAccountKey,
36
- newKey: newAccountKey,
37
- }));
38
- }
39
- else {
40
- return (0, rxjs_1.of)((0, reconciliationViewReducer_1.includeAccountInReconciliationFailure)({
41
- error: response.status,
42
- }));
43
- }
44
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, reconciliationViewReducer_1.includeAccountInReconciliationFailure)({
45
- error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', `Include account in reconciliation REST API call errored out ${JSON.stringify(error)}`),
46
- }))));
47
- }));
48
- exports.includeAccountInReconciliationEpic = includeAccountInReconciliationEpic;