@zeniai/client-epic-state 5.1.62-betaRD1 → 5.1.62-betaRD2
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.
|
@@ -14,6 +14,19 @@ import { getAccountLabelForScheduleType, getAccountsTypesForScheduleList, } from
|
|
|
14
14
|
import { getAllSteps } from '../selectorTypes/expenseAutomationViewSelectorTypes';
|
|
15
15
|
import { getJEAccountSettingsView } from './jeAccountSettingsViewSelector';
|
|
16
16
|
import { getNewScheduleView } from './jeNewScheduleViewSelector';
|
|
17
|
+
// Matches the AI-automation user addresses webc's schedule list row already
|
|
18
|
+
// checks (JEScheduleReadOnlyListRow/JEScheduleDraftListRow "Method" column,
|
|
19
|
+
// strings.ts aiBotEmail/botEmail) to determine whether a schedule was
|
|
20
|
+
// created by the AI accountant vs. a human.
|
|
21
|
+
const AI_BOT_EMAIL = 'ai@zeni.ai';
|
|
22
|
+
const BOT_EMAIL = 'bot@zeni.ai';
|
|
23
|
+
// Exported (rather than kept as a closure inside the selector) so it can be
|
|
24
|
+
// unit-tested directly — confidenceScore is a separate, more narrowly
|
|
25
|
+
// populated field that can be null on a schedule the bot user created,
|
|
26
|
+
// which previously caused these schedules to display as "AI Accountant" in
|
|
27
|
+
// the list but count under "Manual" in the KPI summary.
|
|
28
|
+
export const isAiAccountantSchedule = (schedule) => schedule.createdByUser?.email === AI_BOT_EMAIL ||
|
|
29
|
+
schedule.createdByUser?.email === BOT_EMAIL;
|
|
17
30
|
function getJEScheduleSortAccessor(sortKey) {
|
|
18
31
|
switch (sortKey) {
|
|
19
32
|
case 'vendor':
|
|
@@ -147,7 +160,8 @@ export function getExpenseAutomationJESchedulesView(state) {
|
|
|
147
160
|
const sumAmount = (schedules) => schedules.reduce((total, schedule) => total + (schedule.baseTransaction.amount.amount ?? 0), 0);
|
|
148
161
|
const pendingReviewTotal = sumAmount(pendingReviewSchedules);
|
|
149
162
|
const createdTotal = sumAmount(createdSchedules);
|
|
150
|
-
const aiAccountantSchedules = allSchedules.filter(
|
|
163
|
+
const aiAccountantSchedules = allSchedules.filter(isAiAccountantSchedule);
|
|
164
|
+
const manualSchedules = allSchedules.filter((schedule) => !isAiAccountantSchedule(schedule));
|
|
151
165
|
const pendingUnfiltered = allSchedules.filter((schedule) => schedule.status.code === 'draft');
|
|
152
166
|
const kpiSummary = {
|
|
153
167
|
aiAccountant: {
|
|
@@ -155,9 +169,8 @@ export function getExpenseAutomationJESchedulesView(state) {
|
|
|
155
169
|
amount: sumAmount(aiAccountantSchedules),
|
|
156
170
|
},
|
|
157
171
|
manual: {
|
|
158
|
-
count:
|
|
159
|
-
|
|
160
|
-
amount: sumAmount(allSchedules.filter((schedule) => schedule.confidenceScore == null)),
|
|
172
|
+
count: manualSchedules.length,
|
|
173
|
+
amount: sumAmount(manualSchedules),
|
|
161
174
|
},
|
|
162
175
|
needsReview: {
|
|
163
176
|
count: pendingUnfiltered.length,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { JEScheduledTransaction, ScheduledJournalEntry } from '../../../entity/jeSchedules/jeSchedulesSelector';
|
|
2
2
|
import { RootState } from '../../../reducer';
|
|
3
3
|
import { ExpenseAutomationJESchedulesViewSelector } from '../selectorTypes/jeSchedulesSelectorTypes';
|
|
4
|
+
export declare const isAiAccountantSchedule: (schedule: JEScheduledTransaction | JEScheduledTransactionWithFailedEntries) => boolean;
|
|
4
5
|
export declare function getExpenseAutomationJESchedulesView(state: RootState): ExpenseAutomationJESchedulesViewSelector;
|
|
5
6
|
export interface JEScheduledTransactionWithFailedEntries extends Omit<JEScheduledTransaction, 'scheduledJournalEntry'> {
|
|
6
7
|
scheduledJournalEntry: ScheduledJournalEntry;
|
|
@@ -3,6 +3,7 @@ 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.isAiAccountantSchedule = void 0;
|
|
6
7
|
exports.getExpenseAutomationJESchedulesView = getExpenseAutomationJESchedulesView;
|
|
7
8
|
const omit_1 = __importDefault(require("lodash/omit"));
|
|
8
9
|
const orderBy_1 = __importDefault(require("lodash/orderBy"));
|
|
@@ -20,6 +21,20 @@ const scheduleListHelper_1 = require("../../scheduleView/scheduleListView/schedu
|
|
|
20
21
|
const expenseAutomationViewSelectorTypes_1 = require("../selectorTypes/expenseAutomationViewSelectorTypes");
|
|
21
22
|
const jeAccountSettingsViewSelector_1 = require("./jeAccountSettingsViewSelector");
|
|
22
23
|
const jeNewScheduleViewSelector_1 = require("./jeNewScheduleViewSelector");
|
|
24
|
+
// Matches the AI-automation user addresses webc's schedule list row already
|
|
25
|
+
// checks (JEScheduleReadOnlyListRow/JEScheduleDraftListRow "Method" column,
|
|
26
|
+
// strings.ts aiBotEmail/botEmail) to determine whether a schedule was
|
|
27
|
+
// created by the AI accountant vs. a human.
|
|
28
|
+
const AI_BOT_EMAIL = 'ai@zeni.ai';
|
|
29
|
+
const BOT_EMAIL = 'bot@zeni.ai';
|
|
30
|
+
// Exported (rather than kept as a closure inside the selector) so it can be
|
|
31
|
+
// unit-tested directly — confidenceScore is a separate, more narrowly
|
|
32
|
+
// populated field that can be null on a schedule the bot user created,
|
|
33
|
+
// which previously caused these schedules to display as "AI Accountant" in
|
|
34
|
+
// the list but count under "Manual" in the KPI summary.
|
|
35
|
+
const isAiAccountantSchedule = (schedule) => schedule.createdByUser?.email === AI_BOT_EMAIL ||
|
|
36
|
+
schedule.createdByUser?.email === BOT_EMAIL;
|
|
37
|
+
exports.isAiAccountantSchedule = isAiAccountantSchedule;
|
|
23
38
|
function getJEScheduleSortAccessor(sortKey) {
|
|
24
39
|
switch (sortKey) {
|
|
25
40
|
case 'vendor':
|
|
@@ -153,7 +168,8 @@ function getExpenseAutomationJESchedulesView(state) {
|
|
|
153
168
|
const sumAmount = (schedules) => schedules.reduce((total, schedule) => total + (schedule.baseTransaction.amount.amount ?? 0), 0);
|
|
154
169
|
const pendingReviewTotal = sumAmount(pendingReviewSchedules);
|
|
155
170
|
const createdTotal = sumAmount(createdSchedules);
|
|
156
|
-
const aiAccountantSchedules = allSchedules.filter(
|
|
171
|
+
const aiAccountantSchedules = allSchedules.filter(exports.isAiAccountantSchedule);
|
|
172
|
+
const manualSchedules = allSchedules.filter((schedule) => !(0, exports.isAiAccountantSchedule)(schedule));
|
|
157
173
|
const pendingUnfiltered = allSchedules.filter((schedule) => schedule.status.code === 'draft');
|
|
158
174
|
const kpiSummary = {
|
|
159
175
|
aiAccountant: {
|
|
@@ -161,9 +177,8 @@ function getExpenseAutomationJESchedulesView(state) {
|
|
|
161
177
|
amount: sumAmount(aiAccountantSchedules),
|
|
162
178
|
},
|
|
163
179
|
manual: {
|
|
164
|
-
count:
|
|
165
|
-
|
|
166
|
-
amount: sumAmount(allSchedules.filter((schedule) => schedule.confidenceScore == null)),
|
|
180
|
+
count: manualSchedules.length,
|
|
181
|
+
amount: sumAmount(manualSchedules),
|
|
167
182
|
},
|
|
168
183
|
needsReview: {
|
|
169
184
|
count: pendingUnfiltered.length,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.1.62-
|
|
3
|
+
"version": "5.1.62-betaRD2",
|
|
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",
|