@zeniai/client-epic-state 5.0.44-betaRD3 → 5.0.45
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/commonStateTypes/recommendationBase.d.ts +1 -2
- package/lib/commonStateTypes/viewAndReport/viewAndReport.d.ts +2 -2
- package/lib/commonStateTypes/viewAndReport/viewAndReport.js +0 -1
- package/lib/entity/account/accountState.d.ts +1 -1
- package/lib/entity/accountGroup/accountGroupState.d.ts +1 -1
- package/lib/entity/chargeCardRepayment/chargeCardRepayment.d.ts +1 -1
- package/lib/entity/class/classReducer.d.ts +4 -4
- package/lib/entity/class/classState.d.ts +1 -1
- package/lib/entity/forecast/forecastState.d.ts +1 -1
- package/lib/entity/project/projectPayload.d.ts +0 -7
- package/lib/entity/project/projectPayload.js +1 -15
- package/lib/entity/sectionAccountsView/sectionAccountsView.d.ts +1 -1
- package/lib/entity/sectionClassesViewV2/sectionClassesView.d.ts +1 -1
- package/lib/entity/sectionClassesViewV2/sectionClassesViewReducer.d.ts +2 -2
- package/lib/entity/sectionProjectView/sectionProjectView.d.ts +1 -1
- package/lib/entity/sectionProjectView/sectionProjectViewReducer.d.ts +2 -2
- 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 -6
- package/lib/entity/tenant/clearAllEpic.js +2 -8
- package/lib/entity/transaction/payloadTypes/transactionLinePayload.d.ts +0 -2
- package/lib/entity/transaction/payloadTypes/transactionLinePayload.js +0 -9
- package/lib/entity/transaction/stateTypes/transactionLine.d.ts +0 -2
- package/lib/epic.d.ts +1 -10
- package/lib/epic.js +1 -10
- package/lib/esm/commonStateTypes/viewAndReport/viewAndReport.js +0 -1
- package/lib/esm/entity/project/projectPayload.js +0 -12
- package/lib/esm/entity/snackbar/snackbarTypes.js +0 -3
- package/lib/esm/entity/tenant/clearAllEpic.js +2 -8
- package/lib/esm/entity/transaction/payloadTypes/transactionLinePayload.js +0 -9
- package/lib/esm/epic.js +1 -10
- package/lib/esm/index.js +10 -19
- package/lib/esm/reducer.js +3 -12
- package/lib/esm/view/transactionDetail/epics/saveTransactionHelper.js +0 -1
- package/lib/esm/view/transactionDetail/epics/transactionDetailEpic.js +0 -6
- package/lib/esm/view/transactionDetail/epics/updateTransactionDetailEpic.js +0 -3
- package/lib/esm/view/transactionDetail/transactionDetailSelector.js +2 -14
- package/lib/esm/view/transactionList/transactionListReducer.js +2 -83
- package/lib/esm/view/transactionList/transactionListState.js +0 -10
- package/lib/index.d.ts +14 -25
- package/lib/index.js +46 -86
- package/lib/reducer.d.ts +3 -12
- package/lib/reducer.js +3 -12
- package/lib/view/auditReportView/auditReportViewState.d.ts +1 -1
- package/lib/view/billPayCard/billPayCardSelector.d.ts +1 -1
- package/lib/view/cardBalance/cardBalanceSelector.d.ts +1 -1
- package/lib/view/cashBalance/cashBalanceSelector.d.ts +1 -1
- package/lib/view/cashInCashOut/cashInCashOutSelector.d.ts +1 -1
- package/lib/view/cashPosition/cashPositionSelector.d.ts +1 -1
- package/lib/view/dashboard/dashboardReducer.d.ts +2 -2
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/financeStatement/financeStatementReducer.d.ts +1 -1
- package/lib/view/globalMerchantView/globalMerchantViewReducer.d.ts +2 -2
- package/lib/view/reimbursementCard/reimbursementCardSelector.d.ts +1 -1
- package/lib/view/reportsResync/reportsResyncReducer.d.ts +2 -2
- package/lib/view/tasksCard/tasksCardSelector.d.ts +1 -1
- package/lib/view/topEx/topExSelector.d.ts +1 -1
- package/lib/view/transactionDetail/epics/saveTransactionHelper.js +0 -1
- package/lib/view/transactionDetail/epics/transactionDetailEpic.d.ts +1 -2
- package/lib/view/transactionDetail/epics/transactionDetailEpic.js +0 -6
- package/lib/view/transactionDetail/epics/updateTransactionDetailEpic.js +0 -3
- package/lib/view/transactionDetail/transactionDetailSelector.d.ts +0 -3
- package/lib/view/transactionDetail/transactionDetailSelector.js +1 -13
- package/lib/view/transactionDetail/transactionDetailState.d.ts +0 -2
- package/lib/view/transactionDetail/transactionDetailTypes.d.ts +0 -2
- package/lib/view/transactionList/transactionListPayload.d.ts +0 -15
- package/lib/view/transactionList/transactionListReducer.d.ts +2 -25
- package/lib/view/transactionList/transactionListReducer.js +2 -83
- package/lib/view/transactionList/transactionListState.d.ts +0 -15
- package/lib/view/transactionList/transactionListState.js +1 -13
- 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/esm/view/projectList/fetchProjectListEpic.js +0 -38
- package/lib/esm/view/projectList/projectListPayload.js +0 -1
- package/lib/esm/view/projectList/projectListReducer.js +0 -39
- package/lib/esm/view/projectList/projectListSelector.js +0 -9
- package/lib/esm/view/projectList/projectListState.js +0 -1
- package/lib/esm/view/transactionList/fetchTransactionListByProjectEpic.js +0 -45
- package/lib/esm/view/transactionList/parallelFetchProjectTransactionListEpic.js +0 -32
- package/lib/esm/view/transactionList/transactionListByProjectSelector.js +0 -58
- 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
- package/lib/view/projectList/fetchProjectListEpic.d.ts +0 -8
- package/lib/view/projectList/fetchProjectListEpic.js +0 -42
- package/lib/view/projectList/projectListPayload.d.ts +0 -7
- package/lib/view/projectList/projectListPayload.js +0 -2
- package/lib/view/projectList/projectListReducer.d.ts +0 -9
- package/lib/view/projectList/projectListReducer.js +0 -43
- package/lib/view/projectList/projectListSelector.d.ts +0 -8
- package/lib/view/projectList/projectListSelector.js +0 -13
- package/lib/view/projectList/projectListState.d.ts +0 -4
- package/lib/view/projectList/projectListState.js +0 -2
- package/lib/view/transactionList/fetchTransactionListByProjectEpic.d.ts +0 -8
- package/lib/view/transactionList/fetchTransactionListByProjectEpic.js +0 -52
- package/lib/view/transactionList/parallelFetchProjectTransactionListEpic.d.ts +0 -6
- package/lib/view/transactionList/parallelFetchProjectTransactionListEpic.js +0 -36
- package/lib/view/transactionList/transactionListByProjectSelector.d.ts +0 -22
- package/lib/view/transactionList/transactionListByProjectSelector.js +0 -66
|
@@ -15,10 +15,9 @@ const vendorSelector_1 = require("../../entity/vendor/vendorSelector");
|
|
|
15
15
|
const zeniDayJS_1 = require("../../zeniDayJS");
|
|
16
16
|
const accountListSelector_1 = require("../accountList/accountListSelector");
|
|
17
17
|
const classListSelector_1 = require("../classList/classListSelector");
|
|
18
|
-
const projectListSelector_1 = require("../projectList/projectListSelector");
|
|
19
18
|
const transactionDetailState_1 = require("./transactionDetailState");
|
|
20
19
|
const getTransactionDetail = (state, transactionId, fetchLinkedTransactions = true) => {
|
|
21
|
-
const { transactionDetailState, transactionState, vendorState, vendorListState, accountState, classState, classListState, accountListState,
|
|
20
|
+
const { transactionDetailState, transactionState, vendorState, vendorListState, accountState, classState, classListState, accountListState, } = state;
|
|
22
21
|
const detailKey = (0, transactionDetailState_1.getTransactionDetailKey)(transactionId);
|
|
23
22
|
const transactionDetail = (0, get_1.default)(transactionDetailState.transactionDetailById, detailKey);
|
|
24
23
|
let fetchState = {
|
|
@@ -64,15 +63,6 @@ const getTransactionDetail = (state, transactionId, fetchLinkedTransactions = tr
|
|
|
64
63
|
const classList = isAccountingClassesEnabled
|
|
65
64
|
? (0, classListSelector_1.getClassList)(classState, classListState)
|
|
66
65
|
: { classes: [], nestedClassHierarchy: [], fetchState: 'Completed', error: undefined, version: 0 };
|
|
67
|
-
const isAccountingProjectsEnabled = (0, tenantSelector_1.getIsAccountingProjectsEnabled)(state);
|
|
68
|
-
const projectList = isAccountingProjectsEnabled
|
|
69
|
-
? (0, projectListSelector_1.getProjectList)(projectState, projectListState)
|
|
70
|
-
: {
|
|
71
|
-
projects: [],
|
|
72
|
-
fetchState: 'Completed',
|
|
73
|
-
error: undefined,
|
|
74
|
-
version: 0,
|
|
75
|
-
};
|
|
76
66
|
const accountsHierarchyList = (0, accountListSelector_1.getNestedAccountListHierarchy)(accountListState, 'accountList');
|
|
77
67
|
const classHierarchyList = isAccountingClassesEnabled
|
|
78
68
|
? (0, classListSelector_1.getNestedClassListHierarchy)(classListState)
|
|
@@ -95,8 +85,6 @@ const getTransactionDetail = (state, transactionId, fetchLinkedTransactions = tr
|
|
|
95
85
|
accountsHierarchyList,
|
|
96
86
|
classList: classList,
|
|
97
87
|
isAccountingClassesEnabled,
|
|
98
|
-
isAccountingProjectsEnabled,
|
|
99
|
-
projectList,
|
|
100
88
|
isUpdateNotAllowed: transactionDetail?.isUpdateNotAllowed,
|
|
101
89
|
transactionDetailLocalData: transactionDetail?.transactionDetailLocalData ??
|
|
102
90
|
transactionDetailState_1.initialSupportedTransactionDetail.transactionDetailLocalData,
|
|
@@ -4,7 +4,6 @@ import { AccountBase } from '../../entity/account/accountState';
|
|
|
4
4
|
import { ClassBase } from '../../entity/class/classState';
|
|
5
5
|
import { CustomerBase } from '../../entity/customer/customerState';
|
|
6
6
|
import { EntityType } from '../../entity/genericEntity/entity';
|
|
7
|
-
import { Project } from '../../entity/project/projectState';
|
|
8
7
|
import { Transaction, TransactionID } from '../../entity/transaction/stateTypes/transaction';
|
|
9
8
|
import { VendorBase } from '../../entity/vendor/vendorState';
|
|
10
9
|
import { EntityRecommendationKey } from '../recommendation/recommendationState';
|
|
@@ -53,7 +52,6 @@ export interface TransactionLineUpdates {
|
|
|
53
52
|
class?: ClassBase;
|
|
54
53
|
customer?: CustomerBase;
|
|
55
54
|
lineDescription?: string;
|
|
56
|
-
project?: Project;
|
|
57
55
|
recommendation?: Recommendation[];
|
|
58
56
|
vendor?: VendorBase;
|
|
59
57
|
}
|
|
@@ -4,7 +4,6 @@ import { AccountBase, RecommendedAccountBase } from '../../entity/account/accoun
|
|
|
4
4
|
import { ClassBase, RecommendedClassBase } from '../../entity/class/classState';
|
|
5
5
|
import { CustomerBase } from '../../entity/customer/customerState';
|
|
6
6
|
import { Entity } from '../../entity/genericEntity/entity';
|
|
7
|
-
import { Project } from '../../entity/project/projectState';
|
|
8
7
|
import { TransactionID } from '../../entity/transaction/stateTypes/transaction';
|
|
9
8
|
import { BillableStatus, PlatformLineDetailType, ProductOrService, TransactionLineBase } from '../../entity/transaction/stateTypes/transactionLine';
|
|
10
9
|
import { TransactionCategory, TransactionType } from '../../entity/transaction/stateTypes/transactionType';
|
|
@@ -30,7 +29,6 @@ export interface TransactionDetailLineItemData extends TransactionLineBase {
|
|
|
30
29
|
linkedTransactions?: TransactionID[];
|
|
31
30
|
postingType?: TransactionCategory;
|
|
32
31
|
postingTypeName?: string;
|
|
33
|
-
project?: Project;
|
|
34
32
|
recommendationsWithCOT?: RecommendationWithCOT[];
|
|
35
33
|
recommendedAccount?: RecommendedAccountBase;
|
|
36
34
|
recommendedClass?: RecommendedClassBase;
|
|
@@ -48,24 +48,9 @@ export interface TransactionListByClassPayload {
|
|
|
48
48
|
query: QueryClassMetaDataPayload;
|
|
49
49
|
query_definitions: Record<string, unknown>;
|
|
50
50
|
}
|
|
51
|
-
interface QueryProjectMetaDataPayload {
|
|
52
|
-
account_id: string;
|
|
53
|
-
account_type: string;
|
|
54
|
-
end_date: string;
|
|
55
|
-
group_by: string;
|
|
56
|
-
sort_order: string;
|
|
57
|
-
start_date: string;
|
|
58
|
-
zeni_project_id: string;
|
|
59
|
-
}
|
|
60
|
-
export interface TransactionListByProjectPayload {
|
|
61
|
-
account: TransactionListPayload;
|
|
62
|
-
query: QueryProjectMetaDataPayload;
|
|
63
|
-
query_definitions: Record<string, unknown>;
|
|
64
|
-
}
|
|
65
51
|
export type TransactionListByAccountResponse = ZeniAPIResponse<TransactionListByAccountPayload>;
|
|
66
52
|
export type TransactionListByEntityResponse = ZeniAPIResponse<TransactionListByEntityPayload>;
|
|
67
53
|
export type TransactionListByClassResponse = ZeniAPIResponse<TransactionListByClassPayload>;
|
|
68
|
-
export type TransactionListByProjectResponse = ZeniAPIResponse<TransactionListByProjectPayload>;
|
|
69
54
|
interface TransactionsByCategoryTypePayload {
|
|
70
55
|
query: QueryTransactionByCategoryTypeMetaDataPayload;
|
|
71
56
|
transactions: TransactionPayload[];
|
|
@@ -6,7 +6,7 @@ import { Entity } from '../../entity/genericEntity/entity';
|
|
|
6
6
|
import { TransactionPayload } from '../../entity/transaction/payloadTypes/transactionPayload';
|
|
7
7
|
import { TransactionID } from '../../entity/transaction/stateTypes/transaction';
|
|
8
8
|
import { ZeniAPIStatus } from '../../responsePayload';
|
|
9
|
-
import { TransactionListByAccountPayload, TransactionListByClassPayload, TransactionListByEntityPayload
|
|
9
|
+
import { TransactionListByAccountPayload, TransactionListByClassPayload, TransactionListByEntityPayload } from './transactionListPayload';
|
|
10
10
|
import { TransactionCategoryType, TransactionListState, TransactionListUIState } from './transactionListState';
|
|
11
11
|
export declare const initialState: TransactionListState;
|
|
12
12
|
export declare const parallelFetchAccountTransactionList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[accountId: string, accountType: "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", period: TimePeriod, accountName?: string | undefined, cacheOverride?: any, includeSubAccountTransactions?: any], {
|
|
@@ -69,30 +69,7 @@ export declare const parallelFetchAccountTransactionList: import("@reduxjs/toolk
|
|
|
69
69
|
classId: string;
|
|
70
70
|
period: TimePeriod;
|
|
71
71
|
error: ZeniAPIStatus<Record<string, unknown>>;
|
|
72
|
-
}, "transactionList/updateTransactionListByClassFailure", never, never>,
|
|
73
|
-
accountId: string;
|
|
74
|
-
accountType: "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";
|
|
75
|
-
projectId: string;
|
|
76
|
-
period: TimePeriod;
|
|
77
|
-
cacheOverride: any;
|
|
78
|
-
}, "transactionList/parallelFetchProjectTransactionList", never, never>, fetchProjectTransactionList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[accountId: string, accountType: "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", projectId: string, period: TimePeriod, cacheOverride?: any], {
|
|
79
|
-
accountId: string;
|
|
80
|
-
accountType: "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";
|
|
81
|
-
projectId: string;
|
|
82
|
-
period: TimePeriod;
|
|
83
|
-
cacheOverride: any;
|
|
84
|
-
}, "transactionList/fetchProjectTransactionList", never, never>, updateTransactionListByProject: import("@reduxjs/toolkit").ActionCreatorWithPayload<TransactionListByProjectPayload, "transactionList/updateTransactionListByProject">, updateTransactionListByProjectUIState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
85
|
-
accountId: ID;
|
|
86
|
-
accountType: AccountType;
|
|
87
|
-
projectId: ID;
|
|
88
|
-
uiState: TransactionListUIState;
|
|
89
|
-
}, "transactionList/updateTransactionListByProjectUIState">, updateTransactionListByProjectFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[accountId: string, accountType: "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", projectId: string, period: TimePeriod, error: ZeniAPIStatus<Record<string, unknown>>], {
|
|
90
|
-
accountId: string;
|
|
91
|
-
accountType: "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";
|
|
92
|
-
projectId: string;
|
|
93
|
-
period: TimePeriod;
|
|
94
|
-
error: ZeniAPIStatus<Record<string, unknown>>;
|
|
95
|
-
}, "transactionList/updateTransactionListByProjectFailure", never, never>, parallelFetchTransactionListByCategoryType: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionCategoryType: TransactionCategoryType, period: TimePeriod, cacheOverride?: any, minimumTransactionAmount?: Amount | undefined], {
|
|
72
|
+
}, "transactionList/updateTransactionListByClassFailure", never, never>, parallelFetchTransactionListByCategoryType: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionCategoryType: TransactionCategoryType, period: TimePeriod, cacheOverride?: any, minimumTransactionAmount?: Amount | undefined], {
|
|
96
73
|
transactionCategoryType: TransactionCategoryType;
|
|
97
74
|
period: TimePeriod;
|
|
98
75
|
minimumTransactionAmount: Amount | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.updateLatestTransactionId = exports.clearTransactionList = exports.updateTransactionListUIStateByCategoryType = exports.updateTransactionsListByCategoryTypeFailure = exports.updateTransactionListByCategoryType = exports.fetchTransactionsListByCategoryType = exports.parallelFetchTransactionListByCategoryType = exports.
|
|
4
|
+
exports.updateLatestTransactionId = exports.clearTransactionList = exports.updateTransactionListUIStateByCategoryType = exports.updateTransactionsListByCategoryTypeFailure = exports.updateTransactionListByCategoryType = exports.fetchTransactionsListByCategoryType = exports.parallelFetchTransactionListByCategoryType = exports.updateTransactionListByClassFailure = exports.updateTransactionListByClassUIState = exports.updateTransactionListByClass = exports.fetchClassTransactionList = exports.parallelFetchClassTransactionList = exports.updateTransactionListByAccountUIState = exports.updateTransactionListByEntityFailure = exports.updateTransactionListByEntity = exports.fetchEntityTransactionList = exports.parallelFetchEntityTransactionList = exports.updateTransactionListByAccountFailure = exports.updateTransactionListByAccount = exports.fetchAccountTransactionList = exports.parallelFetchAccountTransactionList = exports.initialState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const timePeriod_1 = require("../../commonStateTypes/timePeriod");
|
|
7
7
|
const accountPayload_1 = require("../../entity/account/accountPayload");
|
|
@@ -41,10 +41,6 @@ exports.initialState = {
|
|
|
41
41
|
transactionListByClassKey: {},
|
|
42
42
|
transactionListUIStateByClassKey: {},
|
|
43
43
|
},
|
|
44
|
-
byProject: {
|
|
45
|
-
transactionListByProjectKey: {},
|
|
46
|
-
transactionListUIStateByProjectKey: {},
|
|
47
|
-
},
|
|
48
44
|
};
|
|
49
45
|
const transactionList = (0, toolkit_1.createSlice)({
|
|
50
46
|
name: 'transactionList',
|
|
@@ -254,64 +250,6 @@ const transactionList = (0, toolkit_1.createSlice)({
|
|
|
254
250
|
return { payload: { accountId, accountType, classId, period, error } };
|
|
255
251
|
},
|
|
256
252
|
},
|
|
257
|
-
// Transaction list by project related reducers
|
|
258
|
-
//
|
|
259
|
-
// Mirrors the by-class set; the only behavioural difference is that the
|
|
260
|
-
// server query param is `zeni_project_id` (post-Ayon's accounting #3984
|
|
261
|
-
// rename) and there's no equivalent of `include_sub_class_transactions`
|
|
262
|
-
// — projects don't have a sub-project hierarchy in this layout yet.
|
|
263
|
-
parallelFetchProjectTransactionList: {
|
|
264
|
-
reducer() {
|
|
265
|
-
// Do nothing..
|
|
266
|
-
},
|
|
267
|
-
prepare(accountId, accountType, projectId, period, cacheOverride = false) {
|
|
268
|
-
return {
|
|
269
|
-
payload: { accountId, accountType, projectId, period, cacheOverride },
|
|
270
|
-
};
|
|
271
|
-
},
|
|
272
|
-
},
|
|
273
|
-
fetchProjectTransactionList: {
|
|
274
|
-
reducer(draft, action) {
|
|
275
|
-
const key = (0, transactionListState_1.getProjectAcTranKey)(action.payload.accountId, action.payload.accountType, action.payload.projectId, action.payload.period);
|
|
276
|
-
if (action.payload.cacheOverride === true ||
|
|
277
|
-
draft.byProject.transactionListByProjectKey[key] == null ||
|
|
278
|
-
(draft.byProject.transactionListByProjectKey[key]?.hasValidState() ===
|
|
279
|
-
false &&
|
|
280
|
-
draft.byProject.transactionListByProjectKey[key]?.fetchState !=
|
|
281
|
-
'In-Progress')) {
|
|
282
|
-
draft.byProject.transactionListByProjectKey[key] = {
|
|
283
|
-
...transactionListState_1.initialProjectTransactionState,
|
|
284
|
-
fetchState: 'In-Progress',
|
|
285
|
-
error: undefined,
|
|
286
|
-
};
|
|
287
|
-
}
|
|
288
|
-
},
|
|
289
|
-
prepare(accountId, accountType, projectId, period, cacheOverride = false) {
|
|
290
|
-
return {
|
|
291
|
-
payload: { accountId, accountType, projectId, period, cacheOverride },
|
|
292
|
-
};
|
|
293
|
-
},
|
|
294
|
-
},
|
|
295
|
-
updateTransactionListByProject(draft, action) {
|
|
296
|
-
doUpdateTransactionListByProject(draft.byProject.transactionListByProjectKey, action.payload);
|
|
297
|
-
},
|
|
298
|
-
updateTransactionListByProjectUIState(draft, action) {
|
|
299
|
-
const key = (0, transactionListState_1.getProjectAcKey)(action.payload.accountId, action.payload.accountType, action.payload.projectId);
|
|
300
|
-
draft.byProject.transactionListUIStateByProjectKey[key] = Object.assign({}, draft.byProject.transactionListUIStateByProjectKey[key], action.payload.uiState);
|
|
301
|
-
},
|
|
302
|
-
updateTransactionListByProjectFailure: {
|
|
303
|
-
reducer(draft, action) {
|
|
304
|
-
const key = (0, transactionListState_1.getProjectAcTranKey)(action.payload.accountId, action.payload.accountType, action.payload.projectId, action.payload.period);
|
|
305
|
-
draft.byProject.transactionListByProjectKey[key] = {
|
|
306
|
-
...transactionListState_1.initialProjectTransactionState,
|
|
307
|
-
fetchState: 'Error',
|
|
308
|
-
error: action.payload.error,
|
|
309
|
-
};
|
|
310
|
-
},
|
|
311
|
-
prepare(accountId, accountType, projectId, period, error) {
|
|
312
|
-
return { payload: { accountId, accountType, projectId, period, error } };
|
|
313
|
-
},
|
|
314
|
-
},
|
|
315
253
|
parallelFetchTransactionListByCategoryType: {
|
|
316
254
|
reducer() {
|
|
317
255
|
// Do nothing..
|
|
@@ -406,7 +344,7 @@ const transactionList = (0, toolkit_1.createSlice)({
|
|
|
406
344
|
},
|
|
407
345
|
},
|
|
408
346
|
});
|
|
409
|
-
_a = transactionList.actions, exports.parallelFetchAccountTransactionList = _a.parallelFetchAccountTransactionList, exports.fetchAccountTransactionList = _a.fetchAccountTransactionList, exports.updateTransactionListByAccount = _a.updateTransactionListByAccount, exports.updateTransactionListByAccountFailure = _a.updateTransactionListByAccountFailure, exports.parallelFetchEntityTransactionList = _a.parallelFetchEntityTransactionList, exports.fetchEntityTransactionList = _a.fetchEntityTransactionList, exports.updateTransactionListByEntity = _a.updateTransactionListByEntity, exports.updateTransactionListByEntityFailure = _a.updateTransactionListByEntityFailure, exports.updateTransactionListByAccountUIState = _a.updateTransactionListByAccountUIState, exports.parallelFetchClassTransactionList = _a.parallelFetchClassTransactionList, exports.fetchClassTransactionList = _a.fetchClassTransactionList, exports.updateTransactionListByClass = _a.updateTransactionListByClass, exports.updateTransactionListByClassUIState = _a.updateTransactionListByClassUIState, exports.updateTransactionListByClassFailure = _a.updateTransactionListByClassFailure, exports.
|
|
347
|
+
_a = transactionList.actions, exports.parallelFetchAccountTransactionList = _a.parallelFetchAccountTransactionList, exports.fetchAccountTransactionList = _a.fetchAccountTransactionList, exports.updateTransactionListByAccount = _a.updateTransactionListByAccount, exports.updateTransactionListByAccountFailure = _a.updateTransactionListByAccountFailure, exports.parallelFetchEntityTransactionList = _a.parallelFetchEntityTransactionList, exports.fetchEntityTransactionList = _a.fetchEntityTransactionList, exports.updateTransactionListByEntity = _a.updateTransactionListByEntity, exports.updateTransactionListByEntityFailure = _a.updateTransactionListByEntityFailure, exports.updateTransactionListByAccountUIState = _a.updateTransactionListByAccountUIState, exports.parallelFetchClassTransactionList = _a.parallelFetchClassTransactionList, exports.fetchClassTransactionList = _a.fetchClassTransactionList, exports.updateTransactionListByClass = _a.updateTransactionListByClass, exports.updateTransactionListByClassUIState = _a.updateTransactionListByClassUIState, exports.updateTransactionListByClassFailure = _a.updateTransactionListByClassFailure, exports.parallelFetchTransactionListByCategoryType = _a.parallelFetchTransactionListByCategoryType, exports.fetchTransactionsListByCategoryType = _a.fetchTransactionsListByCategoryType, exports.updateTransactionListByCategoryType = _a.updateTransactionListByCategoryType, exports.updateTransactionsListByCategoryTypeFailure = _a.updateTransactionsListByCategoryTypeFailure, exports.updateTransactionListUIStateByCategoryType = _a.updateTransactionListUIStateByCategoryType, exports.clearTransactionList = _a.clearTransactionList, exports.updateLatestTransactionId = _a.updateLatestTransactionId;
|
|
410
348
|
exports.default = transactionList.reducer;
|
|
411
349
|
/**
|
|
412
350
|
* Helper functions
|
|
@@ -456,22 +394,3 @@ function doUpdateTransactionListByClass(draft, payload) {
|
|
|
456
394
|
transactionIDs,
|
|
457
395
|
};
|
|
458
396
|
}
|
|
459
|
-
function doUpdateTransactionListByProject(draft, payload) {
|
|
460
|
-
const transactionIDs = payload.account.transactions.map((transactionPaylod) => transactionPaylod.transaction_id);
|
|
461
|
-
const account = (0, accountPayload_1.mapAccountBasePayloadToAccountBase)(payload.account);
|
|
462
|
-
const projectId = payload.query.zeni_project_id;
|
|
463
|
-
const start = (0, timePeriod_1.toAbsoluteDay)(payload.query.start_date);
|
|
464
|
-
const end = (0, timePeriod_1.toAbsoluteDay)(payload.query.end_date);
|
|
465
|
-
const key = (0, transactionListState_1.getProjectAcTranKey)(account.accountId, account.accountType, projectId, {
|
|
466
|
-
start,
|
|
467
|
-
end,
|
|
468
|
-
});
|
|
469
|
-
draft[key] = {
|
|
470
|
-
...transactionListState_1.initialProjectTransactionState,
|
|
471
|
-
fetchState: 'Completed',
|
|
472
|
-
error: undefined,
|
|
473
|
-
account: account,
|
|
474
|
-
projectId: projectId,
|
|
475
|
-
transactionIDs,
|
|
476
|
-
};
|
|
477
|
-
}
|
|
@@ -45,20 +45,6 @@ export interface TransactionListByClassState {
|
|
|
45
45
|
transactionListUIStateByClassKey: Record<ClassAcKey, TransactionListUIState>;
|
|
46
46
|
}
|
|
47
47
|
export declare const initialClassTransactionState: ClassAccountTransactions;
|
|
48
|
-
export declare const getProjectAcTranKey: (accountId: ID, accountType: AccountType, projectId: ID, period: TimePeriod) => string;
|
|
49
|
-
export type ProjectAcTranKey = ReturnType<typeof getProjectAcTranKey>;
|
|
50
|
-
export declare const getProjectAcKey: (accountId: ID, accountType: AccountType, projectId: ID) => string;
|
|
51
|
-
type ProjectAcKey = ReturnType<typeof getProjectAcKey>;
|
|
52
|
-
export interface ProjectAccountTransactions extends FetchedState {
|
|
53
|
-
transactionIDs: ID[];
|
|
54
|
-
account?: AccountBase;
|
|
55
|
-
projectId?: ID;
|
|
56
|
-
}
|
|
57
|
-
export interface TransactionListByProjectState {
|
|
58
|
-
transactionListByProjectKey: Record<ProjectAcTranKey, ProjectAccountTransactions>;
|
|
59
|
-
transactionListUIStateByProjectKey: Record<ProjectAcKey, TransactionListUIState>;
|
|
60
|
-
}
|
|
61
|
-
export declare const initialProjectTransactionState: ProjectAccountTransactions;
|
|
62
48
|
export type TransactionCategoryType = 'missingReceipts' | 'miscategorizedExpense' | 'miscategorizedIncome' | 'uncategorizedIncome' | 'uncategorizedExpense';
|
|
63
49
|
export declare const getCategoryTypeTranKey: (categoryType: TransactionCategoryType, period: TimePeriod) => string;
|
|
64
50
|
type CategoryTypeTranKey = ReturnType<typeof getCategoryTypeTranKey>;
|
|
@@ -73,7 +59,6 @@ export interface TransactionListState {
|
|
|
73
59
|
byAccount: TransactionListByAccountState;
|
|
74
60
|
byClass: TransactionListByClassState;
|
|
75
61
|
byEntity: TransactionListByEntityState;
|
|
76
|
-
byProject: TransactionListByProjectState;
|
|
77
62
|
byType: Record<TransactionCategoryType, TransactionListByCategoryState>;
|
|
78
63
|
latestTransactionId?: TransactionID;
|
|
79
64
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.initialTransactionsStateByCategoryType = exports.getCategoryTypeTranKey = exports.
|
|
3
|
+
exports.initialTransactionsStateByCategoryType = exports.getCategoryTypeTranKey = exports.initialClassTransactionState = exports.getClassAcKey = exports.getClassAcTranKey = exports.initialEntityTransactionState = exports.getEntityTranKey = exports.accountTransactionsInitialState = exports.getAcKey = exports.getAcTranKey = void 0;
|
|
4
4
|
const getAcTranKey = (accountId, accountType, period) => `${accountId}-${accountType}-${period.start.day}_${period.start.month}_${period.start.year}_${period.end.day}_${period.end.month}_${period.end.year}`;
|
|
5
5
|
exports.getAcTranKey = getAcTranKey;
|
|
6
6
|
const getAcKey = (accountId, accountType) => `${accountId}-${accountType}`;
|
|
@@ -38,18 +38,6 @@ exports.initialClassTransactionState = {
|
|
|
38
38
|
return this.fetchState == 'Completed';
|
|
39
39
|
},
|
|
40
40
|
};
|
|
41
|
-
const getProjectAcTranKey = (accountId, accountType, projectId, period) => `${accountId}-${accountType}-${projectId}-${period.start.day}_${period.start.month}_${period.start.year}_${period.end.day}_${period.end.month}_${period.end.year}`;
|
|
42
|
-
exports.getProjectAcTranKey = getProjectAcTranKey;
|
|
43
|
-
const getProjectAcKey = (accountId, accountType, projectId) => `${accountId}-${accountType}-${projectId}`;
|
|
44
|
-
exports.getProjectAcKey = getProjectAcKey;
|
|
45
|
-
exports.initialProjectTransactionState = {
|
|
46
|
-
transactionIDs: [],
|
|
47
|
-
fetchState: 'Not-Started',
|
|
48
|
-
error: undefined,
|
|
49
|
-
hasValidState() {
|
|
50
|
-
return this.fetchState == 'Completed';
|
|
51
|
-
},
|
|
52
|
-
};
|
|
53
41
|
const getCategoryTypeTranKey = (categoryType, period) => `${categoryType}_${period.start.day}_${period.start.month}_${period.start.year}_${period.end.day}_${period.end.month}_${period.end.year}`;
|
|
54
42
|
exports.getCategoryTypeTranKey = getCategoryTypeTranKey;
|
|
55
43
|
exports.initialTransactionsStateByCategoryType = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.45",
|
|
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",
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { CardTenantProfileRow, CreditAgentMacro } from './creditAgentState';
|
|
2
|
-
export interface CardTenantProfileRowPayload {
|
|
3
|
-
card_score: string | null;
|
|
4
|
-
card_status: string;
|
|
5
|
-
company_id: string | null;
|
|
6
|
-
credit_limit: number | null;
|
|
7
|
-
customer_name: string | null;
|
|
8
|
-
is_analyzing: boolean;
|
|
9
|
-
is_new: boolean;
|
|
10
|
-
rationale: string | null;
|
|
11
|
-
recommended_amount: number | null;
|
|
12
|
-
report_date: string | null;
|
|
13
|
-
tenant_id: string;
|
|
14
|
-
tenant_namespace: string;
|
|
15
|
-
updated_by_name: string | null;
|
|
16
|
-
updated_by_user_id: string | null;
|
|
17
|
-
updated_on: string | null;
|
|
18
|
-
}
|
|
19
|
-
export interface CardTenantProfilesPayload {
|
|
20
|
-
count: number;
|
|
21
|
-
rows: CardTenantProfileRowPayload[];
|
|
22
|
-
}
|
|
23
|
-
export interface CardTenantProfileUpdatePayload {
|
|
24
|
-
profile: CardTenantProfileRowPayload;
|
|
25
|
-
}
|
|
26
|
-
export interface MacroPayload {
|
|
27
|
-
created_at: string;
|
|
28
|
-
creator_id: string;
|
|
29
|
-
description: string;
|
|
30
|
-
instructions: string;
|
|
31
|
-
is_active: boolean;
|
|
32
|
-
is_latest: boolean;
|
|
33
|
-
macro_id: string;
|
|
34
|
-
name: string;
|
|
35
|
-
parameters_schema: Record<string, unknown> | null;
|
|
36
|
-
tenant_id: string;
|
|
37
|
-
updated_at: string;
|
|
38
|
-
version: number;
|
|
39
|
-
}
|
|
40
|
-
export declare function toCardTenantProfileRow(row: CardTenantProfileRowPayload): CardTenantProfileRow;
|
|
41
|
-
export declare function toMacro(payload: MacroPayload): CreditAgentMacro;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toCardTenantProfileRow = toCardTenantProfileRow;
|
|
4
|
-
exports.toMacro = toMacro;
|
|
5
|
-
const zeniDayJS_1 = require("../../zeniDayJS");
|
|
6
|
-
const creditAgentState_1 = require("./creditAgentState");
|
|
7
|
-
// ── Mapping functions (payload → domain) ──
|
|
8
|
-
function toCardTenantProfileRow(row) {
|
|
9
|
-
return {
|
|
10
|
-
cardStatus: (0, creditAgentState_1.toCardStatus)(row.card_status),
|
|
11
|
-
companyId: row.company_id ?? undefined,
|
|
12
|
-
creditLimit: row.credit_limit ?? undefined,
|
|
13
|
-
creditScore: row.card_score ?? undefined,
|
|
14
|
-
customerName: row.customer_name ?? undefined,
|
|
15
|
-
isAnalyzing: Boolean(row.is_analyzing),
|
|
16
|
-
isNew: Boolean(row.is_new),
|
|
17
|
-
rationale: row.rationale ?? undefined,
|
|
18
|
-
recommendedAmount: row.recommended_amount ?? undefined,
|
|
19
|
-
reportDate: row.report_date != null ? (0, zeniDayJS_1.date)(row.report_date) : undefined,
|
|
20
|
-
tenantId: row.tenant_id,
|
|
21
|
-
tenantEmailDomain: row.tenant_namespace,
|
|
22
|
-
updatedByName: row.updated_by_name ?? undefined,
|
|
23
|
-
updatedByUserId: row.updated_by_user_id ?? undefined,
|
|
24
|
-
updatedOn: row.updated_on != null ? (0, zeniDayJS_1.date)(row.updated_on) : undefined,
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
function toMacro(payload) {
|
|
28
|
-
return {
|
|
29
|
-
macroId: payload.macro_id,
|
|
30
|
-
version: payload.version,
|
|
31
|
-
isLatest: payload.is_latest,
|
|
32
|
-
isActive: payload.is_active,
|
|
33
|
-
name: payload.name,
|
|
34
|
-
description: payload.description,
|
|
35
|
-
instructions: payload.instructions,
|
|
36
|
-
tenantId: payload.tenant_id,
|
|
37
|
-
createdAt: (0, zeniDayJS_1.date)(payload.created_at),
|
|
38
|
-
updatedAt: (0, zeniDayJS_1.date)(payload.updated_at),
|
|
39
|
-
};
|
|
40
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { CardTenantProfileRowPayload, MacroPayload } from './creditAgentPayload';
|
|
2
|
-
import { CreditAgentEntityState } from './creditAgentState';
|
|
3
|
-
export declare const initialCreditAgentEntityState: CreditAgentEntityState;
|
|
4
|
-
export declare const clearAllCreditAgent: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"creditAgent/clearAllCreditAgent">, updateCreditAgentMacro: import("@reduxjs/toolkit").ActionCreatorWithPayload<MacroPayload, "creditAgent/updateCreditAgentMacro">, updateCreditAgentRow: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
5
|
-
payload: CardTenantProfileRowPayload;
|
|
6
|
-
tenantId: string;
|
|
7
|
-
}, "creditAgent/updateCreditAgentRow">, updateCreditAgentRows: import("@reduxjs/toolkit").ActionCreatorWithPayload<CardTenantProfileRowPayload[], "creditAgent/updateCreditAgentRows">;
|
|
8
|
-
declare const _default: import("redux").Reducer<CreditAgentEntityState>;
|
|
9
|
-
export default _default;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var _a;
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.updateCreditAgentRows = exports.updateCreditAgentRow = exports.updateCreditAgentMacro = exports.clearAllCreditAgent = exports.initialCreditAgentEntityState = void 0;
|
|
5
|
-
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
-
const creditAgentPayload_1 = require("./creditAgentPayload");
|
|
7
|
-
exports.initialCreditAgentEntityState = {
|
|
8
|
-
macro: undefined,
|
|
9
|
-
rowByTenantId: {},
|
|
10
|
-
};
|
|
11
|
-
const creditAgent = (0, toolkit_1.createSlice)({
|
|
12
|
-
name: 'creditAgent',
|
|
13
|
-
initialState: exports.initialCreditAgentEntityState,
|
|
14
|
-
reducers: {
|
|
15
|
-
updateCreditAgentRows(draft, action) {
|
|
16
|
-
const newRowByTenantId = {};
|
|
17
|
-
action.payload.forEach((payload) => {
|
|
18
|
-
const row = (0, creditAgentPayload_1.toCardTenantProfileRow)(payload);
|
|
19
|
-
newRowByTenantId[row.tenantId] = row;
|
|
20
|
-
});
|
|
21
|
-
draft.rowByTenantId = newRowByTenantId;
|
|
22
|
-
},
|
|
23
|
-
updateCreditAgentRow(draft, action) {
|
|
24
|
-
const { tenantId, payload } = action.payload;
|
|
25
|
-
const row = (0, creditAgentPayload_1.toCardTenantProfileRow)(payload);
|
|
26
|
-
draft.rowByTenantId[tenantId] = row;
|
|
27
|
-
},
|
|
28
|
-
updateCreditAgentMacro(draft, action) {
|
|
29
|
-
draft.macro = (0, creditAgentPayload_1.toMacro)(action.payload);
|
|
30
|
-
},
|
|
31
|
-
clearAllCreditAgent(draft) {
|
|
32
|
-
Object.assign(draft, exports.initialCreditAgentEntityState);
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
});
|
|
36
|
-
_a = creditAgent.actions, exports.clearAllCreditAgent = _a.clearAllCreditAgent, exports.updateCreditAgentMacro = _a.updateCreditAgentMacro, exports.updateCreditAgentRow = _a.updateCreditAgentRow, exports.updateCreditAgentRows = _a.updateCreditAgentRows;
|
|
37
|
-
exports.default = creditAgent.reducer;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { CardTenantProfileRow, CreditAgentEntityState, CreditAgentMacro } from './creditAgentState';
|
|
2
|
-
export declare function getCreditAgentRows(state: CreditAgentEntityState): CardTenantProfileRow[];
|
|
3
|
-
export declare function getCreditAgentMacroEntity(state: CreditAgentEntityState): CreditAgentMacro | undefined;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getCreditAgentRows = getCreditAgentRows;
|
|
4
|
-
exports.getCreditAgentMacroEntity = getCreditAgentMacroEntity;
|
|
5
|
-
function getCreditAgentRows(state) {
|
|
6
|
-
return Object.values(state.rowByTenantId);
|
|
7
|
-
}
|
|
8
|
-
function getCreditAgentMacroEntity(state) {
|
|
9
|
-
return state.macro;
|
|
10
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { ID } from '../../commonStateTypes/common';
|
|
2
|
-
import { ZeniDate } from '../../zeniDayJS';
|
|
3
|
-
declare const ALL_CARD_STATUS_VALUES: readonly ["Not-Initiated", "Interested", "Pre-approved", "Approved", "Enabled", "Active", "Rejected", "Locked"];
|
|
4
|
-
export declare const toCardStatus: (v: string) => "Not-Initiated" | "Interested" | "Pre-approved" | "Approved" | "Enabled" | "Active" | "Rejected" | "Locked";
|
|
5
|
-
export type CardStatus = ReturnType<typeof toCardStatus>;
|
|
6
|
-
export { ALL_CARD_STATUS_VALUES };
|
|
7
|
-
export interface CardTenantProfileRow {
|
|
8
|
-
cardStatus: CardStatus;
|
|
9
|
-
isAnalyzing: boolean;
|
|
10
|
-
isNew: boolean;
|
|
11
|
-
tenantEmailDomain: string;
|
|
12
|
-
tenantId: ID;
|
|
13
|
-
companyId?: ID;
|
|
14
|
-
creditLimit?: number;
|
|
15
|
-
creditScore?: string;
|
|
16
|
-
customerName?: string;
|
|
17
|
-
rationale?: string;
|
|
18
|
-
recommendedAmount?: number;
|
|
19
|
-
reportDate?: ZeniDate;
|
|
20
|
-
updatedByName?: string;
|
|
21
|
-
updatedByUserId?: ID;
|
|
22
|
-
updatedOn?: ZeniDate;
|
|
23
|
-
}
|
|
24
|
-
export interface CreditAgentMacro {
|
|
25
|
-
createdAt: ZeniDate;
|
|
26
|
-
description: string;
|
|
27
|
-
instructions: string;
|
|
28
|
-
isActive: boolean;
|
|
29
|
-
isLatest: boolean;
|
|
30
|
-
macroId: ID;
|
|
31
|
-
name: string;
|
|
32
|
-
tenantId: ID;
|
|
33
|
-
updatedAt: ZeniDate;
|
|
34
|
-
version: number;
|
|
35
|
-
}
|
|
36
|
-
export interface CreditAgentEntityState {
|
|
37
|
-
rowByTenantId: Record<ID, CardTenantProfileRow>;
|
|
38
|
-
macro?: CreditAgentMacro;
|
|
39
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ALL_CARD_STATUS_VALUES = exports.toCardStatus = void 0;
|
|
4
|
-
const stringToUnion_1 = require("../../commonStateTypes/stringToUnion");
|
|
5
|
-
const ALL_CARD_STATUS_VALUES = [
|
|
6
|
-
'Not-Initiated',
|
|
7
|
-
'Interested',
|
|
8
|
-
'Pre-approved',
|
|
9
|
-
'Approved',
|
|
10
|
-
'Enabled',
|
|
11
|
-
'Active',
|
|
12
|
-
'Rejected',
|
|
13
|
-
'Locked',
|
|
14
|
-
];
|
|
15
|
-
exports.ALL_CARD_STATUS_VALUES = ALL_CARD_STATUS_VALUES;
|
|
16
|
-
const toCardStatus = (v) => (0, stringToUnion_1.stringToUnion)(v, ALL_CARD_STATUS_VALUES);
|
|
17
|
-
exports.toCardStatus = toCardStatus;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { date } from '../../zeniDayJS';
|
|
2
|
-
import { toCardStatus, } from './creditAgentState';
|
|
3
|
-
// ── Mapping functions (payload → domain) ──
|
|
4
|
-
export function toCardTenantProfileRow(row) {
|
|
5
|
-
return {
|
|
6
|
-
cardStatus: toCardStatus(row.card_status),
|
|
7
|
-
companyId: row.company_id ?? undefined,
|
|
8
|
-
creditLimit: row.credit_limit ?? undefined,
|
|
9
|
-
creditScore: row.card_score ?? undefined,
|
|
10
|
-
customerName: row.customer_name ?? undefined,
|
|
11
|
-
isAnalyzing: Boolean(row.is_analyzing),
|
|
12
|
-
isNew: Boolean(row.is_new),
|
|
13
|
-
rationale: row.rationale ?? undefined,
|
|
14
|
-
recommendedAmount: row.recommended_amount ?? undefined,
|
|
15
|
-
reportDate: row.report_date != null ? date(row.report_date) : undefined,
|
|
16
|
-
tenantId: row.tenant_id,
|
|
17
|
-
tenantEmailDomain: row.tenant_namespace,
|
|
18
|
-
updatedByName: row.updated_by_name ?? undefined,
|
|
19
|
-
updatedByUserId: row.updated_by_user_id ?? undefined,
|
|
20
|
-
updatedOn: row.updated_on != null ? date(row.updated_on) : undefined,
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
export function toMacro(payload) {
|
|
24
|
-
return {
|
|
25
|
-
macroId: payload.macro_id,
|
|
26
|
-
version: payload.version,
|
|
27
|
-
isLatest: payload.is_latest,
|
|
28
|
-
isActive: payload.is_active,
|
|
29
|
-
name: payload.name,
|
|
30
|
-
description: payload.description,
|
|
31
|
-
instructions: payload.instructions,
|
|
32
|
-
tenantId: payload.tenant_id,
|
|
33
|
-
createdAt: date(payload.created_at),
|
|
34
|
-
updatedAt: date(payload.updated_at),
|
|
35
|
-
};
|
|
36
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
-
import { toCardTenantProfileRow, toMacro, } from './creditAgentPayload';
|
|
3
|
-
export const initialCreditAgentEntityState = {
|
|
4
|
-
macro: undefined,
|
|
5
|
-
rowByTenantId: {},
|
|
6
|
-
};
|
|
7
|
-
const creditAgent = createSlice({
|
|
8
|
-
name: 'creditAgent',
|
|
9
|
-
initialState: initialCreditAgentEntityState,
|
|
10
|
-
reducers: {
|
|
11
|
-
updateCreditAgentRows(draft, action) {
|
|
12
|
-
const newRowByTenantId = {};
|
|
13
|
-
action.payload.forEach((payload) => {
|
|
14
|
-
const row = toCardTenantProfileRow(payload);
|
|
15
|
-
newRowByTenantId[row.tenantId] = row;
|
|
16
|
-
});
|
|
17
|
-
draft.rowByTenantId = newRowByTenantId;
|
|
18
|
-
},
|
|
19
|
-
updateCreditAgentRow(draft, action) {
|
|
20
|
-
const { tenantId, payload } = action.payload;
|
|
21
|
-
const row = toCardTenantProfileRow(payload);
|
|
22
|
-
draft.rowByTenantId[tenantId] = row;
|
|
23
|
-
},
|
|
24
|
-
updateCreditAgentMacro(draft, action) {
|
|
25
|
-
draft.macro = toMacro(action.payload);
|
|
26
|
-
},
|
|
27
|
-
clearAllCreditAgent(draft) {
|
|
28
|
-
Object.assign(draft, initialCreditAgentEntityState);
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
});
|
|
32
|
-
export const { clearAllCreditAgent, updateCreditAgentMacro, updateCreditAgentRow, updateCreditAgentRows, } = creditAgent.actions;
|
|
33
|
-
export default creditAgent.reducer;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { stringToUnion } from '../../commonStateTypes/stringToUnion';
|
|
2
|
-
const ALL_CARD_STATUS_VALUES = [
|
|
3
|
-
'Not-Initiated',
|
|
4
|
-
'Interested',
|
|
5
|
-
'Pre-approved',
|
|
6
|
-
'Approved',
|
|
7
|
-
'Enabled',
|
|
8
|
-
'Active',
|
|
9
|
-
'Rejected',
|
|
10
|
-
'Locked',
|
|
11
|
-
];
|
|
12
|
-
export const toCardStatus = (v) => stringToUnion(v, ALL_CARD_STATUS_VALUES);
|
|
13
|
-
export { ALL_CARD_STATUS_VALUES };
|