@zeniai/client-epic-state 4.19.77-betaML99 → 4.19.77-betaSS2

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.
Files changed (37) hide show
  1. package/lib/epic.d.ts +5 -1
  2. package/lib/epic.js +5 -1
  3. package/lib/esm/epic.js +5 -1
  4. package/lib/esm/index.js +2 -0
  5. package/lib/esm/reducer.js +3 -0
  6. package/lib/esm/view/creditAgentView/creditAgentViewPayload.js +1 -0
  7. package/lib/esm/view/creditAgentView/creditAgentViewReducer.js +113 -0
  8. package/lib/esm/view/creditAgentView/creditAgentViewSelector.js +3 -0
  9. package/lib/esm/view/creditAgentView/creditAgentViewState.js +18 -0
  10. package/lib/esm/view/creditAgentView/epics/fetchCreditAgentMacroEpic.js +16 -0
  11. package/lib/esm/view/creditAgentView/epics/fetchTenantCreditScoreReportEpic.js +16 -0
  12. package/lib/esm/view/creditAgentView/epics/saveCreditAgentMacroEpic.js +23 -0
  13. package/lib/esm/view/creditAgentView/epics/scheduleTenantCreditScoreCronEpic.js +19 -0
  14. package/lib/esm/view/taskManager/taskDetailView/taskDetailSelector.js +2 -2
  15. package/lib/index.d.ts +3 -0
  16. package/lib/index.js +20 -1
  17. package/lib/reducer.d.ts +3 -0
  18. package/lib/reducer.js +3 -0
  19. package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
  20. package/lib/view/creditAgentView/creditAgentViewPayload.d.ts +64 -0
  21. package/lib/view/creditAgentView/creditAgentViewPayload.js +2 -0
  22. package/lib/view/creditAgentView/creditAgentViewReducer.d.ts +11 -0
  23. package/lib/view/creditAgentView/creditAgentViewReducer.js +117 -0
  24. package/lib/view/creditAgentView/creditAgentViewSelector.d.ts +17 -0
  25. package/lib/view/creditAgentView/creditAgentViewSelector.js +9 -0
  26. package/lib/view/creditAgentView/creditAgentViewState.d.ts +58 -0
  27. package/lib/view/creditAgentView/creditAgentViewState.js +21 -0
  28. package/lib/view/creditAgentView/epics/fetchCreditAgentMacroEpic.d.ts +12 -0
  29. package/lib/view/creditAgentView/epics/fetchCreditAgentMacroEpic.js +20 -0
  30. package/lib/view/creditAgentView/epics/fetchTenantCreditScoreReportEpic.d.ts +12 -0
  31. package/lib/view/creditAgentView/epics/fetchTenantCreditScoreReportEpic.js +20 -0
  32. package/lib/view/creditAgentView/epics/saveCreditAgentMacroEpic.d.ts +12 -0
  33. package/lib/view/creditAgentView/epics/saveCreditAgentMacroEpic.js +27 -0
  34. package/lib/view/creditAgentView/epics/scheduleTenantCreditScoreCronEpic.d.ts +12 -0
  35. package/lib/view/creditAgentView/epics/scheduleTenantCreditScoreCronEpic.js +23 -0
  36. package/lib/view/taskManager/taskDetailView/taskDetailSelector.js +2 -2
  37. package/package.json +54 -28
