@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.
Files changed (141) hide show
  1. package/lib/commonStateTypes/recommendationBase.d.ts +1 -2
  2. package/lib/commonStateTypes/viewAndReport/viewAndReport.d.ts +2 -2
  3. package/lib/commonStateTypes/viewAndReport/viewAndReport.js +0 -1
  4. package/lib/entity/account/accountState.d.ts +1 -1
  5. package/lib/entity/accountGroup/accountGroupState.d.ts +1 -1
  6. package/lib/entity/chargeCardRepayment/chargeCardRepayment.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/forecast/forecastState.d.ts +1 -1
  10. package/lib/entity/project/projectPayload.d.ts +0 -7
  11. package/lib/entity/project/projectPayload.js +1 -15
  12. package/lib/entity/sectionAccountsView/sectionAccountsView.d.ts +1 -1
  13. package/lib/entity/sectionClassesViewV2/sectionClassesView.d.ts +1 -1
  14. package/lib/entity/sectionClassesViewV2/sectionClassesViewReducer.d.ts +2 -2
  15. package/lib/entity/sectionProjectView/sectionProjectView.d.ts +1 -1
  16. package/lib/entity/sectionProjectView/sectionProjectViewReducer.d.ts +2 -2
  17. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  18. package/lib/entity/snackbar/snackbarTypes.js +0 -3
  19. package/lib/entity/tenant/clearAllEpic.d.ts +3 -6
  20. package/lib/entity/tenant/clearAllEpic.js +2 -8
  21. package/lib/entity/transaction/payloadTypes/transactionLinePayload.d.ts +0 -2
  22. package/lib/entity/transaction/payloadTypes/transactionLinePayload.js +0 -9
  23. package/lib/entity/transaction/stateTypes/transactionLine.d.ts +0 -2
  24. package/lib/epic.d.ts +1 -10
  25. package/lib/epic.js +1 -10
  26. package/lib/esm/commonStateTypes/viewAndReport/viewAndReport.js +0 -1
  27. package/lib/esm/entity/project/projectPayload.js +0 -12
  28. package/lib/esm/entity/snackbar/snackbarTypes.js +0 -3
  29. package/lib/esm/entity/tenant/clearAllEpic.js +2 -8
  30. package/lib/esm/entity/transaction/payloadTypes/transactionLinePayload.js +0 -9
  31. package/lib/esm/epic.js +1 -10
  32. package/lib/esm/index.js +10 -19
  33. package/lib/esm/reducer.js +3 -12
  34. package/lib/esm/view/transactionDetail/epics/saveTransactionHelper.js +0 -1
  35. package/lib/esm/view/transactionDetail/epics/transactionDetailEpic.js +0 -6
  36. package/lib/esm/view/transactionDetail/epics/updateTransactionDetailEpic.js +0 -3
  37. package/lib/esm/view/transactionDetail/transactionDetailSelector.js +2 -14
  38. package/lib/esm/view/transactionList/transactionListReducer.js +2 -83
  39. package/lib/esm/view/transactionList/transactionListState.js +0 -10
  40. package/lib/index.d.ts +14 -25
  41. package/lib/index.js +46 -86
  42. package/lib/reducer.d.ts +3 -12
  43. package/lib/reducer.js +3 -12
  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/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  52. package/lib/view/financeStatement/financeStatementReducer.d.ts +1 -1
  53. package/lib/view/globalMerchantView/globalMerchantViewReducer.d.ts +2 -2
  54. package/lib/view/reimbursementCard/reimbursementCardSelector.d.ts +1 -1
  55. package/lib/view/reportsResync/reportsResyncReducer.d.ts +2 -2
  56. package/lib/view/tasksCard/tasksCardSelector.d.ts +1 -1
  57. package/lib/view/topEx/topExSelector.d.ts +1 -1
  58. package/lib/view/transactionDetail/epics/saveTransactionHelper.js +0 -1
  59. package/lib/view/transactionDetail/epics/transactionDetailEpic.d.ts +1 -2
  60. package/lib/view/transactionDetail/epics/transactionDetailEpic.js +0 -6
  61. package/lib/view/transactionDetail/epics/updateTransactionDetailEpic.js +0 -3
  62. package/lib/view/transactionDetail/transactionDetailSelector.d.ts +0 -3
  63. package/lib/view/transactionDetail/transactionDetailSelector.js +1 -13
  64. package/lib/view/transactionDetail/transactionDetailState.d.ts +0 -2
  65. package/lib/view/transactionDetail/transactionDetailTypes.d.ts +0 -2
  66. package/lib/view/transactionList/transactionListPayload.d.ts +0 -15
  67. package/lib/view/transactionList/transactionListReducer.d.ts +2 -25
  68. package/lib/view/transactionList/transactionListReducer.js +2 -83
  69. package/lib/view/transactionList/transactionListState.d.ts +0 -15
  70. package/lib/view/transactionList/transactionListState.js +1 -13
  71. package/package.json +1 -1
  72. package/lib/entity/creditAgent/creditAgentPayload.d.ts +0 -41
  73. package/lib/entity/creditAgent/creditAgentPayload.js +0 -40
  74. package/lib/entity/creditAgent/creditAgentReducer.d.ts +0 -9
  75. package/lib/entity/creditAgent/creditAgentReducer.js +0 -37
  76. package/lib/entity/creditAgent/creditAgentSelector.d.ts +0 -3
  77. package/lib/entity/creditAgent/creditAgentSelector.js +0 -10
  78. package/lib/entity/creditAgent/creditAgentState.d.ts +0 -39
  79. package/lib/entity/creditAgent/creditAgentState.js +0 -17
  80. package/lib/esm/entity/creditAgent/creditAgentPayload.js +0 -36
  81. package/lib/esm/entity/creditAgent/creditAgentReducer.js +0 -33
  82. package/lib/esm/entity/creditAgent/creditAgentSelector.js +0 -6
  83. package/lib/esm/entity/creditAgent/creditAgentState.js +0 -13
  84. package/lib/esm/view/creditAgentView/buildCreditReportCsv.js +0 -44
  85. package/lib/esm/view/creditAgentView/creditAgentViewPayload.js +0 -2
  86. package/lib/esm/view/creditAgentView/creditAgentViewReducer.js +0 -183
  87. package/lib/esm/view/creditAgentView/creditAgentViewSelector.js +0 -85
  88. package/lib/esm/view/creditAgentView/creditAgentViewState.js +0 -20
  89. package/lib/esm/view/creditAgentView/epics/fetchCardProfilesEpic.js +0 -20
  90. package/lib/esm/view/creditAgentView/epics/fetchCreditAgentAccessEpic.js +0 -13
  91. package/lib/esm/view/creditAgentView/epics/fetchCreditAgentMacroEpic.js +0 -19
  92. package/lib/esm/view/creditAgentView/epics/saveCreditAgentMacroEpic.js +0 -58
  93. package/lib/esm/view/creditAgentView/epics/scheduleTenantCreditScoreCronEpic.js +0 -39
  94. package/lib/esm/view/creditAgentView/epics/updateCardProfileEpic.js +0 -62
  95. package/lib/esm/view/projectList/fetchProjectListEpic.js +0 -38
  96. package/lib/esm/view/projectList/projectListPayload.js +0 -1
  97. package/lib/esm/view/projectList/projectListReducer.js +0 -39
  98. package/lib/esm/view/projectList/projectListSelector.js +0 -9
  99. package/lib/esm/view/projectList/projectListState.js +0 -1
  100. package/lib/esm/view/transactionList/fetchTransactionListByProjectEpic.js +0 -45
  101. package/lib/esm/view/transactionList/parallelFetchProjectTransactionListEpic.js +0 -32
  102. package/lib/esm/view/transactionList/transactionListByProjectSelector.js +0 -58
  103. package/lib/tsconfig.typecheck.tsbuildinfo +0 -1
  104. package/lib/view/creditAgentView/buildCreditReportCsv.d.ts +0 -17
  105. package/lib/view/creditAgentView/buildCreditReportCsv.js +0 -47
  106. package/lib/view/creditAgentView/creditAgentViewPayload.d.ts +0 -9
  107. package/lib/view/creditAgentView/creditAgentViewPayload.js +0 -7
  108. package/lib/view/creditAgentView/creditAgentViewReducer.d.ts +0 -41
  109. package/lib/view/creditAgentView/creditAgentViewReducer.js +0 -187
  110. package/lib/view/creditAgentView/creditAgentViewSelector.d.ts +0 -20
  111. package/lib/view/creditAgentView/creditAgentViewSelector.js +0 -93
  112. package/lib/view/creditAgentView/creditAgentViewState.d.ts +0 -34
  113. package/lib/view/creditAgentView/creditAgentViewState.js +0 -22
  114. package/lib/view/creditAgentView/epics/fetchCardProfilesEpic.d.ts +0 -15
  115. package/lib/view/creditAgentView/epics/fetchCardProfilesEpic.js +0 -24
  116. package/lib/view/creditAgentView/epics/fetchCreditAgentAccessEpic.d.ts +0 -11
  117. package/lib/view/creditAgentView/epics/fetchCreditAgentAccessEpic.js +0 -17
  118. package/lib/view/creditAgentView/epics/fetchCreditAgentMacroEpic.d.ts +0 -15
  119. package/lib/view/creditAgentView/epics/fetchCreditAgentMacroEpic.js +0 -23
  120. package/lib/view/creditAgentView/epics/saveCreditAgentMacroEpic.d.ts +0 -29
  121. package/lib/view/creditAgentView/epics/saveCreditAgentMacroEpic.js +0 -62
  122. package/lib/view/creditAgentView/epics/scheduleTenantCreditScoreCronEpic.d.ts +0 -30
  123. package/lib/view/creditAgentView/epics/scheduleTenantCreditScoreCronEpic.js +0 -43
  124. package/lib/view/creditAgentView/epics/updateCardProfileEpic.d.ts +0 -37
  125. package/lib/view/creditAgentView/epics/updateCardProfileEpic.js +0 -66
  126. package/lib/view/projectList/fetchProjectListEpic.d.ts +0 -8
  127. package/lib/view/projectList/fetchProjectListEpic.js +0 -42
  128. package/lib/view/projectList/projectListPayload.d.ts +0 -7
  129. package/lib/view/projectList/projectListPayload.js +0 -2
  130. package/lib/view/projectList/projectListReducer.d.ts +0 -9
  131. package/lib/view/projectList/projectListReducer.js +0 -43
  132. package/lib/view/projectList/projectListSelector.d.ts +0 -8
  133. package/lib/view/projectList/projectListSelector.js +0 -13
  134. package/lib/view/projectList/projectListState.d.ts +0 -4
  135. package/lib/view/projectList/projectListState.js +0 -2
  136. package/lib/view/transactionList/fetchTransactionListByProjectEpic.d.ts +0 -8
  137. package/lib/view/transactionList/fetchTransactionListByProjectEpic.js +0 -52
  138. package/lib/view/transactionList/parallelFetchProjectTransactionListEpic.d.ts +0 -6
  139. package/lib/view/transactionList/parallelFetchProjectTransactionListEpic.js +0 -36
  140. package/lib/view/transactionList/transactionListByProjectSelector.d.ts +0 -22
  141. package/lib/view/transactionList/transactionListByProjectSelector.js +0 -66
