@zeniai/client-epic-state 5.0.2-betaRD2 → 5.0.2-betaRR02

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 (115) 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 +2 -2
  7. package/lib/entity/snackbar/snackbarTypes.js +2 -0
  8. package/lib/entity/task/taskPayload.d.ts +3 -0
  9. package/lib/entity/task/taskPayload.js +5 -0
  10. package/lib/entity/task/taskState.d.ts +3 -0
  11. package/lib/entity/tenant/clearAllEpic.d.ts +1 -3
  12. package/lib/entity/tenant/clearAllEpic.js +0 -4
  13. package/lib/entity/transaction/payloadTypes/transactionPayload.js +21 -0
  14. package/lib/entity/userRole/userRoleType.d.ts +2 -2
  15. package/lib/epic.d.ts +3 -5
  16. package/lib/epic.js +3 -5
  17. package/lib/esm/entity/snackbar/snackbarTypes.js +2 -0
  18. package/lib/esm/entity/task/taskPayload.js +5 -0
  19. package/lib/esm/entity/tenant/clearAllEpic.js +0 -4
  20. package/lib/esm/entity/transaction/payloadTypes/transactionPayload.js +21 -0
  21. package/lib/esm/epic.js +3 -5
  22. package/lib/esm/index.js +4 -11
  23. package/lib/esm/reducer.js +0 -6
  24. package/lib/esm/view/taskManager/taskDetailView/epics/archiveTaskEpic.js +3 -0
  25. package/lib/esm/view/taskManager/taskDetailView/epics/deleteTaskEpic.js +5 -0
  26. package/lib/esm/view/taskManager/taskDetailView/epics/snoozeTaskEpic.js +65 -0
  27. package/lib/esm/view/taskManager/taskDetailView/epics/unsnoozeTaskEpic.js +56 -0
  28. package/lib/esm/view/taskManager/taskDetailView/taskDetail.js +4 -0
  29. package/lib/esm/view/taskManager/taskDetailView/taskDetailReducer.js +49 -1
  30. package/lib/esm/view/taskManager/taskDetailView/taskDetailSelector.js +9 -0
  31. package/lib/esm/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.js +56 -21
  32. package/lib/esm/view/taskManager/taskListView/epics/dragNDropTasksEpic.js +1 -0
  33. package/lib/esm/view/taskManager/taskListView/epics/fetchTaskListEpic.js +13 -3
  34. package/lib/esm/view/taskManager/taskListView/taskList.js +7 -0
  35. package/lib/esm/view/taskManager/taskListView/taskListReducer.js +91 -12
  36. package/lib/esm/view/taskManager/taskListView/taskListSelector.js +22 -6
  37. package/lib/index.d.ts +4 -13
  38. package/lib/index.js +9 -31
  39. package/lib/reducer.d.ts +0 -6
  40. package/lib/reducer.js +0 -6
  41. package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
  42. package/lib/view/companyView/types/cockpitTypes.d.ts +5 -6
  43. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +2 -2
  44. package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +1 -1
  45. package/lib/view/onboardingView/cockpitView/types/onboardingCockpitViewTypes.d.ts +1 -1
  46. package/lib/view/reviewCompanyView/reviewCompanyViewState.d.ts +1 -1
  47. package/lib/view/spendManagement/billPay/billList/billListReducer.d.ts +1 -1
  48. package/lib/view/spendManagement/billPay/billList/billListState.d.ts +1 -1
  49. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetail.d.ts +1 -1
  50. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.d.ts +4 -4
  51. package/lib/view/spendManagement/reimbursement/remiListView/remiListReducer.d.ts +1 -1
  52. package/lib/view/spendManagement/reimbursement/remiListView/remiListState.d.ts +3 -3
  53. package/lib/view/subscriptionView/types/subscriptionTypes.d.ts +1 -1
  54. package/lib/view/taskManager/taskDetailView/epics/archiveTaskEpic.d.ts +2 -1
  55. package/lib/view/taskManager/taskDetailView/epics/archiveTaskEpic.js +3 -0
  56. package/lib/view/taskManager/taskDetailView/epics/deleteTaskEpic.d.ts +2 -1
  57. package/lib/view/taskManager/taskDetailView/epics/deleteTaskEpic.js +5 -0
  58. package/lib/view/taskManager/taskDetailView/epics/snoozeTaskEpic.d.ts +9 -0
  59. package/lib/view/taskManager/taskDetailView/epics/snoozeTaskEpic.js +69 -0
  60. package/lib/view/taskManager/taskDetailView/epics/unsnoozeTaskEpic.d.ts +9 -0
  61. package/lib/view/taskManager/taskDetailView/epics/unsnoozeTaskEpic.js +60 -0
  62. package/lib/view/taskManager/taskDetailView/taskDetail.d.ts +1 -0
  63. package/lib/view/taskManager/taskDetailView/taskDetail.js +4 -0
  64. package/lib/view/taskManager/taskDetailView/taskDetailReducer.d.ts +10 -1
  65. package/lib/view/taskManager/taskDetailView/taskDetailReducer.js +50 -2
  66. package/lib/view/taskManager/taskDetailView/taskDetailSelector.d.ts +4 -0
  67. package/lib/view/taskManager/taskDetailView/taskDetailSelector.js +9 -0
  68. package/lib/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.d.ts +6 -7
  69. package/lib/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.js +56 -22
  70. package/lib/view/taskManager/taskListView/epics/dragNDropTasksEpic.js +1 -0
  71. package/lib/view/taskManager/taskListView/epics/fetchTaskListEpic.js +13 -3
  72. package/lib/view/taskManager/taskListView/taskList.d.ts +14 -1
  73. package/lib/view/taskManager/taskListView/taskList.js +8 -1
  74. package/lib/view/taskManager/taskListView/taskListPayload.d.ts +3 -0
  75. package/lib/view/taskManager/taskListView/taskListReducer.d.ts +6 -2
  76. package/lib/view/taskManager/taskListView/taskListReducer.js +92 -13
  77. package/lib/view/taskManager/taskListView/taskListSelector.d.ts +3 -1
  78. package/lib/view/taskManager/taskListView/taskListSelector.js +22 -6
  79. package/package.json +1 -1
  80. package/lib/entity/aiAccountantCustomer/aiAccountantCustomerPayload.d.ts +0 -44
  81. package/lib/entity/aiAccountantCustomer/aiAccountantCustomerPayload.js +0 -55
  82. package/lib/entity/aiAccountantCustomer/aiAccountantCustomerReducer.d.ts +0 -10
  83. package/lib/entity/aiAccountantCustomer/aiAccountantCustomerReducer.js +0 -51
  84. package/lib/entity/aiAccountantCustomer/aiAccountantCustomerSelector.d.ts +0 -48
  85. package/lib/entity/aiAccountantCustomer/aiAccountantCustomerSelector.js +0 -66
  86. package/lib/entity/aiAccountantCustomer/aiAccountantCustomerState.d.ts +0 -52
  87. package/lib/entity/aiAccountantCustomer/aiAccountantCustomerState.js +0 -37
  88. package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerPayload.js +0 -49
  89. package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerReducer.js +0 -47
  90. package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerSelector.js +0 -62
  91. package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerState.js +0 -31
  92. package/lib/esm/view/aiAccountantView/aiAccountantViewPayload.js +0 -2
  93. package/lib/esm/view/aiAccountantView/aiAccountantViewReducer.js +0 -149
  94. package/lib/esm/view/aiAccountantView/aiAccountantViewSelector.js +0 -72
  95. package/lib/esm/view/aiAccountantView/aiAccountantViewState.js +0 -11
  96. package/lib/esm/view/aiAccountantView/epics/cancelAiAccountantOnboardingEpic.js +0 -46
  97. package/lib/esm/view/aiAccountantView/epics/fetchAiAccountantCustomersEpic.js +0 -27
  98. package/lib/esm/view/aiAccountantView/epics/fetchAiAccountantJobsEpic.js +0 -47
  99. package/lib/esm/view/aiAccountantView/epics/triggerAiAccountantJobEpic.js +0 -52
  100. package/lib/view/aiAccountantView/aiAccountantViewPayload.d.ts +0 -31
  101. package/lib/view/aiAccountantView/aiAccountantViewPayload.js +0 -8
  102. package/lib/view/aiAccountantView/aiAccountantViewReducer.d.ts +0 -29
  103. package/lib/view/aiAccountantView/aiAccountantViewReducer.js +0 -153
  104. package/lib/view/aiAccountantView/aiAccountantViewSelector.d.ts +0 -14
  105. package/lib/view/aiAccountantView/aiAccountantViewSelector.js +0 -78
  106. package/lib/view/aiAccountantView/aiAccountantViewState.d.ts +0 -26
  107. package/lib/view/aiAccountantView/aiAccountantViewState.js +0 -13
  108. package/lib/view/aiAccountantView/epics/cancelAiAccountantOnboardingEpic.d.ts +0 -33
  109. package/lib/view/aiAccountantView/epics/cancelAiAccountantOnboardingEpic.js +0 -50
  110. package/lib/view/aiAccountantView/epics/fetchAiAccountantCustomersEpic.d.ts +0 -23
  111. package/lib/view/aiAccountantView/epics/fetchAiAccountantCustomersEpic.js +0 -31
  112. package/lib/view/aiAccountantView/epics/fetchAiAccountantJobsEpic.d.ts +0 -33
  113. package/lib/view/aiAccountantView/epics/fetchAiAccountantJobsEpic.js +0 -51
  114. package/lib/view/aiAccountantView/epics/triggerAiAccountantJobEpic.d.ts +0 -28
  115. package/lib/view/aiAccountantView/epics/triggerAiAccountantJobEpic.js +0 -56
