@zeniai/client-epic-state 4.15.90 → 4.15.91

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.
@@ -35,7 +35,7 @@ interface ChargeCardMerchant {
35
35
  export interface ChargeCardTransactionState {
36
36
  chargeCardTransactionById: Record<ID, ChargeCardTransaction>;
37
37
  }
38
- export declare const toCardTransactionTypeCode: (v: string) => "purchase";
38
+ export declare const toCardTransactionTypeCode: (v: string) => "expense" | "credit_card_credit" | "purchase";
39
39
  export type ChargeCardTransactionTypeCode = ReturnType<typeof toCardTransactionTypeCode>;
40
40
  export declare const toCardTransactionStatusCode: (v: string) => "paid" | "canceled" | "authorized" | "declined";
41
41
  export type ChargeCardTransactionStatusCode = ReturnType<typeof toCardTransactionStatusCode>;
@@ -2,7 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.toCardTransactionStatusCode = exports.toCardTransactionTypeCode = void 0;
4
4
  const stringToUnion_1 = require("../../commonStateTypes/stringToUnion");
5
- const CHARGE_CARD_TRANSACTION_TYPE_CODE = ['purchase'];
5
+ const CHARGE_CARD_TRANSACTION_TYPE_CODE = [
6
+ 'purchase',
7
+ 'credit_card_credit',
8
+ 'expense',
9
+ ];
6
10
  const toCardTransactionTypeCode = (v) => (0, stringToUnion_1.stringToUnion)(v, CHARGE_CARD_TRANSACTION_TYPE_CODE);
7
11
  exports.toCardTransactionTypeCode = toCardTransactionTypeCode;
8
12
  const CHARGE_CARD_TRANSACTION_STATUS_CODE = [
@@ -79,7 +79,7 @@ export declare const isZeniDomainTenant: (currentTenant: TenantView) => boolean;
79
79
  export declare const isTenantUsingZeniCOA: (currentTenant: TenantView) => boolean;
80
80
  export declare const getCurrentTenantExternalConnections: (tenantState: TenantState, companyState: CompanyState) => TenantExternalConnections | undefined;
81
81
  export declare const toTenantCoreDetailsView: (tenantsBaseView: TenantBaseView[]) => TenantCoreDetailsView[];
82
- export declare const isTenantBankingOnly: (tenant: Tenant | undefined) => boolean;
82
+ export declare const isTenantBankingOnly: (isDebitCardFlagEnabled: boolean, tenant: Tenant | undefined) => boolean;
83
83
  export declare const isTenantCardsOnly: (tenant: Tenant | undefined) => boolean;
84
84
  export declare const isTenantBookkeepingEnabled: (tenant: Tenant | undefined) => boolean;
85
85
  export declare const isOtherProductsEnabledForTenant: (tenant: Tenant | undefined) => boolean;
@@ -253,10 +253,12 @@ const toTenantCoreDetailsView = (tenantsBaseView) => {
253
253
  });
254
254
  };
255
255
  exports.toTenantCoreDetailsView = toTenantCoreDetailsView;
