@zeniai/client-epic-state 5.1.8-betaML1 → 5.1.8-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.
@@ -85,6 +85,7 @@ export declare const getCurrentTenantExternalConnections: (tenantState: TenantSt
85
85
  export declare const toTenantCoreDetailsView: (tenantsBaseView: TenantBaseView[]) => TenantCoreDetailsView[];
86
86
  export declare const isTenantBankingOnly: (isDebitCardFlagEnabled: boolean, tenant: Tenant | undefined) => boolean;
87
87
  export declare const isTenantCardsOnly: (tenant: Tenant | undefined) => boolean;
88
+ export declare const isTenantUsingAccountingServices: (tenant: Tenant | undefined) => boolean;
88
89
  export declare const getIsAccountingClassesEnabled: (state: RootState) => boolean;
89
90
  export declare const getIsAccountingProjectsEnabled: (state: RootState) => boolean;
90
91
  export declare const isTenantBookkeepingEnabled: (tenant: Tenant | undefined) => boolean;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.isTenantTreasuryEnabled = exports.isOtherProductsEnabledForTenant = exports.isTenantBookkeepingEnabled = exports.getIsAccountingProjectsEnabled = exports.getIsAccountingClassesEnabled = exports.isTenantCardsOnly = exports.isTenantBankingOnly = exports.toTenantCoreDetailsView = exports.getCurrentTenantExternalConnections = exports.isTenantUsingZeniCOA = exports.isZeniDomainTenant = exports.getTenantBaseViewForTenantView = exports.getTenantsCoreDetailsByCheckInDateSelector = exports.getTenantsBaseByCheckInDateSelector = exports.getTenantBaseById = exports.getTenantsByCheckInDateSelector = exports.getCurrentTenant = exports.getTenantBaseViewForTenantId = void 0;
6
+ exports.isTenantTreasuryEnabled = exports.isOtherProductsEnabledForTenant = exports.isTenantBookkeepingEnabled = exports.getIsAccountingProjectsEnabled = exports.getIsAccountingClassesEnabled = exports.isTenantUsingAccountingServices = exports.isTenantCardsOnly = exports.isTenantBankingOnly = exports.toTenantCoreDetailsView = exports.getCurrentTenantExternalConnections = exports.isTenantUsingZeniCOA = exports.isZeniDomainTenant = exports.getTenantBaseViewForTenantView = exports.getTenantsCoreDetailsByCheckInDateSelector = exports.getTenantsBaseByCheckInDateSelector = exports.getTenantBaseById = exports.getTenantsByCheckInDateSelector = exports.getCurrentTenant = exports.getTenantBaseViewForTenantId = void 0;
7
7
  exports.getTenant = getTenant;
8
8
  exports.getOnboardingTenantByTenantId = getOnboardingTenantByTenantId;
9
9
  const toolkit_1 = require("@reduxjs/toolkit");
@@ -280,6 +280,17 @@ const isTenantCardsOnly = (tenant) => {
280
280
  : false;
281
281
  };
282
282
  exports.isTenantCardsOnly = isTenantCardsOnly;
283
+ const isTenantUsingAccountingServices = (tenant) => {
284
+ const settings = tenant?.productSettings;
285
+ if (settings == null) {
286
+ return false;
287
+ }
288
+ return (settings.isCfoEnabled === true ||
289
+ settings.isTaxEnabled === true ||
290
+ settings.isPayrollEnabled === true ||
291
+ settings.isBookkeepingEnabled === true);
292
+ };
293
+ exports.isTenantUsingAccountingServices = isTenantUsingAccountingServices;
283
294
  const getIsAccountingClassesEnabled = (state) => {
284
295
  const { currentTenantId, tenantsById } = state.tenantState;
285
296
  if (currentTenantId == null) {
@@ -51,8 +51,6 @@ export interface TransactionPayload extends TransactionIDPayload, AccountBasePay
51
51
  to_from_account_integration_id?: string | null;
52
52
  to_from_account_name?: string | null;
53
53
  total_amount?: number;
54
- /** Expense-automation transactions list: line count on the transaction (optional). */
55
- total_lines_count?: number;
56
54
  transaction_type_name?: string;
57
55
  transaction_update_time?: string;
58
56
  vendor_id?: string | null;
@@ -140,7 +140,6 @@ const toTransaction = (payload) => {
140
140
  recommendations: (0, exports.getRecommendationsPerLine)(payload.lines, payload.recommendations) ??
141
141
  undefined,
142
142
  isRecommendedTransaction: payload.is_recommended_transaction,
143
- totalLinesCount: payload.total_lines_count != null ? payload.total_lines_count : null,
144
143
  };
145
144
  };
146
145
  exports.toTransaction = toTransaction;
@@ -56,8 +56,6 @@ export interface Transaction extends BaseTransaction {
56
56
  toFromAccountId?: ID;
57
57
  toFromAccountIntegrationId?: string;
58
58
  toFromAccountName?: string;
59
- /** Expense-automation list API; null when wire omits total_lines_count. */
60
- totalLinesCount?: number | null;
61
59
  updateTime?: ZeniDate;
62
60
  vendorId?: ID;
63
61
  vendorName?: string;
@@ -265,6 +265,16 @@ export const isTenantCardsOnly = (tenant) => {
265
265
  tenant.productSettings.isSpendManagementEnabled === false
266
266
  : false;
267
267
  };
268
+ export const isTenantUsingAccountingServices = (tenant) => {
269
+ const settings = tenant?.productSettings;
270
+ if (settings == null) {
271
+ return false;
272
+ }
273
+ return (settings.isCfoEnabled === true ||
274
+ settings.isTaxEnabled === true ||
275
+ settings.isPayrollEnabled === true ||
276
+ settings.isBookkeepingEnabled === true);
277
+ };
268
278
  export const getIsAccountingClassesEnabled = (state) => {
269
279
  const { currentTenantId, tenantsById } = state.tenantState;
270
280
  if (currentTenantId == null) {
@@ -136,7 +136,6 @@ export const toTransaction = (payload) => {
136
136
  recommendations: getRecommendationsPerLine(payload.lines, payload.recommendations) ??
137
137
  undefined,
138
138
  isRecommendedTransaction: payload.is_recommended_transaction,
139
- totalLinesCount: payload.total_lines_count != null ? payload.total_lines_count : null,
140
139
  };
141
140
  };
142
141
  const payloadHasAccountInfo = (payload) => 'account_name' in payload &&
@@ -81,7 +81,6 @@ export const toTransactionDetailLocalData = (transaction, selectedTab, lineItems
81
81
  };
82
82
  transactionLocal.description = transaction.description;
83
83
  transactionLocal.memo = transaction.memo;
84
- transactionLocal.totalLinesCount = transaction.totalLinesCount ?? null;
85
84
  transactionLocal.transactionDate = transaction.date;
86
85
  transactionLocal.transactionType = transaction.type;
87
86
  transactionLocal.transactionTypeName = transaction.typeName;
@@ -1,4 +1,4 @@
1
- import { isTenantBankingOnly, isTenantCardsOnly, } from '../../entity/tenant/tenantSelector';
1
+ import { isTenantBankingOnly, isTenantCardsOnly, isTenantUsingAccountingServices, } from '../../entity/tenant/tenantSelector';
2
2
  import { hasAnyAdminLevelAccess, hasBillPayAccessible, hasBookKeepingAdminLevelAccess, hasBookKeepingUserLevelAccess, hasChargeCardAccessible, hasFullOrAdminLevelAccess, hasInvestorBankerLevelAccess, hasReimbursementAccess, hasReimbursementAccessible, hasSuperAdminLevelAccess, hasZeniAccountsAccessible, isZeniSignedInUser, } from '../../entity/userRole/userRoleType';
3
3
  import { isVendorsTabVisible } from '../vendorList/vendorListSelector';
4
4
  export const isAccountingTabVisible = (userRole, isDebitCardFlagEnabled, currentTenant, userRoleMap) => {
@@ -94,8 +94,9 @@ export const isIntegrationsTabVisible = (userRole, isDebitCardFlagEnabled, curre
94
94
  }
95
95
  if (isSettingsVisible(currentTenant)) {
96
96
  return (hasFullOrAdminLevelAccess(userRole) &&
97
- !(isTenantBankingOnly(isDebitCardFlagEnabled, currentTenant) ||
98
- isTenantCardsOnly(currentTenant)));
97
+ (isTenantUsingAccountingServices(currentTenant) ||
98
+ !(isTenantBankingOnly(isDebitCardFlagEnabled, currentTenant) ||
99
+ isTenantCardsOnly(currentTenant))));
99
100
  }
100
101
  else {
101
102
  return false;
@@ -88,7 +88,6 @@ const toTransactionDetailLocalData = (transaction, selectedTab, lineItemsByTrans
88
88
  };
89
89
  transactionLocal.description = transaction.description;
90
90
  transactionLocal.memo = transaction.memo;
91
- transactionLocal.totalLinesCount = transaction.totalLinesCount ?? null;
92
91
  transactionLocal.transactionDate = transaction.date;
93
92
  transactionLocal.transactionType = transaction.type;
94
93
  transactionLocal.transactionTypeName = transaction.typeName;
@@ -78,8 +78,6 @@ export interface TransactionReviewLocalData {
78
78
  description?: string;
79
79
  memo?: string;
80
80
  selectedEntity?: Entity;
81
- /** From list API total_lines_count; null when absent on wire. */
82
- totalLinesCount?: number | null;
83
81
  transactionDate?: ZeniDate;
84
82
  transactionType?: TransactionType;
85
83
  transactionTypeName?: string;
@@ -103,8 +103,9 @@ const isIntegrationsTabVisible = (userRole, isDebitCardFlagEnabled, currentTenan
103
103
  }
104
104
  if ((0, exports.isSettingsVisible)(currentTenant)) {
105
105
  return ((0, userRoleType_1.hasFullOrAdminLevelAccess)(userRole) &&
106
- !((0, tenantSelector_1.isTenantBankingOnly)(isDebitCardFlagEnabled, currentTenant) ||
107
- (0, tenantSelector_1.isTenantCardsOnly)(currentTenant)));
106
+ ((0, tenantSelector_1.isTenantUsingAccountingServices)(currentTenant) ||
107
+ !((0, tenantSelector_1.isTenantBankingOnly)(isDebitCardFlagEnabled, currentTenant) ||
108
+ (0, tenantSelector_1.isTenantCardsOnly)(currentTenant))));
108
109
  }
109
110
  else {
110
111
  return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.1.8-betaML1",
3
+ "version": "5.1.8-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",