@zeniai/client-epic-state 4.11.47 → 4.11.49
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.
- package/lib/view/settingsView/settingsViewHelpers.js +12 -6
- package/lib/view/settingsView/settingsViewSelector.js +4 -4
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +14 -10
- package/lib/view/spendManagement/billPay/editBillView/epics/fetchEditBillDetailPageEpic.d.ts +2 -2
- package/lib/view/spendManagement/billPay/editBillView/epics/fetchEditBillDetailPageEpic.js +6 -6
- package/lib/view/spendManagement/commonSetup/setupViewSelector.js +7 -1
- package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/getPaymentAccountsEpic.js +2 -1
- package/lib/view/spendManagement/plaidAccount/plaidAccountViewReducer.d.ts +2 -1
- package/lib/view/spendManagement/plaidAccount/plaidAccountViewReducer.js +5 -3
- package/lib/view/spendManagement/plaidAccount/plaidAccountViewState.d.ts +1 -0
- package/lib/view/spendManagement/plaidAccount/plaidAccountViewState.js +1 -0
- package/package.json +1 -1
|
@@ -11,7 +11,8 @@ const isAccountingTabVisible = (userRole, currentTenant, userRoleMap) => {
|
|
|
11
11
|
return (((0, userRoleType_1.hasBillPayAccessible)(currentTenant, userRoleMap) ||
|
|
12
12
|
(0, userRoleType_1.hasReimbursementAccessible)(currentTenant, userRoleMap) ||
|
|
13
13
|
(0, userRoleType_1.hasFullOrAdminLevelAccess)(userRole)) &&
|
|
14
|
-
(0, tenantSelector_1.isTenantBankingOnly)(currentTenant) === false
|
|
14
|
+
(0, tenantSelector_1.isTenantBankingOnly)(currentTenant) === false &&
|
|
15
|
+
(0, tenantSelector_1.isTenantCardsOnly)(currentTenant) === false);
|
|
15
16
|
}
|
|
16
17
|
else {
|
|
17
18
|
return false;
|
|
@@ -30,7 +31,8 @@ const isApprovalRulesTabVisible = (userRole, currentTenant, userRoleMap) => {
|
|
|
30
31
|
(0, userRoleType_1.hasReimbursementAccessible)(currentTenant, userRoleMap) ||
|
|
31
32
|
((isBillPayTOSAccepted || isReimbursementTOSAccepted) &&
|
|
32
33
|
(0, userRoleType_1.hasFullOrAdminLevelAccess)(userRole))) &&
|
|
33
|
-
(0, tenantSelector_1.isTenantBankingOnly)(currentTenant) === false
|
|
34
|
+
(0, tenantSelector_1.isTenantBankingOnly)(currentTenant) === false &&
|
|
35
|
+
(0, tenantSelector_1.isTenantCardsOnly)(currentTenant) === false);
|
|
34
36
|
}
|
|
35
37
|
else {
|
|
36
38
|
return false;
|
|
@@ -46,7 +48,8 @@ const isBankConnectionsTabVisible = (currentTenant, userRoleMap) => {
|
|
|
46
48
|
(0, userRoleType_1.hasReimbursementAccessible)(currentTenant, userRoleMap) ||
|
|
47
49
|
(0, userRoleType_1.hasZeniAccountsAccessible)(currentTenant, userRoleMap) ||
|
|
48
50
|
(0, userRoleType_1.hasChargeCardAccessible)(currentTenant, userRoleMap)) &&
|
|
49
|
-
(0, tenantSelector_1.isTenantBankingOnly)(currentTenant) === false
|
|
51
|
+
(0, tenantSelector_1.isTenantBankingOnly)(currentTenant) === false &&
|
|
52
|
+
(0, tenantSelector_1.isTenantCardsOnly)(currentTenant) === false);
|
|
50
53
|
}
|
|
51
54
|
else {
|
|
52
55
|
return false;
|
|
@@ -62,7 +65,8 @@ const isBusinessVerificationTabVisible = (currentTenant, userRoleMap) => {
|
|
|
62
65
|
(0, userRoleType_1.hasReimbursementAccessible)(currentTenant, userRoleMap) ||
|
|
63
66
|
(0, userRoleType_1.hasZeniAccountsAccessible)(currentTenant, userRoleMap) ||
|
|
64
67
|
(0, userRoleType_1.hasChargeCardAccessible)(currentTenant, userRoleMap)) &&
|
|
65
|
-
(0, tenantSelector_1.isTenantBankingOnly)(currentTenant) === false
|
|
68
|
+
(0, tenantSelector_1.isTenantBankingOnly)(currentTenant) === false &&
|
|
69
|
+
(0, tenantSelector_1.isTenantCardsOnly)(currentTenant) === false);
|
|
66
70
|
}
|
|
67
71
|
else {
|
|
68
72
|
return false;
|
|
@@ -88,7 +92,8 @@ const isIntegrationsTabVisible = (userRole, currentTenant) => {
|
|
|
88
92
|
return false;
|
|
89
93
|
}
|
|
90
94
|
if ((0, exports.isSettingsVisible)(currentTenant)) {
|
|
91
|
-
return ((0, userRoleType_1.hasFullOrAdminLevelAccess)(userRole) &&
|
|
95
|
+
return ((0, userRoleType_1.hasFullOrAdminLevelAccess)(userRole) &&
|
|
96
|
+
!((0, tenantSelector_1.isTenantBankingOnly)(currentTenant) || (0, tenantSelector_1.isTenantCardsOnly)(currentTenant)));
|
|
92
97
|
}
|
|
93
98
|
else {
|
|
94
99
|
return false;
|
|
@@ -137,6 +142,7 @@ const isNotificationsTabVisible = (notificationSettings, signedInUseEmail, curre
|
|
|
137
142
|
const { reminderNotificationSettings, monthEndInsightsNotificationSettings } = notificationSettings;
|
|
138
143
|
return (((0, exports.isRemindersSectionVisibleOnSettingsPage)(reminderNotificationSettings) ||
|
|
139
144
|
(0, exports.isMonthEndNotificationsSectionVisibleOnSettingsPage)(monthEndInsightsNotificationSettings, signedInUseEmail)) &&
|
|
140
|
-
(0, tenantSelector_1.isTenantBankingOnly)(currentTenant) === false
|
|
145
|
+
(0, tenantSelector_1.isTenantBankingOnly)(currentTenant) === false &&
|
|
146
|
+
(0, tenantSelector_1.isTenantCardsOnly)(currentTenant) === false);
|
|
141
147
|
};
|
|
142
148
|
exports.isNotificationsTabVisible = isNotificationsTabVisible;
|
|
@@ -74,16 +74,16 @@ function getBankConnectionsSetupViewDetails(state, companyId, isAccountEnabled,
|
|
|
74
74
|
const accountsPrimaryAccount = (_e = companyView === null || companyView === void 0 ? void 0 : companyView.company.company.companyZeniAccountInfo.primaryFundingAccount) === null || _e === void 0 ? void 0 : _e.accountId; //companyZeniAccountInfo
|
|
75
75
|
const chargeCardsPrimaryAccount = (_f = companyView === null || companyView === void 0 ? void 0 : companyView.company.company.companyChargeCardInfo.primaryFundingAccount) === null || _f === void 0 ? void 0 : _f.accountId; //companyChargeCardInfo
|
|
76
76
|
const primaryAccounts = [];
|
|
77
|
-
if (billPayPrimaryAccount) {
|
|
77
|
+
if (billPayPrimaryAccount != null) {
|
|
78
78
|
primaryAccounts.push(billPayPrimaryAccount);
|
|
79
79
|
}
|
|
80
|
-
if (remiPrimaryAccount) {
|
|
80
|
+
if (remiPrimaryAccount != null) {
|
|
81
81
|
primaryAccounts.push(remiPrimaryAccount);
|
|
82
82
|
}
|
|
83
|
-
if (accountsPrimaryAccount) {
|
|
83
|
+
if (accountsPrimaryAccount != null) {
|
|
84
84
|
primaryAccounts.push(accountsPrimaryAccount);
|
|
85
85
|
}
|
|
86
|
-
if (chargeCardsPrimaryAccount) {
|
|
86
|
+
if (chargeCardsPrimaryAccount != null) {
|
|
87
87
|
primaryAccounts.push(chargeCardsPrimaryAccount);
|
|
88
88
|
}
|
|
89
89
|
const nonPrimaryPaymentAccounts = paymentAccounts.filter((paymentAcc) => !primaryAccounts.includes(paymentAcc.paymentAccountId));
|
|
@@ -61,16 +61,20 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
|
|
|
61
61
|
? (_f = (_e = tenantState.tenantsById) === null || _e === void 0 ? void 0 : _e[currentTenantId]) === null || _f === void 0 ? void 0 : _f.companyId
|
|
62
62
|
: undefined;
|
|
63
63
|
const currentCompany = (0, companySelector_1.getCompanyByCompanyId)(companyState, companyId !== null && companyId !== void 0 ? companyId : '');
|
|
64
|
-
const primaryPaymentAccount = (0, paymentAccountSelector_1.getPaymentAccountsByPaymentAccountIds)(paymentAccountState,
|
|
65
|
-
|
|
66
|
-
(transaction === null || transaction === void 0 ? void 0 : transaction.billPayInfo.fromAccount.billAccountId) != null
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
64
|
+
const primaryPaymentAccount = (0, paymentAccountSelector_1.getPaymentAccountsByPaymentAccountIds)(paymentAccountState, paymentAccountListState.paymentAccountIds);
|
|
65
|
+
const fromPaymentAccount = (transaction === null || transaction === void 0 ? void 0 : transaction.billPayInfo.fromAccount.billAccountType) === 'paymentAccount' &&
|
|
66
|
+
(transaction === null || transaction === void 0 ? void 0 : transaction.billPayInfo.fromAccount.billAccountId) != null
|
|
67
|
+
? (0, paymentAccountSelector_1.getPaymentAccountsByPaymentAccountIds)(paymentAccountState, [
|
|
68
|
+
transaction.billPayInfo.fromAccount.billAccountId,
|
|
69
|
+
])
|
|
70
|
+
: undefined;
|
|
71
|
+
// add the account received in the transaction fromAccount
|
|
72
|
+
// if its not already present in the payment account list
|
|
73
|
+
if (fromPaymentAccount != null &&
|
|
74
|
+
fromPaymentAccount.length > 0 &&
|
|
75
|
+
primaryPaymentAccount.some((account) => account.paymentAccountId === fromPaymentAccount[0].paymentAccountId) === false) {
|
|
76
|
+
primaryPaymentAccount.push(fromPaymentAccount[0]);
|
|
77
|
+
}
|
|
74
78
|
const fromDepositAccount = (transaction === null || transaction === void 0 ? void 0 : transaction.billPayInfo.fromAccount.billAccountType) === 'depositAccount' &&
|
|
75
79
|
(transaction === null || transaction === void 0 ? void 0 : transaction.billPayInfo.fromAccount.billAccountId) != null
|
|
76
80
|
? (0, depositAccountSelector_1.getDepositAccountByDepositAccountId)(depositAccountState, transaction === null || transaction === void 0 ? void 0 : transaction.billPayInfo.fromAccount.billAccountId)
|
package/lib/view/spendManagement/billPay/editBillView/epics/fetchEditBillDetailPageEpic.d.ts
CHANGED
|
@@ -4,11 +4,11 @@ import { fetchEditBillDetailPage, updateShowAutofill } from '../editBillViewRedu
|
|
|
4
4
|
import { RootState } from '../../../../../reducer';
|
|
5
5
|
import { fetchClassList } from '../../../../classList/classListReducer';
|
|
6
6
|
import { fetchAccountList } from '../../../../accountList/accountListReducer';
|
|
7
|
-
import { getPaymentAccounts } from '../../../plaidAccount/plaidAccountViewReducer';
|
|
8
7
|
import { fetchBillPaySetupApproverView } from '../../billPaySetupApproverView/billPaySetupApproverViewReducer';
|
|
9
8
|
import { fetchOwnerList } from '../../../../ownerList/ownerListReducer';
|
|
10
9
|
import { fetchVendorTypeList } from '../../../../vendorTypeList/vendorTypeListReducer';
|
|
11
10
|
import { fetchBillPayConfig } from '../../billPayConfig/billPayConfigReducer';
|
|
12
11
|
import { fetchDepositAccountList } from '../../../zeniAccounts/depositAccountList/depositAccountListReducer';
|
|
13
|
-
|
|
12
|
+
import { fetchPaymentAccountList } from '../../../zeniAccounts/paymentAccountList/paymentAccountListReducer';
|
|
13
|
+
export declare type ActionType = ReturnType<typeof fetchEditBillDetailPage> | ReturnType<typeof fetchClassList> | ReturnType<typeof fetchVendorTypeList> | ReturnType<typeof fetchAccountList> | ReturnType<typeof fetchPaymentAccountList> | ReturnType<typeof fetchDepositAccountList> | ReturnType<typeof fetchBillPayConfig> | ReturnType<typeof updateShowAutofill> | ReturnType<typeof fetchBillPaySetupApproverView> | ReturnType<typeof fetchOwnerList>;
|
|
14
14
|
export declare const fetchEditBillDetailPageEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
|
|
@@ -6,13 +6,13 @@ const operators_1 = require("rxjs/operators");
|
|
|
6
6
|
const editBillViewReducer_1 = require("../editBillViewReducer");
|
|
7
7
|
const classListReducer_1 = require("../../../../classList/classListReducer");
|
|
8
8
|
const accountListReducer_1 = require("../../../../accountList/accountListReducer");
|
|
9
|
-
const plaidAccountViewReducer_1 = require("../../../plaidAccount/plaidAccountViewReducer");
|
|
10
9
|
const billPaySetupApproverViewReducer_1 = require("../../billPaySetupApproverView/billPaySetupApproverViewReducer");
|
|
11
10
|
const ownerListReducer_1 = require("../../../../ownerList/ownerListReducer");
|
|
12
11
|
const vendorTypeListReducer_1 = require("../../../../vendorTypeList/vendorTypeListReducer");
|
|
13
12
|
const billPayConfigReducer_1 = require("../../billPayConfig/billPayConfigReducer");
|
|
14
13
|
const depositAccountListReducer_1 = require("../../../zeniAccounts/depositAccountList/depositAccountListReducer");
|
|
15
14
|
const companySelector_1 = require("../../../../../entity/company/companySelector");
|
|
15
|
+
const paymentAccountListReducer_1 = require("../../../zeniAccounts/paymentAccountList/paymentAccountListReducer");
|
|
16
16
|
const fetchEditBillDetailPageEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(editBillViewReducer_1.fetchEditBillDetailPage.match), (0, operators_1.mergeMap)((action) => {
|
|
17
17
|
var _a, _b, _c;
|
|
18
18
|
const { cacheOverride, billId, isShowDeletedBillsEnabled } = action.payload;
|
|
@@ -34,7 +34,7 @@ const fetchEditBillDetailPageEpic = (actions$, state$) => actions$.pipe((0, oper
|
|
|
34
34
|
if (isCompanyZeniAccountsSetUpDone) {
|
|
35
35
|
billDetailActions.push((0, depositAccountListReducer_1.fetchDepositAccountList)());
|
|
36
36
|
}
|
|
37
|
-
billDetailActions.push((0,
|
|
37
|
+
billDetailActions.push((0, paymentAccountListReducer_1.fetchPaymentAccountList)());
|
|
38
38
|
if (billId != null) {
|
|
39
39
|
billDetailActions.push((0, editBillViewReducer_1.fetchBillAndInitializeLocalStore)(billId, true, isShowDeletedBillsEnabled));
|
|
40
40
|
}
|
|
@@ -73,10 +73,10 @@ const fetchEditBillDetailPageEpic = (actions$, state$) => actions$.pipe((0, oper
|
|
|
73
73
|
depositAccounts.fetchState !== 'Completed') {
|
|
74
74
|
billDetailActions.push((0, depositAccountListReducer_1.fetchDepositAccountList)());
|
|
75
75
|
}
|
|
76
|
-
const
|
|
77
|
-
if (
|
|
78
|
-
|
|
79
|
-
billDetailActions.push((0,
|
|
76
|
+
const paymentAccounts = state.paymentAccountListState;
|
|
77
|
+
if (paymentAccounts.fetchState !== 'In-Progress' &&
|
|
78
|
+
paymentAccounts.fetchState !== 'Completed') {
|
|
79
|
+
billDetailActions.push((0, paymentAccountListReducer_1.fetchPaymentAccountList)());
|
|
80
80
|
}
|
|
81
81
|
if (billId != null) {
|
|
82
82
|
billDetailActions.push((0, editBillViewReducer_1.fetchBillAndInitializeLocalStore)(billId, false, isShowDeletedBillsEnabled));
|
|
@@ -10,7 +10,7 @@ const paymentAccountSelector_1 = require("../../../entity/paymentAccount/payment
|
|
|
10
10
|
const depositAccountSelector_1 = require("../../../entity/depositAccount/depositAccountSelector");
|
|
11
11
|
const depositAccountPayload_1 = require("../../../entity/depositAccount/depositAccountPayload");
|
|
12
12
|
function getCommonSetupViewDetails(state, companyId, setupViewType, plaidAccountKeyType) {
|
|
13
|
-
var _a, _b, _c;
|
|
13
|
+
var _a, _b, _c, _d;
|
|
14
14
|
const { accountState, setupViewState, paymentAccountState, paymentAccountListState, depositAccountState, depositAccountListState, plaidAccountViewState, } = state;
|
|
15
15
|
const { updateStatus } = setupViewState;
|
|
16
16
|
const { accountDetails, plaidConnectionDetails } = (0, plaidAccountViewSelector_1.getPlaidAccountDetails)(plaidAccountViewState, plaidAccountKeyType);
|
|
@@ -38,9 +38,15 @@ function getCommonSetupViewDetails(state, companyId, setupViewType, plaidAccount
|
|
|
38
38
|
primaryFundingAccount = (0, exports.mapPaymentAccToFundingAccount)(paymentAccount);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
+
let paymentAccountForBilling;
|
|
42
|
+
if (((_d = accountDetails.paymentAccountIds) === null || _d === void 0 ? void 0 : _d.length) > 0) {
|
|
43
|
+
const paymentAccountId = accountDetails.paymentAccountIds[0];
|
|
44
|
+
paymentAccountForBilling = (0, paymentAccountSelector_1.getPaymentAccountByPaymentAccountId)(paymentAccountState, paymentAccountId);
|
|
45
|
+
}
|
|
41
46
|
return {
|
|
42
47
|
companyBillPayInfo,
|
|
43
48
|
primaryFundingAccount,
|
|
49
|
+
paymentAccount: paymentAccountForBilling,
|
|
44
50
|
allFundingAccounts,
|
|
45
51
|
allBankAccounts,
|
|
46
52
|
plaidConnectionDetails,
|
package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/getPaymentAccountsEpic.js
CHANGED
|
@@ -24,10 +24,11 @@ const getPaymentAccountsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0,
|
|
|
24
24
|
.getJSON(`${zeniAPI.apiEndPoints.payMicroServiceBaseUrl}/1.0/payment-accounts?query=${encodeURIComponent(JSON.stringify(queryParams))}`)
|
|
25
25
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
26
26
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
27
|
+
const paymentAccountIds = response.data.payment_accounts.map((paymentAccount) => paymentAccount.payment_account_id);
|
|
27
28
|
const actions = [
|
|
28
29
|
(0, accountReducer_1.updateAccounts)(response.data.accounts, setupViewType),
|
|
29
30
|
(0, paymentAccountReducer_1.updatePaymentAccounts)(response.data.payment_accounts),
|
|
30
|
-
(0, plaidAccountViewReducer_1.getPaymentAccountsSuccess)(plaidAccountKeyType),
|
|
31
|
+
(0, plaidAccountViewReducer_1.getPaymentAccountsSuccess)(paymentAccountIds, plaidAccountKeyType),
|
|
31
32
|
];
|
|
32
33
|
return (0, rxjs_1.from)(actions);
|
|
33
34
|
}
|
|
@@ -5,7 +5,8 @@ export declare const getPaymentAccounts: import("@reduxjs/toolkit").ActionCreato
|
|
|
5
5
|
setupViewType: "bill_pay" | "reimbursement" | "zeni_accounts" | "charge_cards" | "billing";
|
|
6
6
|
includeBalances: boolean;
|
|
7
7
|
plaidAccountKeyType: PlaidAccountKeyType;
|
|
8
|
-
}, string, never, never>, getPaymentAccountsSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[plaidAccountKeyType: PlaidAccountKeyType], {
|
|
8
|
+
}, string, never, never>, getPaymentAccountsSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[paymentAccountIds: string[], plaidAccountKeyType: PlaidAccountKeyType], {
|
|
9
|
+
paymentAccountIds: string[];
|
|
9
10
|
plaidAccountKeyType: PlaidAccountKeyType;
|
|
10
11
|
}, string, never, never>, getPaymentAccountsFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[error: ZeniAPIStatus<Record<string, unknown>>, plaidAccountKeyType: PlaidAccountKeyType], {
|
|
11
12
|
error: ZeniAPIStatus<Record<string, unknown>>;
|
|
@@ -39,15 +39,17 @@ const plaidAccountView = (0, toolkit_1.createSlice)({
|
|
|
39
39
|
},
|
|
40
40
|
getPaymentAccountsSuccess: {
|
|
41
41
|
reducer(draft, action) {
|
|
42
|
-
const { plaidAccountKeyType } = action.payload;
|
|
42
|
+
const { plaidAccountKeyType, paymentAccountIds } = action.payload;
|
|
43
43
|
draft[plaidAccountKeyType].accountDetails.fetchStatus = {
|
|
44
44
|
fetchState: 'Completed',
|
|
45
45
|
error: undefined,
|
|
46
46
|
};
|
|
47
|
+
draft[plaidAccountKeyType].accountDetails.paymentAccountIds =
|
|
48
|
+
paymentAccountIds;
|
|
47
49
|
},
|
|
48
|
-
prepare(plaidAccountKeyType) {
|
|
50
|
+
prepare(paymentAccountIds, plaidAccountKeyType) {
|
|
49
51
|
return {
|
|
50
|
-
payload: { plaidAccountKeyType },
|
|
52
|
+
payload: { paymentAccountIds, plaidAccountKeyType },
|
|
51
53
|
};
|
|
52
54
|
},
|
|
53
55
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.11.
|
|
3
|
+
"version": "4.11.49",
|
|
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",
|