@zeniai/client-epic-state 5.1.76-betaDI0 → 5.1.77

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.
@@ -2,7 +2,7 @@ import { createSelector } from '@reduxjs/toolkit';
2
2
  import { newBalancesFilter } from '../../commonStateTypes/coaBalance/coaBalancesFilter';
3
3
  import { reduceFetchState } from '../../commonStateTypes/reduceFetchState';
4
4
  import { getCurrentTenant, getTenantsByCheckInDateSelector, } from '../../entity/tenant/tenantSelector';
5
- import { hasAdminLevelAccess, hasInvestorBankerLevelAccess, isZeniSignedInUser, } from '../../entity/userRole/userRoleType';
5
+ import { hasAdminLevelAccess, hasInvestorBankerLevelAccess, } from '../../entity/userRole/userRoleType';
6
6
  import { getApAgingReport } from '../apAgingView/apAgingReport/apAgingSelector';
7
7
  import { getArAgingReport } from '../arAgingView/arAgingReport/arAgingSelector';
8
8
  import { getBillPayCardReport } from '../billPayCard/billPayCardSelector';
@@ -42,7 +42,7 @@ const tenantSelector = createSelector(getTenantsByCheckInDateSelector, getCurren
42
42
  export const getDashboard = createSelector(tenantSelector, getCardBalance, getCashBalance, getOperatingExpensesForLast5Periods, getRevenueForLast4Periods, getTop6Expenses, getNetBurnOrIncomeForLast4Periods, getNetBurnOrIncomeStoryCard, getCashPositionLast5Periods, getCashInCashOutLast4Periods, getInsights, getCompanyPassportView, getTasksCardReport, getBillPayCardReport, getReimbursementCardReport, apAgingSelector, arAgingSelector, getZeniAccountsPromoCard, getRewardsPlanCard, getDashboardCardsOrdered, (state) => {
43
43
  const currentTenant = getCurrentTenant(state);
44
44
  return getMonthEndCloseChecksViewByTenantId(state, currentTenant.tenantId);
45
- }, (state) => state.tenantState, (_state, additionalExcludedReports) => additionalExcludedReports, (_state, _additionalExcludedReports, signedInUser) => signedInUser, (_state, _excluded, _signedInUser, isExpenseAutomationFeatureEnabledV2) => isExpenseAutomationFeatureEnabledV2, (_state, _excluded, _signedInUser, _enabledV2, isExpenseAutomationFeatureEnabled) => isExpenseAutomationFeatureEnabled, (state) => state.dashboardState.isTreasuryVideoClosed, (tenants, cardBalance, cashBalance, opEx, revenue, topEx, netBurnOrIncome, netBurnOrIncomeStoryCard, cashPosition, cashInCashOut, insightsView, companyPassportView, tasksCard, billPayCard, reimbursementCard, apAgingReport, arAgingReport, zeniAccountsPromoCard, rewardsPlanCard, cards, monthEndCloseChecksView, tenantState, additionalExcludedReports, signedInUser, isExpenseAutomationFeatureEnabledV2, isExpenseAutomationFeatureEnabled, isTreasuryVideoClosed) => {
45
+ }, (state) => state.tenantState, (_state, additionalExcludedReports) => additionalExcludedReports, (state) => state.dashboardState.isTreasuryVideoClosed, (tenants, cardBalance, cashBalance, opEx, revenue, topEx, netBurnOrIncome, netBurnOrIncomeStoryCard, cashPosition, cashInCashOut, insightsView, companyPassportView, tasksCard, billPayCard, reimbursementCard, apAgingReport, arAgingReport, zeniAccountsPromoCard, rewardsPlanCard, cards, monthEndCloseChecksView, tenantState, additionalExcludedReports, isTreasuryVideoClosed) => {
46
46
  const isReimbursementFeatureEnabled = tenants.currentTenant.company?.featuresActivationInfo
47
47
  .isReimbursementFeatureEnabled;
48
48
  const isBillPayFeatureEnabled = tenants.currentTenant.company?.featuresActivationInfo
@@ -72,20 +72,24 @@ export const getDashboard = createSelector(tenantSelector, getCardBalance, getCa
72
72
  if (connectionName === 'netsuite') {
73
73
  cardsToRemove.add('cash_in_cash_out');
74
74
  }
75
- const { isUncategorizedExpenseAccountIdentified, isUncategorizedIncomeAccountIdentified, numOfBillsPendingApproval, numOfReimbursementsPendingApproval, } = tasksCard.tasks;
75
+ const { isUncategorizedExpenseAccountIdentified, isUncategorizedIncomeAccountIdentified, isUncategorizedExpensesTransactionsExist, isUncategorizedIncomeTransactionsExist, numOfBillsPendingApproval, numOfReimbursementsPendingApproval, } = tasksCard.tasks;
76
76
  const showUncategorizedAccountMapping = isUncategorizedExpenseAccountIdentified === false ||
77
77
  isUncategorizedIncomeAccountIdentified === false;
78
- // Filter out task card if tenant is Expense Automation and there are no tasks other than Expense
79
- const isZeniUser = isZeniSignedInUser(signedInUser);
80
- const isExpenseAutomationEnabledForUser = isExpenseAutomationFeatureEnabledV2 ||
81
- (isExpenseAutomationFeatureEnabled && isZeniUser);
82
- const isEmptyTaskCardForExpenseAutomation = showUncategorizedAccountMapping !== true &&
78
+ // Drop the card only when it would render no rows at all. This mirrors every
79
+ // row TasksCard can show; keep the two lists in step. Expense Automation
80
+ // tenants are no longer a special case — they see the uncategorized expense
81
+ // and income rows like everyone else, so those rows count towards emptiness.
82
+ // Only judge emptiness once the payload has arrived, so a pending fetch
83
+ // never hides the card.
84
+ const isTaskCardEmpty = tasksCard.fetchState === 'Completed' &&
85
+ showUncategorizedAccountMapping === false &&
83
86
  numOfBillsPendingApproval === 0 &&
84
87
  numOfReimbursementsPendingApproval === 0 &&
85
- isExpenseAutomationEnabledForUser;
88
+ isUncategorizedExpensesTransactionsExist === false &&
89
+ isUncategorizedIncomeTransactionsExist === false;
86
90
  if (tasksCard.showCard === false ||
87
91
  hasTasksCardAccess === false ||
88
- isEmptyTaskCardForExpenseAutomation) {
92
+ isTaskCardEmpty) {
89
93
  cardsToRemove.add('task_card');
90
94
  }
91
95
  const isBankerOrInvestor = tenants.currentTenant?.userRole != null &&
@@ -1,8 +1,7 @@
1
1
  import { createSelector } from '@reduxjs/toolkit';
2
2
  import omit from 'lodash/omit';
3
- import { reduceAllFetchState, reduceAnyFetchState, } from '../../../commonStateTypes/reduceFetchState';
4
3
  import { toMonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
5
- import { getCurrentTenant, getIsAccountingClassesEnabled, getIsAccountingProjectsEnabled, } from '../../../entity/tenant/tenantSelector';
4
+ import { getCurrentTenant, getIsAccountingProjectsEnabled, } from '../../../entity/tenant/tenantSelector';
6
5
  import { getTransactionWithCOT } from '../../../entity/transaction/transactionHelper';
7
6
  import { getSupportedTransactionsByIds } from '../../../entity/transaction/transactionSelector';
8
7
  import { getAccountList, getNestedAccountListHierarchy, getUncategorizedAccounts, } from '../../accountList/accountListSelector';
@@ -86,7 +85,7 @@ export const toTransactionView = (transaction, transactionLocalData) => {
86
85
  // `view/createTransferEntry/createTransferEntrySelector`.
87
86
  export { getLastTransferEntryReplacement } from '../../createTransferEntry/createTransferEntrySelector';
88
87
  export function getExpenseAutomationTransactionView(state) {
89
- const { accountState, classState, classListState, accountListState, createTransferEntryState, expenseAutomationTransactionsViewState, expenseAutomationViewState, projectState, projectListState, transactionState, monthEndCloseChecksState, monthEndCloseChecksViewState, } = state;
88
+ const { accountState, classState, classListState, accountListState, createTransferEntryState, expenseAutomationTransactionsViewState, expenseAutomationViewState, projectState, projectListState, transactionState, monthEndCloseChecksState, } = state;
90
89
  const { selectedTransactionCategorizationCompletedSubTab, selectedTransactionCategorizationTab, } = expenseAutomationTransactionsViewState;
91
90
  const { uiState, refreshStatus, saveStatus, markAsNotMiscategorizedStatus, transactionIdsBySelectedPeriod, transactionReviewLocalDataById, selectedCheckBoxTransactionIds, transactionIdsWithUnsavedData, uploadReceiptStatusById, selectedTransactionId, selectedTransactionLineId, filters, } = expenseAutomationTransactionsViewState.transactionCategorizationView[selectedTransactionCategorizationTab];
92
91
  const uncategorizedIncomeExpense = getUncategorizedAccounts(accountState, accountListState, 'accountList');
@@ -159,21 +158,8 @@ export function getExpenseAutomationTransactionView(state) {
159
158
  }
160
159
  return [];
161
160
  });
162
- const monthEndFetchState = monthYearPeriodId != null
163
- ? (monthEndCloseChecksViewState.monthEndCloseChecksViewByTenantId[currentTenant.tenantId]?.[monthYearPeriodId] ?? { fetchState: 'Not-Started', error: undefined })
164
- : { fetchState: 'Not-Started', error: undefined };
165
- const isAccountingClassesEnabled = getIsAccountingClassesEnabled(state);
166
- const allFetchStateList = [
167
- accountList,
168
- expenseAutomationTransactionsViewState.transactionCategorizationView[selectedTransactionCategorizationTab],
169
- ];
170
- if (isAccountingClassesEnabled) {
171
- allFetchStateList.push(classList);
172
- }
173
- const fetchStatus = reduceAnyFetchState([
174
- reduceAllFetchState(allFetchStateList),
175
- monthEndFetchState,
176
- ]);
161
+ const { fetchState, error } = expenseAutomationTransactionsViewState.transactionCategorizationView[selectedTransactionCategorizationTab];
162
+ const fetchStatus = { fetchState, error };
177
163
  const totalCountByReview = expenseAutomationTransactionsViewState.transactionCategorizationView.review
178
164
  .uiState.totalCount;
179
165
  const totalCountByAutoCat = expenseAutomationTransactionsViewState.transactionCategorizationView
@@ -1,6 +1,6 @@
1
1
  import { ReportID, SelectorReport, SelectorView } from '../../commonStateTypes/viewAndReport/viewAndReport';
2
2
  import { TenantsOrdered } from '../../entity/tenant/tenantSelector';
3
- import { LoggedInUser, Tenant } from '../../entity/tenant/tenantState';
3
+ import { Tenant } from '../../entity/tenant/tenantState';
4
4
  import { RootState } from '../../reducer';
5
5
  import { CardType } from './dashboardState';
6
6
  export interface DashboardReport extends SelectorReport {
@@ -11,5 +11,4 @@ export interface DashboardReport extends SelectorReport {
11
11
  tenantsOrdered: TenantsOrdered;
12
12
  currentTenant?: Tenant;
13
13
  }
14
- export declare const getDashboard: (state: RootState, additionalExcludedReports: ReportID[], // used when reports are excluded through statsig
15
- signedInUser: LoggedInUser | undefined, isExpenseAutomationFeatureEnabledV2: boolean, isExpenseAutomationFeatureEnabled: boolean) => DashboardReport;
14
+ export declare const getDashboard: (state: RootState, additionalExcludedReports: ReportID[]) => DashboardReport;
@@ -45,7 +45,7 @@ const tenantSelector = (0, toolkit_1.createSelector)(tenantSelector_1.getTenants
45
45
  exports.getDashboard = (0, toolkit_1.createSelector)(tenantSelector, cardBalanceSelector_1.getCardBalance, cashBalanceSelector_1.getCashBalance, getOperatingExpensesForLast5Periods, getRevenueForLast4Periods, topExSelector_1.getTop6Expenses, getNetBurnOrIncomeForLast4Periods, getNetBurnOrIncomeStoryCard, getCashPositionLast5Periods, getCashInCashOutLast4Periods, insightsCardSelector_1.getInsights, companyPassportViewSelector_1.getCompanyPassportView, tasksCardSelector_1.getTasksCardReport, billPayCardSelector_1.getBillPayCardReport, reimbursementCardSelector_1.getReimbursementCardReport, apAgingSelector, arAgingSelector, zeniAccountsPromoCardSelector_1.getZeniAccountsPromoCard, referralSelector_1.getRewardsPlanCard, dashboardLayoutSelector_1.getDashboardCardsOrdered, (state) => {
46
46
  const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
47
47
  return (0, monthEndCloseChecksViewSelector_1.getMonthEndCloseChecksViewByTenantId)(state, currentTenant.tenantId);
48
- }, (state) => state.tenantState, (_state, additionalExcludedReports) => additionalExcludedReports, (_state, _additionalExcludedReports, signedInUser) => signedInUser, (_state, _excluded, _signedInUser, isExpenseAutomationFeatureEnabledV2) => isExpenseAutomationFeatureEnabledV2, (_state, _excluded, _signedInUser, _enabledV2, isExpenseAutomationFeatureEnabled) => isExpenseAutomationFeatureEnabled, (state) => state.dashboardState.isTreasuryVideoClosed, (tenants, cardBalance, cashBalance, opEx, revenue, topEx, netBurnOrIncome, netBurnOrIncomeStoryCard, cashPosition, cashInCashOut, insightsView, companyPassportView, tasksCard, billPayCard, reimbursementCard, apAgingReport, arAgingReport, zeniAccountsPromoCard, rewardsPlanCard, cards, monthEndCloseChecksView, tenantState, additionalExcludedReports, signedInUser, isExpenseAutomationFeatureEnabledV2, isExpenseAutomationFeatureEnabled, isTreasuryVideoClosed) => {
48
+ }, (state) => state.tenantState, (_state, additionalExcludedReports) => additionalExcludedReports, (state) => state.dashboardState.isTreasuryVideoClosed, (tenants, cardBalance, cashBalance, opEx, revenue, topEx, netBurnOrIncome, netBurnOrIncomeStoryCard, cashPosition, cashInCashOut, insightsView, companyPassportView, tasksCard, billPayCard, reimbursementCard, apAgingReport, arAgingReport, zeniAccountsPromoCard, rewardsPlanCard, cards, monthEndCloseChecksView, tenantState, additionalExcludedReports, isTreasuryVideoClosed) => {
49
49
  const isReimbursementFeatureEnabled = tenants.currentTenant.company?.featuresActivationInfo
50
50
  .isReimbursementFeatureEnabled;
51
51
  const isBillPayFeatureEnabled = tenants.currentTenant.company?.featuresActivationInfo
@@ -75,20 +75,24 @@ exports.getDashboard = (0, toolkit_1.createSelector)(tenantSelector, cardBalance
75
75
  if (connectionName === 'netsuite') {
76
76
  cardsToRemove.add('cash_in_cash_out');
77
77
  }
78
- const { isUncategorizedExpenseAccountIdentified, isUncategorizedIncomeAccountIdentified, numOfBillsPendingApproval, numOfReimbursementsPendingApproval, } = tasksCard.tasks;
78
+ const { isUncategorizedExpenseAccountIdentified, isUncategorizedIncomeAccountIdentified, isUncategorizedExpensesTransactionsExist, isUncategorizedIncomeTransactionsExist, numOfBillsPendingApproval, numOfReimbursementsPendingApproval, } = tasksCard.tasks;
79
79
  const showUncategorizedAccountMapping = isUncategorizedExpenseAccountIdentified === false ||
80
80
  isUncategorizedIncomeAccountIdentified === false;
81
- // Filter out task card if tenant is Expense Automation and there are no tasks other than Expense
82
- const isZeniUser = (0, userRoleType_1.isZeniSignedInUser)(signedInUser);
83
- const isExpenseAutomationEnabledForUser = isExpenseAutomationFeatureEnabledV2 ||
84
- (isExpenseAutomationFeatureEnabled && isZeniUser);
85
- const isEmptyTaskCardForExpenseAutomation = showUncategorizedAccountMapping !== true &&
81
+ // Drop the card only when it would render no rows at all. This mirrors every
82
+ // row TasksCard can show; keep the two lists in step. Expense Automation
83
+ // tenants are no longer a special case — they see the uncategorized expense
84
+ // and income rows like everyone else, so those rows count towards emptiness.
85
+ // Only judge emptiness once the payload has arrived, so a pending fetch
86
+ // never hides the card.
87
+ const isTaskCardEmpty = tasksCard.fetchState === 'Completed' &&
88
+ showUncategorizedAccountMapping === false &&
86
89
  numOfBillsPendingApproval === 0 &&
87
90
  numOfReimbursementsPendingApproval === 0 &&
88
- isExpenseAutomationEnabledForUser;
91
+ isUncategorizedExpensesTransactionsExist === false &&
92
+ isUncategorizedIncomeTransactionsExist === false;
89
93
  if (tasksCard.showCard === false ||
90
94
  hasTasksCardAccess === false ||
91
- isEmptyTaskCardForExpenseAutomation) {
95
+ isTaskCardEmpty) {
92
96
  cardsToRemove.add('task_card');
93
97
  }
94
98
  const isBankerOrInvestor = tenants.currentTenant?.userRole != null &&
@@ -7,7 +7,6 @@ exports.getLastTransferEntryReplacement = exports.toTransactionView = exports.ge
7
7
  exports.getExpenseAutomationTransactionView = getExpenseAutomationTransactionView;
8
8
  const toolkit_1 = require("@reduxjs/toolkit");
9
9
  const omit_1 = __importDefault(require("lodash/omit"));
10
- const reduceFetchState_1 = require("../../../commonStateTypes/reduceFetchState");
11
10
  const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
12
11
  const tenantSelector_1 = require("../../../entity/tenant/tenantSelector");
13
12
  const transactionHelper_1 = require("../../../entity/transaction/transactionHelper");
@@ -96,7 +95,7 @@ exports.toTransactionView = toTransactionView;
96
95
  var createTransferEntrySelector_2 = require("../../createTransferEntry/createTransferEntrySelector");
97
96
  Object.defineProperty(exports, "getLastTransferEntryReplacement", { enumerable: true, get: function () { return createTransferEntrySelector_2.getLastTransferEntryReplacement; } });
98
97
  function getExpenseAutomationTransactionView(state) {
99
- const { accountState, classState, classListState, accountListState, createTransferEntryState, expenseAutomationTransactionsViewState, expenseAutomationViewState, projectState, projectListState, transactionState, monthEndCloseChecksState, monthEndCloseChecksViewState, } = state;
98
+ const { accountState, classState, classListState, accountListState, createTransferEntryState, expenseAutomationTransactionsViewState, expenseAutomationViewState, projectState, projectListState, transactionState, monthEndCloseChecksState, } = state;
100
99
  const { selectedTransactionCategorizationCompletedSubTab, selectedTransactionCategorizationTab, } = expenseAutomationTransactionsViewState;
101
100
  const { uiState, refreshStatus, saveStatus, markAsNotMiscategorizedStatus, transactionIdsBySelectedPeriod, transactionReviewLocalDataById, selectedCheckBoxTransactionIds, transactionIdsWithUnsavedData, uploadReceiptStatusById, selectedTransactionId, selectedTransactionLineId, filters, } = expenseAutomationTransactionsViewState.transactionCategorizationView[selectedTransactionCategorizationTab];
102
101
  const uncategorizedIncomeExpense = (0, accountListSelector_1.getUncategorizedAccounts)(accountState, accountListState, 'accountList');
@@ -169,21 +168,8 @@ function getExpenseAutomationTransactionView(state) {
169
168
  }
170
169
  return [];
171
170
  });
172
- const monthEndFetchState = monthYearPeriodId != null
173
- ? (monthEndCloseChecksViewState.monthEndCloseChecksViewByTenantId[currentTenant.tenantId]?.[monthYearPeriodId] ?? { fetchState: 'Not-Started', error: undefined })
174
- : { fetchState: 'Not-Started', error: undefined };
175
- const isAccountingClassesEnabled = (0, tenantSelector_1.getIsAccountingClassesEnabled)(state);
176
- const allFetchStateList = [
177
- accountList,
178
- expenseAutomationTransactionsViewState.transactionCategorizationView[selectedTransactionCategorizationTab],
179
- ];
180
- if (isAccountingClassesEnabled) {
181
- allFetchStateList.push(classList);
182
- }
183
- const fetchStatus = (0, reduceFetchState_1.reduceAnyFetchState)([
184
- (0, reduceFetchState_1.reduceAllFetchState)(allFetchStateList),
185
- monthEndFetchState,
186
- ]);
171
+ const { fetchState, error } = expenseAutomationTransactionsViewState.transactionCategorizationView[selectedTransactionCategorizationTab];
172
+ const fetchStatus = { fetchState, error };
187
173
  const totalCountByReview = expenseAutomationTransactionsViewState.transactionCategorizationView.review
188
174
  .uiState.totalCount;
189
175
  const totalCountByAutoCat = expenseAutomationTransactionsViewState.transactionCategorizationView
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.1.76-betaDI0",
3
+ "version": "5.1.77",
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",