@zeniai/client-epic-state 5.0.90 → 5.0.92-beta0ND

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 (100) hide show
  1. package/lib/commonStateTypes/animations.d.ts +1 -1
  2. package/lib/commonStateTypes/animations.js +1 -0
  3. package/lib/entity/company/companyPayload.d.ts +4 -0
  4. package/lib/entity/company/companyPayload.js +4 -0
  5. package/lib/entity/company/companyStateTypes.d.ts +4 -0
  6. package/lib/entity/paymentAccount/paymentAccountSelector.d.ts +1 -0
  7. package/lib/entity/paymentAccount/paymentAccountSelector.js +4 -0
  8. package/lib/entity/task/taskPayload.d.ts +3 -1
  9. package/lib/entity/task/taskPayload.js +2 -0
  10. package/lib/entity/task/taskState.d.ts +2 -0
  11. package/lib/entity/tenant/epic/deleteConnectionEpic.d.ts +1 -1
  12. package/lib/entity/tenant/epic/initEmailConnectOAuthEpic.d.ts +21 -0
  13. package/lib/entity/tenant/epic/initEmailConnectOAuthEpic.js +54 -0
  14. package/lib/entity/tenant/epic/saveAPIKeyConnectionEpic.d.ts +1 -1
  15. package/lib/entity/tenant/epic/saveConnectorCredentialsEpic.d.ts +3 -3
  16. package/lib/entity/tenant/epic/saveOAuthConnectionEpic.d.ts +1 -1
  17. package/lib/entity/tenant/tenantPayload.d.ts +1 -0
  18. package/lib/entity/tenant/tenantReducer.d.ts +38 -25
  19. package/lib/entity/tenant/tenantReducer.js +65 -5
  20. package/lib/entity/tenant/tenantState.d.ts +1 -0
  21. package/lib/epic.d.ts +10 -3
  22. package/lib/epic.js +11 -3
  23. package/lib/esm/commonStateTypes/animations.js +1 -0
  24. package/lib/esm/entity/company/companyPayload.js +4 -0
  25. package/lib/esm/entity/paymentAccount/paymentAccountSelector.js +3 -0
  26. package/lib/esm/entity/task/taskPayload.js +2 -0
  27. package/lib/esm/entity/tenant/epic/initEmailConnectOAuthEpic.js +50 -0
  28. package/lib/esm/entity/tenant/tenantReducer.js +63 -3
  29. package/lib/esm/epic.js +11 -3
  30. package/lib/esm/index.js +12 -9
  31. package/lib/esm/view/companyTaskManagerView/companyTaskManagerViewReducer.js +39 -11
  32. package/lib/esm/view/companyTaskManagerView/companyTaskManagerViewSelector.js +14 -4
  33. package/lib/esm/view/companyTaskManagerView/epics/fetchCockpitContextEpic.js +38 -0
  34. package/lib/esm/view/companyTaskManagerView/epics/fetchCompanyTaskManagerViewEpic.js +37 -28
  35. package/lib/esm/view/companyTaskManagerView/epics/updateCompanyTaskManagerViewFiltersEpic.js +16 -0
  36. package/lib/esm/view/companyView/epic/fetchAllCockpitViewsEpic.js +2 -2
  37. package/lib/esm/view/fileView/epic/deleteFileEpic.js +2 -2
  38. package/lib/esm/view/fileView/epic/deleteFileListEpic.js +2 -2
  39. package/lib/esm/view/fileView/epic/updateFileNameEpic.js +2 -2
  40. package/lib/esm/view/onboardingView/customerView/epic/aiAgentsActivation/fetchAiAgentsActivationStatusEpic.js +42 -0
  41. package/lib/esm/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiActivationViewedEpic.js +29 -0
  42. package/lib/esm/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiFinanceTeamEpic.js +40 -0
  43. package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewReducer.js +217 -50
  44. package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewSelector.js +7 -1
  45. package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewState.js +12 -0
  46. package/lib/esm/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.js +52 -0
  47. package/lib/esm/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.js +59 -0
  48. package/lib/esm/view/spendManagement/commonSetup/kycKybAutofillActions.js +14 -0
  49. package/lib/esm/view/spendManagement/commonSetup/kycKybParseMapper.js +205 -0
  50. package/lib/esm/view/spendManagement/commonSetup/setupViewReducer.js +105 -52
  51. package/lib/esm/view/spendManagement/commonSetup/setupViewSelector.js +6 -1
  52. package/lib/esm/view/spendManagement/commonSetup/types/kycKybAutofill.js +28 -0
  53. package/lib/index.d.ts +17 -12
  54. package/lib/index.js +53 -31
  55. package/lib/view/companyTaskManagerView/companyTaskManagerViewPayload.d.ts +19 -11
  56. package/lib/view/companyTaskManagerView/companyTaskManagerViewReducer.d.ts +10 -4
  57. package/lib/view/companyTaskManagerView/companyTaskManagerViewReducer.js +40 -12
  58. package/lib/view/companyTaskManagerView/companyTaskManagerViewSelector.d.ts +2 -0
  59. package/lib/view/companyTaskManagerView/companyTaskManagerViewSelector.js +13 -3
  60. package/lib/view/companyTaskManagerView/companyTaskManagerViewState.d.ts +11 -3
  61. package/lib/view/companyTaskManagerView/epics/fetchCockpitContextEpic.d.ts +10 -0
  62. package/lib/view/companyTaskManagerView/epics/fetchCockpitContextEpic.js +42 -0
  63. package/lib/view/companyTaskManagerView/epics/fetchCompanyTaskManagerViewEpic.d.ts +1 -3
  64. package/lib/view/companyTaskManagerView/epics/fetchCompanyTaskManagerViewEpic.js +37 -28
  65. package/lib/view/companyTaskManagerView/epics/updateCompanyTaskManagerViewFiltersEpic.d.ts +6 -0
  66. package/lib/view/companyTaskManagerView/epics/updateCompanyTaskManagerViewFiltersEpic.js +20 -0
  67. package/lib/view/companyView/epic/fetchAllCockpitViewsEpic.js +2 -2
  68. package/lib/view/companyView/types/cockpitTypes.d.ts +2 -1
  69. package/lib/view/fileView/epic/deleteFileEpic.js +1 -1
  70. package/lib/view/fileView/epic/deleteFileListEpic.js +1 -1
  71. package/lib/view/fileView/epic/updateFileNameEpic.js +1 -1
  72. package/lib/view/onboardingView/customerView/epic/aiAgentsActivation/fetchAiAgentsActivationStatusEpic.d.ts +7 -0
  73. package/lib/view/onboardingView/customerView/epic/aiAgentsActivation/fetchAiAgentsActivationStatusEpic.js +46 -0
  74. package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiActivationViewedEpic.d.ts +8 -0
  75. package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiActivationViewedEpic.js +33 -0
  76. package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiFinanceTeamEpic.d.ts +9 -0
  77. package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiFinanceTeamEpic.js +44 -0
  78. package/lib/view/onboardingView/customerView/onboardingCustomerViewPayload.d.ts +3 -0
  79. package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.d.ts +41 -4
  80. package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.js +219 -51
  81. package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.d.ts +5 -1
  82. package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.js +11 -2
  83. package/lib/view/onboardingView/customerView/onboardingCustomerViewState.d.ts +40 -0
  84. package/lib/view/onboardingView/customerView/onboardingCustomerViewState.js +13 -1
  85. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.d.ts +28 -0
  86. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.js +56 -0
  87. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.d.ts +30 -0
  88. package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.js +63 -0
  89. package/lib/view/spendManagement/commonSetup/kycKybAutofillActions.d.ts +33 -0
  90. package/lib/view/spendManagement/commonSetup/kycKybAutofillActions.js +17 -0
  91. package/lib/view/spendManagement/commonSetup/kycKybParseMapper.d.ts +24 -0
  92. package/lib/view/spendManagement/commonSetup/kycKybParseMapper.js +213 -0
  93. package/lib/view/spendManagement/commonSetup/setupViewReducer.d.ts +28 -2
  94. package/lib/view/spendManagement/commonSetup/setupViewReducer.js +106 -53
  95. package/lib/view/spendManagement/commonSetup/setupViewSelector.d.ts +7 -2
  96. package/lib/view/spendManagement/commonSetup/setupViewSelector.js +6 -1
  97. package/lib/view/spendManagement/commonSetup/setupViewState.d.ts +19 -0
  98. package/lib/view/spendManagement/commonSetup/types/kycKybAutofill.d.ts +125 -0
  99. package/lib/view/spendManagement/commonSetup/types/kycKybAutofill.js +32 -0
  100. package/package.json +1 -1