@@ -1,33 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
3
- import { RootState } from '../../../reducer';
4
- import { ZeniAPI } from '../../../zeniAPI';
5
- import { cancelAiAccountantOnboarding, cancelAiAccountantOnboardingFailure, cancelAiAccountantOnboardingSuccess, fetchAiAccountantCustomers } from '../aiAccountantViewReducer';
6
- export type ActionType = ReturnType<typeof cancelAiAccountantOnboarding> | ReturnType<typeof cancelAiAccountantOnboardingSuccess> | ReturnType<typeof cancelAiAccountantOnboardingFailure> | ReturnType<typeof fetchAiAccountantCustomers> | ReturnType<typeof openSnackbar>;
7
- export declare const cancelAiAccountantOnboardingEpic: (actions$: ActionsObservable<ActionType>, _: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
8
- payload: {
9
- messageSection: import("../../..").SnackbarMessageSections;
10
- messageText: import("../../..").SnackbarMessageSectionTexts;
11
- type: import("../../..").SnackbarMessageType;
12
- showStatusIcon?: boolean;
13
- variables?: {
14
- variableName: string;
15
- variableValue: string;
16
- }[];
17
- };
18
- type: "snackbar/openSnackbar";
19
- } | {
20
- payload: {
21
- tenantId: string;
22
- };
23
- type: "aiAccountantView/cancelAiAccountantOnboardingSuccess";
24
- } | {
25
- payload: {
26
- tenantId: string;
27
- error: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>>;
28
- };
29
- type: "aiAccountantView/cancelAiAccountantOnboardingFailure";
30
- } | {
31
- payload: undefined;
32
- type: "aiAccountantView/fetchAiAccountantCustomers";
33
- }>;
@@ -1,50 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.cancelAiAccountantOnboardingEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
7
- const responsePayload_1 = require("../../../responsePayload");
8
- const aiAccountantViewReducer_1 = require("../aiAccountantViewReducer");
9
- const cancelAiAccountantOnboardingEpic = (actions$, _, zeniAPI) => actions$.pipe((0, operators_1.filter)(aiAccountantViewReducer_1.cancelAiAccountantOnboarding.match), (0, operators_1.mergeMap)((action) => {
10
- const { tenantId, companyId } = action.payload;
11
- const base = `${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/cockpit-panels`;
12
- const url = `${base}/ai-accountant/cancel-onboarding`;
13
- return zeniAPI
14
- .postAndGetJSON(url, {
15
- tenant_id: tenantId,
16
- company_id: companyId,
17
- })
18
- .pipe((0, operators_1.mergeMap)((response) => {
19
- if ((0, responsePayload_1.isSuccessResponse)(response)) {
20
- return (0, rxjs_1.from)([
21
- (0, aiAccountantViewReducer_1.cancelAiAccountantOnboardingSuccess)(tenantId),
22
- (0, aiAccountantViewReducer_1.fetchAiAccountantCustomers)(),
23
- (0, snackbarReducer_1.openSnackbar)({
24
- messageSection: 'common',
25
- messageText: 'success',
26
- type: 'success',
27
- }),
28
- ]);
29
- }
30
- else {
31
- return (0, rxjs_1.from)([
32
- (0, aiAccountantViewReducer_1.cancelAiAccountantOnboardingFailure)(tenantId, response.status),
33
- (0, snackbarReducer_1.openSnackbar)({
34
- messageSection: 'common',
35
- messageText: 'failed',
36
- type: 'error',
37
- }),
38
- ]);
39
- }
40
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
41
- (0, aiAccountantViewReducer_1.cancelAiAccountantOnboardingFailure)(tenantId, (0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'AI Accountant cancel onboarding failed: ' +
42
- JSON.stringify(error))),
43
- (0, snackbarReducer_1.openSnackbar)({
44
- messageSection: 'common',
45
- messageText: 'failed',
46
- type: 'error',
47
- }),
48
- ])));
49
- }));
50
- exports.cancelAiAccountantOnboardingEpic = cancelAiAccountantOnboardingEpic;
@@ -1,23 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { updateAiAccountantCustomers as updateAiAccountantCustomerEntities } from '../../../entity/aiAccountantCustomer/aiAccountantCustomerReducer';
3
- import { updateAllUsers } from '../../../entity/user/userReducer';
4
- import { RootState } from '../../../reducer';
5
- import { ZeniAPI } from '../../../zeniAPI';
6
- import { fetchAiAccountantCustomers, updateAiAccountantCustomers, updateAiAccountantCustomersFailure } from '../aiAccountantViewReducer';
7
- export type ActionType = ReturnType<typeof fetchAiAccountantCustomers> | ReturnType<typeof updateAiAccountantCustomers> | ReturnType<typeof updateAiAccountantCustomersFailure> | ReturnType<typeof updateAiAccountantCustomerEntities> | ReturnType<typeof updateAllUsers>;
8
- export declare const fetchAiAccountantCustomersEpic: (actions$: ActionsObservable<ActionType>, _: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
9
- payload: {
10
- users: import("../../..").UserPayload[];
11
- updateType?: import("../../..").UpdateType;
12
- };
13
- type: "user/updateAllUsers";
14
- } | {
15
- payload: import("../aiAccountantViewPayload").AiAccountantCustomerPayload[];
16
- type: "aiAccountantView/updateAiAccountantCustomers";
17
- } | {
18
- payload: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>>;
19
- type: "aiAccountantView/updateAiAccountantCustomersFailure";
20
- } | {
21
- payload: import("../aiAccountantViewPayload").AiAccountantCustomerPayload[];
22
- type: "aiAccountantCustomer/updateAiAccountantCustomers";
23
- }>;
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fetchAiAccountantCustomersEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const aiAccountantCustomerReducer_1 = require("../../../entity/aiAccountantCustomer/aiAccountantCustomerReducer");
7
- const userReducer_1 = require("../../../entity/user/userReducer");
8
- const responsePayload_1 = require("../../../responsePayload");
9
- const aiAccountantViewReducer_1 = require("../aiAccountantViewReducer");
10
- const fetchAiAccountantCustomersEpic = (actions$, _, zeniAPI) => actions$.pipe((0, operators_1.filter)(aiAccountantViewReducer_1.fetchAiAccountantCustomers.match), (0, operators_1.switchMap)(() => {
11
- const base = `${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/cockpit-panels`;
12
- const url = `${base}/ai-accountant/customers`;
13
- return zeniAPI
14
- .getJSON(url)
15
- .pipe((0, operators_1.mergeMap)((response) => {
16
- if ((0, responsePayload_1.isSuccessResponse)(response)) {
17
- const customers = response.data?.customers ?? [];
18
- const users = response.data?.users ?? [];
19
- return (0, rxjs_1.from)([
20
- (0, aiAccountantCustomerReducer_1.updateAiAccountantCustomers)(customers),
21
- (0, userReducer_1.updateAllUsers)({ users }),
22
- (0, aiAccountantViewReducer_1.updateAiAccountantCustomers)(customers),
23
- ]);
24
- }
25
- else {
26
- return (0, rxjs_1.of)((0, aiAccountantViewReducer_1.updateAiAccountantCustomersFailure)(response.status));
27
- }
28
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, aiAccountantViewReducer_1.updateAiAccountantCustomersFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'AI Accountant customers fetch failed: ' +
29
- JSON.stringify(error))))));
30
- }));
31
- exports.fetchAiAccountantCustomersEpic = fetchAiAccountantCustomersEpic;
@@ -1,33 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { updateAiAccountantJobs as updateAiAccountantJobEntities } from '../../../entity/aiAccountantCustomer/aiAccountantCustomerReducer';
3
- import { updateAllUsers } from '../../../entity/user/userReducer';
4
- import { RootState } from '../../../reducer';
5
- import { ZeniAPI } from '../../../zeniAPI';
6
- import { fetchAiAccountantJobs, updateAiAccountantJobs, updateAiAccountantJobsFailure } from '../aiAccountantViewReducer';
7
- export type ActionType = ReturnType<typeof fetchAiAccountantJobs> | ReturnType<typeof updateAiAccountantJobs> | ReturnType<typeof updateAiAccountantJobEntities> | ReturnType<typeof updateAiAccountantJobsFailure> | ReturnType<typeof updateAllUsers>;
8
- export declare const fetchAiAccountantJobsEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
9
- payload: {
10
- users: import("../../..").UserPayload[];
11
- updateType?: import("../../..").UpdateType;
12
- };
13
- type: "user/updateAllUsers";
14
- } | {
15
- payload: {
16
- tenantId: string;
17
- nextPageToken: string | null;
18
- };
19
- type: "aiAccountantView/updateAiAccountantJobs";
20
- } | {
21
- payload: {
22
- tenantId: string;
23
- jobs: import("../aiAccountantViewPayload").AiAccountantJobPayload[];
24
- append: boolean;
25
- };
26
- type: "aiAccountantCustomer/updateAiAccountantJobs";
27
- } | {
28
- payload: {
29
- error: import("../../../responsePayload").ZeniAPIStatus;
30
- tenantId: import("../../..").ID;
31
- };
32
- type: "aiAccountantView/updateAiAccountantJobsFailure";
33
- }>;
@@ -1,51 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fetchAiAccountantJobsEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const aiAccountantCustomerReducer_1 = require("../../../entity/aiAccountantCustomer/aiAccountantCustomerReducer");
7
- const userReducer_1 = require("../../../entity/user/userReducer");
8
- const responsePayload_1 = require("../../../responsePayload");
9
- const aiAccountantViewReducer_1 = require("../aiAccountantViewReducer");
10
- const fetchAiAccountantJobsEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(aiAccountantViewReducer_1.fetchAiAccountantJobs.match), (0, operators_1.switchMap)((action) => {
11
- const { tenantId, fetchNextPage } = action.payload;
12
- const rootState = state$.value;
13
- const customerView = rootState.aiAccountantViewState.customersByTenantId[tenantId];
14
- const pageToken = fetchNextPage && customerView?.jobsPageToken != null
15
- ? customerView.jobsPageToken
16
- : null;
17
- const params = new URLSearchParams({
18
- page_size: '50',
19
- tenant_id: tenantId,
20
- });
21
- if (pageToken != null) {
22
- params.set('page_token', pageToken);
23
- }
24
- const base = `${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/cockpit-panels`;
25
- const url = `${base}/ai-accountant/jobs?${params.toString()}`;
26
- return zeniAPI
27
- .getJSON(url)
28
- .pipe((0, operators_1.mergeMap)((response) => {
29
- if ((0, responsePayload_1.isSuccessResponse)(response)) {
30
- const jobs = response.data?.jobs ?? [];
31
- const users = response.data?.users ?? [];
32
- const nextPageToken = response.data?.next_page_token ?? null;
33
- return (0, rxjs_1.from)([
34
- (0, userReducer_1.updateAllUsers)({ users }),
35
- (0, aiAccountantCustomerReducer_1.updateAiAccountantJobs)(tenantId, jobs, fetchNextPage),
36
- (0, aiAccountantViewReducer_1.updateAiAccountantJobs)(tenantId, nextPageToken),
37
- ]);
38
- }
39
- else {
40
- return (0, rxjs_1.of)((0, aiAccountantViewReducer_1.updateAiAccountantJobsFailure)({
41
- tenantId,
42
- error: response.status,
43
- }));
44
- }
45
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, aiAccountantViewReducer_1.updateAiAccountantJobsFailure)({
46
- tenantId,
47
- error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'AI Accountant jobs fetch failed: ' +
48
- JSON.stringify(error)),
49
- }))));
50
- }));
51
- exports.fetchAiAccountantJobsEpic = fetchAiAccountantJobsEpic;
@@ -1,28 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
3
- import { RootState } from '../../../reducer';
4
- import { ZeniAPI } from '../../../zeniAPI';
5
- import { fetchAiAccountantCustomers, triggerAiAccountantJob, triggerAiAccountantJobFailure, triggerAiAccountantJobSuccess } from '../aiAccountantViewReducer';
6
- export type ActionType = ReturnType<typeof triggerAiAccountantJob> | ReturnType<typeof triggerAiAccountantJobSuccess> | ReturnType<typeof triggerAiAccountantJobFailure> | ReturnType<typeof fetchAiAccountantCustomers> | ReturnType<typeof openSnackbar>;
7
- export declare const triggerAiAccountantJobEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
8
- payload: {
9
- messageSection: import("../../..").SnackbarMessageSections;
10
- messageText: import("../../..").SnackbarMessageSectionTexts;
11
- type: import("../../..").SnackbarMessageType;
12
- showStatusIcon?: boolean;
13
- variables?: {
14
- variableName: string;
15
- variableValue: string;
16
- }[];
17
- };
18
- type: "snackbar/openSnackbar";
19
- } | {
20
- payload: undefined;
21
- type: "aiAccountantView/fetchAiAccountantCustomers";
22
- } | {
23
- payload: undefined;
24
- type: "aiAccountantView/triggerAiAccountantJobSuccess";
25
- } | {
26
- payload: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>>;
27
- type: "aiAccountantView/triggerAiAccountantJobFailure";
28
- }>;
@@ -1,56 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.triggerAiAccountantJobEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
7
- const responsePayload_1 = require("../../../responsePayload");
8
- const aiAccountantViewReducer_1 = require("../aiAccountantViewReducer");
9
- const triggerAiAccountantJobEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(aiAccountantViewReducer_1.triggerAiAccountantJob.match), (0, operators_1.mergeMap)((action) => {
10
- const { operationType, startDate, endDate } = action.payload;
11
- const rootState = state$.value;
12
- const selectedTenantIds = rootState.aiAccountantViewState.selectedTenantIdsForJobTrigger;
13
- const base = `${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/cockpit-panels`;
14
- const url = `${base}/ai-accountant/jobs`;
15
- const params = operationType === 'offboard'
16
- ? {}
17
- : { start_date: startDate, end_date: endDate };
18
- return zeniAPI
19
- .postAndGetJSON(url, {
20
- tenant_ids: selectedTenantIds,
21
- operation_type: operationType,
22
- params,
23
- })
24
- .pipe((0, operators_1.mergeMap)((response) => {
25
- if ((0, responsePayload_1.isSuccessResponse)(response)) {
26
- return (0, rxjs_1.from)([
27
- (0, aiAccountantViewReducer_1.triggerAiAccountantJobSuccess)(),
28
- (0, aiAccountantViewReducer_1.fetchAiAccountantCustomers)(),
29
- (0, snackbarReducer_1.openSnackbar)({
30
- messageSection: 'common',
31
- messageText: 'success',
32
- type: 'success',
33
- }),
34
- ]);
35
- }
36
- else {
37
- return (0, rxjs_1.from)([
38
- (0, aiAccountantViewReducer_1.triggerAiAccountantJobFailure)(response.status),
39
- (0, snackbarReducer_1.openSnackbar)({
40
- messageSection: 'common',
41
- messageText: 'failed',
42
- type: 'error',
43
- }),
44
- ]);
45
- }
46
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
47
- (0, aiAccountantViewReducer_1.triggerAiAccountantJobFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'AI Accountant trigger job failed: ' +
48
- JSON.stringify(error))),
49
- (0, snackbarReducer_1.openSnackbar)({
50
- messageSection: 'common',
51
- messageText: 'failed',
52
- type: 'error',
53
- }),
54
- ])));
55
- }));
56
- exports.triggerAiAccountantJobEpic = triggerAiAccountantJobEpic;