256
- const isTenantBankingOnly = (tenant) => {
256
+ const isTenantBankingOnly = (isDebitCardFlagEnabled, tenant) => {
257
257
  // if the tenants API takes time, tenant can be non null with productSettings as null
258
258
  return tenant != null && tenant.productSettings != null
259
- ? tenant.productSettings.isBankingEnabled === true &&
259
+ ? (tenant.productSettings.isBankingEnabled === true ||
260
+ //Banking will be enabled if debit card statsig flag is enabled
261
+ isDebitCardFlagEnabled) &&
260
262
  tenant.productSettings.isBookkeepingEnabled === false &&
261
263
  tenant.productSettings.isSpendManagementEnabled === false
262
264
  : false;
@@ -13,7 +13,7 @@ const addressViewReducer_1 = require("../../../addressView/addressViewReducer");
13
13
  const onboardingCockpitViewReducer_1 = require("../onboardingCockpitViewReducer");
14
14
  const initializeOnboardingCustomerViewUpdateDataEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(onboardingCockpitViewReducer_1.initializeOnboardingCustomerViewUpdateData.match), (0, operators_1.mergeMap)((action) => {
15
15
  var _a, _b, _c;
16
- const { companyId } = action.payload;
16
+ const { companyId, isDebitCardFlagEnabled } = action.payload;
17
17
  const fetchActions = [];
18
18
  if (companyId != null) {
19
19
  const onboardingCustomerInfo = (0, onboardingCustomerSelector_1.getOnboardingCustomersByCompanyId)(state$.value.onboardingCustomerState, companyId);
@@ -57,7 +57,7 @@ const initializeOnboardingCustomerViewUpdateDataEpic = (actions$, state$) => act
57
57
  accountingConnectionCreationMode: ((_b = company.company.companyOnboardingInfo.onboardingInfo) === null || _b === void 0 ? void 0 : _b.accountingConnectionCreationMode) != null
58
58
  ? (0, companyStateTypes_1.toAccountingConnectionCreationModeStrict)((_c = company.company.companyOnboardingInfo.onboardingInfo) === null || _c === void 0 ? void 0 : _c.accountingConnectionCreationMode)
59
59
  : undefined,
60
- selectedProducts: getSelectedProducts(tenant),
60
+ selectedProducts: getSelectedProducts(isDebitCardFlagEnabled, tenant),
61
61
  };
62
62
  if (onboardingCustomerId != null) {
63
63
  const onboardingCustomerDetails = (0, userSelector_1.getUserByUserId)(state$.value.userState, onboardingCustomerId);
@@ -106,11 +106,11 @@ const initializeOnboardingCustomerViewUpdateDataEpic = (actions$, state$) => act
106
106
  return (0, rxjs_1.from)(fetchActions);
107
107
  }));
108
108
  exports.initializeOnboardingCustomerViewUpdateDataEpic = initializeOnboardingCustomerViewUpdateDataEpic;
109
- const getSelectedProducts = (tenant) => {
109
+ const getSelectedProducts = (isDebitCardFlagEnabled, tenant) => {
110
110
  if (tenant == null) {
111
111
  return [];
112
112
  }
113
- const isBankingOnly = (0, tenantSelector_1.isTenantBankingOnly)(tenant);
113
+ const isBankingOnly = (0, tenantSelector_1.isTenantBankingOnly)(isDebitCardFlagEnabled, 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);
@@ -30,8 +30,9 @@ export declare const fetchCompanyOnboardingView: import("@reduxjs/toolkit").Acti
30
30
  onboardingEmailGroup: OnboardingEmailGroupPayload;
31
31
  }, "onboardingCockpitView/updateOnboardingEmailGroupOnSuccess", never, never>, updateOnboardingEmailGroupOnFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[error: ZeniAPIStatus<Record<string, unknown>>], {
32
32
  error: ZeniAPIStatus<Record<string, unknown>>;
33
- }, "onboardingCockpitView/updateOnboardingEmailGroupOnFailure", never, never>, initializeOnboardingCustomerViewUpdateData: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[companyId?: string | undefined], {
33
+ }, "onboardingCockpitView/updateOnboardingEmailGroupOnFailure", never, never>, initializeOnboardingCustomerViewUpdateData: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[isDebitCardFlagEnabled: boolean, companyId?: string | undefined], {
34
34
  companyId: string | undefined;
35
+ isDebitCardFlagEnabled: boolean;
35
36
  }, "onboardingCockpitView/initializeOnboardingCustomerViewUpdateData", never, never>, saveOnboardingCustomerViewUpdateData: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[newOnboardingCustomer: Partial<NewOnboardingCustomer>], {
36
37
  newOnboardingCustomer: Partial<NewOnboardingCustomer>;
37
38
  }, "onboardingCockpitView/saveOnboardingCustomerViewUpdateData", never, never>, clearOnboardingCustomerViewUpdateData: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"onboardingCockpitView/clearOnboardingCustomerViewUpdateData">, saveOnboardingCustomerViewUpdates: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[sendInvite: boolean, skipSnackbarOnSuccess?: boolean | undefined], {
@@ -130,8 +130,8 @@ const onboardingCockpitView = (0, toolkit_1.createSlice)({
130
130
  reducer(draft) {
131
131
  draft.customerLocalStoreInitState = 'In-Progress';
132
132
  },
133
- prepare(companyId) {
134
- return { payload: { companyId } };
133
+ prepare(isDebitCardFlagEnabled, companyId) {
134
+ return { payload: { companyId, isDebitCardFlagEnabled } };
135
135
  },
136
136
  },
137
137
  saveOnboardingCustomerViewUpdateData: {
@@ -1,15 +1,15 @@
1
1
  import { CurrentTenant } from '../../entity/tenant/tenantSelector';
2
2
  import { RoleMap, UserRoleType } from '../../entity/userRole/userRoleType';
3
3
  import { MonthEndInsightsNotificationSettingsData, NotificationSettingsData, ReminderNotificationSettingsData } from './settingsViewState';
4
- export declare const isAccountingTabVisible: (userRole: UserRoleType[], currentTenant: CurrentTenant | undefined, userRoleMap?: RoleMap) => boolean;
5
- export declare const isApprovalRulesTabVisible: (userRole: UserRoleType[], currentTenant: CurrentTenant | undefined, userRoleMap?: RoleMap) => boolean;
4
+ export declare const isAccountingTabVisible: (userRole: UserRoleType[], isDebitCardFlagEnabled: boolean, currentTenant: CurrentTenant | undefined, userRoleMap?: RoleMap) => boolean;
5
+ export declare const isApprovalRulesTabVisible: (userRole: UserRoleType[], isDebitCardFlagEnabled: boolean, currentTenant: CurrentTenant | undefined, userRoleMap?: RoleMap) => boolean;
6
6
  export declare const isBillingTabVisible: (userRole: UserRoleType[], currentTenant: CurrentTenant | undefined) => boolean;
7
7
  export declare const isBankConnectionsTabVisible: (currentTenant: CurrentTenant | undefined, userRoleMap?: RoleMap) => boolean;
8
8
  export declare const isBusinessVerificationTabVisible: (currentTenant: CurrentTenant | undefined, userRoleMap?: RoleMap) => boolean;
9
9
  export declare const isCompanyDetailsTabVisible: (userRole: UserRoleType[], currentTenant: CurrentTenant | undefined, userRoleMap?: RoleMap) => boolean;
10
- export declare const isIntegrationsTabVisible: (userRole: UserRoleType[], currentTenant: CurrentTenant | undefined) => boolean;
10
+ export declare const isIntegrationsTabVisible: (userRole: UserRoleType[], isDebitCardFlagEnabled: boolean, currentTenant: CurrentTenant | undefined) => boolean;
11
11
  export declare const isSettingsVisible: (currentTenant: CurrentTenant | undefined) => boolean;
12
12
  export declare const isMyBankConnectionsTabVisible: (currentTenant: CurrentTenant | undefined, userRoleMap?: RoleMap) => boolean;
13
13
  export declare const isRemindersSectionVisibleOnSettingsPage: (reminderNotificationSettings: ReminderNotificationSettingsData) => boolean;
14
14
  export declare const isMonthEndNotificationsSectionVisibleOnSettingsPage: (monthEndInsightsNotificationSettings: MonthEndInsightsNotificationSettingsData, signedInUseEmail: string) => boolean;
15
- export declare const isNotificationsTabVisible: (notificationSettings: NotificationSettingsData, signedInUseEmail: string, currentTenant: CurrentTenant | undefined) => boolean;
15
+ export declare const isNotificationsTabVisible: (notificationSettings: NotificationSettingsData, isDebitCardFlagEnabled: boolean, signedInUseEmail: string, currentTenant: CurrentTenant | undefined) => boolean;
@@ -4,7 +4,7 @@ exports.isNotificationsTabVisible = exports.isMonthEndNotificationsSectionVisibl
4
4
  const tenantSelector_1 = require("../../entity/tenant/tenantSelector");
5
5
  const userRoleType_1 = require("../../entity/userRole/userRoleType");
6
6
  const vendorListSelector_1 = require("../vendorList/vendorListSelector");
7
- const isAccountingTabVisible = (userRole, currentTenant, userRoleMap) => {
7
+ const isAccountingTabVisible = (userRole, isDebitCardFlagEnabled, currentTenant, userRoleMap) => {
8
8
  if (currentTenant == null) {
9
9
  return false;
10
10
  }
@@ -13,7 +13,7 @@ const isAccountingTabVisible = (userRole, currentTenant, userRoleMap) => {
13
13
  (0, userRoleType_1.hasBillPayAccessible)(currentTenant, userRoleMap) ||
14
14
  (0, userRoleType_1.hasReimbursementAccessible)(currentTenant, userRoleMap) ||
15
15
  (0, userRoleType_1.hasFullOrAdminLevelAccess)(userRole)) &&
16
- (0, tenantSelector_1.isTenantBankingOnly)(currentTenant) === false &&
16
+ (0, tenantSelector_1.isTenantBankingOnly)(isDebitCardFlagEnabled, currentTenant) === false &&
17
17
  (0, tenantSelector_1.isTenantCardsOnly)(currentTenant) === false);
18
18
  }
19
19
  else {
@@ -21,7 +21,7 @@ const isAccountingTabVisible = (userRole, currentTenant, userRoleMap) => {
21
21
  }
22
22
  };
23
23
  exports.isAccountingTabVisible = isAccountingTabVisible;
24
- const isApprovalRulesTabVisible = (userRole, currentTenant, userRoleMap) => {
24
+ const isApprovalRulesTabVisible = (userRole, isDebitCardFlagEnabled, currentTenant, userRoleMap) => {
25
25
  var _a, _b;
26
26
  if (currentTenant == null || userRoleMap == null) {
27
27
  return false;
@@ -33,7 +33,7 @@ const isApprovalRulesTabVisible = (userRole, currentTenant, userRoleMap) => {
33
33
  (0, userRoleType_1.hasReimbursementAccessible)(currentTenant, userRoleMap) ||
34
34
  ((isBillPayTOSAccepted || isReimbursementTOSAccepted) &&
35
35
  (0, userRoleType_1.hasFullOrAdminLevelAccess)(userRole))) &&
36
- (0, tenantSelector_1.isTenantBankingOnly)(currentTenant) === false &&
36
+ (0, tenantSelector_1.isTenantBankingOnly)(isDebitCardFlagEnabled, currentTenant) === false &&
37
37
  (0, tenantSelector_1.isTenantCardsOnly)(currentTenant) === false);
38
38
  }
39
39
  else {
@@ -97,13 +97,14 @@ const isCompanyDetailsTabVisible = (userRole, currentTenant, userRoleMap) => {
97
97
  }
98
98
  };
99
99
  exports.isCompanyDetailsTabVisible = isCompanyDetailsTabVisible;
100
- const isIntegrationsTabVisible = (userRole, currentTenant) => {
100
+ const isIntegrationsTabVisible = (userRole, isDebitCardFlagEnabled, currentTenant) => {
101
101
  if (currentTenant == null) {
102
102
  return false;
103
103
  }
104
104
  if ((0, exports.isSettingsVisible)(currentTenant)) {
105
105
  return ((0, userRoleType_1.hasFullOrAdminLevelAccess)(userRole) &&
106
- !((0, tenantSelector_1.isTenantBankingOnly)(currentTenant) || (0, tenantSelector_1.isTenantCardsOnly)(currentTenant)));
106
+ !((0, tenantSelector_1.isTenantBankingOnly)(isDebitCardFlagEnabled, currentTenant) ||
107
+ (0, tenantSelector_1.isTenantCardsOnly)(currentTenant)));
107
108
  }
108
109
  else {
109
110
  return false;
@@ -145,14 +146,14 @@ const isMonthEndNotificationsSectionVisibleOnSettingsPage = (monthEndInsightsNot
145
146
  monthEndInsightsNotificationSettings.recipientEmailIds.includes(signedInUseEmail));
146
147
  };
147
148
  exports.isMonthEndNotificationsSectionVisibleOnSettingsPage = isMonthEndNotificationsSectionVisibleOnSettingsPage;
148
- const isNotificationsTabVisible = (notificationSettings, signedInUseEmail, currentTenant) => {
149
+ const isNotificationsTabVisible = (notificationSettings, isDebitCardFlagEnabled, signedInUseEmail, currentTenant) => {
149
150
  if (currentTenant == null) {
150
151
  return false;
151
152
  }
152
153
  const { reminderNotificationSettings, monthEndInsightsNotificationSettings } = notificationSettings;
153
154
  return (((0, exports.isRemindersSectionVisibleOnSettingsPage)(reminderNotificationSettings) ||
154
155
  (0, exports.isMonthEndNotificationsSectionVisibleOnSettingsPage)(monthEndInsightsNotificationSettings, signedInUseEmail)) &&
155
- (0, tenantSelector_1.isTenantBankingOnly)(currentTenant) === false &&
156
+ (0, tenantSelector_1.isTenantBankingOnly)(isDebitCardFlagEnabled, currentTenant) === false &&
156
157
  (0, tenantSelector_1.isTenantCardsOnly)(currentTenant) === false);
157
158
  };
158
159
  exports.isNotificationsTabVisible = isNotificationsTabVisible;
@@ -91,7 +91,8 @@ const getMyPendingActivationChargeCardListView = (state) => {
91
91
  const cards = (0, chargeCardSelector_1.getChargeCardsByIds)(chargeCardState, chargeCardListState.cardIds);
92
92
  const myUserId = (_a = tenantState.loggedInUser) === null || _a === void 0 ? void 0 : _a.userId;
93
93
  const myPendingActivationChargeCardWithUser = getChargeCardsWithUser(cards, state).filter((chargeCard) => chargeCard.cardHolderUserId === myUserId &&
94
- chargeCard.type.code === 'business_physical_credit_card' &&
94
+ (chargeCard.type.code === 'business_physical_credit_card' ||
95
+ chargeCard.type.code === 'business_physical_debit_card') &&
95
96
  chargeCard.status.code === 'inactive');
96
97
  const sortKey = chargeCardListState.uiState.sortKey;
97
98
  const sortOrder = (0, sortOrderPayload_1.getSortOrder)(chargeCardListState.uiState.sortOrder);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.15.90",
3
+ "version": "4.15.91",
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",