@zeniai/client-epic-state 5.0.0-beta0ND → 5.0.0-betaRD2

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 (140) hide show
  1. package/lib/commonPayloadTypes/subAccountView/reportBySubAccountPayload.d.ts +2 -0
  2. package/lib/commonStateTypes/coaBalance/coaBalancesFilterProjectView.d.ts +13 -0
  3. package/lib/commonStateTypes/coaBalance/coaBalancesFilterProjectView.js +9 -0
  4. package/lib/commonStateTypes/common.d.ts +1 -1
  5. package/lib/commonStateTypes/projectView/projectViewParentID.d.ts +5 -0
  6. package/lib/commonStateTypes/projectView/projectViewParentID.js +2 -0
  7. package/lib/commonStateTypes/viewAndReport/reportIDHelper.d.ts +1 -0
  8. package/lib/commonStateTypes/viewAndReport/reportIDHelper.js +3 -1
  9. package/lib/commonStateTypes/viewAndReport/viewAndReport.d.ts +2 -2
  10. package/lib/commonStateTypes/viewAndReport/viewAndReport.js +1 -0
  11. package/lib/coreEpics.js +1 -2
  12. package/lib/entity/account/accountReducer.js +5 -3
  13. package/lib/entity/account/accountSelector.d.ts +7 -0
  14. package/lib/entity/account/accountSelector.js +4 -2
  15. package/lib/entity/account/accountState.d.ts +3 -1
  16. package/lib/entity/account/accountState.js +4 -1
  17. package/lib/entity/account/pickAndMergeForecastAccountReport.d.ts +1 -0
  18. package/lib/entity/account/subAccountSelector.d.ts +2 -0
  19. package/lib/entity/account/subAccountSelector.js +2 -0
  20. package/lib/entity/accountGroup/accountGroupSelector.d.ts +22 -0
  21. package/lib/entity/accountGroup/accountGroupState.d.ts +1 -1
  22. package/lib/entity/class/classReducer.d.ts +4 -4
  23. package/lib/entity/class/classState.d.ts +1 -1
  24. package/lib/entity/forecast/forecastState.d.ts +1 -1
  25. package/lib/entity/project/projectPayload.d.ts +13 -0
  26. package/lib/entity/project/projectPayload.js +30 -0
  27. package/lib/entity/project/projectReducer.d.ts +10 -0
  28. package/lib/entity/project/projectReducer.js +31 -0
  29. package/lib/entity/project/projectSelector.d.ts +5 -0
  30. package/lib/entity/project/projectSelector.js +12 -0
  31. package/lib/entity/project/projectState.d.ts +13 -0
  32. package/lib/entity/project/projectState.js +2 -0
  33. package/lib/entity/sectionAccountsView/sectionAccountsView.d.ts +1 -1
  34. package/lib/entity/sectionClassesViewV2/sectionClassesView.d.ts +1 -1
  35. package/lib/entity/sectionClassesViewV2/sectionClassesViewReducer.d.ts +2 -2
  36. package/lib/entity/sectionProjectView/sectionProjectView.d.ts +11 -0
  37. package/lib/entity/sectionProjectView/sectionProjectView.js +6 -0
  38. package/lib/entity/sectionProjectView/sectionProjectViewEpic.d.ts +6 -0
  39. package/lib/entity/sectionProjectView/sectionProjectViewEpic.js +56 -0
  40. package/lib/entity/sectionProjectView/sectionProjectViewHelper.d.ts +10 -0
  41. package/lib/entity/sectionProjectView/sectionProjectViewHelper.js +14 -0
  42. package/lib/entity/sectionProjectView/sectionProjectViewReducer.d.ts +15 -0
  43. package/lib/entity/sectionProjectView/sectionProjectViewReducer.js +56 -0
  44. package/lib/entity/sectionProjectView/sectionProjectViewSelector.d.ts +11 -0
  45. package/lib/entity/sectionProjectView/sectionProjectViewSelector.js +94 -0
  46. package/lib/entity/sectionProjectView/sectionProjectViewSelectorTypes.d.ts +16 -0
  47. package/lib/entity/sectionProjectView/sectionProjectViewSelectorTypes.js +2 -0
  48. package/lib/entity/sectionProjectView/sectionProjectViewState.d.ts +4 -0
  49. package/lib/entity/sectionProjectView/sectionProjectViewState.js +2 -0
  50. package/lib/entity/tenant/clearAllEpic.d.ts +5 -2
  51. package/lib/entity/tenant/clearAllEpic.js +6 -0
  52. package/lib/entity/tenant/tenantPayload.d.ts +1 -0
  53. package/lib/entity/tenant/tenantReducer.d.ts +1 -5
  54. package/lib/entity/tenant/tenantReducer.js +3 -23
  55. package/lib/entity/tenant/tenantSelector.d.ts +1 -0
  56. package/lib/entity/tenant/tenantSelector.js +9 -1
  57. package/lib/entity/tenant/tenantState.d.ts +1 -1
  58. package/lib/epic.d.ts +4 -1
  59. package/lib/epic.js +4 -1
  60. package/lib/esm/commonStateTypes/coaBalance/coaBalancesFilterProjectView.js +5 -0
  61. package/lib/esm/commonStateTypes/projectView/projectViewParentID.js +1 -0
  62. package/lib/esm/commonStateTypes/viewAndReport/reportIDHelper.js +1 -0
  63. package/lib/esm/commonStateTypes/viewAndReport/viewAndReport.js +1 -0
  64. package/lib/esm/coreEpics.js +1 -2
  65. package/lib/esm/entity/account/accountReducer.js +5 -3
  66. package/lib/esm/entity/account/accountSelector.js +4 -2
  67. package/lib/esm/entity/account/accountState.js +4 -1
  68. package/lib/esm/entity/account/subAccountSelector.js +2 -0
  69. package/lib/esm/entity/project/projectPayload.js +26 -0
  70. package/lib/esm/entity/project/projectReducer.js +27 -0
  71. package/lib/esm/entity/project/projectSelector.js +8 -0
  72. package/lib/esm/entity/project/projectState.js +1 -0
  73. package/lib/esm/entity/sectionProjectView/sectionProjectView.js +3 -0
  74. package/lib/esm/entity/sectionProjectView/sectionProjectViewEpic.js +52 -0
  75. package/lib/esm/entity/sectionProjectView/sectionProjectViewHelper.js +10 -0
  76. package/lib/esm/entity/sectionProjectView/sectionProjectViewReducer.js +52 -0
  77. package/lib/esm/entity/sectionProjectView/sectionProjectViewSelector.js +87 -0
  78. package/lib/esm/entity/sectionProjectView/sectionProjectViewSelectorTypes.js +1 -0
  79. package/lib/esm/entity/sectionProjectView/sectionProjectViewState.js +1 -0
  80. package/lib/esm/entity/tenant/clearAllEpic.js +6 -0
  81. package/lib/esm/entity/tenant/tenantReducer.js +2 -21
  82. package/lib/esm/entity/tenant/tenantSelector.js +7 -0
  83. package/lib/esm/epic.js +4 -1
  84. package/lib/esm/index.js +8 -8
  85. package/lib/esm/reducer.js +9 -0
  86. package/lib/esm/view/financeStatement/financeStatementSelector.js +12 -1
  87. package/lib/esm/view/profitAndLossProjectView/profitAndLossForTimeframeProjectViewEpic.js +47 -0
  88. package/lib/esm/view/profitAndLossProjectView/profitAndLossProjectViewEpic.js +30 -0
  89. package/lib/esm/view/profitAndLossProjectView/profitAndLossProjectViewPayload.js +1 -0
  90. package/lib/esm/view/profitAndLossProjectView/profitAndLossProjectViewReducer.js +113 -0
  91. package/lib/esm/view/profitAndLossProjectView/profitAndLossProjectViewSelector.js +67 -0
  92. package/lib/esm/view/profitAndLossProjectView/profitAndLossProjectViewSelectorTypes.js +1 -0
  93. package/lib/esm/view/profitAndLossProjectView/profitAndLossProjectViewState.js +1 -0
  94. package/lib/esm/view/reportsResync/reportsClassViewRefetchingEpic.js +4 -0
  95. package/lib/index.d.ts +12 -8
  96. package/lib/index.js +46 -40
  97. package/lib/reducer.d.ts +9 -0
  98. package/lib/reducer.js +9 -0
  99. package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
  100. package/lib/view/auditReportView/auditReportViewState.d.ts +1 -1
  101. package/lib/view/billPayCard/billPayCardSelector.d.ts +1 -1
  102. package/lib/view/cardBalance/cardBalanceSelector.d.ts +2 -1
  103. package/lib/view/cashBalance/cashBalanceSelector.d.ts +2 -1
  104. package/lib/view/cashInCashOut/cashInCashOutSelector.d.ts +1 -1
  105. package/lib/view/cashPosition/cashPositionSelector.d.ts +1 -1
  106. package/lib/view/dashboard/dashboardReducer.d.ts +2 -2
  107. package/lib/view/financeStatement/financeStatementReducer.d.ts +1 -1
  108. package/lib/view/financeStatement/financeStatementSelector.d.ts +2 -0
  109. package/lib/view/financeStatement/financeStatementSelector.js +12 -1
  110. package/lib/view/globalMerchantView/globalMerchantViewReducer.d.ts +2 -2
  111. package/lib/view/profitAndLossProjectView/profitAndLossForTimeframeProjectViewEpic.d.ts +9 -0
  112. package/lib/view/profitAndLossProjectView/profitAndLossForTimeframeProjectViewEpic.js +51 -0
  113. package/lib/view/profitAndLossProjectView/profitAndLossProjectViewEpic.d.ts +6 -0
  114. package/lib/view/profitAndLossProjectView/profitAndLossProjectViewEpic.js +34 -0
  115. package/lib/view/profitAndLossProjectView/profitAndLossProjectViewPayload.d.ts +33 -0
  116. package/lib/view/profitAndLossProjectView/profitAndLossProjectViewPayload.js +2 -0
  117. package/lib/view/profitAndLossProjectView/profitAndLossProjectViewReducer.d.ts +33 -0
  118. package/lib/view/profitAndLossProjectView/profitAndLossProjectViewReducer.js +117 -0
  119. package/lib/view/profitAndLossProjectView/profitAndLossProjectViewSelector.d.ts +9 -0
  120. package/lib/view/profitAndLossProjectView/profitAndLossProjectViewSelector.js +71 -0
  121. package/lib/view/profitAndLossProjectView/profitAndLossProjectViewSelectorTypes.d.ts +19 -0
  122. package/lib/view/profitAndLossProjectView/profitAndLossProjectViewSelectorTypes.js +2 -0
  123. package/lib/view/profitAndLossProjectView/profitAndLossProjectViewState.d.ts +22 -0
  124. package/lib/view/profitAndLossProjectView/profitAndLossProjectViewState.js +2 -0
  125. package/lib/view/reimbursementCard/reimbursementCardSelector.d.ts +1 -1
  126. package/lib/view/reportsResync/reportsClassViewRefetchingEpic.d.ts +2 -1
  127. package/lib/view/reportsResync/reportsClassViewRefetchingEpic.js +4 -0
  128. package/lib/view/reportsResync/reportsResyncReducer.d.ts +2 -2
  129. package/lib/view/tasksCard/tasksCardSelector.d.ts +1 -1
  130. package/lib/view/topEx/topExSelector.d.ts +1 -1
  131. package/package.json +1 -1
  132. package/lib/entity/tenant/SessionManager.d.ts +0 -38
  133. package/lib/entity/tenant/SessionManager.js +0 -171
  134. package/lib/entity/tenant/epic/sessionHeartbeatEpic.d.ts +0 -16
  135. package/lib/entity/tenant/epic/sessionHeartbeatEpic.js +0 -16
  136. package/lib/entity/tenant/sessionTypes.d.ts +0 -26
  137. package/lib/entity/tenant/sessionTypes.js +0 -12
  138. package/lib/esm/entity/tenant/SessionManager.js +0 -167
  139. package/lib/esm/entity/tenant/epic/sessionHeartbeatEpic.js +0 -12
  140. package/lib/esm/entity/tenant/sessionTypes.js +0 -9
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getProfitAndLossProjectView = exports.profitAndLossProjectIdsInOrder = void 0;
4
+ const getDifferenceOfBalancesGroupedByPeriod_1 = require("../../commonStateTypes/coaBalance/classBalances/getDifferenceOfBalancesGroupedByPeriod");
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 projectSelector_1 = require("../../entity/project/projectSelector");
9
+ const sectionProjectViewSelector_1 = require("../../entity/sectionProjectView/sectionProjectViewSelector");
10
+ const profitAndLossClassesViewSelectorTypes_1 = require("../profitAndLossClassesView/profitAndLossClassesViewSelectorTypes");
11
+ exports.profitAndLossProjectIdsInOrder = [
12
+ 'income',
13
+ 'cogs',
14
+ 'grossProfit',
15
+ 'expenses',
16
+ 'earningsBeforeInterestAndTax',
17
+ 'otherIncome',
18
+ 'otherExpenses',
19
+ 'netOtherIncome',
20
+ 'netIncome',
21
+ ];
22
+ const getProfitAndLossProjectView = (filter, accountState, projectState, sectionsState, profitAndLossProjectViewState) => {
23
+ const fetchState = (0, reduceFetchState_1.reduceFetchStateParallelTimeframes)([
24
+ profitAndLossProjectViewState.fetchState.month,
25
+ profitAndLossProjectViewState.fetchState.quarter,
26
+ profitAndLossProjectViewState.fetchState.year,
27
+ ]);
28
+ const reportId = 'profit_and_loss_by_projects';
29
+ const sections = {};
30
+ const calculatedSections = {};
31
+ if (fetchState.fetchState === 'Completed') {
32
+ profitAndLossClassesViewSelectorTypes_1.ALL_PANDL_REPORT_VIEW_SECTION_IDS.forEach((sectionId) => {
33
+ sections[`${sectionId}`] = (0, sectionProjectViewSelector_1.getSectionProjectViewReport)(accountState, projectState, sectionsState, profitAndLossProjectViewState.projectIds, {
34
+ reportId,
35
+ sectionId,
36
+ }, filter);
37
+ });
38
+ const grossProfitBalancesByPeriod = (0, getDifferenceOfBalancesGroupedByPeriod_1.getDifferenceOfBalancesGroupedByPeriod)(sections['income'].sectionBalancesTotalByPeriod, sections['cogs'].sectionBalancesTotalByPeriod);
39
+ calculatedSections['grossProfit'] = (0, coaBalance_1.getCOABalances)(grossProfitBalancesByPeriod, filter);
40
+ const ebitBalancesByPeriod = (0, getDifferenceOfBalancesGroupedByPeriod_1.getDifferenceOfBalancesGroupedByPeriod)(grossProfitBalancesByPeriod, sections['expenses'].sectionBalancesTotalByPeriod);
41
+ calculatedSections['earningsBeforeInterestAndTax'] = (0, coaBalance_1.getCOABalances)(ebitBalancesByPeriod, filter);
42
+ const netOtherIncomeBalances = (0, getDifferenceOfBalancesGroupedByPeriod_1.getDifferenceOfBalancesGroupedByPeriod)(sections['otherIncome'].sectionBalancesTotalByPeriod, sections['otherExpenses'].sectionBalancesTotalByPeriod);
43
+ calculatedSections['netOtherIncome'] = (0, coaBalance_1.getCOABalances)(netOtherIncomeBalances, filter);
44
+ const netIncomeBalances = netOtherIncomeBalances != null
45
+ ? (0, getSumOfBalancesGroupedByPeriod_1.getSumOfBalancesByGroupedByPeriod)([
46
+ ebitBalancesByPeriod,
47
+ netOtherIncomeBalances,
48
+ ])
49
+ : ebitBalancesByPeriod;
50
+ calculatedSections['netIncome'] = (0, coaBalance_1.getCOABalances)(netIncomeBalances, filter);
51
+ }
52
+ return {
53
+ sections,
54
+ calculatedSections,
55
+ reportId: profitAndLossProjectViewState.reportId,
56
+ reportTitle: profitAndLossProjectViewState.reportTitle,
57
+ firstMonthOfFY: profitAndLossProjectViewState.firstMonthOfFY,
58
+ dataAvailable: profitAndLossProjectViewState.dataAvailable,
59
+ bookCloseDate: profitAndLossProjectViewState.bookCloseDate,
60
+ version: profitAndLossProjectViewState.version,
61
+ status: profitAndLossProjectViewState.status,
62
+ fetchState: fetchState.fetchState,
63
+ error: fetchState.error,
64
+ filter,
65
+ uiState: profitAndLossProjectViewState.uiState,
66
+ projects: (0, projectSelector_1.getProjectsByIds)(projectState, profitAndLossProjectViewState.projectIds),
67
+ projectsToFilterOut: profitAndLossProjectViewState.uiState.projectsToFilterOut,
68
+ idsInOrder: exports.profitAndLossProjectIdsInOrder,
69
+ };
70
+ };
71
+ exports.getProfitAndLossProjectView = getProfitAndLossProjectView;
@@ -0,0 +1,19 @@
1
+ import { SectionProjectViewReport } from '../../entity/sectionProjectView/sectionProjectViewSelectorTypes';
2
+ import { COABalancesFilterProjectView } from '../../commonStateTypes/coaBalance/coaBalancesFilterProjectView';
3
+ import { ID } from '../../commonStateTypes/common';
4
+ import { DataAvailable } from '../../commonStateTypes/dataAvailable';
5
+ import { CalculatedSection } from '../../commonStateTypes/selectorTypes/selectorTypes';
6
+ import { SelectorReport } from '../../commonStateTypes/viewAndReport/viewAndReport';
7
+ import { Project } from '../../entity/project/projectState';
8
+ import { PandLReportViewCalculatedSectionID, PandLReportViewSectionID } from '../profitAndLossClassesView/profitAndLossClassesViewSelectorTypes';
9
+ import { ProfitAndLossProjectViewUIState } from './profitAndLossProjectViewState';
10
+ export interface ProfitAndLossProjectViewReport extends SelectorReport {
11
+ calculatedSections: Record<PandLReportViewCalculatedSectionID, CalculatedSection>;
12
+ filter: COABalancesFilterProjectView;
13
+ idsInOrder: (PandLReportViewSectionID | PandLReportViewCalculatedSectionID)[];
14
+ projects: Project[];
15
+ projectsToFilterOut: ID[];
16
+ sections: Record<PandLReportViewSectionID, SectionProjectViewReport>;
17
+ uiState: ProfitAndLossProjectViewUIState;
18
+ dataAvailable?: DataAvailable;
19
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,22 @@
1
+ import { Currency } from '../../commonStateTypes/amount';
2
+ import { AccountViewMode, FetchStateAndError, ID } from '../../commonStateTypes/common';
3
+ import { Report } from '../../commonStateTypes/viewAndReport/viewAndReport';
4
+ export interface ProfitAndLossProjectViewUIState {
5
+ accountViewMode: AccountViewMode;
6
+ nodeCollapseState: Record<ID, boolean>;
7
+ projectsToFilterOut: ID[];
8
+ scrollPosition: {
9
+ scrollTop: number;
10
+ scrollLeft?: number;
11
+ } | undefined;
12
+ }
13
+ export interface ProfitAndLossProjectViewState extends Report {
14
+ fetchState: {
15
+ month: FetchStateAndError;
16
+ quarter: FetchStateAndError;
17
+ year: FetchStateAndError;
18
+ };
19
+ projectIds: ID[];
20
+ uiState: ProfitAndLossProjectViewUIState;
21
+ currency?: Currency;
22
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,6 +1,6 @@
1
1
  import { RootState } from '../../reducer';
2
2
  export declare const getReimbursementCardReport: (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" | "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_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";
4
4
  reportTitle: string;
5
5
  version: string | number | undefined;
6
6
  fetchState: import("../..").FetchState;
@@ -4,7 +4,8 @@ import { RootState } from '../../reducer';
4
4
  import { fetchNetBurnOrIncomeClassesView } from '../netBurnOrIncomeClassesView/netBurnOrIncomeClassesViewReducer';
5
5
  import { fetchOpExClassesView } from '../opExClassesView/opExClassesViewReducer';
6
6
  import { fetchProfitAndLossClassesView } from '../profitAndLossClassesView/profitAndLossClassesViewReducer';
7
+ import { fetchProfitAndLossProjectView } from '../profitAndLossProjectView/profitAndLossProjectViewReducer';
7
8
  import { fetchRevenueClassesView } from '../revenueClassesView/revenueClassesViewReducer';
8
9
  import { initiateReportsClassViewRefetching } from './reportsResyncReducer';
9
- export type ActionType = ReturnType<typeof initiateReportsClassViewRefetching> | ReturnType<typeof fetchProfitAndLossClassesView> | ReturnType<typeof fetchOpExClassesView> | ReturnType<typeof fetchRevenueClassesView> | ReturnType<typeof fetchNetBurnOrIncomeClassesView>;
10
+ export type ActionType = ReturnType<typeof initiateReportsClassViewRefetching> | ReturnType<typeof fetchProfitAndLossClassesView> | ReturnType<typeof fetchOpExClassesView> | ReturnType<typeof fetchRevenueClassesView> | ReturnType<typeof fetchNetBurnOrIncomeClassesView> | ReturnType<typeof fetchProfitAndLossProjectView>;
10
11
  export declare const initiateReportsClassViewRefetchingEpic: (actions$: ActionsObservable<ActionType>, _: StateObservable<RootState>) => Observable<ActionType>;
@@ -6,6 +6,7 @@ const operators_1 = require("rxjs/operators");
6
6
  const netBurnOrIncomeClassesViewReducer_1 = require("../netBurnOrIncomeClassesView/netBurnOrIncomeClassesViewReducer");
7
7
  const opExClassesViewReducer_1 = require("../opExClassesView/opExClassesViewReducer");
8
8
  const profitAndLossClassesViewReducer_1 = require("../profitAndLossClassesView/profitAndLossClassesViewReducer");
9
+ const profitAndLossProjectViewReducer_1 = require("../profitAndLossProjectView/profitAndLossProjectViewReducer");
9
10
  const revenueClassesViewReducer_1 = require("../revenueClassesView/revenueClassesViewReducer");
10
11
  const reportsResyncReducer_1 = require("./reportsResyncReducer");
11
12
  const initiateReportsClassViewRefetchingEpic = (actions$,
@@ -26,6 +27,9 @@ _) => actions$.pipe((0, operators_1.filter)(reportsResyncReducer_1.initiateRepor
26
27
  case 'net_burn_or_income_by_classes':
27
28
  actions.push((0, netBurnOrIncomeClassesViewReducer_1.fetchNetBurnOrIncomeClassesView)(true));
28
29
  break;
30
+ case 'profit_and_loss_by_projects':
31
+ actions.push((0, profitAndLossProjectViewReducer_1.fetchProfitAndLossProjectView)(true));
32
+ break;
29
33
  default:
30
34
  break;
31
35
  }
@@ -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" | "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_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" | "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_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
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" | "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_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";
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" | "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_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";
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": "5.0.0-beta0ND",
3
+ "version": "5.0.0-betaRD2",
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,38 +0,0 @@
1
- /**
2
- * SessionManager — Central session lifecycle manager.
3
- *
4
- * Responsibilities:
5
- * 1. Track user activity (mousemove, keydown, click, scroll, touch)
6
- * 2. Send heartbeat at configurable intervals while user is active
7
- * 3. Show warning popup after idle timeout
8
- * 4. Auto-logout after warning countdown expires
9
- */
10
- import { SessionCallbacks, SessionConfig } from './sessionTypes';
11
- export declare class SessionManager {
12
- private config;
13
- private callbacks;
14
- /** Timestamps and timers */
15
- private lastActivityTime;
16
- private idleCheckInterval;
17
- private heartbeatInterval;
18
- private countdownInterval;
19
- private activityDebounceTimer;
20
- /** State */
21
- private running;
22
- private warningActive;
23
- private secondsRemaining;
24
- /** Bound handler for event listener cleanup. */
25
- private boundOnActivity;
26
- private boundOnVisibilityChange;
27
- start(config: Partial<SessionConfig> | undefined, callbacks: SessionCallbacks): void;
28
- stop(): void;
29
- continueSession(): void;
30
- isWarningActive(): boolean;
31
- getSecondsRemaining(): number;
32
- private onActivity;
33
- private onVisibilityChange;
34
- private checkIdle;
35
- private startWarning;
36
- private startHeartbeat;
37
- private clearTimer;
38
- }
@@ -1,171 +0,0 @@
1
- "use strict";
2
- /**
3
- * SessionManager — Central session lifecycle manager.
4
- *
5
- * Responsibilities:
6
- * 1. Track user activity (mousemove, keydown, click, scroll, touch)
7
- * 2. Send heartbeat at configurable intervals while user is active
8
- * 3. Show warning popup after idle timeout
9
- * 4. Auto-logout after warning countdown expires
10
- */
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.SessionManager = void 0;
13
- const sessionTypes_1 = require("./sessionTypes");
14
- /** Events that indicate user activity. */
15
- const ACTIVITY_EVENTS = [
16
- 'mousemove',
17
- 'mousedown',
18
- 'keydown',
19
- 'scroll',
20
- 'touchstart',
21
- 'click',
22
- ];
23
- /** Debounce interval for activity events (ms). */
24
- const ACTIVITY_DEBOUNCE_MS = 1000;
25
- class SessionManager {
26
- constructor() {
27
- this.config = sessionTypes_1.DEFAULT_SESSION_CONFIG;
28
- this.callbacks = null;
29
- /** Timestamps and timers */
30
- this.lastActivityTime = 0;
31
- this.idleCheckInterval = null;
32
- this.heartbeatInterval = null;
33
- this.countdownInterval = null;
34
- this.activityDebounceTimer = null;
35
- /** State */
36
- this.running = false;
37
- this.warningActive = false;
38
- this.secondsRemaining = 0;
39
- /** Bound handler for event listener cleanup. */
40
- this.boundOnActivity = this.onActivity.bind(this);
41
- this.boundOnVisibilityChange = this.onVisibilityChange.bind(this);
42
- }
43
- // ─── Public API ────────────────────────────────────────────
44
- start(config = {}, callbacks) {
45
- if (this.running) {
46
- this.stop();
47
- }
48
- this.config = { ...sessionTypes_1.DEFAULT_SESSION_CONFIG, ...config };
49
- this.callbacks = callbacks;
50
- this.running = true;
51
- this.warningActive = false;
52
- this.lastActivityTime = Date.now();
53
- if (!this.config.isAutoLogoutEnabled) {
54
- return;
55
- }
56
- ACTIVITY_EVENTS.forEach((event) => {
57
- document.addEventListener(event, this.boundOnActivity, {
58
- capture: true,
59
- passive: true,
60
- });
61
- });
62
- document.addEventListener('visibilitychange', this.boundOnVisibilityChange);
63
- this.startHeartbeat();
64
- this.callbacks?.onHeartbeat();
65
- this.idleCheckInterval = setInterval(() => this.checkIdle(), 1000);
66
- }
67
- stop() {
68
- this.running = false;
69
- this.warningActive = false;
70
- ACTIVITY_EVENTS.forEach((event) => {
71
- document.removeEventListener(event, this.boundOnActivity, {
72
- capture: true,
73
- });
74
- });
75
- document.removeEventListener('visibilitychange', this.boundOnVisibilityChange);
76
- this.clearTimer('idleCheckInterval');
77
- this.clearTimer('heartbeatInterval');
78
- this.clearTimer('countdownInterval');
79
- this.clearTimer('activityDebounceTimer');
80
- }
81
- continueSession() {
82
- if (!this.running) {
83
- return;
84
- }
85
- this.warningActive = false;
86
- this.secondsRemaining = 0;
87
- this.lastActivityTime = Date.now();
88
- this.clearTimer('countdownInterval');
89
- this.callbacks?.onHeartbeat();
90
- this.callbacks?.onSessionExtended();
91
- this.startHeartbeat();
92
- }
93
- isWarningActive() {
94
- return this.warningActive;
95
- }
96
- getSecondsRemaining() {
97
- return this.secondsRemaining;
98
- }
99
- // ─── Private ───────────────────────────────────────────────
100
- onActivity() {
101
- if (!this.running || this.warningActive) {
102
- return;
103
- }
104
- if (this.activityDebounceTimer != null) {
105
- return;
106
- }
107
- this.lastActivityTime = Date.now();
108
- this.activityDebounceTimer = setTimeout(() => {
109
- this.activityDebounceTimer = null;
110
- }, ACTIVITY_DEBOUNCE_MS);
111
- }
112
- onVisibilityChange() {
113
- if (!this.running) {
114
- return;
115
- }
116
- if (document.visibilityState === 'visible') {
117
- this.lastActivityTime = Date.now();
118
- this.checkIdle();
119
- }
120
- }
121
- checkIdle() {
122
- if (!this.running || this.warningActive) {
123
- return;
124
- }
125
- const idleMs = Date.now() - this.lastActivityTime;
126
- const idleTimeoutMs = this.config.idleTimeoutMinutes * 60 * 1000;
127
- if (idleMs >= idleTimeoutMs) {
128
- this.startWarning();
129
- }
130
- }
131
- startWarning() {
132
- this.warningActive = true;
133
- this.secondsRemaining = this.config.warningDurationSeconds;
134
- this.clearTimer('heartbeatInterval');
135
- this.callbacks?.onWarningStart(this.secondsRemaining);
136
- this.countdownInterval = setInterval(() => {
137
- this.secondsRemaining -= 1;
138
- if (this.secondsRemaining <= 0) {
139
- this.clearTimer('countdownInterval');
140
- this.warningActive = false;
141
- this.callbacks?.onAutoLogout();
142
- }
143
- else {
144
- this.callbacks?.onWarningTick(this.secondsRemaining);
145
- }
146
- }, 1000);
147
- }
148
- startHeartbeat() {
149
- this.clearTimer('heartbeatInterval');
150
- const intervalMs = this.config.heartbeatIntervalMinutes * 60 * 1000;
151
- this.heartbeatInterval = setInterval(() => {
152
- if (!this.running || this.warningActive) {
153
- return;
154
- }
155
- this.callbacks?.onHeartbeat();
156
- }, intervalMs);
157
- }
158
- clearTimer(name) {
159
- const timer = this[name];
160
- if (timer != null) {
161
- if (name === 'activityDebounceTimer') {
162
- clearTimeout(timer);
163
- }
164
- else {
165
- clearInterval(timer);
166
- }
167
- this[name] = null;
168
- }
169
- }
170
- }
171
- exports.SessionManager = SessionManager;
@@ -1,16 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { RootState } from '../../../reducer';
3
- import { ZeniAPI } from '../../../zeniAPI';
4
- import { sendSessionHeartbeat, sessionHeartbeatFailure, sessionHeartbeatSuccess } from '../tenantReducer';
5
- export type ActionType = ReturnType<typeof sendSessionHeartbeat> | ReturnType<typeof sessionHeartbeatSuccess> | ReturnType<typeof sessionHeartbeatFailure>;
6
- export declare const sessionHeartbeatEpic: (actions$: ActionsObservable<ActionType>, _: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
7
- payload: {
8
- expiresAt: string;
9
- };
10
- type: "tenant/sessionHeartbeatSuccess";
11
- } | {
12
- payload: {
13
- error: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>>;
14
- };
15
- type: "tenant/sessionHeartbeatFailure";
16
- }>;
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sessionHeartbeatEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const responsePayload_1 = require("../../../responsePayload");
7
- const tenantReducer_1 = require("../tenantReducer");
8
- const sessionHeartbeatEpic = (actions$, _, zeniAPI) => actions$.pipe((0, operators_1.filter)(tenantReducer_1.sendSessionHeartbeat.match), (0, operators_1.switchMap)(() => zeniAPI
9
- .postAndGetJSON(`${zeniAPI.apiEndPoints.authMicroServiceBaseUrl}/1.0/sessions/heartbeat`)
10
- .pipe((0, operators_1.mergeMap)((response) => {
11
- if ((0, responsePayload_1.isSuccessResponse)(response)) {
12
- return (0, rxjs_1.of)((0, tenantReducer_1.sessionHeartbeatSuccess)(response.data?.expiry ?? ''));
13
- }
14
- return (0, rxjs_1.of)((0, tenantReducer_1.sessionHeartbeatFailure)(response.status));
15
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, tenantReducer_1.sessionHeartbeatFailure)((0, responsePayload_1.createZeniAPIStatus)('Heartbeat failed', 'Session heartbeat API call errored: ' + JSON.stringify(error))))))));
16
- exports.sessionHeartbeatEpic = sessionHeartbeatEpic;
@@ -1,26 +0,0 @@
1
- /**
2
- * Session management types for idle timeout and heartbeat.
3
- */
4
- export interface SessionConfig {
5
- /** Minutes between heartbeat API calls while user is active. Default: 10 */
6
- heartbeatIntervalMinutes: number;
7
- /** Minutes of inactivity before the warning popup appears. Default: 30 */
8
- idleTimeoutMinutes: number;
9
- /** Whether auto-logout is enabled. Default: true */
10
- isAutoLogoutEnabled: boolean;
11
- /** Seconds to count down in the warning popup before auto-logout. Default: 60 */
12
- warningDurationSeconds: number;
13
- }
14
- export declare const DEFAULT_SESSION_CONFIG: SessionConfig;
15
- export interface SessionCallbacks {
16
- /** Called when the countdown reaches zero — app should sign out. */
17
- onAutoLogout: () => void;
18
- /** Called to send a heartbeat API request. */
19
- onHeartbeat: () => void;
20
- /** Called when the session is extended (heartbeat success or "Continue Session"). */
21
- onSessionExtended: () => void;
22
- /** Called when the warning countdown starts. */
23
- onWarningStart: (secondsRemaining: number) => void;
24
- /** Called every second during the countdown. */
25
- onWarningTick: (secondsRemaining: number) => void;
26
- }
@@ -1,12 +0,0 @@
1
- "use strict";
2
- /**
3
- * Session management types for idle timeout and heartbeat.
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.DEFAULT_SESSION_CONFIG = void 0;
7
- exports.DEFAULT_SESSION_CONFIG = {
8
- heartbeatIntervalMinutes: 10,
9
- idleTimeoutMinutes: 30,
10
- isAutoLogoutEnabled: true,
11
- warningDurationSeconds: 60,
12
- };