@zeniai/client-epic-state 4.19.99-betaRD9 → 4.19.99-betaSS2

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 (72) hide show
  1. package/lib/entity/billPay/billTransaction/billTransactionState.d.ts +2 -2
  2. package/lib/entity/chargeCard/chargeCard.d.ts +1 -1
  3. package/lib/entity/depositAccountTransaction/depositAccountTransaction.d.ts +1 -1
  4. package/lib/entity/entityApprovalStatus/entityApprovalStatusState.d.ts +2 -2
  5. package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +1 -1
  6. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  7. package/lib/entity/tenant/clearAllEpic.d.ts +1 -3
  8. package/lib/entity/tenant/clearAllEpic.js +0 -4
  9. package/lib/entity/userRole/userRoleType.d.ts +2 -2
  10. package/lib/epic.d.ts +1 -5
  11. package/lib/epic.js +1 -5
  12. package/lib/esm/entity/tenant/clearAllEpic.js +0 -4
  13. package/lib/esm/epic.js +1 -5
  14. package/lib/esm/index.js +0 -7
  15. package/lib/esm/reducer.js +0 -6
  16. package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +8 -3
  17. package/lib/esm/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.js +59 -140
  18. package/lib/index.d.ts +0 -8
  19. package/lib/index.js +2 -30
  20. package/lib/reducer.d.ts +0 -6
  21. package/lib/reducer.js +0 -6
  22. package/lib/view/aiCfoView/aiCfoViewState.d.ts +1 -1
  23. package/lib/view/companyView/types/cockpitTypes.d.ts +5 -6
  24. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  25. package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +1 -1
  26. package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +8 -3
  27. package/lib/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.js +59 -140
  28. package/lib/view/reviewCompanyView/reviewCompanyViewState.d.ts +1 -1
  29. package/lib/view/spendManagement/billPay/billList/billListReducer.d.ts +1 -1
  30. package/lib/view/spendManagement/billPay/billList/billListState.d.ts +1 -1
  31. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.d.ts +4 -4
  32. package/lib/view/spendManagement/reimbursement/remiListView/remiListReducer.d.ts +1 -1
  33. package/lib/view/spendManagement/reimbursement/remiListView/remiListState.d.ts +3 -3
  34. package/lib/view/subscriptionView/types/subscriptionTypes.d.ts +1 -1
  35. package/package.json +1 -1
  36. package/lib/entity/aiAccountantCustomer/aiAccountantCustomerPayload.d.ts +0 -44
  37. package/lib/entity/aiAccountantCustomer/aiAccountantCustomerPayload.js +0 -55
  38. package/lib/entity/aiAccountantCustomer/aiAccountantCustomerReducer.d.ts +0 -10
  39. package/lib/entity/aiAccountantCustomer/aiAccountantCustomerReducer.js +0 -51
  40. package/lib/entity/aiAccountantCustomer/aiAccountantCustomerSelector.d.ts +0 -48
  41. package/lib/entity/aiAccountantCustomer/aiAccountantCustomerSelector.js +0 -66
  42. package/lib/entity/aiAccountantCustomer/aiAccountantCustomerState.d.ts +0 -52
  43. package/lib/entity/aiAccountantCustomer/aiAccountantCustomerState.js +0 -37
  44. package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerPayload.js +0 -49
  45. package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerReducer.js +0 -47
  46. package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerSelector.js +0 -62
  47. package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerState.js +0 -31
  48. package/lib/esm/view/aiAccountantView/aiAccountantViewPayload.js +0 -2
  49. package/lib/esm/view/aiAccountantView/aiAccountantViewReducer.js +0 -149
  50. package/lib/esm/view/aiAccountantView/aiAccountantViewSelector.js +0 -72
  51. package/lib/esm/view/aiAccountantView/aiAccountantViewState.js +0 -11
  52. package/lib/esm/view/aiAccountantView/epics/cancelAiAccountantOnboardingEpic.js +0 -46
  53. package/lib/esm/view/aiAccountantView/epics/fetchAiAccountantCustomersEpic.js +0 -27
  54. package/lib/esm/view/aiAccountantView/epics/fetchAiAccountantJobsEpic.js +0 -47
  55. package/lib/esm/view/aiAccountantView/epics/triggerAiAccountantJobEpic.js +0 -52
  56. package/lib/tsconfig.typecheck.tsbuildinfo +0 -1
  57. package/lib/view/aiAccountantView/aiAccountantViewPayload.d.ts +0 -32
  58. package/lib/view/aiAccountantView/aiAccountantViewPayload.js +0 -8
  59. package/lib/view/aiAccountantView/aiAccountantViewReducer.d.ts +0 -29
  60. package/lib/view/aiAccountantView/aiAccountantViewReducer.js +0 -153
  61. package/lib/view/aiAccountantView/aiAccountantViewSelector.d.ts +0 -14
  62. package/lib/view/aiAccountantView/aiAccountantViewSelector.js +0 -78
  63. package/lib/view/aiAccountantView/aiAccountantViewState.d.ts +0 -27
  64. package/lib/view/aiAccountantView/aiAccountantViewState.js +0 -13
  65. package/lib/view/aiAccountantView/epics/cancelAiAccountantOnboardingEpic.d.ts +0 -33
  66. package/lib/view/aiAccountantView/epics/cancelAiAccountantOnboardingEpic.js +0 -50
  67. package/lib/view/aiAccountantView/epics/fetchAiAccountantCustomersEpic.d.ts +0 -23
  68. package/lib/view/aiAccountantView/epics/fetchAiAccountantCustomersEpic.js +0 -31
  69. package/lib/view/aiAccountantView/epics/fetchAiAccountantJobsEpic.d.ts +0 -33
  70. package/lib/view/aiAccountantView/epics/fetchAiAccountantJobsEpic.js +0 -51
  71. package/lib/view/aiAccountantView/epics/triggerAiAccountantJobEpic.d.ts +0 -28
  72. package/lib/view/aiAccountantView/epics/triggerAiAccountantJobEpic.js +0 -56
