@zeniai/client-epic-state 4.18.96 → 4.18.97

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.
@@ -37,7 +37,6 @@ const fetchDashboardEpic = (actions$, state$) => actions$.pipe((0, operators_1.f
37
37
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
38
38
  const { userId, companyId, fetchFullReport, cacheOverride, excludeResources, tenantId, } = action.payload;
39
39
  const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state$.value);
40
- const userRoleMap = (0, userRoleType_1.getUserRoleMap)(currentTenant.userRole);
41
40
  const isReimbursementFeatureEnabled = (_a = currentTenant.company) === null || _a === void 0 ? void 0 : _a.featuresActivationInfo.isReimbursementFeatureEnabled;
42
41
  const isAdmin = Boolean(currentTenant === null || currentTenant === void 0 ? void 0 : currentTenant.userRole) === true
43
42
  ? (0, userRoleType_1.hasAdminLevelAccess)(currentTenant.userRole)
@@ -89,7 +88,7 @@ const fetchDashboardEpic = (actions$, state$) => actions$.pipe((0, operators_1.f
89
88
  refreshViewInBackground: false,
90
89
  }));
91
90
  }
92
- if ((0, userRoleType_1.hasTreasuryAccess)(userRoleMap)) {
91
+ if (excludeResources.includes('treasury_promo_card') === false) {
93
92
  actions.push((0, treasurySetupViewReducer_1.fetchTreasuryFunds)());
94
93
  }
95
94
  return (0, rxjs_1.from)(actions);
@@ -205,7 +204,7 @@ const fetchDashboardEpic = (actions$, state$) => actions$.pipe((0, operators_1.f
205
204
  .fetchState !== 'In-Progress' &&
206
205
  state.treasurySetupViewState.treasuryFundsDetails.fetchStatus
207
206
  .fetchState !== 'Completed' &&
208
- (0, userRoleType_1.hasTreasuryAccess)(userRoleMap)) {
207
+ excludeResources.includes('treasury_promo_card') === false) {
209
208
  fetchActions.push((0, treasurySetupViewReducer_1.fetchTreasuryFunds)());
210
209
  }
211
210
  return (0, rxjs_1.from)(fetchActions);
@@ -1,7 +1,6 @@
1
1
  import { ReportID, SelectorReport, SelectorView } from '../../commonStateTypes/viewAndReport/viewAndReport';
2
2
  import { TenantsOrdered } from '../../entity/tenant/tenantSelector';
3
3
  import { LoggedInUser, Tenant } from '../../entity/tenant/tenantState';
4
- import { RoleMap } from '../../entity/userRole/userRoleType';
5
4
  import { RootState } from '../../reducer';
6
5
  import { CardType } from './dashboardState';
7
6
  export interface DashboardReport extends SelectorReport {
@@ -12,4 +11,4 @@ export interface DashboardReport extends SelectorReport {
12
11
  currentTenant?: Tenant;
13
12
  }
14
13
  export declare const getDashboard: (state: RootState, additionalExcludedReports: ReportID[], // used when reports are excluded through statsig
15
- signedInUser: LoggedInUser | undefined, isExpenseAutomationFeatureEnabledV2: boolean, isExpenseAutomationFeatureEnabled: boolean, isDebitCardFeatureEnabled: boolean, isTreasuryFeatureEnabled: boolean, userRoleMap?: RoleMap) => DashboardReport;
14
+ signedInUser: LoggedInUser | undefined, isExpenseAutomationFeatureEnabledV2: boolean, isExpenseAutomationFeatureEnabled: boolean, isDebitCardFeatureEnabled: boolean, isTreasuryFeatureEnabled: boolean) => 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, _excluded, _signedInUser, _enabledV2, _enabled, isDebitCardFeatureEnabled) => isDebitCardFeatureEnabled, (_state, _excluded, _signedInUser, _enabledV2, _enabled, _debitEnabled, isTreasuryFeatureEnabled) => isTreasuryFeatureEnabled, (_state, _excluded, _signedInUser, _enabledV2, _enabled, _debitEnabled, _treasuryEnabled, userRoleMap) => userRoleMap, (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, isDebitCardFeatureEnabled, isTreasuryFeatureEnabled, userRoleMap) => {
48
+ }, (state) => state.tenantState, (_state, additionalExcludedReports) => additionalExcludedReports, (_state, _additionalExcludedReports, signedInUser) => signedInUser, (_state, _excluded, _signedInUser, isExpenseAutomationFeatureEnabledV2) => isExpenseAutomationFeatureEnabledV2, (_state, _excluded, _signedInUser, _enabledV2, isExpenseAutomationFeatureEnabled) => isExpenseAutomationFeatureEnabled, (_state, _excluded, _signedInUser, _enabledV2, _enabled, isDebitCardFeatureEnabled) => isDebitCardFeatureEnabled, (_state, _excluded, _signedInUser, _enabledV2, _enabled, _debitEnabled, isTreasuryFeatureEnabled) => isTreasuryFeatureEnabled, (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, isDebitCardFeatureEnabled, isTreasuryFeatureEnabled) => {
49
49
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
50
50
  const isReimbursementFeatureEnabled = (_a = tenants.currentTenant.company) === null || _a === void 0 ? void 0 : _a.featuresActivationInfo.isReimbursementFeatureEnabled;
51
51
  const isBillPayFeatureEnabled = (_b = tenants.currentTenant.company) === null || _b === void 0 ? void 0 : _b.featuresActivationInfo.isBillPayFeatureEnabled;
@@ -182,11 +182,8 @@ exports.getDashboard = (0, toolkit_1.createSelector)(tenantSelector, cardBalance
182
182
  }
183
183
  }
184
184
  // remove treasury promo card if its already enabled
185
- const isUserHasTreasuryAccess = (0, userRoleType_1.hasTreasuryAccess)(userRoleMap);
186
185
  const isTreasuryTOSAccepted = (_0 = (_z = tenants.currentTenant.companyTreasuryInfo) === null || _z === void 0 ? void 0 : _z.info) === null || _0 === void 0 ? void 0 : _0.isTreasuryTOSAccepted;
187
- if (isTreasuryTOSAccepted === true ||
188
- isTreasuryFeatureEnabled === false ||
189
- isUserHasTreasuryAccess === false) {
186
+ if (isTreasuryTOSAccepted === true || isTreasuryFeatureEnabled === false) {
190
187
  cardsToRemove.add('treasury_promo_card');
191
188
  }
192
189
  cardsCopy = cardsCopy.filter((c) => !cardsToRemove.has(c));
@@ -10,15 +10,10 @@ const getTreasuryTransferMoney = (state) => {
10
10
  const { treasuryTransferMoneyState, treasuryDetailState, treasurySetupViewState, depositAccountState, paymentAccountState, depositAccountListState, paymentAccountListState, } = state;
11
11
  const { localData, fetchState, error } = treasuryTransferMoneyState;
12
12
  const depositAccountsView = (0, depositAccountListSelector_1.getAllDepositAccounts)(depositAccountState, depositAccountListState);
13
- const paymentAccountsView = (0, paymentAccountListSelector_1.getAllPaymentAccounts)(paymentAccountState, paymentAccountListState);
14
13
  let transferParties = [];
15
- const transferMoneyPartiesFetchState = (0, reduceFetchState_1.reduceAllFetchState)([
16
- depositAccountsView,
17
- paymentAccountsView,
18
- ]).fetchState;
19
- if (depositAccountsView.fetchState === 'Completed' &&
20
- paymentAccountsView.fetchState === 'Completed') {
21
- transferParties = (0, setupViewSelector_1.getAllFundingAccounts)(depositAccountsView.depositAccounts, paymentAccountsView.paymentAccounts, paymentAccountListState.paymentAccountBalanceFetchStatus);
14
+ const transferMoneyPartiesFetchState = depositAccountsView.fetchState;
15
+ if (depositAccountsView.fetchState === 'Completed') {
16
+ transferParties = depositAccountsView.depositAccounts.map((depositAcc) => (0, setupViewSelector_1.mapDepositAccToFundingAccount)(depositAcc));
22
17
  }
23
18
  const primaryPaymentAccount = (0, paymentAccountListSelector_1.getPrimaryPaymentAccount)(paymentAccountState, paymentAccountListState);
24
19
  const treasuryAccount = {
@@ -30,7 +25,6 @@ const getTreasuryTransferMoney = (state) => {
30
25
  };
31
26
  const allRequiredDataFetchState = (0, reduceFetchState_1.reduceAllFetchState)([
32
27
  depositAccountsView,
33
- paymentAccountsView,
34
28
  treasuryDetailState,
35
29
  treasurySetupViewState.currentAllocation.fetchStatus,
36
30
  treasurySetupViewState,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.18.96",
3
+ "version": "4.18.97",
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
  "types": "lib/index.d.ts",