@@ -1,13 +1,14 @@
1
1
  "use strict";
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.clearCompanyTaskManagerView = exports.updateTaskManagerMetricsOnFailure = exports.updateTaskManagerMetrics = exports.fetchTaskManagerMetrics = exports.updateCompanyTaskManagerViewOnFailure = exports.updateCompanyTaskManagerViewOnSuccess = exports.fetchCompanyTaskManagerView = exports.initialState = exports.initialUIState = void 0;
4
+ exports.updateCockpitContextOnFailure = exports.updateCockpitContextOnSuccess = exports.fetchCockpitContext = exports.updateCompanyTaskManagerViewFilters = exports.clearCompanyTaskManagerView = exports.updateTaskManagerMetricsOnFailure = exports.updateTaskManagerMetrics = exports.fetchTaskManagerMetrics = exports.updateCompanyTaskManagerViewOnFailure = exports.updateCompanyTaskManagerViewOnSuccess = exports.fetchCompanyTaskManagerView = exports.initialState = exports.initialUIState = void 0;
5
5
  const toolkit_1 = require("@reduxjs/toolkit");
6
6
  exports.initialUIState = {
7
7
  filterText: '',
8
8
  sortKey: 'dueDate',
9
9
  sortOrder: 'descending',
10
- pageToken: null,
10
+ from: 0,
11
+ filters: {},
11
12
  };