@@ -1,46 +0,0 @@
1
- import { from } from 'rxjs';
2
- import { catchError, filter, mergeMap } from 'rxjs/operators';
3
- import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
4
- import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
5
- import { cancelAiAccountantOnboarding, cancelAiAccountantOnboardingFailure, cancelAiAccountantOnboardingSuccess, fetchAiAccountantCustomers, } from '../aiAccountantViewReducer';
6
- export const cancelAiAccountantOnboardingEpic = (actions$, _, zeniAPI) => actions$.pipe(filter(cancelAiAccountantOnboarding.match), mergeMap((action) => {
7
- const { tenantId, companyId } = action.payload;
8
- const base = `${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/cockpit-panels`;
9
- const url = `${base}/ai-accountant/cancel-onboarding`;
10
- return zeniAPI
11
- .postAndGetJSON(url, {
12
- tenant_id: tenantId,
13
- company_id: companyId,
14
- })
15
- .pipe(mergeMap((response) => {
16
- if (isSuccessResponse(response)) {
17
- return from([
18
- cancelAiAccountantOnboardingSuccess(tenantId),
19
- fetchAiAccountantCustomers(),
20
- openSnackbar({
21
- messageSection: 'common',
22
- messageText: 'success',
23
- type: 'success',
24
- }),
25
- ]);
26
- }
27
- else {
28
- return from([
29
- cancelAiAccountantOnboardingFailure(tenantId, response.status),
30
- openSnackbar({
31
- messageSection: 'common',
32
- messageText: 'failed',
33
- type: 'error',
34
- }),
35
- ]);
36
- }
37
- }), catchError((error) => from([
38
- cancelAiAccountantOnboardingFailure(tenantId, createZeniAPIStatus('Unexpected error', 'AI Accountant cancel onboarding failed: ' +
39
- JSON.stringify(error))),
40
- openSnackbar({
41
- messageSection: 'common',
42
- messageText: 'failed',
43
- type: 'error',
44
- }),
45
- ])));
46
- }));
@@ -1,27 +0,0 @@
1
- import { from, of } from 'rxjs';
2
- import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
3
- import { updateAiAccountantCustomers as updateAiAccountantCustomerEntities } from '../../../entity/aiAccountantCustomer/aiAccountantCustomerReducer';
4
- import { updateAllUsers } from '../../../entity/user/userReducer';
5
- import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
6
- import { fetchAiAccountantCustomers, updateAiAccountantCustomers, updateAiAccountantCustomersFailure, } from '../aiAccountantViewReducer';
7
- export const fetchAiAccountantCustomersEpic = (actions$, _, zeniAPI) => actions$.pipe(filter(fetchAiAccountantCustomers.match), switchMap(() => {
8
- const base = `${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/cockpit-panels`;
9
- const url = `${base}/ai-accountant/customers`;
10
- return zeniAPI
11
- .getJSON(url)
12
- .pipe(mergeMap((response) => {
13
- if (isSuccessResponse(response)) {
14
- const customers = response.data?.customers ?? [];
15
- const users = response.data?.users ?? [];
16
- return from([
17
- updateAiAccountantCustomerEntities(customers),
18
- updateAllUsers({ users }),
19
- updateAiAccountantCustomers(customers),
20
- ]);
21
- }
22
- else {
23
- return of(updateAiAccountantCustomersFailure(response.status));
24
- }
25
- }), catchError((error) => of(updateAiAccountantCustomersFailure(createZeniAPIStatus('Unexpected error', 'AI Accountant customers fetch failed: ' +
26
- JSON.stringify(error))))));
27
- }));
@@ -1,47 +0,0 @@
1
- import { from, of } from 'rxjs';
2
- import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
3
- import { updateAiAccountantJobs as updateAiAccountantJobEntities } from '../../../entity/aiAccountantCustomer/aiAccountantCustomerReducer';
4
- import { updateAllUsers } from '../../../entity/user/userReducer';
5
- import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
6
- import { fetchAiAccountantJobs, updateAiAccountantJobs, updateAiAccountantJobsFailure, } from '../aiAccountantViewReducer';
7
- export const fetchAiAccountantJobsEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(fetchAiAccountantJobs.match), switchMap((action) => {
8
- const { tenantId, fetchNextPage } = action.payload;
9
- const rootState = state$.value;
10
- const customerView = rootState.aiAccountantViewState.customersByTenantId[tenantId];
11
- const pageToken = fetchNextPage && customerView?.jobsPageToken != null
12
- ? customerView.jobsPageToken
13
- : null;
14
- const params = new URLSearchParams({
15
- limit: '50',
16
- tenant_id: tenantId,
17
- });
18
- if (pageToken != null) {
19
- params.set('page_token', pageToken);
20
- }
21
- const base = `${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/cockpit-panels`;
22
- const url = `${base}/ai-accountant/jobs?${params.toString()}`;
23
- return zeniAPI
24
- .getJSON(url)
25
- .pipe(mergeMap((response) => {
26
- if (isSuccessResponse(response)) {
27
- const jobs = response.data?.jobs ?? [];
28
- const users = response.data?.users ?? [];
29
- const nextPageToken = response.data?.next_page_token ?? null;
30
- return from([
31
- updateAllUsers({ users }),
32
- updateAiAccountantJobEntities(tenantId, jobs, fetchNextPage),
33
- updateAiAccountantJobs(tenantId, nextPageToken),
34
- ]);
35
- }
36
- else {
37
- return of(updateAiAccountantJobsFailure({
38
- tenantId,
39
- error: response.status,
40
- }));
41
- }
42
- }), catchError((error) => of(updateAiAccountantJobsFailure({
43
- tenantId,
44
- error: createZeniAPIStatus('Unexpected error', 'AI Accountant jobs fetch failed: ' +
45
- JSON.stringify(error)),
46
- }))));
47
- }));
@@ -1,52 +0,0 @@
1
- import { from } from 'rxjs';
2
- import { catchError, filter, mergeMap } from 'rxjs/operators';
3
- import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
4
- import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
5
- import { fetchAiAccountantCustomers, triggerAiAccountantJob, triggerAiAccountantJobFailure, triggerAiAccountantJobSuccess, } from '../aiAccountantViewReducer';
6
- export const triggerAiAccountantJobEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(triggerAiAccountantJob.match), mergeMap((action) => {
7
- const { operationType, startDate, endDate } = action.payload;
8
- const rootState = state$.value;
9
- const selectedTenantIds = rootState.aiAccountantViewState.selectedTenantIdsForJobTrigger;
10
- const base = `${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/cockpit-panels`;
11
- const url = `${base}/ai-accountant/jobs`;
12
- return zeniAPI
13
- .postAndGetJSON(url, {
14
- tenant_ids: selectedTenantIds,
15
- operation_type: operationType,
16
- params: {
17
- start_date: startDate,
18
- end_date: endDate,
19
- },
20
- })
21
- .pipe(mergeMap((response) => {
22
- if (isSuccessResponse(response)) {
23
- return from([
24
- triggerAiAccountantJobSuccess(),
25
- fetchAiAccountantCustomers(),
26
- openSnackbar({
27
- messageSection: 'common',
28
- messageText: 'success',
29
- type: 'success',
30
- }),
31
- ]);
32
- }
33
- else {
34
- return from([
35
- triggerAiAccountantJobFailure(response.status),
36
- openSnackbar({
37
- messageSection: 'common',
38
- messageText: 'failed',
39
- type: 'error',
40
- }),
41
- ]);
42
- }
43
- }), catchError((error) => from([
44
- triggerAiAccountantJobFailure(createZeniAPIStatus('Unexpected error', 'AI Accountant trigger job failed: ' +
45
- JSON.stringify(error))),
46
- openSnackbar({
47
- messageSection: 'common',
48
- messageText: 'failed',
49
- type: 'error',
50
- }),
51
- ])));
52
- }));