@zeniai/client-epic-state 5.3.6-betaGS3 → 5.3.6-betaGS4
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/jeScheduleApprovalRule/jeScheduleApprovalRulePayload.d.ts +5 -6
- package/lib/entity/jeScheduleApprovalRule/jeScheduleApprovalRulePayload.js +7 -7
- package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +2 -4
- package/lib/entity/jeSchedules/jeSchedulesSelector.js +16 -13
- package/lib/esm/entity/jeScheduleApprovalRule/jeScheduleApprovalRulePayload.js +7 -7
- package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +15 -12
- package/lib/esm/index.js +2 -2
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +9 -2
- package/lib/esm/view/settings/jeScheduleApprovalRules/epic/deleteJEScheduleApprovalRuleEpic.js +23 -5
- package/lib/esm/view/settings/jeScheduleApprovalRules/epic/fetchJEScheduleApprovalRulesEpic.js +5 -2
- package/lib/esm/view/settings/jeScheduleApprovalRules/epic/fetchJEScheduleApproversEpic.js +5 -2
- package/lib/esm/view/settings/jeScheduleApprovalRules/epic/jeScheduleApprovalActionEpic.js +20 -5
- package/lib/esm/view/settings/jeScheduleApprovalRules/epic/reorderJEScheduleApprovalRulesEpic.js +7 -3
- package/lib/esm/view/settings/jeScheduleApprovalRules/epic/saveJEScheduleApprovalRuleEpic.js +22 -5
- package/lib/esm/view/settings/jeScheduleApprovalRules/jeScheduleSetupApproverViewReducer.js +17 -8
- package/lib/esm/view/settings/jeScheduleApprovalRules/jeScheduleSetupApproverViewSelector.js +7 -11
- package/lib/esm/view/settingsView/settingsViewHelpers.js +3 -2
- package/lib/index.d.ts +2 -2
- package/lib/index.js +28 -27
- package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +9 -2
- package/lib/view/settings/jeScheduleApprovalRules/epic/deleteJEScheduleApprovalRuleEpic.d.ts +2 -1
- package/lib/view/settings/jeScheduleApprovalRules/epic/deleteJEScheduleApprovalRuleEpic.js +21 -3
- package/lib/view/settings/jeScheduleApprovalRules/epic/fetchJEScheduleApprovalRulesEpic.d.ts +2 -1
- package/lib/view/settings/jeScheduleApprovalRules/epic/fetchJEScheduleApprovalRulesEpic.js +4 -1
- package/lib/view/settings/jeScheduleApprovalRules/epic/fetchJEScheduleApproversEpic.d.ts +2 -1
- package/lib/view/settings/jeScheduleApprovalRules/epic/fetchJEScheduleApproversEpic.js +4 -1
- package/lib/view/settings/jeScheduleApprovalRules/epic/jeScheduleApprovalActionEpic.d.ts +2 -1
- package/lib/view/settings/jeScheduleApprovalRules/epic/jeScheduleApprovalActionEpic.js +18 -3
- package/lib/view/settings/jeScheduleApprovalRules/epic/reorderJEScheduleApprovalRulesEpic.d.ts +2 -1
- package/lib/view/settings/jeScheduleApprovalRules/epic/reorderJEScheduleApprovalRulesEpic.js +6 -2
- package/lib/view/settings/jeScheduleApprovalRules/epic/saveJEScheduleApprovalRuleEpic.d.ts +2 -1
- package/lib/view/settings/jeScheduleApprovalRules/epic/saveJEScheduleApprovalRuleEpic.js +20 -3
- package/lib/view/settings/jeScheduleApprovalRules/jeScheduleSetupApproverViewPayload.d.ts +3 -3
- package/lib/view/settings/jeScheduleApprovalRules/jeScheduleSetupApproverViewReducer.d.ts +2 -1
- package/lib/view/settings/jeScheduleApprovalRules/jeScheduleSetupApproverViewReducer.js +17 -8
- package/lib/view/settings/jeScheduleApprovalRules/jeScheduleSetupApproverViewSelector.js +7 -14
- package/lib/view/settingsView/settingsViewHelpers.d.ts +1 -1
- package/lib/view/settingsView/settingsViewHelpers.js +3 -2
- package/package.json +1 -1
|
@@ -39,8 +39,8 @@ export interface JEScheduleApprovalRulesListPayload {
|
|
|
39
39
|
export interface JEScheduleApprovalRuleSavePayload extends JEScheduleApprovalRulesListPayload {
|
|
40
40
|
rule: JEScheduleApprovalRulePayload;
|
|
41
41
|
}
|
|
42
|
-
/** Body for POST / PUT `/1.0/je-schedules/approval-rules[/<id>]
|
|
43
|
-
export
|
|
42
|
+
/** Body for POST / PUT `/1.0/je-schedules/approval-rules[/<id>]`; a type alias so it satisfies the `Record<string, unknown>` body param. */
|
|
43
|
+
export type JEScheduleApprovalRuleRequestBody = {
|
|
44
44
|
description: string | null;
|
|
45
45
|
is_applicable_on_pending_approval_entity: boolean;
|
|
46
46
|
is_separation_of_duty_enabled: boolean;
|
|
@@ -48,8 +48,7 @@ export interface JEScheduleApprovalRuleRequestBody {
|
|
|
48
48
|
name: string;
|
|
49
49
|
schedule_types: JEScheduleType[];
|
|
50
50
|
step: JEScheduleApprovalStepPayload;
|
|
51
|
-
|
|
52
|
-
}
|
|
51
|
+
};
|
|
53
52
|
export interface JEScheduleApproverPayload {
|
|
54
53
|
email: string;
|
|
55
54
|
first_name: string;
|
|
@@ -98,5 +97,5 @@ export declare const toJEScheduleApprovalRulePayload: (formData: JEScheduleAppro
|
|
|
98
97
|
export declare const toJEScheduleApprover: (payload: JEScheduleApproverPayload) => JEScheduleApprover;
|
|
99
98
|
export declare const toJEScheduleApproverRole: (payload: JEScheduleApproverRolePayload) => JEScheduleApproverRole;
|
|
100
99
|
export declare const toJEScheduleApprovalInfo: (payload: JEScheduleApprovalInfoPayload | null | undefined) => JEScheduleApprovalInfo | undefined;
|
|
101
|
-
/** Wraps an API status with a typed `kind` and a user-facing message for 403 /
|
|
102
|
-
export declare const toJEScheduleApprovalAPIStatus: (status: ZeniAPIStatus) => JEScheduleApprovalAPIStatus;
|
|
100
|
+
/** Wraps an API status with a typed `kind` and a user-facing message for 403 / 404; a 404 on the action endpoint means the schedule, not the rules, is gone. */
|
|
101
|
+
export declare const toJEScheduleApprovalAPIStatus: (status: ZeniAPIStatus, context?: "rules" | "action") => JEScheduleApprovalAPIStatus;
|
|
@@ -146,13 +146,13 @@ const USER_FACING_MESSAGES = {
|
|
|
146
146
|
not_found: 'JE schedule approval rules are not available for this account.',
|
|
147
147
|
unknown: undefined,
|
|
148
148
|
};
|
|
149
|
-
|
|
150
|
-
|
|
149
|
+
const SCHEDULE_NOT_FOUND_MESSAGE = 'This schedule no longer exists.';
|
|
150
|
+
/** Wraps an API status with a typed `kind` and a user-facing message for 403 / 404; a 404 on the action endpoint means the schedule, not the rules, is gone. */
|
|
151
|
+
const toJEScheduleApprovalAPIStatus = (status, context = 'rules') => {
|
|
151
152
|
const kind = toJEApprovalErrorKind(status.code);
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
kind
|
|
155
|
-
|
|
156
|
-
};
|
|
153
|
+
const message = kind === 'not_found' && context === 'action'
|
|
154
|
+
? status.message || SCHEDULE_NOT_FOUND_MESSAGE
|
|
155
|
+
: (USER_FACING_MESSAGES[kind] ?? status.message);
|
|
156
|
+
return { ...status, kind, message };
|
|
157
157
|
};
|
|
158
158
|
exports.toJEScheduleApprovalAPIStatus = toJEScheduleApprovalAPIStatus;
|
|
@@ -85,10 +85,8 @@ export interface JEOneTimeAccrual extends JEOneTimeAccrualState {
|
|
|
85
85
|
export declare const getJEOneTimeAccrualByKey: (jeOneTimeAccrualKey: JEOneTimeAccrualKey, jeSchedulesState: JESchedulesState) => JEOneTimeAccrual | undefined;
|
|
86
86
|
export declare const getJEAccruedScheduleByJEScheduleKey: (JEScheduleKey: JEScheduleKey, state: RootState) => JEAccruedSchedule | undefined;
|
|
87
87
|
export declare const getJEScheduledTransactionByJEScheduleTransactionKey: (jeScheduleTransactionKey: JEScheduleTransactionKey, state: RootState) => JEScheduledTransaction;
|
|
88
|
-
/**
|
|
89
|
-
|
|
90
|
-
* scans both maps. ponytail: O(n) scan; index by schedule id if lists grow.
|
|
91
|
-
*/
|
|
88
|
+
/** Schedules are keyed by transaction / accrued key, not schedule id, so this re-indexes both maps by schedule id. */
|
|
89
|
+
export declare const getApprovalInfoByScheduleId: (jeSchedulesState: JESchedulesState) => Record<ID, JEScheduleApprovalInfo>;
|
|
92
90
|
export declare const getScheduleApprovalInfo: (jeSchedulesState: JESchedulesState, jeScheduleId: ID) => JEScheduleApprovalInfo | undefined;
|
|
93
91
|
/** One-time accruals are keyed by accrual id, so this is a direct lookup, unlike the schedule scan. */
|
|
94
92
|
export declare const getOneTimeAccrualApprovalInfo: (jeSchedulesState: JESchedulesState, accrualId: ID) => JEScheduleApprovalInfo | undefined;
|
|
@@ -3,7 +3,8 @@ 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.getOneTimeAccrualApprovalInfo = exports.getScheduleApprovalInfo = exports.getJEScheduledTransactionByJEScheduleTransactionKey = exports.getJEAccruedScheduleByJEScheduleKey = exports.getJEOneTimeAccrualByKey = void 0;
|
|
6
|
+
exports.getOneTimeAccrualApprovalInfo = exports.getScheduleApprovalInfo = exports.getApprovalInfoByScheduleId = exports.getJEScheduledTransactionByJEScheduleTransactionKey = exports.getJEAccruedScheduleByJEScheduleKey = exports.getJEOneTimeAccrualByKey = void 0;
|
|
7
|
+
const toolkit_1 = require("@reduxjs/toolkit");
|
|
7
8
|
const get_1 = __importDefault(require("lodash/get"));
|
|
8
9
|
const amount_1 = require("../../commonStateTypes/amount");
|
|
9
10
|
const accountSelector_1 = require("../account/accountSelector");
|
|
@@ -177,18 +178,20 @@ const getJEScheduledTransactionByJEScheduleTransactionKey = (jeScheduleTransacti
|
|
|
177
178
|
};
|
|
178
179
|
};
|
|
179
180
|
exports.getJEScheduledTransactionByJEScheduleTransactionKey = getJEScheduledTransactionByJEScheduleTransactionKey;
|
|
180
|
-
/**
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
181
|
+
/** Schedules are keyed by transaction / accrued key, not schedule id, so this re-indexes both maps by schedule id. */
|
|
182
|
+
exports.getApprovalInfoByScheduleId = (0, toolkit_1.createSelector)((jeSchedulesState) => jeSchedulesState.schedulesByTransactionKey, (jeSchedulesState) => jeSchedulesState.schedulesByAccruedJEScheduleKey, (schedulesByTransactionKey, schedulesByAccruedJEScheduleKey) => {
|
|
183
|
+
const byScheduleId = {};
|
|
184
|
+
[
|
|
185
|
+
...Object.values(schedulesByTransactionKey),
|
|
186
|
+
...Object.values(schedulesByAccruedJEScheduleKey),
|
|
187
|
+
].forEach((schedule) => {
|
|
188
|
+
if (schedule.jeScheduleId != null && schedule.approvalInfo != null) {
|
|
189
|
+
byScheduleId[schedule.jeScheduleId] = schedule.approvalInfo;
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
return byScheduleId;
|
|
193
|
+
});
|
|
194
|
+
const getScheduleApprovalInfo = (jeSchedulesState, jeScheduleId) => (0, get_1.default)((0, exports.getApprovalInfoByScheduleId)(jeSchedulesState), jeScheduleId, undefined);
|
|
192
195
|
exports.getScheduleApprovalInfo = getScheduleApprovalInfo;
|
|
193
196
|
/** One-time accruals are keyed by accrual id, so this is a direct lookup, unlike the schedule scan. */
|
|
194
197
|
const getOneTimeAccrualApprovalInfo = (jeSchedulesState, accrualId) => (0, get_1.default)(jeSchedulesState.oneTimeAccrualsByKey, (0, jeScheduleHelper_1.generateJEOneTimeAccrualKey)(accrualId), undefined)?.approvalInfo;
|
|
@@ -136,12 +136,12 @@ const USER_FACING_MESSAGES = {
|
|
|
136
136
|
not_found: 'JE schedule approval rules are not available for this account.',
|
|
137
137
|
unknown: undefined,
|
|
138
138
|
};
|
|
139
|
-
|
|
140
|
-
|
|
139
|
+
const SCHEDULE_NOT_FOUND_MESSAGE = 'This schedule no longer exists.';
|
|
140
|
+
/** Wraps an API status with a typed `kind` and a user-facing message for 403 / 404; a 404 on the action endpoint means the schedule, not the rules, is gone. */
|
|
141
|
+
export const toJEScheduleApprovalAPIStatus = (status, context = 'rules') => {
|
|
141
142
|
const kind = toJEApprovalErrorKind(status.code);
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
kind
|
|
145
|
-
|
|
146
|
-
};
|
|
143
|
+
const message = kind === 'not_found' && context === 'action'
|
|
144
|
+
? status.message || SCHEDULE_NOT_FOUND_MESSAGE
|
|
145
|
+
: (USER_FACING_MESSAGES[kind] ?? status.message);
|
|
146
|
+
return { ...status, kind, message };
|
|
147
147
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createSelector } from '@reduxjs/toolkit';
|
|
1
2
|
import recordGet from 'lodash/get';
|
|
2
3
|
import { toAmount } from '../../commonStateTypes/amount';
|
|
3
4
|
import { getAccountBase } from '../account/accountSelector';
|
|
@@ -168,17 +169,19 @@ export const getJEScheduledTransactionByJEScheduleTransactionKey = (jeScheduleTr
|
|
|
168
169
|
recommendations,
|
|
169
170
|
};
|
|
170
171
|
};
|
|
171
|
-
/**
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
172
|
+
/** Schedules are keyed by transaction / accrued key, not schedule id, so this re-indexes both maps by schedule id. */
|
|
173
|
+
export const getApprovalInfoByScheduleId = createSelector((jeSchedulesState) => jeSchedulesState.schedulesByTransactionKey, (jeSchedulesState) => jeSchedulesState.schedulesByAccruedJEScheduleKey, (schedulesByTransactionKey, schedulesByAccruedJEScheduleKey) => {
|
|
174
|
+
const byScheduleId = {};
|
|
175
|
+
[
|
|
176
|
+
...Object.values(schedulesByTransactionKey),
|
|
177
|
+
...Object.values(schedulesByAccruedJEScheduleKey),
|
|
178
|
+
].forEach((schedule) => {
|
|
179
|
+
if (schedule.jeScheduleId != null && schedule.approvalInfo != null) {
|
|
180
|
+
byScheduleId[schedule.jeScheduleId] = schedule.approvalInfo;
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
return byScheduleId;
|
|
184
|
+
});
|
|
185
|
+
export const getScheduleApprovalInfo = (jeSchedulesState, jeScheduleId) => recordGet(getApprovalInfoByScheduleId(jeSchedulesState), jeScheduleId, undefined);
|
|
183
186
|
/** One-time accruals are keyed by accrual id, so this is a direct lookup, unlike the schedule scan. */
|
|
184
187
|
export const getOneTimeAccrualApprovalInfo = (jeSchedulesState, accrualId) => recordGet(jeSchedulesState.oneTimeAccrualsByKey, generateJEOneTimeAccrualKey(accrualId), undefined)?.approvalInfo;
|
package/lib/esm/index.js
CHANGED
|
@@ -62,7 +62,7 @@ import { updateEntities } from './entity/genericEntity/entityReducer';
|
|
|
62
62
|
import { getEntityByEntityIDs } from './entity/genericEntity/entitySelector';
|
|
63
63
|
import { toJEScheduleApprovalAPIStatus, toJEScheduleApprovalInfo, toJEScheduleApprovalRulePayload, toJEScheduleApprovalRuleState, toJEScheduleApprover, toJEScheduleApproverRole, } from './entity/jeScheduleApprovalRule/jeScheduleApprovalRulePayload';
|
|
64
64
|
import { JE_APPROVAL_CUSTOMER_ROLE_SUB_TYPES, JE_APPROVAL_OWNERS, JE_APPROVAL_ROLE_SUB_TYPES, JE_APPROVAL_STEP_ACTIONS, JE_APPROVAL_ZENI_ROLE_SUB_TYPES, JE_LEVEL_CONTROLLER, JE_LEVEL_LABELS, JE_LEVEL_PREPARER, JE_LEVEL_REVIEWER, JE_SCHEDULE_TYPES, JE_SCHEDULE_TYPE_LABELS, toJEApprovalOwner, toJEApprovalRoleSubType, toJEApprovalStepAction, toJEScheduleType, toJEScheduleTypeStrict, } from './entity/jeScheduleApprovalRule/jeScheduleApprovalRuleTypes';
|
|
65
|
-
import { getOneTimeAccrualApprovalInfo, getScheduleApprovalInfo, } from './entity/jeSchedules/jeSchedulesSelector';
|
|
65
|
+
import { getApprovalInfoByScheduleId, getOneTimeAccrualApprovalInfo, getScheduleApprovalInfo, } from './entity/jeSchedules/jeSchedulesSelector';
|
|
66
66
|
import { ALL_JE_SCHEDULE_IGNORE_REASONS, ALL_JE_SCHEDULE_REVERT_REASONS, ALL_ONE_TIME_ACCRUAL_IGNORE_REASONS, ALL_ONE_TIME_ACCRUAL_REVERT_REASONS, ALL_SCHEDULES_TYPES, getJEScheduleTransactionKey, toScheduleTypesType, toScheduleTypesTypeStrict, } from './entity/jeSchedules/jeSchedulesTypes';
|
|
67
67
|
import { ALL_MONTH_END_CLOSE_CHECKS_FREQUENCY, } from './entity/monthEndCloseChecks/monthEndCloseChecksState';
|
|
68
68
|
import { updateCommentsNotifications, updateCommentsNotificationsStatuses, } from './entity/notification/notificationReducer';
|
|
@@ -635,7 +635,7 @@ export { VERIFIED_PAYMENT_ACCOUNT_PROVIDER_VERIFICATION_STATUS, };
|
|
|
635
635
|
export { isSuccessResponse, isInvalidSessionError, isAccessDeniedError, };
|
|
636
636
|
export { getAmountCriteria, getApprovalRulesByEntityType, getDepartmentCriteria, getFallbackApprovalRule, getVendorCriteria, toAttributeTypeStrict, toAttributeOrRoleTypeStrict, toRoleTypeStrict, detectRuleOverlap, };
|
|
637
637
|
export { getBillPaySetupApproverView, getBillPaySetupApproverUpdateDataView, fetchBillPaySetupApproverView, fetchBillPayApproversDetails, fetchBillPayApproversList, deleteBillPayApprovalRule, reorderBillPayApprovalRules, saveBillPaySetupApproverViewUpdateData, saveBillPaySetupApproverViewUpdates, setBillsSetupApproverViewListeningToPusherEvent, initializeBillPaySetupApproverViewUpdateData, clearBillPaySetupApproverViewUpdateData, };
|
|
638
|
-
export { toJEScheduleApprovalAPIStatus, toJEScheduleApprovalInfo, toJEScheduleApprovalRulePayload, toJEScheduleApprovalRuleState, toJEScheduleApprover, toJEScheduleApproverRole, JE_APPROVAL_OWNERS, JE_APPROVAL_CUSTOMER_ROLE_SUB_TYPES, JE_APPROVAL_ROLE_SUB_TYPES, JE_APPROVAL_ZENI_ROLE_SUB_TYPES, JE_APPROVAL_STEP_ACTIONS, JE_LEVEL_CONTROLLER, JE_LEVEL_LABELS, JE_LEVEL_PREPARER, JE_LEVEL_REVIEWER, JE_SCHEDULE_TYPES, JE_SCHEDULE_TYPE_LABELS, toJEApprovalOwner, toJEApprovalRoleSubType, toJEApprovalStepAction, toJEScheduleType, toJEScheduleTypeStrict, toJEScheduleApprovalRulesList, getJEScheduleSetupApproverView, getJEScheduleOwnRules, getJEScheduleOtherRules, getJEScheduleOwnRuleCount, getApprovalStartsAt, getOneTimeAccrualApprovalInfo, getScheduleApprovalInfo, fetchJEScheduleApprovalRules, fetchJEScheduleApprovers, saveJEScheduleApprovalRule, deleteJEScheduleApprovalRule, reorderJEScheduleApprovalRules, jeScheduleApprovalAction, saveJEScheduleApprovalDraft, approveJEScheduleWithLocalEdits, clearJEScheduleApprovalRuleSaveStatus, };
|
|
638
|
+
export { toJEScheduleApprovalAPIStatus, toJEScheduleApprovalInfo, toJEScheduleApprovalRulePayload, toJEScheduleApprovalRuleState, toJEScheduleApprover, toJEScheduleApproverRole, JE_APPROVAL_OWNERS, JE_APPROVAL_CUSTOMER_ROLE_SUB_TYPES, JE_APPROVAL_ROLE_SUB_TYPES, JE_APPROVAL_ZENI_ROLE_SUB_TYPES, JE_APPROVAL_STEP_ACTIONS, JE_LEVEL_CONTROLLER, JE_LEVEL_LABELS, JE_LEVEL_PREPARER, JE_LEVEL_REVIEWER, JE_SCHEDULE_TYPES, JE_SCHEDULE_TYPE_LABELS, toJEApprovalOwner, toJEApprovalRoleSubType, toJEApprovalStepAction, toJEScheduleType, toJEScheduleTypeStrict, toJEScheduleApprovalRulesList, getJEScheduleSetupApproverView, getJEScheduleOwnRules, getJEScheduleOtherRules, getJEScheduleOwnRuleCount, getApprovalStartsAt, getApprovalInfoByScheduleId, getOneTimeAccrualApprovalInfo, getScheduleApprovalInfo, fetchJEScheduleApprovalRules, fetchJEScheduleApprovers, saveJEScheduleApprovalRule, deleteJEScheduleApprovalRule, reorderJEScheduleApprovalRules, jeScheduleApprovalAction, saveJEScheduleApprovalDraft, approveJEScheduleWithLocalEdits, clearJEScheduleApprovalRuleSaveStatus, };
|
|
639
639
|
export { getRemiSetupApproverView, getRemiSetupApproverUpdateDataView, fetchRemiSetupApproverView, fetchRemiApproversList, fetchRemiApproversDetails, deleteRemiApprovalRule, reorderRemiApprovalRules, saveRemiSetupApproverViewUpdateData, saveRemiSetupApproverViewUpdates, initializeRemiSetupApproverViewUpdateData, setRemiSetupApproverViewListeningToPusherEvent, clearRemiSetupApproverViewUpdateData, };
|
|
640
640
|
export { getRemiDetailView, checkApproveRejectBtnShowForRemi, };
|
|
641
641
|
export { saveRealTimeApproval, updateIsEditModeRealTimeApprovals, };
|
|
@@ -49,6 +49,7 @@ messageSection, accrualId, message, status) {
|
|
|
49
49
|
];
|
|
50
50
|
}
|
|
51
51
|
const MISSING_ACCOUNT_MESSAGE = 'This accrual is missing an expense or liability account.';
|
|
52
|
+
const MISSING_AMOUNT_MESSAGE = 'This accrual has no amount to save.';
|
|
52
53
|
/**
|
|
53
54
|
* The PUT /1.0/accruals/<id> body, shared by promote and save-draft. Returns undefined when either
|
|
54
55
|
* JE account is missing: promote posts a journal entry, and a draft saved without both sides would
|
|
@@ -167,9 +168,15 @@ export const saveJEOneTimeAccrualDraftEpic = (actions$, state$, zeniAPI) => acti
|
|
|
167
168
|
const state = state$.value;
|
|
168
169
|
const { accrualId, amount } = action.payload;
|
|
169
170
|
const accrual = getJEOneTimeAccrualByKey(generateJEOneTimeAccrualKey(accrualId), state.jeSchedulesState);
|
|
171
|
+
// The amount falls back to the stored estimate when the caller has none; with neither
|
|
172
|
+
// there is nothing to save, so refuse rather than park a 0 on the draft.
|
|
173
|
+
const draftAmount = amount ?? accrual?.estimatedAmount.amount;
|
|
174
|
+
if (draftAmount == null) {
|
|
175
|
+
return from(failureActions('je_schedule_approval_action', accrualId, MISSING_AMOUNT_MESSAGE));
|
|
176
|
+
}
|
|
170
177
|
// Same body as promote plus save_draft: the server keeps the edits on the held draft
|
|
171
|
-
// without posting.
|
|
172
|
-
const payload = buildOneTimeAccrualBody(state, accrualId,
|
|
178
|
+
// without posting.
|
|
179
|
+
const payload = buildOneTimeAccrualBody(state, accrualId, draftAmount);
|
|
173
180
|
if (payload == null) {
|
|
174
181
|
return from(failureActions('je_schedule_approval_action', accrualId, MISSING_ACCOUNT_MESSAGE));
|
|
175
182
|
}
|
package/lib/esm/view/settings/jeScheduleApprovalRules/epic/deleteJEScheduleApprovalRuleEpic.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import { from
|
|
2
|
-
import { catchError, filter, mergeMap,
|
|
1
|
+
import { from } from 'rxjs';
|
|
2
|
+
import { catchError, filter, mergeMap, takeUntil } from 'rxjs/operators';
|
|
3
3
|
import { toJEScheduleApprovalAPIStatus, } from '../../../../entity/jeScheduleApprovalRule/jeScheduleApprovalRulePayload';
|
|
4
4
|
import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
5
5
|
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
6
|
+
import { clearAll } from '../../../../rootActions';
|
|
6
7
|
import { toJEScheduleApprovalRulesList } from '../jeScheduleSetupApproverViewPayload';
|
|
7
8
|
import { deleteJEScheduleApprovalRule, deleteJEScheduleApprovalRuleFailure, deleteJEScheduleApprovalRuleSuccess, } from '../jeScheduleSetupApproverViewReducer';
|
|
8
9
|
import { JE_SCHEDULE_APPROVAL_RULES_PATH } from './fetchJEScheduleApprovalRulesEpic';
|
|
9
|
-
export const deleteJEScheduleApprovalRuleEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(deleteJEScheduleApprovalRule.match),
|
|
10
|
+
export const deleteJEScheduleApprovalRuleEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(deleteJEScheduleApprovalRule.match),
|
|
11
|
+
// mergeMap: deleting two rules back to back must not cancel the first request.
|
|
12
|
+
mergeMap((action) => {
|
|
10
13
|
const { approvalRuleId } = action.payload;
|
|
11
14
|
return zeniAPI
|
|
12
15
|
.deleteAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}${JE_SCHEDULE_APPROVAL_RULES_PATH}/${approvalRuleId}`)
|
|
@@ -33,6 +36,21 @@ export const deleteJEScheduleApprovalRuleEpic = (actions$, _state$, zeniAPI) =>
|
|
|
33
36
|
],
|
|
34
37
|
}),
|
|
35
38
|
]);
|
|
36
|
-
}), catchError((error) =>
|
|
37
|
-
|
|
39
|
+
}), catchError((error) => {
|
|
40
|
+
const status = createZeniAPIStatus('Unexpected Error', 'Delete JE schedule approval rule errored out' +
|
|
41
|
+
JSON.stringify(error));
|
|
42
|
+
return from([
|
|
43
|
+
deleteJEScheduleApprovalRuleFailure(approvalRuleId, status),
|
|
44
|
+
openSnackbar({
|
|
45
|
+
messageSection: 'je_schedule_approval_delete',
|
|
46
|
+
messageText: 'failed',
|
|
47
|
+
type: 'error',
|
|
48
|
+
variables: [
|
|
49
|
+
{ variableName: '_api-error_', variableValue: status.message },
|
|
50
|
+
],
|
|
51
|
+
}),
|
|
52
|
+
]);
|
|
53
|
+
}),
|
|
54
|
+
// A tenant switch clears the store while this request is still in flight.
|
|
55
|
+
takeUntil(actions$.pipe(filter(clearAll.match))));
|
|
38
56
|
}));
|
package/lib/esm/view/settings/jeScheduleApprovalRules/epic/fetchJEScheduleApprovalRulesEpic.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { of } from 'rxjs';
|
|
2
|
-
import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
|
|
2
|
+
import { catchError, filter, mergeMap, switchMap, takeUntil, } from 'rxjs/operators';
|
|
3
3
|
import { toJEScheduleApprovalAPIStatus, } from '../../../../entity/jeScheduleApprovalRule/jeScheduleApprovalRulePayload';
|
|
4
4
|
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
5
|
+
import { clearAll } from '../../../../rootActions';
|
|
5
6
|
import { toJEScheduleApprovalRulesList } from '../jeScheduleSetupApproverViewPayload';
|
|
6
7
|
import { fetchJEScheduleApprovalRules, fetchJEScheduleApprovalRulesFailure, fetchJEScheduleApprovalRulesSuccess, } from '../jeScheduleSetupApproverViewReducer';
|
|
7
8
|
export const JE_SCHEDULE_APPROVAL_RULES_PATH = '/1.0/je-schedules/approval-rules';
|
|
@@ -24,5 +25,7 @@ export const fetchJEScheduleApprovalRulesEpic = (actions$, state$, zeniAPI) => a
|
|
|
24
25
|
}
|
|
25
26
|
return of(fetchJEScheduleApprovalRulesFailure(toJEScheduleApprovalAPIStatus(response.status)));
|
|
26
27
|
}), catchError((error) => of(fetchJEScheduleApprovalRulesFailure(createZeniAPIStatus('Unexpected Error', 'Fetch JE schedule approval rules errored out' +
|
|
27
|
-
JSON.stringify(error)))))
|
|
28
|
+
JSON.stringify(error))))),
|
|
29
|
+
// A tenant switch clears the store while this request is still in flight.
|
|
30
|
+
takeUntil(actions$.pipe(filter(clearAll.match))));
|
|
28
31
|
}));
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { of } from 'rxjs';
|
|
2
|
-
import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
|
|
2
|
+
import { catchError, filter, mergeMap, switchMap, takeUntil, } from 'rxjs/operators';
|
|
3
3
|
import { toJEScheduleApprovalAPIStatus, toJEScheduleApprover, toJEScheduleApproverRole, } from '../../../../entity/jeScheduleApprovalRule/jeScheduleApprovalRulePayload';
|
|
4
4
|
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
5
|
+
import { clearAll } from '../../../../rootActions';
|
|
5
6
|
import { fetchJEScheduleApprovers, fetchJEScheduleApproversFailure, fetchJEScheduleApproversSuccess, } from '../jeScheduleSetupApproverViewReducer';
|
|
6
7
|
export const JE_SCHEDULE_APPROVERS_PATH = '/1.0/je-schedules/approvers';
|
|
7
8
|
export const fetchJEScheduleApproversEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(fetchJEScheduleApprovers.match), switchMap((action) => {
|
|
@@ -18,5 +19,7 @@ export const fetchJEScheduleApproversEpic = (actions$, state$, zeniAPI) => actio
|
|
|
18
19
|
}
|
|
19
20
|
return of(fetchJEScheduleApproversFailure(toJEScheduleApprovalAPIStatus(response.status)));
|
|
20
21
|
}), catchError((error) => of(fetchJEScheduleApproversFailure(createZeniAPIStatus('Unexpected Error', 'Fetch JE schedule approvers errored out' +
|
|
21
|
-
JSON.stringify(error)))))
|
|
22
|
+
JSON.stringify(error))))),
|
|
23
|
+
// A tenant switch clears the store while this request is still in flight.
|
|
24
|
+
takeUntil(actions$.pipe(filter(clearAll.match))));
|
|
22
25
|
}));
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { from
|
|
2
|
-
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
1
|
+
import { from } from 'rxjs';
|
|
2
|
+
import { catchError, filter, mergeMap, takeUntil } from 'rxjs/operators';
|
|
3
3
|
import { toJEScheduleApprovalAPIStatus } from '../../../../entity/jeScheduleApprovalRule/jeScheduleApprovalRulePayload';
|
|
4
4
|
import { updateAccruedJESchedulesDetails, updateJESchedulesDetails, } from '../../../../entity/jeSchedules/jeSchedulesReducer';
|
|
5
5
|
import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
6
6
|
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
7
|
+
import { clearAll } from '../../../../rootActions';
|
|
7
8
|
import { fetchScheduleAccruedDetails } from '../../../scheduleView/scheduleAccruedDetailView/scheduleAccruedDetailReducer';
|
|
8
9
|
import { fetchScheduleDetails } from '../../../scheduleView/scheduleDetailView/scheduleDetailReducer';
|
|
9
10
|
import { isAccruedJESchedulePayload, toJEScheduleApprovalActionRequestBody, } from '../jeScheduleSetupApproverViewPayload';
|
|
@@ -28,7 +29,7 @@ export const jeScheduleApprovalActionEpic = (actions$, _state$, zeniAPI) => acti
|
|
|
28
29
|
}),
|
|
29
30
|
]);
|
|
30
31
|
}
|
|
31
|
-
const status = toJEScheduleApprovalAPIStatus(response.status);
|
|
32
|
+
const status = toJEScheduleApprovalAPIStatus(response.status, 'action');
|
|
32
33
|
const failureActions = [
|
|
33
34
|
jeScheduleApprovalActionFailure(jeScheduleId, status),
|
|
34
35
|
openSnackbar({
|
|
@@ -46,6 +47,20 @@ export const jeScheduleApprovalActionEpic = (actions$, _state$, zeniAPI) => acti
|
|
|
46
47
|
: fetchScheduleDetails(refetch.scheduleType, jeScheduleId, true));
|
|
47
48
|
}
|
|
48
49
|
return from(failureActions);
|
|
49
|
-
}), catchError((error) =>
|
|
50
|
-
JSON.stringify(error))
|
|
50
|
+
}), catchError((error) => {
|
|
51
|
+
const status = createZeniAPIStatus('Unexpected Error', 'JE schedule approval action errored out' + JSON.stringify(error));
|
|
52
|
+
return from([
|
|
53
|
+
jeScheduleApprovalActionFailure(jeScheduleId, status),
|
|
54
|
+
openSnackbar({
|
|
55
|
+
messageSection: 'je_schedule_approval_action',
|
|
56
|
+
messageText: 'failed',
|
|
57
|
+
type: 'error',
|
|
58
|
+
variables: [
|
|
59
|
+
{ variableName: '_api-error_', variableValue: status.message },
|
|
60
|
+
],
|
|
61
|
+
}),
|
|
62
|
+
]);
|
|
63
|
+
}),
|
|
64
|
+
// A tenant switch clears the store while this request is still in flight.
|
|
65
|
+
takeUntil(actions$.pipe(filter(clearAll.match))));
|
|
51
66
|
}));
|
package/lib/esm/view/settings/jeScheduleApprovalRules/epic/reorderJEScheduleApprovalRulesEpic.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { from } from 'rxjs';
|
|
2
|
-
import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
|
|
2
|
+
import { catchError, filter, mergeMap, switchMap, takeUntil, } from 'rxjs/operators';
|
|
3
3
|
import { toJEScheduleApprovalAPIStatus, } from '../../../../entity/jeScheduleApprovalRule/jeScheduleApprovalRulePayload';
|
|
4
4
|
import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
5
5
|
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
6
|
+
import { clearAll } from '../../../../rootActions';
|
|
6
7
|
import { toJEScheduleApprovalRulesList, } from '../jeScheduleSetupApproverViewPayload';
|
|
7
8
|
import { fetchJEScheduleApprovalRules, reorderJEScheduleApprovalRules, reorderJEScheduleApprovalRulesFailure, reorderJEScheduleApprovalRulesSuccess, } from '../jeScheduleSetupApproverViewReducer';
|
|
8
9
|
import { JE_SCHEDULE_APPROVAL_RULES_PATH } from './fetchJEScheduleApprovalRulesEpic';
|
|
@@ -21,7 +22,8 @@ export const reorderJEScheduleApprovalRulesEpic = (actions$, _state$, zeniAPI) =
|
|
|
21
22
|
messageText: 'failed',
|
|
22
23
|
type: 'error',
|
|
23
24
|
}),
|
|
24
|
-
|
|
25
|
+
// Silent: the list is already on screen, a full-slice spinner would blank it.
|
|
26
|
+
fetchJEScheduleApprovalRules(true, true),
|
|
25
27
|
]);
|
|
26
28
|
return zeniAPI
|
|
27
29
|
.putAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}${JE_SCHEDULE_APPROVAL_RULES_PATH}/reorder`, body)
|
|
@@ -38,5 +40,7 @@ export const reorderJEScheduleApprovalRulesEpic = (actions$, _state$, zeniAPI) =
|
|
|
38
40
|
}
|
|
39
41
|
return recover(toJEScheduleApprovalAPIStatus(response.status));
|
|
40
42
|
}), catchError((error) => recover(createZeniAPIStatus('Unexpected Error', 'Reorder JE schedule approval rules errored out' +
|
|
41
|
-
JSON.stringify(error))))
|
|
43
|
+
JSON.stringify(error)))),
|
|
44
|
+
// A tenant switch clears the store while this request is still in flight.
|
|
45
|
+
takeUntil(actions$.pipe(filter(clearAll.match))));
|
|
42
46
|
}));
|
package/lib/esm/view/settings/jeScheduleApprovalRules/epic/saveJEScheduleApprovalRuleEpic.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import { from
|
|
2
|
-
import { catchError, filter, mergeMap,
|
|
1
|
+
import { from } from 'rxjs';
|
|
2
|
+
import { catchError, filter, mergeMap, takeUntil } from 'rxjs/operators';
|
|
3
3
|
import { toJEScheduleApprovalAPIStatus, toJEScheduleApprovalRulePayload, } from '../../../../entity/jeScheduleApprovalRule/jeScheduleApprovalRulePayload';
|
|
4
4
|
import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
5
5
|
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
6
|
+
import { clearAll } from '../../../../rootActions';
|
|
6
7
|
import { toJEScheduleApprovalRulesList } from '../jeScheduleSetupApproverViewPayload';
|
|
7
8
|
import { saveJEScheduleApprovalRule, saveJEScheduleApprovalRuleFailure, saveJEScheduleApprovalRuleSuccess, } from '../jeScheduleSetupApproverViewReducer';
|
|
8
9
|
import { JE_SCHEDULE_APPROVAL_RULES_PATH } from './fetchJEScheduleApprovalRulesEpic';
|
|
9
|
-
export const saveJEScheduleApprovalRuleEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(saveJEScheduleApprovalRule.match),
|
|
10
|
+
export const saveJEScheduleApprovalRuleEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(saveJEScheduleApprovalRule.match),
|
|
11
|
+
// mergeMap: saving two rules back to back must not cancel the first request.
|
|
12
|
+
mergeMap((action) => {
|
|
10
13
|
const { formData } = action.payload;
|
|
11
14
|
const body = toJEScheduleApprovalRulePayload(formData);
|
|
12
15
|
const isUpdate = formData.approvalRuleId != null;
|
|
@@ -40,6 +43,20 @@ export const saveJEScheduleApprovalRuleEpic = (actions$, _state$, zeniAPI) => ac
|
|
|
40
43
|
],
|
|
41
44
|
}),
|
|
42
45
|
]);
|
|
43
|
-
}), catchError((error) =>
|
|
44
|
-
JSON.stringify(error))
|
|
46
|
+
}), catchError((error) => {
|
|
47
|
+
const status = createZeniAPIStatus('Unexpected Error', 'Save JE schedule approval rule errored out' + JSON.stringify(error));
|
|
48
|
+
return from([
|
|
49
|
+
saveJEScheduleApprovalRuleFailure(status),
|
|
50
|
+
openSnackbar({
|
|
51
|
+
messageSection: section,
|
|
52
|
+
messageText: 'failed',
|
|
53
|
+
type: 'error',
|
|
54
|
+
variables: [
|
|
55
|
+
{ variableName: '_api-error_', variableValue: status.message },
|
|
56
|
+
],
|
|
57
|
+
}),
|
|
58
|
+
]);
|
|
59
|
+
}),
|
|
60
|
+
// A tenant switch clears the store while this request is still in flight.
|
|
61
|
+
takeUntil(actions$.pipe(filter(clearAll.match))));
|
|
45
62
|
}));
|
|
@@ -39,18 +39,25 @@ const jeScheduleSetupApproverView = createSlice({
|
|
|
39
39
|
initialState,
|
|
40
40
|
reducers: {
|
|
41
41
|
fetchJEScheduleApprovalRules: {
|
|
42
|
-
reducer(draft) {
|
|
42
|
+
reducer(draft, action) {
|
|
43
|
+
const { cacheOverride, silent } = action.payload;
|
|
44
|
+
// Leave the spinner alone when the epic will serve the cache or the caller asked for a quiet refresh.
|
|
45
|
+
if (silent ||
|
|
46
|
+
(cacheOverride === false && draft.fetchState === 'Completed')) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
43
49
|
draft.fetchState = 'In-Progress';
|
|
44
50
|
draft.error = undefined;
|
|
45
51
|
},
|
|
46
|
-
prepare(cacheOverride = false) {
|
|
47
|
-
return { payload: { cacheOverride } };
|
|
52
|
+
prepare(cacheOverride = false, silent = false) {
|
|
53
|
+
return { payload: { cacheOverride, silent } };
|
|
48
54
|
},
|
|
49
55
|
},
|
|
50
56
|
fetchJEScheduleApprovalRulesSuccess: {
|
|
51
57
|
reducer(draft, action) {
|
|
52
58
|
draft.fetchState = 'Completed';
|
|
53
59
|
draft.error = undefined;
|
|
60
|
+
draft.approvalRulesDeleteStatusById = {};
|
|
54
61
|
applyList(draft, action.payload);
|
|
55
62
|
},
|
|
56
63
|
prepare(list) {
|
|
@@ -67,7 +74,11 @@ const jeScheduleSetupApproverView = createSlice({
|
|
|
67
74
|
},
|
|
68
75
|
},
|
|
69
76
|
fetchJEScheduleApprovers: {
|
|
70
|
-
reducer(draft) {
|
|
77
|
+
reducer(draft, action) {
|
|
78
|
+
if (action.payload.cacheOverride === false &&
|
|
79
|
+
draft.approverListState.fetchStatus.fetchState === 'Completed') {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
71
82
|
draft.approverListState.fetchStatus = {
|
|
72
83
|
fetchState: 'In-Progress',
|
|
73
84
|
error: undefined,
|
|
@@ -140,10 +151,8 @@ const jeScheduleSetupApproverView = createSlice({
|
|
|
140
151
|
},
|
|
141
152
|
deleteJEScheduleApprovalRuleSuccess: {
|
|
142
153
|
reducer(draft, action) {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
error: undefined,
|
|
146
|
-
};
|
|
154
|
+
// Done entries are dropped so one past failure cannot pin the aggregate delete status.
|
|
155
|
+
delete draft.approvalRulesDeleteStatusById[action.payload.approvalRuleId];
|
|
147
156
|
applyList(draft, action.payload.list);
|
|
148
157
|
},
|
|
149
158
|
prepare(approvalRuleId, list) {
|
package/lib/esm/view/settings/jeScheduleApprovalRules/jeScheduleSetupApproverViewSelector.js
CHANGED
|
@@ -38,22 +38,18 @@ export const getJEScheduleSetupApproverView = createSelector((state) => state.je
|
|
|
38
38
|
error,
|
|
39
39
|
};
|
|
40
40
|
});
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
export const getOtherRules = (state) => {
|
|
46
|
-
const { allApprovalRules, viewerOwner } = getJEScheduleSetupApproverView(state);
|
|
47
|
-
return allApprovalRules.filter((rule) => rule.owner !== viewerOwner);
|
|
48
|
-
};
|
|
41
|
+
const getViewerOwner = (state) => state.jeScheduleSetupApproverViewState.viewerOwner;
|
|
42
|
+
const getAllApprovalRules = (state) => getJEScheduleSetupApproverView(state).allApprovalRules;
|
|
43
|
+
export const getOwnRules = createSelector(getAllApprovalRules, getViewerOwner, (allApprovalRules, viewerOwner) => allApprovalRules.filter((rule) => rule.owner === viewerOwner));
|
|
44
|
+
export const getOtherRules = createSelector(getAllApprovalRules, getViewerOwner, (allApprovalRules, viewerOwner) => allApprovalRules.filter((rule) => rule.owner !== viewerOwner));
|
|
49
45
|
export const getOwnRuleCount = (state) => getOwnRules(state).length;
|
|
50
|
-
export const getApprovalStartsAt = (state) => {
|
|
46
|
+
export const getApprovalStartsAt = createSelector((state) => state.jeScheduleSetupApproverViewState.approvalRules, (approvalRules) => {
|
|
51
47
|
const startsAt = {
|
|
52
48
|
prepaid_expenses: undefined,
|
|
53
49
|
fixed_assets: undefined,
|
|
54
50
|
accrued_expenses: undefined,
|
|
55
51
|
};
|
|
56
|
-
|
|
52
|
+
approvalRules.forEach((rule) => {
|
|
57
53
|
rule.criteria.scheduleTypes.forEach((scheduleType) => {
|
|
58
54
|
const current = startsAt[scheduleType];
|
|
59
55
|
if (current == null || rule.criteria.monthlyAmountMin < current) {
|
|
@@ -62,4 +58,4 @@ export const getApprovalStartsAt = (state) => {
|
|
|
62
58
|
});
|
|
63
59
|
});
|
|
64
60
|
return startsAt;
|
|
65
|
-
};
|
|
61
|
+
});
|
|
@@ -20,7 +20,7 @@ export const isAccountingTabVisible = (userRole, isDebitCardFlagEnabled, current
|
|
|
20
20
|
return false;
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
|
-
export const isApprovalRulesTabVisible = (userRole, isDebitCardFlagEnabled, currentTenant, userRoleMap) => {
|
|
23
|
+
export const isApprovalRulesTabVisible = (userRole, isDebitCardFlagEnabled, currentTenant, userRoleMap, isJEApprovalRulesEnabled = false) => {
|
|
24
24
|
if (currentTenant == null || userRoleMap == null) {
|
|
25
25
|
return false;
|
|
26
26
|
}
|
|
@@ -28,7 +28,8 @@ export const isApprovalRulesTabVisible = (userRole, isDebitCardFlagEnabled, curr
|
|
|
28
28
|
const isBillPayTOSAccepted = Boolean(currentTenant.company?.companyBillPayInfo.isBillPayTOSAccepted);
|
|
29
29
|
const isReimbursementTOSAccepted = Boolean(currentTenant?.company?.companyReimbursementInfo
|
|
30
30
|
.isReimbursementTOSAccepted);
|
|
31
|
-
const isJEScheduleApprovalVisible =
|
|
31
|
+
const isJEScheduleApprovalVisible = isJEApprovalRulesEnabled &&
|
|
32
|
+
hasJEScheduleApprovalAccessible(currentTenant) &&
|
|
32
33
|
(currentTenant.isZeni || hasFullOrAdminLevelAccess(userRole));
|
|
33
34
|
return ((hasBillPayAccessible(currentTenant, userRoleMap) ||
|
|
34
35
|
hasReimbursementAccessible(currentTenant, userRoleMap) ||
|
package/lib/index.d.ts
CHANGED
|
@@ -110,7 +110,7 @@ import { InsightSummary } from './entity/insights/insightSummary';
|
|
|
110
110
|
import { JEScheduleApprovalInfoPayload, JEScheduleApprovalRulePayload, JEScheduleApprovalRuleRequestBody, JEScheduleApprovalRuleSavePayload, JEScheduleApprovalRulesListPayload, JEScheduleApproverPayload, JEScheduleApproverRolePayload, JEScheduleApproversPayload, toJEScheduleApprovalAPIStatus, toJEScheduleApprovalInfo, toJEScheduleApprovalRulePayload, toJEScheduleApprovalRuleState, toJEScheduleApprover, toJEScheduleApproverRole } from './entity/jeScheduleApprovalRule/jeScheduleApprovalRulePayload';
|
|
111
111
|
import { JEScheduleApprovalAPIStatus, JEScheduleApprovalCriteria, JEScheduleApprovalInfo, JEScheduleApprovalNonUserActor, JEScheduleApprovalRule, JEScheduleApprovalRuleFormData, JEScheduleApprovalRuleState, JEScheduleApprovalStep, JEScheduleApprovalStepState, JEScheduleApprover, JEScheduleApproverRole } from './entity/jeScheduleApprovalRule/jeScheduleApprovalRuleState';
|
|
112
112
|
import { JEApprovalAction, JEApprovalErrorKind, JEApprovalOwner, JEApprovalRoleSubType, JEApprovalStepAction, JEScheduleType, JE_APPROVAL_CUSTOMER_ROLE_SUB_TYPES, JE_APPROVAL_OWNERS, JE_APPROVAL_ROLE_SUB_TYPES, JE_APPROVAL_STEP_ACTIONS, JE_APPROVAL_ZENI_ROLE_SUB_TYPES, JE_LEVEL_CONTROLLER, JE_LEVEL_LABELS, JE_LEVEL_PREPARER, JE_LEVEL_REVIEWER, JE_SCHEDULE_TYPES, JE_SCHEDULE_TYPE_LABELS, toJEApprovalOwner, toJEApprovalRoleSubType, toJEApprovalStepAction, toJEScheduleType, toJEScheduleTypeStrict } from './entity/jeScheduleApprovalRule/jeScheduleApprovalRuleTypes';
|
|
113
|
-
import { JEAccruedSchedule, JEOneTimeAccrual, JEScheduledTransaction, ScheduledJournalEntry, getOneTimeAccrualApprovalInfo, getScheduleApprovalInfo } from './entity/jeSchedules/jeSchedulesSelector';
|
|
113
|
+
import { JEAccruedSchedule, JEOneTimeAccrual, JEScheduledTransaction, ScheduledJournalEntry, getApprovalInfoByScheduleId, getOneTimeAccrualApprovalInfo, getScheduleApprovalInfo } from './entity/jeSchedules/jeSchedulesSelector';
|
|
114
114
|
import { JEOneTimeAccrualAiSuggestion, JEOneTimeAccrualBillingPattern, JEOneTimeAccrualCleared, JEOneTimeAccrualMatchSuggestion, JEOneTimeAccrualMonthlyTotal, JEOneTimeAccrualProfileSnapshot, JEScheduleAISummaries, JEScheduleFieldRecommendation, JEScheduleSummary, OneTimeAccrualEdits } from './entity/jeSchedules/jeSchedulesState';
|
|
115
115
|
import { ALL_JE_SCHEDULE_IGNORE_REASONS, ALL_JE_SCHEDULE_REVERT_REASONS, ALL_ONE_TIME_ACCRUAL_IGNORE_REASONS, ALL_ONE_TIME_ACCRUAL_REVERT_REASONS, ALL_SCHEDULES_TYPES, JEOneTimeAccrualKey, JEScheduleIgnoreReasonType, JEScheduleKey, JEScheduleRevertReasonType, JEScheduleTransactionKey, JournalEntryErrorCodeType, OneTimeAccrualIgnoreReasonType, OneTimeAccrualRevertReasonType, ScheduleJournalEntryStatusCodeType, ScheduleStatusCodeType, ScheduleTransactionID, ScheduleTypes, getJEScheduleTransactionKey, toScheduleTypesType, toScheduleTypesTypeStrict } from './entity/jeSchedules/jeSchedulesTypes';
|
|
116
116
|
import { Merchant } from './entity/merchant/merchant';
|
|
@@ -908,7 +908,7 @@ export { SubscriptionPaymentAccount };
|
|
|
908
908
|
export { PreviousBillsSelectorView, InvoiceProcessingPayload, InvoiceProcessingResponse, isSuccessResponse, isInvalidSessionError, isAccessDeniedError, };
|
|
909
909
|
export { Step, Actor as ApprovalRuleActor, ActorType, ApprovalActionType, StepOperatorType, ApprovalRuleState, ApprovalRule, AmountComparator, AmountCriteria, ConditionType, Criteria, DepartmentCriteria, VendorCriteria, AttributeType, Approvers, RoleType, EntityApprovalStatusState, EntityApprovalStatus, SpendManagementEntityType, SpendManagementEntityTypeWithOtherConnection, getAmountCriteria, getApprovalRulesByEntityType, getDepartmentCriteria, getFallbackApprovalRule, getVendorCriteria, toAttributeTypeStrict, toAttributeOrRoleTypeStrict, toRoleTypeStrict, DetectRuleOverlapInput, RuleForOverlapCheck, RuleOverlap, detectRuleOverlap, };
|
|
910
910
|
export { ApprovalRuleUpdateData, ApprovalRuleCreateData, BillPayApprovalRuleWithUser, ApprovalUpdateActionType, ApproverViewUpdateData, BillPaySetupApproverViewState, BillPaySetupApproverView, BillPaySetupApproverUpdateDataView, getBillPaySetupApproverView, getBillPaySetupApproverUpdateDataView, fetchBillPaySetupApproverView, fetchBillPayApproversDetails, fetchBillPayApproversList, deleteBillPayApprovalRule, reorderBillPayApprovalRules, saveBillPaySetupApproverViewUpdateData, saveBillPaySetupApproverViewUpdates, setBillsSetupApproverViewListeningToPusherEvent, initializeBillPaySetupApproverViewUpdateData, clearBillPaySetupApproverViewUpdateData, };
|
|
911
|
-
export { JEScheduleApprovalInfoPayload, JEScheduleApprovalRulePayload, JEScheduleApprovalRuleRequestBody, JEScheduleApprovalRuleSavePayload, JEScheduleApprovalRulesListPayload, JEScheduleApproverPayload, JEScheduleApproverRolePayload, JEScheduleApproversPayload, toJEScheduleApprovalAPIStatus, toJEScheduleApprovalInfo, toJEScheduleApprovalRulePayload, toJEScheduleApprovalRuleState, toJEScheduleApprover, toJEScheduleApproverRole, JEScheduleApprovalAPIStatus, JEScheduleApprovalCriteria, JEScheduleApprovalInfo, JEScheduleApprovalNonUserActor, JEScheduleApprovalRule, JEScheduleApprovalRuleFormData, JEScheduleApprovalRuleState, JEScheduleApprovalStep, JEScheduleApprovalStepState, JEScheduleApprover, JEScheduleApproverRole, JEApprovalAction, JEApprovalErrorKind, JEApprovalOwner, JEApprovalRoleSubType, JEApprovalStepAction, JEScheduleType, JE_APPROVAL_OWNERS, JE_APPROVAL_CUSTOMER_ROLE_SUB_TYPES, JE_APPROVAL_ROLE_SUB_TYPES, JE_APPROVAL_ZENI_ROLE_SUB_TYPES, JE_APPROVAL_STEP_ACTIONS, JE_LEVEL_CONTROLLER, JE_LEVEL_LABELS, JE_LEVEL_PREPARER, JE_LEVEL_REVIEWER, JE_SCHEDULE_TYPES, JE_SCHEDULE_TYPE_LABELS, toJEApprovalOwner, toJEApprovalRoleSubType, toJEApprovalStepAction, toJEScheduleType, toJEScheduleTypeStrict, JEScheduleApprovalActionBody, toJEScheduleApprovalRulesList, JEScheduleApprovalRulesList, JEScheduleSetupApproverViewState, JEScheduleApprovalStartsAt, JEScheduleSetupApproverView, getJEScheduleSetupApproverView, getJEScheduleOwnRules, getJEScheduleOtherRules, getJEScheduleOwnRuleCount, getApprovalStartsAt, getOneTimeAccrualApprovalInfo, getScheduleApprovalInfo, fetchJEScheduleApprovalRules, fetchJEScheduleApprovers, saveJEScheduleApprovalRule, deleteJEScheduleApprovalRule, reorderJEScheduleApprovalRules, jeScheduleApprovalAction, saveJEScheduleApprovalDraft, approveJEScheduleWithLocalEdits, clearJEScheduleApprovalRuleSaveStatus, };
|
|
911
|
+
export { JEScheduleApprovalInfoPayload, JEScheduleApprovalRulePayload, JEScheduleApprovalRuleRequestBody, JEScheduleApprovalRuleSavePayload, JEScheduleApprovalRulesListPayload, JEScheduleApproverPayload, JEScheduleApproverRolePayload, JEScheduleApproversPayload, toJEScheduleApprovalAPIStatus, toJEScheduleApprovalInfo, toJEScheduleApprovalRulePayload, toJEScheduleApprovalRuleState, toJEScheduleApprover, toJEScheduleApproverRole, JEScheduleApprovalAPIStatus, JEScheduleApprovalCriteria, JEScheduleApprovalInfo, JEScheduleApprovalNonUserActor, JEScheduleApprovalRule, JEScheduleApprovalRuleFormData, JEScheduleApprovalRuleState, JEScheduleApprovalStep, JEScheduleApprovalStepState, JEScheduleApprover, JEScheduleApproverRole, JEApprovalAction, JEApprovalErrorKind, JEApprovalOwner, JEApprovalRoleSubType, JEApprovalStepAction, JEScheduleType, JE_APPROVAL_OWNERS, JE_APPROVAL_CUSTOMER_ROLE_SUB_TYPES, JE_APPROVAL_ROLE_SUB_TYPES, JE_APPROVAL_ZENI_ROLE_SUB_TYPES, JE_APPROVAL_STEP_ACTIONS, JE_LEVEL_CONTROLLER, JE_LEVEL_LABELS, JE_LEVEL_PREPARER, JE_LEVEL_REVIEWER, JE_SCHEDULE_TYPES, JE_SCHEDULE_TYPE_LABELS, toJEApprovalOwner, toJEApprovalRoleSubType, toJEApprovalStepAction, toJEScheduleType, toJEScheduleTypeStrict, JEScheduleApprovalActionBody, toJEScheduleApprovalRulesList, JEScheduleApprovalRulesList, JEScheduleSetupApproverViewState, JEScheduleApprovalStartsAt, JEScheduleSetupApproverView, getJEScheduleSetupApproverView, getJEScheduleOwnRules, getJEScheduleOtherRules, getJEScheduleOwnRuleCount, getApprovalStartsAt, getApprovalInfoByScheduleId, getOneTimeAccrualApprovalInfo, getScheduleApprovalInfo, fetchJEScheduleApprovalRules, fetchJEScheduleApprovers, saveJEScheduleApprovalRule, deleteJEScheduleApprovalRule, reorderJEScheduleApprovalRules, jeScheduleApprovalAction, saveJEScheduleApprovalDraft, approveJEScheduleWithLocalEdits, clearJEScheduleApprovalRuleSaveStatus, };
|
|
912
912
|
export { RemiApprovalRuleWithUser, RemiSetupApproverViewState, RemiSetupApproverView, RemiSetupApproverUpdateDataView, getRemiSetupApproverView, getRemiSetupApproverUpdateDataView, fetchRemiSetupApproverView, fetchRemiApproversList, fetchRemiApproversDetails, deleteRemiApprovalRule, reorderRemiApprovalRules, saveRemiSetupApproverViewUpdateData, saveRemiSetupApproverViewUpdates, initializeRemiSetupApproverViewUpdateData, setRemiSetupApproverViewListeningToPusherEvent, clearRemiSetupApproverViewUpdateData, };
|
|
913
913
|
export { RemiDetailViewSelector, getRemiDetailView, RemiActivity, RemiDetails, checkApproveRejectBtnShowForRemi, };
|
|
914
914
|
export { RemiApprovalType, RemiDetailView, DuplicateLine };
|