@zeniai/client-epic-state 5.0.69-betaAR3 → 5.0.69-betaAR4
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/account/accountSelector.d.ts +0 -26
- package/lib/entity/account/accountSelector.js +1 -47
- package/lib/entity/account/accountState.d.ts +0 -5
- package/lib/entity/account/accountState.js +4 -11
- package/lib/entity/approvalRule/approvalRulePayload.d.ts +27 -5
- package/lib/entity/approvalRule/approvalRulePayload.js +131 -10
- package/lib/entity/approvalRule/approvalRuleSelector.d.ts +25 -1
- package/lib/entity/approvalRule/approvalRuleSelector.js +40 -0
- package/lib/entity/approvalRule/approvalRuleState.d.ts +48 -7
- package/lib/entity/class/classSelector.d.ts +0 -35
- package/lib/entity/class/classSelector.js +0 -50
- package/lib/esm/entity/account/accountSelector.js +1 -46
- package/lib/esm/entity/account/accountState.js +1 -7
- package/lib/esm/entity/approvalRule/approvalRulePayload.js +131 -10
- package/lib/esm/entity/approvalRule/approvalRuleSelector.js +35 -0
- package/lib/esm/entity/class/classSelector.js +0 -48
- package/lib/esm/index.js +6 -11
- package/lib/esm/view/companyHealthMetricView/companyHealthMetricViewSelector.js +1 -1
- package/lib/esm/view/companyView/helpers/cockpitHelpers.js +1 -1
- package/lib/esm/view/companyView/selector/companyManagementViewSelector.js +1 -1
- package/lib/esm/view/companyView/selector/companyPortfolioViewSelector.js +1 -1
- package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +1 -11
- package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +12 -69
- package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/initializeBillPaySetupApproverViewUpdateDataEpic.js +11 -7
- package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/types/commonPayload.js +61 -16
- package/lib/esm/view/spendManagement/billPay/editBillView/editBillViewSelector.js +7 -2
- package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/epic/initializeRemiSetupApproverViewUpdateDataEpic.js +11 -7
- package/lib/esm/view/spendManagement/spendManagementFilterHelpers.js +2 -4
- package/lib/esm/view/subscriptionView/subscriptionViewSelector.js +1 -1
- package/lib/esm/view/taskManager/taskListView/taskListReducer.js +1 -1
- package/lib/index.d.ts +8 -9
- package/lib/index.js +38 -41
- package/lib/view/companyHealthMetricView/companyHealthMetricViewSelector.js +1 -1
- package/lib/view/companyTaskManagerView/companyTaskManagerViewReducer.d.ts +2 -2
- package/lib/view/companyView/helpers/cockpitHelpers.js +1 -1
- package/lib/view/companyView/selector/companyManagementViewSelector.js +1 -1
- package/lib/view/companyView/selector/companyPortfolioViewSelector.js +1 -1
- package/lib/view/companyView/types/cockpitTypes.d.ts +2 -2
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +1 -5
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +2 -12
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.d.ts +1 -4
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +12 -71
- package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +0 -2
- package/lib/view/people/peopleTypes.d.ts +1 -1
- package/lib/view/spendManagement/billPay/billList/billListState.d.ts +1 -1
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/initializeBillPaySetupApproverViewUpdateDataEpic.js +10 -6
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/types/commonPayload.d.ts +9 -1
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/types/commonPayload.js +61 -16
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/types/commonState.d.ts +31 -5
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +7 -2
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +1 -1
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistory.d.ts +1 -1
- package/lib/view/spendManagement/reimbursement/remiListView/remiListState.d.ts +1 -1
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/epic/initializeRemiSetupApproverViewUpdateDataEpic.js +10 -6
- package/lib/view/spendManagement/spendManagementFilterHelpers.d.ts +1 -1
- package/lib/view/spendManagement/spendManagementFilterHelpers.js +2 -4
- package/lib/view/subscriptionView/subscriptionViewSelector.js +1 -1
- package/lib/view/taskManager/taskListView/taskList.d.ts +4 -4
- package/lib/view/taskManager/taskListView/taskListReducer.js +1 -1
- package/package.json +1 -1
- package/lib/esm/view/expenseAutomationView/transactionFilterHelpers.js +0 -228
- package/lib/view/expenseAutomationView/transactionFilterHelpers.d.ts +0 -65
- package/lib/view/expenseAutomationView/transactionFilterHelpers.js +0 -232
|
@@ -3,7 +3,6 @@ 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.toTransactionView = void 0;
|
|
7
6
|
exports.getExpenseAutomationTransactionView = getExpenseAutomationTransactionView;
|
|
8
7
|
const omit_1 = __importDefault(require("lodash/omit"));
|
|
9
8
|
const reduceFetchState_1 = require("../../../commonStateTypes/reduceFetchState");
|
|
@@ -11,34 +10,14 @@ const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
|
|
|
11
10
|
const tenantSelector_1 = require("../../../entity/tenant/tenantSelector");
|
|
12
11
|
const transactionHelper_1 = require("../../../entity/transaction/transactionHelper");
|
|
13
12
|
const transactionSelector_1 = require("../../../entity/transaction/transactionSelector");
|
|
14
|
-
const transactionFilterHelpers_1 = require("../transactionFilterHelpers");
|
|
15
13
|
const accountListSelector_1 = require("../../accountList/accountListSelector");
|
|
16
14
|
const classListSelector_1 = require("../../classList/classListSelector");
|
|
17
15
|
const projectListSelector_1 = require("../../projectList/projectListSelector");
|
|
18
16
|
const expenseAutomationViewSelectorTypes_1 = require("../selectorTypes/expenseAutomationViewSelectorTypes");
|
|
19
|
-
const toTransactionView = (transaction, transactionLocalData) => {
|
|
20
|
-
return {
|
|
21
|
-
id: transaction.id,
|
|
22
|
-
date: transaction.date,
|
|
23
|
-
amount: transaction.amount,
|
|
24
|
-
vendorName: transaction.vendorName,
|
|
25
|
-
customerName: transaction.customerName,
|
|
26
|
-
vendorId: transaction.vendorId,
|
|
27
|
-
customerId: transaction.customerId,
|
|
28
|
-
description: transaction.description,
|
|
29
|
-
memo: transaction.memo,
|
|
30
|
-
type: transaction.type,
|
|
31
|
-
typeName: transaction.typeName,
|
|
32
|
-
createTime: transaction.createTime,
|
|
33
|
-
transaction: transaction,
|
|
34
|
-
transactionLocalData,
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
exports.toTransactionView = toTransactionView;
|
|
38
17
|
function getExpenseAutomationTransactionView(state) {
|
|
39
18
|
const { accountState, classState, classListState, accountListState, expenseAutomationTransactionsViewState, expenseAutomationViewState, projectState, projectListState, transactionState, monthEndCloseChecksState, monthEndCloseChecksViewState, } = state;
|
|
40
19
|
const { selectedTransactionCategorizationCompletedSubTab, selectedTransactionCategorizationTab, } = expenseAutomationTransactionsViewState;
|
|
41
|
-
const { uiState, refreshStatus, saveStatus, markAsNotMiscategorizedStatus, transactionIdsBySelectedPeriod, transactionReviewLocalDataById, selectedCheckBoxTransactionIds, transactionIdsWithUnsavedData, uploadReceiptStatusById, selectedTransactionId, selectedTransactionLineId,
|
|
20
|
+
const { uiState, refreshStatus, saveStatus, markAsNotMiscategorizedStatus, transactionIdsBySelectedPeriod, transactionReviewLocalDataById, selectedCheckBoxTransactionIds, transactionIdsWithUnsavedData, uploadReceiptStatusById, selectedTransactionId, selectedTransactionLineId, } = expenseAutomationTransactionsViewState.transactionCategorizationView[selectedTransactionCategorizationTab];
|
|
42
21
|
const uncategorizedIncomeExpense = (0, accountListSelector_1.getUncategorizedAccounts)(accountState, accountListState, 'accountList');
|
|
43
22
|
const accountList = (0, accountListSelector_1.getAccountList)(accountState, accountListState, 'accountList');
|
|
44
23
|
const classList = (0, classListSelector_1.getClassList)(classState, classListState);
|
|
@@ -57,58 +36,20 @@ function getExpenseAutomationTransactionView(state) {
|
|
|
57
36
|
? transactionIdsBySelectedPeriod[monthYearPeriodId]
|
|
58
37
|
: null;
|
|
59
38
|
const transactionIds = transactionIdsForSelectedPeriod ?? [];
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
const transactionLocalDataMap = new Map();
|
|
63
|
-
transactionIds.forEach((transactionId) => {
|
|
39
|
+
const transactionLocalData = transactionIds
|
|
40
|
+
.map((transactionId) => {
|
|
64
41
|
const transactionData = transactionReviewLocalDataById[transactionId];
|
|
65
42
|
if (transactionData != null) {
|
|
66
|
-
|
|
43
|
+
return {
|
|
67
44
|
transactionId,
|
|
68
45
|
transactionReviewLocalData: transactionData.transactionReviewLocalData,
|
|
69
|
-
}
|
|
46
|
+
};
|
|
70
47
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
});
|
|
77
|
-
// Apply TC-specific filters (lives under expenseAutomationView, independent
|
|
78
|
-
// of the Spend Management filter pipeline).
|
|
79
|
-
const filteredTransactionViews = (0, transactionFilterHelpers_1.applyTransactionFilters)(transactionViews, filters);
|
|
80
|
-
// Convert back to TransactionWithCOT for return
|
|
81
|
-
const filteredTransactionsWithCOT = filteredTransactionViews.map((view) => view.transaction);
|
|
82
|
-
// Get transactionLocalData for filtered transactions
|
|
83
|
-
// Also include transactionLocalData for transactions that don't exist in transactionState
|
|
84
|
-
// but have local data (to match original behavior)
|
|
85
|
-
const filteredTransactionIds = new Set(filteredTransactionViews.map((view) => view.id));
|
|
86
|
-
// Pre-compute the membership set once. The previous implementation called
|
|
87
|
-
// `transactions.some(t => t.id === transactionId)` inside the per-id loop,
|
|
88
|
-
// turning the pipeline into O(n × m) — measurable on tenants with large
|
|
89
|
-
// transaction lists since this selector runs on every Redux dispatch.
|
|
90
|
-
const transactionExistsById = new Set(transactions.map((t) => t.id));
|
|
91
|
-
// `.flatMap` returns `X[]` directly when the callback returns `[]` for the
|
|
92
|
-
// skip case, so we don't need the trailing `.filter((d): d is X => …)` type
|
|
93
|
-
// predicate that the previous `map → filter` pipeline required.
|
|
94
|
-
const filteredTransactionLocalData = transactionIds.flatMap((transactionId) => {
|
|
95
|
-
const transactionData = transactionReviewLocalDataById[transactionId];
|
|
96
|
-
if (transactionData == null) {
|
|
97
|
-
return [];
|
|
98
|
-
}
|
|
99
|
-
// Include if transaction is in filtered results, or if transaction doesn't exist in state
|
|
100
|
-
// (to maintain backward compatibility with tests)
|
|
101
|
-
const transactionExists = transactionExistsById.has(transactionId);
|
|
102
|
-
if (filteredTransactionIds.has(transactionId) || !transactionExists) {
|
|
103
|
-
return [
|
|
104
|
-
{
|
|
105
|
-
transactionId,
|
|
106
|
-
transactionReviewLocalData: transactionData.transactionReviewLocalData,
|
|
107
|
-
},
|
|
108
|
-
];
|
|
109
|
-
}
|
|
110
|
-
return [];
|
|
111
|
-
});
|
|
48
|
+
return null;
|
|
49
|
+
})
|
|
50
|
+
.filter((transaction) => transaction != null);
|
|
51
|
+
const transactions = (0, transactionSelector_1.getSupportedTransactionsByIds)(transactionState, transactionIds);
|
|
52
|
+
const transactionsWithCOT = transactions.map((transaction) => (0, transactionHelper_1.getTransactionWithCOT)(transaction));
|
|
112
53
|
const monthEndFetchState = monthYearPeriodId != null
|
|
113
54
|
? (monthEndCloseChecksViewState.monthEndCloseChecksViewByTenantId[currentTenant.tenantId]?.[monthYearPeriodId] ?? { fetchState: 'Not-Started', error: undefined })
|
|
114
55
|
: { fetchState: 'Not-Started', error: undefined };
|
|
@@ -172,7 +113,7 @@ function getExpenseAutomationTransactionView(state) {
|
|
|
172
113
|
version: 0,
|
|
173
114
|
fetchState: fetchStatus.fetchState,
|
|
174
115
|
error: fetchStatus.error,
|
|
175
|
-
transactions:
|
|
116
|
+
transactions: transactionsWithCOT,
|
|
176
117
|
selectedCheckBoxTransactionIds,
|
|
177
118
|
transactionIdsWithUnsavedData,
|
|
178
119
|
uncategorizedAccounts: uncategorizedIncomeExpense,
|
|
@@ -183,7 +124,7 @@ function getExpenseAutomationTransactionView(state) {
|
|
|
183
124
|
classHierarchyList,
|
|
184
125
|
isAccountingProjectsEnabled,
|
|
185
126
|
projectList,
|
|
186
|
-
transactionLocalData
|
|
127
|
+
transactionLocalData,
|
|
187
128
|
uiState,
|
|
188
129
|
refreshStatus,
|
|
189
130
|
saveStatus,
|
|
@@ -16,7 +16,6 @@ import { VendorBase } from '../../../entity/vendor/vendorState';
|
|
|
16
16
|
import { ZeniAPIStatus } from '../../../responsePayload';
|
|
17
17
|
import { ZeniDate } from '../../../zeniDayJS';
|
|
18
18
|
import { EntityRecommendationKey } from '../../recommendation/recommendationState';
|
|
19
|
-
import { TransactionFilters } from '../transactionFilterHelpers';
|
|
20
19
|
import { TransactionDetailKey } from '../../transactionDetail/transactionDetailState';
|
|
21
20
|
import { CompletedSubTab } from './completedSubTab';
|
|
22
21
|
export declare const toTransactionsSortKey: (v: string) => "date" | "amount" | "vendor" | "project" | "category" | "class" | "payment_account" | "transaction_type" | "memo_and_receipt";
|
|
@@ -94,7 +93,6 @@ export interface SupportedTransactionCategorization {
|
|
|
94
93
|
}
|
|
95
94
|
export declare const initialSupportedTransactionCategorization: SupportedTransactionCategorization;
|
|
96
95
|
export interface TransactionsTabViewState extends FetchedState {
|
|
97
|
-
filters: TransactionFilters;
|
|
98
96
|
markAsNotMiscategorizedStatus: FetchStateAndError;
|
|
99
97
|
refreshStatus: FetchStateAndError;
|
|
100
98
|
saveStatus: FetchStateAndError;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
declare const toPeopleSortKeyType: (v: string) => "role" | "manager" | "
|
|
1
|
+
declare const toPeopleSortKeyType: (v: string) => "role" | "manager" | "department" | "name" | "lastSeen";
|
|
2
2
|
export type PeopleViewSortKey = ReturnType<typeof toPeopleSortKeyType>;
|
|
3
3
|
export {};
|
|
@@ -45,7 +45,7 @@ export interface BillPayFilters {
|
|
|
45
45
|
}
|
|
46
46
|
export interface BillPayFilterCategory {
|
|
47
47
|
field: BillListViewFilterCategoryField;
|
|
48
|
-
matchingOperator: 'equal' | '
|
|
48
|
+
matchingOperator: 'equal' | 'not-equal';
|
|
49
49
|
values: (string | ZeniDate)[];
|
|
50
50
|
valuesCombinationOperator: 'ANY';
|
|
51
51
|
}
|
|
@@ -11,16 +11,20 @@ const initializeBillPaySetupApproverViewUpdateDataEpic = (actions$, state$) => a
|
|
|
11
11
|
if (approvalRuleId != null) {
|
|
12
12
|
const approvalRule = (0, approvalRuleSelector_1.getApprovalRuleById)(state$.value.approvalRuleState, approvalRuleId);
|
|
13
13
|
if (approvalRule != null) {
|
|
14
|
-
const criteria = approvalRule.criteria[0];
|
|
15
|
-
const range = criteria?.range;
|
|
16
14
|
const billPaySetupApproverViewUpdateData = {
|
|
17
15
|
approvalRuleId,
|
|
18
16
|
steps: approvalRule.steps,
|
|
19
17
|
criteria: {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
amount: (0, approvalRuleSelector_1.getAmountCriteria)(approvalRule.criteria),
|
|
19
|
+
vendor: (0, approvalRuleSelector_1.getVendorCriteria)(approvalRule.criteria),
|
|
20
|
+
department: (0, approvalRuleSelector_1.getDepartmentCriteria)(approvalRule.criteria),
|
|
23
21
|
},
|
|
22
|
+
// Approval Rules 3.0 — seed rule-level fields so the form can
|
|
23
|
+
// round-trip them on edit. Each may be undefined on legacy rules.
|
|
24
|
+
name: approvalRule.name,
|
|
25
|
+
description: approvalRule.description,
|
|
26
|
+
separationOfDuties: approvalRule.separationOfDuties,
|
|
27
|
+
isFallback: approvalRule.isFallback,
|
|
24
28
|
};
|
|
25
29
|
fetchActions.push((0, billPaySetupApproverViewReducer_1.clearBillPaySetupApproverViewUpdateData)(), (0, billPaySetupApproverViewReducer_1.saveBillPaySetupApproverViewUpdateData)(billPaySetupApproverViewUpdateData));
|
|
26
30
|
}
|
|
@@ -28,7 +32,7 @@ const initializeBillPaySetupApproverViewUpdateDataEpic = (actions$, state$) => a
|
|
|
28
32
|
else {
|
|
29
33
|
const billPaySetupApproverViewCreateData = {
|
|
30
34
|
steps: [],
|
|
31
|
-
criteria:
|
|
35
|
+
criteria: {},
|
|
32
36
|
};
|
|
33
37
|
fetchActions.push((0, billPaySetupApproverViewReducer_1.clearBillPaySetupApproverViewUpdateData)(), (0, billPaySetupApproverViewReducer_1.saveBillPaySetupApproverViewUpdateData)(billPaySetupApproverViewCreateData));
|
|
34
38
|
}
|
|
@@ -14,9 +14,17 @@ interface ApproverViewStepPayload extends Omit<StepPayload, 'actors'> {
|
|
|
14
14
|
}
|
|
15
15
|
interface ApprovalUpdatableInfoPayload {
|
|
16
16
|
approval_rule_id: ID;
|
|
17
|
-
criteria: CriteriaPayload
|
|
17
|
+
criteria: CriteriaPayload;
|
|
18
18
|
is_applicable_on_pending_approval_entity: boolean;
|
|
19
19
|
steps: ApproverViewStepPayload[];
|
|
20
|
+
description?: string;
|
|
21
|
+
is_fallback?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Approval Rules 3.0 — rule-level wire fields. The backend accepts these
|
|
24
|
+
* as optional today; once 3.0 ships they become first-class.
|
|
25
|
+
*/
|
|
26
|
+
name?: string;
|
|
27
|
+
separation_of_duties?: boolean;
|
|
20
28
|
}
|
|
21
29
|
export declare const toApprovalChangableInfoPayload: (approverViewUpdateData: ApprovalRuleUpdateData | ApprovalRuleCreateData) => Partial<ApprovalUpdatableInfoPayload>;
|
|
22
30
|
export {};
|
|
@@ -2,22 +2,50 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.toApprovalChangableInfoPayload = void 0;
|
|
4
4
|
const toApprovalChangableInfoPayload = (approverViewUpdateData) => {
|
|
5
|
-
|
|
5
|
+
// Form-side criteria is a structured object with optional slots for
|
|
6
|
+
// amount / vendor / department; flatten it into the wire format's
|
|
7
|
+
// `conditions[]` array.
|
|
8
|
+
let criteriaPayload;
|
|
6
9
|
if (approverViewUpdateData.criteria != null) {
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
10
|
+
const { amount, vendor, department } = approverViewUpdateData.criteria;
|
|
11
|
+
const conditions = [];
|
|
12
|
+
if (amount?.min != null) {
|
|
13
|
+
conditions.push({
|
|
14
|
+
field: 'amount',
|
|
15
|
+
type: 'gte',
|
|
16
|
+
value: amount.min.amount,
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
if (amount?.max != null) {
|
|
20
|
+
conditions.push({
|
|
21
|
+
field: 'amount',
|
|
22
|
+
type: 'lte',
|
|
23
|
+
value: amount.max.amount,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
if (vendor != null && vendor.vendorIds.length > 0) {
|
|
27
|
+
conditions.push({
|
|
28
|
+
field: 'vendor_id',
|
|
29
|
+
type: vendor.operator === 'is_not' ? 'not_in' : 'in',
|
|
30
|
+
value: vendor.vendorIds,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
if (department != null && department.departmentIds.length > 0) {
|
|
34
|
+
conditions.push({
|
|
35
|
+
field: 'department_id',
|
|
36
|
+
type: department.operator === 'is_not' ? 'not_in' : 'in',
|
|
37
|
+
value: department.departmentIds,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
if (conditions.length > 0) {
|
|
41
|
+
const currency = amount?.min ?? amount?.max ?? null;
|
|
42
|
+
criteriaPayload = {
|
|
43
|
+
conditions,
|
|
44
|
+
criteria_operator: 'and',
|
|
45
|
+
currency_code: currency?.currencyCode ?? 'USD',
|
|
46
|
+
currency_symbol: currency?.currencySymbol ?? '$',
|
|
47
|
+
};
|
|
48
|
+
}
|
|
21
49
|
}
|
|
22
50
|
const steps = approverViewUpdateData.steps.map((step) => {
|
|
23
51
|
return {
|
|
@@ -38,10 +66,27 @@ const toApprovalChangableInfoPayload = (approverViewUpdateData) => {
|
|
|
38
66
|
});
|
|
39
67
|
const isUpdate = approverViewUpdateData.approvalRuleId != null;
|
|
40
68
|
const payload = {
|
|
41
|
-
criteria: criteriaPayload,
|
|
42
69
|
steps,
|
|
43
70
|
is_applicable_on_pending_approval_entity: approverViewUpdateData.isApplicableOnPendingApprovalEntity ?? true,
|
|
44
71
|
};
|
|
72
|
+
if (criteriaPayload != null) {
|
|
73
|
+
payload.criteria = criteriaPayload;
|
|
74
|
+
}
|
|
75
|
+
// Approval Rules 3.0 — surface rule-level fields when the form set them.
|
|
76
|
+
// Send only what the user actually entered: an undefined value means
|
|
77
|
+
// "no opinion" and stays off the wire.
|
|
78
|
+
if (approverViewUpdateData.name != null) {
|
|
79
|
+
payload.name = approverViewUpdateData.name;
|
|
80
|
+
}
|
|
81
|
+
if (approverViewUpdateData.description != null) {
|
|
82
|
+
payload.description = approverViewUpdateData.description;
|
|
83
|
+
}
|
|
84
|
+
if (approverViewUpdateData.separationOfDuties != null) {
|
|
85
|
+
payload.separation_of_duties = approverViewUpdateData.separationOfDuties;
|
|
86
|
+
}
|
|
87
|
+
if (approverViewUpdateData.isFallback != null) {
|
|
88
|
+
payload.is_fallback = approverViewUpdateData.isFallback;
|
|
89
|
+
}
|
|
45
90
|
if (isUpdate) {
|
|
46
91
|
payload.approval_rule_id = approverViewUpdateData.approvalRuleId;
|
|
47
92
|
}
|
|
@@ -1,19 +1,45 @@
|
|
|
1
1
|
import { FetchStateAndError, ID } from '../../../../../commonStateTypes/common';
|
|
2
|
-
import {
|
|
2
|
+
import { AmountCriteria, DepartmentCriteria, Step, VendorCriteria } from '../../../../../entity/approvalRule/approvalRuleState';
|
|
3
3
|
export type ApprovalUpdateActionType = 'approval_create' | 'approval_update';
|
|
4
4
|
export interface ApproverViewUpdateData {
|
|
5
5
|
type: ApprovalUpdateActionType;
|
|
6
6
|
updateStatus: FetchStateAndError;
|
|
7
7
|
data?: ApprovalRuleUpdateData | ApprovalRuleCreateData;
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Form-side criteria shape used by the rule create/edit form.
|
|
11
|
+
*
|
|
12
|
+
* Each condition kind gets its own optional slot, mirroring how the UI
|
|
13
|
+
* edits them as distinct rows. At most one of each kind is present; this
|
|
14
|
+
* matches the design constraint that each condition type can be added once.
|
|
15
|
+
*/
|
|
16
|
+
export interface ApprovalRuleFormCriteria {
|
|
17
|
+
amount?: AmountCriteria;
|
|
18
|
+
department?: DepartmentCriteria;
|
|
19
|
+
vendor?: VendorCriteria;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Rule-level fields shared by both create and update flows.
|
|
23
|
+
*
|
|
24
|
+
* These come from the 3.0 design: the form now owns a name, an optional
|
|
25
|
+
* description, an optional Separation-of-Duties toggle, and a flag that
|
|
26
|
+
* marks the rule as the org-wide fallback rule. They live alongside
|
|
27
|
+
* criteria/steps but are not part of either.
|
|
28
|
+
*/
|
|
29
|
+
export interface ApprovalRuleFormBase {
|
|
30
|
+
description?: string;
|
|
31
|
+
isFallback?: boolean;
|
|
32
|
+
name?: string;
|
|
33
|
+
separationOfDuties?: boolean;
|
|
34
|
+
}
|
|
35
|
+
export interface ApprovalRuleUpdateData extends ApprovalRuleFormBase {
|
|
10
36
|
approvalRuleId: ID;
|
|
11
|
-
criteria:
|
|
37
|
+
criteria: ApprovalRuleFormCriteria;
|
|
12
38
|
steps: Step[];
|
|
13
39
|
isApplicableOnPendingApprovalEntity?: boolean;
|
|
14
40
|
}
|
|
15
|
-
export interface ApprovalRuleCreateData {
|
|
16
|
-
criteria:
|
|
41
|
+
export interface ApprovalRuleCreateData extends ApprovalRuleFormBase {
|
|
42
|
+
criteria: ApprovalRuleFormCriteria;
|
|
17
43
|
steps: Step[];
|
|
18
44
|
isApplicableOnPendingApprovalEntity?: boolean;
|
|
19
45
|
}
|
|
@@ -9,6 +9,7 @@ exports.getPaymentSection = getPaymentSection;
|
|
|
9
9
|
exports.toPaymentToOption = toPaymentToOption;
|
|
10
10
|
const get_1 = __importDefault(require("lodash/get"));
|
|
11
11
|
const has_1 = __importDefault(require("lodash/has"));
|
|
12
|
+
const approvalRuleSelector_1 = require("../../../../entity/approvalRule/approvalRuleSelector");
|
|
12
13
|
const reduceFetchState_1 = require("../../../../commonStateTypes/reduceFetchState");
|
|
13
14
|
const bankAccountSelector_1 = require("../../../../entity/bankAccount/bankAccountSelector");
|
|
14
15
|
const contactSelector_1 = require("../../../../entity/billPay/contact/contactSelector");
|
|
@@ -698,9 +699,13 @@ exports.getDefaultWithdrawFromAccount = getDefaultWithdrawFromAccount;
|
|
|
698
699
|
const checkIfCreatorIsApprover = (billAmount, approvalRules, signedInUser) => {
|
|
699
700
|
let isCreatorAlsoApprover = false;
|
|
700
701
|
const approvalRule = approvalRules.find((rule) => {
|
|
701
|
-
const
|
|
702
|
+
const amountCriteria = (0, approvalRuleSelector_1.getAmountCriteria)(rule.criteria);
|
|
703
|
+
if (amountCriteria?.min == null) {
|
|
704
|
+
return false;
|
|
705
|
+
}
|
|
706
|
+
const { min, max } = amountCriteria;
|
|
702
707
|
return (billAmount > min.amount &&
|
|
703
|
-
(max?.amount != null ? billAmount <= max
|
|
708
|
+
(max?.amount != null ? billAmount <= max.amount : true));
|
|
704
709
|
});
|
|
705
710
|
if (approvalRule != null) {
|
|
706
711
|
const requireApprovalSteps = approvalRule.steps.filter((step) => step.action === 'require_approval');
|
|
@@ -61,7 +61,7 @@ export declare const initialCreditAcc: CreditAccount;
|
|
|
61
61
|
export declare const initialDebitCardSummaries: DebitCardSummaries;
|
|
62
62
|
export declare const initialResendRevokeCardInvite: ResendRevokeCardInvite;
|
|
63
63
|
export declare const initialCreditAccountRepayment: CreditAccountRepayment;
|
|
64
|
-
export declare const toChargeCardSortKeyType: (v: string) => "status" | "
|
|
64
|
+
export declare const toChargeCardSortKeyType: (v: string) => "status" | "department" | "accountType" | "owner" | "cardName" | "limit" | "cardType" | "utilisation";
|
|
65
65
|
export declare type ChargeCardViewSortKey = ReturnType<typeof toChargeCardSortKeyType>;
|
|
66
66
|
export declare const ALL_CASHBACK_SORT_KEYS: readonly ["month", "cashback"];
|
|
67
67
|
export declare const toCashbackSortKeyType: (v: string) => "month" | "cashback";
|
package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistory.d.ts
CHANGED
|
@@ -36,7 +36,7 @@ export interface PaymentHistoryFilters {
|
|
|
36
36
|
}
|
|
37
37
|
export interface PaymentHistoryFilterCategory {
|
|
38
38
|
field: PaymentHistoryFilterCategoryField;
|
|
39
|
-
matchingOperator: 'equal' | '
|
|
39
|
+
matchingOperator: 'equal' | 'not-equal';
|
|
40
40
|
values: (string | ZeniDate)[];
|
|
41
41
|
valuesCombinationOperator: 'ANY';
|
|
42
42
|
}
|
|
@@ -46,7 +46,7 @@ export interface ReimbursementFilters {
|
|
|
46
46
|
}
|
|
47
47
|
export interface ReimbursementFilterCategory {
|
|
48
48
|
field: RemiListViewFilterCategoryField;
|
|
49
|
-
matchingOperator: 'equal' | '
|
|
49
|
+
matchingOperator: 'equal' | 'not-equal';
|
|
50
50
|
values: (string | ZeniDate)[];
|
|
51
51
|
valuesCombinationOperator: 'ANY';
|
|
52
52
|
}
|
|
@@ -11,16 +11,20 @@ const initializeRemiSetupApproverViewUpdateDataEpic = (actions$, state$) => acti
|
|
|
11
11
|
if (approvalRuleId != null) {
|
|
12
12
|
const approvalRule = (0, approvalRuleSelector_1.getApprovalRuleById)(state$.value.approvalRuleState, approvalRuleId);
|
|
13
13
|
if (approvalRule != null) {
|
|
14
|
-
const criteria = approvalRule.criteria[0];
|
|
15
|
-
const range = criteria?.range;
|
|
16
14
|
const remiSetupApproverViewUpdateData = {
|
|
17
15
|
approvalRuleId,
|
|
18
16
|
steps: approvalRule.steps,
|
|
19
17
|
criteria: {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
amount: (0, approvalRuleSelector_1.getAmountCriteria)(approvalRule.criteria),
|
|
19
|
+
vendor: (0, approvalRuleSelector_1.getVendorCriteria)(approvalRule.criteria),
|
|
20
|
+
department: (0, approvalRuleSelector_1.getDepartmentCriteria)(approvalRule.criteria),
|
|
23
21
|
},
|
|
22
|
+
// Approval Rules 3.0 — seed rule-level fields so the form can
|
|
23
|
+
// round-trip them on edit. Each may be undefined on legacy rules.
|
|
24
|
+
name: approvalRule.name,
|
|
25
|
+
description: approvalRule.description,
|
|
26
|
+
separationOfDuties: approvalRule.separationOfDuties,
|
|
27
|
+
isFallback: approvalRule.isFallback,
|
|
24
28
|
};
|
|
25
29
|
fetchActions.push((0, remiSetupApproverViewReducer_1.clearRemiSetupApproverViewUpdateData)(), (0, remiSetupApproverViewReducer_1.saveRemiSetupApproverViewUpdateData)(remiSetupApproverViewUpdateData));
|
|
26
30
|
}
|
|
@@ -28,7 +32,7 @@ const initializeRemiSetupApproverViewUpdateDataEpic = (actions$, state$) => acti
|
|
|
28
32
|
else {
|
|
29
33
|
const remiSetupApproverViewCreateData = {
|
|
30
34
|
steps: [],
|
|
31
|
-
criteria:
|
|
35
|
+
criteria: {},
|
|
32
36
|
};
|
|
33
37
|
fetchActions.push((0, remiSetupApproverViewReducer_1.clearRemiSetupApproverViewUpdateData)(), (0, remiSetupApproverViewReducer_1.saveRemiSetupApproverViewUpdateData)(remiSetupApproverViewCreateData));
|
|
34
38
|
}
|
|
@@ -15,7 +15,7 @@ export type SpendManagementFilterEntityType = 'bill_pay' | 'reimbursement' | 'ta
|
|
|
15
15
|
export type FilterCategoryType = 'searchAutocomplete' | 'user' | 'dateRange' | 'numberRange' | 'dropdown';
|
|
16
16
|
export interface MatchingOperatorDropdownOption {
|
|
17
17
|
label: 'is' | 'is not';
|
|
18
|
-
value: 'equal' | '
|
|
18
|
+
value: 'equal' | 'not-equal';
|
|
19
19
|
}
|
|
20
20
|
export type CategoryCombinationOperator = 'AND' | 'OR';
|
|
21
21
|
export interface BillPayFilterCategoryDropdownOption {
|
|
@@ -14,8 +14,6 @@ const helpers_1 = require("./helpers");
|
|
|
14
14
|
const remiListSelector_1 = require("./reimbursement/remiListView/remiListSelector");
|
|
15
15
|
const remiListState_1 = require("./reimbursement/remiListView/remiListState");
|
|
16
16
|
//filters items against filter values representing a range. ex: date (from-to), amount(1k<-->5k)
|
|
17
|
-
// Spend Management uses only equal/not_equal — TC amount operators
|
|
18
|
-
// (inBetween, lessThan, greaterThan) live in the TC filter pipeline.
|
|
19
17
|
const filterItemOnRangeCategoryType = (valueForItem, currentFilter) => {
|
|
20
18
|
let doesItemFallInValueRange = false;
|
|
21
19
|
const filterField = currentFilter.field;
|
|
@@ -49,7 +47,7 @@ const filterItemOnCategoriesWithSingleValue = (categoryValue, currentFilter, ran
|
|
|
49
47
|
return filterItemOnRangeCategoryType(categoryValue, currentFilter);
|
|
50
48
|
}
|
|
51
49
|
// if filter category is not rangeType
|
|
52
|
-
if (currentFilter.matchingOperator === '
|
|
50
|
+
if (currentFilter.matchingOperator === 'not-equal') {
|
|
53
51
|
return currentFilter.values.indexOf(categoryValue.toString()) === -1;
|
|
54
52
|
}
|
|
55
53
|
return currentFilter.values.indexOf(categoryValue.toString()) > -1;
|
|
@@ -123,7 +121,7 @@ const applyAdvancedFiltersOnList = (entity, allItems, filters, filteredItems = [
|
|
|
123
121
|
? getCategoryValueForTaskList(key, item)
|
|
124
122
|
: getCategoryValueForPaymentHistory(key, item);
|
|
125
123
|
if (categoryValue == null) {
|
|
126
|
-
if (currentFilter.matchingOperator === '
|
|
124
|
+
if (currentFilter.matchingOperator === 'not-equal') {
|
|
127
125
|
return true;
|
|
128
126
|
}
|
|
129
127
|
return false;
|
|
@@ -217,7 +217,7 @@ const applyAdvancedFiltersOnCompaniesList = (allCompanies, filters, filteredComp
|
|
|
217
217
|
const key = currentFilter.field;
|
|
218
218
|
const categoryValue = getCategoryValueForCompany(key, company);
|
|
219
219
|
if (categoryValue == null) {
|
|
220
|
-
if (currentFilter.matchingOperator === '
|
|
220
|
+
if (currentFilter.matchingOperator === 'not-equal') {
|
|
221
221
|
return true;
|
|
222
222
|
}
|
|
223
223
|
return false;
|
|
@@ -44,21 +44,21 @@ export interface TaskListFilters {
|
|
|
44
44
|
}
|
|
45
45
|
export interface TaskFilterCategory {
|
|
46
46
|
field: TaskListFilterCategoryField;
|
|
47
|
-
matchingOperator: 'equal' | '
|
|
47
|
+
matchingOperator: 'equal' | 'not-equal';
|
|
48
48
|
values: (string | ZeniDate)[];
|
|
49
49
|
valuesCombinationOperator: 'ANY';
|
|
50
50
|
}
|
|
51
51
|
export type TaskListFilterCategoryField = 'status' | 'dueDate' | 'assignee' | 'creationDate' | 'priority' | 'tag';
|
|
52
52
|
export declare const TASK_LIST_GROUP_BY_KEYS: readonly ["groupName", "status", "dueDate", "assignee", "priority", "tag"];
|
|
53
|
-
export declare const toTaskListGroupByKeyType: (v: string) => "status" | "
|
|
54
|
-
export declare const toTaskListGroupByKeyTypeStrict: (v: string) => "status" | "
|
|
53
|
+
export declare const toTaskListGroupByKeyType: (v: string) => "status" | "priority" | "dueDate" | "groupName" | "tag" | "assignee";
|
|
54
|
+
export declare const toTaskListGroupByKeyTypeStrict: (v: string) => "status" | "priority" | "dueDate" | "groupName" | "tag" | "assignee" | undefined;
|
|
55
55
|
export declare type TaskGroupKey = ReturnType<typeof toTaskListGroupByKeyType>;
|
|
56
56
|
export interface TaskListUIState extends SpendManagementUIState {
|
|
57
57
|
groupByKey: TaskGroupKey;
|
|
58
58
|
searchText: string;
|
|
59
59
|
sortKey: TaskListViewSortKey;
|
|
60
60
|
}
|
|
61
|
-
declare const toTaskListSortKeyType: (v: string) => "status" | "name" | "
|
|
61
|
+
declare const toTaskListSortKeyType: (v: string) => "status" | "name" | "priority" | "dueDate" | "tag" | "timeSpent" | "assignee" | "creationDate" | "visibility";
|
|
62
62
|
export declare type TaskListViewSortKey = ReturnType<typeof toTaskListSortKeyType>;
|
|
63
63
|
export declare const TASK_LIST_FILTER_CATEGORIES: TaskListFilterCategoryOption[];
|
|
64
64
|
interface TaskListFilterCategoryOption {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.0.69-
|
|
3
|
+
"version": "5.0.69-betaAR4",
|
|
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
|
"module": "lib/esm/index.js",
|