@zeniai/client-epic-state 4.17.46 → 4.17.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/lib/commonStateTypes/animations.d.ts +1 -1
  2. package/lib/commonStateTypes/animations.js +0 -1
  3. package/lib/commonStateTypes/viewAndReport/viewAndReport.d.ts +2 -2
  4. package/lib/commonStateTypes/viewAndReport/viewAndReport.js +0 -1
  5. package/lib/entity/account/accountState.d.ts +1 -1
  6. package/lib/entity/accountGroup/accountGroupState.d.ts +1 -1
  7. package/lib/entity/class/classReducer.d.ts +4 -4
  8. package/lib/entity/class/classState.d.ts +1 -1
  9. package/lib/entity/company/companyPayload.d.ts +2 -27
  10. package/lib/entity/company/companyPayload.js +2 -38
  11. package/lib/entity/company/companyStateTypes.d.ts +0 -22
  12. package/lib/entity/company/companyStateTypes.js +1 -13
  13. package/lib/entity/entityApprovalStatus/entityApprovalStatusState.d.ts +2 -2
  14. package/lib/entity/entityApprovalStatus/entityApprovalStatusState.js +0 -1
  15. package/lib/entity/file/fileState.d.ts +2 -2
  16. package/lib/entity/file/fileState.js +0 -1
  17. package/lib/entity/forecast/forecastState.d.ts +1 -1
  18. package/lib/entity/sectionAccountsView/sectionAccountsView.d.ts +1 -1
  19. package/lib/entity/sectionClassesViewV2/sectionClassesView.d.ts +1 -1
  20. package/lib/entity/sectionClassesViewV2/sectionClassesViewReducer.d.ts +2 -2
  21. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  22. package/lib/entity/snackbar/snackbarTypes.js +0 -4
  23. package/lib/entity/tenant/clearAllEpic.d.ts +1 -5
  24. package/lib/entity/tenant/clearAllEpic.js +0 -8
  25. package/lib/entity/tenant/tenantPayload.d.ts +0 -3
  26. package/lib/entity/tenant/tenantReducer.js +0 -1
  27. package/lib/entity/tenant/tenantSelector.d.ts +1 -5
  28. package/lib/entity/tenant/tenantSelector.js +0 -6
  29. package/lib/entity/tenant/tenantState.d.ts +0 -1
  30. package/lib/entity/userRole/userRolePayload.d.ts +0 -6
  31. package/lib/entity/userRole/userRolePayload.js +0 -6
  32. package/lib/entity/userRole/userRoleReducer.js +0 -3
  33. package/lib/entity/userRole/userRoleState.d.ts +0 -1
  34. package/lib/entity/userRole/userRoleType.d.ts +2 -5
  35. package/lib/entity/userRole/userRoleType.js +5 -44
  36. package/lib/epic.d.ts +1 -11
  37. package/lib/epic.js +1 -11
  38. package/lib/index.d.ts +9 -23
  39. package/lib/index.js +33 -64
  40. package/lib/reducer.d.ts +0 -12
  41. package/lib/reducer.js +0 -12
  42. package/lib/view/addressView/__mocks__/json/createCompanyAddressSuccess.json +0 -21
  43. package/lib/view/addressView/__mocks__/json/createCompanyUserAddressSuccess.json +0 -43
  44. package/lib/view/auditReportView/auditReportViewState.d.ts +1 -1
  45. package/lib/view/billPayCard/billPayCardSelector.d.ts +1 -1
  46. package/lib/view/cardBalance/cardBalanceSelector.d.ts +1 -1
  47. package/lib/view/cashBalance/cashBalanceSelector.d.ts +1 -1
  48. package/lib/view/cashInCashOut/cashInCashOutSelector.d.ts +1 -1
  49. package/lib/view/cashPosition/cashPositionSelector.d.ts +1 -1
  50. package/lib/view/dashboard/dashboardReducer.d.ts +2 -2
  51. package/lib/view/financeStatement/financeStatementReducer.d.ts +1 -1
  52. package/lib/view/globalMerchantView/globalMerchantViewReducer.d.ts +2 -2
  53. package/lib/view/onboardingView/cockpitView/onboardingCockpitViewPayload.d.ts +0 -1
  54. package/lib/view/onboardingView/cockpitView/onboardingCockpitViewPayload.js +0 -7
  55. package/lib/view/onboardingView/cockpitView/onboardingCockpitViewSelector.js +0 -5
  56. package/lib/view/onboardingView/cockpitView/types/onboardingCockpitViewTypes.d.ts +2 -2
  57. package/lib/view/onboardingView/cockpitView/types/onboardingCockpitViewTypes.js +0 -1
  58. package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.js +0 -1
  59. package/lib/view/reimbursementCard/reimbursementCardSelector.d.ts +1 -1
  60. package/lib/view/settingsView/settingsViewSelector.d.ts +1 -1
  61. package/lib/view/settingsView/settingsViewSelector.js +2 -9
  62. package/lib/view/spendManagement/commonHistoryView/commonHistoryReducer.d.ts +2 -2
  63. package/lib/view/spendManagement/commonSetup/epic/setup/updateBusinessVerificationDetailsEpic.js +1 -6
  64. package/lib/view/spendManagement/commonSetup/epic/setup/updateSetupViewLocalStoreDataEpic.js +1 -3
  65. package/lib/view/spendManagement/commonSetup/setupViewReducer.d.ts +6 -6
  66. package/lib/view/spendManagement/commonSetup/setupViewReducer.js +2 -15
  67. package/lib/view/spendManagement/commonSetup/setupViewSelector.d.ts +0 -1
  68. package/lib/view/spendManagement/commonSetup/setupViewSelector.js +2 -10
  69. package/lib/view/spendManagement/commonSetup/setupViewState.d.ts +1 -3
  70. package/lib/view/spendManagement/commonSetup/types/businessVerification.d.ts +0 -1
  71. package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/updatePrimaryFundingAccountEpic.js +0 -6
  72. package/lib/view/spendManagement/plaidAccount/plaidAccountViewReducer.d.ts +10 -10
  73. package/lib/view/spendManagement/plaidAccount/plaidAccountViewReducer.js +0 -1
  74. package/lib/view/spendManagement/plaidAccount/plaidAccountViewState.d.ts +1 -1
  75. package/lib/view/spendManagement/realTimeApprovalView/realTimeApprovalReducer.d.ts +2 -2
  76. package/lib/view/tasksCard/tasksCardSelector.d.ts +1 -1
  77. package/lib/view/topEx/topExSelector.d.ts +1 -1
  78. package/package.json +1 -1
  79. package/lib/view/spendManagement/treasury/treasuryList/epics/fetchTreasuryDetailEpic.d.ts +0 -9
  80. package/lib/view/spendManagement/treasury/treasuryList/epics/fetchTreasuryDetailEpic.js +0 -69
  81. package/lib/view/spendManagement/treasury/treasuryList/epics/fetchTreasuryHistoryEpic.d.ts +0 -7
  82. package/lib/view/spendManagement/treasury/treasuryList/epics/fetchTreasuryHistoryEpic.js +0 -31
  83. package/lib/view/spendManagement/treasury/treasuryList/epics/fetchTreasuryTransactionListEpic.d.ts +0 -7
  84. package/lib/view/spendManagement/treasury/treasuryList/epics/fetchTreasuryTransactionListEpic.js +0 -40
  85. package/lib/view/spendManagement/treasury/treasuryList/treasuryDetailPayload.d.ts +0 -60
  86. package/lib/view/spendManagement/treasury/treasuryList/treasuryDetailPayload.js +0 -18
  87. package/lib/view/spendManagement/treasury/treasuryList/treasuryDetailReducer.d.ts +0 -31
  88. package/lib/view/spendManagement/treasury/treasuryList/treasuryDetailReducer.js +0 -152
  89. package/lib/view/spendManagement/treasury/treasuryList/treasuryDetailSelector.d.ts +0 -14
  90. package/lib/view/spendManagement/treasury/treasuryList/treasuryDetailSelector.js +0 -46
  91. package/lib/view/spendManagement/treasury/treasuryList/treasuryDetailState.d.ts +0 -42
  92. package/lib/view/spendManagement/treasury/treasuryList/treasuryDetailState.js +0 -31
  93. package/lib/view/spendManagement/treasury/treasurySetUp/epic/acceptTreasuryTermsEpic.d.ts +0 -11
  94. package/lib/view/spendManagement/treasury/treasurySetUp/epic/acceptTreasuryTermsEpic.js +0 -44
  95. package/lib/view/spendManagement/treasury/treasurySetUp/epic/fetchPortfolioAllocationEpic.d.ts +0 -7
  96. package/lib/view/spendManagement/treasury/treasurySetUp/epic/fetchPortfolioAllocationEpic.js +0 -21
  97. package/lib/view/spendManagement/treasury/treasurySetUp/epic/fetchTreasuryFundsEpic.d.ts +0 -7
  98. package/lib/view/spendManagement/treasury/treasurySetUp/epic/fetchTreasuryFundsEpic.js +0 -28
  99. package/lib/view/spendManagement/treasury/treasurySetUp/epic/fetchTreasurySetupViewEpic.d.ts +0 -20
  100. package/lib/view/spendManagement/treasury/treasurySetUp/epic/fetchTreasurySetupViewEpic.js +0 -83
  101. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updatePortfolioAllocationEpic.d.ts +0 -7
  102. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updatePortfolioAllocationEpic.js +0 -30
  103. package/lib/view/spendManagement/treasury/treasurySetUp/treasurySetupViewPayload.d.ts +0 -53
  104. package/lib/view/spendManagement/treasury/treasurySetUp/treasurySetupViewPayload.js +0 -2
  105. package/lib/view/spendManagement/treasury/treasurySetUp/treasurySetupViewReducer.d.ts +0 -19
  106. package/lib/view/spendManagement/treasury/treasurySetUp/treasurySetupViewReducer.js +0 -264
  107. package/lib/view/spendManagement/treasury/treasurySetUp/treasurySetupViewSelector.d.ts +0 -24
  108. package/lib/view/spendManagement/treasury/treasurySetUp/treasurySetupViewSelector.js +0 -35
  109. package/lib/view/spendManagement/treasury/treasurySetUp/treasurySetupViewState.d.ts +0 -47
  110. package/lib/view/spendManagement/treasury/treasurySetUp/treasurySetupViewState.js +0 -2
  111. package/lib/view/spendManagement/treasury/treasuryStatementList/fetchTreasuryStatementListEpic.d.ts +0 -7
  112. package/lib/view/spendManagement/treasury/treasuryStatementList/fetchTreasuryStatementListEpic.js +0 -42
  113. package/lib/view/spendManagement/treasury/treasuryStatementList/treasuryStatementList.d.ts +0 -10
  114. package/lib/view/spendManagement/treasury/treasuryStatementList/treasuryStatementList.js +0 -11
  115. package/lib/view/spendManagement/treasury/treasuryStatementList/treasuryStatementListPayload.d.ts +0 -10
  116. package/lib/view/spendManagement/treasury/treasuryStatementList/treasuryStatementListPayload.js +0 -2
  117. package/lib/view/spendManagement/treasury/treasuryStatementList/treasuryStatementListReducer.d.ts +0 -15
  118. package/lib/view/spendManagement/treasury/treasuryStatementList/treasuryStatementListReducer.js +0 -57
  119. package/lib/view/spendManagement/treasury/treasuryStatementList/treasuryStatementListSelector.d.ts +0 -7
  120. package/lib/view/spendManagement/treasury/treasuryStatementList/treasuryStatementListSelector.js +0 -18
  121. package/lib/view/spendManagement/treasury/treasuryTransferMoney/treasuryTransferMoneyEpic.d.ts +0 -9
  122. package/lib/view/spendManagement/treasury/treasuryTransferMoney/treasuryTransferMoneyEpic.js +0 -92
  123. package/lib/view/spendManagement/treasury/treasuryTransferMoney/treasuryTransferMoneyPayload.d.ts +0 -36
  124. package/lib/view/spendManagement/treasury/treasuryTransferMoney/treasuryTransferMoneyPayload.js +0 -15
  125. package/lib/view/spendManagement/treasury/treasuryTransferMoney/treasuryTransferMoneyReducer.d.ts +0 -10
  126. package/lib/view/spendManagement/treasury/treasuryTransferMoney/treasuryTransferMoneyReducer.js +0 -45
  127. package/lib/view/spendManagement/treasury/treasuryTransferMoney/treasuryTransferMoneySelector.d.ts +0 -17
  128. package/lib/view/spendManagement/treasury/treasuryTransferMoney/treasuryTransferMoneySelector.js +0 -55
  129. package/lib/view/spendManagement/treasury/treasuryTransferMoney/treasuryTransferMoneyState.d.ts +0 -17
  130. package/lib/view/spendManagement/treasury/treasuryTransferMoney/treasuryTransferMoneyState.js +0 -2
