@zeniai/client-epic-state 4.17.66 → 4.17.67

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.
@@ -87,4 +87,5 @@ export declare const isTenantBankingOnly: (tenant: Tenant | undefined) => boolea
87
87
  export declare const isTenantCardsOnly: (tenant: Tenant | undefined) => boolean;
88
88
  export declare const isTenantBookkeepingEnabled: (tenant: Tenant | undefined) => boolean;
89
89
  export declare const isOtherProductsEnabledForTenant: (tenant: Tenant | undefined) => boolean;
90
+ export declare const isTenantTreasuryEnabled: (tenant: Tenant | undefined) => boolean;
90
91
  export {};
@@ -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.isOtherProductsEnabledForTenant = exports.isTenantBookkeepingEnabled = 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.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");
@@ -291,3 +291,10 @@ const isOtherProductsEnabledForTenant = (tenant) => {
291
291
  : false;
292
292
  };
293
293
  exports.isOtherProductsEnabledForTenant = isOtherProductsEnabledForTenant;
294
+ const isTenantTreasuryEnabled = (tenant) => {
295
+ // if the tenants API takes time, tenant can be non null with productSettings as null
296
+ return tenant != null && tenant.productSettings != null
297
+ ? tenant.productSettings.isTreasuryEnabled === true
298
+ : false;
299
+ };
300
+ exports.isTenantTreasuryEnabled = isTenantTreasuryEnabled;
@@ -114,11 +114,20 @@ const getSelectedProducts = (tenant) => {
114
114
  const isBookkeepingEnabled = (0, tenantSelector_1.isTenantBookkeepingEnabled)(tenant);
115
115
  const isOtherProductsEnabled = (0, tenantSelector_1.isOtherProductsEnabledForTenant)(tenant);
116
116
  const isCardsEnabled = (0, tenantSelector_1.isTenantCardsOnly)(tenant);
117
+ const isTreasuryEnabled = (0, tenantSelector_1.isTenantTreasuryEnabled)(tenant);
117
118
  if (isCardsEnabled && isBankingOnly) {
118
- return ['zeni_cards', 'zeni_checking'];
119
+ const selectedProducts = ['zeni_cards', 'zeni_checking'];
120
+ if (isTreasuryEnabled) {
121
+ selectedProducts.push('zeni_treasury');
122
+ }
123
+ return selectedProducts;
119
124
  }
120
125
  else if (isBankingOnly) {
121
- return ['zeni_checking'];
126
+ const selectedProducts = ['zeni_checking'];
127
+ if (isTreasuryEnabled) {
128
+ selectedProducts.push('zeni_treasury');
129
+ }
130
+ return selectedProducts;
122
131
  }
123
132
  else if (isCardsEnabled) {
124
133
  return ['zeni_cards'];
@@ -128,8 +137,9 @@ const getSelectedProducts = (tenant) => {
128
137
  'bookkeeping',
129
138
  'zeni_bill_pay',
130
139
  'zeni_checking',
131
- 'zeni_bill_pay',
132
140
  'zeni_reimbursements',
141
+ 'zeni_treasury',
142
+ 'zeni_cards',
133
143
  ];
134
144
  }
135
145
  else if (isOtherProductsEnabled) {
@@ -16,7 +16,7 @@ exports.initialState = {
16
16
  transactions: [],
17
17
  uiState: {
18
18
  sortKey: 'date',
19
- sortOrder: 'ascending',
19
+ sortOrder: 'descending',
20
20
  scrollYOffset: 0,
21
21
  },
22
22
  },
@@ -34,7 +34,6 @@ export interface AccountHistoryWithBalance {
34
34
  date: ZeniDate;
35
35
  }
36
36
  export declare const initialAccountHistoryWithBalances: AccountHistoryWithBalances;
37
- export declare const initialTreasuryDetail: TreasuryDetailState;
38
37
  export declare const toTreasurySortKeyType: (v: string) => "date" | "amount" | "description";
39
38
  export declare type TreasuryViewSortKey = ReturnType<typeof toTreasurySortKeyType>;
40
39
  export interface TreasuryListUIState extends SpendManagementUIState {
@@ -1,31 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toTreasurySortKeyType = exports.initialTreasuryDetail = exports.initialAccountHistoryWithBalances = void 0;
3
+ exports.toTreasurySortKeyType = exports.initialAccountHistoryWithBalances = void 0;
4
4
  const stringToUnion_1 = require("../../../../commonStateTypes/stringToUnion");
5
5
  exports.initialAccountHistoryWithBalances = {
6
6
  fetchState: 'Not-Started',
7
7
  error: undefined,
8
8
  accountHistoryWithBalance: [],
9
9
  };
10
- exports.initialTreasuryDetail = {
11
- accountHistory: exports.initialAccountHistoryWithBalances,
12
- accountSummary: undefined,
13
- transactionsState: {
14
- fetchState: 'Not-Started',
15
- error: undefined,
16
- transactions: [],
17
- uiState: {
18
- sortKey: 'date',
19
- sortOrder: 'ascending',
20
- scrollYOffset: 0,
21
- },
22
- },
23
- fetchState: 'Not-Started',
24
- error: undefined,
25
- hasValidState() {
26
- return this.fetchState == 'Completed';
27
- },
28
- };
29
10
  const ALL_TREASURY_SORT_KEYS = ['description', 'date', 'amount'];
30
11
  const toTreasurySortKeyType = (v) => (0, stringToUnion_1.stringToUnion)(v, ALL_TREASURY_SORT_KEYS);
31
12
  exports.toTreasurySortKeyType = toTreasurySortKeyType;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.17.66",
3
+ "version": "4.17.67",
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",