@zeniai/client-epic-state 5.3.5 → 5.3.6-betaGS1
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/customerIncome/customerIncomeTrend.d.ts +18 -2
- package/lib/entity/customerIncome/customerIncomeTrend.js +65 -5
- package/lib/entity/insights/insightSummary.d.ts +3 -0
- package/lib/entity/insights/insightSummaryPayload.js +2 -0
- package/lib/entity/invoicing/invoice/invoicePayload.d.ts +1 -0
- package/lib/entity/invoicing/invoice/invoicePayload.js +3 -0
- package/lib/entity/invoicing/invoice/invoiceState.d.ts +2 -0
- package/lib/entity/jeScheduleApprovalRule/jeScheduleApprovalRulePayload.d.ts +100 -0
- package/lib/entity/jeScheduleApprovalRule/jeScheduleApprovalRulePayload.js +156 -0
- package/lib/entity/jeScheduleApprovalRule/jeScheduleApprovalRuleState.d.ts +87 -0
- package/lib/entity/jeScheduleApprovalRule/jeScheduleApprovalRuleState.js +2 -0
- package/lib/entity/jeScheduleApprovalRule/jeScheduleApprovalRuleTypes.d.ts +29 -0
- package/lib/entity/jeScheduleApprovalRule/jeScheduleApprovalRuleTypes.js +55 -0
- package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +3 -0
- package/lib/entity/jeSchedules/jeSchedulesPayload.js +4 -0
- package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +8 -0
- package/lib/entity/jeSchedules/jeSchedulesSelector.js +18 -1
- package/lib/entity/jeSchedules/jeSchedulesState.d.ts +4 -0
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +6 -0
- package/lib/entity/userRole/userRoleTenantAccess.d.ts +9 -0
- package/lib/entity/userRole/userRoleTenantAccess.js +25 -1
- package/lib/entity/userRole/userRoleType.d.ts +2 -2
- package/lib/entity/vendorExpense/vendorSpendTrendFilterTabType.d.ts +2 -2
- package/lib/epic.d.ts +11 -1
- package/lib/epic.js +21 -0
- package/lib/esm/entity/customerIncome/customerIncomeTrend.js +63 -4
- package/lib/esm/entity/insights/insightSummaryPayload.js +2 -0
- package/lib/esm/entity/invoicing/invoice/invoicePayload.js +3 -0
- package/lib/esm/entity/jeScheduleApprovalRule/jeScheduleApprovalRulePayload.js +145 -0
- package/lib/esm/entity/jeScheduleApprovalRule/jeScheduleApprovalRuleState.js +1 -0
- package/lib/esm/entity/jeScheduleApprovalRule/jeScheduleApprovalRuleTypes.js +45 -0
- package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +4 -0
- package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +15 -0
- package/lib/esm/entity/snackbar/snackbarTypes.js +6 -0
- package/lib/esm/entity/userRole/userRoleTenantAccess.js +22 -0
- package/lib/esm/epic.js +22 -1
- package/lib/esm/index.js +14 -4
- package/lib/esm/reducer.js +6 -0
- package/lib/esm/view/customerSummaryView/customerSummaryViewPayload.js +1 -0
- package/lib/esm/view/customerSummaryView/customerSummaryViewReducer.js +197 -0
- package/lib/esm/view/customerSummaryView/customerSummaryViewSelector.js +35 -0
- package/lib/esm/view/customerSummaryView/customerSummaryViewState.js +10 -0
- package/lib/esm/view/customerSummaryView/epic/fetchCustomerSummaryDetailEpic.js +30 -0
- package/lib/esm/view/customerSummaryView/epic/fetchCustomerSummaryListEpic.js +27 -0
- package/lib/esm/view/customerSummaryView/epic/saveCustomerSummaryDetailEpic.js +44 -0
- package/lib/esm/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js +2 -1
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +55 -10
- package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +16 -1
- package/lib/esm/view/settings/jeScheduleApprovalRules/epic/deleteJEScheduleApprovalRuleEpic.js +38 -0
- package/lib/esm/view/settings/jeScheduleApprovalRules/epic/fetchJEScheduleApprovalRulesEpic.js +28 -0
- package/lib/esm/view/settings/jeScheduleApprovalRules/epic/fetchJEScheduleApproversEpic.js +22 -0
- package/lib/esm/view/settings/jeScheduleApprovalRules/epic/jeScheduleApprovalActionEpic.js +43 -0
- package/lib/esm/view/settings/jeScheduleApprovalRules/epic/reorderJEScheduleApprovalRulesEpic.js +42 -0
- package/lib/esm/view/settings/jeScheduleApprovalRules/epic/saveJEScheduleApprovalDraftEpic.js +45 -0
- package/lib/esm/view/settings/jeScheduleApprovalRules/epic/saveJEScheduleApprovalRuleEpic.js +45 -0
- package/lib/esm/view/settings/jeScheduleApprovalRules/jeScheduleSetupApproverViewPayload.js +28 -0
- package/lib/esm/view/settings/jeScheduleApprovalRules/jeScheduleSetupApproverViewReducer.js +266 -0
- package/lib/esm/view/settings/jeScheduleApprovalRules/jeScheduleSetupApproverViewSelector.js +65 -0
- package/lib/esm/view/settings/jeScheduleApprovalRules/jeScheduleSetupApproverViewSelectorTypes.js +1 -0
- package/lib/esm/view/settings/jeScheduleApprovalRules/jeScheduleSetupApproverViewState.js +1 -0
- package/lib/esm/view/settingsView/settingsViewHelpers.js +5 -2
- package/lib/esm/view/trend/fetchIncomeTrendEpic.js +29 -6
- package/lib/esm/view/trend/trendReducer.js +4 -2
- package/lib/index.d.ts +20 -5
- package/lib/index.js +113 -46
- package/lib/reducer.d.ts +2 -0
- package/lib/reducer.js +6 -0
- package/lib/rootStateTypes.d.ts +4 -0
- package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewReducer.d.ts +2 -2
- package/lib/view/companyView/types/cockpitTypes.d.ts +1 -1
- package/lib/view/customerSummaryView/customerSummaryViewPayload.d.ts +38 -0
- package/lib/view/customerSummaryView/customerSummaryViewPayload.js +2 -0
- package/lib/view/customerSummaryView/customerSummaryViewReducer.d.ts +32 -0
- package/lib/view/customerSummaryView/customerSummaryViewReducer.js +202 -0
- package/lib/view/customerSummaryView/customerSummaryViewSelector.d.ts +20 -0
- package/lib/view/customerSummaryView/customerSummaryViewSelector.js +43 -0
- package/lib/view/customerSummaryView/customerSummaryViewState.d.ts +63 -0
- package/lib/view/customerSummaryView/customerSummaryViewState.js +13 -0
- package/lib/view/customerSummaryView/epic/fetchCustomerSummaryDetailEpic.d.ts +9 -0
- package/lib/view/customerSummaryView/epic/fetchCustomerSummaryDetailEpic.js +34 -0
- package/lib/view/customerSummaryView/epic/fetchCustomerSummaryListEpic.d.ts +7 -0
- package/lib/view/customerSummaryView/epic/fetchCustomerSummaryListEpic.js +31 -0
- package/lib/view/customerSummaryView/epic/saveCustomerSummaryDetailEpic.d.ts +8 -0
- package/lib/view/customerSummaryView/epic/saveCustomerSummaryDetailEpic.js +48 -0
- package/lib/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js +2 -1
- package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.d.ts +3 -2
- package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +55 -9
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +2 -0
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +4 -1
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +18 -3
- package/lib/view/expenseAutomationView/types/actualMatchingViewState.d.ts +1 -1
- package/lib/view/scheduleView/scheduleDetailView/scheduleDetailPayload.d.ts +1 -1
- package/lib/view/settings/jeScheduleApprovalRules/epic/deleteJEScheduleApprovalRuleEpic.d.ts +8 -0
- package/lib/view/settings/jeScheduleApprovalRules/epic/deleteJEScheduleApprovalRuleEpic.js +42 -0
- package/lib/view/settings/jeScheduleApprovalRules/epic/fetchJEScheduleApprovalRulesEpic.d.ts +8 -0
- package/lib/view/settings/jeScheduleApprovalRules/epic/fetchJEScheduleApprovalRulesEpic.js +32 -0
- package/lib/view/settings/jeScheduleApprovalRules/epic/fetchJEScheduleApproversEpic.d.ts +8 -0
- package/lib/view/settings/jeScheduleApprovalRules/epic/fetchJEScheduleApproversEpic.js +26 -0
- package/lib/view/settings/jeScheduleApprovalRules/epic/jeScheduleApprovalActionEpic.d.ts +10 -0
- package/lib/view/settings/jeScheduleApprovalRules/epic/jeScheduleApprovalActionEpic.js +47 -0
- package/lib/view/settings/jeScheduleApprovalRules/epic/reorderJEScheduleApprovalRulesEpic.d.ts +12 -0
- package/lib/view/settings/jeScheduleApprovalRules/epic/reorderJEScheduleApprovalRulesEpic.js +46 -0
- package/lib/view/settings/jeScheduleApprovalRules/epic/saveJEScheduleApprovalDraftEpic.d.ts +10 -0
- package/lib/view/settings/jeScheduleApprovalRules/epic/saveJEScheduleApprovalDraftEpic.js +49 -0
- package/lib/view/settings/jeScheduleApprovalRules/epic/saveJEScheduleApprovalRuleEpic.d.ts +8 -0
- package/lib/view/settings/jeScheduleApprovalRules/epic/saveJEScheduleApprovalRuleEpic.js +49 -0
- package/lib/view/settings/jeScheduleApprovalRules/jeScheduleSetupApproverViewPayload.d.ts +43 -0
- package/lib/view/settings/jeScheduleApprovalRules/jeScheduleSetupApproverViewPayload.js +34 -0
- package/lib/view/settings/jeScheduleApprovalRules/jeScheduleSetupApproverViewReducer.d.ts +49 -0
- package/lib/view/settings/jeScheduleApprovalRules/jeScheduleSetupApproverViewReducer.js +271 -0
- package/lib/view/settings/jeScheduleApprovalRules/jeScheduleSetupApproverViewSelector.d.ts +8 -0
- package/lib/view/settings/jeScheduleApprovalRules/jeScheduleSetupApproverViewSelector.js +72 -0
- package/lib/view/settings/jeScheduleApprovalRules/jeScheduleSetupApproverViewSelectorTypes.d.ts +23 -0
- package/lib/view/settings/jeScheduleApprovalRules/jeScheduleSetupApproverViewSelectorTypes.js +2 -0
- package/lib/view/settings/jeScheduleApprovalRules/jeScheduleSetupApproverViewState.d.ts +28 -0
- package/lib/view/settings/jeScheduleApprovalRules/jeScheduleSetupApproverViewState.js +2 -0
- package/lib/view/settingsView/settingsViewHelpers.js +4 -1
- package/lib/view/trend/fetchIncomeTrendEpic.d.ts +1 -1
- package/lib/view/trend/fetchIncomeTrendEpic.js +28 -5
- package/lib/view/trend/trendReducer.d.ts +8 -1
- package/lib/view/trend/trendReducer.js +4 -2
- package/package.json +1 -1
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
import { Amount } from '../../commonStateTypes/amount';
|
|
2
2
|
import { BalanceKind, TrendTimeseries } from '../../commonStateTypes/balanceTimeseries';
|
|
3
3
|
import { COABalance, COABalanceGrouped } from '../../commonStateTypes/coaBalance/coaBalance';
|
|
4
|
-
import { TimePeriod } from '../../commonStateTypes/timePeriod';
|
|
4
|
+
import { Month, TimePeriod } from '../../commonStateTypes/timePeriod';
|
|
5
5
|
import { CustomerBase } from '../customer/customerState';
|
|
6
6
|
import { InsightSummary } from '../insights/insightSummary';
|
|
7
|
+
import { VendorSpendTrendFilterTabType } from '../vendorExpense/vendorSpendTrendFilterTabType';
|
|
7
8
|
export interface CustomerIncomeTrendData {
|
|
8
9
|
customer: CustomerBase;
|
|
9
10
|
incomeTrend: COABalanceGrouped;
|
|
10
11
|
insights: InsightSummary[];
|
|
11
12
|
timePeriod: TimePeriod;
|
|
12
13
|
}
|
|
14
|
+
/** Customers tab trend pills: same periods as the Vendors spend pills. */
|
|
15
|
+
export interface CustomerIncomeTrendFilter {
|
|
16
|
+
filter: VendorSpendTrendFilterTabType;
|
|
17
|
+
last30DaysRevenue: number;
|
|
18
|
+
last90DaysRevenue: number;
|
|
19
|
+
firstMonthOfFY?: Month;
|
|
20
|
+
}
|
|
13
21
|
export declare class CustomerIncomeTrend implements TrendTimeseries {
|
|
14
22
|
#private;
|
|
15
23
|
get balancesKind(): BalanceKind;
|
|
@@ -24,5 +32,13 @@ export declare class CustomerIncomeTrend implements TrendTimeseries {
|
|
|
24
32
|
get customer(): CustomerBase;
|
|
25
33
|
get timePeriod(): TimePeriod;
|
|
26
34
|
get key(): string;
|
|
27
|
-
|
|
35
|
+
withFilter(filter: CustomerIncomeTrendFilter): CustomerIncomeTrend;
|
|
36
|
+
constructor({ customer, timePeriod, incomeTrend, insights }: CustomerIncomeTrendData, filter?: CustomerIncomeTrendFilter);
|
|
28
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Months covering the last `n` days, oldest month cut so the slices add up to the precomputed
|
|
40
|
+
* last-n-days total. Port of accounting `SpendTrendReport._prepare_last_n_days_time_slice`
|
|
41
|
+
* (Vendors gets these slices from the spend_trend API; income_trend has no equivalent).
|
|
42
|
+
* The cut slice is clamped at 0: the total (gl_entries, daily) and the months (live QBO) can disagree.
|
|
43
|
+
*/
|
|
44
|
+
export declare const getLastNDaysMonths: (months: COABalance[], lastNDaysAmount: number, n: number) => COABalance[];
|
|
@@ -10,9 +10,11 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
10
10
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
11
11
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
12
12
|
};
|
|
13
|
-
var _CustomerIncomeTrend_customer, _CustomerIncomeTrend_timePeriod, _CustomerIncomeTrend_incomeTrend, _CustomerIncomeTrend_insights;
|
|
13
|
+
var _CustomerIncomeTrend_customer, _CustomerIncomeTrend_filter, _CustomerIncomeTrend_timePeriod, _CustomerIncomeTrend_incomeTrend, _CustomerIncomeTrend_insights;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.CustomerIncomeTrend = void 0;
|
|
15
|
+
exports.getLastNDaysMonths = exports.CustomerIncomeTrend = void 0;
|
|
16
|
+
const zeniDayJS_1 = require("../../zeniDayJS");
|
|
17
|
+
const vendorExpenseTrend_1 = require("../vendorExpense/vendorExpenseTrend");
|
|
16
18
|
const customerIncomeTrendKey_1 = require("./customerIncomeTrendKey");
|
|
17
19
|
class CustomerIncomeTrend {
|
|
18
20
|
get balancesKind() {
|
|
@@ -22,7 +24,18 @@ class CustomerIncomeTrend {
|
|
|
22
24
|
return 'ascending_date';
|
|
23
25
|
}
|
|
24
26
|
get monthly() {
|
|
25
|
-
|
|
27
|
+
const months = __classPrivateFieldGet(this, _CustomerIncomeTrend_incomeTrend, "f").months ?? [];
|
|
28
|
+
if (__classPrivateFieldGet(this, _CustomerIncomeTrend_filter, "f") == null) {
|
|
29
|
+
return months;
|
|
30
|
+
}
|
|
31
|
+
const { filter, firstMonthOfFY, last30DaysRevenue, last90DaysRevenue } = __classPrivateFieldGet(this, _CustomerIncomeTrend_filter, "f");
|
|
32
|
+
if (filter === 'last_30_days') {
|
|
33
|
+
return (0, exports.getLastNDaysMonths)(months, last30DaysRevenue, 30);
|
|
34
|
+
}
|
|
35
|
+
if (filter === 'last_90_days') {
|
|
36
|
+
return (0, exports.getLastNDaysMonths)(months, last90DaysRevenue, 90);
|
|
37
|
+
}
|
|
38
|
+
return (0, vendorExpenseTrend_1.getFilteredExpenseTrend)({ ...__classPrivateFieldGet(this, _CustomerIncomeTrend_incomeTrend, "f"), last30DaysMonths: null, last90DaysMonths: null }, filter, firstMonthOfFY);
|
|
26
39
|
}
|
|
27
40
|
get quarterly() {
|
|
28
41
|
return __classPrivateFieldGet(this, _CustomerIncomeTrend_incomeTrend, "f").quarters ?? [];
|
|
@@ -51,8 +64,17 @@ class CustomerIncomeTrend {
|
|
|
51
64
|
get key() {
|
|
52
65
|
return (0, customerIncomeTrendKey_1.getCustomerIncomeTrendKey)(__classPrivateFieldGet(this, _CustomerIncomeTrend_customer, "f").id, __classPrivateFieldGet(this, _CustomerIncomeTrend_timePeriod, "f"));
|
|
53
66
|
}
|
|
54
|
-
|
|
67
|
+
withFilter(filter) {
|
|
68
|
+
return new CustomerIncomeTrend({
|
|
69
|
+
customer: __classPrivateFieldGet(this, _CustomerIncomeTrend_customer, "f"),
|
|
70
|
+
timePeriod: __classPrivateFieldGet(this, _CustomerIncomeTrend_timePeriod, "f"),
|
|
71
|
+
incomeTrend: __classPrivateFieldGet(this, _CustomerIncomeTrend_incomeTrend, "f"),
|
|
72
|
+
insights: __classPrivateFieldGet(this, _CustomerIncomeTrend_insights, "f"),
|
|
73
|
+
}, filter);
|
|
74
|
+
}
|
|
75
|
+
constructor({ customer, timePeriod, incomeTrend, insights }, filter) {
|
|
55
76
|
_CustomerIncomeTrend_customer.set(this, void 0);
|
|
77
|
+
_CustomerIncomeTrend_filter.set(this, void 0);
|
|
56
78
|
_CustomerIncomeTrend_timePeriod.set(this, void 0);
|
|
57
79
|
_CustomerIncomeTrend_incomeTrend.set(this, void 0);
|
|
58
80
|
_CustomerIncomeTrend_insights.set(this, void 0);
|
|
@@ -60,10 +82,48 @@ class CustomerIncomeTrend {
|
|
|
60
82
|
__classPrivateFieldSet(this, _CustomerIncomeTrend_timePeriod, timePeriod, "f");
|
|
61
83
|
__classPrivateFieldSet(this, _CustomerIncomeTrend_incomeTrend, incomeTrend, "f");
|
|
62
84
|
__classPrivateFieldSet(this, _CustomerIncomeTrend_insights, insights, "f");
|
|
85
|
+
__classPrivateFieldSet(this, _CustomerIncomeTrend_filter, filter, "f");
|
|
63
86
|
}
|
|
64
87
|
}
|
|
65
88
|
exports.CustomerIncomeTrend = CustomerIncomeTrend;
|
|
66
|
-
_CustomerIncomeTrend_customer = new WeakMap(), _CustomerIncomeTrend_timePeriod = new WeakMap(), _CustomerIncomeTrend_incomeTrend = new WeakMap(), _CustomerIncomeTrend_insights = new WeakMap();
|
|
89
|
+
_CustomerIncomeTrend_customer = new WeakMap(), _CustomerIncomeTrend_filter = new WeakMap(), _CustomerIncomeTrend_timePeriod = new WeakMap(), _CustomerIncomeTrend_incomeTrend = new WeakMap(), _CustomerIncomeTrend_insights = new WeakMap();
|
|
90
|
+
/**
|
|
91
|
+
* Months covering the last `n` days, oldest month cut so the slices add up to the precomputed
|
|
92
|
+
* last-n-days total. Port of accounting `SpendTrendReport._prepare_last_n_days_time_slice`
|
|
93
|
+
* (Vendors gets these slices from the spend_trend API; income_trend has no equivalent).
|
|
94
|
+
* The cut slice is clamped at 0: the total (gl_entries, daily) and the months (live QBO) can disagree.
|
|
95
|
+
*/
|
|
96
|
+
const getLastNDaysMonths = (months, lastNDaysAmount, n) => {
|
|
97
|
+
const findMonth = (start) => months.find((month) => month.startDate.isSame(start, 'day'));
|
|
98
|
+
const withAmount = (month, amount) => ({
|
|
99
|
+
...month,
|
|
100
|
+
balance: { ...month.balance, amount: Math.max(amount, 0) },
|
|
101
|
+
});
|
|
102
|
+
const now = (0, zeniDayJS_1.dateNow)();
|
|
103
|
+
let monthStart = now.startOf('month');
|
|
104
|
+
let daysCollected = now.date();
|
|
105
|
+
const currentMonth = findMonth(monthStart);
|
|
106
|
+
// The current month alone covers the n days (e.g. the 31st for last 30 days): it is the whole total.
|
|
107
|
+
if (daysCollected >= n) {
|
|
108
|
+
return currentMonth != null
|
|
109
|
+
? [withAmount(currentMonth, lastNDaysAmount)]
|
|
110
|
+
: [];
|
|
111
|
+
}
|
|
112
|
+
const slices = currentMonth != null ? [currentMonth] : [];
|
|
113
|
+
let total = currentMonth?.balance.amount ?? 0;
|
|
114
|
+
while (daysCollected < n) {
|
|
115
|
+
monthStart = monthStart.subtract(1, 'month');
|
|
116
|
+
daysCollected += monthStart.daysInMonth();
|
|
117
|
+
const month = findMonth(monthStart);
|
|
118
|
+
if (month != null) {
|
|
119
|
+
const slice = daysCollected > n ? withAmount(month, lastNDaysAmount - total) : month;
|
|
120
|
+
total += slice.balance.amount;
|
|
121
|
+
slices.unshift(slice);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return slices;
|
|
125
|
+
};
|
|
126
|
+
exports.getLastNDaysMonths = getLastNDaysMonths;
|
|
67
127
|
/**
|
|
68
128
|
* Returns an average amount for the list of COABalances
|
|
69
129
|
* @param coaBalances
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { ZeniUrl as Url } from '../../zeniUrl';
|
|
2
|
+
import { TrendChangeType } from './insightPayload';
|
|
2
3
|
export type InsightSummary = {
|
|
3
4
|
details: string[];
|
|
4
5
|
icon: Url;
|
|
5
6
|
summary: string;
|
|
7
|
+
changeType?: TrendChangeType;
|
|
8
|
+
percentChange?: string;
|
|
6
9
|
title?: string;
|
|
7
10
|
};
|
|
@@ -8,6 +8,8 @@ const mapInsightsPayloadtoInsightsState = (insightsPayload) => {
|
|
|
8
8
|
title: insight.title ?? '',
|
|
9
9
|
summary: insight.summary ?? '',
|
|
10
10
|
icon: (0, zeniUrl_1.toZeniUrl)(insight.icon?.url ?? ''),
|
|
11
|
+
changeType: insight.change_type,
|
|
12
|
+
percentChange: insight.percent_change,
|
|
11
13
|
}));
|
|
12
14
|
};
|
|
13
15
|
exports.mapInsightsPayloadtoInsightsState = mapInsightsPayloadtoInsightsState;
|
|
@@ -17,6 +17,9 @@ const mapLineItem = (payload, currencyCode, currencySymbol) => ({
|
|
|
17
17
|
: undefined,
|
|
18
18
|
entityDescription: payload.entity_description,
|
|
19
19
|
entityType: payload.entity_type,
|
|
20
|
+
grossAmount: payload.gross_amount != null
|
|
21
|
+
? (0, amount_1.toAmount)(payload.gross_amount, currencyCode, currencySymbol)
|
|
22
|
+
: undefined,
|
|
20
23
|
id: payload.id,
|
|
21
24
|
isTaxed: payload.is_taxed,
|
|
22
25
|
itemLevelDiscountAmount: payload.item_level_discount_amount != null
|
|
@@ -13,6 +13,8 @@ export interface InvoicingLineItem {
|
|
|
13
13
|
discountAmount?: Amount;
|
|
14
14
|
entityDescription?: string;
|
|
15
15
|
entityType?: string;
|
|
16
|
+
/** Price before item-level coupons (`amount` is after); absent on older invoices. */
|
|
17
|
+
grossAmount?: Amount;
|
|
16
18
|
id?: ID;
|
|
17
19
|
isTaxed?: boolean;
|
|
18
20
|
itemLevelDiscountAmount?: Amount;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { ID } from '../../commonStateTypes/common';
|
|
2
|
+
import { ZeniAPIResponse, ZeniAPIStatus } from '../../responsePayload';
|
|
3
|
+
import { JEScheduleApprovalAPIStatus, JEScheduleApprovalInfo, JEScheduleApprovalRuleFormData, JEScheduleApprovalRuleState, JEScheduleApprovalStepState, JEScheduleApprover, JEScheduleApproverRole } from './jeScheduleApprovalRuleState';
|
|
4
|
+
import { JEScheduleType } from './jeScheduleApprovalRuleTypes';
|
|
5
|
+
export interface JEScheduleApprovalUserActorPayload {
|
|
6
|
+
id: ID;
|
|
7
|
+
type: 'user';
|
|
8
|
+
}
|
|
9
|
+
export interface JEScheduleApprovalRoleActorPayload {
|
|
10
|
+
sub_type: string;
|
|
11
|
+
type: 'role';
|
|
12
|
+
}
|
|
13
|
+
export type JEScheduleApprovalActorPayload = JEScheduleApprovalUserActorPayload | JEScheduleApprovalRoleActorPayload;
|
|
14
|
+
export interface JEScheduleApprovalStepPayload {
|
|
15
|
+
action: string;
|
|
16
|
+
actors: JEScheduleApprovalActorPayload[];
|
|
17
|
+
}
|
|
18
|
+
export interface JEScheduleApprovalRulePayload {
|
|
19
|
+
create_time: string;
|
|
20
|
+
created_by_user_id: ID | null;
|
|
21
|
+
description: string | null;
|
|
22
|
+
id: ID;
|
|
23
|
+
is_separation_of_duty_enabled: boolean;
|
|
24
|
+
monthly_amount_min: number;
|
|
25
|
+
name: string;
|
|
26
|
+
owner: string;
|
|
27
|
+
priority: number;
|
|
28
|
+
schedule_types: string[];
|
|
29
|
+
step: JEScheduleApprovalStepPayload;
|
|
30
|
+
update_time: string;
|
|
31
|
+
updated_by_user_id: ID | null;
|
|
32
|
+
}
|
|
33
|
+
export interface JEScheduleApprovalRulesListPayload {
|
|
34
|
+
can_edit: boolean;
|
|
35
|
+
rules: JEScheduleApprovalRulePayload[];
|
|
36
|
+
rules_version: number;
|
|
37
|
+
viewer_owner: string;
|
|
38
|
+
}
|
|
39
|
+
export interface JEScheduleApprovalRuleSavePayload extends JEScheduleApprovalRulesListPayload {
|
|
40
|
+
rule: JEScheduleApprovalRulePayload;
|
|
41
|
+
}
|
|
42
|
+
/** Body for POST / PUT `/1.0/je-schedules/approval-rules[/<id>]`. */
|
|
43
|
+
export interface JEScheduleApprovalRuleRequestBody {
|
|
44
|
+
description: string | null;
|
|
45
|
+
is_applicable_on_pending_approval_entity: boolean;
|
|
46
|
+
is_separation_of_duty_enabled: boolean;
|
|
47
|
+
monthly_amount_min: number;
|
|
48
|
+
name: string;
|
|
49
|
+
schedule_types: JEScheduleType[];
|
|
50
|
+
step: JEScheduleApprovalStepPayload;
|
|
51
|
+
[key: string]: unknown;
|
|
52
|
+
}
|
|
53
|
+
export interface JEScheduleApproverPayload {
|
|
54
|
+
email: string;
|
|
55
|
+
first_name: string;
|
|
56
|
+
is_zeni: boolean;
|
|
57
|
+
je_level: number | null;
|
|
58
|
+
je_level_label: string | null;
|
|
59
|
+
last_name: string;
|
|
60
|
+
user_id: ID;
|
|
61
|
+
}
|
|
62
|
+
export interface JEScheduleApproverRolePayload {
|
|
63
|
+
label: string;
|
|
64
|
+
level: number;
|
|
65
|
+
sub_type: string;
|
|
66
|
+
}
|
|
67
|
+
export interface JEScheduleApproversPayload {
|
|
68
|
+
roles: JEScheduleApproverRolePayload[];
|
|
69
|
+
users: JEScheduleApproverPayload[];
|
|
70
|
+
viewer_owner: string;
|
|
71
|
+
}
|
|
72
|
+
export interface JEScheduleApprovalInfoPayload {
|
|
73
|
+
approver_labels: string[];
|
|
74
|
+
approver_roles: string[];
|
|
75
|
+
approver_user_ids: ID[];
|
|
76
|
+
can_approve: boolean;
|
|
77
|
+
matched_rule_ids: ID[];
|
|
78
|
+
matched_rule_name: string | null;
|
|
79
|
+
matched_rule_owner: string | null;
|
|
80
|
+
message: string;
|
|
81
|
+
monthly_amount: number | null;
|
|
82
|
+
preparer_user_id: ID | null;
|
|
83
|
+
requires_approval: boolean;
|
|
84
|
+
rule_min: number | null;
|
|
85
|
+
separation_of_duties: boolean;
|
|
86
|
+
unevaluable_reason: string | null;
|
|
87
|
+
}
|
|
88
|
+
export type JEScheduleApprovalRulesListResponse = ZeniAPIResponse<JEScheduleApprovalRulesListPayload>;
|
|
89
|
+
export type JEScheduleApprovalRuleSaveResponse = ZeniAPIResponse<JEScheduleApprovalRuleSavePayload>;
|
|
90
|
+
export type JEScheduleApproversResponse = ZeniAPIResponse<JEScheduleApproversPayload>;
|
|
91
|
+
export declare const toJEScheduleApprovalStepState: (payload: JEScheduleApprovalStepPayload) => JEScheduleApprovalStepState;
|
|
92
|
+
export declare const toJEScheduleTypes: (scheduleTypes: string[]) => JEScheduleType[];
|
|
93
|
+
export declare const toJEScheduleApprovalRuleState: (payload: JEScheduleApprovalRulePayload) => JEScheduleApprovalRuleState;
|
|
94
|
+
/** Reverse mapper for create / update. The contract carries exactly one step. */
|
|
95
|
+
export declare const toJEScheduleApprovalRulePayload: (formData: JEScheduleApprovalRuleFormData) => JEScheduleApprovalRuleRequestBody;
|
|
96
|
+
export declare const toJEScheduleApprover: (payload: JEScheduleApproverPayload) => JEScheduleApprover;
|
|
97
|
+
export declare const toJEScheduleApproverRole: (payload: JEScheduleApproverRolePayload) => JEScheduleApproverRole;
|
|
98
|
+
export declare const toJEScheduleApprovalInfo: (payload: JEScheduleApprovalInfoPayload | null | undefined) => JEScheduleApprovalInfo | undefined;
|
|
99
|
+
/** Wraps an API status with a typed `kind` and a user-facing message for 403 / 409. */
|
|
100
|
+
export declare const toJEScheduleApprovalAPIStatus: (status: ZeniAPIStatus) => JEScheduleApprovalAPIStatus;
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toJEScheduleApprovalAPIStatus = exports.toJEScheduleApprovalInfo = exports.toJEScheduleApproverRole = exports.toJEScheduleApprover = exports.toJEScheduleApprovalRulePayload = exports.toJEScheduleApprovalRuleState = exports.toJEScheduleTypes = exports.toJEScheduleApprovalStepState = void 0;
|
|
4
|
+
const zeniDayJS_1 = require("../../zeniDayJS");
|
|
5
|
+
const jeScheduleApprovalRuleTypes_1 = require("./jeScheduleApprovalRuleTypes");
|
|
6
|
+
const isUserActor = (actor) => actor.type === 'user';
|
|
7
|
+
const toJEScheduleApprovalStepState = (payload) => {
|
|
8
|
+
const nonUserActors = [];
|
|
9
|
+
payload.actors.forEach((actor) => {
|
|
10
|
+
if (isUserActor(actor)) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const subType = (0, jeScheduleApprovalRuleTypes_1.toJEApprovalRoleSubTypeStrict)(actor.sub_type);
|
|
14
|
+
if (subType == null) {
|
|
15
|
+
console.warn(`[jeScheduleApprovalRule] dropping unknown role actor "${actor.sub_type}"`);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
nonUserActors.push({ subType });
|
|
19
|
+
});
|
|
20
|
+
return {
|
|
21
|
+
action: (0, jeScheduleApprovalRuleTypes_1.toJEApprovalStepAction)(payload.action),
|
|
22
|
+
actorUserIds: payload.actors.filter(isUserActor).map((actor) => actor.id),
|
|
23
|
+
nonUserActors,
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
exports.toJEScheduleApprovalStepState = toJEScheduleApprovalStepState;
|
|
27
|
+
const toJEScheduleTypes = (scheduleTypes) => {
|
|
28
|
+
const result = [];
|
|
29
|
+
scheduleTypes.forEach((scheduleType) => {
|
|
30
|
+
const known = (0, jeScheduleApprovalRuleTypes_1.toJEScheduleTypeStrict)(scheduleType);
|
|
31
|
+
if (known == null) {
|
|
32
|
+
console.warn(`[jeScheduleApprovalRule] dropping unknown schedule type "${scheduleType}"`);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
result.push(known);
|
|
36
|
+
});
|
|
37
|
+
return result;
|
|
38
|
+
};
|
|
39
|
+
exports.toJEScheduleTypes = toJEScheduleTypes;
|
|
40
|
+
const toJEScheduleApprovalRuleState = (payload) => ({
|
|
41
|
+
approvalRuleId: payload.id,
|
|
42
|
+
owner: (0, jeScheduleApprovalRuleTypes_1.toJEApprovalOwner)(payload.owner),
|
|
43
|
+
priority: payload.priority,
|
|
44
|
+
name: payload.name,
|
|
45
|
+
description: payload.description ?? undefined,
|
|
46
|
+
separationOfDuties: payload.is_separation_of_duty_enabled,
|
|
47
|
+
criteria: {
|
|
48
|
+
scheduleTypes: (0, exports.toJEScheduleTypes)(payload.schedule_types),
|
|
49
|
+
monthlyAmountMin: payload.monthly_amount_min,
|
|
50
|
+
},
|
|
51
|
+
steps: [(0, exports.toJEScheduleApprovalStepState)(payload.step)],
|
|
52
|
+
createdByUserId: payload.created_by_user_id ?? undefined,
|
|
53
|
+
updatedByUserId: payload.updated_by_user_id ?? undefined,
|
|
54
|
+
createTime: (0, zeniDayJS_1.date)(payload.create_time),
|
|
55
|
+
updateTime: (0, zeniDayJS_1.date)(payload.update_time),
|
|
56
|
+
});
|
|
57
|
+
exports.toJEScheduleApprovalRuleState = toJEScheduleApprovalRuleState;
|
|
58
|
+
const toJEScheduleApprovalStepPayload = (step) => ({
|
|
59
|
+
action: step.action,
|
|
60
|
+
actors: [
|
|
61
|
+
...step.actorUserIds.map((userId) => ({
|
|
62
|
+
type: 'user',
|
|
63
|
+
id: userId,
|
|
64
|
+
})),
|
|
65
|
+
...step.nonUserActors.map((actor) => ({
|
|
66
|
+
type: 'role',
|
|
67
|
+
sub_type: actor.subType,
|
|
68
|
+
})),
|
|
69
|
+
],
|
|
70
|
+
});
|
|
71
|
+
/** Reverse mapper for create / update. The contract carries exactly one step. */
|
|
72
|
+
const toJEScheduleApprovalRulePayload = (formData) => ({
|
|
73
|
+
name: formData.name,
|
|
74
|
+
description: formData.description ?? null,
|
|
75
|
+
is_separation_of_duty_enabled: formData.separationOfDuties,
|
|
76
|
+
schedule_types: formData.criteria.scheduleTypes,
|
|
77
|
+
monthly_amount_min: formData.criteria.monthlyAmountMin,
|
|
78
|
+
step: toJEScheduleApprovalStepPayload(formData.steps[0] ?? {
|
|
79
|
+
action: 'require_approval',
|
|
80
|
+
actorUserIds: [],
|
|
81
|
+
nonUserActors: [],
|
|
82
|
+
}),
|
|
83
|
+
is_applicable_on_pending_approval_entity: formData.isApplicableOnPendingApprovalEntity,
|
|
84
|
+
});
|
|
85
|
+
exports.toJEScheduleApprovalRulePayload = toJEScheduleApprovalRulePayload;
|
|
86
|
+
const toJEScheduleApprover = (payload) => ({
|
|
87
|
+
userId: payload.user_id,
|
|
88
|
+
email: payload.email,
|
|
89
|
+
firstName: payload.first_name,
|
|
90
|
+
lastName: payload.last_name,
|
|
91
|
+
isZeni: payload.is_zeni,
|
|
92
|
+
jeLevel: payload.je_level ?? undefined,
|
|
93
|
+
jeLevelLabel: payload.je_level_label ?? undefined,
|
|
94
|
+
});
|
|
95
|
+
exports.toJEScheduleApprover = toJEScheduleApprover;
|
|
96
|
+
const toJEScheduleApproverRole = (payload) => ({
|
|
97
|
+
subType: (0, jeScheduleApprovalRuleTypes_1.toJEApprovalRoleSubType)(payload.sub_type),
|
|
98
|
+
level: payload.level,
|
|
99
|
+
label: payload.label,
|
|
100
|
+
});
|
|
101
|
+
exports.toJEScheduleApproverRole = toJEScheduleApproverRole;
|
|
102
|
+
const toJEScheduleApprovalInfo = (payload) => {
|
|
103
|
+
if (payload == null) {
|
|
104
|
+
return undefined;
|
|
105
|
+
}
|
|
106
|
+
return {
|
|
107
|
+
requiresApproval: payload.requires_approval,
|
|
108
|
+
canApprove: payload.can_approve,
|
|
109
|
+
approverLabels: payload.approver_labels,
|
|
110
|
+
approverRoles: payload.approver_roles,
|
|
111
|
+
approverUserIds: payload.approver_user_ids,
|
|
112
|
+
matchedRuleIds: payload.matched_rule_ids,
|
|
113
|
+
matchedRuleName: payload.matched_rule_name ?? undefined,
|
|
114
|
+
matchedRuleOwner: payload.matched_rule_owner != null
|
|
115
|
+
? (0, jeScheduleApprovalRuleTypes_1.toJEApprovalOwner)(payload.matched_rule_owner)
|
|
116
|
+
: undefined,
|
|
117
|
+
monthlyAmount: payload.monthly_amount ?? undefined,
|
|
118
|
+
ruleMin: payload.rule_min ?? undefined,
|
|
119
|
+
separationOfDuties: payload.separation_of_duties,
|
|
120
|
+
preparerUserId: payload.preparer_user_id ?? undefined,
|
|
121
|
+
unevaluableReason: payload.unevaluable_reason ?? undefined,
|
|
122
|
+
message: payload.message,
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
exports.toJEScheduleApprovalInfo = toJEScheduleApprovalInfo;
|
|
126
|
+
const toJEApprovalErrorKind = (code) => {
|
|
127
|
+
switch (code) {
|
|
128
|
+
case 403:
|
|
129
|
+
return 'forbidden';
|
|
130
|
+
case 409:
|
|
131
|
+
return 'conflict';
|
|
132
|
+
case 400:
|
|
133
|
+
return 'validation';
|
|
134
|
+
case 404:
|
|
135
|
+
return 'not_found';
|
|
136
|
+
default:
|
|
137
|
+
return 'unknown';
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
const USER_FACING_MESSAGES = {
|
|
141
|
+
forbidden: 'You are not allowed to perform this action.',
|
|
142
|
+
conflict: 'This schedule was already approved by someone else.',
|
|
143
|
+
validation: undefined, // backend's status.message is already user-facing
|
|
144
|
+
not_found: 'JE schedule approval rules are not available for this account.',
|
|
145
|
+
unknown: undefined,
|
|
146
|
+
};
|
|
147
|
+
/** Wraps an API status with a typed `kind` and a user-facing message for 403 / 409. */
|
|
148
|
+
const toJEScheduleApprovalAPIStatus = (status) => {
|
|
149
|
+
const kind = toJEApprovalErrorKind(status.code);
|
|
150
|
+
return {
|
|
151
|
+
...status,
|
|
152
|
+
kind,
|
|
153
|
+
message: USER_FACING_MESSAGES[kind] ?? status.message,
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
exports.toJEScheduleApprovalAPIStatus = toJEScheduleApprovalAPIStatus;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { ID } from '../../commonStateTypes/common';
|
|
2
|
+
import { ZeniAPIStatus } from '../../responsePayload';
|
|
3
|
+
import { ZeniDate } from '../../zeniDayJS';
|
|
4
|
+
import { JEApprovalErrorKind, JEApprovalOwner, JEApprovalRoleSubType, JEApprovalStepAction, JEScheduleType } from './jeScheduleApprovalRuleTypes';
|
|
5
|
+
/** A user eligible to approve JE schedules, as `/je-schedules/approvers` reports them. */
|
|
6
|
+
export interface JEScheduleApprover {
|
|
7
|
+
email: string;
|
|
8
|
+
firstName: string;
|
|
9
|
+
isZeni: boolean;
|
|
10
|
+
lastName: string;
|
|
11
|
+
userId: ID;
|
|
12
|
+
jeLevel?: number;
|
|
13
|
+
jeLevelLabel?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface JEScheduleApproverRole {
|
|
16
|
+
label: string;
|
|
17
|
+
level: number;
|
|
18
|
+
subType: JEApprovalRoleSubType;
|
|
19
|
+
}
|
|
20
|
+
export interface JEScheduleApprovalNonUserActor {
|
|
21
|
+
subType: JEApprovalRoleSubType;
|
|
22
|
+
}
|
|
23
|
+
export interface JEScheduleApprovalCriteria {
|
|
24
|
+
monthlyAmountMin: number;
|
|
25
|
+
scheduleTypes: JEScheduleType[];
|
|
26
|
+
}
|
|
27
|
+
/** Stored shape: actors are user ids; the view selector joins them against the approvers list. */
|
|
28
|
+
export interface JEScheduleApprovalStepState {
|
|
29
|
+
action: JEApprovalStepAction;
|
|
30
|
+
actorUserIds: ID[];
|
|
31
|
+
nonUserActors: JEScheduleApprovalNonUserActor[];
|
|
32
|
+
}
|
|
33
|
+
export interface JEScheduleApprovalRuleBase {
|
|
34
|
+
approvalRuleId: ID;
|
|
35
|
+
createTime: ZeniDate;
|
|
36
|
+
criteria: JEScheduleApprovalCriteria;
|
|
37
|
+
name: string;
|
|
38
|
+
owner: JEApprovalOwner;
|
|
39
|
+
priority: number;
|
|
40
|
+
separationOfDuties: boolean;
|
|
41
|
+
updateTime: ZeniDate;
|
|
42
|
+
createdByUserId?: ID;
|
|
43
|
+
description?: string;
|
|
44
|
+
updatedByUserId?: ID;
|
|
45
|
+
}
|
|
46
|
+
export interface JEScheduleApprovalRuleState extends JEScheduleApprovalRuleBase {
|
|
47
|
+
steps: JEScheduleApprovalStepState[];
|
|
48
|
+
}
|
|
49
|
+
/** Selector shape: actors resolved to approver records. */
|
|
50
|
+
export interface JEScheduleApprovalStep {
|
|
51
|
+
action: JEApprovalStepAction;
|
|
52
|
+
actors: JEScheduleApprover[];
|
|
53
|
+
nonUserActors: JEScheduleApprovalNonUserActor[];
|
|
54
|
+
}
|
|
55
|
+
export interface JEScheduleApprovalRule extends JEScheduleApprovalRuleBase {
|
|
56
|
+
steps: JEScheduleApprovalStep[];
|
|
57
|
+
}
|
|
58
|
+
/** Form-side shape for create / update; mapped to the wire by `toJEScheduleApprovalRulePayload`. */
|
|
59
|
+
export interface JEScheduleApprovalRuleFormData {
|
|
60
|
+
criteria: JEScheduleApprovalCriteria;
|
|
61
|
+
isApplicableOnPendingApprovalEntity: boolean;
|
|
62
|
+
name: string;
|
|
63
|
+
separationOfDuties: boolean;
|
|
64
|
+
steps: JEScheduleApprovalStepState[];
|
|
65
|
+
approvalRuleId?: ID;
|
|
66
|
+
description?: string;
|
|
67
|
+
}
|
|
68
|
+
/** Per-schedule approval evaluation carried on JE schedule rows (`approval_info`). */
|
|
69
|
+
export interface JEScheduleApprovalInfo {
|
|
70
|
+
approverLabels: string[];
|
|
71
|
+
approverRoles: string[];
|
|
72
|
+
approverUserIds: ID[];
|
|
73
|
+
canApprove: boolean;
|
|
74
|
+
matchedRuleIds: ID[];
|
|
75
|
+
message: string;
|
|
76
|
+
requiresApproval: boolean;
|
|
77
|
+
separationOfDuties: boolean;
|
|
78
|
+
matchedRuleName?: string;
|
|
79
|
+
matchedRuleOwner?: JEApprovalOwner;
|
|
80
|
+
monthlyAmount?: number;
|
|
81
|
+
preparerUserId?: ID;
|
|
82
|
+
ruleMin?: number;
|
|
83
|
+
unevaluableReason?: string;
|
|
84
|
+
}
|
|
85
|
+
export interface JEScheduleApprovalAPIStatus extends ZeniAPIStatus {
|
|
86
|
+
kind: JEApprovalErrorKind;
|
|
87
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export declare const JE_SCHEDULE_TYPES: readonly ["prepaid_expenses", "fixed_assets", "accrued_expenses"];
|
|
2
|
+
export declare const toJEScheduleType: (v: string) => "prepaid_expenses" | "fixed_assets" | "accrued_expenses";
|
|
3
|
+
export declare const toJEScheduleTypeStrict: (v: string) => "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | undefined;
|
|
4
|
+
export type JEScheduleType = ReturnType<typeof toJEScheduleType>;
|
|
5
|
+
export declare const JE_APPROVAL_OWNERS: readonly ["zeni", "customer"];
|
|
6
|
+
export declare const toJEApprovalOwner: (v: string) => "customer" | "zeni";
|
|
7
|
+
export declare const toJEApprovalOwnerStrict: (v: string) => "customer" | "zeni" | undefined;
|
|
8
|
+
export type JEApprovalOwner = ReturnType<typeof toJEApprovalOwner>;
|
|
9
|
+
export declare const JE_APPROVAL_STEP_ACTIONS: readonly ["require_approval", "send_notification"];
|
|
10
|
+
export declare const toJEApprovalStepAction: (v: string) => "require_approval" | "send_notification";
|
|
11
|
+
export type JEApprovalStepAction = ReturnType<typeof toJEApprovalStepAction>;
|
|
12
|
+
export declare const JE_APPROVAL_ROLE_SUB_TYPES: readonly ["reviewer", "controller"];
|
|
13
|
+
export declare const toJEApprovalRoleSubType: (v: string) => "reviewer" | "controller";
|
|
14
|
+
export declare const toJEApprovalRoleSubTypeStrict: (v: string) => "reviewer" | "controller" | undefined;
|
|
15
|
+
export type JEApprovalRoleSubType = ReturnType<typeof toJEApprovalRoleSubType>;
|
|
16
|
+
export declare const JE_APPROVAL_ACTIONS: readonly ["approve", "reject", "save_draft"];
|
|
17
|
+
export type JEApprovalAction = (typeof JE_APPROVAL_ACTIONS)[number];
|
|
18
|
+
export declare const JE_LEVEL_PREPARER = 1;
|
|
19
|
+
export declare const JE_LEVEL_REVIEWER = 2;
|
|
20
|
+
export declare const JE_LEVEL_CONTROLLER = 3;
|
|
21
|
+
export declare const JE_LEVEL_LABELS: Record<number, string>;
|
|
22
|
+
export declare const JE_SCHEDULE_TYPE_LABELS: Record<JEScheduleType, string>;
|
|
23
|
+
/**
|
|
24
|
+
* Typed failure kinds for the approval-rule / approval-action endpoints.
|
|
25
|
+
* 403 = viewer may not edit (or touched the other owner's rule / is not an
|
|
26
|
+
* eligible approver / SoD); 409 = someone else already approved.
|
|
27
|
+
*/
|
|
28
|
+
export declare const JE_APPROVAL_ERROR_KINDS: readonly ["forbidden", "conflict", "validation", "not_found", "unknown"];
|
|
29
|
+
export type JEApprovalErrorKind = (typeof JE_APPROVAL_ERROR_KINDS)[number];
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JE_APPROVAL_ERROR_KINDS = exports.JE_SCHEDULE_TYPE_LABELS = exports.JE_LEVEL_LABELS = exports.JE_LEVEL_CONTROLLER = exports.JE_LEVEL_REVIEWER = exports.JE_LEVEL_PREPARER = exports.JE_APPROVAL_ACTIONS = exports.toJEApprovalRoleSubTypeStrict = exports.toJEApprovalRoleSubType = exports.JE_APPROVAL_ROLE_SUB_TYPES = exports.toJEApprovalStepAction = exports.JE_APPROVAL_STEP_ACTIONS = exports.toJEApprovalOwnerStrict = exports.toJEApprovalOwner = exports.JE_APPROVAL_OWNERS = exports.toJEScheduleTypeStrict = exports.toJEScheduleType = exports.JE_SCHEDULE_TYPES = void 0;
|
|
4
|
+
const stringToUnion_1 = require("../../commonStateTypes/stringToUnion");
|
|
5
|
+
exports.JE_SCHEDULE_TYPES = [
|
|
6
|
+
'prepaid_expenses',
|
|
7
|
+
'fixed_assets',
|
|
8
|
+
'accrued_expenses',
|
|
9
|
+
];
|
|
10
|
+
const toJEScheduleType = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.JE_SCHEDULE_TYPES);
|
|
11
|
+
exports.toJEScheduleType = toJEScheduleType;
|
|
12
|
+
const toJEScheduleTypeStrict = (v) => (0, stringToUnion_1.stringToUnionStrict)(v, exports.JE_SCHEDULE_TYPES);
|
|
13
|
+
exports.toJEScheduleTypeStrict = toJEScheduleTypeStrict;
|
|
14
|
+
exports.JE_APPROVAL_OWNERS = ['zeni', 'customer'];
|
|
15
|
+
const toJEApprovalOwner = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.JE_APPROVAL_OWNERS);
|
|
16
|
+
exports.toJEApprovalOwner = toJEApprovalOwner;
|
|
17
|
+
const toJEApprovalOwnerStrict = (v) => (0, stringToUnion_1.stringToUnionStrict)(v, exports.JE_APPROVAL_OWNERS);
|
|
18
|
+
exports.toJEApprovalOwnerStrict = toJEApprovalOwnerStrict;
|
|
19
|
+
exports.JE_APPROVAL_STEP_ACTIONS = [
|
|
20
|
+
'require_approval',
|
|
21
|
+
'send_notification',
|
|
22
|
+
];
|
|
23
|
+
const toJEApprovalStepAction = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.JE_APPROVAL_STEP_ACTIONS);
|
|
24
|
+
exports.toJEApprovalStepAction = toJEApprovalStepAction;
|
|
25
|
+
exports.JE_APPROVAL_ROLE_SUB_TYPES = ['reviewer', 'controller'];
|
|
26
|
+
const toJEApprovalRoleSubType = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.JE_APPROVAL_ROLE_SUB_TYPES);
|
|
27
|
+
exports.toJEApprovalRoleSubType = toJEApprovalRoleSubType;
|
|
28
|
+
const toJEApprovalRoleSubTypeStrict = (v) => (0, stringToUnion_1.stringToUnionStrict)(v, exports.JE_APPROVAL_ROLE_SUB_TYPES);
|
|
29
|
+
exports.toJEApprovalRoleSubTypeStrict = toJEApprovalRoleSubTypeStrict;
|
|
30
|
+
exports.JE_APPROVAL_ACTIONS = ['approve', 'reject', 'save_draft'];
|
|
31
|
+
exports.JE_LEVEL_PREPARER = 1;
|
|
32
|
+
exports.JE_LEVEL_REVIEWER = 2;
|
|
33
|
+
exports.JE_LEVEL_CONTROLLER = 3;
|
|
34
|
+
exports.JE_LEVEL_LABELS = {
|
|
35
|
+
[exports.JE_LEVEL_PREPARER]: 'Preparer',
|
|
36
|
+
[exports.JE_LEVEL_REVIEWER]: 'Reviewer',
|
|
37
|
+
[exports.JE_LEVEL_CONTROLLER]: 'Controller',
|
|
38
|
+
};
|
|
39
|
+
exports.JE_SCHEDULE_TYPE_LABELS = {
|
|
40
|
+
prepaid_expenses: 'Prepaid Expenses',
|
|
41
|
+
fixed_assets: 'Fixed Assets',
|
|
42
|
+
accrued_expenses: 'Accrued Expenses',
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Typed failure kinds for the approval-rule / approval-action endpoints.
|
|
46
|
+
* 403 = viewer may not edit (or touched the other owner's rule / is not an
|
|
47
|
+
* eligible approver / SoD); 409 = someone else already approved.
|
|
48
|
+
*/
|
|
49
|
+
exports.JE_APPROVAL_ERROR_KINDS = [
|
|
50
|
+
'forbidden',
|
|
51
|
+
'conflict',
|
|
52
|
+
'validation',
|
|
53
|
+
'not_found',
|
|
54
|
+
'unknown',
|
|
55
|
+
];
|
|
@@ -2,6 +2,7 @@ import { StatusCodeWithLabelPayload } from '../../commonPayloadTypes/statusPaylo
|
|
|
2
2
|
import { ID } from '../../commonStateTypes/common';
|
|
3
3
|
import { AccountPayload } from '../account/accountPayload';
|
|
4
4
|
import { ClassBasePayload } from '../class/classPayload';
|
|
5
|
+
import { JEScheduleApprovalInfoPayload } from '../jeScheduleApprovalRule/jeScheduleApprovalRulePayload';
|
|
5
6
|
import { ScheduleTransactionPayload } from '../transaction/payloadTypes/scheduleTransactionPayload';
|
|
6
7
|
import { TransactionIDPayload } from '../transaction/payloadTypes/transactionIDPayload';
|
|
7
8
|
import { TransactionCategory } from '../transaction/stateTypes/transactionType';
|
|
@@ -83,6 +84,7 @@ export interface JEScheduledTransactionPayload {
|
|
|
83
84
|
updated_by: UserPayload;
|
|
84
85
|
vendor: VendorPayload;
|
|
85
86
|
ai_summaries?: JEScheduleAISummariesPayload;
|
|
87
|
+
approval_info?: JEScheduleApprovalInfoPayload | null;
|
|
86
88
|
confidence_score?: number | null;
|
|
87
89
|
create_time?: string | null;
|
|
88
90
|
created_by?: UserPayload;
|
|
@@ -166,6 +168,7 @@ export interface JEOneTimeAccrualPayload {
|
|
|
166
168
|
actual_post_date?: string | null;
|
|
167
169
|
actual_reversal_post_date?: string | null;
|
|
168
170
|
ai_suggestion?: JEOneTimeAccrualAiSuggestionPayload | null;
|
|
171
|
+
approval_info?: JEScheduleApprovalInfoPayload | null;
|
|
169
172
|
automation_tier?: string | null;
|
|
170
173
|
cleared?: JEOneTimeAccrualClearedPayload | null;
|
|
171
174
|
created_by_user?: UserPayload | null;
|