@zeniai/client-epic-state 4.17.44 → 4.17.46

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.
@@ -176,7 +176,7 @@ interface CompanyZeniAccountInfoPayload {
176
176
  deposit_accounts_info: CompanyZeniAccountInfoDataPayload;
177
177
  }
178
178
  interface CompanyTreasuryInfoPayload {
179
- treasury_accounts_info: CompanyTreasuryInfoDataPayload;
179
+ treasury_accounts_info?: CompanyTreasuryInfoDataPayload;
180
180
  }
181
181
  interface CompanyChargeCardInfoPayload {
182
182
  charge_cards_info: CompanyChargeCardInfoDataPayload;
@@ -211,7 +211,7 @@ interface CompanyFeaturesActivationInfoPayload {
211
211
  connected_account_provider: string;
212
212
  is_feature_vendor_listing_enabled: boolean;
213
213
  }
214
- export declare const toCompanyTreasuryInfo: (payload: CompanyTreasuryInfoDataPayload) => CompanyTreasuryInfo;
214
+ export declare const toCompanyTreasuryInfo: (payload: CompanyTreasuryInfoDataPayload | undefined) => CompanyTreasuryInfo;
215
215
  export declare const toOnboardingInfo: (onboardingInfoPayload?: OnboardingInfoPayload) => OnboardingInfo | undefined;
216
216
  interface CompanyManagementUserRolePayload {
217
217
  is_zeni: boolean;
@@ -197,7 +197,12 @@ const toCompanyZeniAccountInfo = (payload) => {
197
197
  };
198
198
  const toCompanyTreasuryInfo = (payload) => {
199
199
  var _a, _b, _c, _d, _e, _f;
200
- return ({
200
+ if (!payload) {
201
+ return {
202
+ isTreasuryTOSAccepted: false,
203
+ };
204
+ }
205
+ return {
201
206
  treasuryTOSAcceptanceUserid: (_a = payload.treasury_accounts_tos_acceptance_user_id) !== null && _a !== void 0 ? _a : undefined,
202
207
  treasuryTOSAcceptanceUserAgent: (_b = payload.treasury_accounts_tos_acceptance_user_agent) !== null && _b !== void 0 ? _b : undefined,
203
208
  treasuryTOSAcceptanceTime: payload.treasury_accounts_tos_acceptance_time != null
@@ -221,7 +226,7 @@ const toCompanyTreasuryInfo = (payload) => {
221
226
  companyVerificationStatus: payload.company_verification_status != null
222
227
  ? (0, exports.toAllowedValueWithCode)(payload.company_verification_status)
223
228
  : undefined,
224
- });
229
+ };
225
230
  };
226
231
  exports.toCompanyTreasuryInfo = toCompanyTreasuryInfo;
227
232
  const toCompanyChargeCardInfo = (payload) => {
@@ -515,11 +515,11 @@ const hasZeniAccountsAccessible = (currentTenant, userRoleMap) => {
515
515
  };
516
516
  exports.hasZeniAccountsAccessible = hasZeniAccountsAccessible;
517
517
  const hasTreasuryAccessible = (currentTenant, userRoleMap) => {
518
- var _a;
518
+ var _a, _b;
519
519
  if (currentTenant == null || userRoleMap === null) {
520
520
  return false;
521
521
  }
522
- const isTreasuryTOSAccepted = Boolean((_a = currentTenant.company) === null || _a === void 0 ? void 0 : _a.companyTreasuryInfo.isTreasuryTOSAccepted);
522
+ const isTreasuryTOSAccepted = Boolean((_b = (_a = currentTenant.company) === null || _a === void 0 ? void 0 : _a.companyTreasuryInfo) === null || _b === void 0 ? void 0 : _b.isTreasuryTOSAccepted);
523
523
  return isTreasuryTOSAccepted && (0, exports.hasTreasuryAdminLevelAccess)(userRoleMap);
524
524
  };
525
525
  exports.hasTreasuryAccessible = hasTreasuryAccessible;
@@ -40,7 +40,7 @@ function getApprovalRuleViewDetails(state) {
40
40
  };
41
41
  }
42
42
  function getBankConnectionsSetupViewDetails(state, companyId, isBillPayEnabled, isRemiEnabled, isAccountEnabled, isCardEnabled, isTreasuryEnabled) {
43
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
43
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
44
44
  const { accountState, settingsViewState, paymentAccountState, depositAccountState, depositAccountListState, paymentAccountListState, } = state;
45
45
  const { bankConnection } = settingsViewState;
46
46
  const { paymentAccountIds } = paymentAccountListState;
@@ -92,7 +92,7 @@ function getBankConnectionsSetupViewDetails(state, companyId, isBillPayEnabled,
92
92
  const remiPrimaryAccount = (_f = companyView === null || companyView === void 0 ? void 0 : companyView.company.company.companyReimbursementInfo.primaryFundingAccount) === null || _f === void 0 ? void 0 : _f.accountId;
93
93
  const accountsPrimaryAccount = (_g = companyView === null || companyView === void 0 ? void 0 : companyView.company.company.companyZeniAccountInfo.primaryFundingAccount) === null || _g === void 0 ? void 0 : _g.accountId; //companyZeniAccountInfo
94
94
  const chargeCardsPrimaryAccount = (_h = companyView === null || companyView === void 0 ? void 0 : companyView.company.company.companyChargeCardInfo.primaryFundingAccount) === null || _h === void 0 ? void 0 : _h.accountId; //companyChargeCardInfo
95
- const treasuryPrimaryAccount = (_j = companyView === null || companyView === void 0 ? void 0 : companyView.company.company.companyTreasuryInfo.primaryFundingAccount) === null || _j === void 0 ? void 0 : _j.accountId; //companyTreasuryInfo
95
+ const treasuryPrimaryAccount = (_k = (_j = companyView === null || companyView === void 0 ? void 0 : companyView.company.company.companyTreasuryInfo) === null || _j === void 0 ? void 0 : _j.primaryFundingAccount) === null || _k === void 0 ? void 0 : _k.accountId; //companyTreasuryInfo
96
96
  const primaryAccounts = [];
97
97
  if (billPayPrimaryAccount != null && isBillPayEnabled) {
98
98
  primaryAccounts.push(billPayPrimaryAccount);
@@ -61,6 +61,7 @@ function getCommonSetupViewDetails(state, companyId, setupViewType, plaidAccount
61
61
  };
62
62
  }
63
63
  function getPrimaryAccountForTheProduct(state, companyId, setupViewType) {
64
+ var _a;
64
65
  const companyView = (0, getCompanyView_1.getCompanyView)(state, companyId, []);
65
66
  if (companyView == null) {
66
67
  return undefined;
@@ -85,7 +86,7 @@ function getPrimaryAccountForTheProduct(state, companyId, setupViewType) {
85
86
  }
86
87
  else if (setupViewType === 'zeni_treasury') {
87
88
  primaryFundingAccount =
88
- companyView.company.company.companyTreasuryInfo.primaryFundingAccount;
89
+ (_a = companyView.company.company.companyTreasuryInfo) === null || _a === void 0 ? void 0 : _a.primaryFundingAccount;
89
90
  }
90
91
  return primaryFundingAccount;
91
92
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.17.44",
3
+ "version": "4.17.46",
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",