@@ -0,0 +1,64 @@
1
+ export interface TenantCreditScoreRowPayload {
2
+ burn_rate_monthly: number;
3
+ cards: string;
4
+ confidence: number;
5
+ cons: string;
6
+ conservative_limit_rationale: string;
7
+ controller_name: string;
8
+ credit_amount: number;
9
+ credit_limit: number;
10
+ credit_score: string;
11
+ customer_name: string;
12
+ going_concern_analysis: string;
13
+ health_monitor_score: number;
14
+ key_ratios: Record<string, unknown>;
15
+ liberal_credit_limit: number;
16
+ liberal_limit_rationale: string;
17
+ period: string;
18
+ pros: string;
19
+ reasoning: string;
20
+ run_date: string;
21
+ runway: number;
22
+ status: string;
23
+ total_card_balance: number;
24
+ total_cash_balance: number;
25
+ }
26
+ export interface TenantCreditScoreReportPayload {
27
+ count: number;
28
+ report: TenantCreditScoreRowPayload[];
29
+ }
30
+ export interface TenantCreditScoreReportResponse {
31
+ data: TenantCreditScoreReportPayload;
32
+ status: {
33
+ code: number;
34
+ message: string;
35
+ };
36
+ }
37
+ export interface ScheduleCreditScoreCronResponse {
38
+ data: string;
39
+ status: {
40
+ code: number;
41
+ message: string;
42
+ };
43
+ }
44
+ export interface MacroPayload {
45
+ created_at: string;
46
+ creator_id: string;
47
+ description: string;
48
+ instructions: string;
49
+ is_active: boolean;
50
+ is_latest: boolean;
51
+ macro_id: string;
52
+ name: string;
53
+ parameters_schema: Record<string, unknown> | null;
54
+ tenant_id: string | null;
55
+ updated_at: string;
56
+ version: number;
57
+ }
58
+ export interface MacroResponse {
59
+ data: MacroPayload;
60
+ status: {
61
+ code: number;
62
+ message: string;
63
+ };
64
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,11 @@
1
+ import { ZeniAPIStatus } from '../../responsePayload';
2
+ import { MacroPayload, TenantCreditScoreReportPayload } from './creditAgentViewPayload';
3
+ import { CreditAgentViewState, initialCreditAgentViewState } from './creditAgentViewState';
4
+ export declare const fetchTenantCreditScoreReport: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"creditAgentView/fetchTenantCreditScoreReport">, updateTenantCreditScoreReport: import("@reduxjs/toolkit").ActionCreatorWithPayload<TenantCreditScoreReportPayload, "creditAgentView/updateTenantCreditScoreReport">, updateTenantCreditScoreReportFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "creditAgentView/updateTenantCreditScoreReportFailure">, scheduleTenantCreditScoreCron: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
5
+ tenantId?: string;
6
+ }, "creditAgentView/scheduleTenantCreditScoreCron">, scheduleTenantCreditScoreCronSuccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"creditAgentView/scheduleTenantCreditScoreCronSuccess">, scheduleTenantCreditScoreCronFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "creditAgentView/scheduleTenantCreditScoreCronFailure">, resetScheduleCronState: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"creditAgentView/resetScheduleCronState">, fetchCreditAgentMacro: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"creditAgentView/fetchCreditAgentMacro">, updateCreditAgentMacro: import("@reduxjs/toolkit").ActionCreatorWithPayload<MacroPayload, "creditAgentView/updateCreditAgentMacro">, updateCreditAgentMacroFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "creditAgentView/updateCreditAgentMacroFailure">, saveCreditAgentMacro: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
7
+ instructions: string;
8
+ }, "creditAgentView/saveCreditAgentMacro">, saveCreditAgentMacroSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<MacroPayload, "creditAgentView/saveCreditAgentMacroSuccess">, saveCreditAgentMacroFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "creditAgentView/saveCreditAgentMacroFailure">, resetSaveMacroState: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"creditAgentView/resetSaveMacroState">;
9
+ export { initialCreditAgentViewState as initialState, CreditAgentViewState };
10
+ declare const _default: import("redux").Reducer<CreditAgentViewState>;
11
+ export default _default;
@@ -0,0 +1,117 @@
1
+ "use strict";
2
+ var _a;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.initialState = exports.resetSaveMacroState = exports.saveCreditAgentMacroFailure = exports.saveCreditAgentMacroSuccess = exports.saveCreditAgentMacro = exports.updateCreditAgentMacroFailure = exports.updateCreditAgentMacro = exports.fetchCreditAgentMacro = exports.resetScheduleCronState = exports.scheduleTenantCreditScoreCronFailure = exports.scheduleTenantCreditScoreCronSuccess = exports.scheduleTenantCreditScoreCron = exports.updateTenantCreditScoreReportFailure = exports.updateTenantCreditScoreReport = exports.fetchTenantCreditScoreReport = void 0;
5
+ const toolkit_1 = require("@reduxjs/toolkit");
6
+ const creditAgentViewState_1 = require("./creditAgentViewState");
7
+ Object.defineProperty(exports, "initialState", { enumerable: true, get: function () { return creditAgentViewState_1.initialCreditAgentViewState; } });
8
+ const creditAgentView = (0, toolkit_1.createSlice)({
9
+ name: 'creditAgentView',
10
+ initialState: creditAgentViewState_1.initialCreditAgentViewState,
11
+ reducers: {
12
+ fetchTenantCreditScoreReport(draft) {
13
+ draft.report.fetchState = 'In-Progress';
14
+ draft.report.error = undefined;
15
+ },
16
+ updateTenantCreditScoreReport(draft, action) {
17
+ draft.report.fetchState = 'Completed';
18
+ draft.report.error = undefined;
19
+ draft.report.rows = action.payload.report.map((row) => ({
20
+ customerName: row.customer_name,
21
+ totalCashBalance: row.total_cash_balance,
22
+ totalCardBalance: row.total_card_balance,
23
+ cards: row.cards,
24
+ controllerName: row.controller_name,
25
+ period: row.period,
26
+ runway: row.runway,
27
+ burnRateMonthly: row.burn_rate_monthly,
28
+ healthMonitorScore: row.health_monitor_score,
29
+ creditScore: row.credit_score,
30
+ confidence: row.confidence,
31
+ creditAmount: row.credit_amount,
32
+ creditLimit: row.credit_limit,
33
+ conservativeLimitRationale: row.conservative_limit_rationale,
34
+ liberalCreditLimit: row.liberal_credit_limit,
35
+ liberalLimitRationale: row.liberal_limit_rationale,
36
+ pros: row.pros,
37
+ cons: row.cons,
38
+ reasoning: row.reasoning,
39
+ goingConcernAnalysis: row.going_concern_analysis,
40
+ keyRatios: row.key_ratios,
41
+ runDate: row.run_date,
42
+ status: row.status,
43
+ }));
44
+ draft.report.count = action.payload.count;
45
+ },
46
+ updateTenantCreditScoreReportFailure(draft, action) {
47
+ draft.report.fetchState = 'Error';
48
+ draft.report.error = action.payload;
49
+ },
50
+ scheduleTenantCreditScoreCron(draft,
51
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
52
+ _action) {
53
+ draft.scheduleCron.fetchState = 'In-Progress';
54
+ draft.scheduleCron.error = undefined;
55
+ },
56
+ scheduleTenantCreditScoreCronSuccess(draft) {
57
+ draft.scheduleCron.fetchState = 'Completed';
58
+ draft.scheduleCron.error = undefined;
59
+ },
60
+ scheduleTenantCreditScoreCronFailure(draft, action) {
61
+ draft.scheduleCron.fetchState = 'Error';
62
+ draft.scheduleCron.error = action.payload;
63
+ },
64
+ resetScheduleCronState(draft) {
65
+ draft.scheduleCron.fetchState = 'Not-Started';
66
+ draft.scheduleCron.error = undefined;
67
+ },
68
+ fetchCreditAgentMacro(draft) {
69
+ draft.macro.fetchState = 'In-Progress';
70
+ draft.macro.error = undefined;
71
+ },
72
+ updateCreditAgentMacro(draft, action) {
73
+ draft.macro.fetchState = 'Completed';
74
+ draft.macro.error = undefined;
75
+ draft.macro.data = mapMacroPayload(action.payload);
76
+ },
77
+ updateCreditAgentMacroFailure(draft, action) {
78
+ draft.macro.fetchState = 'Error';
79
+ draft.macro.error = action.payload;
80
+ },
81
+ saveCreditAgentMacro(draft,
82
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
83
+ _action) {
84
+ draft.macro.updateState = 'In-Progress';
85
+ draft.macro.error = undefined;
86
+ },
87
+ saveCreditAgentMacroSuccess(draft, action) {
88
+ draft.macro.updateState = 'Completed';
89
+ draft.macro.error = undefined;
90
+ draft.macro.data = mapMacroPayload(action.payload);
91
+ },
92
+ saveCreditAgentMacroFailure(draft, action) {
93
+ draft.macro.updateState = 'Error';
94
+ draft.macro.error = action.payload;
95
+ },
96
+ resetSaveMacroState(draft) {
97
+ draft.macro.updateState = 'Not-Started';
98
+ draft.macro.error = undefined;
99
+ },
100
+ },
101
+ });
102
+ function mapMacroPayload(payload) {
103
+ return {
104
+ macroId: payload.macro_id,
105
+ version: payload.version,
106
+ isLatest: payload.is_latest,
107
+ isActive: payload.is_active,
108
+ name: payload.name,
109
+ description: payload.description,
110
+ instructions: payload.instructions,
111
+ tenantId: payload.tenant_id,
112
+ createdAt: payload.created_at,
113
+ updatedAt: payload.updated_at,
114
+ };
115
+ }
116
+ _a = creditAgentView.actions, exports.fetchTenantCreditScoreReport = _a.fetchTenantCreditScoreReport, exports.updateTenantCreditScoreReport = _a.updateTenantCreditScoreReport, exports.updateTenantCreditScoreReportFailure = _a.updateTenantCreditScoreReportFailure, exports.scheduleTenantCreditScoreCron = _a.scheduleTenantCreditScoreCron, exports.scheduleTenantCreditScoreCronSuccess = _a.scheduleTenantCreditScoreCronSuccess, exports.scheduleTenantCreditScoreCronFailure = _a.scheduleTenantCreditScoreCronFailure, exports.resetScheduleCronState = _a.resetScheduleCronState, exports.fetchCreditAgentMacro = _a.fetchCreditAgentMacro, exports.updateCreditAgentMacro = _a.updateCreditAgentMacro, exports.updateCreditAgentMacroFailure = _a.updateCreditAgentMacroFailure, exports.saveCreditAgentMacro = _a.saveCreditAgentMacro, exports.saveCreditAgentMacroSuccess = _a.saveCreditAgentMacroSuccess, exports.saveCreditAgentMacroFailure = _a.saveCreditAgentMacroFailure, exports.resetSaveMacroState = _a.resetSaveMacroState;
117
+ exports.default = creditAgentView.reducer;
@@ -0,0 +1,17 @@
1
+ import { RootState } from '../../reducer';
2
+ export declare const getCreditAgentReport: (state: RootState) => {
3
+ count: number;
4
+ fetchState: import("../..").FetchState;
5
+ rows: import("./creditAgentViewState").TenantCreditScoreRow[];
6
+ error?: import("../..").ZeniAPIStatus;
7
+ };
8
+ export declare const getCreditAgentMacro: (state: RootState) => {
9
+ data: import("./creditAgentViewState").CreditAgentMacro | null;
10
+ fetchState: import("../..").FetchState;
11
+ updateState: import("../..").FetchState;
12
+ error?: import("../..").ZeniAPIStatus;
13
+ };
14
+ export declare const getScheduleCronState: (state: RootState) => {
15
+ fetchState: import("../..").FetchState;
16
+ error?: import("../..").ZeniAPIStatus;
17
+ };
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getScheduleCronState = exports.getCreditAgentMacro = exports.getCreditAgentReport = void 0;
4
+ const getCreditAgentReport = (state) => state.creditAgentViewState.report;
5
+ exports.getCreditAgentReport = getCreditAgentReport;
6
+ const getCreditAgentMacro = (state) => state.creditAgentViewState.macro;
7
+ exports.getCreditAgentMacro = getCreditAgentMacro;
8
+ const getScheduleCronState = (state) => state.creditAgentViewState.scheduleCron;
9
+ exports.getScheduleCronState = getScheduleCronState;
@@ -0,0 +1,58 @@
1
+ import { FetchState } from '../../commonStateTypes/common';
2
+ import { ZeniAPIStatus } from '../../responsePayload';
3
+ export interface TenantCreditScoreRow {
4
+ burnRateMonthly: number;
5
+ cards: string;
6
+ confidence: number;
7
+ cons: string;
8
+ conservativeLimitRationale: string;
9
+ controllerName: string;
10
+ creditAmount: number;
11
+ creditLimit: number;
12
+ creditScore: string;
13
+ customerName: string;
14
+ goingConcernAnalysis: string;
15
+ healthMonitorScore: number;
16
+ keyRatios: Record<string, unknown>;
17
+ liberalCreditLimit: number;
18
+ liberalLimitRationale: string;
19
+ period: string;
20
+ pros: string;
21
+ reasoning: string;
22
+ runDate: string;
23
+ runway: number;
24
+ status: string;
25
+ totalCardBalance: number;
26
+ totalCashBalance: number;
27
+ }
28
+ export interface CreditAgentMacro {
29
+ createdAt: string;
30
+ description: string;
31
+ instructions: string;
32
+ isActive: boolean;
33
+ isLatest: boolean;
34
+ macroId: string;
35
+ name: string;
36
+ tenantId: string | null;
37
+ updatedAt: string;
38
+ version: number;
39
+ }
40
+ export interface CreditAgentViewState {
41
+ macro: {
42
+ data: CreditAgentMacro | null;
43
+ fetchState: FetchState;
44
+ updateState: FetchState;
45
+ error?: ZeniAPIStatus;
46
+ };
47
+ report: {
48
+ count: number;
49
+ fetchState: FetchState;
50
+ rows: TenantCreditScoreRow[];
51
+ error?: ZeniAPIStatus;
52
+ };
53
+ scheduleCron: {
54
+ fetchState: FetchState;
55
+ error?: ZeniAPIStatus;
56
+ };
57
+ }
58
+ export declare const initialCreditAgentViewState: CreditAgentViewState;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.initialCreditAgentViewState = void 0;
4
+ exports.initialCreditAgentViewState = {
5
+ report: {
6
+ fetchState: 'Not-Started',
7
+ error: undefined,
8
+ rows: [],
9
+ count: 0,
10
+ },
11
+ scheduleCron: {
12
+ fetchState: 'Not-Started',
13
+ error: undefined,
14
+ },
15
+ macro: {
16
+ fetchState: 'Not-Started',
17
+ updateState: 'Not-Started',
18
+ error: undefined,
19
+ data: null,
20
+ },
21
+ };
@@ -0,0 +1,12 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { RootState } from '../../../reducer';
3
+ import { ZeniAPI } from '../../../zeniAPI';
4
+ import { fetchCreditAgentMacro, updateCreditAgentMacro, updateCreditAgentMacroFailure } from '../creditAgentViewReducer';
5
+ export type ActionType = ReturnType<typeof fetchCreditAgentMacro> | ReturnType<typeof updateCreditAgentMacro> | ReturnType<typeof updateCreditAgentMacroFailure>;
6
+ export declare const fetchCreditAgentMacroEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
7
+ payload: import("../creditAgentViewPayload").MacroPayload;
8
+ type: "creditAgentView/updateCreditAgentMacro";
9
+ } | {
10
+ payload: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>>;
11
+ type: "creditAgentView/updateCreditAgentMacroFailure";
12
+ }>;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchCreditAgentMacroEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const responsePayload_1 = require("../../../responsePayload");
7
+ const creditAgentViewReducer_1 = require("../creditAgentViewReducer");
8
+ const fetchCreditAgentMacroEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(creditAgentViewReducer_1.fetchCreditAgentMacro.match), (0, operators_1.switchMap)(() => {
9
+ const url = `${zeniAPI.apiEndPoints.aiCfoMicroServiceBaseUrl}/1.0/macros/credit-agent`;
10
+ return zeniAPI.getJSON(url).pipe((0, operators_1.mergeMap)((response) => {
11
+ if ((0, responsePayload_1.isSuccessResponse)(response)) {
12
+ return (0, rxjs_1.of)((0, creditAgentViewReducer_1.updateCreditAgentMacro)(response.data // eslint-disable-line @typescript-eslint/no-non-null-assertion
13
+ ));
14
+ }
15
+ else {
16
+ return (0, rxjs_1.of)((0, creditAgentViewReducer_1.updateCreditAgentMacroFailure)(response.status));
17
+ }
18
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, creditAgentViewReducer_1.updateCreditAgentMacroFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'REST API call errored out: ' + JSON.stringify(error))))));
19
+ }));
20
+ exports.fetchCreditAgentMacroEpic = fetchCreditAgentMacroEpic;
@@ -0,0 +1,12 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { RootState } from '../../../reducer';
3
+ import { ZeniAPI } from '../../../zeniAPI';
4
+ import { fetchTenantCreditScoreReport, updateTenantCreditScoreReport, updateTenantCreditScoreReportFailure } from '../creditAgentViewReducer';
5
+ export type ActionType = ReturnType<typeof fetchTenantCreditScoreReport> | ReturnType<typeof updateTenantCreditScoreReport> | ReturnType<typeof updateTenantCreditScoreReportFailure>;
6
+ export declare const fetchTenantCreditScoreReportEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
7
+ payload: import("../creditAgentViewPayload").TenantCreditScoreReportPayload;
8
+ type: "creditAgentView/updateTenantCreditScoreReport";
9
+ } | {
10
+ payload: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>>;
11
+ type: "creditAgentView/updateTenantCreditScoreReportFailure";
12
+ }>;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchTenantCreditScoreReportEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const responsePayload_1 = require("../../../responsePayload");
7
+ const creditAgentViewReducer_1 = require("../creditAgentViewReducer");
8
+ const fetchTenantCreditScoreReportEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(creditAgentViewReducer_1.fetchTenantCreditScoreReport.match), (0, operators_1.switchMap)(() => {
9
+ const url = `${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/admin/tenant-credit-score-report`;
10
+ return zeniAPI.getJSON(url).pipe((0, operators_1.mergeMap)((response) => {
11
+ if ((0, responsePayload_1.isSuccessResponse)(response)) {
12
+ return (0, rxjs_1.of)((0, creditAgentViewReducer_1.updateTenantCreditScoreReport)(response.data // eslint-disable-line @typescript-eslint/no-non-null-assertion
13
+ ));
14
+ }
15
+ else {
16
+ return (0, rxjs_1.of)((0, creditAgentViewReducer_1.updateTenantCreditScoreReportFailure)(response.status));
17
+ }
18
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, creditAgentViewReducer_1.updateTenantCreditScoreReportFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'REST API call errored out: ' + JSON.stringify(error))))));
19
+ }));
20
+ exports.fetchTenantCreditScoreReportEpic = fetchTenantCreditScoreReportEpic;
@@ -0,0 +1,12 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { RootState } from '../../../reducer';
3
+ import { ZeniAPI } from '../../../zeniAPI';
4
+ import { saveCreditAgentMacro, saveCreditAgentMacroFailure, saveCreditAgentMacroSuccess } from '../creditAgentViewReducer';
5
+ export type ActionType = ReturnType<typeof saveCreditAgentMacro> | ReturnType<typeof saveCreditAgentMacroSuccess> | ReturnType<typeof saveCreditAgentMacroFailure>;
6
+ export declare const saveCreditAgentMacroEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
7
+ payload: import("../creditAgentViewPayload").MacroPayload;
8
+ type: "creditAgentView/saveCreditAgentMacroSuccess";
9
+ } | {
10
+ payload: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>>;
11
+ type: "creditAgentView/saveCreditAgentMacroFailure";
12
+ }>;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.saveCreditAgentMacroEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const responsePayload_1 = require("../../../responsePayload");
7
+ const creditAgentViewReducer_1 = require("../creditAgentViewReducer");
8
+ const saveCreditAgentMacroEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(creditAgentViewReducer_1.saveCreditAgentMacro.match), (0, operators_1.switchMap)((action) => {
9
+ const { instructions } = action.payload;
10
+ const existingMacro = state$.value.creditAgentViewState.macro.data;
11
+ const url = `${zeniAPI.apiEndPoints.aiCfoMicroServiceBaseUrl}/1.0/macros/credit-agent`;
12
+ const body = {
13
+ instructions,
14
+ name: existingMacro?.name ?? 'credit-agent',
15
+ description: existingMacro?.description ?? '',
16
+ };
17
+ return zeniAPI.putAndGetJSON(url, body).pipe((0, operators_1.mergeMap)((response) => {
18
+ if ((0, responsePayload_1.isSuccessResponse)(response)) {
19
+ return (0, rxjs_1.of)((0, creditAgentViewReducer_1.saveCreditAgentMacroSuccess)(response.data // eslint-disable-line @typescript-eslint/no-non-null-assertion
20
+ ));
21
+ }
22
+ else {
23
+ return (0, rxjs_1.of)((0, creditAgentViewReducer_1.saveCreditAgentMacroFailure)(response.status));
24
+ }
25
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, creditAgentViewReducer_1.saveCreditAgentMacroFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'REST API call errored out: ' + JSON.stringify(error))))));
26
+ }));
27
+ exports.saveCreditAgentMacroEpic = saveCreditAgentMacroEpic;
@@ -0,0 +1,12 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { RootState } from '../../../reducer';
3
+ import { ZeniAPI } from '../../../zeniAPI';
4
+ import { scheduleTenantCreditScoreCron, scheduleTenantCreditScoreCronFailure, scheduleTenantCreditScoreCronSuccess } from '../creditAgentViewReducer';
5
+ export type ActionType = ReturnType<typeof scheduleTenantCreditScoreCron> | ReturnType<typeof scheduleTenantCreditScoreCronSuccess> | ReturnType<typeof scheduleTenantCreditScoreCronFailure>;
6
+ export declare const scheduleTenantCreditScoreCronEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
7
+ payload: undefined;
8
+ type: "creditAgentView/scheduleTenantCreditScoreCronSuccess";
9
+ } | {
10
+ payload: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>>;
11
+ type: "creditAgentView/scheduleTenantCreditScoreCronFailure";
12
+ }>;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.scheduleTenantCreditScoreCronEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const responsePayload_1 = require("../../../responsePayload");
7
+ const creditAgentViewReducer_1 = require("../creditAgentViewReducer");
8
+ const scheduleTenantCreditScoreCronEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(creditAgentViewReducer_1.scheduleTenantCreditScoreCron.match), (0, operators_1.switchMap)((action) => {
9
+ const { tenantId } = action.payload;
10
+ const url = `${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/crons/cards/tenant-credit-score`;
11
+ const body = tenantId != null ? { tenant_id: tenantId } : {};
12
+ return zeniAPI
13
+ .postAndGetJSON(url, body)
14
+ .pipe((0, operators_1.mergeMap)((response) => {
15
+ if ((0, responsePayload_1.isSuccessResponse)(response)) {
16
+ return (0, rxjs_1.of)((0, creditAgentViewReducer_1.scheduleTenantCreditScoreCronSuccess)());
17
+ }
18
+ else {
19
+ return (0, rxjs_1.of)((0, creditAgentViewReducer_1.scheduleTenantCreditScoreCronFailure)(response.status));
20
+ }
21
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, creditAgentViewReducer_1.scheduleTenantCreditScoreCronFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'REST API call errored out: ' + JSON.stringify(error))))));
22
+ }));
23
+ exports.scheduleTenantCreditScoreCronEpic = scheduleTenantCreditScoreCronEpic;
@@ -98,11 +98,11 @@ exports.allTaskStatus = [
98
98
  },