@@ -1,45 +0,0 @@
1
- import { toBase64 } from 'js-base64';
2
- import lodashGet from 'lodash/get';
3
- import { from, of } from 'rxjs';
4
- import { catchError, filter, mergeMap } from 'rxjs/operators';
5
- import { toString } from '../../commonStateTypes/timePeriod';
6
- import { updateTransactions } from '../../entity/transaction/transactionReducer';
7
- import { createZeniAPIStatus, isSuccessResponse } from '../../responsePayload';
8
- import { fetchProjectTransactionList, updateTransactionListByProject, updateTransactionListByProjectFailure, } from './transactionListReducer';
9
- import { getProjectAcTranKey } from './transactionListState';
10
- export const fetchTransactionListByProjectEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(fetchProjectTransactionList.match), mergeMap((action) => {
11
- const state = state$.value;
12
- const key = getProjectAcTranKey(action.payload.accountId, action.payload.accountType, action.payload.projectId, action.payload.period);
13
- const projectTransactions = lodashGet(state.transactionListState.byProject.transactionListByProjectKey, key, undefined);
14
- if (action.payload.cacheOverride === true ||
15
- projectTransactions == null ||
16
- projectTransactions.hasValidState() === false) {
17
- const queryParam = {
18
- start_date: toString(action.payload.period.start),
19
- end_date: toString(action.payload.period.end),
20
- sort_by: 'create_time',
21
- sort_order: 'desc',
22
- account_id: action.payload.accountId,
23
- account_type: action.payload.accountType,
24
- zeni_project_id: action.payload.projectId,
25
- };
26
- const base64AccountId = toBase64(action.payload.accountId);
27
- return zeniAPI
28
- .getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accounts/${base64AccountId}/transactions?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
29
- .pipe(mergeMap((response) => {
30
- if (isSuccessResponse(response) && response.data != null) {
31
- const updateActions = [];
32
- updateActions.push(updateTransactions(response.data.account.transactions, (value) => value.transaction_id));
33
- updateActions.push(updateTransactionListByProject(response.data));
34
- return from(updateActions);
35
- }
36
- else {
37
- return of(updateTransactionListByProjectFailure(action.payload.accountId, action.payload.accountType, action.payload.projectId, action.payload.period, response.status));
38
- }
39
- }), catchError((error) => of(updateTransactionListByProjectFailure(action.payload.accountId, action.payload.accountType, action.payload.projectId, action.payload.period, createZeniAPIStatus('Unexpected Error', 'fetch transaction list REST API call errored out' +
40
- JSON.stringify(error))))));
41
- }
42
- else {
43
- return from([]);
44
- }
45
- }));
@@ -1,32 +0,0 @@
1
- import { from } from 'rxjs';
2
- import { filter, mergeMap } from 'rxjs/operators';
3
- import { splitPeriod } from './parallelFetchClassTransactionListEpic';
4
- import { fetchProjectTransactionList, parallelFetchProjectTransactionList, } from './transactionListReducer';
5
- import { getProjectAcTranKey, } from './transactionListState';
6
- export const parallelFetchProjectTransactionListEpic = (actions$, state$) => actions$.pipe(filter(parallelFetchProjectTransactionList.match), mergeMap((action) => {
7
- const state = state$.value.transactionListState;
8
- const timePeriods = splitPeriod(action.payload.period);
9
- const filteredTimePeriods = timePeriods.filter((value) => {
10
- if (action.payload.cacheOverride === false) {
11
- return (isDataAvailableOrFetching(state.byProject, action.payload.accountId, action.payload.accountType, action.payload.projectId, value) === false);
12
- }
13
- else {
14
- return true;
15
- }
16
- });
17
- if (filteredTimePeriods.length > 12) {
18
- console.error('Only maximum 12 parallel fetch are allowed!');
19
- return from([]);
20
- }
21
- else {
22
- const fetchActions = filteredTimePeriods.map((period) => fetchProjectTransactionList(action.payload.accountId, action.payload.accountType, action.payload.projectId, period, true));
23
- return from(fetchActions);
24
- }
25
- }));
26
- function isDataAvailableOrFetching(state, accountId, accountType, projectId, period) {
27
- const key = getProjectAcTranKey(accountId, accountType, projectId, period);
28
- const projectTransactions = state.transactionListByProjectKey[key];
29
- return (projectTransactions != null &&
30
- (projectTransactions.fetchState === 'In-Progress' ||
31
- projectTransactions.hasValidState()));
32
- }
@@ -1,58 +0,0 @@
1
- import flatMap from 'lodash/flatMap';
2
- import recordGet from 'lodash/get';
3
- import orderBy from 'lodash/orderBy';
4
- import { getSupportedTransactionById } from '../../entity/transaction/transactionSelector';
5
- import { splitPeriod } from './parallelFetchAccountTransactionListEpic';
6
- import { isAnyFetchCompleted, reduceFetchState, } from './reduceTransactionListFetchState';
7
- import { getProjectAcKey, getProjectAcTranKey, } from './transactionListState';
8
- export const getTransactionListByProject = (transactionState, transactionListState, accountId, accountType, projectId, timeframe, filterByTimePeriod) => {
9
- const timePeriods = splitPeriod(filterByTimePeriod); // Note: Split by months.
10
- const accountTransactions = timePeriods
11
- .map((thisTimePeriod) => {
12
- const key = getProjectAcTranKey(accountId, accountType, projectId, thisTimePeriod);
13
- return recordGet(transactionListState.byProject.transactionListByProjectKey, key, undefined);
14
- })
15
- .filter((acTransaction) => acTransaction != null);
16
- let account = undefined;
17
- if (accountTransactions.length > 0) {
18
- account = accountTransactions[0].account;
19
- }
20
- const fetchState = reduceFetchState(accountTransactions);
21
- let transactions = [];
22
- if (isAnyFetchCompleted(accountTransactions)) {
23
- const allTransactionIDs = flatMap(accountTransactions, (value) => value.transactionIDs);
24
- const transactionsUnsorted = allTransactionIDs
25
- .map((transactionId) => getSupportedTransactionById(transactionState, transactionId))
26
- .filter((value) => {
27
- if (value == null) {
28
- console.error("Can't have null transaction at this stage!");
29
- }
30
- return value != null;
31
- });
32
- transactions = orderBy(transactionsUnsorted, (value) => value.date.valueOf(), 'desc');
33
- }
34
- const key = getProjectAcKey(accountId, accountType, projectId);
35
- const uiState = recordGet(transactionListState.byProject.transactionListUIStateByProjectKey, key, {});
36
- return {
37
- reportId: 'transaction_list_of_account_by_project',
38
- reportTitle: 'Transaction List of Account By Project',
39
- version: 1,
40
- status: undefined,
41
- fetchState: fetchState.fetchState,
42
- error: fetchState.error,
43
- timeframe,
44
- filterByTimePeriod,
45
- accountId,
46
- accountType,
47
- projectId,
48
- account,
49
- transactionOrder: 'descending_transaction_date',
50
- transactions,
51
- uiState,
52
- latestTransactionId: transactionListState.latestTransactionId,
53
- };
54
- };
55
- export const getTransactionListUIStateByProjectKey = (transactionListState, accountId, accountType, projectId) => {
56
- const key = getProjectAcKey(accountId, accountType, projectId);
57
- return recordGet(transactionListState.byProject.transactionListUIStateByProjectKey, key, undefined);
58
- };