12
13
  const initialMetrics = {
13
14
  closed: 0,
@@ -22,6 +23,13 @@ exports.initialState = {
22
23
  metrics: initialMetrics,
23
24
  metricsFetchState: 'Not-Started',
24
25
  uiState: exports.initialUIState,
26
+ cockpitContext: {
27
+ fetchState: 'Not-Started',
28
+ error: undefined,
29
+ companyIds: [],
30
+ userIds: [],
31
+ userGroupIds: [],
32
+ },
25
33
  hasValidState() {
26
34
  return this.fetchState == 'Completed';
27
35
  },
@@ -32,10 +40,11 @@ const companyTaskManagerView = (0, toolkit_1.createSlice)({
32
40
  initialState: exports.initialState,
33
41
  reducers: {
34
42
  fetchCompanyTaskManagerView: {
35
- prepare(pageToken, sortKey, sortOrder, keepExistingListItems = true, searchString) {
43
+ prepare(from, sortKey, sortOrder, keepExistingListItems = true, searchString, filters) {
36
44
  return {
37
45
  payload: {
38
- pageToken,
46
+ from,
47
+ filters,
39
48
  searchString,
40
49
  sortKey,
41
50
  sortOrder,
@@ -44,10 +53,10 @@ const companyTaskManagerView = (0, toolkit_1.createSlice)({
44
53
  };
45
54
  },
46
55
  reducer(draft, action) {
47
- const { pageToken, searchString, sortKey, sortOrder, keepExistingListItems, } = action.payload;
56
+ const { from, searchString, sortKey, sortOrder, keepExistingListItems } = action.payload;
48
57
  draft.uiState.sortKey = sortKey;
49
58
  draft.uiState.sortOrder = sortOrder;
50
- draft.uiState.pageToken = pageToken;
59
+ draft.uiState.from = from;
51
60
  if (keepExistingListItems === false) {
52
61
  draft.taskIds = [];
53
62
  }
@@ -60,15 +69,14 @@ const companyTaskManagerView = (0, toolkit_1.createSlice)({
60
69
  },
61
70
  updateCompanyTaskManagerViewOnSuccess(draft, action) {
62
71
  const { data } = action.payload;
63
- const { tasks, query, total_count } = data;
72
+ const tasks = data.aggregations.group_by_company_name.buckets.flatMap((bucket) => bucket.tasks);
64
73
  draft.fetchState = 'Completed';
65
74
  draft.error = undefined;
66
75
  draft.taskIds = [...draft.taskIds, ...tasks.map((task) => task.task_id)];
67
- // consider total count only when fetching for first time
68
- if (draft.uiState.filterText === '' && draft.uiState.pageToken == null) {
69
- draft.totalTaskCount = total_count;
76
+ if (draft.uiState.filterText === '' && draft.uiState.from === 0) {
77
+ draft.totalTaskCount = data.total;
70
78
  }
71
- draft.uiState.pageToken = query.page_token;
79
+ draft.uiState.from = data.from + data.limit;
72
80
  },
73
81
  updateCompanyTaskManagerViewOnFailure: {
74
82
  reducer(draft, action) {
@@ -89,10 +97,30 @@ const companyTaskManagerView = (0, toolkit_1.createSlice)({
89
97
  updateTaskManagerMetricsOnFailure(draft) {
90
98
  draft.metricsFetchState = 'Error';
91
99
  },
100
+ updateCompanyTaskManagerViewFilters(draft, action) {
101
+ if (action.payload.filters != null) {
102
+ draft.uiState.filters = action.payload.filters;
103
+ }
104
+ },
105
+ fetchCockpitContext(draft) {
106
+ draft.cockpitContext.fetchState = 'In-Progress';
107
+ draft.cockpitContext.error = undefined;
108
+ },
109
+ updateCockpitContextOnSuccess(draft, action) {
110
+ draft.cockpitContext.fetchState = 'Completed';
111
+ draft.cockpitContext.error = undefined;
112
+ draft.cockpitContext.companyIds = action.payload.companyIds;
113
+ draft.cockpitContext.userIds = action.payload.userIds;
114
+ draft.cockpitContext.userGroupIds = action.payload.userGroupIds;
115
+ },
116
+ updateCockpitContextOnFailure(draft, action) {
117
+ draft.cockpitContext.fetchState = 'Error';
118
+ draft.cockpitContext.error = action.payload;
119
+ },
92
120
  clearCompanyTaskManagerView(draft) {
93
121
  Object.assign(draft, exports.initialState);
94
122
  },
95
123
  },
96
124
  });
97
- _a = companyTaskManagerView.actions, exports.fetchCompanyTaskManagerView = _a.fetchCompanyTaskManagerView, exports.updateCompanyTaskManagerViewOnSuccess = _a.updateCompanyTaskManagerViewOnSuccess, exports.updateCompanyTaskManagerViewOnFailure = _a.updateCompanyTaskManagerViewOnFailure, exports.fetchTaskManagerMetrics = _a.fetchTaskManagerMetrics, exports.updateTaskManagerMetrics = _a.updateTaskManagerMetrics, exports.updateTaskManagerMetricsOnFailure = _a.updateTaskManagerMetricsOnFailure, exports.clearCompanyTaskManagerView = _a.clearCompanyTaskManagerView;
125
+ _a = companyTaskManagerView.actions, exports.fetchCompanyTaskManagerView = _a.fetchCompanyTaskManagerView, exports.updateCompanyTaskManagerViewOnSuccess = _a.updateCompanyTaskManagerViewOnSuccess, exports.updateCompanyTaskManagerViewOnFailure = _a.updateCompanyTaskManagerViewOnFailure, exports.fetchTaskManagerMetrics = _a.fetchTaskManagerMetrics, exports.updateTaskManagerMetrics = _a.updateTaskManagerMetrics, exports.updateTaskManagerMetricsOnFailure = _a.updateTaskManagerMetricsOnFailure, exports.clearCompanyTaskManagerView = _a.clearCompanyTaskManagerView, exports.updateCompanyTaskManagerViewFilters = _a.updateCompanyTaskManagerViewFilters, exports.fetchCockpitContext = _a.fetchCockpitContext, exports.updateCockpitContextOnSuccess = _a.updateCockpitContextOnSuccess, exports.updateCockpitContextOnFailure = _a.updateCockpitContextOnFailure;
98
126
  exports.default = companyTaskManagerView.reducer;
@@ -14,10 +14,12 @@ export interface TaskWithCompanyDetail {
14
14
  task: Task;
15
15
  }
16
16
  export interface CompanyTaskManagerSelectorView extends SelectorView {
17
+ companies: Company[];
17
18
  metrics: TaskManagerMetrics;
18
19
  metricsFetchState: FetchState;
19
20
  tasksList: TaskWithCompanyDetail[];
20
21
  totalTaskCount: number;
21
22
  uiState: CompanyTaskManagerViewUIState;
23
+ users: User[];
22
24
  }
23
25
  export declare const getCompanyTaskManagerView: (state: RootState) => CompanyTaskManagerSelectorView;
@@ -2,12 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getCompanyTaskManagerView = void 0;
4
4
  const toolkit_1 = require("@reduxjs/toolkit");
5
+ const reduceFetchState_1 = require("../../commonStateTypes/reduceFetchState");
5
6
  const companySelector_1 = require("../../entity/company/companySelector");
6
7
  const tagSelector_1 = require("../../entity/tag/tagSelector");
7
8
  const taskSelector_1 = require("../../entity/task/taskSelector");
8
9
  const userSelector_1 = require("../../entity/user/userSelector");
9
10
  exports.getCompanyTaskManagerView = (0, toolkit_1.createSelector)((state) => state.companyTaskManagerViewState, (state) => state.companyState, (state) => state.userState, (state) => state.taskState, (state) => state.tagState, (companyTaskManagerViewState, companyState, userState, taskState, tagState) => {
10
- const { taskIds, uiState, fetchState, error, totalTaskCount, metrics, metricsFetchState, } = companyTaskManagerViewState;
11
+ const { taskIds, uiState, totalTaskCount, metrics, metricsFetchState } = companyTaskManagerViewState;
11
12
  const tasksList = [];
12
13
  taskIds.forEach((taskId) => {
13
14
  const task = (0, taskSelector_1.getTaskById)(taskState, taskId);
@@ -29,13 +30,22 @@ exports.getCompanyTaskManagerView = (0, toolkit_1.createSelector)((state) => sta
29
30
  }
30
31
  }
31
32
  });
33
+ const allCompanyIds = companyTaskManagerViewState.cockpitContext.companyIds;
34
+ const companies = (0, companySelector_1.getCompanyByCompanyIds)(companyState, allCompanyIds).map((c) => c.company);
35
+ const users = (0, userSelector_1.getUsersByUserIds)(userState, companyTaskManagerViewState.cockpitContext.userIds);
36
+ const fetchStateAndError = (0, reduceFetchState_1.reduceAnyFetchState)([
37
+ companyTaskManagerViewState,
38
+ companyTaskManagerViewState.cockpitContext,
39
+ ]);
32
40
  return {
41
+ companies,
33
42
  metrics,
34
43
  metricsFetchState,
35
44
  tasksList,
36
45
  uiState,
37
- fetchState,
38
- error,
46
+ fetchState: fetchStateAndError.fetchState,
47
+ error: fetchStateAndError.error,
39
48
  totalTaskCount,
49
+ users,
40
50
  };
41
51
  });
@@ -1,7 +1,7 @@
1
1
  import { FetchState, FetchedState, ID } from '../../commonStateTypes/common';
2
2
  import { SortOrder } from '../../commonStateTypes/selectorTypes/sortOrderTypes';
3
- import { PageToken } from '../../commonStateTypes/viewAndReport/viewAndReport';
4
- import { TaskManagerViewSortKey } from '../companyView/types/cockpitTypes';
3
+ import { ZeniAPIStatus } from '../../responsePayload';
4
+ import { CockpitFilters, TaskManagerViewSortKey } from '../companyView/types/cockpitTypes';
5
5
  export interface TaskManagerMetrics {
6
6
  closed: number;
7
7
  open: number;
@@ -9,12 +9,20 @@ export interface TaskManagerMetrics {
9
9
  total: number;
10
10
  }
11
11
  export interface CompanyTaskManagerViewUIState {
12
+ filters: CockpitFilters;
12
13
  filterText: string;
13
- pageToken: PageToken;
14
+ from: number;
14
15
  sortKey: TaskManagerViewSortKey;
15
16
  sortOrder: SortOrder;
16
17
  }
17
18
  export interface CompanyTaskManagerViewState extends FetchedState {
19
+ cockpitContext: {
20
+ companyIds: ID[];
21
+ fetchState: FetchState;
22
+ userGroupIds: ID[];
23
+ userIds: ID[];
24
+ error?: ZeniAPIStatus;
25
+ };
18
26
  metrics: TaskManagerMetrics;
19
27
  metricsFetchState: FetchState;
20
28
  taskIds: ID[];
@@ -0,0 +1,10 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { updateCompanies } from '../../../entity/company/companyReducer';
4
+ import { updateAllUsers } from '../../../entity/user/userReducer';
5
+ import { updateAllUserGroups } from '../../../entity/userGroups/userGroupsReducer';
6
+ import { RootState } from '../../../reducer';
7
+ import { ZeniAPI } from '../../../zeniAPI';
8
+ import { fetchCockpitContext, updateCockpitContextOnFailure, updateCockpitContextOnSuccess } from '../companyTaskManagerViewReducer';
9
+ export type ActionType = ReturnType<typeof fetchCockpitContext> | ReturnType<typeof updateCockpitContextOnSuccess> | ReturnType<typeof updateCockpitContextOnFailure> | ReturnType<typeof updateCompanies> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateAllUserGroups>;
10
+ export declare const fetchCockpitContextEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchCockpitContextEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const companyReducer_1 = require("../../../entity/company/companyReducer");
7
+ const userReducer_1 = require("../../../entity/user/userReducer");
8
+ const userGroupsReducer_1 = require("../../../entity/userGroups/userGroupsReducer");
9
+ const responsePayload_1 = require("../../../responsePayload");
10
+ const companyTaskManagerViewReducer_1 = require("../companyTaskManagerViewReducer");
11
+ const fetchCockpitContextEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(companyTaskManagerViewReducer_1.fetchCockpitContext.match), (0, operators_1.switchMap)(() => zeniAPI
12
+ .getJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/cockpit-panels/cockpit-context`)
13
+ .pipe((0, operators_1.mergeMap)((response) => {
14
+ if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
15
+ const companies = response.data?.companies ?? [];
16
+ const users = response.data?.users ?? [];
17
+ const userGroups = response.data?.user_groups ?? [];
18
+ const companyIds = companies.map((company) => company.company_id);
19
+ const userIds = users.map((user) => user.user_id);
20
+ const userGroupIds = userGroups.map((userGroup) => userGroup.id);
21
+ const actions = [
22
+ (0, companyReducer_1.updateCompanies)({
23
+ payload: response.data.companies,
24
+ schema: {},
25
+ }),
26
+ (0, userReducer_1.updateAllUsers)({ users: response.data.users }),
27
+ (0, userGroupsReducer_1.updateAllUserGroups)({
28
+ userGroups: response.data.user_groups,
29
+ }),
30
+ (0, companyTaskManagerViewReducer_1.updateCockpitContextOnSuccess)({
31
+ companyIds,
32
+ userIds,
33
+ userGroupIds,
34
+ }),
35
+ ];
36
+ return (0, rxjs_1.from)(actions);
37
+ }
38
+ else {
39
+ return (0, rxjs_1.of)((0, companyTaskManagerViewReducer_1.updateCockpitContextOnFailure)(response.status));
40
+ }
41
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, companyTaskManagerViewReducer_1.updateCockpitContextOnFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'Cockpit context fetch errored out' + JSON.stringify(error))))))));
42
+ exports.fetchCockpitContextEpic = fetchCockpitContextEpic;
@@ -1,11 +1,9 @@
1
1
  import { ActionsObservable, StateObservable } from 'redux-observable';
2
2
  import { Observable } from 'rxjs';
3
- import { updateCompanies } from '../../../entity/company/companyReducer';
4
3
  import { updateTags } from '../../../entity/tag/tagReducer';
5
4
  import { updateTasks } from '../../../entity/task/taskReducer';
6
- import { updateAllUsers } from '../../../entity/user/userReducer';
7
5
  import { RootState } from '../../../reducer';
8
6
  import { ZeniAPI } from '../../../zeniAPI';
9
7
  import { fetchCompanyTaskManagerView, updateCompanyTaskManagerViewOnFailure, updateCompanyTaskManagerViewOnSuccess } from '../companyTaskManagerViewReducer';
10
- export type ActionType = ReturnType<typeof fetchCompanyTaskManagerView> | ReturnType<typeof updateCompanyTaskManagerViewOnSuccess> | ReturnType<typeof updateTasks> | ReturnType<typeof updateCompanies> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateTags> | ReturnType<typeof updateCompanyTaskManagerViewOnFailure>;
8
+ export type ActionType = ReturnType<typeof fetchCompanyTaskManagerView> | ReturnType<typeof updateCompanyTaskManagerViewOnSuccess> | ReturnType<typeof updateTasks> | ReturnType<typeof updateTags> | ReturnType<typeof updateCompanyTaskManagerViewOnFailure>;
11
9
  export declare const fetchCompanyTaskManagerViewEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -4,51 +4,35 @@ exports.fetchCompanyTaskManagerViewEpic = void 0;
4
4
  const rxjs_1 = require("rxjs");
5
5
  const operators_1 = require("rxjs/operators");
6
6
  const sortOrderPayload_1 = require("../../../commonPayloadTypes/sortOrderPayload");
7
- const companyReducer_1 = require("../../../entity/company/companyReducer");
8
7
  const tagReducer_1 = require("../../../entity/tag/tagReducer");
9
8
  const taskReducer_1 = require("../../../entity/task/taskReducer");
10
- const userReducer_1 = require("../../../entity/user/userReducer");
11
9
  const responsePayload_1 = require("../../../responsePayload");
12
10
  const companyTaskManagerViewReducer_1 = require("../companyTaskManagerViewReducer");
13
- const toSortKeyPayload = (sortKey) => {
14
- switch (sortKey) {
15
- case 'taskName':
16
- return 'name';
17
- case 'dueDate':
18
- return 'due_date';
19
- case 'createdBy':
20
- return 'created_by';
21
- case 'name':
22
- return 'company_name';
23
- default:
24
- return sortKey;
25
- }
26
- };
11
+ const DEFAULT_PAGE_SIZE = 100;
27
12
  const fetchCompanyTaskManagerViewEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(companyTaskManagerViewReducer_1.fetchCompanyTaskManagerView.match), (0, operators_1.switchMap)((action) => {
28
- const { pageToken, sortKey, sortOrder, searchString } = action.payload;
13
+ const { from: fromOffset, searchString, sortKey, sortOrder, filters, } = action.payload;
29
14
  const queryValue = {
30
- page_token: pageToken,
15
+ size: DEFAULT_PAGE_SIZE,
16
+ from: fromOffset,
17
+ global_search: searchString ?? '',
31
18
  sort_by: toSortKeyPayload(sortKey),
32
19
  sort_order: (0, sortOrderPayload_1.getSortOrder)(sortOrder),
33
- search_text: searchString ?? '',
34
- view: 'cockpit_task_manager_view',
20
+ filter_join: filters?.categoryCombinationOperator === 'AND' ? 'and' : 'or',
21
+ ...(filters?.categories != null && filters.categories.length > 0
22
+ ? { filter_by: toFilterByPayload(filters) }
23
+ : {}),
35
24
  };
36
25
  return zeniAPI
37
- .getJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/cockpit-panels/tasks?query=${encodeURIComponent(JSON.stringify(queryValue))}`)
26
+ .getJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/cockpit-panels/tasks-es?query=${encodeURIComponent(JSON.stringify(queryValue))}`)
38
27
  .pipe((0, operators_1.mergeMap)((response) => {
39
28
  if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
40
- const tasksList = response.data.tasks;
29
+ const tasksList = response.data.aggregations.group_by_company_name.buckets.flatMap((bucket) => bucket.tasks);
41
30
  const actions = [
42
31
  (0, companyTaskManagerViewReducer_1.updateCompanyTaskManagerViewOnSuccess)({
43
32
  data: response.data,
44
33
  }),
45
34
  (0, taskReducer_1.updateTasks)(tasksList),
46
- (0, companyReducer_1.updateCompanies)({
47
- payload: response.data.companies,
48
- schema: {},
49
- }),
50
- (0, tagReducer_1.updateTags)(tasksList.map((task) => task.tags).flat()),
51
- (0, userReducer_1.updateAllUsers)({ users: response.data.users }),
35
+ (0, tagReducer_1.updateTags)(tasksList.flatMap((task) => task.tags)),
52
36
  ];
53
37
  return (0, rxjs_1.from)(actions);
54
38
  }
@@ -66,3 +50,28 @@ const fetchCompanyTaskManagerViewEpic = (actions$, _state$, zeniAPI) => actions$
66
50
  }));
67
51
  }));
68
52
  exports.fetchCompanyTaskManagerViewEpic = fetchCompanyTaskManagerViewEpic;
53
+ const toSortKeyPayload = (sortKey) => {
54
+ switch (sortKey) {
55
+ case 'taskName':
56
+ return 'name';
57
+ case 'dueDate':
58
+ return 'due_date';
59
+ case 'createdBy':
60
+ return 'created_by';
61
+ case 'name':
62
+ return 'company_name';
63
+ default:
64
+ return sortKey;
65
+ }
66
+ };
67
+ const toFilterByPayload = (filters) => {
68
+ if (filters.categories == null) {
69
+ return [];
70
+ }
71
+ return filters.categories.map((category) => ({
72
+ field: category.field ?? '',
73
+ operator: category.matchingOperator === 'equal' ? 'is' : 'is_not',
74
+ values: category.values.map((v) => String(v)),
75
+ join: category.valuesCombinationOperator === 'ALL' ? 'and' : 'or',
76
+ }));
77
+ };
@@ -0,0 +1,6 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { RootState } from '../../../reducer';
4
+ import { fetchCompanyTaskManagerView, updateCompanyTaskManagerViewFilters } from '../companyTaskManagerViewReducer';
5
+ export type ActionType = ReturnType<typeof updateCompanyTaskManagerViewFilters> | ReturnType<typeof fetchCompanyTaskManagerView>;
6
+ export declare const updateCompanyTaskManagerViewFiltersEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateCompanyTaskManagerViewFiltersEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const companyTaskManagerViewReducer_1 = require("../companyTaskManagerViewReducer");
7
+ const updateCompanyTaskManagerViewFiltersEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(companyTaskManagerViewReducer_1.updateCompanyTaskManagerViewFilters.match), (0, operators_1.switchMap)((action) => {
8
+ const filters = action.payload.filters;
9
+ const allCategoriesValid = filters?.categories == null
10
+ ? true
11
+ : filters?.categories?.every((category) => category.field != null &&
12
+ category.values != null &&
13
+ category.values.length > 0);
14
+ if (!allCategoriesValid) {
15
+ return rxjs_1.EMPTY;
16
+ }
17
+ const { uiState } = state$.value.companyTaskManagerViewState;
18
+ return (0, rxjs_1.of)((0, companyTaskManagerViewReducer_1.fetchCompanyTaskManagerView)(0, uiState.sortKey, uiState.sortOrder, false, uiState.filterText, filters));
19
+ }));
20
+ exports.updateCompanyTaskManagerViewFiltersEpic = updateCompanyTaskManagerViewFiltersEpic;
@@ -24,7 +24,7 @@ const fetchAllCockpitViewsEpic = (actions$, state$) => actions$.pipe((0, operato
24
24
  (0, reviewCompanyViewReducer_1.fetchReviewCompanyView)(),
25
25
  (0, companyHealthMetricViewReducer_1.fetchCompanyHealthMetricView)(),
26
26
  (0, companyViewReducer_1.fetchCompanyMetaData)(),
27
- (0, companyTaskManagerViewReducer_1.fetchCompanyTaskManagerView)(null, 'dueDate', 'descending', false),
27
+ (0, companyTaskManagerViewReducer_1.fetchCompanyTaskManagerView)(0, 'dueDate', 'descending', false),
28
28
  (0, companyHealthMetricConfigReducer_1.fetchCompanyHealthMetricConfig)(),
29
29
  ]);
30
30
  }
@@ -77,7 +77,7 @@ const fetchAllCockpitViewsEpic = (actions$, state$) => actions$.pipe((0, operato
77
77
  }
78
78
  if (state.companyTaskManagerViewState.fetchState !== 'In-Progress' &&
79
79
  state.companyTaskManagerViewState.hasValidState() === false) {
80
- fetchActions.push((0, companyTaskManagerViewReducer_1.fetchCompanyTaskManagerView)(null, 'dueDate', 'descending', false));
80
+ fetchActions.push((0, companyTaskManagerViewReducer_1.fetchCompanyTaskManagerView)(0, 'dueDate', 'descending', false));
81
81
  }
82
82
  return (0, rxjs_1.from)(fetchActions);
83
83
  }
@@ -18,11 +18,12 @@ export type ManagementViewFilterCategoryField = 'controllerUserIds' | 'customerS
18
18
  export type SubscriptionViewFilterCategoryField = 'controllerUserIds' | 'statusCode' | 'recommendedActionCode' | 'subscriptionPlans' | 'subscriptionAddOns' | 'avg2MonthExpenses' | 'slabLowerLimit' | 'slabUpperLimit' | 'monthlyRecurringRevenue';
19
19
  export type PortfolioViewFilterCategoryField = 'netBurnOrIncome' | 'cashPosition' | 'income' | 'expenses' | 'runway';
20
20
  export type HealthMonitorViewFilterCategoryField = 'verticalProductServices' | 'runway' | 'netPromoterScore' | 'customerSatisfactionScore' | 'churnProbabilityPercentage' | 'controller' | 'customerSuccessManager' | 'lastReportSent' | 'subscriptionStartDate' | 'subscriptionRenewalDate' | 'externalProductServiceExposure' | 'companyEngagementMetricsUpdatedAt' | 'companyGroupId' | 'monthlyRecurringRevenue';
21
+ export type TaskManagerViewFilterCategoryField = 'assignees' | 'creationDate' | 'dueDate' | 'priority' | 'status' | 'company_id' | 'tag';
21
22
  export interface CockpitFilterCategory {
22
23
  matchingOperator: 'equal' | 'not_equal';
23
24
  values: FilterCategoryValueType[];
24
25
  valuesCombinationOperator: 'ANY' | 'ALL';
25
- field?: AiAccountantFilterCategoryField | ManagementViewFilterCategoryField | SubscriptionViewFilterCategoryField | PortfolioViewFilterCategoryField | HealthMonitorViewFilterCategoryField;
26
+ field?: AiAccountantFilterCategoryField | ManagementViewFilterCategoryField | SubscriptionViewFilterCategoryField | PortfolioViewFilterCategoryField | HealthMonitorViewFilterCategoryField | TaskManagerViewFilterCategoryField;
26
27
  }
27
28
  export interface CockpitFilters {
28
29
  categories?: CockpitFilterCategory[];
@@ -6,7 +6,7 @@ const operators_1 = require("rxjs/operators");
6
6
  const fileReducer_1 = require("../../../entity/file/fileReducer");
7
7
  const responsePayload_1 = require("../../../responsePayload");
8
8
  const fileViewReducer_1 = require("../fileViewReducer");
9
- const deleteFileEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(fileViewReducer_1.deleteFile.match), (0, operators_1.switchMap)((action) => {
9
+ const deleteFileEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(fileViewReducer_1.deleteFile.match), (0, operators_1.mergeMap)((action) => {
10
10
  /**
11
11
  * tenantId is required for deleting onboarding files.
12
12
  */
@@ -6,7 +6,7 @@ const operators_1 = require("rxjs/operators");
6
6
  const fileReducer_1 = require("../../../entity/file/fileReducer");
7
7
  const responsePayload_1 = require("../../../responsePayload");
8
8
  const fileViewReducer_1 = require("../fileViewReducer");
9
- const deleteFileListEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(fileViewReducer_1.deleteFileList.match), (0, operators_1.switchMap)((action) => {
9
+ const deleteFileListEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(fileViewReducer_1.deleteFileList.match), (0, operators_1.mergeMap)((action) => {
10
10
  const { fileIds } = action.payload;
11
11
  return zeniAPI
12
12
  .deleteAndGetJSON(`${zeniAPI.apiEndPoints.fileMicroServiceBaseUrl}/1.0/files?query=${encodeURIComponent(JSON.stringify({ file_ids: fileIds }))}`)
@@ -6,7 +6,7 @@ const operators_1 = require("rxjs/operators");
6
6
  const fileReducer_1 = require("../../../entity/file/fileReducer");
7
7
  const responsePayload_1 = require("../../../responsePayload");
8
8
  const fileViewReducer_1 = require("../fileViewReducer");
9
- const updateFileNameEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(fileViewReducer_1.updateFileName.match), (0, operators_1.switchMap)((action) => {
9
+ const updateFileNameEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(fileViewReducer_1.updateFileName.match), (0, operators_1.mergeMap)((action) => {
10
10
  /**
11
11
  * tenantId is required for updating onboarding file names.
12
12
  */
@@ -0,0 +1,7 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { RootState } from '../../../../../reducer';
4
+ import { ZeniAPI } from '../../../../../zeniAPI';
5
+ import { fetchAiAgentsActivationStatus, fetchAiAgentsActivationStatusFailure, fetchAiAgentsActivationStatusSuccess } from '../../onboardingCustomerViewReducer';
6
+ export type ActionType = ReturnType<typeof fetchAiAgentsActivationStatus> | ReturnType<typeof fetchAiAgentsActivationStatusSuccess> | ReturnType<typeof fetchAiAgentsActivationStatusFailure>;
7
+ export declare const fetchAiAgentsActivationStatusEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchAiAgentsActivationStatusEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const responsePayload_1 = require("../../../../../responsePayload");
7
+ const onboardingCustomerViewReducer_1 = require("../../onboardingCustomerViewReducer");
8
+ const toPhaseStatus = (raw) => {
9
+ if (raw === 'idle' ||
10
+ raw === 'starting' ||
11
+ raw === 'building' ||
12
+ raw === 'ready') {
13
+ return raw;
14
+ }
15
+ return 'idle';
16
+ };
17
+ const toPhase = (row) => ({
18
+ key: row.key,
19
+ status: toPhaseStatus(row.status),
20
+ startedAt: row.started_at,
21
+ completedAt: row.completed_at,
22
+ });
23
+ const toCounts = (payload) => ({
24
+ customerCount: payload?.customer_count ?? 0,
25
+ glAccountCount: payload?.gl_account_count ?? 0,
26
+ targetTransactionCount: payload?.target_transaction_count ?? 0,
27
+ transactionCount: payload?.transaction_count ?? 0,
28
+ vendorCount: payload?.vendor_count ?? 0,
29
+ });
30
+ const fetchAiAgentsActivationStatusEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(onboardingCustomerViewReducer_1.fetchAiAgentsActivationStatus.match), (0, operators_1.mergeMap)(() => {
31
+ const url = `${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/ai-agents-activation/status`;
32
+ return zeniAPI
33
+ .getJSON(url)
34
+ .pipe((0, operators_1.mergeMap)((response) => {
35
+ if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
36
+ const phases = (response.data.phases ?? []).map(toPhase);
37
+ return (0, rxjs_1.of)((0, onboardingCustomerViewReducer_1.fetchAiAgentsActivationStatusSuccess)({
38
+ phases,
39
+ counts: toCounts(response.data.counts),
40
+ }));
41
+ }
42
+ return (0, rxjs_1.of)((0, onboardingCustomerViewReducer_1.fetchAiAgentsActivationStatusFailure)(response.status));
43
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, onboardingCustomerViewReducer_1.fetchAiAgentsActivationStatusFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'fetchAiAgentsActivationStatus errored out ' +
44
+ JSON.stringify(error))))));
45
+ }));
46
+ exports.fetchAiAgentsActivationStatusEpic = fetchAiAgentsActivationStatusEpic;
@@ -0,0 +1,8 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { updateCompanies } from '../../../../../entity/company/companyReducer';
4
+ import { RootState } from '../../../../../reducer';
5
+ import { ZeniAPI } from '../../../../../zeniAPI';
6
+ import { acknowledgeOnboardingAiActivationViewed, acknowledgeOnboardingAiActivationViewedFailure, acknowledgeOnboardingAiActivationViewedSuccess } from '../../onboardingCustomerViewReducer';
7
+ export type ActionType = ReturnType<typeof acknowledgeOnboardingAiActivationViewed> | ReturnType<typeof updateCompanies> | ReturnType<typeof acknowledgeOnboardingAiActivationViewedSuccess> | ReturnType<typeof acknowledgeOnboardingAiActivationViewedFailure>;
8
+ export declare const acknowledgeOnboardingAiActivationViewedEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.acknowledgeOnboardingAiActivationViewedEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const companyReducer_1 = require("../../../../../entity/company/companyReducer");
7
+ const responsePayload_1 = require("../../../../../responsePayload");
8
+ const onboardingCustomerViewReducer_1 = require("../../onboardingCustomerViewReducer");
9
+ const acknowledgeOnboardingAiActivationViewedEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(onboardingCustomerViewReducer_1.acknowledgeOnboardingAiActivationViewed.match), (0, operators_1.mergeMap)((action) => {
10
+ const { companyId } = action.payload;
11
+ const payload = {
12
+ is_onboarding_ai_activation_viewed: true,
13
+ };
14
+ return zeniAPI
15
+ .putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/companies/${companyId}`, payload)
16
+ .pipe((0, operators_1.mergeMap)((response) => {
17
+ if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
18
+ const actions = [
19
+ (0, companyReducer_1.updateCompanies)({
20
+ payload: response.data.companies,
21
+ schema: {},
22
+ }),
23
+ (0, onboardingCustomerViewReducer_1.acknowledgeOnboardingAiActivationViewedSuccess)(),
24
+ ];
25
+ return (0, rxjs_1.from)(actions);
26
+ }
27
+ return (0, rxjs_1.of)((0, onboardingCustomerViewReducer_1.acknowledgeOnboardingAiActivationViewedFailure)(response.status));
28
+ }),
29
+ // Best-effort — failure is silent; cascade just runs again next visit.
30
+ (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, onboardingCustomerViewReducer_1.acknowledgeOnboardingAiActivationViewedFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Acknowledge - Onboarding AI Activation Viewed errored out' +
31
+ JSON.stringify(error))))));
32
+ }));
33
+ exports.acknowledgeOnboardingAiActivationViewedEpic = acknowledgeOnboardingAiActivationViewedEpic;
@@ -0,0 +1,9 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { updateCompanies } from '../../../../../entity/company/companyReducer';
4
+ import { openSnackbar } from '../../../../../entity/snackbar/snackbarReducer';
5
+ import { RootState } from '../../../../../reducer';
6
+ import { ZeniAPI } from '../../../../../zeniAPI';
7
+ import { acknowledgeOnboardingAiFinanceTeam, acknowledgeOnboardingAiFinanceTeamFailure, acknowledgeOnboardingAiFinanceTeamSuccess } from '../../onboardingCustomerViewReducer';
8
+ export type ActionType = ReturnType<typeof acknowledgeOnboardingAiFinanceTeam> | ReturnType<typeof updateCompanies> | ReturnType<typeof openSnackbar> | ReturnType<typeof acknowledgeOnboardingAiFinanceTeamSuccess> | ReturnType<typeof acknowledgeOnboardingAiFinanceTeamFailure>;
9
+ export declare const acknowledgeOnboardingAiFinanceTeamEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.acknowledgeOnboardingAiFinanceTeamEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const companyReducer_1 = require("../../../../../entity/company/companyReducer");
7
+ const snackbarReducer_1 = require("../../../../../entity/snackbar/snackbarReducer");
8
+ const responsePayload_1 = require("../../../../../responsePayload");
9
+ const onboardingCustomerViewReducer_1 = require("../../onboardingCustomerViewReducer");
10
+ const acknowledgeOnboardingAiFinanceTeamEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(onboardingCustomerViewReducer_1.acknowledgeOnboardingAiFinanceTeam.match), (0, operators_1.mergeMap)((action) => {
11
+ const { companyId } = action.payload;
12
+ const payload = {
13
+ is_onboarding_ai_finance_team_acknowledged: true,
14
+ };
15
+ return zeniAPI
16
+ .putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/companies/${companyId}`, payload)
17
+ .pipe((0, operators_1.mergeMap)((response) => {
18
+ if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
19
+ const actions = [
20
+ (0, companyReducer_1.updateCompanies)({
21
+ payload: response.data.companies,
22
+ schema: {},
23
+ }),
24
+ (0, onboardingCustomerViewReducer_1.acknowledgeOnboardingAiFinanceTeamSuccess)(),
25
+ ];
26
+ return (0, rxjs_1.from)(actions);
27
+ }
28
+ else {
29
+ return (0, rxjs_1.of)((0, snackbarReducer_1.openSnackbar)({
30
+ messageSection: 'onboarding_customer_view_complete',
31
+ messageText: 'failed',
32
+ type: 'error',
33
+ variables: [
34
+ {
35
+ variableName: '_api-error_',
36
+ variableValue: response.status.message,
37
+ },
38
+ ],
39
+ }), (0, onboardingCustomerViewReducer_1.acknowledgeOnboardingAiFinanceTeamFailure)(response.status));
40
+ }
41
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, onboardingCustomerViewReducer_1.acknowledgeOnboardingAiFinanceTeamFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Acknowledge - Onboarding AI Finance Team errored out' +
42
+ JSON.stringify(error))))));
43
+ }));
44
+ exports.acknowledgeOnboardingAiFinanceTeamEpic = acknowledgeOnboardingAiFinanceTeamEpic;
@@ -15,6 +15,9 @@ export interface OnboardingStatusPayload {
15
15
  is_user_landed_to_interim_page: boolean;
16
16
  should_complete_onboarding: boolean;
17
17
  }
18
+ export interface AiFinanceTeamAcknowledgementPayload {
19
+ is_onboarding_ai_finance_team_acknowledged: boolean;
20
+ }
18
21
  interface CompaniesData {
19
22
  companies: CompanyPayload[];
20
23
  }