99
99
  {
100
100
  code: 'done',
101
- name: 'In Review',
101
+ name: 'Done',
102
102
  },
103
103
  {
104
104
  code: 'resolved',
105
- name: 'Complete',
105
+ name: 'Resolved',
106
106
  },
107
107
  ];
108
108
  exports.allTaskPriority = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.19.77-betaML99",
3
+ "version": "4.19.77-betaSS2",
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",
@@ -33,6 +33,34 @@
33
33
  "require": "./lib/view/*.js"
34
34
  }
35
35
  },
36
+ "scripts": {
37
+ "clean": "rimraf lib",
38
+ "test:typecheck": "echo 'Typechecking test files...' && time tsc -p tsconfig.typecheck.json",
39
+ "test": "pnpm test:typecheck && vitest run --typecheck",
40
+ "lint": "eslint . --ext .js,.jsx,.ts,.tsx --fix",
41
+ "find-dead-code": "ts-prune | grep -v '(used in module)'",
42
+ "find-unused-exports": "ts-unused-exports ./tsconfig.json",
43
+ "circular-dependency": "npx madge --circular --extensions ts ./src",
44
+ "build": "concurrently --kill-others-on-fail --handle-input \"echo 'Running ESLint...' && eslint . --ext .js,.jsx,.ts,.tsx\" \"echo 'TypeScript build in progress...' && time tsc && echo 'ESM build...' && tsc -p tsconfig.esm.json\" \"echo 'Running tests and typecheck...' && pnpm test\" && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
45
+ "only-build": "eslint . --ext .js,.jsx,.ts,.tsx && time tsc && tsc -p tsconfig.esm.json && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
46
+ "only-build-dev": "eslint . --ext .js,.jsx,.ts,.tsx && time tsc -p tsconfig.dev.json && tsc -p tsconfig.esm.dev.json && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
47
+ "format": "prettier --write --ignore-unknown \"src/**/*\" && pnpm lint",
48
+ "format-watch": "(git diff --name-only --diff-filter=ACM && git ls-files --others --exclude-standard) | grep -E '\\.(ts|tsx)$' | xargs prettier --write",
49
+ "check-version": "node ./scripts/check_version.js",
50
+ "prepublishOnly": "chmod +x ./scripts/branch_validation.sh && ./scripts/branch_validation.sh && pnpm update-slack-group-topic && pnpm run check-version && pnpm clean && pnpm build",
51
+ "version": "git add -A src",
52
+ "postversion": "git push && git push --tags",
53
+ "check-dependencies": "node ./scripts/check_dependencies.js",
54
+ "clean-overrides": "node ./scripts/clean_overrides.js",
55
+ "create-release-branch": "chmod +x ./scripts/create_release_branch.sh && ./scripts/create_release_branch.sh",
56
+ "bump-update-web-app-cockpit-beta": "chmod +x ./scripts/bump_and_update_web_app_ui_beta.sh && ./scripts/bump_and_update_web_app_ui_beta.sh",
57
+ "send-release-notes": "chmod +x ./scripts/send_release_notes.sh && ./scripts/send_release_notes.sh",
58
+ "update-slack-group-topic": "chmod +x ./scripts/update-slack-group-topic.sh && ./scripts/update-slack-group-topic.sh",
59
+ "build-beta-and-copy": "chmod +x ./scripts/build_and_copy.sh && ./scripts/build_and_copy.sh",
60
+ "pr-approvals-update": "chmod +x ./scripts/pr_approvals.sh && ./scripts/pr_approvals.sh",
61
+ "raise-pr-automation": "chmod +x ./scripts/raise_pr_automation.sh && ./scripts/raise_pr_automation.sh",
62
+ "test:file": "scripts/test-file.sh"
63
+ },
36
64
  "files": [
37
65
  "lib/**/*"
38
66
  ],