@@ -1,264 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- var _a;
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.updateFundAllocationLocalData = exports.fetchPortfolioAllocationFailure = exports.fetchPortfolioAllocationSuccess = exports.fetchPortfolioAllocation = exports.updatePortfolioAllocationFailure = exports.updatePortfolioAllocationSuccess = exports.updatePortfolioAllocation = exports.updateTreasuryFundsFailure = exports.updateTreasuryFundsSuccess = exports.clearTreasurySetupView = exports.acceptTreasuryTermsFailure = exports.acceptTreasuryTermsSuccess = exports.acceptTreasuryTerms = exports.fetchTreasurySetupViewFailure = exports.fetchTreasurySetupViewSuccess = exports.fetchTreasurySetupView = exports.fetchTreasuryFunds = exports.initialState = void 0;
8
- const toolkit_1 = require("@reduxjs/toolkit");
9
- const isEqual_1 = __importDefault(require("lodash/isEqual"));
10
- const zeniDayJS_1 = require("../../../../zeniDayJS");
11
- exports.initialState = {
12
- fetchState: 'Not-Started',
13
- error: undefined,
14
- isRefreshingViewInBackground: false,
15
- treasuryTermsDetails: undefined,
16
- treasuryFundsDetails: {
17
- fundsDetails: [],
18
- fundAllocationOptions: [],
19
- fetchStatus: {
20
- fetchState: 'Not-Started',
21
- error: undefined,
22
- },
23
- },
24
- fundAllocationLocalData: {
25
- allocation: {},
26
- riskLevel: 'Recommended',
27
- optionIndex: 0,
28
- },
29
- currentAllocation: {
30
- fetchStatus: {
31
- fetchState: 'Not-Started',
32
- error: undefined,
33
- },
34
- allocation: undefined,
35
- },
36
- portfolioAllocationUpdateStatus: {
37
- fetchState: 'Not-Started',
38
- error: undefined,
39
- },
40
- hasValidState() {
41
- return this.fetchState === 'Completed';
42
- },
43
- };
44
- const treasurySetupView = (0, toolkit_1.createSlice)({
45
- name: 'treasurySetupView',
46
- initialState: exports.initialState,
47
- reducers: {
48
- fetchTreasuryFunds(draft) {
49
- draft.treasuryFundsDetails = Object.assign(Object.assign({}, draft.treasuryFundsDetails), { fundsDetails: [], fundAllocationOptions: [], fetchStatus: {
50
- fetchState: 'In-Progress',
51
- error: undefined,
52
- } });
53
- },
54
- updateTreasuryFundsSuccess(draft, action) {
55
- const fundAllocationOptions = action.payload.allocation_percentage_to_risk.map((option, index) => ({
56
- allocation: option.allocation,
57
- riskLevel: option.risk_level,
58
- optionIndex: index,
59
- }));
60
- draft.treasuryFundsDetails = {
61
- fundsDetails: mapTreasuryFundsPayloadToFundData(action.payload),
62
- fundAllocationOptions,
63
- fetchStatus: { fetchState: 'Completed', error: undefined },
64
- };
65
- // If currentAllocation already exists, populate fundAllocationLocalData with matching option
66
- if (draft.currentAllocation.allocation) {
67
- const matchingOption = fundAllocationOptions.find((option) => (0, isEqual_1.default)(option.allocation, draft.currentAllocation.allocation));
68
- if (matchingOption) {
69
- draft.fundAllocationLocalData = {
70
- allocation: matchingOption.allocation,
71
- riskLevel: matchingOption.riskLevel,
72
- optionIndex: matchingOption.optionIndex,
73
- };
74
- }
75
- }
76
- else {
77
- // If no currentAllocation, default to "Recommended" risk level option
78
- const recommendedOption = fundAllocationOptions.find((option) => option.riskLevel === 'Recommended');
79
- if (recommendedOption) {
80
- draft.fundAllocationLocalData = {
81
- allocation: recommendedOption.allocation,
82
- riskLevel: recommendedOption.riskLevel,
83
- optionIndex: recommendedOption.optionIndex,
84
- };
85
- }
86
- }
87
- },
88
- updateTreasuryFundsFailure(draft, action) {
89
- draft.treasuryFundsDetails = {
90
- fundsDetails: [],
91
- fundAllocationOptions: [],
92
- fetchStatus: {
93
- fetchState: 'Error',
94
- error: action.payload.error,
95
- },
96
- };
97
- },
98
- fetchTreasurySetupView: {
99
- reducer(draft, action) {
100
- const { refreshViewInBackground } = action.payload;
101
- draft.isRefreshingViewInBackground = refreshViewInBackground;
102
- if (!refreshViewInBackground) {
103
- draft.fetchState = 'In-Progress';
104
- draft.error = undefined;
105
- }
106
- },
107
- prepare(companyId, cacheOverride = false, refreshViewInBackground = false) {
108
- return {
109
- payload: { companyId, cacheOverride, refreshViewInBackground },
110
- };
111
- },
112
- },
113
- fetchTreasurySetupViewSuccess(draft) {
114
- draft.isRefreshingViewInBackground = false;
115
- draft.fetchState = 'Completed';
116
- draft.error = undefined;
117
- },
118
- fetchTreasurySetupViewFailure: {
119
- reducer(draft, action) {
120
- draft.isRefreshingViewInBackground = false;
121
- draft.fetchState = 'Error';
122
- draft.error = action.payload;
123
- },
124
- prepare(error) {
125
- return {
126
- payload: error,
127
- };
128
- },
129
- },
130
- acceptTreasuryTerms: {
131
- reducer(draft) {
132
- draft.treasuryTermsDetails = Object.assign({}, draft.treasuryTermsDetails, {
133
- fetchStatus: {
134
- fetchState: 'In-Progress',
135
- error: undefined,
136
- },
137
- });
138
- },
139
- prepare(companyId) {
140
- return { payload: { companyId } };
141
- },
142
- },
143
- acceptTreasuryTermsSuccess(draft) {
144
- draft.treasuryTermsDetails = Object.assign({}, draft.treasuryTermsDetails, {
145
- fetchStatus: {
146
- fetchState: 'Completed',
147
- error: undefined,
148
- },
149
- });
150
- },
151
- acceptTreasuryTermsFailure: {
152
- reducer(draft, action) {
153
- draft.treasuryTermsDetails = Object.assign({}, draft.treasuryTermsDetails, {
154
- fetchStatus: {
155
- fetchState: 'Error',
156
- error: action.payload,
157
- },
158
- });
159
- },
160
- prepare(error) {
161
- return {
162
- payload: error,
163
- };
164
- },
165
- },
166
- updatePortfolioAllocation: {
167
- reducer(draft) {
168
- draft.portfolioAllocationUpdateStatus = {
169
- fetchState: 'In-Progress',
170
- error: undefined,
171
- };
172
- },
173
- prepare(isEdit) {
174
- return {
175
- payload: { isEdit },
176
- };
177
- },
178
- },
179
- updatePortfolioAllocationSuccess(draft) {
180
- draft.portfolioAllocationUpdateStatus = {
181
- fetchState: 'Completed',
182
- error: undefined,
183
- };
184
- },
185
- updatePortfolioAllocationFailure: {
186
- reducer(draft, action) {
187
- draft.portfolioAllocationUpdateStatus = {
188
- fetchState: 'Error',
189
- error: action.payload,
190
- };
191
- },
192
- prepare(error) {
193
- return {
194
- payload: error,
195
- };
196
- },
197
- },
198
- fetchPortfolioAllocation(draft) {
199
- draft.currentAllocation = {
200
- fetchStatus: {
201
- fetchState: 'In-Progress',
202
- error: undefined,
203
- },
204
- allocation: undefined,
205
- };
206
- },
207
- fetchPortfolioAllocationSuccess(draft, action) {
208
- draft.currentAllocation = Object.assign({ fetchStatus: {
209
- fetchState: 'Completed',
210
- error: undefined,
211
- } }, (Object.keys(action.payload.allocation_percentages).length > 0 && {
212
- allocation: action.payload.allocation_percentages,
213
- }));
214
- //populate the fund allocation local data with current allocation
215
- const option = draft.treasuryFundsDetails.fundAllocationOptions.find((option) => (0, isEqual_1.default)(option.allocation, action.payload.allocation_percentages));
216
- if (option) {
217
- draft.fundAllocationLocalData = {
218
- allocation: option.allocation,
219
- riskLevel: option.riskLevel,
220
- optionIndex: option.optionIndex,
221
- };
222
- }
223
- },
224
- fetchPortfolioAllocationFailure(draft, action) {
225
- draft.currentAllocation = {
226
- fetchStatus: {
227
- fetchState: 'Error',
228
- error: action.payload,
229
- },
230
- allocation: undefined,
231
- };
232
- },
233
- updateFundAllocationLocalData(draft, action) {
234
- draft.fundAllocationLocalData = action.payload;
235
- },
236
- clearTreasurySetupView(draft) {
237
- Object.assign(draft, exports.initialState);
238
- },
239
- },
240
- });
241
- _a = treasurySetupView.actions, exports.fetchTreasuryFunds = _a.fetchTreasuryFunds, exports.fetchTreasurySetupView = _a.fetchTreasurySetupView, exports.fetchTreasurySetupViewSuccess = _a.fetchTreasurySetupViewSuccess, exports.fetchTreasurySetupViewFailure = _a.fetchTreasurySetupViewFailure, exports.acceptTreasuryTerms = _a.acceptTreasuryTerms, exports.acceptTreasuryTermsSuccess = _a.acceptTreasuryTermsSuccess, exports.acceptTreasuryTermsFailure = _a.acceptTreasuryTermsFailure, exports.clearTreasurySetupView = _a.clearTreasurySetupView, exports.updateTreasuryFundsSuccess = _a.updateTreasuryFundsSuccess, exports.updateTreasuryFundsFailure = _a.updateTreasuryFundsFailure, exports.updatePortfolioAllocation = _a.updatePortfolioAllocation, exports.updatePortfolioAllocationSuccess = _a.updatePortfolioAllocationSuccess, exports.updatePortfolioAllocationFailure = _a.updatePortfolioAllocationFailure, exports.fetchPortfolioAllocation = _a.fetchPortfolioAllocation, exports.fetchPortfolioAllocationSuccess = _a.fetchPortfolioAllocationSuccess, exports.fetchPortfolioAllocationFailure = _a.fetchPortfolioAllocationFailure, exports.updateFundAllocationLocalData = _a.updateFundAllocationLocalData;
242
- exports.default = treasurySetupView.reducer;
243
- function mapTreasuryFundsPayloadToFundData(fundsPayload) {
244
- return fundsPayload.funds.map((fund) => ({
245
- fundCode: fund.fund_code,
246
- fundName: fund.fund_name,
247
- fundCompanyName: fund.fund_company_name,
248
- fundType: fund.fund_type,
249
- description: fund.description,
250
- liquidityTimeline: fund.liquidity_timeline,
251
- yield: fund.percentage_yield,
252
- fundSize: fund.fund_size,
253
- currencySymbol: fund.currency_symbol,
254
- maturity: fund.maturity,
255
- expenseRatio: fund.expense_ratio,
256
- riskRating: fund.risk_rating,
257
- compositions: fund.compositions.map((composition) => ({
258
- percentage: composition.percentage,
259
- investedIn: composition.invested_in,
260
- })),
261
- url: fund.url,
262
- asOfDate: (0, zeniDayJS_1.date)(fund.as_of_date),
263
- }));
264
- }
@@ -1,24 +0,0 @@
1
- import { FetchStateAndError, ID } from '../../../../commonStateTypes/common';
2
- import { SelectorView } from '../../../../commonStateTypes/viewAndReport/viewAndReport';
3
- import { CompanyTreasuryInfo } from '../../../../entity/company/companyStateTypes';
4
- import { RootState } from '../../../../reducer';
5
- import { BusinessVerificationDetails, CompanyOfficersDetails, SetupView } from '../../commonSetup/setupViewSelector';
6
- import { FundAllocationOption, FundData } from './treasurySetupViewState';
7
- export interface TreasurySetupView extends SetupView, SelectorView {
8
- fundsData: FundData[];
9
- fundAllocationOptions: FundAllocationOption[];
10
- isRefreshingViewInBackground: boolean;
11
- fundAllocationLocalData: FundAllocationOption;
12
- portfolioAllocationUpdateStatus: FetchStateAndError;
13
- companyTreasuryInfo?: CompanyTreasuryInfo;
14
- treasuryTermsDetails?: {
15
- fetchStatus: FetchStateAndError;
16
- };
17
- selectedCompanyOfficer?: CompanyOfficersDetails;
18
- currentAllocation?: Record<string, number>;
19
- }
20
- export interface TreasuryBusinessVerificationDetails extends BusinessVerificationDetails, SelectorView {
21
- isRefreshingViewInBackground: boolean;
22
- }
23
- export declare function getTreasurySetupViewDetails(state: RootState, companyId: ID): TreasurySetupView;
24
- export declare function getTreasuryBusinessVerificationDetails(state: RootState, companyId: ID): TreasuryBusinessVerificationDetails;
@@ -1,35 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getTreasurySetupViewDetails = getTreasurySetupViewDetails;
4
- exports.getTreasuryBusinessVerificationDetails = getTreasuryBusinessVerificationDetails;
5
- const reduceFetchState_1 = require("../../../../commonStateTypes/reduceFetchState");
6
- const getCompanyView_1 = require("../../../companyView/selectorHelpers/getCompanyView");
7
- const setupViewSelector_1 = require("../../commonSetup/setupViewSelector");
8
- const helpers_1 = require("../../helpers");
9
- function getTreasurySetupViewDetails(state, companyId) {
10
- const treasurySetupViewDetails = (0, setupViewSelector_1.getCommonSetupViewDetails)(state, companyId, 'zeni_treasury', 'treasury_setup');
11
- const companyView = (0, getCompanyView_1.getCompanyView)(state, companyId, []);
12
- const companyTreasuryInfo = companyView === null || companyView === void 0 ? void 0 : companyView.company.company.companyTreasuryInfo;
13
- const { treasurySetupViewState, setupViewState } = state;
14
- const { treasuryTermsDetails, isRefreshingViewInBackground, treasuryFundsDetails, } = treasurySetupViewState;
15
- const { updateStatus } = setupViewState;
16
- const businessVerificationDetails = getTreasuryBusinessVerificationDetails(state, companyId);
17
- const selectedCompanyOfficer = (0, helpers_1.getSelectedCompanyOfficer)(businessVerificationDetails);
18
- const reducedFetchState = (0, reduceFetchState_1.reduceFetchState)([
19
- treasurySetupViewState,
20
- treasurySetupViewState.treasuryFundsDetails.fetchStatus,
21
- treasurySetupViewState.currentAllocation.fetchStatus,
22
- ]);
23
- return Object.assign(Object.assign({}, treasurySetupViewDetails), { treasuryTermsDetails,
24
- companyTreasuryInfo, version: 1, fetchState: reducedFetchState.fetchState, error: reducedFetchState.error, updateStatus,
25
- selectedCompanyOfficer,
26
- isRefreshingViewInBackground, fundsData: treasuryFundsDetails.fundsDetails, fundAllocationOptions: treasuryFundsDetails.fundAllocationOptions, fundAllocationLocalData: treasurySetupViewState.fundAllocationLocalData, currentAllocation: treasurySetupViewState.currentAllocation.allocation, portfolioAllocationUpdateStatus: treasurySetupViewState.portfolioAllocationUpdateStatus });
27
- }
28
- function getTreasuryBusinessVerificationDetails(state, companyId) {
29
- const treasuryBusinessVerificationDetails = (0, setupViewSelector_1.getBusinessVerificationDetails)(state, companyId);
30
- const { treasurySetupViewState } = state;
31
- const { isRefreshingViewInBackground, fetchState, error } = treasurySetupViewState;
32
- return Object.assign(Object.assign({}, treasuryBusinessVerificationDetails), { version: 1, fetchState,
33
- error,
34
- isRefreshingViewInBackground });
35
- }
@@ -1,47 +0,0 @@
1
- import { FetchStateAndError, FetchedState } from '../../../../commonStateTypes/common';
2
- import { ZeniDate } from '../../../../zeniDayJS';
3
- import { SetupViewLocalData } from '../../commonSetup/setupViewState';
4
- export type TreasurySetupViewLocalData = SetupViewLocalData;
5
- export interface TreasurySetupViewState extends FetchedState {
6
- isRefreshingViewInBackground: boolean;
7
- currentAllocation: {
8
- fetchStatus: FetchStateAndError;
9
- allocation?: Record<string, number>;
10
- };
11
- treasuryFundsDetails: {
12
- fundsDetails: FundData[];
13
- fundAllocationOptions: FundAllocationOption[];
14
- fetchStatus: FetchStateAndError;
15
- };
16
- portfolioAllocationUpdateStatus: FetchStateAndError;
17
- fundAllocationLocalData: FundAllocationOption;
18
- treasuryTermsDetails?: {
19
- fetchStatus: FetchStateAndError;
20
- };
21
- }
22
- export interface FundAllocationOption {
23
- allocation: Record<string, number>;
24
- riskLevel: string;
25
- optionIndex: number;
26
- }
27
- export interface FundData {
28
- fundCode: string;
29
- fundName: string;
30
- fundCompanyName: string;
31
- fundType: string;
32
- description: string;
33
- liquidityTimeline: string;
34
- yield: string;
35
- fundSize: string;
36
- currencySymbol: string;
37
- maturity: string;
38
- expenseRatio: string;
39
- riskRating: string;
40
- compositions: FundComposition[];
41
- url: string;
42
- asOfDate: ZeniDate;
43
- }
44
- export interface FundComposition {
45
- percentage: string;
46
- investedIn: string;
47
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,7 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { Observable } from 'rxjs';
3
- import { RootState } from '../../../../reducer';
4
- import { ZeniAPI } from '../../../../zeniAPI';
5
- import { fetchTreasuryStatementList, updateTreasuryStatementList, updateTreasuryStatementListFetchStatus } from './treasuryStatementListReducer';
6
- export type ActionType = ReturnType<typeof fetchTreasuryStatementList> | ReturnType<typeof updateTreasuryStatementList> | ReturnType<typeof updateTreasuryStatementListFetchStatus>;
7
- export declare const fetchTreasuryStatementListEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -1,42 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fetchTreasuryStatementListEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const responsePayload_1 = require("../../../../responsePayload");
7
- const treasuryStatementListReducer_1 = require("./treasuryStatementListReducer");
8
- const fetchTreasuryStatementListEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(treasuryStatementListReducer_1.fetchTreasuryStatementList.match), (0, operators_1.mergeMap)((action) => {
9
- const { cacheOverride } = action.payload;
10
- const currentFetchState = state$.value.treasuryStatementListState.fetchState;
11
- if (cacheOverride === true || currentFetchState !== 'Completed') {
12
- const apiEndpoint = `${zeniAPI.apiEndPoints.bankingMicroServiceBaseUrl}/1.0/treasury-account/statements`;
13
- return zeniAPI
14
- .getJSON(apiEndpoint)
15
- .pipe((0, operators_1.mergeMap)((response) => {
16
- var _a, _b;
17
- if ((0, responsePayload_1.isSuccessResponse)(response)) {
18
- return (0, rxjs_1.of)((0, treasuryStatementListReducer_1.updateTreasuryStatementList)({
19
- data: (_b = (_a = response.data) === null || _a === void 0 ? void 0 : _a.statements) !== null && _b !== void 0 ? _b : [],
20
- }));
21
- }
22
- else {
23
- return (0, rxjs_1.of)((0, treasuryStatementListReducer_1.updateTreasuryStatementListFetchStatus)({
24
- fetchState: 'Error',
25
- error: response.status,
26
- }));
27
- }
28
- }), (0, operators_1.catchError)((error) => {
29
- return (0, rxjs_1.of)((0, treasuryStatementListReducer_1.updateTreasuryStatementListFetchStatus)({
30
- fetchState: 'Error',
31
- error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch treasury Account statement REST API call errored out ' +
32
- JSON.stringify(error)),
33
- }));
34
- }));
35
- }
36
- // Otherwise, just update fetch status to completed
37
- return (0, rxjs_1.of)((0, treasuryStatementListReducer_1.updateTreasuryStatementListFetchStatus)({
38
- fetchState: 'Completed',
39
- error: undefined,
40
- }));
41
- }));
42
- exports.fetchTreasuryStatementListEpic = fetchTreasuryStatementListEpic;
@@ -1,10 +0,0 @@
1
- import { FetchedState, ID } from '../../../../commonStateTypes/common';
2
- import { MonthYearPeriod } from '../../../../commonStateTypes/timePeriod';
3
- export interface TreasuryStatementListState extends FetchedState {
4
- statements: Statement[];
5
- }
6
- export interface Statement {
7
- id: ID;
8
- title: MonthYearPeriod;
9
- }
10
- export declare const initialStatements: TreasuryStatementListState;
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.initialStatements = void 0;
4
- exports.initialStatements = {
5
- statements: [],
6
- fetchState: 'Not-Started',
7
- error: undefined,
8
- hasValidState() {
9
- return this.fetchState == 'Completed';
10
- },
11
- };
@@ -1,10 +0,0 @@
1
- import { ZeniAPIResponse } from '../../../../responsePayload';
2
- export interface StatementPayload {
3
- statement_id: string;
4
- period: string;
5
- }
6
- interface FetchTreasuryStatementPayload {
7
- statements: StatementPayload[];
8
- }
9
- export type FetchTreasuryStatementResponse = ZeniAPIResponse<FetchTreasuryStatementPayload>;
10
- export {};
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,15 +0,0 @@
1
- import { FetchState } from '../../../../commonStateTypes/common';
2
- import { ZeniAPIStatus } from '../../../../responsePayload';
3
- import { TreasuryStatementListState } from './treasuryStatementList';
4
- import { StatementPayload } from './treasuryStatementListPayload';
5
- export declare const initialState: TreasuryStatementListState;
6
- export declare const fetchTreasuryStatementList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[cacheOverride?: any], {
7
- cacheOverride: any;
8
- }, "treasuryStatementList/fetchTreasuryStatementList", never, never>, updateTreasuryStatementList: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
9
- data: StatementPayload[];
10
- }, "treasuryStatementList/updateTreasuryStatementList">, updateTreasuryStatementListFetchStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
11
- fetchState: FetchState;
12
- error?: ZeniAPIStatus;
13
- }, "treasuryStatementList/updateTreasuryStatementListFetchStatus">, clearTreasuryStatementList: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"treasuryStatementList/clearTreasuryStatementList">;
14
- declare const _default: import("redux").Reducer<TreasuryStatementListState>;
15
- export default _default;
@@ -1,57 +0,0 @@
1
- "use strict";
2
- var _a;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.clearTreasuryStatementList = exports.updateTreasuryStatementListFetchStatus = exports.updateTreasuryStatementList = exports.fetchTreasuryStatementList = exports.initialState = void 0;
5
- const toolkit_1 = require("@reduxjs/toolkit");
6
- exports.initialState = {
7
- statements: [],
8
- fetchState: 'Not-Started',
9
- error: undefined,
10
- hasValidState() {
11
- return this.fetchState == 'Completed';
12
- },
13
- };
14
- const treasuryStatementList = (0, toolkit_1.createSlice)({
15
- name: 'treasuryStatementList',
16
- initialState: exports.initialState,
17
- reducers: {
18
- fetchTreasuryStatementList: {
19
- reducer(draft) {
20
- draft.fetchState = 'In-Progress';
21
- },
22
- prepare(cacheOverride = false) {
23
- return {
24
- payload: {
25
- cacheOverride,
26
- },
27
- };
28
- },
29
- },
30
- updateTreasuryStatementList(draft, action) {
31
- const { data } = action.payload;
32
- const statements = data.map((payload) => {
33
- const s = payload.period.split('-');
34
- return {
35
- id: payload.statement_id,
36
- title: {
37
- year: parseInt(s[0]),
38
- month: parseInt(s[1]),
39
- },
40
- };
41
- });
42
- draft.statements = statements;
43
- draft.fetchState = 'Completed';
44
- draft.error = undefined;
45
- },
46
- updateTreasuryStatementListFetchStatus(draft, action) {
47
- const { fetchState, error } = action.payload;
48
- draft.fetchState = fetchState;
49
- draft.error = error;
50
- },
51
- clearTreasuryStatementList(draft) {
52
- Object.assign(draft, exports.initialState);
53
- },
54
- },
55
- });
56
- _a = treasuryStatementList.actions, exports.fetchTreasuryStatementList = _a.fetchTreasuryStatementList, exports.updateTreasuryStatementList = _a.updateTreasuryStatementList, exports.updateTreasuryStatementListFetchStatus = _a.updateTreasuryStatementListFetchStatus, exports.clearTreasuryStatementList = _a.clearTreasuryStatementList;
57
- exports.default = treasuryStatementList.reducer;
@@ -1,7 +0,0 @@
1
- import { SelectorView } from '../../../../commonStateTypes/viewAndReport/viewAndReport';
2
- import { RootState } from '../../../../reducer';
3
- import { Statement } from './treasuryStatementList';
4
- export interface TreasuryStatementsSelectorView extends SelectorView {
5
- statements: Statement[];
6
- }
7
- export declare const getTreasuryStatements: (state: RootState) => TreasuryStatementsSelectorView;
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getTreasuryStatements = void 0;
4
- const getTreasuryStatements = (state) => {
5
- var _a;
6
- const { treasuryStatementListState } = state;
7
- const fetchStateAndError = {
8
- fetchState: treasuryStatementListState.fetchState,
9
- error: treasuryStatementListState.error,
10
- };
11
- return {
12
- statements: (_a = treasuryStatementListState.statements) !== null && _a !== void 0 ? _a : [],
13
- fetchState: fetchStateAndError.fetchState,
14
- error: fetchStateAndError.error,
15
- version: 0,
16
- };
17
- };
18
- exports.getTreasuryStatements = getTreasuryStatements;
@@ -1,9 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { Observable } from 'rxjs';
3
- import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
4
- import { RootState } from '../../../../reducer';
5
- import { ZeniAPI } from '../../../../zeniAPI';
6
- import { updateTreasuryTransactionList } from '../treasuryList/treasuryDetailReducer';
7
- import { executeTreasuryTransferMoney, treasuryTransferMoneySuccessOrFailure } from './treasuryTransferMoneyReducer';
8
- export type ActionType = ReturnType<typeof executeTreasuryTransferMoney> | ReturnType<typeof treasuryTransferMoneySuccessOrFailure> | ReturnType<typeof updateTreasuryTransactionList> | ReturnType<typeof openSnackbar>;
9
- export declare const treasuryTransferMoneyEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;