@zeniai/client-epic-state 4.19.77-betaML1 → 4.19.77-betaSS1
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/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +0 -1
- package/lib/epic.d.ts +5 -2
- package/lib/epic.js +5 -2
- package/lib/esm/entity/snackbar/snackbarTypes.js +0 -1
- package/lib/esm/epic.js +5 -2
- package/lib/esm/index.js +6 -4
- package/lib/esm/reducer.js +3 -0
- package/lib/esm/view/accountList/accountListReducer.js +1 -3
- package/lib/esm/view/accountList/accountListSelector.js +0 -8
- package/lib/esm/view/accountList/fetchAccountListEpic.js +10 -20
- package/lib/esm/view/creditAgentView/creditAgentViewPayload.js +1 -0
- package/lib/esm/view/creditAgentView/creditAgentViewReducer.js +113 -0
- package/lib/esm/view/creditAgentView/creditAgentViewSelector.js +3 -0
- package/lib/esm/view/creditAgentView/creditAgentViewState.js +18 -0
- package/lib/esm/view/creditAgentView/epics/fetchCreditAgentMacroEpic.js +16 -0
- package/lib/esm/view/creditAgentView/epics/fetchTenantCreditScoreReportEpic.js +16 -0
- package/lib/esm/view/creditAgentView/epics/saveCreditAgentMacroEpic.js +23 -0
- package/lib/esm/view/creditAgentView/epics/scheduleTenantCreditScoreCronEpic.js +19 -0
- package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationViewEpic.js +0 -5
- package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +1 -30
- package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +0 -3
- package/lib/esm/view/transactionDetail/epics/transactionDetailEpic.js +0 -5
- package/lib/esm/view/transactionDetail/transactionDetailSelector.js +0 -2
- package/lib/index.d.ts +7 -4
- package/lib/index.js +49 -35
- package/lib/reducer.d.ts +3 -0
- package/lib/reducer.js +3 -0
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
- package/lib/view/accountList/accountListReducer.d.ts +1 -2
- package/lib/view/accountList/accountListReducer.js +1 -3
- package/lib/view/accountList/accountListSelector.d.ts +1 -6
- package/lib/view/accountList/accountListSelector.js +1 -10
- package/lib/view/accountList/accountListState.d.ts +1 -1
- package/lib/view/accountList/fetchAccountListEpic.js +10 -20
- package/lib/view/creditAgentView/creditAgentViewPayload.d.ts +64 -0
- package/lib/view/creditAgentView/creditAgentViewPayload.js +2 -0
- package/lib/view/creditAgentView/creditAgentViewReducer.d.ts +11 -0
- package/lib/view/creditAgentView/creditAgentViewReducer.js +117 -0
- package/lib/view/creditAgentView/creditAgentViewSelector.d.ts +17 -0
- package/lib/view/creditAgentView/creditAgentViewSelector.js +9 -0
- package/lib/view/creditAgentView/creditAgentViewState.d.ts +58 -0
- package/lib/view/creditAgentView/creditAgentViewState.js +21 -0
- package/lib/view/creditAgentView/epics/fetchCreditAgentMacroEpic.d.ts +12 -0
- package/lib/view/creditAgentView/epics/fetchCreditAgentMacroEpic.js +20 -0
- package/lib/view/creditAgentView/epics/fetchTenantCreditScoreReportEpic.d.ts +12 -0
- package/lib/view/creditAgentView/epics/fetchTenantCreditScoreReportEpic.js +20 -0
- package/lib/view/creditAgentView/epics/saveCreditAgentMacroEpic.d.ts +12 -0
- package/lib/view/creditAgentView/epics/saveCreditAgentMacroEpic.js +27 -0
- package/lib/view/creditAgentView/epics/scheduleTenantCreditScoreCronEpic.d.ts +12 -0
- package/lib/view/creditAgentView/epics/scheduleTenantCreditScoreCronEpic.js +23 -0
- package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationViewEpic.js +0 -5
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +1 -17
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +2 -31
- package/lib/view/expenseAutomationView/selectorTypes/transactionsViewSelectorTypes.d.ts +1 -10
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +0 -3
- package/lib/view/transactionDetail/epics/transactionDetailEpic.js +0 -5
- package/lib/view/transactionDetail/transactionDetailSelector.d.ts +1 -4
- package/lib/view/transactionDetail/transactionDetailSelector.js +0 -2
- package/lib/zeniAPI.d.ts +1 -0
- package/package.json +54 -28
- package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/convertTransactionTypeEpic.js +0 -78
- package/lib/view/expenseAutomationView/epics/transactionCategorization/convertTransactionTypeEpic.d.ts +0 -38
- package/lib/view/expenseAutomationView/epics/transactionCategorization/convertTransactionTypeEpic.js +0 -82
|
@@ -3,8 +3,7 @@ import { AccountListResponse } from './accountListPayload';
|
|
|
3
3
|
import { AccountList, AccountListKeyType, AccountListState } from './accountListState';
|
|
4
4
|
export declare const initialAccountList: AccountList;
|
|
5
5
|
export declare const initialState: AccountListState;
|
|
6
|
-
export declare const fetchAccountList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[accountListKey: AccountListKeyType, fetchFullResponse?: any, excludeAccountPayableAccounts?: any, excludeAccountReceivableAccounts?: any, isLimitedCategoryEnabled?: any, filterAccountTypes?: ("cash_position" | "fixed_assets" | "bank" | "credit_card" | "expenses" | "cogs" | "income" | "cash_in" | "cash_out" | "other_income" | "other_expense" | "accounts_receivable" | "other_current_assets" | "other_assets" | "accounts_payable" | "other_current_liabilities" | "long_term_liabilities" | "equity" | "current_liabilities" | "current_assets")[] | undefined, isIncludeDeleted?: boolean | undefined
|
|
7
|
-
query?: Record<string, unknown> | undefined;
|
|
6
|
+
export declare const fetchAccountList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[accountListKey: AccountListKeyType, fetchFullResponse?: any, excludeAccountPayableAccounts?: any, excludeAccountReceivableAccounts?: any, isLimitedCategoryEnabled?: any, filterAccountTypes?: ("cash_position" | "fixed_assets" | "bank" | "credit_card" | "expenses" | "cogs" | "income" | "cash_in" | "cash_out" | "other_income" | "other_expense" | "accounts_receivable" | "other_current_assets" | "other_assets" | "accounts_payable" | "other_current_liabilities" | "long_term_liabilities" | "equity" | "current_liabilities" | "current_assets")[] | undefined, isIncludeDeleted?: boolean | undefined], {
|
|
8
7
|
isIncludeDeleted?: true | undefined;
|
|
9
8
|
accountListKey: AccountListKeyType;
|
|
10
9
|
fetchFullResponse: any;
|
|
@@ -34,7 +34,6 @@ exports.initialState = {
|
|
|
34
34
|
reimbursementAccountList: exports.initialAccountList,
|
|
35
35
|
schedulesAccountList: exports.initialAccountList,
|
|
36
36
|
billPayAccountList: exports.initialAccountList,
|
|
37
|
-
bankAndCreditCardAccounts: exports.initialAccountList,
|
|
38
37
|
},
|
|
39
38
|
};
|
|
40
39
|
const accountList = (0, toolkit_1.createSlice)({
|
|
@@ -50,7 +49,7 @@ const accountList = (0, toolkit_1.createSlice)({
|
|
|
50
49
|
error: undefined,
|
|
51
50
|
};
|
|
52
51
|
},
|
|
53
|
-
prepare(accountListKey, fetchFullResponse = false, excludeAccountPayableAccounts = false, excludeAccountReceivableAccounts = false, isLimitedCategoryEnabled = false, filterAccountTypes, isIncludeDeleted
|
|
52
|
+
prepare(accountListKey, fetchFullResponse = false, excludeAccountPayableAccounts = false, excludeAccountReceivableAccounts = false, isLimitedCategoryEnabled = false, filterAccountTypes, isIncludeDeleted) {
|
|
54
53
|
return {
|
|
55
54
|
payload: {
|
|
56
55
|
accountListKey,
|
|
@@ -60,7 +59,6 @@ const accountList = (0, toolkit_1.createSlice)({
|
|
|
60
59
|
isLimitedCategoryEnabled,
|
|
61
60
|
filterAccountTypes: filterAccountTypes ?? [],
|
|
62
61
|
...(isIncludeDeleted === true && { isIncludeDeleted }),
|
|
63
|
-
...(query != null && { query }),
|
|
64
62
|
},
|
|
65
63
|
};
|
|
66
64
|
},
|
|
@@ -2,7 +2,7 @@ import { NestedAccountHierarchyForReport } from '../../commonStateTypes/accountV
|
|
|
2
2
|
import { FetchState, ID } from '../../commonStateTypes/common';
|
|
3
3
|
import { SelectorView } from '../../commonStateTypes/viewAndReport/viewAndReport';
|
|
4
4
|
import { AccountBase, AccountLabel, AccountState } from '../../entity/account/accountState';
|
|
5
|
-
import {
|
|
5
|
+
import { AccountListKeyType, AccountListState } from './accountListState';
|
|
6
6
|
export interface AccountListSelectorView extends SelectorView {
|
|
7
7
|
accounts: AccountBase[];
|
|
8
8
|
}
|
|
@@ -28,8 +28,3 @@ export declare const getFilteredNestedAndAccountListsForLabel: (accountState: Ac
|
|
|
28
28
|
nestedAccountList: NestedAccountHierarchyForReport[];
|
|
29
29
|
};
|
|
30
30
|
export declare const getAccountIdsForLabel: (accountListState: AccountListState, accountListKey: AccountListKeyType, accountLabel: AccountLabel) => ID[];
|
|
31
|
-
/**
|
|
32
|
-
* Selector for bank and credit card accounts (e.g. used in the convert transaction type drawer).
|
|
33
|
-
* Fetched once when transaction categorization or transaction detail is loaded; result is cached.
|
|
34
|
-
*/
|
|
35
|
-
export declare const getBankAndCreditCardAccountList: (accountListState: AccountListState) => AccountList;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getAccountIdsForLabel = exports.getFilteredNestedAndAccountListsForLabel = exports.getNestedAccountListHierarchy = exports.getUncategorizedAccounts = exports.getAccountListFetchState = exports.getAccountList = void 0;
|
|
4
4
|
const accountSelector_1 = require("../../entity/account/accountSelector");
|
|
5
|
-
const BANK_AND_CREDIT_CARD_ACCOUNTS_KEY = 'bankAndCreditCardAccounts';
|
|
6
5
|
const getAccountList = (accountState, accountListState, accountListKey) => {
|
|
7
6
|
const accListState = accountListState.byReportId[accountListKey];
|
|
8
7
|
return {
|
|
@@ -82,11 +81,3 @@ const getAccountIdsForLabel = (accountListState, accountListKey, accountLabel) =
|
|
|
82
81
|
return [];
|
|
83
82
|
};
|
|
84
83
|
exports.getAccountIdsForLabel = getAccountIdsForLabel;
|
|
85
|
-
/**
|
|
86
|
-
* Selector for bank and credit card accounts (e.g. used in the convert transaction type drawer).
|
|
87
|
-
* Fetched once when transaction categorization or transaction detail is loaded; result is cached.
|
|
88
|
-
*/
|
|
89
|
-
const getBankAndCreditCardAccountList = (accountListState) => {
|
|
90
|
-
return accountListState.byReportId[BANK_AND_CREDIT_CARD_ACCOUNTS_KEY];
|
|
91
|
-
};
|
|
92
|
-
exports.getBankAndCreditCardAccountList = getBankAndCreditCardAccountList;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { NestedAccountHierarchyForReport } from '../../commonStateTypes/accountView/nestedAccountID';
|
|
2
2
|
import { FetchedState, ID } from '../../commonStateTypes/common';
|
|
3
3
|
import { AccountLabel } from '../../entity/account/accountState';
|
|
4
|
-
export type AccountListKeyType = 'accountList' | 'reimbursementAccountList' | 'schedulesAccountList' | 'billPayAccountList'
|
|
4
|
+
export type AccountListKeyType = 'accountList' | 'reimbursementAccountList' | 'schedulesAccountList' | 'billPayAccountList';
|
|
5
5
|
export interface AccountList extends FetchedState {
|
|
6
6
|
accountIds: ID[];
|
|
7
7
|
accountIdsByLabel: Record<AccountLabel, ID[]>;
|
|
@@ -16,36 +16,26 @@ const getAccountTypes = (isLimitedCategoryEnabled, filterAccountTypes) => {
|
|
|
16
16
|
return [];
|
|
17
17
|
};
|
|
18
18
|
const fetchAccountListEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(accountListReducer_1.fetchAccountList.match), (0, operators_1.mergeMap)((action) => {
|
|
19
|
-
const { accountListKey, fetchFullResponse, excludeAccountPayableAccounts, excludeAccountReceivableAccounts, isLimitedCategoryEnabled, filterAccountTypes, isIncludeDeleted,
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return {
|
|
29
|
-
is_bookkeeping_admin: fetchFullResponse,
|
|
30
|
-
is_exclude_account_payable_accounts: excludeAccountPayableAccounts,
|
|
31
|
-
is_exclude_account_receivable_accounts: excludeAccountReceivableAccounts,
|
|
32
|
-
account_types: accountTypes,
|
|
33
|
-
...(isIncludeDeleted === true && { is_include_deleted: true }),
|
|
34
|
-
};
|
|
35
|
-
})();
|
|
19
|
+
const { accountListKey, fetchFullResponse, excludeAccountPayableAccounts, excludeAccountReceivableAccounts, isLimitedCategoryEnabled, filterAccountTypes, isIncludeDeleted, } = action.payload;
|
|
20
|
+
const accountTypes = getAccountTypes(isLimitedCategoryEnabled, filterAccountTypes);
|
|
21
|
+
const queryValue = {
|
|
22
|
+
is_bookkeeping_admin: fetchFullResponse,
|
|
23
|
+
is_exclude_account_payable_accounts: excludeAccountPayableAccounts,
|
|
24
|
+
is_exclude_account_receivable_accounts: excludeAccountReceivableAccounts,
|
|
25
|
+
account_types: accountTypes,
|
|
26
|
+
...(isIncludeDeleted === true && { is_include_deleted: true }),
|
|
27
|
+
};
|
|
36
28
|
return zeniAPI
|
|
37
29
|
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accounts?query=${encodeURIComponent(JSON.stringify(queryValue))}`)
|
|
38
30
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
39
31
|
if ((0, responsePayload_1.isSuccessResponse)(response)) {
|
|
40
32
|
const actions = [
|
|
33
|
+
(0, accountReducer_1.updateAccounts)(response.data?.accounts ?? [], 'account_list'),
|
|
41
34
|
(0, accountListReducer_1.updateAccountList)({
|
|
42
35
|
accountListKey,
|
|
43
36
|
accountListResponse: response,
|
|
44
37
|
}),
|
|
45
38
|
];
|
|
46
|
-
if (accountListKey !== 'bankAndCreditCardAccounts') {
|
|
47
|
-
actions.unshift((0, accountReducer_1.updateAccounts)(response.data?.accounts ?? [], 'account_list'));
|
|
48
|
-
}
|
|
49
39
|
return (0, rxjs_1.from)(actions);
|
|
50
40
|
}
|
|
51
41
|
else {
|
|
@@ -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,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.chatMicroServiceBaseUrl}/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.chatMicroServiceBaseUrl}/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;
|
|
@@ -24,11 +24,6 @@ const fetchTransactionCategorizationViewEpic = (actions$, state$) => actions$.pi
|
|
|
24
24
|
accountList.fetchState === 'Not-Started') {
|
|
25
25
|
updateActions.push((0, accountListReducer_1.fetchAccountList)('accountList', true));
|
|
26
26
|
}
|
|
27
|
-
const bankAndCreditCardAccounts = state$.value.accountListState.byReportId.bankAndCreditCardAccounts;
|
|
28
|
-
if (bankAndCreditCardAccounts.hasValidState() === false &&
|
|
29
|
-
bankAndCreditCardAccounts.fetchState === 'Not-Started') {
|
|
30
|
-
updateActions.push((0, accountListReducer_1.fetchAccountList)('bankAndCreditCardAccounts'));
|
|
31
|
-
}
|
|
32
27
|
const classList = state$.value.classListState;
|
|
33
28
|
if (classList.hasValidState() === false &&
|
|
34
29
|
classList.fetchState === 'Not-Started') {
|