@zeniai/client-epic-state 4.14.76 → 4.14.78
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/entity/tenant/tenantPayload.d.ts +1 -0
- package/lib/entity/userRole/userRolePayload.d.ts +1 -0
- package/lib/entity/userRole/userRolePayload.js +3 -0
- package/lib/entity/userRole/userRoleType.d.ts +2 -2
- package/lib/entity/userRole/userRoleType.js +6 -7
- package/lib/view/addressView/__mocks__/json/createCompanyUserAddressSuccess.json +1 -0
- package/lib/view/people/helpers/updateManagersListOnRoleChange.js +3 -2
- package/lib/view/people/peoplePayload.d.ts +1 -0
- package/lib/view/spendManagement/reimbursement/remiListView/remiListSelector.d.ts +1 -1
- package/lib/view/spendManagement/reimbursement/remiListView/remiListSelector.js +6 -3
- package/package.json +1 -1
|
@@ -9,6 +9,9 @@ function getUserRoles(userRolePayload) {
|
|
|
9
9
|
if (userRolePayload.is_admin === true) {
|
|
10
10
|
roles.push('admin');
|
|
11
11
|
}
|
|
12
|
+
if (userRolePayload.is_zeni_support_user === true) {
|
|
13
|
+
roles.push('zeni_support_user');
|
|
14
|
+
}
|
|
12
15
|
if (userRolePayload.is_bookkeeping_admin === true) {
|
|
13
16
|
roles.push('bookkeeping_admin');
|
|
14
17
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CurrentTenant, TenantView } from '../tenant/tenantSelector';
|
|
2
2
|
import { LoggedInUser } from '../tenant/tenantState';
|
|
3
|
-
export declare const toUserRoleTypeStrict: (v?: string) => "admin" | "bookkeeping_admin" | "bookkeeping_user" | "investor_or_banker" | "company_officer" | "reimbursements_user" | "bill_pay_admin" | "bill_pay_user" | "reimbursements_admin" | "deposit_accounts_admin" | "deposit_accounts_user" | "charge_card_admin" | "charge_card_user" | "controller" | "tax_lead" | "ap_analyst" | "preparer" | "reviewer" | "customer_success_manager" | undefined;
|
|
4
|
-
export declare const toUserRoleType: (v: string) => "admin" | "bookkeeping_admin" | "bookkeeping_user" | "investor_or_banker" | "company_officer" | "reimbursements_user" | "bill_pay_admin" | "bill_pay_user" | "reimbursements_admin" | "deposit_accounts_admin" | "deposit_accounts_user" | "charge_card_admin" | "charge_card_user" | "controller" | "tax_lead" | "ap_analyst" | "preparer" | "reviewer" | "customer_success_manager";
|
|
3
|
+
export declare const toUserRoleTypeStrict: (v?: string) => "admin" | "bookkeeping_admin" | "bookkeeping_user" | "investor_or_banker" | "company_officer" | "reimbursements_user" | "bill_pay_admin" | "bill_pay_user" | "reimbursements_admin" | "deposit_accounts_admin" | "deposit_accounts_user" | "charge_card_admin" | "charge_card_user" | "controller" | "tax_lead" | "ap_analyst" | "preparer" | "reviewer" | "customer_success_manager" | "zeni_support_user" | undefined;
|
|
4
|
+
export declare const toUserRoleType: (v: string) => "admin" | "bookkeeping_admin" | "bookkeeping_user" | "investor_or_banker" | "company_officer" | "reimbursements_user" | "bill_pay_admin" | "bill_pay_user" | "reimbursements_admin" | "deposit_accounts_admin" | "deposit_accounts_user" | "charge_card_admin" | "charge_card_user" | "controller" | "tax_lead" | "ap_analyst" | "preparer" | "reviewer" | "customer_success_manager" | "zeni_support_user";
|
|
5
5
|
export type UserRoleType = ReturnType<typeof toUserRoleType>;
|
|
6
6
|
export type RoleMap = Record<string, boolean>;
|
|
7
7
|
export declare const isFinOpsUserRoleType: (userRole: UserRoleType) => boolean;
|
|
@@ -9,6 +9,7 @@ const FINOPS_USER_ROLES = [
|
|
|
9
9
|
'preparer',
|
|
10
10
|
'reviewer',
|
|
11
11
|
'customer_success_manager',
|
|
12
|
+
'zeni_support_user',
|
|
12
13
|
];
|
|
13
14
|
const toFinOpsUserRoleTypeStrict = (v) => (0, stringToUnion_1.stringToUnionStrict)(v !== null && v !== void 0 ? v : '', FINOPS_USER_ROLES);
|
|
14
15
|
const ALL_USER_ROLES = [
|
|
@@ -34,13 +35,10 @@ exports.toUserRoleType = toUserRoleType;
|
|
|
34
35
|
const isFinOpsUserRoleType = (userRole) => toFinOpsUserRoleTypeStrict(userRole) != null;
|
|
35
36
|
exports.isFinOpsUserRoleType = isFinOpsUserRoleType;
|
|
36
37
|
const hasAdminLevelAccess = (roles) => {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const finOpsRoles = roles.filter((role) => (0, exports.isFinOpsUserRoleType)(role));
|
|
42
|
-
return finOpsRoles.length > 0; // Any internal finOps roles have admin level access.
|
|
43
|
-
}
|
|
38
|
+
return (roles.includes('admin') ||
|
|
39
|
+
roles.includes('zeni_support_user') ||
|
|
40
|
+
roles.some(exports.isFinOpsUserRoleType) // Check if any role is a FinOps role
|
|
41
|
+
);
|
|
44
42
|
};
|
|
45
43
|
exports.hasAdminLevelAccess = hasAdminLevelAccess;
|
|
46
44
|
// for zeni domain - super admin, bill pay admin and cockpit role users can act as fallback admins
|
|
@@ -420,6 +418,7 @@ const hasAnyFinOpRole = (userRoleMap) => {
|
|
|
420
418
|
}
|
|
421
419
|
if (userRoleMap.controller ||
|
|
422
420
|
userRoleMap.customer_success_manager ||
|
|
421
|
+
userRoleMap.zeni_support_user ||
|
|
423
422
|
userRoleMap.tax_lead ||
|
|
424
423
|
userRoleMap.ap_analyst ||
|
|
425
424
|
userRoleMap.preparer ||
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"update_time": "2021-12-16T10:15:02.615038",
|
|
29
29
|
"inviter_id": "u_70221b69-51a0-4b48-a634-f59391365805",
|
|
30
30
|
"is_admin": true,
|
|
31
|
+
"is_zeni_support_user": false,
|
|
31
32
|
"user_role_id": "ur_003da742-26c2-441a-bd2c-77d91f3762a6",
|
|
32
33
|
"is_investor_or_banker": false,
|
|
33
34
|
"is_deleted": false,
|
|
@@ -3,9 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.updateManagersListOnRoleChange = void 0;
|
|
4
4
|
const userListViewReducer_1 = require("../../userListView/userListViewReducer");
|
|
5
5
|
const updateManagersListOnRoleChange = (actions, userRoles, isZeniTenant) => {
|
|
6
|
-
const { is_admin, is_bookkeeping_admin, is_bookkeeping_user, user_id, is_invite_accepted, is_reimbursements_user, is_zeni, } = userRoles;
|
|
6
|
+
const { is_admin, is_bookkeeping_admin, is_bookkeeping_user, user_id, is_invite_accepted, is_reimbursements_user, is_zeni, is_zeni_support_user, } = userRoles;
|
|
7
7
|
if (is_invite_accepted && (!is_zeni || Boolean(isZeniTenant))) {
|
|
8
|
-
if (
|
|
8
|
+
if (is_zeni_support_user ||
|
|
9
|
+
is_admin ||
|
|
9
10
|
is_bookkeeping_admin ||
|
|
10
11
|
is_bookkeeping_user ||
|
|
11
12
|
is_reimbursements_user) {
|
|
@@ -46,4 +46,4 @@ export interface ReimbursementView extends Reimbursement {
|
|
|
46
46
|
export declare const getRemiList: (state: RootState, currentTimePeriod: TimePeriod, isBulkActionFeatureEnabled: boolean) => RemiListReport;
|
|
47
47
|
export declare const getApproversOrRejectors: (reimbursement: Reimbursement, entityApprovalStatusState: EntityApprovalStatusState, userState: UserState) => Approvers;
|
|
48
48
|
export declare const getRemiListOnSort: (sortKey: ReimbursementViewSortKey, sortOrder: SortOrder, currentTab: RemiTabType, reimbursements: ReimbursementView[]) => ReimbursementView[];
|
|
49
|
-
export declare const getAllowedBulkActions: (selectedTab: RemiTabType, selectedSubTab: RemiSubTabType, isAllAwaitingMyApproval: boolean, isFirstBillProcessing: boolean) => BulkOperationType[];
|
|
49
|
+
export declare const getAllowedBulkActions: (selectedTab: RemiTabType, selectedSubTab: RemiSubTabType, isAllAwaitingMyApproval: boolean, isFirstBillProcessing: boolean, hasReimbursementFromOthers: boolean) => BulkOperationType[];
|
|
@@ -112,9 +112,10 @@ const getRemiList = (state, currentTimePeriod, isBulkActionFeatureEnabled) => {
|
|
|
112
112
|
});
|
|
113
113
|
const allBulkRemisAwaitingMyApproval = (0, difference_1.default)(remisSelectedForBulkAction, pendingApprovalTransactionIDs)
|
|
114
114
|
.length === 0;
|
|
115
|
+
const hasReimbursementFromOthers = reimbursementsDetailed.some((remi) => remi.createdBy !== loggedInUserId);
|
|
115
116
|
const allowedBulkActions = isBulkActionAllowed
|
|
116
117
|
? (0, exports.getAllowedBulkActions)(remiListState.currentTab, remiListState.currentSubTab, allBulkRemisAwaitingMyApproval, (firstRemiInBulkList === null || firstRemiInBulkList === void 0 ? void 0 : firstRemiInBulkList.reimbursementInfo.billPaymentStatus.code) ===
|
|
117
|
-
'processing')
|
|
118
|
+
'processing', hasReimbursementFromOthers)
|
|
118
119
|
: [];
|
|
119
120
|
remiListBulkActionInfo = {
|
|
120
121
|
isBulkActionAllowed,
|
|
@@ -510,10 +511,12 @@ const isRemiSelectableForBulkAction = (reimbursement, selectedTab, firstSelectab
|
|
|
510
511
|
}
|
|
511
512
|
return result;
|
|
512
513
|
};
|
|
513
|
-
const getAllowedBulkActions = (selectedTab, selectedSubTab, isAllAwaitingMyApproval, isFirstBillProcessing) => {
|
|
514
|
+
const getAllowedBulkActions = (selectedTab, selectedSubTab, isAllAwaitingMyApproval, isFirstBillProcessing, hasReimbursementFromOthers) => {
|
|
514
515
|
switch (selectedTab) {
|
|
515
516
|
case 'draft':
|
|
516
|
-
return
|
|
517
|
+
return hasReimbursementFromOthers
|
|
518
|
+
? ['delete']
|
|
519
|
+
: ['send_for_approval', 'delete'];
|
|
517
520
|
case 'pending_approval': {
|
|
518
521
|
switch (selectedSubTab) {
|
|
519
522
|
case 'all':
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.14.
|
|
3
|
+
"version": "4.14.78",
|
|
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",
|