@zeniai/client-epic-state 5.1.94 → 5.1.95
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/commonStateTypes/viewAndReport/reportIDHelper.d.ts +16 -0
- package/lib/commonStateTypes/viewAndReport/reportIDHelper.js +22 -1
- package/lib/commonStateTypes/viewAndReport/viewAndReport.d.ts +2 -2
- package/lib/commonStateTypes/viewAndReport/viewAndReport.js +2 -0
- package/lib/entity/accountGroup/accountGroupState.d.ts +1 -1
- package/lib/entity/class/classReducer.d.ts +4 -4
- package/lib/entity/class/classSelectorV2.d.ts +2 -1
- package/lib/entity/class/classSelectorV2.js +7 -7
- package/lib/entity/class/classState.d.ts +1 -1
- package/lib/entity/forecast/forecastState.d.ts +1 -1
- package/lib/entity/sectionAccountsView/sectionAccountsView.d.ts +1 -1
- package/lib/entity/sectionClassesViewV2/sectionClassesView.d.ts +1 -1
- package/lib/entity/sectionClassesViewV2/sectionClassesViewReducer.d.ts +2 -2
- package/lib/entity/sectionClassesViewV2/sectionClassesViewSelector.d.ts +2 -1
- package/lib/entity/sectionClassesViewV2/sectionClassesViewSelector.js +3 -3
- package/lib/entity/sectionProjectView/sectionProjectView.d.ts +1 -1
- package/lib/entity/sectionProjectView/sectionProjectViewReducer.d.ts +2 -2
- package/lib/entity/sectionProjectView/sectionProjectViewSelector.d.ts +2 -1
- package/lib/entity/sectionProjectView/sectionProjectViewSelector.js +4 -4
- package/lib/epic.d.ts +5 -1
- package/lib/epic.js +5 -1
- package/lib/esm/commonStateTypes/viewAndReport/reportIDHelper.js +17 -0
- package/lib/esm/commonStateTypes/viewAndReport/viewAndReport.js +2 -0
- package/lib/esm/entity/class/classSelectorV2.js +7 -7
- package/lib/esm/entity/sectionClassesViewV2/sectionClassesViewSelector.js +3 -3
- package/lib/esm/entity/sectionProjectView/sectionProjectViewSelector.js +4 -4
- package/lib/esm/epic.js +5 -1
- package/lib/esm/index.js +8 -2
- package/lib/esm/reducer.js +6 -0
- package/lib/esm/view/balanceSheetClassesView/balanceSheetClassesViewEpic.js +30 -0
- package/lib/esm/view/balanceSheetClassesView/balanceSheetClassesViewPayload.js +1 -0
- package/lib/esm/view/balanceSheetClassesView/balanceSheetClassesViewReducer.js +132 -0
- package/lib/esm/view/balanceSheetClassesView/balanceSheetClassesViewSelector.js +90 -0
- package/lib/esm/view/balanceSheetClassesView/balanceSheetClassesViewSelectorTypes.js +1 -0
- package/lib/esm/view/balanceSheetClassesView/balanceSheetClassesViewState.js +1 -0
- package/lib/esm/view/balanceSheetClassesView/balanceSheetForTimeframeClassesViewEpic.js +61 -0
- package/lib/esm/view/balanceSheetProjectView/balanceSheetForTimeframeProjectViewEpic.js +63 -0
- package/lib/esm/view/balanceSheetProjectView/balanceSheetProjectViewEpic.js +30 -0
- package/lib/esm/view/balanceSheetProjectView/balanceSheetProjectViewPayload.js +1 -0
- package/lib/esm/view/balanceSheetProjectView/balanceSheetProjectViewReducer.js +128 -0
- package/lib/esm/view/balanceSheetProjectView/balanceSheetProjectViewSelector.js +90 -0
- package/lib/esm/view/balanceSheetProjectView/balanceSheetProjectViewSelectorTypes.js +1 -0
- package/lib/esm/view/balanceSheetProjectView/balanceSheetProjectViewState.js +1 -0
- package/lib/esm/view/financeStatement/financeStatementSelector.js +21 -1
- package/lib/esm/view/profitAndLossProjectView/profitAndLossProjectViewReducer.js +7 -2
- package/lib/esm/view/spendManagement/spendManagementFilterHelpers.js +1 -1
- package/lib/index.d.ts +12 -2
- package/lib/index.js +73 -48
- package/lib/reducer.d.ts +6 -0
- package/lib/reducer.js +6 -0
- package/lib/view/auditReportView/auditReportViewState.d.ts +1 -1
- package/lib/view/balanceSheetClassesView/balanceSheetClassesViewEpic.d.ts +6 -0
- package/lib/view/balanceSheetClassesView/balanceSheetClassesViewEpic.js +34 -0
- package/lib/view/balanceSheetClassesView/balanceSheetClassesViewPayload.d.ts +20 -0
- package/lib/view/balanceSheetClassesView/balanceSheetClassesViewPayload.js +2 -0
- package/lib/view/balanceSheetClassesView/balanceSheetClassesViewReducer.d.ts +34 -0
- package/lib/view/balanceSheetClassesView/balanceSheetClassesViewReducer.js +136 -0
- package/lib/view/balanceSheetClassesView/balanceSheetClassesViewSelector.d.ts +7 -0
- package/lib/view/balanceSheetClassesView/balanceSheetClassesViewSelector.js +94 -0
- package/lib/view/balanceSheetClassesView/balanceSheetClassesViewSelectorTypes.d.ts +7 -0
- package/lib/view/balanceSheetClassesView/balanceSheetClassesViewSelectorTypes.js +2 -0
- package/lib/view/balanceSheetClassesView/balanceSheetClassesViewState.d.ts +23 -0
- package/lib/view/balanceSheetClassesView/balanceSheetClassesViewState.js +2 -0
- package/lib/view/balanceSheetClassesView/balanceSheetForTimeframeClassesViewEpic.d.ts +9 -0
- package/lib/view/balanceSheetClassesView/balanceSheetForTimeframeClassesViewEpic.js +66 -0
- package/lib/view/balanceSheetProjectView/balanceSheetForTimeframeProjectViewEpic.d.ts +10 -0
- package/lib/view/balanceSheetProjectView/balanceSheetForTimeframeProjectViewEpic.js +68 -0
- package/lib/view/balanceSheetProjectView/balanceSheetProjectViewEpic.d.ts +6 -0
- package/lib/view/balanceSheetProjectView/balanceSheetProjectViewEpic.js +34 -0
- package/lib/view/balanceSheetProjectView/balanceSheetProjectViewPayload.d.ts +20 -0
- package/lib/view/balanceSheetProjectView/balanceSheetProjectViewPayload.js +2 -0
- package/lib/view/balanceSheetProjectView/balanceSheetProjectViewReducer.d.ts +33 -0
- package/lib/view/balanceSheetProjectView/balanceSheetProjectViewReducer.js +132 -0
- package/lib/view/balanceSheetProjectView/balanceSheetProjectViewSelector.d.ts +7 -0
- package/lib/view/balanceSheetProjectView/balanceSheetProjectViewSelector.js +94 -0
- package/lib/view/balanceSheetProjectView/balanceSheetProjectViewSelectorTypes.d.ts +18 -0
- package/lib/view/balanceSheetProjectView/balanceSheetProjectViewSelectorTypes.js +2 -0
- package/lib/view/balanceSheetProjectView/balanceSheetProjectViewState.d.ts +22 -0
- package/lib/view/balanceSheetProjectView/balanceSheetProjectViewState.js +2 -0
- package/lib/view/billPayCard/billPayCardSelector.d.ts +1 -1
- package/lib/view/cardBalance/cardBalanceSelector.d.ts +1 -1
- package/lib/view/cashBalance/cashBalanceSelector.d.ts +1 -1
- package/lib/view/cashInCashOut/cashInCashOutSelector.d.ts +1 -1
- package/lib/view/cashPosition/cashPositionSelector.d.ts +1 -1
- package/lib/view/dashboard/dashboardReducer.d.ts +2 -2
- package/lib/view/financeStatement/financeStatementReducer.d.ts +1 -1
- package/lib/view/financeStatement/financeStatementSelector.d.ts +4 -0
- package/lib/view/financeStatement/financeStatementSelector.js +21 -1
- package/lib/view/globalMerchantView/globalMerchantViewReducer.d.ts +2 -2
- package/lib/view/profitAndLossProjectView/profitAndLossProjectViewReducer.d.ts +1 -0
- package/lib/view/profitAndLossProjectView/profitAndLossProjectViewReducer.js +7 -2
- package/lib/view/reimbursementCard/reimbursementCardSelector.d.ts +1 -1
- package/lib/view/reportsResync/reportsResyncReducer.d.ts +2 -2
- package/lib/view/spendManagement/spendManagementFilterHelpers.js +1 -1
- package/lib/view/tasksCard/tasksCardSelector.d.ts +1 -1
- package/lib/view/topEx/topExSelector.d.ts +1 -1
- package/package.json +1 -1
package/lib/reducer.d.ts
CHANGED
|
@@ -90,6 +90,8 @@ import { AuditReportViewState } from './view/auditReportView/auditReportViewStat
|
|
|
90
90
|
import { AuthenticationViewState } from './view/authenticationView/authenticationViewState';
|
|
91
91
|
import { EntityAutoCompleteState } from './view/autoComplete/entityAutoCompleteState';
|
|
92
92
|
import { BalanceSheetState } from './view/balanceSheet/balanceSheetState';
|
|
93
|
+
import { BalanceSheetClassesViewState } from './view/balanceSheetClassesView/balanceSheetClassesViewState';
|
|
94
|
+
import { BalanceSheetProjectViewState } from './view/balanceSheetProjectView/balanceSheetProjectViewState';
|
|
93
95
|
import { BankAccountViewState } from './view/bankAccountView/bankAccountViewState';
|
|
94
96
|
import { BillPayCardState } from './view/billPayCard/billPayCardState';
|
|
95
97
|
import { CardBalanceState } from './view/cardBalance/cardBalanceState';
|
|
@@ -373,6 +375,8 @@ type ViewsState = {
|
|
|
373
375
|
auditReportViewState: AuditReportViewState;
|
|
374
376
|
authenticationViewState: AuthenticationViewState;
|
|
375
377
|
autotransferRulesState: AutoTransferRulesState;
|
|
378
|
+
balanceSheetClassesViewState: BalanceSheetClassesViewState;
|
|
379
|
+
balanceSheetProjectViewState: BalanceSheetProjectViewState;
|
|
376
380
|
balanceSheetState: BalanceSheetState;
|
|
377
381
|
bankAccountViewState: BankAccountViewState;
|
|
378
382
|
billDetailViewState: BillDetailViewState;
|
|
@@ -583,6 +587,8 @@ declare const reducers: import("redux").Reducer<import("redux").CombinedState<{
|
|
|
583
587
|
auditReportViewState: AuditReportViewState;
|
|
584
588
|
authenticationViewState: AuthenticationViewState;
|
|
585
589
|
autotransferRulesState: AutoTransferRulesState;
|
|
590
|
+
balanceSheetClassesViewState: BalanceSheetClassesViewState;
|
|
591
|
+
balanceSheetProjectViewState: BalanceSheetProjectViewState;
|
|
586
592
|
balanceSheetState: BalanceSheetState;
|
|
587
593
|
bankAccountViewState: BankAccountViewState;
|
|
588
594
|
billDetailViewState: BillDetailViewState;
|
package/lib/reducer.js
CHANGED
|
@@ -130,6 +130,8 @@ const auditReportViewReducer_1 = __importStar(require("./view/auditReportView/au
|
|
|
130
130
|
const authenticationViewReducer_1 = __importStar(require("./view/authenticationView/authenticationViewReducer"));
|
|
131
131
|
const entityAutoCompleteReducer_1 = __importStar(require("./view/autoComplete/entityAutoCompleteReducer"));
|
|
132
132
|
const balanceSheetReducer_1 = __importStar(require("./view/balanceSheet/balanceSheetReducer"));
|
|
133
|
+
const balanceSheetClassesViewReducer_1 = __importStar(require("./view/balanceSheetClassesView/balanceSheetClassesViewReducer"));
|
|
134
|
+
const balanceSheetProjectViewReducer_1 = __importStar(require("./view/balanceSheetProjectView/balanceSheetProjectViewReducer"));
|
|
133
135
|
const bankAccountViewReducer_1 = __importStar(require("./view/bankAccountView/bankAccountViewReducer"));
|
|
134
136
|
const billPayCardReducer_1 = __importStar(require("./view/billPayCard/billPayCardReducer"));
|
|
135
137
|
const cardBalanceReducer_1 = __importStar(require("./view/cardBalance/cardBalanceReducer"));
|
|
@@ -416,6 +418,8 @@ const initialViewsState = {
|
|
|
416
418
|
auditReportViewState: auditReportViewReducer_1.initialState,
|
|
417
419
|
authenticationViewState: authenticationViewReducer_1.initialState,
|
|
418
420
|
autotransferRulesState: autoTransferRulesReducer_1.initialState,
|
|
421
|
+
balanceSheetClassesViewState: balanceSheetClassesViewReducer_1.initialState,
|
|
422
|
+
balanceSheetProjectViewState: balanceSheetProjectViewReducer_1.initialState,
|
|
419
423
|
balanceSheetState: balanceSheetReducer_1.initialState,
|
|
420
424
|
bankAccountViewState: bankAccountViewReducer_1.initialState,
|
|
421
425
|
billDetailViewState: billDetailViewReducer_1.initialState,
|
|
@@ -710,6 +714,8 @@ const viewReducers = {
|
|
|
710
714
|
auditReportViewState: auditReportViewReducer_1.default,
|
|
711
715
|
authenticationViewState: authenticationViewReducer_1.default,
|
|
712
716
|
autotransferRulesState: autoTransferRulesReducer_1.default,
|
|
717
|
+
balanceSheetClassesViewState: balanceSheetClassesViewReducer_1.default,
|
|
718
|
+
balanceSheetProjectViewState: balanceSheetProjectViewReducer_1.default,
|
|
713
719
|
balanceSheetState: balanceSheetReducer_1.default,
|
|
714
720
|
bankAccountViewState: bankAccountViewReducer_1.default,
|
|
715
721
|
billDetailViewState: billDetailViewReducer_1.default,
|
|
@@ -5,7 +5,7 @@ import { ZeniDate } from '../../zeniDayJS';
|
|
|
5
5
|
import { AuditSummary } from '../reviewCompanyView/reviewCompanyViewState';
|
|
6
6
|
export declare const toAuditRuleEntityType: (v: string) => "dashboard" | "transactions" | "reports";
|
|
7
7
|
export type AuditRuleEntityType = ReturnType<typeof toAuditRuleEntityType>;
|
|
8
|
-
declare const toAuditRuleEntityIdType: (v: string) => "cash_balance" | "card_balance" | "expense_automation_card" | "operating_expenses" | "operating_expenses_by_classes" | "operating_expenses_by_projects" | "revenue" | "revenue_by_classes" | "revenue_by_projects" | "net_burn_or_income" | "net_burn_or_income_story_card" | "net_burn_or_income_by_classes" | "net_burn_or_income_by_projects" | "cash_position" | "top_expenses" | "profit_and_loss" | "profit_and_loss_by_classes" | "profit_and_loss_by_projects" | "balance_sheet" | "cash_flow" | "dashboard" | "finance_statement" | "transaction_list_of_account" | "transaction_list_missing_receipt" | "transaction_list_of_account_by_class" | "transaction_list_of_account_by_project" | "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" | "transfer_accounts" | "credit_card_transfer_accounts" | "uncategorized-expense" | "uncategorized-income";
|
|
8
|
+
declare const toAuditRuleEntityIdType: (v: string) => "cash_balance" | "card_balance" | "expense_automation_card" | "operating_expenses" | "operating_expenses_by_classes" | "operating_expenses_by_projects" | "revenue" | "revenue_by_classes" | "revenue_by_projects" | "net_burn_or_income" | "net_burn_or_income_story_card" | "net_burn_or_income_by_classes" | "net_burn_or_income_by_projects" | "cash_position" | "top_expenses" | "profit_and_loss" | "profit_and_loss_by_classes" | "profit_and_loss_by_projects" | "balance_sheet" | "balance_sheet_by_classes" | "balance_sheet_by_projects" | "cash_flow" | "dashboard" | "finance_statement" | "transaction_list_of_account" | "transaction_list_missing_receipt" | "transaction_list_of_account_by_class" | "transaction_list_of_account_by_project" | "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" | "transfer_accounts" | "credit_card_transfer_accounts" | "uncategorized-expense" | "uncategorized-income";
|
|
9
9
|
export type AuditRuleEntityIdType = ReturnType<typeof toAuditRuleEntityIdType>;
|
|
10
10
|
export declare const toAuditRuleTypeIdType: (v: string) => "accounting" | "business";
|
|
11
11
|
type AuditRuleTypeIdType = ReturnType<typeof toAuditRuleTypeIdType>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { RootState } from '../../reducer';
|
|
4
|
+
import { fetchBalanceSheetClassesView, fetchBalanceSheetForTimeframeClassesView } from './balanceSheetClassesViewReducer';
|
|
5
|
+
export type ActionType = ReturnType<typeof fetchBalanceSheetClassesView> | ReturnType<typeof fetchBalanceSheetForTimeframeClassesView>;
|
|
6
|
+
export declare const fetchBalanceSheetClassesViewEpic: (actions$: ActionsObservable<ActionType>, state: StateObservable<RootState>) => Observable<ActionType>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchBalanceSheetClassesViewEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const balanceSheetClassesViewReducer_1 = require("./balanceSheetClassesViewReducer");
|
|
7
|
+
const fetchBalanceSheetClassesViewEpic = (actions$, state) => actions$.pipe((0, operators_1.filter)(balanceSheetClassesViewReducer_1.fetchBalanceSheetClassesView.match), (0, operators_1.switchMap)((action) => {
|
|
8
|
+
const { cacheOverride } = action.payload;
|
|
9
|
+
if (cacheOverride === true) {
|
|
10
|
+
return (0, rxjs_1.from)([
|
|
11
|
+
(0, balanceSheetClassesViewReducer_1.fetchBalanceSheetForTimeframeClassesView)('month', true),
|
|
12
|
+
(0, balanceSheetClassesViewReducer_1.fetchBalanceSheetForTimeframeClassesView)('quarter', true),
|
|
13
|
+
(0, balanceSheetClassesViewReducer_1.fetchBalanceSheetForTimeframeClassesView)('year', true),
|
|
14
|
+
]);
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
const fetchActions = [];
|
|
18
|
+
const classFetchState = state.value.balanceSheetClassesViewState.fetchState;
|
|
19
|
+
if (classFetchState['month'].fetchState !== 'In-Progress' &&
|
|
20
|
+
classFetchState['month'].fetchState !== 'Completed') {
|
|
21
|
+
fetchActions.push((0, balanceSheetClassesViewReducer_1.fetchBalanceSheetForTimeframeClassesView)('month'));
|
|
22
|
+
}
|
|
23
|
+
if (classFetchState['quarter'].fetchState !== 'In-Progress' &&
|
|
24
|
+
classFetchState['quarter'].fetchState !== 'Completed') {
|
|
25
|
+
fetchActions.push((0, balanceSheetClassesViewReducer_1.fetchBalanceSheetForTimeframeClassesView)('quarter'));
|
|
26
|
+
}
|
|
27
|
+
if (classFetchState['year'].fetchState !== 'In-Progress' &&
|
|
28
|
+
classFetchState['year'].fetchState !== 'Completed') {
|
|
29
|
+
fetchActions.push((0, balanceSheetClassesViewReducer_1.fetchBalanceSheetForTimeframeClassesView)('year'));
|
|
30
|
+
}
|
|
31
|
+
return (0, rxjs_1.from)(fetchActions);
|
|
32
|
+
}
|
|
33
|
+
}));
|
|
34
|
+
exports.fetchBalanceSheetClassesViewEpic = fetchBalanceSheetClassesViewEpic;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ReportByClassMetadataPayloadV2, SectionByClassCOABalanceGroupedPayloadV2 } from '../../commonPayloadTypes/classesView/reportByClassPayloadV2';
|
|
2
|
+
import { COABalanceGroupedByPeriodPayloadV2 } from '../../commonPayloadTypes/v2/coaBalancePayload';
|
|
3
|
+
import { ZeniReportResponse } from '../../responsePayload';
|
|
4
|
+
interface AssetSubSectionsClassesView {
|
|
5
|
+
current_assets: Record<'cash_and_equivalents' | 'accounts_receivable' | 'other_current_assets', SectionByClassCOABalanceGroupedPayloadV2> & COABalanceGroupedByPeriodPayloadV2;
|
|
6
|
+
fixed_assets: SectionByClassCOABalanceGroupedPayloadV2;
|
|
7
|
+
other_assets: SectionByClassCOABalanceGroupedPayloadV2;
|
|
8
|
+
}
|
|
9
|
+
interface LiabilitySubSectionsClassesView {
|
|
10
|
+
current_liabilities: Record<'accounts_payable' | 'credit_cards' | 'other_current_liabilities', SectionByClassCOABalanceGroupedPayloadV2> & COABalanceGroupedByPeriodPayloadV2;
|
|
11
|
+
long_term_liabilities: SectionByClassCOABalanceGroupedPayloadV2;
|
|
12
|
+
}
|
|
13
|
+
export interface BalanceSheetClassesViewPayload extends ReportByClassMetadataPayloadV2 {
|
|
14
|
+
assets: COABalanceGroupedByPeriodPayloadV2 & AssetSubSectionsClassesView;
|
|
15
|
+
equity: SectionByClassCOABalanceGroupedPayloadV2;
|
|
16
|
+
liabilities: COABalanceGroupedByPeriodPayloadV2 & LiabilitySubSectionsClassesView;
|
|
17
|
+
liabilities_and_equity: COABalanceGroupedByPeriodPayloadV2;
|
|
18
|
+
}
|
|
19
|
+
export type BalanceSheetReportClassesViewResponse = ZeniReportResponse<BalanceSheetClassesViewPayload>;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { NestedClassID } from '../../commonStateTypes/classesView/nestedClassID';
|
|
2
|
+
import { AccountViewMode, ID } from '../../commonStateTypes/common';
|
|
3
|
+
import { ZeniAPIStatus, ZeniReportData } from '../../responsePayload';
|
|
4
|
+
import { BalanceSheetClassesViewPayload } from './balanceSheetClassesViewPayload';
|
|
5
|
+
import { BalanceSheetClassesViewState } from './balanceSheetClassesViewState';
|
|
6
|
+
export declare const initialState: BalanceSheetClassesViewState;
|
|
7
|
+
export declare const fetchBalanceSheetClassesView: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[cacheOverride?: boolean | undefined], {
|
|
8
|
+
cacheOverride: boolean;
|
|
9
|
+
}, "balanceSheetClassesView/fetchBalanceSheetClassesView", never, never>, fetchBalanceSheetForTimeframeClassesView: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[timeframe: "month" | "year" | "quarter", cacheOverride?: boolean | undefined], {
|
|
10
|
+
timeframe: "month" | "year" | "quarter";
|
|
11
|
+
cacheOverride: boolean;
|
|
12
|
+
}, "balanceSheetClassesView/fetchBalanceSheetForTimeframeClassesView", never, never>, updateBalanceSheetForTimeframeClassesView: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
13
|
+
report: ZeniReportData<BalanceSheetClassesViewPayload>;
|
|
14
|
+
timeframe: "month" | "quarter" | "year";
|
|
15
|
+
}, "balanceSheetClassesView/updateBalanceSheetForTimeframeClassesView">, updateBalanceSheetForTimeframeClassesViewFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[error: ZeniAPIStatus<Record<string, unknown>>, timeframe: "month" | "year" | "quarter"], {
|
|
16
|
+
error: ZeniAPIStatus<Record<string, unknown>>;
|
|
17
|
+
timeframe: "month" | "year" | "quarter";
|
|
18
|
+
}, "balanceSheetClassesView/updateBalanceSheetForTimeframeClassesViewFailure", never, never>, updateBalanceSheetClassesToFilterOut: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
19
|
+
classesToFilterOut: NestedClassID[];
|
|
20
|
+
}, "balanceSheetClassesView/updateBalanceSheetClassesToFilterOut">, updateBalanceSheetClassesViewUIState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
21
|
+
nodeCollapseState?: {
|
|
22
|
+
isCollapsed: boolean;
|
|
23
|
+
nodeId: ID;
|
|
24
|
+
};
|
|
25
|
+
resetLeftScroll?: boolean;
|
|
26
|
+
scrollPosition?: {
|
|
27
|
+
scrollTop: number;
|
|
28
|
+
scrollLeft?: number;
|
|
29
|
+
};
|
|
30
|
+
}, "balanceSheetClassesView/updateBalanceSheetClassesViewUIState">, updateBalanceSheetClassesViewAccountViewMode: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
31
|
+
viewMode: AccountViewMode;
|
|
32
|
+
}, "balanceSheetClassesView/updateBalanceSheetClassesViewAccountViewMode">, resetBalanceSheetClassesNodeCollapseState: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"balanceSheetClassesView/resetBalanceSheetClassesNodeCollapseState">, clearBalanceSheetClassesView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"balanceSheetClassesView/clearBalanceSheetClassesView">;
|
|
33
|
+
declare const _default: import("redux").Reducer<BalanceSheetClassesViewState>;
|
|
34
|
+
export default _default;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.clearBalanceSheetClassesView = exports.resetBalanceSheetClassesNodeCollapseState = exports.updateBalanceSheetClassesViewAccountViewMode = exports.updateBalanceSheetClassesViewUIState = exports.updateBalanceSheetClassesToFilterOut = exports.updateBalanceSheetForTimeframeClassesViewFailure = exports.updateBalanceSheetForTimeframeClassesView = exports.fetchBalanceSheetForTimeframeClassesView = exports.fetchBalanceSheetClassesView = exports.initialState = void 0;
|
|
5
|
+
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
+
const viewAndReportPayloadv2_1 = require("../../commonPayloadTypes/v2/viewAndReportPayloadv2");
|
|
7
|
+
const getNestedClassIDHierarchyForReport_1 = require("../../commonStateTypes/classesView/getNestedClassIDHierarchyForReport");
|
|
8
|
+
const classPayload_1 = require("../../entity/class/classPayload");
|
|
9
|
+
const rootActions_1 = require("../../rootActions");
|
|
10
|
+
exports.initialState = {
|
|
11
|
+
classHierarchy: [],
|
|
12
|
+
bookCloseDate: undefined,
|
|
13
|
+
fetchState: {
|
|
14
|
+
month: {
|
|
15
|
+
fetchState: 'Not-Started',
|
|
16
|
+
error: undefined,
|
|
17
|
+
},
|
|
18
|
+
quarter: {
|
|
19
|
+
fetchState: 'Not-Started',
|
|
20
|
+
error: undefined,
|
|
21
|
+
},
|
|
22
|
+
year: {
|
|
23
|
+
fetchState: 'Not-Started',
|
|
24
|
+
error: undefined,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
uiState: {
|
|
28
|
+
nodeCollapseState: {},
|
|
29
|
+
scrollPosition: undefined,
|
|
30
|
+
accountViewMode: 'account_group',
|
|
31
|
+
classesToFilterOut: [],
|
|
32
|
+
},
|
|
33
|
+
firstMonthOfFY: 1,
|
|
34
|
+
reportId: 'balance_sheet_by_classes',
|
|
35
|
+
reportTitle: 'balance_sheet_by_classes',
|
|
36
|
+
};
|
|
37
|
+
const balanceSheetClassesView = (0, toolkit_1.createSlice)({
|
|
38
|
+
name: 'balanceSheetClassesView',
|
|
39
|
+
initialState: exports.initialState,
|
|
40
|
+
reducers: {
|
|
41
|
+
fetchBalanceSheetClassesView: {
|
|
42
|
+
prepare(cacheOverride = false) {
|
|
43
|
+
return { payload: { cacheOverride } };
|
|
44
|
+
},
|
|
45
|
+
reducer(
|
|
46
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
47
|
+
_draft,
|
|
48
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
49
|
+
_action) {
|
|
50
|
+
// nothing to do here
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
fetchBalanceSheetForTimeframeClassesView: {
|
|
54
|
+
prepare(timeframe, cacheOverride = false) {
|
|
55
|
+
return { payload: { timeframe, cacheOverride } };
|
|
56
|
+
},
|
|
57
|
+
reducer(draft, action) {
|
|
58
|
+
const timeframe = action.payload.timeframe;
|
|
59
|
+
draft.fetchState[timeframe].fetchState = 'In-Progress';
|
|
60
|
+
draft.fetchState[timeframe].error = undefined;
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
updateBalanceSheetForTimeframeClassesView(draft, action) {
|
|
64
|
+
doUpdateBalanceSheetClassesView(draft, action.payload.timeframe, action.payload.report);
|
|
65
|
+
},
|
|
66
|
+
updateBalanceSheetForTimeframeClassesViewFailure: {
|
|
67
|
+
prepare(error, timeframe) {
|
|
68
|
+
return {
|
|
69
|
+
payload: {
|
|
70
|
+
error,
|
|
71
|
+
timeframe,
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
},
|
|
75
|
+
reducer(draft, action) {
|
|
76
|
+
draft.fetchState[action.payload.timeframe] = {
|
|
77
|
+
fetchState: 'Error',
|
|
78
|
+
error: action.payload.error,
|
|
79
|
+
};
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
updateBalanceSheetClassesToFilterOut(draft, action) {
|
|
83
|
+
draft.uiState.classesToFilterOut = action.payload.classesToFilterOut;
|
|
84
|
+
},
|
|
85
|
+
updateBalanceSheetClassesViewUIState(draft, action) {
|
|
86
|
+
const { nodeCollapseState, scrollPosition, resetLeftScroll } = action.payload;
|
|
87
|
+
if (nodeCollapseState != null) {
|
|
88
|
+
draft.uiState.nodeCollapseState = Object.assign({}, draft.uiState.nodeCollapseState, {
|
|
89
|
+
[nodeCollapseState.nodeId]: nodeCollapseState.isCollapsed,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
// Mutually exclusive: resetLeftScroll clears only scrollLeft from the
|
|
93
|
+
// recorded position, scrollPosition replaces the whole record.
|
|
94
|
+
if (resetLeftScroll === true && draft.uiState.scrollPosition != null) {
|
|
95
|
+
draft.uiState.scrollPosition.scrollLeft = undefined;
|
|
96
|
+
}
|
|
97
|
+
else if (scrollPosition != null) {
|
|
98
|
+
draft.uiState.scrollPosition = scrollPosition;
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
updateBalanceSheetClassesViewAccountViewMode(draft, action) {
|
|
102
|
+
draft.uiState.accountViewMode = action.payload.viewMode;
|
|
103
|
+
},
|
|
104
|
+
resetBalanceSheetClassesNodeCollapseState(draft) {
|
|
105
|
+
draft.uiState.nodeCollapseState = {};
|
|
106
|
+
},
|
|
107
|
+
clearBalanceSheetClassesView(draft) {
|
|
108
|
+
Object.assign(draft, exports.initialState);
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
extraReducers: (builder) => {
|
|
112
|
+
builder.addCase(rootActions_1.clearAll, (draft) => {
|
|
113
|
+
Object.assign(draft, exports.initialState);
|
|
114
|
+
});
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
_a = balanceSheetClassesView.actions, exports.fetchBalanceSheetClassesView = _a.fetchBalanceSheetClassesView, exports.fetchBalanceSheetForTimeframeClassesView = _a.fetchBalanceSheetForTimeframeClassesView, exports.updateBalanceSheetForTimeframeClassesView = _a.updateBalanceSheetForTimeframeClassesView, exports.updateBalanceSheetForTimeframeClassesViewFailure = _a.updateBalanceSheetForTimeframeClassesViewFailure, exports.updateBalanceSheetClassesToFilterOut = _a.updateBalanceSheetClassesToFilterOut, exports.updateBalanceSheetClassesViewUIState = _a.updateBalanceSheetClassesViewUIState, exports.updateBalanceSheetClassesViewAccountViewMode = _a.updateBalanceSheetClassesViewAccountViewMode, exports.resetBalanceSheetClassesNodeCollapseState = _a.resetBalanceSheetClassesNodeCollapseState, exports.clearBalanceSheetClassesView = _a.clearBalanceSheetClassesView;
|
|
118
|
+
exports.default = balanceSheetClassesView.reducer;
|
|
119
|
+
const doUpdateBalanceSheetClassesView = (draft, timeframe, balanceSheetReport) => {
|
|
120
|
+
const report = (0, viewAndReportPayloadv2_1.mapReportPayloadV2ToReportV2)(balanceSheetReport.report);
|
|
121
|
+
draft.currency = report.currency;
|
|
122
|
+
draft.dataAvailable = report.dataAvailable;
|
|
123
|
+
draft.firstMonthOfFY = report.firstMonthOfFY;
|
|
124
|
+
draft.bookCloseDate = report.bookCloseDate;
|
|
125
|
+
draft.status = report.status;
|
|
126
|
+
draft.fetchState[timeframe].fetchState = 'Completed';
|
|
127
|
+
draft.fetchState[timeframe].error = undefined;
|
|
128
|
+
const classMetadata = balanceSheetReport.report.classes.map((eachClass) => (0, classPayload_1.toClassMetadata)(eachClass));
|
|
129
|
+
// Populated once and then left alone, so a per-timeframe response cannot
|
|
130
|
+
// clobber a hierarchy built from a full one. A class added mid-session is
|
|
131
|
+
// therefore not picked up until the store is cleared, even by a hard refresh —
|
|
132
|
+
// the same trade-off profitAndLossClassesViewReducer makes.
|
|
133
|
+
if (draft.classHierarchy.length <= 0) {
|
|
134
|
+
draft.classHierarchy = (0, getNestedClassIDHierarchyForReport_1.geNestedClassIDHierarchyForReport)(classMetadata);
|
|
135
|
+
}
|
|
136
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { COABalancesFilterClassesView } from '../../commonStateTypes/coaBalance/coaBalancesFilterClassesView';
|
|
2
|
+
import { AccountState } from '../../entity/account/accountState';
|
|
3
|
+
import { ClassState } from '../../entity/class/classState';
|
|
4
|
+
import { SectionClassesViewStateV2 } from '../../entity/sectionClassesViewV2/sectionClassesViewState';
|
|
5
|
+
import { BalanceSheetClassesViewReport } from './balanceSheetClassesViewSelectorTypes';
|
|
6
|
+
import { BalanceSheetClassesViewState } from './balanceSheetClassesViewState';
|
|
7
|
+
export declare const getBalanceSheetClassesView: (filter: COABalancesFilterClassesView, accountState: AccountState, classState: ClassState, sectionsState: SectionClassesViewStateV2, balanceSheetClassesViewState: BalanceSheetClassesViewState) => BalanceSheetClassesViewReport;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getBalanceSheetClassesView = void 0;
|
|
4
|
+
const getAdditionalBalances_1 = require("../../commonStateTypes/coaBalance/additionalBalances/getAdditionalBalances");
|
|
5
|
+
const getSumOfBalancesGroupedByPeriod_1 = require("../../commonStateTypes/coaBalance/classBalances/getSumOfBalancesGroupedByPeriod");
|
|
6
|
+
const coaBalance_1 = require("../../commonStateTypes/coaBalance/coaBalance");
|
|
7
|
+
const reduceFetchState_1 = require("../../commonStateTypes/reduceFetchState");
|
|
8
|
+
const sectionClassesViewSelector_1 = require("../../entity/sectionClassesViewV2/sectionClassesViewSelector");
|
|
9
|
+
const balanceSheetSelectorTypes_1 = require("../balanceSheet/balanceSheetSelectorTypes");
|
|
10
|
+
// The section-id constants and the display order are both module-level, so the
|
|
11
|
+
// sorted groupings are computed once instead of on every selector call.
|
|
12
|
+
const byDisplayOrder = (a, b) => balanceSheetSelectorTypes_1.balanceSheetSectionIdsInOrder.indexOf(a) -
|
|
13
|
+
balanceSheetSelectorTypes_1.balanceSheetSectionIdsInOrder.indexOf(b);
|
|
14
|
+
const ASSET_IDS_IN_ORDER = [...balanceSheetSelectorTypes_1.ALL_BALANCE_SHEET_REPORT_VIEW_ASSET_IDS].sort(byDisplayOrder);
|
|
15
|
+
const LIABILITY_IDS_IN_ORDER = [
|
|
16
|
+
...balanceSheetSelectorTypes_1.ALL_BALANCE_SHEET_REPORT_VIEW_LIABILITY_IDS,
|
|
17
|
+
].sort(byDisplayOrder);
|
|
18
|
+
const EQUITY_IDS_IN_ORDER = [...balanceSheetSelectorTypes_1.ALL_BALANCE_SHEET_REPORT_VIEW_EQUITY_IDS].sort(byDisplayOrder);
|
|
19
|
+
const getBalanceSheetClassesView = (filter, accountState, classState, sectionsState, balanceSheetClassesViewState) => {
|
|
20
|
+
const fetchState = (0, reduceFetchState_1.reduceFetchStateParallelTimeframes)([
|
|
21
|
+
balanceSheetClassesViewState.fetchState.month,
|
|
22
|
+
balanceSheetClassesViewState.fetchState.quarter,
|
|
23
|
+
balanceSheetClassesViewState.fetchState.year,
|
|
24
|
+
]);
|
|
25
|
+
const reportId = 'balance_sheet_by_classes';
|
|
26
|
+
const sections = {};
|
|
27
|
+
const calculatedSections = {};
|
|
28
|
+
if (fetchState.fetchState === 'Completed') {
|
|
29
|
+
// Balance Sheet balances are point-in-time, so the extra columns must be
|
|
30
|
+
// read as snapshots rather than period sums.
|
|
31
|
+
const additionalBalancesOptions = (0, getAdditionalBalances_1.newAdditionalBalancesOptions)(true);
|
|
32
|
+
balanceSheetSelectorTypes_1.ALL_BALANCE_SHEET_REPORT_VIEW_SECTION_IDS.forEach((sectionId) => {
|
|
33
|
+
sections[`${sectionId}`] = (0, sectionClassesViewSelector_1.getSectionClassesViewReport)(accountState, classState, sectionsState, {
|
|
34
|
+
reportId,
|
|
35
|
+
sectionId,
|
|
36
|
+
}, filter, additionalBalancesOptions);
|
|
37
|
+
});
|
|
38
|
+
const totalCurrentAssetsBalancesByPeriod = (0, getSumOfBalancesGroupedByPeriod_1.getSumOfBalancesByGroupedByPeriod)([
|
|
39
|
+
sections['cashAndEquivalents'].sectionBalancesTotalByPeriod,
|
|
40
|
+
sections['accountsReceiable'].sectionBalancesTotalByPeriod,
|
|
41
|
+
sections['otherCurrentAssets'].sectionBalancesTotalByPeriod,
|
|
42
|
+
]);
|
|
43
|
+
calculatedSections['totalCurrentAssets'] = (0, coaBalance_1.getCOABalances)(totalCurrentAssetsBalancesByPeriod, filter, additionalBalancesOptions);
|
|
44
|
+
const totalAssetsBalancesByPeriod = (0, getSumOfBalancesGroupedByPeriod_1.getSumOfBalancesByGroupedByPeriod)([
|
|
45
|
+
totalCurrentAssetsBalancesByPeriod ?? {},
|
|
46
|
+
sections['fixedAssets'].sectionBalancesTotalByPeriod,
|
|
47
|
+
sections['otherAssets'].sectionBalancesTotalByPeriod,
|
|
48
|
+
]);
|
|
49
|
+
calculatedSections['totalAssets'] = (0, coaBalance_1.getCOABalances)(totalAssetsBalancesByPeriod, filter, additionalBalancesOptions);
|
|
50
|
+
const totalCurrentLiabilitiesBalancesByPeriod = (0, getSumOfBalancesGroupedByPeriod_1.getSumOfBalancesByGroupedByPeriod)([
|
|
51
|
+
sections['accountsPayable'].sectionBalancesTotalByPeriod,
|
|
52
|
+
sections['creditCards'].sectionBalancesTotalByPeriod,
|
|
53
|
+
sections['otherCurrentLiabilities'].sectionBalancesTotalByPeriod,
|
|
54
|
+
]);
|
|
55
|
+
calculatedSections['totalCurrentLiabilities'] = (0, coaBalance_1.getCOABalances)(totalCurrentLiabilitiesBalancesByPeriod, filter, additionalBalancesOptions);
|
|
56
|
+
calculatedSections['totalNonCurrentLiabilities'] = (0, coaBalance_1.getCOABalances)(sections['longTermLiabilities'].sectionBalancesTotalByPeriod, filter, additionalBalancesOptions);
|
|
57
|
+
const totalLiabilitiesBalancesByPeriod = (0, getSumOfBalancesGroupedByPeriod_1.getSumOfBalancesByGroupedByPeriod)([
|
|
58
|
+
totalCurrentLiabilitiesBalancesByPeriod ?? {},
|
|
59
|
+
sections['longTermLiabilities'].sectionBalancesTotalByPeriod,
|
|
60
|
+
]);
|
|
61
|
+
calculatedSections['totalLiabilities'] = (0, coaBalance_1.getCOABalances)(totalLiabilitiesBalancesByPeriod, filter, additionalBalancesOptions);
|
|
62
|
+
calculatedSections['totalEquity'] = (0, coaBalance_1.getCOABalances)(sections['equity'].sectionBalancesTotalByPeriod, filter, additionalBalancesOptions);
|
|
63
|
+
const liabilitiesAndEquityBalancesByPeriod = (0, getSumOfBalancesGroupedByPeriod_1.getSumOfBalancesByGroupedByPeriod)([
|
|
64
|
+
totalLiabilitiesBalancesByPeriod ?? {},
|
|
65
|
+
sections['equity'].sectionBalancesTotalByPeriod,
|
|
66
|
+
]);
|
|
67
|
+
calculatedSections['liabilitiesAndEquity'] = (0, coaBalance_1.getCOABalances)(liabilitiesAndEquityBalancesByPeriod, filter, additionalBalancesOptions);
|
|
68
|
+
}
|
|
69
|
+
const classHierarchy = balanceSheetClassesViewState.classHierarchy;
|
|
70
|
+
return {
|
|
71
|
+
sections,
|
|
72
|
+
calculatedSections,
|
|
73
|
+
reportId: balanceSheetClassesViewState.reportId,
|
|
74
|
+
reportTitle: balanceSheetClassesViewState.reportTitle,
|
|
75
|
+
firstMonthOfFY: balanceSheetClassesViewState.firstMonthOfFY,
|
|
76
|
+
dataAvailable: balanceSheetClassesViewState.dataAvailable,
|
|
77
|
+
bookCloseDate: balanceSheetClassesViewState.bookCloseDate,
|
|
78
|
+
version: balanceSheetClassesViewState.version,
|
|
79
|
+
status: balanceSheetClassesViewState.status,
|
|
80
|
+
fetchState: fetchState.fetchState,
|
|
81
|
+
error: fetchState.error,
|
|
82
|
+
filter,
|
|
83
|
+
uiState: balanceSheetClassesViewState.uiState,
|
|
84
|
+
classHierarchy,
|
|
85
|
+
classesToFilterOut: balanceSheetClassesViewState.uiState.classesToFilterOut,
|
|
86
|
+
idsInOrder: balanceSheetSelectorTypes_1.balanceSheetSectionIdsInOrder,
|
|
87
|
+
rootSectionsWithSubSectionIds: {
|
|
88
|
+
assets: ASSET_IDS_IN_ORDER,
|
|
89
|
+
liabilities: LIABILITY_IDS_IN_ORDER,
|
|
90
|
+
equity: EQUITY_IDS_IN_ORDER,
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
exports.getBalanceSheetClassesView = getBalanceSheetClassesView;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ClassesViewSelectorReportV2 } from '../../commonStateTypes/selectorTypes/classesViewSelectorReport';
|
|
2
|
+
import { BalanceSheetReportViewCalculatedSectionID, BalanceSheetReportViewSectionID, SectionIdsWithSubSectionIds } from '../balanceSheet/balanceSheetSelectorTypes';
|
|
3
|
+
import { BalanceSheetClassesViewUIState } from './balanceSheetClassesViewState';
|
|
4
|
+
export interface BalanceSheetClassesViewReport extends ClassesViewSelectorReportV2<BalanceSheetReportViewSectionID, BalanceSheetReportViewCalculatedSectionID> {
|
|
5
|
+
rootSectionsWithSubSectionIds: SectionIdsWithSubSectionIds;
|
|
6
|
+
uiState: BalanceSheetClassesViewUIState;
|
|
7
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Currency } from '../../commonStateTypes/amount';
|
|
2
|
+
import { NestedClassHierarchyForReport, NestedClassID } from '../../commonStateTypes/classesView/nestedClassID';
|
|
3
|
+
import { AccountViewMode, FetchStateAndError, ID } from '../../commonStateTypes/common';
|
|
4
|
+
import { Report } from '../../commonStateTypes/viewAndReport/viewAndReport';
|
|
5
|
+
export interface BalanceSheetClassesViewUIState {
|
|
6
|
+
accountViewMode: AccountViewMode;
|
|
7
|
+
classesToFilterOut: NestedClassID[];
|
|
8
|
+
nodeCollapseState: Record<ID, boolean>;
|
|
9
|
+
scrollPosition: {
|
|
10
|
+
scrollTop: number;
|
|
11
|
+
scrollLeft?: number;
|
|
12
|
+
} | undefined;
|
|
13
|
+
}
|
|
14
|
+
export interface BalanceSheetClassesViewState extends Report {
|
|
15
|
+
classHierarchy: NestedClassHierarchyForReport[];
|
|
16
|
+
fetchState: {
|
|
17
|
+
month: FetchStateAndError;
|
|
18
|
+
quarter: FetchStateAndError;
|
|
19
|
+
year: FetchStateAndError;
|
|
20
|
+
};
|
|
21
|
+
uiState: BalanceSheetClassesViewUIState;
|
|
22
|
+
currency?: Currency;
|
|
23
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { updateSectionClassesView } from '../../entity/sectionClassesViewV2/sectionClassesViewReducer';
|
|
4
|
+
import { RootState } from '../../reducer';
|
|
5
|
+
import { ZeniAPI } from '../../zeniAPI';
|
|
6
|
+
import { fetchBalanceSheetForTimeframeClassesView, updateBalanceSheetForTimeframeClassesView, updateBalanceSheetForTimeframeClassesViewFailure } from './balanceSheetClassesViewReducer';
|
|
7
|
+
export type ActionType = ReturnType<typeof fetchBalanceSheetForTimeframeClassesView> | ReturnType<typeof updateBalanceSheetForTimeframeClassesView> | ReturnType<typeof updateBalanceSheetForTimeframeClassesViewFailure> | ReturnType<typeof updateSectionClassesView>;
|
|
8
|
+
export declare const reportIdUniqueKey: () => "balance_sheet_by_classes";
|
|
9
|
+
export declare const fetchBalanceSheetForTimeframeClassesViewEpic: (actions$: ActionsObservable<ActionType>, _: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchBalanceSheetForTimeframeClassesViewEpic = exports.reportIdUniqueKey = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const sectionClassesViewReducer_1 = require("../../entity/sectionClassesViewV2/sectionClassesViewReducer");
|
|
7
|
+
const responsePayload_1 = require("../../responsePayload");
|
|
8
|
+
const balanceSheetPayload_1 = require("../balanceSheet/balanceSheetPayload");
|
|
9
|
+
const balanceSheetClassesViewReducer_1 = require("./balanceSheetClassesViewReducer");
|
|
10
|
+
const getTimeSeriesGroup = (timeframe) => {
|
|
11
|
+
switch (timeframe) {
|
|
12
|
+
case 'month':
|
|
13
|
+
return 'months';
|
|
14
|
+
case 'quarter':
|
|
15
|
+
return 'quarters';
|
|
16
|
+
case 'year':
|
|
17
|
+
return 'years';
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
const reportIdUniqueKey = () => 'balance_sheet_by_classes';
|
|
21
|
+
exports.reportIdUniqueKey = reportIdUniqueKey;
|
|
22
|
+
const fetchBalanceSheetForTimeframeClassesViewEpic = (actions$, _, zeniAPI) => actions$.pipe((0, operators_1.filter)(balanceSheetClassesViewReducer_1.fetchBalanceSheetForTimeframeClassesView.match), (0, operators_1.mergeMap)((action) => {
|
|
23
|
+
const queryValue = {
|
|
24
|
+
// The report endpoint rejects a falsey is_full_response, so it is fixed.
|
|
25
|
+
is_full_response: true,
|
|
26
|
+
time_series_groups: [getTimeSeriesGroup(action.payload.timeframe)],
|
|
27
|
+
is_group_by_class: true,
|
|
28
|
+
// Only sent when refreshing: the flag makes the backend bypass its saved
|
|
29
|
+
// report and regenerate, so a normal lookup must not carry it.
|
|
30
|
+
...(action.payload.cacheOverride === true
|
|
31
|
+
? { is_hard_refresh: true }
|
|
32
|
+
: {}),
|
|
33
|
+
};
|
|
34
|
+
return zeniAPI
|
|
35
|
+
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/2.0/reports/balance_sheet?query=${encodeURIComponent(JSON.stringify(queryValue))}`)
|
|
36
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
37
|
+
if (response.data != null && (0, responsePayload_1.isSuccessResponse)(response)) {
|
|
38
|
+
const actions = [];
|
|
39
|
+
const { report } = response.data;
|
|
40
|
+
const currency = report.currency;
|
|
41
|
+
actions.push((0, sectionClassesViewReducer_1.updateSectionClassesView)(action.payload.timeframe, (0, balanceSheetPayload_1.toSectionId)('cash_and_equivalents'), (0, exports.reportIdUniqueKey)(), report.assets.current_assets.cash_and_equivalents, report.classes, report.accounts, currency));
|
|
42
|
+
actions.push((0, sectionClassesViewReducer_1.updateSectionClassesView)(action.payload.timeframe, (0, balanceSheetPayload_1.toSectionId)('accounts_receivable'), (0, exports.reportIdUniqueKey)(), report.assets.current_assets.accounts_receivable, report.classes, report.accounts, currency));
|
|
43
|
+
actions.push((0, sectionClassesViewReducer_1.updateSectionClassesView)(action.payload.timeframe, (0, balanceSheetPayload_1.toSectionId)('other_current_assets'), (0, exports.reportIdUniqueKey)(), report.assets.current_assets.other_current_assets, report.classes, report.accounts, currency));
|
|
44
|
+
actions.push((0, sectionClassesViewReducer_1.updateSectionClassesView)(action.payload.timeframe, (0, balanceSheetPayload_1.toSectionId)('fixed_assets'), (0, exports.reportIdUniqueKey)(), report.assets.fixed_assets, report.classes, report.accounts, currency));
|
|
45
|
+
actions.push((0, sectionClassesViewReducer_1.updateSectionClassesView)(action.payload.timeframe, (0, balanceSheetPayload_1.toSectionId)('other_assets'), (0, exports.reportIdUniqueKey)(), report.assets.other_assets, report.classes, report.accounts, currency));
|
|
46
|
+
actions.push((0, sectionClassesViewReducer_1.updateSectionClassesView)(action.payload.timeframe, (0, balanceSheetPayload_1.toSectionId)('accounts_payable'), (0, exports.reportIdUniqueKey)(), report.liabilities.current_liabilities.accounts_payable, report.classes, report.accounts, currency));
|
|
47
|
+
actions.push((0, sectionClassesViewReducer_1.updateSectionClassesView)(action.payload.timeframe, (0, balanceSheetPayload_1.toSectionId)('credit_cards'), (0, exports.reportIdUniqueKey)(), report.liabilities.current_liabilities.credit_cards, report.classes, report.accounts, currency));
|
|
48
|
+
actions.push((0, sectionClassesViewReducer_1.updateSectionClassesView)(action.payload.timeframe, (0, balanceSheetPayload_1.toSectionId)('other_current_liabilities'), (0, exports.reportIdUniqueKey)(), report.liabilities.current_liabilities
|
|
49
|
+
.other_current_liabilities, report.classes, report.accounts, currency));
|
|
50
|
+
actions.push((0, sectionClassesViewReducer_1.updateSectionClassesView)(action.payload.timeframe, (0, balanceSheetPayload_1.toSectionId)('long_term_liabilities'), (0, exports.reportIdUniqueKey)(), report.liabilities.long_term_liabilities, report.classes, report.accounts, currency));
|
|
51
|
+
actions.push((0, sectionClassesViewReducer_1.updateSectionClassesView)(action.payload.timeframe, (0, balanceSheetPayload_1.toSectionId)('equity'), (0, exports.reportIdUniqueKey)(), report.equity, report.classes, report.accounts, currency));
|
|
52
|
+
actions.push((0, balanceSheetClassesViewReducer_1.updateBalanceSheetForTimeframeClassesView)({
|
|
53
|
+
timeframe: action.payload.timeframe,
|
|
54
|
+
report: response.data,
|
|
55
|
+
}));
|
|
56
|
+
return (0, rxjs_1.from)(actions);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
return (0, rxjs_1.of)((0, balanceSheetClassesViewReducer_1.updateBalanceSheetForTimeframeClassesViewFailure)(response.status, action.payload.timeframe));
|
|
60
|
+
}
|
|
61
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, balanceSheetClassesViewReducer_1.updateBalanceSheetForTimeframeClassesViewFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Balance Sheet by Class REST API call errored out: ' +
|
|
62
|
+
(error instanceof Error
|
|
63
|
+
? error.message
|
|
64
|
+
: JSON.stringify(error))), action.payload.timeframe))));
|
|
65
|
+
}));
|
|
66
|
+
exports.fetchBalanceSheetForTimeframeClassesViewEpic = fetchBalanceSheetForTimeframeClassesViewEpic;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { updateProjects } from '../../entity/project/projectReducer';
|
|
4
|
+
import { updateSectionProjectView } from '../../entity/sectionProjectView/sectionProjectViewReducer';
|
|
5
|
+
import { RootState } from '../../reducer';
|
|
6
|
+
import { ZeniAPI } from '../../zeniAPI';
|
|
7
|
+
import { fetchBalanceSheetForTimeframeProjectView, updateBalanceSheetForTimeframeProjectView, updateBalanceSheetForTimeframeProjectViewFailure } from './balanceSheetProjectViewReducer';
|
|
8
|
+
export type ActionType = ReturnType<typeof fetchBalanceSheetForTimeframeProjectView> | ReturnType<typeof updateBalanceSheetForTimeframeProjectView> | ReturnType<typeof updateBalanceSheetForTimeframeProjectViewFailure> | ReturnType<typeof updateProjects> | ReturnType<typeof updateSectionProjectView>;
|
|
9
|
+
export declare const reportIdUniqueKey: () => "balance_sheet_by_projects";
|
|
10
|
+
export declare const fetchBalanceSheetForTimeframeProjectViewEpic: (actions$: ActionsObservable<ActionType>, _: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchBalanceSheetForTimeframeProjectViewEpic = exports.reportIdUniqueKey = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const projectReducer_1 = require("../../entity/project/projectReducer");
|
|
7
|
+
const sectionProjectViewReducer_1 = require("../../entity/sectionProjectView/sectionProjectViewReducer");
|
|
8
|
+
const responsePayload_1 = require("../../responsePayload");
|
|
9
|
+
const balanceSheetPayload_1 = require("../balanceSheet/balanceSheetPayload");
|
|
10
|
+
const balanceSheetProjectViewReducer_1 = require("./balanceSheetProjectViewReducer");
|
|
11
|
+
const getTimeSeriesGroup = (timeframe) => {
|
|
12
|
+
switch (timeframe) {
|
|
13
|
+
case 'month':
|
|
14
|
+
return 'months';
|
|
15
|
+
case 'quarter':
|
|
16
|
+
return 'quarters';
|
|
17
|
+
case 'year':
|
|
18
|
+
return 'years';
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
const reportIdUniqueKey = () => 'balance_sheet_by_projects';
|
|
22
|
+
exports.reportIdUniqueKey = reportIdUniqueKey;
|
|
23
|
+
const fetchBalanceSheetForTimeframeProjectViewEpic = (actions$, _, zeniAPI) => actions$.pipe((0, operators_1.filter)(balanceSheetProjectViewReducer_1.fetchBalanceSheetForTimeframeProjectView.match), (0, operators_1.mergeMap)((action) => {
|
|
24
|
+
const queryValue = {
|
|
25
|
+
// The report endpoint rejects a falsey is_full_response, so it is fixed.
|
|
26
|
+
is_full_response: true,
|
|
27
|
+
time_series_groups: [getTimeSeriesGroup(action.payload.timeframe)],
|
|
28
|
+
is_group_by_project: true,
|
|
29
|
+
// Only sent when refreshing: the flag makes the backend bypass its saved
|
|
30
|
+
// report and regenerate, so a normal lookup must not carry it.
|
|
31
|
+
...(action.payload.cacheOverride === true
|
|
32
|
+
? { is_hard_refresh: true }
|
|
33
|
+
: {}),
|
|
34
|
+
};
|
|
35
|
+
return zeniAPI
|
|
36
|
+
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/2.0/reports/balance_sheet?query=${encodeURIComponent(JSON.stringify(queryValue))}`)
|
|
37
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
38
|
+
if (response.data != null && (0, responsePayload_1.isSuccessResponse)(response)) {
|
|
39
|
+
const actions = [];
|
|
40
|
+
const { report } = response.data;
|
|
41
|
+
const currency = report.currency;
|
|
42
|
+
actions.push((0, projectReducer_1.updateProjects)(report.projects));
|
|
43
|
+
actions.push((0, sectionProjectViewReducer_1.updateSectionProjectView)(action.payload.timeframe, (0, balanceSheetPayload_1.toSectionId)('cash_and_equivalents'), (0, exports.reportIdUniqueKey)(), report.assets.current_assets.cash_and_equivalents, report.accounts, currency));
|
|
44
|
+
actions.push((0, sectionProjectViewReducer_1.updateSectionProjectView)(action.payload.timeframe, (0, balanceSheetPayload_1.toSectionId)('accounts_receivable'), (0, exports.reportIdUniqueKey)(), report.assets.current_assets.accounts_receivable, report.accounts, currency));
|
|
45
|
+
actions.push((0, sectionProjectViewReducer_1.updateSectionProjectView)(action.payload.timeframe, (0, balanceSheetPayload_1.toSectionId)('other_current_assets'), (0, exports.reportIdUniqueKey)(), report.assets.current_assets.other_current_assets, report.accounts, currency));
|
|
46
|
+
actions.push((0, sectionProjectViewReducer_1.updateSectionProjectView)(action.payload.timeframe, (0, balanceSheetPayload_1.toSectionId)('fixed_assets'), (0, exports.reportIdUniqueKey)(), report.assets.fixed_assets, report.accounts, currency));
|
|
47
|
+
actions.push((0, sectionProjectViewReducer_1.updateSectionProjectView)(action.payload.timeframe, (0, balanceSheetPayload_1.toSectionId)('other_assets'), (0, exports.reportIdUniqueKey)(), report.assets.other_assets, report.accounts, currency));
|
|
48
|
+
actions.push((0, sectionProjectViewReducer_1.updateSectionProjectView)(action.payload.timeframe, (0, balanceSheetPayload_1.toSectionId)('accounts_payable'), (0, exports.reportIdUniqueKey)(), report.liabilities.current_liabilities.accounts_payable, report.accounts, currency));
|
|
49
|
+
actions.push((0, sectionProjectViewReducer_1.updateSectionProjectView)(action.payload.timeframe, (0, balanceSheetPayload_1.toSectionId)('credit_cards'), (0, exports.reportIdUniqueKey)(), report.liabilities.current_liabilities.credit_cards, report.accounts, currency));
|
|
50
|
+
actions.push((0, sectionProjectViewReducer_1.updateSectionProjectView)(action.payload.timeframe, (0, balanceSheetPayload_1.toSectionId)('other_current_liabilities'), (0, exports.reportIdUniqueKey)(), report.liabilities.current_liabilities
|
|
51
|
+
.other_current_liabilities, report.accounts, currency));
|
|
52
|
+
actions.push((0, sectionProjectViewReducer_1.updateSectionProjectView)(action.payload.timeframe, (0, balanceSheetPayload_1.toSectionId)('long_term_liabilities'), (0, exports.reportIdUniqueKey)(), report.liabilities.long_term_liabilities, report.accounts, currency));
|
|
53
|
+
actions.push((0, sectionProjectViewReducer_1.updateSectionProjectView)(action.payload.timeframe, (0, balanceSheetPayload_1.toSectionId)('equity'), (0, exports.reportIdUniqueKey)(), report.equity, report.accounts, currency));
|
|
54
|
+
actions.push((0, balanceSheetProjectViewReducer_1.updateBalanceSheetForTimeframeProjectView)({
|
|
55
|
+
timeframe: action.payload.timeframe,
|
|
56
|
+
report: response.data,
|
|
57
|
+
}));
|
|
58
|
+
return (0, rxjs_1.from)(actions);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
return (0, rxjs_1.of)((0, balanceSheetProjectViewReducer_1.updateBalanceSheetForTimeframeProjectViewFailure)(response.status, action.payload.timeframe));
|
|
62
|
+
}
|
|
63
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, balanceSheetProjectViewReducer_1.updateBalanceSheetForTimeframeProjectViewFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Balance Sheet by Project REST API call errored out: ' +
|
|
64
|
+
(error instanceof Error
|
|
65
|
+
? error.message
|
|
66
|
+
: JSON.stringify(error))), action.payload.timeframe))));
|
|
67
|
+
}));
|
|
68
|
+
exports.fetchBalanceSheetForTimeframeProjectViewEpic = fetchBalanceSheetForTimeframeProjectViewEpic;
|