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

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 (35) hide show
  1. package/lib/epic.d.ts +1 -5
  2. package/lib/epic.js +1 -5
  3. package/lib/esm/epic.js +1 -5
  4. package/lib/esm/index.js +0 -2
  5. package/lib/esm/reducer.js +0 -3
  6. package/lib/index.d.ts +0 -3
  7. package/lib/index.js +1 -20
  8. package/lib/reducer.d.ts +0 -3
  9. package/lib/reducer.js +0 -3
  10. package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
  11. package/package.json +28 -54
  12. package/lib/esm/view/creditAgentView/creditAgentViewPayload.js +0 -1
  13. package/lib/esm/view/creditAgentView/creditAgentViewReducer.js +0 -113
  14. package/lib/esm/view/creditAgentView/creditAgentViewSelector.js +0 -3
  15. package/lib/esm/view/creditAgentView/creditAgentViewState.js +0 -18
  16. package/lib/esm/view/creditAgentView/epics/fetchCreditAgentMacroEpic.js +0 -16
  17. package/lib/esm/view/creditAgentView/epics/fetchTenantCreditScoreReportEpic.js +0 -16
  18. package/lib/esm/view/creditAgentView/epics/saveCreditAgentMacroEpic.js +0 -23
  19. package/lib/esm/view/creditAgentView/epics/scheduleTenantCreditScoreCronEpic.js +0 -19
  20. package/lib/view/creditAgentView/creditAgentViewPayload.d.ts +0 -64
  21. package/lib/view/creditAgentView/creditAgentViewPayload.js +0 -2
  22. package/lib/view/creditAgentView/creditAgentViewReducer.d.ts +0 -11
  23. package/lib/view/creditAgentView/creditAgentViewReducer.js +0 -117
  24. package/lib/view/creditAgentView/creditAgentViewSelector.d.ts +0 -17
  25. package/lib/view/creditAgentView/creditAgentViewSelector.js +0 -9
  26. package/lib/view/creditAgentView/creditAgentViewState.d.ts +0 -58
  27. package/lib/view/creditAgentView/creditAgentViewState.js +0 -21
  28. package/lib/view/creditAgentView/epics/fetchCreditAgentMacroEpic.d.ts +0 -12
  29. package/lib/view/creditAgentView/epics/fetchCreditAgentMacroEpic.js +0 -20
  30. package/lib/view/creditAgentView/epics/fetchTenantCreditScoreReportEpic.d.ts +0 -12
  31. package/lib/view/creditAgentView/epics/fetchTenantCreditScoreReportEpic.js +0 -20
  32. package/lib/view/creditAgentView/epics/saveCreditAgentMacroEpic.d.ts +0 -12
  33. package/lib/view/creditAgentView/epics/saveCreditAgentMacroEpic.js +0 -27
  34. package/lib/view/creditAgentView/epics/scheduleTenantCreditScoreCronEpic.d.ts +0 -12
  35. package/lib/view/creditAgentView/epics/scheduleTenantCreditScoreCronEpic.js +0 -23
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.19.77-betaSS2",
3
+ "version": "4.19.77",
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,34 +33,6 @@
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
- },
64
36
  "files": [
65
37
  "lib/**/*"
66
38
  ],
@@ -131,29 +103,31 @@
131
103
  "dayjs": "^1.10.7",
132
104
  "url-parse": "^1.5.10"
133
105
  },
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
- }
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"
158
132
  }
