@zeniai/client-epic-state 5.0.2-betaRD2 → 5.0.2-betaRR02
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/billPay/billTransaction/billTransactionState.d.ts +2 -2
- package/lib/entity/chargeCard/chargeCard.d.ts +1 -1
- package/lib/entity/depositAccountTransaction/depositAccountTransaction.d.ts +1 -1
- package/lib/entity/entityApprovalStatus/entityApprovalStatusState.d.ts +2 -2
- package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.d.ts +2 -2
- package/lib/entity/snackbar/snackbarTypes.js +2 -0
- package/lib/entity/task/taskPayload.d.ts +3 -0
- package/lib/entity/task/taskPayload.js +5 -0
- package/lib/entity/task/taskState.d.ts +3 -0
- package/lib/entity/tenant/clearAllEpic.d.ts +1 -3
- package/lib/entity/tenant/clearAllEpic.js +0 -4
- package/lib/entity/transaction/payloadTypes/transactionPayload.js +21 -0
- package/lib/entity/userRole/userRoleType.d.ts +2 -2
- package/lib/epic.d.ts +3 -5
- package/lib/epic.js +3 -5
- package/lib/esm/entity/snackbar/snackbarTypes.js +2 -0
- package/lib/esm/entity/task/taskPayload.js +5 -0
- package/lib/esm/entity/tenant/clearAllEpic.js +0 -4
- package/lib/esm/entity/transaction/payloadTypes/transactionPayload.js +21 -0
- package/lib/esm/epic.js +3 -5
- package/lib/esm/index.js +4 -11
- package/lib/esm/reducer.js +0 -6
- package/lib/esm/view/taskManager/taskDetailView/epics/archiveTaskEpic.js +3 -0
- package/lib/esm/view/taskManager/taskDetailView/epics/deleteTaskEpic.js +5 -0
- package/lib/esm/view/taskManager/taskDetailView/epics/snoozeTaskEpic.js +65 -0
- package/lib/esm/view/taskManager/taskDetailView/epics/unsnoozeTaskEpic.js +56 -0
- package/lib/esm/view/taskManager/taskDetailView/taskDetail.js +4 -0
- package/lib/esm/view/taskManager/taskDetailView/taskDetailReducer.js +49 -1
- package/lib/esm/view/taskManager/taskDetailView/taskDetailSelector.js +9 -0
- package/lib/esm/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.js +56 -21
- package/lib/esm/view/taskManager/taskListView/epics/dragNDropTasksEpic.js +1 -0
- package/lib/esm/view/taskManager/taskListView/epics/fetchTaskListEpic.js +13 -3
- package/lib/esm/view/taskManager/taskListView/taskList.js +7 -0
- package/lib/esm/view/taskManager/taskListView/taskListReducer.js +91 -12
- package/lib/esm/view/taskManager/taskListView/taskListSelector.js +22 -6
- package/lib/index.d.ts +4 -13
- package/lib/index.js +9 -31
- package/lib/reducer.d.ts +0 -6
- package/lib/reducer.js +0 -6
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
- package/lib/view/companyView/types/cockpitTypes.d.ts +5 -6
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +2 -2
- package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +1 -1
- package/lib/view/onboardingView/cockpitView/types/onboardingCockpitViewTypes.d.ts +1 -1
- package/lib/view/reviewCompanyView/reviewCompanyViewState.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/chargeCards/chargeCardDetail/chargeCardDetail.d.ts +1 -1
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.d.ts +4 -4
- 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/lib/view/taskManager/taskDetailView/epics/archiveTaskEpic.d.ts +2 -1
- package/lib/view/taskManager/taskDetailView/epics/archiveTaskEpic.js +3 -0
- package/lib/view/taskManager/taskDetailView/epics/deleteTaskEpic.d.ts +2 -1
- package/lib/view/taskManager/taskDetailView/epics/deleteTaskEpic.js +5 -0
- package/lib/view/taskManager/taskDetailView/epics/snoozeTaskEpic.d.ts +9 -0
- package/lib/view/taskManager/taskDetailView/epics/snoozeTaskEpic.js +69 -0
- package/lib/view/taskManager/taskDetailView/epics/unsnoozeTaskEpic.d.ts +9 -0
- package/lib/view/taskManager/taskDetailView/epics/unsnoozeTaskEpic.js +60 -0
- package/lib/view/taskManager/taskDetailView/taskDetail.d.ts +1 -0
- package/lib/view/taskManager/taskDetailView/taskDetail.js +4 -0
- package/lib/view/taskManager/taskDetailView/taskDetailReducer.d.ts +10 -1
- package/lib/view/taskManager/taskDetailView/taskDetailReducer.js +50 -2
- package/lib/view/taskManager/taskDetailView/taskDetailSelector.d.ts +4 -0
- package/lib/view/taskManager/taskDetailView/taskDetailSelector.js +9 -0
- package/lib/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.d.ts +6 -7
- package/lib/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.js +56 -22
- package/lib/view/taskManager/taskListView/epics/dragNDropTasksEpic.js +1 -0
- package/lib/view/taskManager/taskListView/epics/fetchTaskListEpic.js +13 -3
- package/lib/view/taskManager/taskListView/taskList.d.ts +14 -1
- package/lib/view/taskManager/taskListView/taskList.js +8 -1
- package/lib/view/taskManager/taskListView/taskListPayload.d.ts +3 -0
- package/lib/view/taskManager/taskListView/taskListReducer.d.ts +6 -2
- package/lib/view/taskManager/taskListView/taskListReducer.js +92 -13
- package/lib/view/taskManager/taskListView/taskListSelector.d.ts +3 -1
- package/lib/view/taskManager/taskListView/taskListSelector.js +22 -6
- package/package.json +1 -1
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerPayload.d.ts +0 -44
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerPayload.js +0 -55
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerReducer.d.ts +0 -10
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerReducer.js +0 -51
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerSelector.d.ts +0 -48
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerSelector.js +0 -66
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerState.d.ts +0 -52
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerState.js +0 -37
- package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerPayload.js +0 -49
- package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerReducer.js +0 -47
- package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerSelector.js +0 -62
- package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerState.js +0 -31
- package/lib/esm/view/aiAccountantView/aiAccountantViewPayload.js +0 -2
- package/lib/esm/view/aiAccountantView/aiAccountantViewReducer.js +0 -149
- package/lib/esm/view/aiAccountantView/aiAccountantViewSelector.js +0 -72
- package/lib/esm/view/aiAccountantView/aiAccountantViewState.js +0 -11
- package/lib/esm/view/aiAccountantView/epics/cancelAiAccountantOnboardingEpic.js +0 -46
- package/lib/esm/view/aiAccountantView/epics/fetchAiAccountantCustomersEpic.js +0 -27
- package/lib/esm/view/aiAccountantView/epics/fetchAiAccountantJobsEpic.js +0 -47
- package/lib/esm/view/aiAccountantView/epics/triggerAiAccountantJobEpic.js +0 -52
- package/lib/view/aiAccountantView/aiAccountantViewPayload.d.ts +0 -31
- package/lib/view/aiAccountantView/aiAccountantViewPayload.js +0 -8
- package/lib/view/aiAccountantView/aiAccountantViewReducer.d.ts +0 -29
- package/lib/view/aiAccountantView/aiAccountantViewReducer.js +0 -153
- package/lib/view/aiAccountantView/aiAccountantViewSelector.d.ts +0 -14
- package/lib/view/aiAccountantView/aiAccountantViewSelector.js +0 -78
- package/lib/view/aiAccountantView/aiAccountantViewState.d.ts +0 -26
- package/lib/view/aiAccountantView/aiAccountantViewState.js +0 -13
- package/lib/view/aiAccountantView/epics/cancelAiAccountantOnboardingEpic.d.ts +0 -33
- package/lib/view/aiAccountantView/epics/cancelAiAccountantOnboardingEpic.js +0 -50
- package/lib/view/aiAccountantView/epics/fetchAiAccountantCustomersEpic.d.ts +0 -23
- package/lib/view/aiAccountantView/epics/fetchAiAccountantCustomersEpic.js +0 -31
- package/lib/view/aiAccountantView/epics/fetchAiAccountantJobsEpic.d.ts +0 -33
- package/lib/view/aiAccountantView/epics/fetchAiAccountantJobsEpic.js +0 -51
- package/lib/view/aiAccountantView/epics/triggerAiAccountantJobEpic.d.ts +0 -28
- package/lib/view/aiAccountantView/epics/triggerAiAccountantJobEpic.js +0 -56
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toAiAccountantJob = exports.toAiAccountantCustomer = exports.toAiAccountantEnrollment = void 0;
|
|
4
|
-
const zeniDayJS_1 = require("../../zeniDayJS");
|
|
5
|
-
const aiAccountantCustomerState_1 = require("./aiAccountantCustomerState");
|
|
6
|
-
// ── Mapping functions (payload → state) ──
|
|
7
|
-
const toAiAccountantEnrollment = (payload) => ({
|
|
8
|
-
status: (0, aiAccountantCustomerState_1.toAiAccountantEnrollmentStatus)(payload.status),
|
|
9
|
-
accuracy: payload.accuracy,
|
|
10
|
-
latestTraining: payload.latest_training != null
|
|
11
|
-
? (0, zeniDayJS_1.date)(payload.latest_training)
|
|
12
|
-
: undefined,
|
|
13
|
-
latestTransactionSync: payload.latest_transaction_sync != null
|
|
14
|
-
? (0, zeniDayJS_1.date)(payload.latest_transaction_sync)
|
|
15
|
-
: undefined,
|
|
16
|
-
offboardedAt: payload.offboarded_at != null ? (0, zeniDayJS_1.date)(payload.offboarded_at) : undefined,
|
|
17
|
-
offboardedBy: payload.offboarded_by,
|
|
18
|
-
onboardedAt: payload.onboarded_at != null ? (0, zeniDayJS_1.date)(payload.onboarded_at) : undefined,
|
|
19
|
-
onboardedBy: payload.onboarded_by,
|
|
20
|
-
validationResults: payload.validation_results?.map((vr) => ({
|
|
21
|
-
accuracy: vr.accuracy,
|
|
22
|
-
modelType: vr.model_type,
|
|
23
|
-
passed: vr.passed,
|
|
24
|
-
threshold: vr.threshold,
|
|
25
|
-
})),
|
|
26
|
-
});
|
|
27
|
-
exports.toAiAccountantEnrollment = toAiAccountantEnrollment;
|
|
28
|
-
const toAiAccountantCustomer = (payload) => ({
|
|
29
|
-
companyId: payload.company_id,
|
|
30
|
-
companyName: payload.company_name,
|
|
31
|
-
tenantId: payload.tenant_id,
|
|
32
|
-
bookcloseDate: payload.bookclose_date != null ? (0, zeniDayJS_1.date)(payload.bookclose_date) : undefined,
|
|
33
|
-
enrollment: payload.enrollment != null
|
|
34
|
-
? (0, exports.toAiAccountantEnrollment)(payload.enrollment)
|
|
35
|
-
: undefined,
|
|
36
|
-
});
|
|
37
|
-
exports.toAiAccountantCustomer = toAiAccountantCustomer;
|
|
38
|
-
const toAiAccountantJob = (payload) => ({
|
|
39
|
-
companyId: payload.company_id,
|
|
40
|
-
createdAt: (0, zeniDayJS_1.date)(payload.created_at),
|
|
41
|
-
jobId: payload.job_id,
|
|
42
|
-
operationType: (0, aiAccountantCustomerState_1.toAiAccountantOperationType)(payload.operation_type),
|
|
43
|
-
status: (0, aiAccountantCustomerState_1.toAiAccountantJobStatus)(payload.status),
|
|
44
|
-
tenantId: payload.tenant_id,
|
|
45
|
-
triggeredBy: payload.triggered_by,
|
|
46
|
-
companyNamespace: payload.company_namespace,
|
|
47
|
-
completedAt: payload.completed_at != null ? (0, zeniDayJS_1.date)(payload.completed_at) : undefined,
|
|
48
|
-
errorMessage: payload.error_message,
|
|
49
|
-
parameters: payload.parameters,
|
|
50
|
-
retryCount: payload.retry_count,
|
|
51
|
-
startedAt: payload.started_at != null ? (0, zeniDayJS_1.date)(payload.started_at) : undefined,
|
|
52
|
-
steps: payload.steps,
|
|
53
|
-
validationResults: payload.validation_results,
|
|
54
|
-
});
|
|
55
|
-
exports.toAiAccountantJob = toAiAccountantJob;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { AiAccountantCustomerPayload, AiAccountantJobPayload } from './aiAccountantCustomerPayload';
|
|
2
|
-
import { AiAccountantCustomerState } from './aiAccountantCustomerState';
|
|
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[], append?: boolean | undefined], {
|
|
5
|
-
tenantId: string;
|
|
6
|
-
jobs: AiAccountantJobPayload[];
|
|
7
|
-
append: boolean;
|
|
8
|
-
}, "aiAccountantCustomer/updateAiAccountantJobs", never, never>;
|
|
9
|
-
declare const _default: import("redux").Reducer<AiAccountantCustomerState>;
|
|
10
|
-
export default _default;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var _a;
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.updateAiAccountantJobs = exports.updateAiAccountantCustomer = exports.updateAiAccountantCustomers = exports.clearAllAiAccountantCustomers = exports.initialAiAccountantCustomerState = void 0;
|
|
5
|
-
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
-
const aiAccountantCustomerPayload_1 = require("./aiAccountantCustomerPayload");
|
|
7
|
-
exports.initialAiAccountantCustomerState = {
|
|
8
|
-
customerByTenantId: {},
|
|
9
|
-
jobsByTenantId: {},
|
|
10
|
-
};
|
|
11
|
-
const aiAccountantCustomer = (0, toolkit_1.createSlice)({
|
|
12
|
-
name: 'aiAccountantCustomer',
|
|
13
|
-
initialState: exports.initialAiAccountantCustomerState,
|
|
14
|
-
reducers: {
|
|
15
|
-
updateAiAccountantCustomers(draft, action) {
|
|
16
|
-
const newCustomerByTenantId = {};
|
|
17
|
-
action.payload.forEach((payload) => {
|
|
18
|
-
const customer = (0, aiAccountantCustomerPayload_1.toAiAccountantCustomer)(payload);
|
|
19
|
-
newCustomerByTenantId[customer.tenantId] = customer;
|
|
20
|
-
});
|
|
21
|
-
draft.customerByTenantId = newCustomerByTenantId;
|
|
22
|
-
},
|
|
23
|
-
updateAiAccountantCustomer(draft, action) {
|
|
24
|
-
const customer = (0, aiAccountantCustomerPayload_1.toAiAccountantCustomer)(action.payload);
|
|
25
|
-
draft.customerByTenantId[customer.tenantId] = customer;
|
|
26
|
-
},
|
|
27
|
-
updateAiAccountantJobs: {
|
|
28
|
-
reducer(draft, action) {
|
|
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
|
-
}
|
|
40
|
-
},
|
|
41
|
-
prepare(tenantId, jobs, append = false) {
|
|
42
|
-
return { payload: { tenantId, jobs, append } };
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
clearAllAiAccountantCustomers(draft) {
|
|
46
|
-
Object.assign(draft, exports.initialAiAccountantCustomerState);
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
});
|
|
50
|
-
_a = aiAccountantCustomer.actions, exports.clearAllAiAccountantCustomers = _a.clearAllAiAccountantCustomers, exports.updateAiAccountantCustomers = _a.updateAiAccountantCustomers, exports.updateAiAccountantCustomer = _a.updateAiAccountantCustomer, exports.updateAiAccountantJobs = _a.updateAiAccountantJobs;
|
|
51
|
-
exports.default = aiAccountantCustomer.reducer;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { ID } from '../../commonStateTypes/common';
|
|
2
|
-
import { User } from '../user/userState';
|
|
3
|
-
import { UserState } from '../user/userState';
|
|
4
|
-
import { ZeniDate } from '../../zeniDayJS';
|
|
5
|
-
import { AiAccountantCustomerState, AiAccountantEnrollmentStatus, AiAccountantJobStatus, AiAccountantOperationType } from './aiAccountantCustomerState';
|
|
6
|
-
export interface AiAccountantEnrollmentView {
|
|
7
|
-
status: AiAccountantEnrollmentStatus;
|
|
8
|
-
accuracy?: Record<string, number>;
|
|
9
|
-
latestTraining?: ZeniDate;
|
|
10
|
-
latestTransactionSync?: ZeniDate;
|
|
11
|
-
offboardedAt?: ZeniDate;
|
|
12
|
-
offboardedBy?: User;
|
|
13
|
-
onboardedAt?: ZeniDate;
|
|
14
|
-
onboardedBy?: User;
|
|
15
|
-
validationResults?: Array<{
|
|
16
|
-
accuracy: number;
|
|
17
|
-
modelType: string;
|
|
18
|
-
passed: boolean;
|
|
19
|
-
threshold: number;
|
|
20
|
-
}>;
|
|
21
|
-
}
|
|
22
|
-
export interface AiAccountantCustomerView {
|
|
23
|
-
averageAccuracy: number;
|
|
24
|
-
companyId: ID;
|
|
25
|
-
companyName: string;
|
|
26
|
-
tenantId: ID;
|
|
27
|
-
bookcloseDate?: ZeniDate;
|
|
28
|
-
enrollment?: AiAccountantEnrollmentView;
|
|
29
|
-
}
|
|
30
|
-
export interface AiAccountantJobView {
|
|
31
|
-
companyId: ID;
|
|
32
|
-
createdAt: ZeniDate;
|
|
33
|
-
jobId: ID;
|
|
34
|
-
operationType: AiAccountantOperationType;
|
|
35
|
-
status: AiAccountantJobStatus;
|
|
36
|
-
tenantId: ID;
|
|
37
|
-
companyNamespace?: string;
|
|
38
|
-
completedAt?: ZeniDate;
|
|
39
|
-
errorMessage?: string;
|
|
40
|
-
parameters?: Record<string, unknown>;
|
|
41
|
-
retryCount?: number;
|
|
42
|
-
startedAt?: ZeniDate;
|
|
43
|
-
steps?: Array<Record<string, unknown>>;
|
|
44
|
-
triggeredBy?: User;
|
|
45
|
-
validationResults?: Array<Record<string, unknown>>;
|
|
46
|
-
}
|
|
47
|
-
export declare function getAiAccountantCustomers(customerState: AiAccountantCustomerState, userState: UserState): AiAccountantCustomerView[];
|
|
48
|
-
export declare function getAiAccountantJobsByTenantId(customerState: AiAccountantCustomerState, userState: UserState, tenantId: string): AiAccountantJobView[];
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getAiAccountantCustomers = getAiAccountantCustomers;
|
|
4
|
-
exports.getAiAccountantJobsByTenantId = getAiAccountantJobsByTenantId;
|
|
5
|
-
const userSelector_1 = require("../user/userSelector");
|
|
6
|
-
// ── Selectors ──
|
|
7
|
-
function getAiAccountantCustomers(customerState, userState) {
|
|
8
|
-
return Object.values(customerState.customerByTenantId).map((customer) => toCustomerView(customer, userState));
|
|
9
|
-
}
|
|
10
|
-
function getAiAccountantJobsByTenantId(customerState, userState, tenantId) {
|
|
11
|
-
const jobs = customerState.jobsByTenantId[tenantId] ?? [];
|
|
12
|
-
return jobs.map((job) => toJobView(job, userState));
|
|
13
|
-
}
|
|
14
|
-
// ── Helpers ──
|
|
15
|
-
function toCustomerView(customer, userState) {
|
|
16
|
-
return {
|
|
17
|
-
averageAccuracy: calcAverageAccuracy(customer),
|
|
18
|
-
companyId: customer.companyId,
|
|
19
|
-
companyName: customer.companyName,
|
|
20
|
-
tenantId: customer.tenantId,
|
|
21
|
-
bookcloseDate: customer.bookcloseDate,
|
|
22
|
-
enrollment: customer.enrollment != null
|
|
23
|
-
? {
|
|
24
|
-
...customer.enrollment,
|
|
25
|
-
offboardedBy: customer.enrollment.offboardedBy != null
|
|
26
|
-
? (0, userSelector_1.getUserByUserId)(userState, customer.enrollment.offboardedBy)
|
|
27
|
-
: undefined,
|
|
28
|
-
onboardedBy: customer.enrollment.onboardedBy != null
|
|
29
|
-
? (0, userSelector_1.getUserByUserId)(userState, customer.enrollment.onboardedBy)
|
|
30
|
-
: undefined,
|
|
31
|
-
}
|
|
32
|
-
: undefined,
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
function toJobView(job, userState) {
|
|
36
|
-
return {
|
|
37
|
-
companyId: job.companyId,
|
|
38
|
-
createdAt: job.createdAt,
|
|
39
|
-
jobId: job.jobId,
|
|
40
|
-
operationType: job.operationType,
|
|
41
|
-
status: job.status,
|
|
42
|
-
tenantId: job.tenantId,
|
|
43
|
-
triggeredBy: job.triggeredBy != null
|
|
44
|
-
? (0, userSelector_1.getUserByUserId)(userState, job.triggeredBy)
|
|
45
|
-
: undefined,
|
|
46
|
-
companyNamespace: job.companyNamespace,
|
|
47
|
-
completedAt: job.completedAt,
|
|
48
|
-
errorMessage: job.errorMessage,
|
|
49
|
-
parameters: job.parameters,
|
|
50
|
-
retryCount: job.retryCount,
|
|
51
|
-
startedAt: job.startedAt,
|
|
52
|
-
steps: job.steps,
|
|
53
|
-
validationResults: job.validationResults,
|
|
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
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { ID } from '../../commonStateTypes/common';
|
|
2
|
-
import { ZeniDate } from '../../zeniDayJS';
|
|
3
|
-
export declare const toAiAccountantOperationType: (v: string) => "onboard" | "offboard" | "retrain" | "full_pipeline" | "cancel_onboarding";
|
|
4
|
-
export type AiAccountantOperationType = ReturnType<typeof toAiAccountantOperationType>;
|
|
5
|
-
export declare const toAiAccountantEnrollmentStatus: (v: string) => "onboarding" | "error" | "active" | "pending" | "offboarding" | "offboarded" | "failed";
|
|
6
|
-
export type AiAccountantEnrollmentStatus = ReturnType<typeof toAiAccountantEnrollmentStatus>;
|
|
7
|
-
export declare const toAiAccountantJobStatus: (v: string) => "failed" | "queued" | "running" | "completed" | "cancelled" | "retried";
|
|
8
|
-
export type AiAccountantJobStatus = ReturnType<typeof toAiAccountantJobStatus>;
|
|
9
|
-
export interface AiAccountantEnrollment {
|
|
10
|
-
status: AiAccountantEnrollmentStatus;
|
|
11
|
-
accuracy?: Record<string, number>;
|
|
12
|
-
latestTraining?: ZeniDate;
|
|
13
|
-
latestTransactionSync?: ZeniDate;
|
|
14
|
-
offboardedAt?: ZeniDate;
|
|
15
|
-
offboardedBy?: ID;
|
|
16
|
-
onboardedAt?: ZeniDate;
|
|
17
|
-
onboardedBy?: ID;
|
|
18
|
-
validationResults?: Array<{
|
|
19
|
-
accuracy: number;
|
|
20
|
-
modelType: string;
|
|
21
|
-
passed: boolean;
|
|
22
|
-
threshold: number;
|
|
23
|
-
}>;
|
|
24
|
-
}
|
|
25
|
-
export interface AiAccountantJob {
|
|
26
|
-
companyId: ID;
|
|
27
|
-
createdAt: ZeniDate;
|
|
28
|
-
jobId: ID;
|
|
29
|
-
operationType: AiAccountantOperationType;
|
|
30
|
-
status: AiAccountantJobStatus;
|
|
31
|
-
tenantId: ID;
|
|
32
|
-
triggeredBy: ID;
|
|
33
|
-
companyNamespace?: string;
|
|
34
|
-
completedAt?: ZeniDate;
|
|
35
|
-
errorMessage?: string;
|
|
36
|
-
parameters?: Record<string, unknown>;
|
|
37
|
-
retryCount?: number;
|
|
38
|
-
startedAt?: ZeniDate;
|
|
39
|
-
steps?: Array<Record<string, unknown>>;
|
|
40
|
-
validationResults?: Array<Record<string, unknown>>;
|
|
41
|
-
}
|
|
42
|
-
export interface AiAccountantCustomer {
|
|
43
|
-
companyId: ID;
|
|
44
|
-
companyName: string;
|
|
45
|
-
tenantId: ID;
|
|
46
|
-
bookcloseDate?: ZeniDate;
|
|
47
|
-
enrollment?: AiAccountantEnrollment;
|
|
48
|
-
}
|
|
49
|
-
export interface AiAccountantCustomerState {
|
|
50
|
-
customerByTenantId: Record<ID, AiAccountantCustomer>;
|
|
51
|
-
jobsByTenantId: Record<ID, AiAccountantJob[]>;
|
|
52
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toAiAccountantJobStatus = exports.toAiAccountantEnrollmentStatus = exports.toAiAccountantOperationType = void 0;
|
|
4
|
-
const stringToUnion_1 = require("../../commonStateTypes/stringToUnion");
|
|
5
|
-
// ── Operation Type ──
|
|
6
|
-
const ALL_OPERATION_TYPES = [
|
|
7
|
-
'onboard',
|
|
8
|
-
'offboard',
|
|
9
|
-
'retrain',
|
|
10
|
-
'full_pipeline',
|
|
11
|
-
'cancel_onboarding',
|
|
12
|
-
];
|
|
13
|
-
const toAiAccountantOperationType = (v) => (0, stringToUnion_1.stringToUnion)(v, ALL_OPERATION_TYPES);
|
|
14
|
-
exports.toAiAccountantOperationType = toAiAccountantOperationType;
|
|
15
|
-
// ── Enrollment Status ──
|
|
16
|
-
const ALL_ENROLLMENT_STATUSES = [
|
|
17
|
-
'active',
|
|
18
|
-
'pending',
|
|
19
|
-
'onboarding',
|
|
20
|
-
'offboarding',
|
|
21
|
-
'offboarded',
|
|
22
|
-
'failed',
|
|
23
|
-
'error',
|
|
24
|
-
];
|
|
25
|
-
const toAiAccountantEnrollmentStatus = (v) => (0, stringToUnion_1.stringToUnion)(v, ALL_ENROLLMENT_STATUSES);
|
|
26
|
-
exports.toAiAccountantEnrollmentStatus = toAiAccountantEnrollmentStatus;
|
|
27
|
-
// ── Job Status ──
|
|
28
|
-
const ALL_JOB_STATUSES = [
|
|
29
|
-
'queued',
|
|
30
|
-
'running',
|
|
31
|
-
'completed',
|
|
32
|
-
'failed',
|
|
33
|
-
'cancelled',
|
|
34
|
-
'retried',
|
|
35
|
-
];
|
|
36
|
-
const toAiAccountantJobStatus = (v) => (0, stringToUnion_1.stringToUnion)(v, ALL_JOB_STATUSES);
|
|
37
|
-
exports.toAiAccountantJobStatus = toAiAccountantJobStatus;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { date } from '../../zeniDayJS';
|
|
2
|
-
import { toAiAccountantEnrollmentStatus, toAiAccountantJobStatus, toAiAccountantOperationType, } from './aiAccountantCustomerState';
|
|
3
|
-
// ── Mapping functions (payload → state) ──
|
|
4
|
-
export const toAiAccountantEnrollment = (payload) => ({
|
|
5
|
-
status: toAiAccountantEnrollmentStatus(payload.status),
|
|
6
|
-
accuracy: payload.accuracy,
|
|
7
|
-
latestTraining: payload.latest_training != null
|
|
8
|
-
? date(payload.latest_training)
|
|
9
|
-
: undefined,
|
|
10
|
-
latestTransactionSync: payload.latest_transaction_sync != null
|
|
11
|
-
? date(payload.latest_transaction_sync)
|
|
12
|
-
: undefined,
|
|
13
|
-
offboardedAt: payload.offboarded_at != null ? date(payload.offboarded_at) : undefined,
|
|
14
|
-
offboardedBy: payload.offboarded_by,
|
|
15
|
-
onboardedAt: payload.onboarded_at != null ? date(payload.onboarded_at) : undefined,
|
|
16
|
-
onboardedBy: payload.onboarded_by,
|
|
17
|
-
validationResults: payload.validation_results?.map((vr) => ({
|
|
18
|
-
accuracy: vr.accuracy,
|
|
19
|
-
modelType: vr.model_type,
|
|
20
|
-
passed: vr.passed,
|
|
21
|
-
threshold: vr.threshold,
|
|
22
|
-
})),
|
|
23
|
-
});
|
|
24
|
-
export const toAiAccountantCustomer = (payload) => ({
|
|
25
|
-
companyId: payload.company_id,
|
|
26
|
-
companyName: payload.company_name,
|
|
27
|
-
tenantId: payload.tenant_id,
|
|
28
|
-
bookcloseDate: payload.bookclose_date != null ? date(payload.bookclose_date) : undefined,
|
|
29
|
-
enrollment: payload.enrollment != null
|
|
30
|
-
? toAiAccountantEnrollment(payload.enrollment)
|
|
31
|
-
: undefined,
|
|
32
|
-
});
|
|
33
|
-
export const toAiAccountantJob = (payload) => ({
|
|
34
|
-
companyId: payload.company_id,
|
|
35
|
-
createdAt: date(payload.created_at),
|
|
36
|
-
jobId: payload.job_id,
|
|
37
|
-
operationType: toAiAccountantOperationType(payload.operation_type),
|
|
38
|
-
status: toAiAccountantJobStatus(payload.status),
|
|
39
|
-
tenantId: payload.tenant_id,
|
|
40
|
-
triggeredBy: payload.triggered_by,
|
|
41
|
-
companyNamespace: payload.company_namespace,
|
|
42
|
-
completedAt: payload.completed_at != null ? date(payload.completed_at) : undefined,
|
|
43
|
-
errorMessage: payload.error_message,
|
|
44
|
-
parameters: payload.parameters,
|
|
45
|
-
retryCount: payload.retry_count,
|
|
46
|
-
startedAt: payload.started_at != null ? date(payload.started_at) : undefined,
|
|
47
|
-
steps: payload.steps,
|
|
48
|
-
validationResults: payload.validation_results,
|
|
49
|
-
});
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
-
import { toAiAccountantCustomer, toAiAccountantJob, } from './aiAccountantCustomerPayload';
|
|
3
|
-
export const initialAiAccountantCustomerState = {
|
|
4
|
-
customerByTenantId: {},
|
|
5
|
-
jobsByTenantId: {},
|
|
6
|
-
};
|
|
7
|
-
const aiAccountantCustomer = createSlice({
|
|
8
|
-
name: 'aiAccountantCustomer',
|
|
9
|
-
initialState: initialAiAccountantCustomerState,
|
|
10
|
-
reducers: {
|
|
11
|
-
updateAiAccountantCustomers(draft, action) {
|
|
12
|
-
const newCustomerByTenantId = {};
|
|
13
|
-
action.payload.forEach((payload) => {
|
|
14
|
-
const customer = toAiAccountantCustomer(payload);
|
|
15
|
-
newCustomerByTenantId[customer.tenantId] = customer;
|
|
16
|
-
});
|
|
17
|
-
draft.customerByTenantId = newCustomerByTenantId;
|
|
18
|
-
},
|
|
19
|
-
updateAiAccountantCustomer(draft, action) {
|
|
20
|
-
const customer = toAiAccountantCustomer(action.payload);
|
|
21
|
-
draft.customerByTenantId[customer.tenantId] = customer;
|
|
22
|
-
},
|
|
23
|
-
updateAiAccountantJobs: {
|
|
24
|
-
reducer(draft, action) {
|
|
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
|
-
}
|
|
36
|
-
},
|
|
37
|
-
prepare(tenantId, jobs, append = false) {
|
|
38
|
-
return { payload: { tenantId, jobs, append } };
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
clearAllAiAccountantCustomers(draft) {
|
|
42
|
-
Object.assign(draft, initialAiAccountantCustomerState);
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
});
|
|
46
|
-
export const { clearAllAiAccountantCustomers, updateAiAccountantCustomers, updateAiAccountantCustomer, updateAiAccountantJobs, } = aiAccountantCustomer.actions;
|
|
47
|
-
export default aiAccountantCustomer.reducer;
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { getUserByUserId } from '../user/userSelector';
|
|
2
|
-
// ── Selectors ──
|
|
3
|
-
export function getAiAccountantCustomers(customerState, userState) {
|
|
4
|
-
return Object.values(customerState.customerByTenantId).map((customer) => toCustomerView(customer, userState));
|
|
5
|
-
}
|
|
6
|
-
export function getAiAccountantJobsByTenantId(customerState, userState, tenantId) {
|
|
7
|
-
const jobs = customerState.jobsByTenantId[tenantId] ?? [];
|
|
8
|
-
return jobs.map((job) => toJobView(job, userState));
|
|
9
|
-
}
|
|
10
|
-
// ── Helpers ──
|
|
11
|
-
function toCustomerView(customer, userState) {
|
|
12
|
-
return {
|
|
13
|
-
averageAccuracy: calcAverageAccuracy(customer),
|
|
14
|
-
companyId: customer.companyId,
|
|
15
|
-
companyName: customer.companyName,
|
|
16
|
-
tenantId: customer.tenantId,
|
|
17
|
-
bookcloseDate: customer.bookcloseDate,
|
|
18
|
-
enrollment: customer.enrollment != null
|
|
19
|
-
? {
|
|
20
|
-
...customer.enrollment,
|
|
21
|
-
offboardedBy: customer.enrollment.offboardedBy != null
|
|
22
|
-
? getUserByUserId(userState, customer.enrollment.offboardedBy)
|
|
23
|
-
: undefined,
|
|
24
|
-
onboardedBy: customer.enrollment.onboardedBy != null
|
|
25
|
-
? getUserByUserId(userState, customer.enrollment.onboardedBy)
|
|
26
|
-
: undefined,
|
|
27
|
-
}
|
|
28
|
-
: undefined,
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
function toJobView(job, userState) {
|
|
32
|
-
return {
|
|
33
|
-
companyId: job.companyId,
|
|
34
|
-
createdAt: job.createdAt,
|
|
35
|
-
jobId: job.jobId,
|
|
36
|
-
operationType: job.operationType,
|
|
37
|
-
status: job.status,
|
|
38
|
-
tenantId: job.tenantId,
|
|
39
|
-
triggeredBy: job.triggeredBy != null
|
|
40
|
-
? getUserByUserId(userState, job.triggeredBy)
|
|
41
|
-
: undefined,
|
|
42
|
-
companyNamespace: job.companyNamespace,
|
|
43
|
-
completedAt: job.completedAt,
|
|
44
|
-
errorMessage: job.errorMessage,
|
|
45
|
-
parameters: job.parameters,
|
|
46
|
-
retryCount: job.retryCount,
|
|
47
|
-
startedAt: job.startedAt,
|
|
48
|
-
steps: job.steps,
|
|
49
|
-
validationResults: job.validationResults,
|
|
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
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { stringToUnion } from '../../commonStateTypes/stringToUnion';
|
|
2
|
-
// ── Operation Type ──
|
|
3
|
-
const ALL_OPERATION_TYPES = [
|
|
4
|
-
'onboard',
|
|
5
|
-
'offboard',
|
|
6
|
-
'retrain',
|
|
7
|
-
'full_pipeline',
|
|
8
|
-
'cancel_onboarding',
|
|
9
|
-
];
|
|
10
|
-
export const toAiAccountantOperationType = (v) => stringToUnion(v, ALL_OPERATION_TYPES);
|
|
11
|
-
// ── Enrollment Status ──
|
|
12
|
-
const ALL_ENROLLMENT_STATUSES = [
|
|
13
|
-
'active',
|
|
14
|
-
'pending',
|
|
15
|
-
'onboarding',
|
|
16
|
-
'offboarding',
|
|
17
|
-
'offboarded',
|
|
18
|
-
'failed',
|
|
19
|
-
'error',
|
|
20
|
-
];
|
|
21
|
-
export const toAiAccountantEnrollmentStatus = (v) => stringToUnion(v, ALL_ENROLLMENT_STATUSES);
|
|
22
|
-
// ── Job Status ──
|
|
23
|
-
const ALL_JOB_STATUSES = [
|
|
24
|
-
'queued',
|
|
25
|
-
'running',
|
|
26
|
-
'completed',
|
|
27
|
-
'failed',
|
|
28
|
-
'cancelled',
|
|
29
|
-
'retried',
|
|
30
|
-
];
|
|
31
|
-
export const toAiAccountantJobStatus = (v) => stringToUnion(v, ALL_JOB_STATUSES);
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
-
export const initialAiAccountantViewState = {
|
|
3
|
-
customersByTenantId: {},
|
|
4
|
-
customersFetchStatus: { fetchState: 'Not-Started' },
|
|
5
|
-
selectedTenantIdsForJobTrigger: [],
|
|
6
|
-
triggerJobStatus: { fetchState: 'Not-Started' },
|
|
7
|
-
uiState: {
|
|
8
|
-
filterText: '',
|
|
9
|
-
filters: {},
|
|
10
|
-
selectedCustomerTenantId: '',
|
|
11
|
-
sortKey: 'companyName',
|
|
12
|
-
sortOrder: 'ascending',
|
|
13
|
-
},
|
|
14
|
-
};
|
|
15
|
-
const aiAccountantView = createSlice({
|
|
16
|
-
name: 'aiAccountantView',
|
|
17
|
-
initialState: initialAiAccountantViewState,
|
|
18
|
-
reducers: {
|
|
19
|
-
// ── Customers ──
|
|
20
|
-
fetchAiAccountantCustomers(draft) {
|
|
21
|
-
draft.customersFetchStatus = { fetchState: 'In-Progress' };
|
|
22
|
-
},
|
|
23
|
-
updateAiAccountantCustomers(draft, action) {
|
|
24
|
-
draft.customersByTenantId = toCustomersByTenantId(action.payload, draft.customersByTenantId);
|
|
25
|
-
draft.customersFetchStatus = { fetchState: 'Completed' };
|
|
26
|
-
},
|
|
27
|
-
updateAiAccountantCustomersFailure(draft, action) {
|
|
28
|
-
draft.customersFetchStatus = {
|
|
29
|
-
fetchState: 'Error',
|
|
30
|
-
error: action.payload,
|
|
31
|
-
};
|
|
32
|
-
},
|
|
33
|
-
// ── Jobs ──
|
|
34
|
-
fetchAiAccountantJobs: {
|
|
35
|
-
reducer(draft, action) {
|
|
36
|
-
const customerView = draft.customersByTenantId[action.payload.tenantId];
|
|
37
|
-
if (customerView != null) {
|
|
38
|
-
customerView.jobsFetchStatus = { fetchState: 'In-Progress' };
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
prepare(tenantId, fetchNextPage) {
|
|
42
|
-
return { payload: { tenantId, fetchNextPage: fetchNextPage ?? false } };
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
updateAiAccountantJobs: {
|
|
46
|
-
reducer(draft, action) {
|
|
47
|
-
const customerView = draft.customersByTenantId[action.payload.tenantId];
|
|
48
|
-
if (customerView != null) {
|
|
49
|
-
customerView.jobsFetchStatus = { fetchState: 'Completed' };
|
|
50
|
-
customerView.jobsPageToken = action.payload.nextPageToken;
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
prepare(tenantId, nextPageToken) {
|
|
54
|
-
return { payload: { tenantId, nextPageToken: nextPageToken ?? null } };
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
updateAiAccountantJobsFailure(draft, action) {
|
|
58
|
-
const customerView = draft.customersByTenantId[action.payload.tenantId];
|
|
59
|
-
if (customerView != null) {
|
|
60
|
-
customerView.jobsFetchStatus = {
|
|
61
|
-
fetchState: 'Error',
|
|
62
|
-
error: action.payload.error,
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
setSelectedTenantIdsForJobTrigger(draft, action) {
|
|
67
|
-
draft.selectedTenantIdsForJobTrigger = action.payload;
|
|
68
|
-
},
|
|
69
|
-
// ── Trigger Job ──
|
|
70
|
-
triggerAiAccountantJob: {
|
|
71
|
-
reducer(draft,
|
|
72
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
73
|
-
_action) {
|
|
74
|
-
draft.triggerJobStatus = { fetchState: 'In-Progress' };
|
|
75
|
-
},
|
|
76
|
-
prepare(operationType, startDate, endDate) {
|
|
77
|
-
return { payload: { operationType, startDate, endDate } };
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
triggerAiAccountantJobSuccess(draft) {
|
|
81
|
-
draft.triggerJobStatus = { fetchState: 'Completed' };
|
|
82
|
-
},
|
|
83
|
-
triggerAiAccountantJobFailure(draft, action) {
|
|
84
|
-
draft.triggerJobStatus = { fetchState: 'Error', error: action.payload };
|
|
85
|
-
},
|
|
86
|
-
// ── Cancel Onboarding ──
|
|
87
|
-
cancelAiAccountantOnboarding: {
|
|
88
|
-
reducer(draft, action) {
|
|
89
|
-
const customerView = draft.customersByTenantId[action.payload.tenantId];
|
|
90
|
-
if (customerView != null) {
|
|
91
|
-
customerView.cancelOnboardingStatus = { fetchState: 'In-Progress' };
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
prepare(companyId, tenantId) {
|
|
95
|
-
return { payload: { companyId, tenantId } };
|
|
96
|
-
},
|
|
97
|
-
},
|
|
98
|
-
cancelAiAccountantOnboardingSuccess: {
|
|
99
|
-
reducer(draft, action) {
|
|
100
|
-
const customerView = draft.customersByTenantId[action.payload.tenantId];
|
|
101
|
-
if (customerView != null) {
|
|
102
|
-
customerView.cancelOnboardingStatus = { fetchState: 'Completed' };
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
prepare(tenantId) {
|
|
106
|
-
return { payload: { tenantId } };
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
cancelAiAccountantOnboardingFailure: {
|
|
110
|
-
reducer(draft, action) {
|
|
111
|
-
const customerView = draft.customersByTenantId[action.payload.tenantId];
|
|
112
|
-
if (customerView != null) {
|
|
113
|
-
customerView.cancelOnboardingStatus = {
|
|
114
|
-
fetchState: 'Error',
|
|
115
|
-
error: action.payload.error,
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
|
-
prepare(tenantId, error) {
|
|
120
|
-
return { payload: { tenantId, error } };
|
|
121
|
-
},
|
|
122
|
-
},
|
|
123
|
-
// ── UI State ──
|
|
124
|
-
updateAiAccountantUIState(draft, action) {
|
|
125
|
-
Object.assign(draft.uiState, action.payload);
|
|
126
|
-
},
|
|
127
|
-
// ── Clear ──
|
|
128
|
-
clearAiAccountantView() {
|
|
129
|
-
return initialAiAccountantViewState;
|
|
130
|
-
},
|
|
131
|
-
},
|
|
132
|
-
});
|
|
133
|
-
export const { cancelAiAccountantOnboarding, cancelAiAccountantOnboardingFailure, cancelAiAccountantOnboardingSuccess, clearAiAccountantView, fetchAiAccountantCustomers, fetchAiAccountantJobs, setSelectedTenantIdsForJobTrigger, triggerAiAccountantJob, triggerAiAccountantJobFailure, triggerAiAccountantJobSuccess, updateAiAccountantCustomers, updateAiAccountantCustomersFailure, updateAiAccountantJobs, updateAiAccountantJobsFailure, updateAiAccountantUIState, } = aiAccountantView.actions;
|
|
134
|
-
export default aiAccountantView.reducer;
|
|
135
|
-
// ── Helpers ──
|
|
136
|
-
const toCustomersByTenantId = (customers, existing) => {
|
|
137
|
-
const result = {};
|
|
138
|
-
for (const payload of customers) {
|
|
139
|
-
const tenantId = payload.tenant_id;
|
|
140
|
-
const existingState = existing[tenantId];
|
|
141
|
-
result[tenantId] = existingState ?? {
|
|
142
|
-
cancelOnboardingStatus: { fetchState: 'Not-Started' },
|
|
143
|
-
jobsFetchStatus: { fetchState: 'Not-Started' },
|
|
144
|
-
jobsPageToken: null,
|
|
145
|
-
tenantId,
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
return result;
|
|
149
|
-
};
|