@@ -103,31 +131,29 @@
103
131
  "dayjs": "^1.10.7",
104
132
  "url-parse": "^1.5.10"
105
133
  },
106
- "scripts": {
107
- "clean": "rimraf lib",
108
- "test:typecheck": "echo 'Typechecking test files...' && time tsc -p tsconfig.typecheck.json",
109
- "test": "pnpm test:typecheck && vitest run --typecheck",
110
- "lint": "eslint . --ext .js,.jsx,.ts,.tsx --fix",
111
- "find-dead-code": "ts-prune | grep -v '(used in module)'",
112
- "find-unused-exports": "ts-unused-exports ./tsconfig.json",
113
- "circular-dependency": "npx madge --circular --extensions ts ./src",
114
- "build": "concurrently --kill-others-on-fail --handle-input \"echo 'Running ESLint...' && eslint . --ext .js,.jsx,.ts,.tsx\" \"echo 'TypeScript build in progress...' && time tsc && echo 'ESM build...' && tsc -p tsconfig.esm.json\" \"echo 'Running tests and typecheck...' && pnpm test\" && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
115
- "only-build": "eslint . --ext .js,.jsx,.ts,.tsx && time tsc && tsc -p tsconfig.esm.json && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
116
- "only-build-dev": "eslint . --ext .js,.jsx,.ts,.tsx && time tsc -p tsconfig.dev.json && tsc -p tsconfig.esm.dev.json && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
117
- "format": "prettier --write --ignore-unknown \"src/**/*\" && pnpm lint",
118
- "format-watch": "(git diff --name-only --diff-filter=ACM && git ls-files --others --exclude-standard) | grep -E '\\.(ts|tsx)$' | xargs prettier --write",
119
- "check-version": "node ./scripts/check_version.js",
120
- "version": "git add -A src",
121
- "postversion": "git push && git push --tags",
122
- "check-dependencies": "node ./scripts/check_dependencies.js",
123
- "clean-overrides": "node ./scripts/clean_overrides.js",
124
- "create-release-branch": "chmod +x ./scripts/create_release_branch.sh && ./scripts/create_release_branch.sh",
125
- "bump-update-web-app-cockpit-beta": "chmod +x ./scripts/bump_and_update_web_app_ui_beta.sh && ./scripts/bump_and_update_web_app_ui_beta.sh",
126
- "send-release-notes": "chmod +x ./scripts/send_release_notes.sh && ./scripts/send_release_notes.sh",
127
- "update-slack-group-topic": "chmod +x ./scripts/update-slack-group-topic.sh && ./scripts/update-slack-group-topic.sh",
128
- "build-beta-and-copy": "chmod +x ./scripts/build_and_copy.sh && ./scripts/build_and_copy.sh",
129
- "pr-approvals-update": "chmod +x ./scripts/pr_approvals.sh && ./scripts/pr_approvals.sh",
130
- "raise-pr-automation": "chmod +x ./scripts/raise_pr_automation.sh && ./scripts/raise_pr_automation.sh",
131
- "test:file": "scripts/test-file.sh"
134
+ "pnpm": {
135
+ "overrides": {
136
+ "@babel/helpers": ">=7.26.10",
137
+ "@babel/runtime": ">=7.26.10",
138
+ "@babel/traverse": ">=7.23.2",
139
+ "@eslint/eslintrc>ajv": ">=6.14.0 <7",
140
+ "@eslint/plugin-kit": ">=0.3.4",
141
+ "@modelcontextprotocol/sdk": ">=1.25.2",
142
+ "ajv": ">=8.18.0",
143
+ "body-parser": ">=2.2.1",
144
+ "brace-expansion": ">=5.0.2",
145
+ "cross-spawn": ">=7.0.5",
146
+ "eslint>ajv": ">=6.14.0 <7",
147
+ "flatted": ">=3.4.0",
148
+ "glob": ">=11.1.0",
149
+ "hono": ">=4.11.4",
150
+ "immutable": ">=4.3.8 <5",
151
+ "js-yaml": ">=4.1.1",
152
+ "minimatch": ">=10.2.3",
153
+ "qs": "^6.14.1",
154
+ "rollup": ">=4.59.0",
155
+ "tough-cookie": "=4.1.3",
156
+ "vite": "^7.1.12"
157
+ }
132
158
  }
133
- }
159
+ }