@zeniai/client-epic-state 4.18.36 → 4.18.37
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/index.d.ts +1 -1
- package/lib/view/spendManagement/treasury/treasuryList/treasuryDetailPayload.d.ts +19 -11
- package/lib/view/spendManagement/treasury/treasuryList/treasuryDetailReducer.js +0 -6
- package/lib/view/spendManagement/treasury/treasuryList/treasuryDetailState.d.ts +0 -5
- package/lib/view/spendManagement/treasury/treasuryTransferMoney/treasuryTransferMoneySelector.js +0 -17
- package/lib/view/spendManagement/treasury/treasuryTransferMoney/treasuryTransferMoneyState.d.ts +0 -2
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -846,7 +846,7 @@ export { AiCfoSelectorView, getAllQuestionAnswersForChatSession, getQuestionAnsw
|
|
|
846
846
|
export { AiCfoQuestionWithAnswer, AiCfoAnswerParagraph, AiCfoAnswerStateType, AiCfoChartType, AiCfoAnswerResponseType, TableVisualization, ChartVisualization, AiCfoVisualization, AiCfoVisualizationType, AiCfoState, ChatSession, ALL_AI_CFO_CHARTS_TYPES, ALL_AI_CFO_VISUALIZATION_TYPES, ALL_AI_CFO_ANSWER_STATE_TYPES, ALL_AI_CFO_ANSWER_RESPONSE_TYPES, toAiCfoVisualizationType, toAiCfoVisualizationTypeStrict, toAiCfoChartType, toAiCfoChartTypeStrict, toAiCfoAnswerStateType, toAiCfoAnswerStateTypeStrict, toAiCfoAnswerResponseType, toAiCfoAnswerResponseTypeStrict, ChatSessionWithMessages, ResponseBlockBase, AnswerContentBlockBase, QuestionContentBlockBase, ResponseBlockType, toMessageSender, toMessageType, MessageSender, MessageType, } from './entity/aiCfo/aiCfoState';
|
|
847
847
|
export { fetchTreasuryOverviewDetail, updateTreasuryTransactionListUIState, } from './view/spendManagement/treasury/treasuryList/treasuryDetailReducer';
|
|
848
848
|
export { TreasuryDetailSelectorView, getTreasuryDetail, } from './view/spendManagement/treasury/treasuryList/treasuryDetailSelector';
|
|
849
|
-
export { TreasuryListUIState, TreasuryViewSortKey, TreasuryTransaction,
|
|
849
|
+
export { TreasuryListUIState, TreasuryViewSortKey, TreasuryTransaction, } from './view/spendManagement/treasury/treasuryList/treasuryDetailState';
|
|
850
850
|
export { executeTreasuryTransferMoney, updateTreasuryTransferMoneyLocalData, clearTreasuryTransferMoney, } from './view/spendManagement/treasury/treasuryTransferMoney/treasuryTransferMoneyReducer';
|
|
851
851
|
export { TreasuryTransferMoneySelectorView, getTreasuryTransferMoney, } from './view/spendManagement/treasury/treasuryTransferMoney/treasuryTransferMoneySelector';
|
|
852
852
|
export { TreasuryTransferMoneyLocalData, TreasuryTransferMoneyState, TreasuryAccount, } from './view/spendManagement/treasury/treasuryTransferMoney/treasuryTransferMoneyState';
|
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
import { ZeniAPIResponse } from '../../../../responsePayload';
|
|
2
2
|
import { AccountHistoryWithBalance } from './treasuryDetailState';
|
|
3
|
-
interface AmountPayload {
|
|
4
|
-
amount: number;
|
|
5
|
-
currency_code: string;
|
|
6
|
-
currency_symbol: string;
|
|
7
|
-
}
|
|
8
3
|
interface TreasuryDetailPayload {
|
|
9
4
|
treasury_account: {
|
|
10
|
-
available_balance:
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
available_balance: {
|
|
6
|
+
amount: number;
|
|
7
|
+
currency_code: string;
|
|
8
|
+
currency_symbol: string;
|
|
9
|
+
};
|
|
10
|
+
insured_funds: {
|
|
11
|
+
amount: number;
|
|
12
|
+
currency_code: string;
|
|
13
|
+
currency_symbol: string;
|
|
14
|
+
};
|
|
15
|
+
processing_transactions_balance: {
|
|
16
|
+
amount: number;
|
|
17
|
+
currency_code: string;
|
|
18
|
+
currency_symbol: string;
|
|
19
|
+
};
|
|
20
|
+
total_yield: {
|
|
21
|
+
amount: number;
|
|
22
|
+
currency_code: string;
|
|
23
|
+
currency_symbol: string;
|
|
13
24
|
};
|
|
14
|
-
insured_funds: AmountPayload;
|
|
15
|
-
processing_transactions_balance: AmountPayload;
|
|
16
|
-
total_yield: AmountPayload;
|
|
17
25
|
};
|
|
18
26
|
}
|
|
19
27
|
export type FetchTreasuryDetailResponse = ZeniAPIResponse<TreasuryDetailPayload>;
|
|
@@ -115,11 +115,6 @@ const treasuryDetail = (0, toolkit_1.createSlice)({
|
|
|
115
115
|
fetchTreasurySummarySuccess(draft, action) {
|
|
116
116
|
const { data } = action.payload;
|
|
117
117
|
if (data === null || data === void 0 ? void 0 : data.data) {
|
|
118
|
-
let fundAllocations = undefined;
|
|
119
|
-
fundAllocations = Object.entries(data.data.treasury_account.fund_code_to_portfolio_value).map(([fundCode, amountPayload]) => ({
|
|
120
|
-
fundCode,
|
|
121
|
-
amount: (0, amount_1.toAmount)(amountPayload.amount, amountPayload.currency_code, amountPayload.currency_symbol),
|
|
122
|
-
}));
|
|
123
118
|
const summary = {
|
|
124
119
|
insuredFunds: (0, amount_1.toAmount)(data.data.treasury_account.insured_funds.amount, data.data.treasury_account.insured_funds.currency_code, data.data.treasury_account.insured_funds.currency_symbol),
|
|
125
120
|
totalYield: (0, amount_1.toAmount)(data.data.treasury_account.total_yield.amount, data.data.treasury_account.total_yield.currency_code, data.data.treasury_account.total_yield.currency_symbol),
|
|
@@ -129,7 +124,6 @@ const treasuryDetail = (0, toolkit_1.createSlice)({
|
|
|
129
124
|
.currency_symbol),
|
|
130
125
|
totalBalance: (0, amount_1.toAmount)(data.data.treasury_account.available_balance.amount +
|
|
131
126
|
data.data.treasury_account.processing_transactions_balance.amount, data.data.treasury_account.available_balance.currency_code, data.data.treasury_account.available_balance.currency_symbol),
|
|
132
|
-
fundAllocations,
|
|
133
127
|
};
|
|
134
128
|
draft.accountSummary = summary;
|
|
135
129
|
draft.fetchState = 'Completed';
|
|
@@ -20,13 +20,8 @@ export interface TreasuryTransaction {
|
|
|
20
20
|
id: ID;
|
|
21
21
|
status: TreasuryTransactionStatus;
|
|
22
22
|
}
|
|
23
|
-
export interface FundAllocation {
|
|
24
|
-
amount: Amount;
|
|
25
|
-
fundCode: string;
|
|
26
|
-
}
|
|
27
23
|
export interface TreasurySummaryWithBalance {
|
|
28
24
|
availableBalance: Amount;
|
|
29
|
-
fundAllocations: FundAllocation[];
|
|
30
25
|
insuredFunds: Amount;
|
|
31
26
|
processingBalance: Amount;
|
|
32
27
|
totalBalance: Amount;
|
package/lib/view/spendManagement/treasury/treasuryTransferMoney/treasuryTransferMoneySelector.js
CHANGED
|
@@ -26,7 +26,6 @@ const getTreasuryTransferMoney = (state) => {
|
|
|
26
26
|
label: 'Treasury',
|
|
27
27
|
id: 'treasury',
|
|
28
28
|
balance: (_a = treasuryDetailState.accountSummary) === null || _a === void 0 ? void 0 : _a.availableBalance,
|
|
29
|
-
fundAllocations: getValidFundAllocations(treasuryDetailState.accountSummary, treasurySetupViewState.treasuryFundsDetails.fundsDetails),
|
|
30
29
|
};
|
|
31
30
|
const allRequiredDataFetchState = (0, reduceFetchState_1.reduceAllFetchState)([
|
|
32
31
|
depositAccountsView,
|
|
@@ -54,19 +53,3 @@ const getTreasuryTransferMoney = (state) => {
|
|
|
54
53
|
};
|
|
55
54
|
};
|
|
56
55
|
exports.getTreasuryTransferMoney = getTreasuryTransferMoney;
|
|
57
|
-
const getValidFundAllocations = (summary, fundsDetails) => {
|
|
58
|
-
var _a, _b;
|
|
59
|
-
// there could be entries in the allocations that are not in the fundsDetails. eg - 'CASH_USD'. These need to be ignored.
|
|
60
|
-
const FUND_ALLOCATION_TOLERANCE = 5;
|
|
61
|
-
const validFundCodes = new Set((fundsDetails !== null && fundsDetails !== void 0 ? fundsDetails : []).map((fund) => fund.fundCode));
|
|
62
|
-
const allocations = (_a = summary === null || summary === void 0 ? void 0 : summary.fundAllocations) === null || _a === void 0 ? void 0 : _a.filter((allocation) => validFundCodes.has(allocation.fundCode));
|
|
63
|
-
const availableAmount = (_b = summary === null || summary === void 0 ? void 0 : summary.availableBalance) === null || _b === void 0 ? void 0 : _b.amount;
|
|
64
|
-
const total = allocations === null || allocations === void 0 ? void 0 : allocations.reduce((sum, allocation) => { var _a, _b; return sum + ((_b = (_a = allocation.amount) === null || _a === void 0 ? void 0 : _a.amount) !== null && _b !== void 0 ? _b : 0); }, 0);
|
|
65
|
-
if (availableAmount == null || total == null) {
|
|
66
|
-
return undefined;
|
|
67
|
-
}
|
|
68
|
-
// only show the allocations if the difference between available balance and total is less than $5
|
|
69
|
-
return Math.abs(availableAmount - total) <= FUND_ALLOCATION_TOLERANCE
|
|
70
|
-
? allocations
|
|
71
|
-
: undefined;
|
|
72
|
-
};
|
package/lib/view/spendManagement/treasury/treasuryTransferMoney/treasuryTransferMoneyState.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Amount } from '../../../../commonStateTypes/amount';
|
|
2
2
|
import { FetchStateAndError } from '../../../../commonStateTypes/common';
|
|
3
3
|
import { FundingAccount } from '../../commonSetup/setupViewSelector';
|
|
4
|
-
import { FundAllocation } from '../treasuryList/treasuryDetailState';
|
|
5
4
|
export interface TreasuryTransferMoneyState extends FetchStateAndError {
|
|
6
5
|
localData: TreasuryTransferMoneyLocalData;
|
|
7
6
|
}
|
|
@@ -15,5 +14,4 @@ export interface TreasuryAccount {
|
|
|
15
14
|
id: 'treasury';
|
|
16
15
|
label: 'Treasury';
|
|
17
16
|
balance?: Amount;
|
|
18
|
-
fundAllocations?: FundAllocation[];
|
|
19
17
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.18.
|
|
3
|
+
"version": "4.18.37",
|
|
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
|
"types": "lib/index.d.ts",
|