@zeniai/client-epic-state 5.0.44 → 5.0.46
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/chargeCardRepayment/chargeCardRepayment.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +0 -3
- package/lib/entity/tenant/clearAllEpic.d.ts +3 -5
- package/lib/entity/tenant/clearAllEpic.js +2 -6
- package/lib/epic.d.ts +1 -7
- package/lib/epic.js +1 -7
- package/lib/esm/entity/snackbar/snackbarTypes.js +0 -3
- package/lib/esm/entity/tenant/clearAllEpic.js +2 -6
- package/lib/esm/epic.js +1 -7
- package/lib/esm/index.js +6 -12
- package/lib/esm/reducer.js +3 -9
- package/lib/index.d.ts +10 -18
- package/lib/index.js +46 -75
- package/lib/reducer.d.ts +3 -9
- package/lib/reducer.js +3 -9
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/package.json +1 -1
- package/lib/entity/creditAgent/creditAgentPayload.d.ts +0 -41
- package/lib/entity/creditAgent/creditAgentPayload.js +0 -40
- package/lib/entity/creditAgent/creditAgentReducer.d.ts +0 -9
- package/lib/entity/creditAgent/creditAgentReducer.js +0 -37
- package/lib/entity/creditAgent/creditAgentSelector.d.ts +0 -3
- package/lib/entity/creditAgent/creditAgentSelector.js +0 -10
- package/lib/entity/creditAgent/creditAgentState.d.ts +0 -39
- package/lib/entity/creditAgent/creditAgentState.js +0 -17
- package/lib/esm/entity/creditAgent/creditAgentPayload.js +0 -36
- package/lib/esm/entity/creditAgent/creditAgentReducer.js +0 -33
- package/lib/esm/entity/creditAgent/creditAgentSelector.js +0 -6
- package/lib/esm/entity/creditAgent/creditAgentState.js +0 -13
- package/lib/esm/view/creditAgentView/buildCreditReportCsv.js +0 -44
- package/lib/esm/view/creditAgentView/creditAgentViewPayload.js +0 -2
- package/lib/esm/view/creditAgentView/creditAgentViewReducer.js +0 -183
- package/lib/esm/view/creditAgentView/creditAgentViewSelector.js +0 -85
- package/lib/esm/view/creditAgentView/creditAgentViewState.js +0 -20
- package/lib/esm/view/creditAgentView/epics/fetchCardProfilesEpic.js +0 -20
- package/lib/esm/view/creditAgentView/epics/fetchCreditAgentAccessEpic.js +0 -13
- package/lib/esm/view/creditAgentView/epics/fetchCreditAgentMacroEpic.js +0 -19
- package/lib/esm/view/creditAgentView/epics/saveCreditAgentMacroEpic.js +0 -58
- package/lib/esm/view/creditAgentView/epics/scheduleTenantCreditScoreCronEpic.js +0 -39
- package/lib/esm/view/creditAgentView/epics/updateCardProfileEpic.js +0 -62
- package/lib/tsconfig.typecheck.tsbuildinfo +0 -1
- package/lib/view/creditAgentView/buildCreditReportCsv.d.ts +0 -17
- package/lib/view/creditAgentView/buildCreditReportCsv.js +0 -47
- package/lib/view/creditAgentView/creditAgentViewPayload.d.ts +0 -9
- package/lib/view/creditAgentView/creditAgentViewPayload.js +0 -7
- package/lib/view/creditAgentView/creditAgentViewReducer.d.ts +0 -41
- package/lib/view/creditAgentView/creditAgentViewReducer.js +0 -187
- package/lib/view/creditAgentView/creditAgentViewSelector.d.ts +0 -20
- package/lib/view/creditAgentView/creditAgentViewSelector.js +0 -93
- package/lib/view/creditAgentView/creditAgentViewState.d.ts +0 -34
- package/lib/view/creditAgentView/creditAgentViewState.js +0 -22
- package/lib/view/creditAgentView/epics/fetchCardProfilesEpic.d.ts +0 -15
- package/lib/view/creditAgentView/epics/fetchCardProfilesEpic.js +0 -24
- package/lib/view/creditAgentView/epics/fetchCreditAgentAccessEpic.d.ts +0 -11
- package/lib/view/creditAgentView/epics/fetchCreditAgentAccessEpic.js +0 -17
- package/lib/view/creditAgentView/epics/fetchCreditAgentMacroEpic.d.ts +0 -15
- package/lib/view/creditAgentView/epics/fetchCreditAgentMacroEpic.js +0 -23
- package/lib/view/creditAgentView/epics/saveCreditAgentMacroEpic.d.ts +0 -29
- package/lib/view/creditAgentView/epics/saveCreditAgentMacroEpic.js +0 -62
- package/lib/view/creditAgentView/epics/scheduleTenantCreditScoreCronEpic.d.ts +0 -30
- package/lib/view/creditAgentView/epics/scheduleTenantCreditScoreCronEpic.js +0 -43
- package/lib/view/creditAgentView/epics/updateCardProfileEpic.d.ts +0 -37
- package/lib/view/creditAgentView/epics/updateCardProfileEpic.js +0 -66
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { CardTenantProfileRow } from '../../entity/creditAgent/creditAgentState';
|
|
2
|
-
/**
|
|
3
|
-
* Payload shape expected by the web-app-v2 GET /tableDownload endpoint.
|
|
4
|
-
*/
|
|
5
|
-
export interface CreditReportDownloadPayload {
|
|
6
|
-
columns: string[];
|
|
7
|
-
file_name: string;
|
|
8
|
-
rows: (string | number | null | undefined)[][];
|
|
9
|
-
sheet_name: string;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Build the payload for the web-app-v2 table download endpoint.
|
|
13
|
-
*
|
|
14
|
-
* The component calls this, then GETs the endpoint with the payload
|
|
15
|
-
* as a query param and handles the blob response as a file download.
|
|
16
|
-
*/
|
|
17
|
-
export declare function getCreditReportDownloadPayload(rows: CardTenantProfileRow[]): CreditReportDownloadPayload;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getCreditReportDownloadPayload = getCreditReportDownloadPayload;
|
|
4
|
-
const CREDIT_REPORT_COLUMNS = [
|
|
5
|
-
'Customer Name',
|
|
6
|
-
'Card Status',
|
|
7
|
-
'Credit Limit ($)',
|
|
8
|
-
'Credit Score',
|
|
9
|
-
'Recommended Amount ($)',
|
|
10
|
-
'Rationale',
|
|
11
|
-
'Report Date',
|
|
12
|
-
'Tenant Email Domain',
|
|
13
|
-
'Tenant ID',
|
|
14
|
-
'Company ID',
|
|
15
|
-
'Updated By',
|
|
16
|
-
'Updated On',
|
|
17
|
-
];
|
|
18
|
-
function rowToFields(row) {
|
|
19
|
-
return [
|
|
20
|
-
row.customerName,
|
|
21
|
-
row.cardStatus,
|
|
22
|
-
row.creditLimit,
|
|
23
|
-
row.creditScore,
|
|
24
|
-
row.recommendedAmount,
|
|
25
|
-
row.rationale,
|
|
26
|
-
row.reportDate?.format('YYYY-MM-DD'),
|
|
27
|
-
row.tenantEmailDomain,
|
|
28
|
-
row.tenantId,
|
|
29
|
-
row.companyId,
|
|
30
|
-
row.updatedByName,
|
|
31
|
-
row.updatedOn?.format('YYYY-MM-DD'),
|
|
32
|
-
];
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Build the payload for the web-app-v2 table download endpoint.
|
|
36
|
-
*
|
|
37
|
-
* The component calls this, then GETs the endpoint with the payload
|
|
38
|
-
* as a query param and handles the blob response as a file download.
|
|
39
|
-
*/
|
|
40
|
-
function getCreditReportDownloadPayload(rows) {
|
|
41
|
-
return {
|
|
42
|
-
columns: CREDIT_REPORT_COLUMNS,
|
|
43
|
-
rows: rows.map(rowToFields),
|
|
44
|
-
file_name: 'credit-report',
|
|
45
|
-
sheet_name: 'Credit Report',
|
|
46
|
-
};
|
|
47
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { CardTenantProfileUpdatePayload, CardTenantProfilesPayload, MacroPayload } from '../../entity/creditAgent/creditAgentPayload';
|
|
2
|
-
import { ZeniAPIResponse } from '../../responsePayload';
|
|
3
|
-
export { CardTenantProfileRowPayload, CardTenantProfilesPayload, CardTenantProfileUpdatePayload, MacroPayload, toCardTenantProfileRow, toMacro, } from '../../entity/creditAgent/creditAgentPayload';
|
|
4
|
-
export type CardTenantProfilesResponse = ZeniAPIResponse<CardTenantProfilesPayload>;
|
|
5
|
-
export type CreditAgentAccessResponse = ZeniAPIResponse<{
|
|
6
|
-
is_allowed: boolean;
|
|
7
|
-
}>;
|
|
8
|
-
export type CardTenantProfileUpdateResponse = ZeniAPIResponse<CardTenantProfileUpdatePayload>;
|
|
9
|
-
export type MacroResponse = ZeniAPIResponse<MacroPayload>;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toMacro = exports.toCardTenantProfileRow = void 0;
|
|
4
|
-
// Re-export entity payload types and mapping functions.
|
|
5
|
-
var creditAgentPayload_1 = require("../../entity/creditAgent/creditAgentPayload");
|
|
6
|
-
Object.defineProperty(exports, "toCardTenantProfileRow", { enumerable: true, get: function () { return creditAgentPayload_1.toCardTenantProfileRow; } });
|
|
7
|
-
Object.defineProperty(exports, "toMacro", { enumerable: true, get: function () { return creditAgentPayload_1.toMacro; } });
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { CardTenantProfileRowPayload } from '../../entity/creditAgent/creditAgentPayload';
|
|
2
|
-
import { CardStatus } from '../../entity/creditAgent/creditAgentState';
|
|
3
|
-
import { ZeniAPIStatus } from '../../responsePayload';
|
|
4
|
-
import { CreditAgentUIState, CreditAgentViewState } from './creditAgentViewState';
|
|
5
|
-
export declare const initialCreditAgentViewState: CreditAgentViewState;
|
|
6
|
-
export declare const fetchCreditAgentAccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"creditAgentView/fetchCreditAgentAccess">, fetchCreditAgentAccessSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "creditAgentView/fetchCreditAgentAccessSuccess">, fetchCreditAgentAccessFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "creditAgentView/fetchCreditAgentAccessFailure">, scheduleTenantCreditScoreCron: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId?: string | undefined], {
|
|
7
|
-
tenantId: string | undefined;
|
|
8
|
-
}, "creditAgentView/scheduleTenantCreditScoreCron", never, never>, scheduleTenantCreditScoreCronSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId?: string | undefined], {
|
|
9
|
-
tenantId: string | undefined;
|
|
10
|
-
}, "creditAgentView/scheduleTenantCreditScoreCronSuccess", never, never>, scheduleTenantCreditScoreCronFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string | undefined, error: ZeniAPIStatus<Record<string, unknown>>], {
|
|
11
|
-
tenantId: string | undefined;
|
|
12
|
-
error: ZeniAPIStatus<Record<string, unknown>>;
|
|
13
|
-
}, "creditAgentView/scheduleTenantCreditScoreCronFailure", never, never>, fetchCreditAgentMacro: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"creditAgentView/fetchCreditAgentMacro">, fetchCreditAgentMacroSuccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"creditAgentView/fetchCreditAgentMacroSuccess">, fetchCreditAgentMacroFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "creditAgentView/fetchCreditAgentMacroFailure">, saveCreditAgentMacro: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[instructions: string], {
|
|
14
|
-
instructions: string;
|
|
15
|
-
}, "creditAgentView/saveCreditAgentMacro", never, never>, saveCreditAgentMacroSuccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"creditAgentView/saveCreditAgentMacroSuccess">, saveCreditAgentMacroFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "creditAgentView/saveCreditAgentMacroFailure">, resetSaveMacroState: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"creditAgentView/resetSaveMacroState">, fetchCardProfiles: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"creditAgentView/fetchCardProfiles">, fetchCardProfilesSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<CardTenantProfileRowPayload[], "creditAgentView/fetchCardProfilesSuccess">, fetchCardProfilesFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "creditAgentView/fetchCardProfilesFailure">, updateCardProfile: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[payload: {
|
|
16
|
-
tenantEmailDomain: string;
|
|
17
|
-
tenantId: string;
|
|
18
|
-
update: {
|
|
19
|
-
cardStatus?: CardStatus;
|
|
20
|
-
creditLimit?: number;
|
|
21
|
-
reason?: string;
|
|
22
|
-
updatedByName?: string;
|
|
23
|
-
};
|
|
24
|
-
}], {
|
|
25
|
-
tenantEmailDomain: string;
|
|
26
|
-
tenantId: string;
|
|
27
|
-
update: {
|
|
28
|
-
cardStatus?: CardStatus;
|
|
29
|
-
creditLimit?: number;
|
|
30
|
-
reason?: string;
|
|
31
|
-
updatedByName?: string;
|
|
32
|
-
};
|
|
33
|
-
}, "creditAgentView/updateCardProfile", never, never>, updateCardProfileSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string], {
|
|
34
|
-
tenantId: string;
|
|
35
|
-
}, "creditAgentView/updateCardProfileSuccess", never, never>, updateCardProfileFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, error: ZeniAPIStatus<Record<string, unknown>>], {
|
|
36
|
-
tenantId: string;
|
|
37
|
-
error: ZeniAPIStatus<Record<string, unknown>>;
|
|
38
|
-
}, "creditAgentView/updateCardProfileFailure", never, never>, updateCreditAgentUIState: import("@reduxjs/toolkit").ActionCreatorWithPayload<Partial<CreditAgentUIState>, "creditAgentView/updateCreditAgentUIState">, clearCreditAgentView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"creditAgentView/clearCreditAgentView">;
|
|
39
|
-
export { initialCreditAgentViewState as initialState };
|
|
40
|
-
declare const _default: import("redux").Reducer<CreditAgentViewState>;
|
|
41
|
-
export default _default;
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var _a;
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.initialState = exports.clearCreditAgentView = exports.updateCreditAgentUIState = exports.updateCardProfileFailure = exports.updateCardProfileSuccess = exports.updateCardProfile = exports.fetchCardProfilesFailure = exports.fetchCardProfilesSuccess = exports.fetchCardProfiles = exports.resetSaveMacroState = exports.saveCreditAgentMacroFailure = exports.saveCreditAgentMacroSuccess = exports.saveCreditAgentMacro = exports.fetchCreditAgentMacroFailure = exports.fetchCreditAgentMacroSuccess = exports.fetchCreditAgentMacro = exports.scheduleTenantCreditScoreCronFailure = exports.scheduleTenantCreditScoreCronSuccess = exports.scheduleTenantCreditScoreCron = exports.fetchCreditAgentAccessFailure = exports.fetchCreditAgentAccessSuccess = exports.fetchCreditAgentAccess = exports.initialCreditAgentViewState = void 0;
|
|
5
|
-
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
-
const initialTenantView = {
|
|
7
|
-
analyzeStatus: { fetchState: 'Not-Started' },
|
|
8
|
-
updateStatus: { fetchState: 'Not-Started' },
|
|
9
|
-
};
|
|
10
|
-
function getOrCreateTenantView(draft, tenantId) {
|
|
11
|
-
if (draft.tenantViewByTenantId[tenantId] == null) {
|
|
12
|
-
draft.tenantViewByTenantId[tenantId] = {
|
|
13
|
-
...initialTenantView,
|
|
14
|
-
tenantId,
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
return draft.tenantViewByTenantId[tenantId];
|
|
18
|
-
}
|
|
19
|
-
exports.initialCreditAgentViewState = {
|
|
20
|
-
access: {
|
|
21
|
-
fetchStatus: { fetchState: 'Not-Started' },
|
|
22
|
-
isAllowed: false,
|
|
23
|
-
},
|
|
24
|
-
macro: {
|
|
25
|
-
fetchStatus: { fetchState: 'Not-Started' },
|
|
26
|
-
updateStatus: { fetchState: 'Not-Started' },
|
|
27
|
-
},
|
|
28
|
-
profilesFetchStatus: { fetchState: 'Not-Started' },
|
|
29
|
-
tenantViewByTenantId: {},
|
|
30
|
-
uiState: {
|
|
31
|
-
filterText: '',
|
|
32
|
-
focus: 'All',
|
|
33
|
-
minScore: 0,
|
|
34
|
-
sortDir: 'asc',
|
|
35
|
-
sortKey: undefined,
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
exports.initialState = exports.initialCreditAgentViewState;
|
|
39
|
-
const creditAgentView = (0, toolkit_1.createSlice)({
|
|
40
|
-
name: 'creditAgentView',
|
|
41
|
-
initialState: exports.initialCreditAgentViewState,
|
|
42
|
-
reducers: {
|
|
43
|
-
// ── Access ──
|
|
44
|
-
fetchCreditAgentAccess(draft) {
|
|
45
|
-
draft.access.fetchStatus = { fetchState: 'In-Progress' };
|
|
46
|
-
},
|
|
47
|
-
fetchCreditAgentAccessSuccess(draft, action) {
|
|
48
|
-
draft.access.fetchStatus = { fetchState: 'Completed' };
|
|
49
|
-
draft.access.isAllowed = action.payload;
|
|
50
|
-
},
|
|
51
|
-
fetchCreditAgentAccessFailure(draft, action) {
|
|
52
|
-
draft.access.fetchStatus = { fetchState: 'Error', error: action.payload };
|
|
53
|
-
},
|
|
54
|
-
// ── Card Profiles (list-level fetch) ──
|
|
55
|
-
fetchCardProfiles(draft) {
|
|
56
|
-
draft.profilesFetchStatus = { fetchState: 'In-Progress' };
|
|
57
|
-
},
|
|
58
|
-
fetchCardProfilesSuccess(draft, action) {
|
|
59
|
-
draft.profilesFetchStatus = { fetchState: 'Completed' };
|
|
60
|
-
// Replace entire tenantViewByTenantId, preserving existing statuses
|
|
61
|
-
// for tenants still present, removing stale ones.
|
|
62
|
-
draft.tenantViewByTenantId = toTenantViewByTenantId(action.payload, draft.tenantViewByTenantId);
|
|
63
|
-
},
|
|
64
|
-
fetchCardProfilesFailure(draft, action) {
|
|
65
|
-
draft.profilesFetchStatus = { fetchState: 'Error', error: action.payload };
|
|
66
|
-
},
|
|
67
|
-
// ── Update Card Profile (per-tenant) ──
|
|
68
|
-
updateCardProfile: {
|
|
69
|
-
reducer(draft, action) {
|
|
70
|
-
const tv = getOrCreateTenantView(draft, action.payload.tenantId);
|
|
71
|
-
tv.updateStatus = { fetchState: 'In-Progress' };
|
|
72
|
-
},
|
|
73
|
-
prepare(payload) {
|
|
74
|
-
return { payload };
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
updateCardProfileSuccess: {
|
|
78
|
-
reducer(draft, action) {
|
|
79
|
-
const tv = getOrCreateTenantView(draft, action.payload.tenantId);
|
|
80
|
-
tv.updateStatus = { fetchState: 'Completed' };
|
|
81
|
-
},
|
|
82
|
-
prepare(tenantId) {
|
|
83
|
-
return { payload: { tenantId } };
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
updateCardProfileFailure: {
|
|
87
|
-
reducer(draft, action) {
|
|
88
|
-
const tv = getOrCreateTenantView(draft, action.payload.tenantId);
|
|
89
|
-
tv.updateStatus = {
|
|
90
|
-
fetchState: 'Error',
|
|
91
|
-
error: action.payload.error,
|
|
92
|
-
};
|
|
93
|
-
},
|
|
94
|
-
prepare(tenantId, error) {
|
|
95
|
-
return { payload: { tenantId, error } };
|
|
96
|
-
},
|
|
97
|
-
},
|
|
98
|
-
// ── Analyze / Schedule Cron (per-tenant) ──
|
|
99
|
-
scheduleTenantCreditScoreCron: {
|
|
100
|
-
reducer(draft, action) {
|
|
101
|
-
if (action.payload.tenantId != null) {
|
|
102
|
-
const tv = getOrCreateTenantView(draft, action.payload.tenantId);
|
|
103
|
-
tv.analyzeStatus = { fetchState: 'In-Progress' };
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
prepare(tenantId) {
|
|
107
|
-
return { payload: { tenantId } };
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
scheduleTenantCreditScoreCronSuccess: {
|
|
111
|
-
reducer(draft, action) {
|
|
112
|
-
if (action.payload.tenantId != null) {
|
|
113
|
-
const tv = getOrCreateTenantView(draft, action.payload.tenantId);
|
|
114
|
-
tv.analyzeStatus = { fetchState: 'Completed' };
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
|
-
prepare(tenantId) {
|
|
118
|
-
return { payload: { tenantId } };
|
|
119
|
-
},
|
|
120
|
-
},
|
|
121
|
-
scheduleTenantCreditScoreCronFailure: {
|
|
122
|
-
reducer(draft, action) {
|
|
123
|
-
if (action.payload.tenantId != null) {
|
|
124
|
-
const tv = getOrCreateTenantView(draft, action.payload.tenantId);
|
|
125
|
-
tv.analyzeStatus = {
|
|
126
|
-
fetchState: 'Error',
|
|
127
|
-
error: action.payload.error,
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
prepare(tenantId, error) {
|
|
132
|
-
return { payload: { tenantId, error } };
|
|
133
|
-
},
|
|
134
|
-
},
|
|
135
|
-
// ── Macro ──
|
|
136
|
-
fetchCreditAgentMacro(draft) {
|
|
137
|
-
draft.macro.fetchStatus = { fetchState: 'In-Progress' };
|
|
138
|
-
},
|
|
139
|
-
fetchCreditAgentMacroSuccess(draft) {
|
|
140
|
-
draft.macro.fetchStatus = { fetchState: 'Completed' };
|
|
141
|
-
},
|
|
142
|
-
fetchCreditAgentMacroFailure(draft, action) {
|
|
143
|
-
draft.macro.fetchStatus = { fetchState: 'Error', error: action.payload };
|
|
144
|
-
},
|
|
145
|
-
saveCreditAgentMacro: {
|
|
146
|
-
reducer(draft) {
|
|
147
|
-
draft.macro.updateStatus = { fetchState: 'In-Progress' };
|
|
148
|
-
},
|
|
149
|
-
prepare(instructions) {
|
|
150
|
-
return { payload: { instructions } };
|
|
151
|
-
},
|
|
152
|
-
},
|
|
153
|
-
saveCreditAgentMacroSuccess(draft) {
|
|
154
|
-
draft.macro.updateStatus = { fetchState: 'Completed' };
|
|
155
|
-
},
|
|
156
|
-
saveCreditAgentMacroFailure(draft, action) {
|
|
157
|
-
draft.macro.updateStatus = { fetchState: 'Error', error: action.payload };
|
|
158
|
-
},
|
|
159
|
-
resetSaveMacroState(draft) {
|
|
160
|
-
draft.macro.updateStatus = { fetchState: 'Not-Started' };
|
|
161
|
-
},
|
|
162
|
-
// ── UI State ──
|
|
163
|
-
updateCreditAgentUIState(draft, action) {
|
|
164
|
-
Object.assign(draft.uiState, action.payload);
|
|
165
|
-
},
|
|
166
|
-
// ── Clear ──
|
|
167
|
-
clearCreditAgentView() {
|
|
168
|
-
return exports.initialCreditAgentViewState;
|
|
169
|
-
},
|
|
170
|
-
},
|
|
171
|
-
});
|
|
172
|
-
_a = creditAgentView.actions, exports.fetchCreditAgentAccess = _a.fetchCreditAgentAccess, exports.fetchCreditAgentAccessSuccess = _a.fetchCreditAgentAccessSuccess, exports.fetchCreditAgentAccessFailure = _a.fetchCreditAgentAccessFailure, exports.scheduleTenantCreditScoreCron = _a.scheduleTenantCreditScoreCron, exports.scheduleTenantCreditScoreCronSuccess = _a.scheduleTenantCreditScoreCronSuccess, exports.scheduleTenantCreditScoreCronFailure = _a.scheduleTenantCreditScoreCronFailure, exports.fetchCreditAgentMacro = _a.fetchCreditAgentMacro, exports.fetchCreditAgentMacroSuccess = _a.fetchCreditAgentMacroSuccess, exports.fetchCreditAgentMacroFailure = _a.fetchCreditAgentMacroFailure, exports.saveCreditAgentMacro = _a.saveCreditAgentMacro, exports.saveCreditAgentMacroSuccess = _a.saveCreditAgentMacroSuccess, exports.saveCreditAgentMacroFailure = _a.saveCreditAgentMacroFailure, exports.resetSaveMacroState = _a.resetSaveMacroState, exports.fetchCardProfiles = _a.fetchCardProfiles, exports.fetchCardProfilesSuccess = _a.fetchCardProfilesSuccess, exports.fetchCardProfilesFailure = _a.fetchCardProfilesFailure, exports.updateCardProfile = _a.updateCardProfile, exports.updateCardProfileSuccess = _a.updateCardProfileSuccess, exports.updateCardProfileFailure = _a.updateCardProfileFailure, exports.updateCreditAgentUIState = _a.updateCreditAgentUIState, exports.clearCreditAgentView = _a.clearCreditAgentView;
|
|
173
|
-
exports.default = creditAgentView.reducer;
|
|
174
|
-
// ── Helpers ──
|
|
175
|
-
const toTenantViewByTenantId = (rows, existing) => {
|
|
176
|
-
const result = {};
|
|
177
|
-
for (const row of rows) {
|
|
178
|
-
const tenantId = row.tenant_id;
|
|
179
|
-
const existingState = existing[tenantId];
|
|
180
|
-
result[tenantId] = existingState ?? {
|
|
181
|
-
analyzeStatus: { fetchState: 'Not-Started' },
|
|
182
|
-
tenantId,
|
|
183
|
-
updateStatus: { fetchState: 'Not-Started' },
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
return result;
|
|
187
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { FetchStateAndError } from '../../commonStateTypes/common';
|
|
2
|
-
import { CardTenantProfileRow, CreditAgentEntityState, CreditAgentMacro } from '../../entity/creditAgent/creditAgentState';
|
|
3
|
-
import { RootState } from '../../reducer';
|
|
4
|
-
import { CreditAgentUIState, CreditAgentViewState } from './creditAgentViewState';
|
|
5
|
-
export declare const getCreditAgentView: (state: RootState) => CreditAgentViewState;
|
|
6
|
-
export declare const getCreditAgentEntity: (state: RootState) => CreditAgentEntityState;
|
|
7
|
-
export declare const getCreditAgentMacro: (state: RootState) => {
|
|
8
|
-
fetchStatus: FetchStateAndError;
|
|
9
|
-
updateStatus: FetchStateAndError;
|
|
10
|
-
data?: CreditAgentMacro;
|
|
11
|
-
};
|
|
12
|
-
export interface CardProfileRowWithStatus extends CardTenantProfileRow {
|
|
13
|
-
analyzeStatus: FetchStateAndError;
|
|
14
|
-
updateStatus: FetchStateAndError;
|
|
15
|
-
}
|
|
16
|
-
export declare const getCardProfilesData: (state: RootState) => {
|
|
17
|
-
fetchStatus: FetchStateAndError;
|
|
18
|
-
rows: CardProfileRowWithStatus[];
|
|
19
|
-
uiState: CreditAgentUIState;
|
|
20
|
-
};
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getCardProfilesData = exports.getCreditAgentMacro = exports.getCreditAgentEntity = exports.getCreditAgentView = void 0;
|
|
7
|
-
const toolkit_1 = require("@reduxjs/toolkit");
|
|
8
|
-
const orderBy_1 = __importDefault(require("lodash/orderBy"));
|
|
9
|
-
const getCreditAgentView = (state) => state.creditAgentViewState;
|
|
10
|
-
exports.getCreditAgentView = getCreditAgentView;
|
|
11
|
-
const getCreditAgentEntity = (state) => state.creditAgentEntityState;
|
|
12
|
-
exports.getCreditAgentEntity = getCreditAgentEntity;
|
|
13
|
-
exports.getCreditAgentMacro = (0, toolkit_1.createSelector)(exports.getCreditAgentView, exports.getCreditAgentEntity, (view, entity) => ({
|
|
14
|
-
...view.macro,
|
|
15
|
-
data: entity.macro,
|
|
16
|
-
}));
|
|
17
|
-
exports.getCardProfilesData = (0, toolkit_1.createSelector)(exports.getCreditAgentView, exports.getCreditAgentEntity, (view, entity) => {
|
|
18
|
-
const { uiState } = view;
|
|
19
|
-
const allRows = Object.values(entity.rowByTenantId).map((row) => {
|
|
20
|
-
const tenantView = view.tenantViewByTenantId[row.tenantId];
|
|
21
|
-
return {
|
|
22
|
-
...row,
|
|
23
|
-
analyzeStatus: tenantView?.analyzeStatus ?? {
|
|
24
|
-
fetchState: 'Not-Started',
|
|
25
|
-
},
|
|
26
|
-
updateStatus: tenantView?.updateStatus ?? { fetchState: 'Not-Started' },
|
|
27
|
-
};
|
|
28
|
-
});
|
|
29
|
-
let filteredRows = allRows;
|
|
30
|
-
// Text filter
|
|
31
|
-
const trimmedFilterText = uiState.filterText.trim();
|
|
32
|
-
if (trimmedFilterText.length > 0) {
|
|
33
|
-
const query = trimmedFilterText.toLowerCase();
|
|
34
|
-
filteredRows = filteredRows.filter((row) => (row.customerName ?? '').toLowerCase().includes(query) ||
|
|
35
|
-
row.tenantId.toLowerCase().includes(query));
|
|
36
|
-
}
|
|
37
|
-
// Focus filter
|
|
38
|
-
filteredRows = applyFocusFilter(filteredRows, uiState.focus);
|
|
39
|
-
// Min score filter
|
|
40
|
-
if (uiState.minScore > 0) {
|
|
41
|
-
filteredRows = filteredRows.filter((row) => {
|
|
42
|
-
const score = parseFloat(row.creditScore ?? '0');
|
|
43
|
-
return score >= uiState.minScore;
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
// Sorting
|
|
47
|
-
const sortedRows = getSortedRows(filteredRows, uiState.sortKey, uiState.sortDir);
|
|
48
|
-
return {
|
|
49
|
-
fetchStatus: view.profilesFetchStatus,
|
|
50
|
-
rows: sortedRows,
|
|
51
|
-
uiState,
|
|
52
|
-
};
|
|
53
|
-
});
|
|
54
|
-
// ── Helpers ──
|
|
55
|
-
const applyFocusFilter = (rows, focus) => {
|
|
56
|
-
switch (focus) {
|
|
57
|
-
case 'New only':
|
|
58
|
-
return rows.filter((row) => row.isNew);
|
|
59
|
-
case 'Interested':
|
|
60
|
-
return rows.filter((row) => row.cardStatus === 'Interested');
|
|
61
|
-
case 'Active only':
|
|
62
|
-
return rows.filter((row) => row.cardStatus === 'Active' || row.cardStatus === 'Enabled');
|
|
63
|
-
case 'All':
|
|
64
|
-
default:
|
|
65
|
-
return rows;
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
const getSortedRows = (rows, sortKey, sortDir) => {
|
|
69
|
-
if (sortKey == null) {
|
|
70
|
-
return rows;
|
|
71
|
-
}
|
|
72
|
-
const direction = sortDir === 'asc' ? 'asc' : 'desc';
|
|
73
|
-
return (0, orderBy_1.default)(rows, (row) => {
|
|
74
|
-
switch (sortKey) {
|
|
75
|
-
case 'name':
|
|
76
|
-
return (row.customerName ?? '').toLowerCase();
|
|
77
|
-
case 'status':
|
|
78
|
-
return row.cardStatus.toLowerCase();
|
|
79
|
-
case 'creditLimit':
|
|
80
|
-
return row.creditLimit ?? 0;
|
|
81
|
-
case 'creditScore':
|
|
82
|
-
return parseFloat(row.creditScore ?? '0');
|
|
83
|
-
case 'recAmount':
|
|
84
|
-
return row.recommendedAmount ?? 0;
|
|
85
|
-
case 'reportDate':
|
|
86
|
-
return row.reportDate?.valueOf() ?? 0;
|
|
87
|
-
case 'updatedBy':
|
|
88
|
-
return (row.updatedByName ?? '').toLowerCase();
|
|
89
|
-
default:
|
|
90
|
-
return (row.customerName ?? '').toLowerCase();
|
|
91
|
-
}
|
|
92
|
-
}, direction);
|
|
93
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { FetchStateAndError, ID } from '../../commonStateTypes/common';
|
|
2
|
-
export type { CardStatus, CardTenantProfileRow, CreditAgentMacro, } from '../../entity/creditAgent/creditAgentState';
|
|
3
|
-
declare const toCreditAgentSortKeyType: (v: string) => "status" | "name" | "creditLimit" | "creditScore" | "reportDate" | "recAmount" | "updatedBy";
|
|
4
|
-
export type CreditAgentSortKey = ReturnType<typeof toCreditAgentSortKeyType>;
|
|
5
|
-
export type CreditAgentSortDir = 'asc' | 'desc';
|
|
6
|
-
declare const toCreditAgentFocusFilterType: (v: string) => "Interested" | "All" | "New only" | "Active only";
|
|
7
|
-
export type CreditAgentFocusFilter = ReturnType<typeof toCreditAgentFocusFilterType>;
|
|
8
|
-
export interface CreditAgentUIState {
|
|
9
|
-
filterText: string;
|
|
10
|
-
focus: CreditAgentFocusFilter;
|
|
11
|
-
minScore: number;
|
|
12
|
-
sortDir: CreditAgentSortDir;
|
|
13
|
-
sortKey?: CreditAgentSortKey;
|
|
14
|
-
}
|
|
15
|
-
export interface CreditAgentAccessState {
|
|
16
|
-
fetchStatus: FetchStateAndError;
|
|
17
|
-
isAllowed: boolean;
|
|
18
|
-
}
|
|
19
|
-
export interface CreditAgentTenantView {
|
|
20
|
-
analyzeStatus: FetchStateAndError;
|
|
21
|
-
tenantId: ID;
|
|
22
|
-
updateStatus: FetchStateAndError;
|
|
23
|
-
}
|
|
24
|
-
export interface CreditAgentMacroState {
|
|
25
|
-
fetchStatus: FetchStateAndError;
|
|
26
|
-
updateStatus: FetchStateAndError;
|
|
27
|
-
}
|
|
28
|
-
export interface CreditAgentViewState {
|
|
29
|
-
access: CreditAgentAccessState;
|
|
30
|
-
macro: CreditAgentMacroState;
|
|
31
|
-
profilesFetchStatus: FetchStateAndError;
|
|
32
|
-
tenantViewByTenantId: Record<ID, CreditAgentTenantView>;
|
|
33
|
-
uiState: CreditAgentUIState;
|
|
34
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const stringToUnion_1 = require("../../commonStateTypes/stringToUnion");
|
|
4
|
-
const ALL_CREDIT_AGENT_SORT_KEYS = [
|
|
5
|
-
'name',
|
|
6
|
-
'status',
|
|
7
|
-
'creditLimit',
|
|
8
|
-
'creditScore',
|
|
9
|
-
'recAmount',
|
|
10
|
-
'reportDate',
|
|
11
|
-
'updatedBy',
|
|
12
|
-
];
|
|
13
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
14
|
-
const toCreditAgentSortKeyType = (v) => (0, stringToUnion_1.stringToUnion)(v, ALL_CREDIT_AGENT_SORT_KEYS);
|
|
15
|
-
const ALL_CREDIT_AGENT_FOCUS_FILTERS = [
|
|
16
|
-
'All',
|
|
17
|
-
'New only',
|
|
18
|
-
'Interested',
|
|
19
|
-
'Active only',
|
|
20
|
-
];
|
|
21
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
22
|
-
const toCreditAgentFocusFilterType = (v) => (0, stringToUnion_1.stringToUnion)(v, ALL_CREDIT_AGENT_FOCUS_FILTERS);
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable } from 'redux-observable';
|
|
2
|
-
import { updateCreditAgentRows } from '../../../entity/creditAgent/creditAgentReducer';
|
|
3
|
-
import { ZeniAPI } from '../../../zeniAPI';
|
|
4
|
-
import { fetchCardProfiles, fetchCardProfilesFailure, fetchCardProfilesSuccess } from '../creditAgentViewReducer';
|
|
5
|
-
export type ActionType = ReturnType<typeof fetchCardProfiles> | ReturnType<typeof fetchCardProfilesSuccess> | ReturnType<typeof fetchCardProfilesFailure> | ReturnType<typeof updateCreditAgentRows>;
|
|
6
|
-
export declare const fetchCardProfilesEpic: (actions$: ActionsObservable<ActionType>, _state$: unknown, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
|
|
7
|
-
payload: import("../creditAgentViewPayload").CardTenantProfileRowPayload[];
|
|
8
|
-
type: "creditAgentView/fetchCardProfilesSuccess";
|
|
9
|
-
} | {
|
|
10
|
-
payload: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>>;
|
|
11
|
-
type: "creditAgentView/fetchCardProfilesFailure";
|
|
12
|
-
} | {
|
|
13
|
-
payload: import("../creditAgentViewPayload").CardTenantProfileRowPayload[];
|
|
14
|
-
type: "creditAgent/updateCreditAgentRows";
|
|
15
|
-
}>;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fetchCardProfilesEpic = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const creditAgentReducer_1 = require("../../../entity/creditAgent/creditAgentReducer");
|
|
7
|
-
const responsePayload_1 = require("../../../responsePayload");
|
|
8
|
-
const creditAgentViewReducer_1 = require("../creditAgentViewReducer");
|
|
9
|
-
const fetchCardProfilesEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(creditAgentViewReducer_1.fetchCardProfiles.match), (0, operators_1.switchMap)(() => {
|
|
10
|
-
const url = `${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/cockpit/card-tenant-profiles`;
|
|
11
|
-
return zeniAPI.getJSON(url).pipe((0, operators_1.mergeMap)((response) => {
|
|
12
|
-
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
13
|
-
const rawRows = response.data.rows;
|
|
14
|
-
return (0, rxjs_1.from)([
|
|
15
|
-
(0, creditAgentReducer_1.updateCreditAgentRows)(rawRows),
|
|
16
|
-
(0, creditAgentViewReducer_1.fetchCardProfilesSuccess)(rawRows),
|
|
17
|
-
]);
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
return (0, rxjs_1.of)((0, creditAgentViewReducer_1.fetchCardProfilesFailure)(response.status));
|
|
21
|
-
}
|
|
22
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, creditAgentViewReducer_1.fetchCardProfilesFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'REST API call errored out: ' + JSON.stringify(error))))));
|
|
23
|
-
}));
|
|
24
|
-
exports.fetchCardProfilesEpic = fetchCardProfilesEpic;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable } from 'redux-observable';
|
|
2
|
-
import { ZeniAPI } from '../../../zeniAPI';
|
|
3
|
-
import { fetchCreditAgentAccess, fetchCreditAgentAccessFailure, fetchCreditAgentAccessSuccess } from '../creditAgentViewReducer';
|
|
4
|
-
export type ActionType = ReturnType<typeof fetchCreditAgentAccess> | ReturnType<typeof fetchCreditAgentAccessSuccess> | ReturnType<typeof fetchCreditAgentAccessFailure>;
|
|
5
|
-
export declare const fetchCreditAgentAccessEpic: (actions$: ActionsObservable<ActionType>, _state$: unknown, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
|
|
6
|
-
payload: boolean;
|
|
7
|
-
type: "creditAgentView/fetchCreditAgentAccessSuccess";
|
|
8
|
-
} | {
|
|
9
|
-
payload: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>>;
|
|
10
|
-
type: "creditAgentView/fetchCreditAgentAccessFailure";
|
|
11
|
-
}>;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fetchCreditAgentAccessEpic = 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 fetchCreditAgentAccessEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(creditAgentViewReducer_1.fetchCreditAgentAccess.match), (0, operators_1.switchMap)(() => {
|
|
9
|
-
const url = `${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/cockpit/cards-cockpit-access`;
|
|
10
|
-
return zeniAPI.getJSON(url).pipe((0, operators_1.switchMap)((response) => {
|
|
11
|
-
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
12
|
-
return (0, rxjs_1.of)((0, creditAgentViewReducer_1.fetchCreditAgentAccessSuccess)(response.data.is_allowed === true));
|
|
13
|
-
}
|
|
14
|
-
return (0, rxjs_1.of)((0, creditAgentViewReducer_1.fetchCreditAgentAccessFailure)(response.status));
|
|
15
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, creditAgentViewReducer_1.fetchCreditAgentAccessFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'REST API call errored out: ' + JSON.stringify(error))))));
|
|
16
|
-
}));
|
|
17
|
-
exports.fetchCreditAgentAccessEpic = fetchCreditAgentAccessEpic;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable } from 'redux-observable';
|
|
2
|
-
import { updateCreditAgentMacro } from '../../../entity/creditAgent/creditAgentReducer';
|
|
3
|
-
import { ZeniAPI } from '../../../zeniAPI';
|
|
4
|
-
import { fetchCreditAgentMacro, fetchCreditAgentMacroFailure, fetchCreditAgentMacroSuccess } from '../creditAgentViewReducer';
|
|
5
|
-
export type ActionType = ReturnType<typeof fetchCreditAgentMacro> | ReturnType<typeof fetchCreditAgentMacroSuccess> | ReturnType<typeof fetchCreditAgentMacroFailure> | ReturnType<typeof updateCreditAgentMacro>;
|
|
6
|
-
export declare const fetchCreditAgentMacroEpic: (actions$: ActionsObservable<ActionType>, _state$: unknown, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
|
|
7
|
-
payload: undefined;
|
|
8
|
-
type: "creditAgentView/fetchCreditAgentMacroSuccess";
|
|
9
|
-
} | {
|
|
10
|
-
payload: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>>;
|
|
11
|
-
type: "creditAgentView/fetchCreditAgentMacroFailure";
|
|
12
|
-
} | {
|
|
13
|
-
payload: import("../creditAgentViewPayload").MacroPayload;
|
|
14
|
-
type: "creditAgent/updateCreditAgentMacro";
|
|
15
|
-
}>;
|
|
@@ -1,23 +0,0 @@
|
|
|
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 creditAgentReducer_1 = require("../../../entity/creditAgent/creditAgentReducer");
|
|
7
|
-
const responsePayload_1 = require("../../../responsePayload");
|
|
8
|
-
const creditAgentViewReducer_1 = require("../creditAgentViewReducer");
|
|
9
|
-
const fetchCreditAgentMacroEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(creditAgentViewReducer_1.fetchCreditAgentMacro.match), (0, operators_1.switchMap)(() => {
|
|
10
|
-
const url = `${zeniAPI.apiEndPoints.aiCfoMicroServiceBaseUrl}/1.0/macros/credit-agent`;
|
|
11
|
-
return zeniAPI.getJSON(url).pipe((0, operators_1.mergeMap)((response) => {
|
|
12
|
-
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
13
|
-
return (0, rxjs_1.from)([
|
|
14
|
-
(0, creditAgentReducer_1.updateCreditAgentMacro)(response.data),
|
|
15
|
-
(0, creditAgentViewReducer_1.fetchCreditAgentMacroSuccess)(),
|
|
16
|
-
]);
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
return (0, rxjs_1.of)((0, creditAgentViewReducer_1.fetchCreditAgentMacroFailure)(response.status));
|
|
20
|
-
}
|
|
21
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, creditAgentViewReducer_1.fetchCreditAgentMacroFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'REST API call errored out: ' + JSON.stringify(error))))));
|
|
22
|
-
}));
|
|
23
|
-
exports.fetchCreditAgentMacroEpic = fetchCreditAgentMacroEpic;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { updateCreditAgentMacro } from '../../../entity/creditAgent/creditAgentReducer';
|
|
3
|
-
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
4
|
-
import { RootState } from '../../../reducer';
|
|
5
|
-
import { ZeniAPI } from '../../../zeniAPI';
|
|
6
|
-
import { saveCreditAgentMacro, saveCreditAgentMacroFailure, saveCreditAgentMacroSuccess } from '../creditAgentViewReducer';
|
|
7
|
-
export type ActionType = ReturnType<typeof saveCreditAgentMacro> | ReturnType<typeof saveCreditAgentMacroSuccess> | ReturnType<typeof saveCreditAgentMacroFailure> | ReturnType<typeof updateCreditAgentMacro> | ReturnType<typeof openSnackbar>;
|
|
8
|
-
export declare const saveCreditAgentMacroEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
|
|
9
|
-
payload: {
|
|
10
|
-
messageSection: import("../../..").SnackbarMessageSections;
|
|
11
|
-
messageText: import("../../..").SnackbarMessageSectionTexts;
|
|
12
|
-
type: import("../../..").SnackbarMessageType;
|
|
13
|
-
showStatusIcon?: boolean;
|
|
14
|
-
variables?: {
|
|
15
|
-
variableName: string;
|
|
16
|
-
variableValue: string;
|
|
17
|
-
}[];
|
|
18
|
-
};
|
|
19
|
-
type: "snackbar/openSnackbar";
|
|
20
|
-
} | {
|
|
21
|
-
payload: import("../creditAgentViewPayload").MacroPayload;
|
|
22
|
-
type: "creditAgent/updateCreditAgentMacro";
|
|
23
|
-
} | {
|
|
24
|
-
payload: undefined;
|
|
25
|
-
type: "creditAgentView/saveCreditAgentMacroSuccess";
|
|
26
|
-
} | {
|
|
27
|
-
payload: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>>;
|
|
28
|
-
type: "creditAgentView/saveCreditAgentMacroFailure";
|
|
29
|
-
}>;
|