@zeniai/client-epic-state 4.19.99-betaRD1 → 4.19.99-betaRD10
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/aiAccountantCustomer/aiAccountantCustomerPayload.js +3 -1
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerReducer.d.ts +2 -1
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerReducer.js +16 -5
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerSelector.d.ts +2 -1
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerSelector.js +12 -0
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerState.d.ts +2 -2
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerState.js +1 -0
- package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +9 -6
- package/lib/entity/jeSchedules/jeSchedulesPayload.js +36 -2
- package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +4 -2
- package/lib/entity/jeSchedules/jeSchedulesSelector.js +5 -2
- package/lib/entity/jeSchedules/jeSchedulesState.d.ts +26 -2
- package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.d.ts +4 -1
- package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.js +1 -0
- package/lib/entity/transaction/stateTypes/scheduleTransaction.d.ts +1 -0
- package/lib/entity/userRole/userRoleType.d.ts +2 -2
- package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerPayload.js +3 -1
- package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerReducer.js +16 -5
- package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerSelector.js +12 -0
- package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerState.js +1 -0
- package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +36 -2
- package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +5 -2
- package/lib/esm/entity/transaction/payloadTypes/scheduleTransactionPayload.js +1 -0
- package/lib/esm/view/aiAccountantView/aiAccountantViewReducer.js +15 -11
- package/lib/esm/view/aiAccountantView/aiAccountantViewSelector.js +20 -15
- package/lib/esm/view/aiAccountantView/epics/cancelAiAccountantOnboardingEpic.js +24 -4
- package/lib/esm/view/aiAccountantView/epics/fetchAiAccountantJobsEpic.js +17 -7
- package/lib/esm/view/aiAccountantView/epics/triggerAiAccountantJobEpic.js +30 -17
- package/lib/esm/view/expenseAutomationView/expenseAutomationViewSelector.js +0 -1
- package/lib/esm/view/expenseAutomationView/selectors/fluxAnalysisViewSelector.js +10 -2
- package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +13 -3
- package/lib/esm/view/expenseAutomationView/selectors/missingReceiptsSelector.js +11 -3
- package/lib/esm/view/expenseAutomationView/selectors/reconciliationViewSelector.js +22 -9
- package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +12 -6
- package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +1 -0
- package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +3 -8
- package/lib/esm/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.js +140 -59
- package/lib/index.d.ts +3 -3
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
- package/lib/view/aiAccountantView/aiAccountantViewPayload.d.ts +2 -2
- package/lib/view/aiAccountantView/aiAccountantViewReducer.d.ts +7 -5
- package/lib/view/aiAccountantView/aiAccountantViewReducer.js +15 -11
- package/lib/view/aiAccountantView/aiAccountantViewSelector.d.ts +1 -0
- package/lib/view/aiAccountantView/aiAccountantViewSelector.js +20 -15
- package/lib/view/aiAccountantView/aiAccountantViewState.d.ts +4 -2
- package/lib/view/aiAccountantView/epics/cancelAiAccountantOnboardingEpic.d.ts +14 -1
- package/lib/view/aiAccountantView/epics/cancelAiAccountantOnboardingEpic.js +23 -3
- package/lib/view/aiAccountantView/epics/fetchAiAccountantJobsEpic.d.ts +10 -3
- package/lib/view/aiAccountantView/epics/fetchAiAccountantJobsEpic.js +16 -6
- package/lib/view/aiAccountantView/epics/triggerAiAccountantJobEpic.d.ts +14 -1
- package/lib/view/aiAccountantView/epics/triggerAiAccountantJobEpic.js +29 -16
- package/lib/view/companyView/types/cockpitTypes.d.ts +5 -4
- package/lib/view/expenseAutomationView/expenseAutomationViewSelector.js +0 -1
- package/lib/view/expenseAutomationView/selectors/fluxAnalysisViewSelector.js +10 -2
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +13 -3
- package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.js +11 -3
- package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.js +22 -9
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +11 -5
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +1 -1
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +1 -0
- package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +3 -8
- package/lib/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.js +140 -59
- package/lib/view/reviewCompanyView/reviewCompanyViewState.d.ts +1 -1
- package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
- package/lib/view/spendManagement/billPay/billList/billListReducer.d.ts +1 -1
- package/lib/view/spendManagement/billPay/billList/billListState.d.ts +1 -1
- package/lib/view/spendManagement/reimbursement/remiListView/remiListReducer.d.ts +1 -1
- package/lib/view/spendManagement/reimbursement/remiListView/remiListState.d.ts +3 -3
- package/lib/view/subscriptionView/types/subscriptionTypes.d.ts +1 -1
- package/package.json +1 -1
|
@@ -7,7 +7,9 @@ const aiAccountantCustomerState_1 = require("./aiAccountantCustomerState");
|
|
|
7
7
|
const toAiAccountantEnrollment = (payload) => ({
|
|
8
8
|
status: (0, aiAccountantCustomerState_1.toAiAccountantEnrollmentStatus)(payload.status),
|
|
9
9
|
accuracy: payload.accuracy,
|
|
10
|
-
latestTraining: payload.latest_training
|
|
10
|
+
latestTraining: payload.latest_training != null
|
|
11
|
+
? (0, zeniDayJS_1.date)(payload.latest_training)
|
|
12
|
+
: undefined,
|
|
11
13
|
latestTransactionSync: payload.latest_transaction_sync != null
|
|
12
14
|
? (0, zeniDayJS_1.date)(payload.latest_transaction_sync)
|
|
13
15
|
: undefined,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { AiAccountantCustomerPayload, AiAccountantJobPayload } from './aiAccountantCustomerPayload';
|
|
2
2
|
import { AiAccountantCustomerState } from './aiAccountantCustomerState';
|
|
3
3
|
export declare const initialAiAccountantCustomerState: AiAccountantCustomerState;
|
|
4
|
-
export declare const clearAllAiAccountantCustomers: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"aiAccountantCustomer/clearAllAiAccountantCustomers">, updateAiAccountantCustomers: import("@reduxjs/toolkit").ActionCreatorWithPayload<AiAccountantCustomerPayload[], "aiAccountantCustomer/updateAiAccountantCustomers">, updateAiAccountantCustomer: import("@reduxjs/toolkit").ActionCreatorWithPayload<AiAccountantCustomerPayload, "aiAccountantCustomer/updateAiAccountantCustomer">, updateAiAccountantJobs: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, jobs: AiAccountantJobPayload[]], {
|
|
4
|
+
export declare const clearAllAiAccountantCustomers: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"aiAccountantCustomer/clearAllAiAccountantCustomers">, updateAiAccountantCustomers: import("@reduxjs/toolkit").ActionCreatorWithPayload<AiAccountantCustomerPayload[], "aiAccountantCustomer/updateAiAccountantCustomers">, updateAiAccountantCustomer: import("@reduxjs/toolkit").ActionCreatorWithPayload<AiAccountantCustomerPayload, "aiAccountantCustomer/updateAiAccountantCustomer">, updateAiAccountantJobs: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, jobs: AiAccountantJobPayload[], append?: boolean | undefined], {
|
|
5
5
|
tenantId: string;
|
|
6
6
|
jobs: AiAccountantJobPayload[];
|
|
7
|
+
append: boolean;
|
|
7
8
|
}, "aiAccountantCustomer/updateAiAccountantJobs", never, never>;
|
|
8
9
|
declare const _default: import("redux").Reducer<AiAccountantCustomerState>;
|
|
9
10
|
export default _default;
|
|
@@ -13,10 +13,12 @@ const aiAccountantCustomer = (0, toolkit_1.createSlice)({
|
|
|
13
13
|
initialState: exports.initialAiAccountantCustomerState,
|
|
14
14
|
reducers: {
|
|
15
15
|
updateAiAccountantCustomers(draft, action) {
|
|
16
|
+
const newCustomerByTenantId = {};
|
|
16
17
|
action.payload.forEach((payload) => {
|
|
17
18
|
const customer = (0, aiAccountantCustomerPayload_1.toAiAccountantCustomer)(payload);
|
|
18
|
-
|
|
19
|
+
newCustomerByTenantId[customer.tenantId] = customer;
|
|
19
20
|
});
|
|
21
|
+
draft.customerByTenantId = newCustomerByTenantId;
|
|
20
22
|
},
|
|
21
23
|
updateAiAccountantCustomer(draft, action) {
|
|
22
24
|
const customer = (0, aiAccountantCustomerPayload_1.toAiAccountantCustomer)(action.payload);
|
|
@@ -24,11 +26,20 @@ const aiAccountantCustomer = (0, toolkit_1.createSlice)({
|
|
|
24
26
|
},
|
|
25
27
|
updateAiAccountantJobs: {
|
|
26
28
|
reducer(draft, action) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
const mappedJobs = action.payload.jobs.map(aiAccountantCustomerPayload_1.toAiAccountantJob);
|
|
30
|
+
if (action.payload.append) {
|
|
31
|
+
const existing = draft.jobsByTenantId[action.payload.tenantId] ?? [];
|
|
32
|
+
const jobMap = new Map(existing.map((job) => [job.jobId, job]));
|
|
33
|
+
mappedJobs.forEach((job) => jobMap.set(job.jobId, job));
|
|
34
|
+
draft.jobsByTenantId[action.payload.tenantId] =
|
|
35
|
+
Array.from(jobMap.values());
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
draft.jobsByTenantId[action.payload.tenantId] = mappedJobs;
|
|
39
|
+
}
|
|
29
40
|
},
|
|
30
|
-
prepare(tenantId, jobs) {
|
|
31
|
-
return { payload: { tenantId, jobs } };
|
|
41
|
+
prepare(tenantId, jobs, append = false) {
|
|
42
|
+
return { payload: { tenantId, jobs, append } };
|
|
32
43
|
},
|
|
33
44
|
},
|
|
34
45
|
clearAllAiAccountantCustomers(draft) {
|
|
@@ -6,7 +6,7 @@ import { AiAccountantCustomerState, AiAccountantEnrollmentStatus, AiAccountantJo
|
|
|
6
6
|
export interface AiAccountantEnrollmentView {
|
|
7
7
|
status: AiAccountantEnrollmentStatus;
|
|
8
8
|
accuracy?: Record<string, number>;
|
|
9
|
-
latestTraining?:
|
|
9
|
+
latestTraining?: ZeniDate;
|
|
10
10
|
latestTransactionSync?: ZeniDate;
|
|
11
11
|
offboardedAt?: ZeniDate;
|
|
12
12
|
offboardedBy?: User;
|
|
@@ -20,6 +20,7 @@ export interface AiAccountantEnrollmentView {
|
|
|
20
20
|
}>;
|
|
21
21
|
}
|
|
22
22
|
export interface AiAccountantCustomerView {
|
|
23
|
+
averageAccuracy: number;
|
|
23
24
|
companyId: ID;
|
|
24
25
|
companyName: string;
|
|
25
26
|
tenantId: ID;
|
|
@@ -14,6 +14,7 @@ function getAiAccountantJobsByTenantId(customerState, userState, tenantId) {
|
|
|
14
14
|
// ── Helpers ──
|
|
15
15
|
function toCustomerView(customer, userState) {
|
|
16
16
|
return {
|
|
17
|
+
averageAccuracy: calcAverageAccuracy(customer),
|
|
17
18
|
companyId: customer.companyId,
|
|
18
19
|
companyName: customer.companyName,
|
|
19
20
|
tenantId: customer.tenantId,
|
|
@@ -52,3 +53,14 @@ function toJobView(job, userState) {
|
|
|
52
53
|
validationResults: job.validationResults,
|
|
53
54
|
};
|
|
54
55
|
}
|
|
56
|
+
function calcAverageAccuracy(customer) {
|
|
57
|
+
const accuracy = customer.enrollment?.accuracy;
|
|
58
|
+
if (accuracy == null) {
|
|
59
|
+
return 0;
|
|
60
|
+
}
|
|
61
|
+
const values = Object.values(accuracy);
|
|
62
|
+
if (values.length === 0) {
|
|
63
|
+
return 0;
|
|
64
|
+
}
|
|
65
|
+
return values.reduce((sum, value) => sum + value, 0) / values.length;
|
|
66
|
+
}
|
|
@@ -4,12 +4,12 @@ export declare const toAiAccountantOperationType: (v: string) => "onboard" | "of
|
|
|
4
4
|
export type AiAccountantOperationType = ReturnType<typeof toAiAccountantOperationType>;
|
|
5
5
|
export declare const toAiAccountantEnrollmentStatus: (v: string) => "onboarding" | "error" | "active" | "pending" | "offboarding" | "offboarded" | "failed";
|
|
6
6
|
export type AiAccountantEnrollmentStatus = ReturnType<typeof toAiAccountantEnrollmentStatus>;
|
|
7
|
-
export declare const toAiAccountantJobStatus: (v: string) => "failed" | "queued" | "running" | "completed" | "cancelled";
|
|
7
|
+
export declare const toAiAccountantJobStatus: (v: string) => "failed" | "queued" | "running" | "completed" | "cancelled" | "retried";
|
|
8
8
|
export type AiAccountantJobStatus = ReturnType<typeof toAiAccountantJobStatus>;
|
|
9
9
|
export interface AiAccountantEnrollment {
|
|
10
10
|
status: AiAccountantEnrollmentStatus;
|
|
11
11
|
accuracy?: Record<string, number>;
|
|
12
|
-
latestTraining?:
|
|
12
|
+
latestTraining?: ZeniDate;
|
|
13
13
|
latestTransactionSync?: ZeniDate;
|
|
14
14
|
offboardedAt?: ZeniDate;
|
|
15
15
|
offboardedBy?: ID;
|
|
@@ -25,26 +25,28 @@ export interface JEScheduleAISummariesPayload {
|
|
|
25
25
|
debit_accounting_class?: JEScheduleAISummaryFieldPayload;
|
|
26
26
|
period?: JEScheduleAISummaryFieldPayload;
|
|
27
27
|
posting_date?: JEScheduleAISummaryFieldPayload;
|
|
28
|
+
schedule_type?: JEScheduleAISummaryFieldPayload;
|
|
28
29
|
}
|
|
29
30
|
export interface JEScheduleRecommendationsPayload {
|
|
30
|
-
amortization_days?: number | null;
|
|
31
|
-
amortization_months_estimate?: number | null;
|
|
32
31
|
credit_account_confidence?: number;
|
|
33
|
-
credit_account_id?: string | null;
|
|
34
|
-
credit_accounting_class_id?: string | null;
|
|
35
32
|
credit_class_confidence?: number;
|
|
36
33
|
debit_account_confidence?: number;
|
|
37
|
-
debit_account_id?: string | null;
|
|
38
|
-
debit_accounting_class_id?: string | null;
|
|
39
34
|
debit_class_confidence?: number;
|
|
40
35
|
end_date?: string | null;
|
|
36
|
+
je_credit_account_id?: string | null;
|
|
37
|
+
je_credit_accounting_class_id?: string | null;
|
|
38
|
+
je_debit_account_id?: string | null;
|
|
39
|
+
je_debit_accounting_class_id?: string | null;
|
|
41
40
|
je_schedule_type?: string | null;
|
|
41
|
+
je_schedule_type_confidence?: number;
|
|
42
42
|
period?: number | null;
|
|
43
43
|
period_confidence?: number;
|
|
44
44
|
posting_date?: string | null;
|
|
45
|
+
posting_date_confidence?: number;
|
|
45
46
|
similar_transactions?: unknown[];
|
|
46
47
|
start_date?: string | null;
|
|
47
48
|
starting_month?: string | null;
|
|
49
|
+
starting_month_confidence?: number;
|
|
48
50
|
}
|
|
49
51
|
export interface JEScheduledTransactionPayload {
|
|
50
52
|
balance: number | null;
|
|
@@ -69,6 +71,7 @@ export interface JEScheduledTransactionPayload {
|
|
|
69
71
|
updated_by: UserPayload;
|
|
70
72
|
vendor: VendorPayload;
|
|
71
73
|
ai_summaries?: JEScheduleAISummariesPayload;
|
|
74
|
+
created_by?: UserPayload;
|
|
72
75
|
end_date?: string | null;
|
|
73
76
|
recommendations?: JEScheduleRecommendationsPayload;
|
|
74
77
|
updated_at?: string | null;
|
|
@@ -146,7 +146,7 @@ function toJEScheduleOtherAttributes(payload) {
|
|
|
146
146
|
assetId: payload.asset_id ?? undefined,
|
|
147
147
|
};
|
|
148
148
|
}
|
|
149
|
-
function
|
|
149
|
+
function toJEScheduleAISummaries(payload) {
|
|
150
150
|
if (payload == null) {
|
|
151
151
|
return undefined;
|
|
152
152
|
}
|
|
@@ -187,8 +187,40 @@ function toJEScheduleAIRecommendations(payload) {
|
|
|
187
187
|
reasoning: payload.posting_date.reasoning,
|
|
188
188
|
};
|
|
189
189
|
}
|
|
190
|
+
if (payload.schedule_type != null) {
|
|
191
|
+
result.scheduleType = {
|
|
192
|
+
confidence: payload.schedule_type.confidence,
|
|
193
|
+
reasoning: payload.schedule_type.reasoning,
|
|
194
|
+
};
|
|
195
|
+
}
|
|
190
196
|
return Object.keys(result).length > 0 ? result : undefined;
|
|
191
197
|
}
|
|
198
|
+
function toJEScheduleRecommendations(payload) {
|
|
199
|
+
if (payload == null) {
|
|
200
|
+
return undefined;
|
|
201
|
+
}
|
|
202
|
+
return {
|
|
203
|
+
creditAccountConfidence: payload.credit_account_confidence,
|
|
204
|
+
creditClassConfidence: payload.credit_class_confidence,
|
|
205
|
+
debitAccountConfidence: payload.debit_account_confidence,
|
|
206
|
+
debitClassConfidence: payload.debit_class_confidence,
|
|
207
|
+
endDate: payload.end_date ?? undefined,
|
|
208
|
+
jeCreditAccountId: payload.je_credit_account_id ?? undefined,
|
|
209
|
+
jeCreditAccountingClassId: payload.je_credit_accounting_class_id ?? undefined,
|
|
210
|
+
jeDebitAccountId: payload.je_debit_account_id ?? undefined,
|
|
211
|
+
jeDebitAccountingClassId: payload.je_debit_accounting_class_id ?? undefined,
|
|
212
|
+
jeScheduleType: payload.je_schedule_type ?? undefined,
|
|
213
|
+
jeScheduleTypeConfidence: payload.je_schedule_type_confidence,
|
|
214
|
+
period: payload.period ?? undefined,
|
|
215
|
+
periodConfidence: payload.period_confidence,
|
|
216
|
+
postingDate: payload.posting_date ?? undefined,
|
|
217
|
+
postingDateConfidence: payload.posting_date_confidence,
|
|
218
|
+
similarTransactions: payload.similar_transactions,
|
|
219
|
+
startDate: payload.start_date ?? undefined,
|
|
220
|
+
startingMonth: payload.starting_month ?? undefined,
|
|
221
|
+
startingMonthConfidence: payload.starting_month_confidence,
|
|
222
|
+
};
|
|
223
|
+
}
|
|
192
224
|
function toJEScheduledTransaction(payload) {
|
|
193
225
|
return {
|
|
194
226
|
jeScheduleId: payload.je_schedule_id ?? undefined,
|
|
@@ -233,7 +265,9 @@ function toJEScheduledTransaction(payload) {
|
|
|
233
265
|
? toJEScheduleOtherAttributes(payload.other_attributes)
|
|
234
266
|
: {},
|
|
235
267
|
scheduledJournalEntry: [],
|
|
236
|
-
|
|
268
|
+
aiSummaries: toJEScheduleAISummaries(payload.ai_summaries),
|
|
269
|
+
createdByUserID: payload.created_by?.user_id ?? undefined,
|
|
270
|
+
recommendations: toJEScheduleRecommendations(payload.recommendations),
|
|
237
271
|
};
|
|
238
272
|
}
|
|
239
273
|
function toJEAccruedScheduledTransaction(payload) {
|
|
@@ -9,7 +9,7 @@ import { ScheduleTransaction } from '../transaction/stateTypes/scheduleTransacti
|
|
|
9
9
|
import { TransactionID } from '../transaction/stateTypes/transaction';
|
|
10
10
|
import { User } from '../user/userState';
|
|
11
11
|
import { Vendor } from '../vendor/vendorState';
|
|
12
|
-
import {
|
|
12
|
+
import { JEScheduleAISummaries, JEScheduleOtherAttributes, JEScheduleRecommendations, ScheduleJournalStatusCode, ScheduleStatus } from './jeSchedulesState';
|
|
13
13
|
import { JEScheduleKey, JEScheduleTransactionKey, JournalEntryErrorCodeType, ScheduleTypes } from './jeSchedulesTypes';
|
|
14
14
|
export interface ScheduledJournalEntry {
|
|
15
15
|
error: JournalEntryErrorCodeType[];
|
|
@@ -59,14 +59,16 @@ export interface JEScheduledTransaction {
|
|
|
59
59
|
scheduledJournalEntry: ScheduledJournalEntry[];
|
|
60
60
|
status: ScheduleStatus;
|
|
61
61
|
vendor: Vendor;
|
|
62
|
-
|
|
62
|
+
aiSummaries?: JEScheduleAISummaries;
|
|
63
63
|
balanceAsOfToday?: Amount;
|
|
64
|
+
createdByUser?: User;
|
|
64
65
|
dayOfPostingDate?: ScheduleDaysOfMonth;
|
|
65
66
|
endDate?: ZeniDate;
|
|
66
67
|
jeScheduleId?: ID;
|
|
67
68
|
jeScheduleType?: ScheduleTypes;
|
|
68
69
|
lastDayOfMonth?: boolean;
|
|
69
70
|
period?: number;
|
|
71
|
+
recommendations?: JEScheduleRecommendations;
|
|
70
72
|
startDate?: ZeniDate;
|
|
71
73
|
updatedAt?: ZeniDate;
|
|
72
74
|
updatedByUser?: User;
|
|
@@ -77,12 +77,13 @@ exports.getJEAccruedScheduleByJEScheduleKey = getJEAccruedScheduleByJEScheduleKe
|
|
|
77
77
|
const getJEScheduledTransactionByJEScheduleTransactionKey = (jeScheduleTransactionKey, state) => {
|
|
78
78
|
const { jeSchedulesState, vendorState, accountState, userState, classState, transactionState, } = state;
|
|
79
79
|
const jeScheduleTransactionState = (0, get_1.default)(jeSchedulesState.schedulesByTransactionKey, jeScheduleTransactionKey);
|
|
80
|
-
const { period, updatedByUserID: updatedBy, vendorId, jeCredit, jeDebit, currencyCode, currencySymbol, balanceAsOfToday, baseTransaction, startDate, endDate, status, updatedAt, jeScheduleId, scheduledJournalEntry, dayOfPostingDate: postingDate, lastDayOfMonth, otherAttributes, jeScheduleType,
|
|
80
|
+
const { period, updatedByUserID: updatedBy, createdByUserID: createdBy, vendorId, jeCredit, jeDebit, currencyCode, currencySymbol, balanceAsOfToday, baseTransaction, startDate, endDate, status, updatedAt, jeScheduleId, scheduledJournalEntry, dayOfPostingDate: postingDate, lastDayOfMonth, otherAttributes, jeScheduleType, aiSummaries, recommendations, } = jeScheduleTransactionState;
|
|
81
81
|
const vendorDetails = (0, vendorSelector_1.getVendorByVendorId)(vendorState, vendorId);
|
|
82
82
|
if (vendorDetails == null) {
|
|
83
83
|
throw new Error(`Vendor with ${vendorId} doesn't exist`);
|
|
84
84
|
}
|
|
85
85
|
const userDetails = updatedBy != null ? (0, userSelector_1.getUserByUserId)(userState, updatedBy) : undefined;
|
|
86
|
+
const createdByUserDetails = createdBy != null ? (0, userSelector_1.getUserByUserId)(userState, createdBy) : undefined;
|
|
86
87
|
const baseTransactionObject = (0, transactionSelector_1.getScheduleTransactionById)(transactionState, baseTransaction);
|
|
87
88
|
if (baseTransactionObject == null) {
|
|
88
89
|
throw Error('Base Schedule transaction cannot be null');
|
|
@@ -134,7 +135,9 @@ const getJEScheduledTransactionByJEScheduleTransactionKey = (jeScheduleTransacti
|
|
|
134
135
|
account: accountDebit,
|
|
135
136
|
},
|
|
136
137
|
scheduledJournalEntry,
|
|
137
|
-
|
|
138
|
+
aiSummaries,
|
|
139
|
+
createdByUser: createdByUserDetails,
|
|
140
|
+
recommendations,
|
|
138
141
|
};
|
|
139
142
|
};
|
|
140
143
|
exports.getJEScheduledTransactionByJEScheduleTransactionKey = getJEScheduledTransactionByJEScheduleTransactionKey;
|
|
@@ -16,13 +16,35 @@ export interface JEScheduleFieldRecommendation {
|
|
|
16
16
|
confidence: number;
|
|
17
17
|
reasoning: string;
|
|
18
18
|
}
|
|
19
|
-
export interface
|
|
19
|
+
export interface JEScheduleAISummaries {
|
|
20
20
|
creditAccount?: JEScheduleFieldRecommendation;
|
|
21
21
|
creditClass?: JEScheduleFieldRecommendation;
|
|
22
22
|
debitAccount?: JEScheduleFieldRecommendation;
|
|
23
23
|
debitClass?: JEScheduleFieldRecommendation;
|
|
24
24
|
period?: JEScheduleFieldRecommendation;
|
|
25
25
|
postingDate?: JEScheduleFieldRecommendation;
|
|
26
|
+
scheduleType?: JEScheduleFieldRecommendation;
|
|
27
|
+
}
|
|
28
|
+
export interface JEScheduleRecommendations {
|
|
29
|
+
creditAccountConfidence?: number;
|
|
30
|
+
creditClassConfidence?: number;
|
|
31
|
+
debitAccountConfidence?: number;
|
|
32
|
+
debitClassConfidence?: number;
|
|
33
|
+
endDate?: string;
|
|
34
|
+
jeCreditAccountId?: string;
|
|
35
|
+
jeCreditAccountingClassId?: string;
|
|
36
|
+
jeDebitAccountId?: string;
|
|
37
|
+
jeDebitAccountingClassId?: string;
|
|
38
|
+
jeScheduleType?: string;
|
|
39
|
+
jeScheduleTypeConfidence?: number;
|
|
40
|
+
period?: number;
|
|
41
|
+
periodConfidence?: number;
|
|
42
|
+
postingDate?: string;
|
|
43
|
+
postingDateConfidence?: number;
|
|
44
|
+
similarTransactions?: unknown[];
|
|
45
|
+
startDate?: string;
|
|
46
|
+
startingMonth?: string;
|
|
47
|
+
startingMonthConfidence?: number;
|
|
26
48
|
}
|
|
27
49
|
export interface JEScheduleOtherAttributes {
|
|
28
50
|
assetId?: string;
|
|
@@ -68,14 +90,16 @@ export interface JEScheduledTransactionState {
|
|
|
68
90
|
scheduledJournalEntry: ScheduledJournalEntryState[];
|
|
69
91
|
status: ScheduleStatus;
|
|
70
92
|
vendorId: ID;
|
|
71
|
-
|
|
93
|
+
aiSummaries?: JEScheduleAISummaries;
|
|
72
94
|
balanceAsOfToday?: number;
|
|
95
|
+
createdByUserID?: ID;
|
|
73
96
|
dayOfPostingDate?: ScheduleDaysOfMonth;
|
|
74
97
|
endDate?: ZeniDate;
|
|
75
98
|
jeScheduleId?: ID;
|
|
76
99
|
jeScheduleType?: ScheduleTypes;
|
|
77
100
|
lastDayOfMonth?: boolean;
|
|
78
101
|
period?: number;
|
|
102
|
+
recommendations?: JEScheduleRecommendations;
|
|
79
103
|
startDate?: ZeniDate;
|
|
80
104
|
updatedAt?: ZeniDate;
|
|
81
105
|
updatedByUserID?: ID;
|
|
@@ -2,12 +2,15 @@ import { AccountBasePayload } from '../../account/accountPayload';
|
|
|
2
2
|
import { ClassBasePayload } from '../../class/classPayload';
|
|
3
3
|
import { ScheduleTransaction } from '../stateTypes/scheduleTransaction';
|
|
4
4
|
import { TransactionIDPayload } from './transactionIDPayload';
|
|
5
|
-
export interface ScheduleTransactionPayload extends TransactionIDPayload, Omit<AccountBasePayload, 'qbo_id'>, Omit<ClassBasePayload, 'qbo_id' | 'labels'> {
|
|
5
|
+
export interface ScheduleTransactionPayload extends TransactionIDPayload, Omit<AccountBasePayload, 'qbo_id' | 'labels'>, Omit<ClassBasePayload, 'qbo_id' | 'labels'> {
|
|
6
6
|
line_id: string;
|
|
7
7
|
third_party_transaction_id: string;
|
|
8
8
|
total_amount: number;
|
|
9
9
|
transaction_date: string;
|
|
10
10
|
transaction_memo: string;
|
|
11
11
|
transaction_type_name: string;
|
|
12
|
+
labels?: string[];
|
|
13
|
+
sync_token?: number;
|
|
14
|
+
transaction_description?: string | null;
|
|
12
15
|
}
|
|
13
16
|
export declare const toScheduleTransaction: (payload: ScheduleTransactionPayload, currency_code: string, currency_symbol: string) => ScheduleTransaction;
|
|
@@ -32,6 +32,7 @@ const toScheduleTransaction = (payload, currency_code, currency_symbol) => {
|
|
|
32
32
|
currencyCode: currency_code,
|
|
33
33
|
currencySymbol: currency_symbol,
|
|
34
34
|
},
|
|
35
|
+
description: payload.transaction_description ?? undefined,
|
|
35
36
|
};
|
|
36
37
|
};
|
|
37
38
|
exports.toScheduleTransaction = toScheduleTransaction;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CurrentTenant, TenantView } from '../tenant/tenantSelector';
|
|
2
2
|
import { LoggedInUser } from '../tenant/tenantState';
|
|
3
|
-
export declare const toUserRoleTypeStrict: (v?: string) => "admin" | "bookkeeping_admin" | "bookkeeping_user" | "investor_or_banker" | "company_officer" | "reimbursements_user" | "bill_pay_admin" | "bill_pay_user" | "reimbursements_admin" | "deposit_accounts_admin" | "deposit_accounts_user" | "charge_card_admin" | "charge_card_user" | "treasury_admin" | "treasury_user" | "
|
|
4
|
-
export declare const toUserRoleType: (v: string) => "admin" | "bookkeeping_admin" | "bookkeeping_user" | "investor_or_banker" | "company_officer" | "reimbursements_user" | "bill_pay_admin" | "bill_pay_user" | "reimbursements_admin" | "deposit_accounts_admin" | "deposit_accounts_user" | "charge_card_admin" | "charge_card_user" | "treasury_admin" | "treasury_user" | "
|
|
3
|
+
export declare const toUserRoleTypeStrict: (v?: string) => "admin" | "controller" | "bookkeeping_admin" | "bookkeeping_user" | "investor_or_banker" | "company_officer" | "reimbursements_user" | "bill_pay_admin" | "bill_pay_user" | "reimbursements_admin" | "deposit_accounts_admin" | "deposit_accounts_user" | "charge_card_admin" | "charge_card_user" | "treasury_admin" | "treasury_user" | "tax_lead" | "ap_analyst" | "preparer" | "reviewer" | "customer_success_manager" | "zeni_support_user" | undefined;
|
|
4
|
+
export declare const toUserRoleType: (v: string) => "admin" | "controller" | "bookkeeping_admin" | "bookkeeping_user" | "investor_or_banker" | "company_officer" | "reimbursements_user" | "bill_pay_admin" | "bill_pay_user" | "reimbursements_admin" | "deposit_accounts_admin" | "deposit_accounts_user" | "charge_card_admin" | "charge_card_user" | "treasury_admin" | "treasury_user" | "tax_lead" | "ap_analyst" | "preparer" | "reviewer" | "customer_success_manager" | "zeni_support_user";
|
|
5
5
|
export type UserRoleType = ReturnType<typeof toUserRoleType>;
|
|
6
6
|
export type RoleMap = Record<string, boolean>;
|
|
7
7
|
export declare const isFinOpsUserRoleType: (userRole: UserRoleType) => boolean;
|
|
@@ -4,7 +4,9 @@ import { toAiAccountantEnrollmentStatus, toAiAccountantJobStatus, toAiAccountant
|
|
|
4
4
|
export const toAiAccountantEnrollment = (payload) => ({
|
|
5
5
|
status: toAiAccountantEnrollmentStatus(payload.status),
|
|
6
6
|
accuracy: payload.accuracy,
|
|
7
|
-
latestTraining: payload.latest_training
|
|
7
|
+
latestTraining: payload.latest_training != null
|
|
8
|
+
? date(payload.latest_training)
|
|
9
|
+
: undefined,
|
|
8
10
|
latestTransactionSync: payload.latest_transaction_sync != null
|
|
9
11
|
? date(payload.latest_transaction_sync)
|
|
10
12
|
: undefined,
|
|
@@ -9,10 +9,12 @@ const aiAccountantCustomer = createSlice({
|
|
|
9
9
|
initialState: initialAiAccountantCustomerState,
|
|
10
10
|
reducers: {
|
|
11
11
|
updateAiAccountantCustomers(draft, action) {
|
|
12
|
+
const newCustomerByTenantId = {};
|
|
12
13
|
action.payload.forEach((payload) => {
|
|
13
14
|
const customer = toAiAccountantCustomer(payload);
|
|
14
|
-
|
|
15
|
+
newCustomerByTenantId[customer.tenantId] = customer;
|
|
15
16
|
});
|
|
17
|
+
draft.customerByTenantId = newCustomerByTenantId;
|
|
16
18
|
},
|
|
17
19
|
updateAiAccountantCustomer(draft, action) {
|
|
18
20
|
const customer = toAiAccountantCustomer(action.payload);
|
|
@@ -20,11 +22,20 @@ const aiAccountantCustomer = createSlice({
|
|
|
20
22
|
},
|
|
21
23
|
updateAiAccountantJobs: {
|
|
22
24
|
reducer(draft, action) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
const mappedJobs = action.payload.jobs.map(toAiAccountantJob);
|
|
26
|
+
if (action.payload.append) {
|
|
27
|
+
const existing = draft.jobsByTenantId[action.payload.tenantId] ?? [];
|
|
28
|
+
const jobMap = new Map(existing.map((job) => [job.jobId, job]));
|
|
29
|
+
mappedJobs.forEach((job) => jobMap.set(job.jobId, job));
|
|
30
|
+
draft.jobsByTenantId[action.payload.tenantId] =
|
|
31
|
+
Array.from(jobMap.values());
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
draft.jobsByTenantId[action.payload.tenantId] = mappedJobs;
|
|
35
|
+
}
|
|
25
36
|
},
|
|
26
|
-
prepare(tenantId, jobs) {
|
|
27
|
-
return { payload: { tenantId, jobs } };
|
|
37
|
+
prepare(tenantId, jobs, append = false) {
|
|
38
|
+
return { payload: { tenantId, jobs, append } };
|
|
28
39
|
},
|
|
29
40
|
},
|
|
30
41
|
clearAllAiAccountantCustomers(draft) {
|
|
@@ -10,6 +10,7 @@ export function getAiAccountantJobsByTenantId(customerState, userState, tenantId
|
|
|
10
10
|
// ── Helpers ──
|
|
11
11
|
function toCustomerView(customer, userState) {
|
|
12
12
|
return {
|
|
13
|
+
averageAccuracy: calcAverageAccuracy(customer),
|
|
13
14
|
companyId: customer.companyId,
|
|
14
15
|
companyName: customer.companyName,
|
|
15
16
|
tenantId: customer.tenantId,
|
|
@@ -48,3 +49,14 @@ function toJobView(job, userState) {
|
|
|
48
49
|
validationResults: job.validationResults,
|
|
49
50
|
};
|
|
50
51
|
}
|
|
52
|
+
function calcAverageAccuracy(customer) {
|
|
53
|
+
const accuracy = customer.enrollment?.accuracy;
|
|
54
|
+
if (accuracy == null) {
|
|
55
|
+
return 0;
|
|
56
|
+
}
|
|
57
|
+
const values = Object.values(accuracy);
|
|
58
|
+
if (values.length === 0) {
|
|
59
|
+
return 0;
|
|
60
|
+
}
|
|
61
|
+
return values.reduce((sum, value) => sum + value, 0) / values.length;
|
|
62
|
+
}
|
|
@@ -136,7 +136,7 @@ function toJEScheduleOtherAttributes(payload) {
|
|
|
136
136
|
assetId: payload.asset_id ?? undefined,
|
|
137
137
|
};
|
|
138
138
|
}
|
|
139
|
-
function
|
|
139
|
+
function toJEScheduleAISummaries(payload) {
|
|
140
140
|
if (payload == null) {
|
|
141
141
|
return undefined;
|
|
142
142
|
}
|
|
@@ -177,8 +177,40 @@ function toJEScheduleAIRecommendations(payload) {
|
|
|
177
177
|
reasoning: payload.posting_date.reasoning,
|
|
178
178
|
};
|
|
179
179
|
}
|
|
180
|
+
if (payload.schedule_type != null) {
|
|
181
|
+
result.scheduleType = {
|
|
182
|
+
confidence: payload.schedule_type.confidence,
|
|
183
|
+
reasoning: payload.schedule_type.reasoning,
|
|
184
|
+
};
|
|
185
|
+
}
|
|
180
186
|
return Object.keys(result).length > 0 ? result : undefined;
|
|
181
187
|
}
|
|
188
|
+
function toJEScheduleRecommendations(payload) {
|
|
189
|
+
if (payload == null) {
|
|
190
|
+
return undefined;
|
|
191
|
+
}
|
|
192
|
+
return {
|
|
193
|
+
creditAccountConfidence: payload.credit_account_confidence,
|
|
194
|
+
creditClassConfidence: payload.credit_class_confidence,
|
|
195
|
+
debitAccountConfidence: payload.debit_account_confidence,
|
|
196
|
+
debitClassConfidence: payload.debit_class_confidence,
|
|
197
|
+
endDate: payload.end_date ?? undefined,
|
|
198
|
+
jeCreditAccountId: payload.je_credit_account_id ?? undefined,
|
|
199
|
+
jeCreditAccountingClassId: payload.je_credit_accounting_class_id ?? undefined,
|
|
200
|
+
jeDebitAccountId: payload.je_debit_account_id ?? undefined,
|
|
201
|
+
jeDebitAccountingClassId: payload.je_debit_accounting_class_id ?? undefined,
|
|
202
|
+
jeScheduleType: payload.je_schedule_type ?? undefined,
|
|
203
|
+
jeScheduleTypeConfidence: payload.je_schedule_type_confidence,
|
|
204
|
+
period: payload.period ?? undefined,
|
|
205
|
+
periodConfidence: payload.period_confidence,
|
|
206
|
+
postingDate: payload.posting_date ?? undefined,
|
|
207
|
+
postingDateConfidence: payload.posting_date_confidence,
|
|
208
|
+
similarTransactions: payload.similar_transactions,
|
|
209
|
+
startDate: payload.start_date ?? undefined,
|
|
210
|
+
startingMonth: payload.starting_month ?? undefined,
|
|
211
|
+
startingMonthConfidence: payload.starting_month_confidence,
|
|
212
|
+
};
|
|
213
|
+
}
|
|
182
214
|
export function toJEScheduledTransaction(payload) {
|
|
183
215
|
return {
|
|
184
216
|
jeScheduleId: payload.je_schedule_id ?? undefined,
|
|
@@ -223,7 +255,9 @@ export function toJEScheduledTransaction(payload) {
|
|
|
223
255
|
? toJEScheduleOtherAttributes(payload.other_attributes)
|
|
224
256
|
: {},
|
|
225
257
|
scheduledJournalEntry: [],
|
|
226
|
-
|
|
258
|
+
aiSummaries: toJEScheduleAISummaries(payload.ai_summaries),
|
|
259
|
+
createdByUserID: payload.created_by?.user_id ?? undefined,
|
|
260
|
+
recommendations: toJEScheduleRecommendations(payload.recommendations),
|
|
227
261
|
};
|
|
228
262
|
}
|
|
229
263
|
export function toJEAccruedScheduledTransaction(payload) {
|
|
@@ -70,12 +70,13 @@ export const getJEAccruedScheduleByJEScheduleKey = (JEScheduleKey, state) => {
|
|
|
70
70
|
export const getJEScheduledTransactionByJEScheduleTransactionKey = (jeScheduleTransactionKey, state) => {
|
|
71
71
|
const { jeSchedulesState, vendorState, accountState, userState, classState, transactionState, } = state;
|
|
72
72
|
const jeScheduleTransactionState = recordGet(jeSchedulesState.schedulesByTransactionKey, jeScheduleTransactionKey);
|
|
73
|
-
const { period, updatedByUserID: updatedBy, vendorId, jeCredit, jeDebit, currencyCode, currencySymbol, balanceAsOfToday, baseTransaction, startDate, endDate, status, updatedAt, jeScheduleId, scheduledJournalEntry, dayOfPostingDate: postingDate, lastDayOfMonth, otherAttributes, jeScheduleType,
|
|
73
|
+
const { period, updatedByUserID: updatedBy, createdByUserID: createdBy, vendorId, jeCredit, jeDebit, currencyCode, currencySymbol, balanceAsOfToday, baseTransaction, startDate, endDate, status, updatedAt, jeScheduleId, scheduledJournalEntry, dayOfPostingDate: postingDate, lastDayOfMonth, otherAttributes, jeScheduleType, aiSummaries, recommendations, } = jeScheduleTransactionState;
|
|
74
74
|
const vendorDetails = getVendorByVendorId(vendorState, vendorId);
|
|
75
75
|
if (vendorDetails == null) {
|
|
76
76
|
throw new Error(`Vendor with ${vendorId} doesn't exist`);
|
|
77
77
|
}
|
|
78
78
|
const userDetails = updatedBy != null ? getUserByUserId(userState, updatedBy) : undefined;
|
|
79
|
+
const createdByUserDetails = createdBy != null ? getUserByUserId(userState, createdBy) : undefined;
|
|
79
80
|
const baseTransactionObject = getScheduleTransactionById(transactionState, baseTransaction);
|
|
80
81
|
if (baseTransactionObject == null) {
|
|
81
82
|
throw Error('Base Schedule transaction cannot be null');
|
|
@@ -127,6 +128,8 @@ export const getJEScheduledTransactionByJEScheduleTransactionKey = (jeScheduleTr
|
|
|
127
128
|
account: accountDebit,
|
|
128
129
|
},
|
|
129
130
|
scheduledJournalEntry,
|
|
130
|
-
|
|
131
|
+
aiSummaries,
|
|
132
|
+
createdByUser: createdByUserDetails,
|
|
133
|
+
recommendations,
|
|
131
134
|
};
|
|
132
135
|
};
|