159
- }
133
+ }
@@ -1,113 +0,0 @@
1
- import { createSlice } from '@reduxjs/toolkit';
2
- import { initialCreditAgentViewState, } from './creditAgentViewState';
3
- const creditAgentView = createSlice({
4
- name: 'creditAgentView',
5
- initialState: initialCreditAgentViewState,
6
- reducers: {
7
- fetchTenantCreditScoreReport(draft) {
8
- draft.report.fetchState = 'In-Progress';
9
- draft.report.error = undefined;
10
- },
11
- updateTenantCreditScoreReport(draft, action) {
12
- draft.report.fetchState = 'Completed';
13
- draft.report.error = undefined;
14
- draft.report.rows = action.payload.report.map((row) => ({
15
- customerName: row.customer_name,
16
- totalCashBalance: row.total_cash_balance,
17
- totalCardBalance: row.total_card_balance,
18
- cards: row.cards,
19
- controllerName: row.controller_name,
20
- period: row.period,
21
- runway: row.runway,
22
- burnRateMonthly: row.burn_rate_monthly,
23
- healthMonitorScore: row.health_monitor_score,
24
- creditScore: row.credit_score,
25
- confidence: row.confidence,
26
- creditAmount: row.credit_amount,
27
- creditLimit: row.credit_limit,
28
- conservativeLimitRationale: row.conservative_limit_rationale,
29
- liberalCreditLimit: row.liberal_credit_limit,
30
- liberalLimitRationale: row.liberal_limit_rationale,
31
- pros: row.pros,
32
- cons: row.cons,
33
- reasoning: row.reasoning,
34
- goingConcernAnalysis: row.going_concern_analysis,
35
- keyRatios: row.key_ratios,
36
- runDate: row.run_date,
37
- status: row.status,
38
- }));
39
- draft.report.count = action.payload.count;
40
- },
41
- updateTenantCreditScoreReportFailure(draft, action) {
42
- draft.report.fetchState = 'Error';
43
- draft.report.error = action.payload;
44
- },
45
- scheduleTenantCreditScoreCron(draft,
46
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
47
- _action) {
48
- draft.scheduleCron.fetchState = 'In-Progress';
49
- draft.scheduleCron.error = undefined;
50
- },
51
- scheduleTenantCreditScoreCronSuccess(draft) {
52
- draft.scheduleCron.fetchState = 'Completed';
53
- draft.scheduleCron.error = undefined;
54
- },
55
- scheduleTenantCreditScoreCronFailure(draft, action) {
56
- draft.scheduleCron.fetchState = 'Error';
57
- draft.scheduleCron.error = action.payload;
58
- },
59
- resetScheduleCronState(draft) {
60
- draft.scheduleCron.fetchState = 'Not-Started';
61
- draft.scheduleCron.error = undefined;
62
- },
63
- fetchCreditAgentMacro(draft) {
64
- draft.macro.fetchState = 'In-Progress';
65
- draft.macro.error = undefined;
66
- },
67
- updateCreditAgentMacro(draft, action) {
68
- draft.macro.fetchState = 'Completed';
69
- draft.macro.error = undefined;
70
- draft.macro.data = mapMacroPayload(action.payload);
71
- },
72
- updateCreditAgentMacroFailure(draft, action) {
73
- draft.macro.fetchState = 'Error';
74
- draft.macro.error = action.payload;
75
- },
76
- saveCreditAgentMacro(draft,
77
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
78
- _action) {
79
- draft.macro.updateState = 'In-Progress';
80
- draft.macro.error = undefined;
81
- },
82
- saveCreditAgentMacroSuccess(draft, action) {
83
- draft.macro.updateState = 'Completed';
84
- draft.macro.error = undefined;
85
- draft.macro.data = mapMacroPayload(action.payload);
86
- },
87
- saveCreditAgentMacroFailure(draft, action) {
88
- draft.macro.updateState = 'Error';
89
- draft.macro.error = action.payload;
90
- },
91
- resetSaveMacroState(draft) {
92
- draft.macro.updateState = 'Not-Started';
93
- draft.macro.error = undefined;
94
- },
95
- },
96
- });
97
- function mapMacroPayload(payload) {
98
- return {
99
- macroId: payload.macro_id,
100
- version: payload.version,
101
- isLatest: payload.is_latest,
102
- isActive: payload.is_active,
103
- name: payload.name,
104
- description: payload.description,
105
- instructions: payload.instructions,
106
- tenantId: payload.tenant_id,
107
- createdAt: payload.created_at,
108
- updatedAt: payload.updated_at,
109
- };
110
- }
111
- export const { fetchTenantCreditScoreReport, updateTenantCreditScoreReport, updateTenantCreditScoreReportFailure, scheduleTenantCreditScoreCron, scheduleTenantCreditScoreCronSuccess, scheduleTenantCreditScoreCronFailure, resetScheduleCronState, fetchCreditAgentMacro, updateCreditAgentMacro, updateCreditAgentMacroFailure, saveCreditAgentMacro, saveCreditAgentMacroSuccess, saveCreditAgentMacroFailure, resetSaveMacroState, } = creditAgentView.actions;
112
- export { initialCreditAgentViewState as initialState };
113
- export default creditAgentView.reducer;
@@ -1,3 +0,0 @@
1
- export const getCreditAgentReport = (state) => state.creditAgentViewState.report;
2
- export const getCreditAgentMacro = (state) => state.creditAgentViewState.macro;
3
- export const getScheduleCronState = (state) => state.creditAgentViewState.scheduleCron;
@@ -1,18 +0,0 @@
1
- export const initialCreditAgentViewState = {
2
- report: {
3
- fetchState: 'Not-Started',
4
- error: undefined,
5
- rows: [],
6
- count: 0,
7
- },
8
- scheduleCron: {
9
- fetchState: 'Not-Started',
10
- error: undefined,
11
- },
12
- macro: {
13
- fetchState: 'Not-Started',
14
- updateState: 'Not-Started',
15
- error: undefined,
16
- data: null,
17
- },
18
- };
@@ -1,16 +0,0 @@
1
- import { of } from 'rxjs';
2
- import { catchError, filter, switchMap, mergeMap } from 'rxjs/operators';
3
- import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
4
- import { fetchCreditAgentMacro, updateCreditAgentMacro, updateCreditAgentMacroFailure, } from '../creditAgentViewReducer';
5
- export const fetchCreditAgentMacroEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchCreditAgentMacro.match), switchMap(() => {
6
- const url = `${zeniAPI.apiEndPoints.aiCfoMicroServiceBaseUrl}/1.0/macros/credit-agent`;
7
- return zeniAPI.getJSON(url).pipe(mergeMap((response) => {
8
- if (isSuccessResponse(response)) {
9
- return of(updateCreditAgentMacro(response.data // eslint-disable-line @typescript-eslint/no-non-null-assertion
10
- ));
11
- }
12
- else {
13
- return of(updateCreditAgentMacroFailure(response.status));
14
- }
15
- }), catchError((error) => of(updateCreditAgentMacroFailure(createZeniAPIStatus('Unexpected error', 'REST API call errored out: ' + JSON.stringify(error))))));
16
- }));
@@ -1,16 +0,0 @@
1
- import { of } from 'rxjs';
2
- import { catchError, filter, switchMap, mergeMap } from 'rxjs/operators';
3
- import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
4
- import { fetchTenantCreditScoreReport, updateTenantCreditScoreReport, updateTenantCreditScoreReportFailure, } from '../creditAgentViewReducer';
5
- export const fetchTenantCreditScoreReportEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchTenantCreditScoreReport.match), switchMap(() => {
6
- const url = `${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/admin/tenant-credit-score-report`;
7
- return zeniAPI.getJSON(url).pipe(mergeMap((response) => {
8
- if (isSuccessResponse(response)) {
9
- return of(updateTenantCreditScoreReport(response.data // eslint-disable-line @typescript-eslint/no-non-null-assertion
10
- ));
11
- }
12
- else {
13
- return of(updateTenantCreditScoreReportFailure(response.status));
14
- }
15
- }), catchError((error) => of(updateTenantCreditScoreReportFailure(createZeniAPIStatus('Unexpected error', 'REST API call errored out: ' + JSON.stringify(error))))));
16
- }));
@@ -1,23 +0,0 @@
1
- import { of } from 'rxjs';
2
- import { catchError, filter, switchMap, mergeMap } from 'rxjs/operators';
3
- import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
4
- import { saveCreditAgentMacro, saveCreditAgentMacroFailure, saveCreditAgentMacroSuccess, } from '../creditAgentViewReducer';
5
- export const saveCreditAgentMacroEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(saveCreditAgentMacro.match), switchMap((action) => {
6
- const { instructions } = action.payload;
7
- const existingMacro = state$.value.creditAgentViewState.macro.data;
8
- const url = `${zeniAPI.apiEndPoints.aiCfoMicroServiceBaseUrl}/1.0/macros/credit-agent`;
9
- const body = {
10
- instructions,
11
- name: existingMacro?.name ?? 'credit-agent',
12
- description: existingMacro?.description ?? '',
13
- };
14
- return zeniAPI.putAndGetJSON(url, body).pipe(mergeMap((response) => {
15
- if (isSuccessResponse(response)) {
16
- return of(saveCreditAgentMacroSuccess(response.data // eslint-disable-line @typescript-eslint/no-non-null-assertion
17
- ));
18
- }
19
- else {
20
- return of(saveCreditAgentMacroFailure(response.status));
21
- }
22
- }), catchError((error) => of(saveCreditAgentMacroFailure(createZeniAPIStatus('Unexpected error', 'REST API call errored out: ' + JSON.stringify(error))))));
23
- }));
@@ -1,19 +0,0 @@
1
- import { of } from 'rxjs';
2
- import { catchError, filter, switchMap, mergeMap } from 'rxjs/operators';
3
- import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
4
- import { scheduleTenantCreditScoreCron, scheduleTenantCreditScoreCronFailure, scheduleTenantCreditScoreCronSuccess, } from '../creditAgentViewReducer';
5
- export const scheduleTenantCreditScoreCronEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(scheduleTenantCreditScoreCron.match), switchMap((action) => {
6
- const { tenantId } = action.payload;
7
- const url = `${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/crons/cards/tenant-credit-score`;
8
- const body = tenantId != null ? { tenant_id: tenantId } : {};
9
- return zeniAPI
10
- .postAndGetJSON(url, body)
11
- .pipe(mergeMap((response) => {
12
- if (isSuccessResponse(response)) {
13
- return of(scheduleTenantCreditScoreCronSuccess());
14
- }
15
- else {
16
- return of(scheduleTenantCreditScoreCronFailure(response.status));
17
- }
18
- }), catchError((error) => of(scheduleTenantCreditScoreCronFailure(createZeniAPIStatus('Unexpected error', 'REST API call errored out: ' + JSON.stringify(error))))));
19
- }));
@@ -1,64 +0,0 @@
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
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,11 +0,0 @@
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;
@@ -1,117 +0,0 @@
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;
@@ -1,17 +0,0 @@
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
- };
@@ -1,9 +0,0 @@
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;
@@ -1,58 +0,0 @@
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;
@@ -1,21 +0,0 @@
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
- };