@zeniai/client-epic-state 5.0.91 → 5.0.92-betaNB1

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 (62) hide show
  1. package/lib/commonStateTypes/viewAndReport/agingReportStateTypes.d.ts +1 -1
  2. package/lib/entity/accountRecon/accountReconPayload.d.ts +20 -1
  3. package/lib/entity/accountRecon/accountReconPayload.js +23 -1
  4. package/lib/entity/accountRecon/accountReconSelector.d.ts +6 -1
  5. package/lib/entity/accountRecon/accountReconSelector.js +5 -0
  6. package/lib/entity/accountRecon/accountReconState.d.ts +19 -0
  7. package/lib/entity/monthEndCloseChecks/monthEndCloseChecksPayload.d.ts +7 -0
  8. package/lib/entity/monthEndCloseChecks/monthEndCloseChecksPayload.js +9 -0
  9. package/lib/entity/monthEndCloseChecks/monthEndCloseChecksState.d.ts +7 -0
  10. package/lib/entity/task/taskPayload.d.ts +3 -1
  11. package/lib/entity/task/taskPayload.js +2 -0
  12. package/lib/entity/task/taskState.d.ts +2 -0
  13. package/lib/epic.d.ts +7 -3
  14. package/lib/epic.js +7 -3
  15. package/lib/esm/entity/accountRecon/accountReconPayload.js +23 -1
  16. package/lib/esm/entity/accountRecon/accountReconSelector.js +5 -0
  17. package/lib/esm/entity/monthEndCloseChecks/monthEndCloseChecksPayload.js +9 -0
  18. package/lib/esm/entity/task/taskPayload.js +2 -0
  19. package/lib/esm/epic.js +7 -3
  20. package/lib/esm/index.js +5 -5
  21. package/lib/esm/view/companyTaskManagerView/companyTaskManagerViewReducer.js +39 -11
  22. package/lib/esm/view/companyTaskManagerView/companyTaskManagerViewSelector.js +14 -4
  23. package/lib/esm/view/companyTaskManagerView/epics/fetchCockpitContextEpic.js +38 -0
  24. package/lib/esm/view/companyTaskManagerView/epics/fetchCompanyTaskManagerViewEpic.js +37 -28
  25. package/lib/esm/view/companyTaskManagerView/epics/updateCompanyTaskManagerViewFiltersEpic.js +16 -0
  26. package/lib/esm/view/companyView/epic/fetchAllCockpitViewsEpic.js +2 -2
  27. package/lib/esm/view/expenseAutomationView/epics/accountRecon/parseStatementEpic.js +34 -0
  28. package/lib/esm/view/expenseAutomationView/epics/accountRecon/updateStatementInfoEpic.js +42 -0
  29. package/lib/esm/view/expenseAutomationView/payload/reconciliationPayload.js +73 -0
  30. package/lib/esm/view/expenseAutomationView/reducers/reconciliationViewReducer.js +89 -3
  31. package/lib/esm/view/expenseAutomationView/selectors/reconciliationViewSelector.js +20 -0
  32. package/lib/esm/view/expenseAutomationView/types/reconciliationViewState.js +20 -0
  33. package/lib/index.d.ts +11 -10
  34. package/lib/index.js +43 -33
  35. package/lib/view/companyTaskManagerView/companyTaskManagerViewPayload.d.ts +19 -11
  36. package/lib/view/companyTaskManagerView/companyTaskManagerViewReducer.d.ts +10 -4
  37. package/lib/view/companyTaskManagerView/companyTaskManagerViewReducer.js +40 -12
  38. package/lib/view/companyTaskManagerView/companyTaskManagerViewSelector.d.ts +2 -0
  39. package/lib/view/companyTaskManagerView/companyTaskManagerViewSelector.js +13 -3
  40. package/lib/view/companyTaskManagerView/companyTaskManagerViewState.d.ts +11 -3
  41. package/lib/view/companyTaskManagerView/epics/fetchCockpitContextEpic.d.ts +10 -0
  42. package/lib/view/companyTaskManagerView/epics/fetchCockpitContextEpic.js +42 -0
  43. package/lib/view/companyTaskManagerView/epics/fetchCompanyTaskManagerViewEpic.d.ts +1 -3
  44. package/lib/view/companyTaskManagerView/epics/fetchCompanyTaskManagerViewEpic.js +37 -28
  45. package/lib/view/companyTaskManagerView/epics/updateCompanyTaskManagerViewFiltersEpic.d.ts +6 -0
  46. package/lib/view/companyTaskManagerView/epics/updateCompanyTaskManagerViewFiltersEpic.js +20 -0
  47. package/lib/view/companyView/epic/fetchAllCockpitViewsEpic.js +2 -2
  48. package/lib/view/companyView/types/cockpitTypes.d.ts +2 -1
  49. package/lib/view/expenseAutomationView/epics/accountRecon/parseStatementEpic.d.ts +6 -0
  50. package/lib/view/expenseAutomationView/epics/accountRecon/parseStatementEpic.js +38 -0
  51. package/lib/view/expenseAutomationView/epics/accountRecon/updateStatementInfoEpic.d.ts +19 -0
  52. package/lib/view/expenseAutomationView/epics/accountRecon/updateStatementInfoEpic.js +46 -0
  53. package/lib/view/expenseAutomationView/payload/reconciliationPayload.d.ts +83 -1
  54. package/lib/view/expenseAutomationView/payload/reconciliationPayload.js +75 -0
  55. package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.d.ts +35 -3
  56. package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.js +90 -4
  57. package/lib/view/expenseAutomationView/selectorTypes/reconciliationViewSelectorTypes.d.ts +5 -1
  58. package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.js +20 -0
  59. package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +128 -0
  60. package/lib/view/expenseAutomationView/types/reconciliationViewState.js +21 -0
  61. package/lib/view/vendorFiling1099/vendorFiling1099List/vendorFiling1099ListState.d.ts +1 -1
  62. package/package.json +1 -1
@@ -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[];
@@ -0,0 +1,6 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { RootState } from '../../../../reducer';
3
+ import { ZeniAPI } from '../../../../zeniAPI';
4
+ import { parseStatement, parseStatementFailure, parseStatementSuccess, updateParsedStatementData } from '../../reducers/reconciliationViewReducer';
5
+ export type ActionType = ReturnType<typeof parseStatement> | ReturnType<typeof parseStatementSuccess> | ReturnType<typeof parseStatementFailure> | ReturnType<typeof updateParsedStatementData>;
6
+ export declare const parseStatementEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<ActionType>;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseStatementEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const responsePayload_1 = require("../../../../responsePayload");
7
+ const reconciliationPayload_1 = require("../../payload/reconciliationPayload");
8
+ const reconciliationViewReducer_1 = require("../../reducers/reconciliationViewReducer");
9
+ const parseStatementEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(reconciliationViewReducer_1.parseStatement.match), (0, operators_1.mergeMap)((action) => {
10
+ const { accountId, selectedPeriod, statementUploadId } = action.payload;
11
+ const parseStatementApi$ = zeniAPI.getJSON(`${zeniAPI.apiEndPoints.reconciliationMicroServiceBaseUrl}/2.0/statement-uploads/${statementUploadId}`);
12
+ return parseStatementApi$.pipe((0, operators_1.mergeMap)((response) => {
13
+ if ((0, responsePayload_1.isSuccessResponse)(response) === true && response.data != null) {
14
+ const actions = [];
15
+ const transformedData = (0, reconciliationPayload_1.transformParseStatementPayloadToState)(response.data);
16
+ actions.push((0, reconciliationViewReducer_1.updateParsedStatementData)({
17
+ accountId,
18
+ selectedPeriod,
19
+ parsedStatementData: transformedData,
20
+ }));
21
+ actions.push((0, reconciliationViewReducer_1.parseStatementSuccess)({ accountId, selectedPeriod }));
22
+ return (0, rxjs_1.from)(actions);
23
+ }
24
+ else {
25
+ return (0, rxjs_1.of)((0, reconciliationViewReducer_1.parseStatementFailure)({
26
+ accountId,
27
+ selectedPeriod,
28
+ error: response.status,
29
+ }));
30
+ }
31
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, reconciliationViewReducer_1.parseStatementFailure)({
32
+ accountId,
33
+ selectedPeriod,
34
+ error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Parse Statement REST API call errored out ' +
35
+ JSON.stringify(error)),
36
+ }))));
37
+ }));
38
+ exports.parseStatementEpic = parseStatementEpic;
@@ -0,0 +1,19 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { RootState } from '../../../../reducer';
3
+ import { ZeniAPI } from '../../../../zeniAPI';
4
+ import { submitStatementUpdate, submitStatementUpdateFailure, submitStatementUpdateSuccess } from '../../reducers/reconciliationViewReducer';
5
+ export type ActionType = ReturnType<typeof submitStatementUpdate> | ReturnType<typeof submitStatementUpdateSuccess> | ReturnType<typeof submitStatementUpdateFailure>;
6
+ export declare const updateStatementInfoEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
7
+ payload: {
8
+ accountId: import("../../../..").ID;
9
+ selectedPeriod: import("../../../../commonStateTypes/timePeriod").MonthYearPeriod;
10
+ };
11
+ type: "expenseAutomationReconciliationView/submitStatementUpdateSuccess";
12
+ } | {
13
+ payload: {
14
+ accountId: import("../../../..").ID;
15
+ error: import("../../../../responsePayload").ZeniAPIStatus;
16
+ selectedPeriod: import("../../../../commonStateTypes/timePeriod").MonthYearPeriod;
17
+ };
18
+ type: "expenseAutomationReconciliationView/submitStatementUpdateFailure";
19
+ }>;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateStatementInfoEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
7
+ const responsePayload_1 = require("../../../../responsePayload");
8
+ const reconciliationPayload_1 = require("../../payload/reconciliationPayload");
9
+ const reconciliationViewReducer_1 = require("../../reducers/reconciliationViewReducer");
10
+ const updateStatementInfoEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(reconciliationViewReducer_1.submitStatementUpdate.match), (0, operators_1.mergeMap)((action) => {
11
+ const { accountId, selectedPeriod, statementUploadId } = action.payload;
12
+ const state = state$.value;
13
+ const reconciliationView = state.expenseAutomationReconciliationViewState;
14
+ const accountRecon = reconciliationView.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)]?.reconciliationByAccountID[accountId];
15
+ const localData = accountRecon?.localData?.statementUpdateLocalData;
16
+ if (!localData) {
17
+ return (0, rxjs_1.of)((0, reconciliationViewReducer_1.submitStatementUpdateFailure)({
18
+ accountId,
19
+ selectedPeriod,
20
+ error: (0, responsePayload_1.createZeniAPIStatus)('Missing Data', 'No statement update data found'),
21
+ }));
22
+ }
23
+ const payload = (0, reconciliationPayload_1.transformStatementUpdateStateToPayload)(localData);
24
+ const updateStatementApi$ = zeniAPI.putAndGetJSON(`${zeniAPI.apiEndPoints.reconciliationMicroServiceBaseUrl}/2.0/statement-uploads/${statementUploadId}`, payload);
25
+ return updateStatementApi$.pipe((0, operators_1.mergeMap)((response) => {
26
+ if ((0, responsePayload_1.isSuccessResponse)(response) === true && response.data != null) {
27
+ return (0, rxjs_1.of)((0, reconciliationViewReducer_1.submitStatementUpdateSuccess)({
28
+ accountId,
29
+ selectedPeriod,
30
+ }));
31
+ }
32
+ else {
33
+ return (0, rxjs_1.of)((0, reconciliationViewReducer_1.submitStatementUpdateFailure)({
34
+ accountId,
35
+ selectedPeriod,
36
+ error: response.status,
37
+ }));
38
+ }
39
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, reconciliationViewReducer_1.submitStatementUpdateFailure)({
40
+ accountId,
41
+ selectedPeriod,
42
+ error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Update Statement REST API call errored out ' +
43
+ JSON.stringify(error)),
44
+ }))));
45
+ }));
46
+ exports.updateStatementInfoEpic = updateStatementInfoEpic;
@@ -9,7 +9,7 @@ import { MatchedTransactionPayload } from '../../../entity/transaction/payloadTy
9
9
  import { UserPayload } from '../../../entity/user/userPayload';
10
10
  import { RootState } from '../../../reducer';
11
11
  import { ZeniAPIResponse } from '../../../responsePayload';
12
- import { BalancesLocalData, SaveReconcileDetailActionPayload } from '../types/reconciliationViewState';
12
+ import { BalancesLocalData, ParsedStatementData, SaveReconcileDetailActionPayload, StatementUpdateLocalData, StatementUpdateLocalDataPayload } from '../types/reconciliationViewState';
13
13
  export interface DetectionInfoPayload {
14
14
  account_id: string;
15
15
  bank_balance: number | null;
@@ -31,6 +31,24 @@ interface ExclusionInfoPayload {
31
31
  export interface ExcludedAccountPayload extends AccountAndPaymentAccountPayload {
32
32
  exclusion_info: ExclusionInfoPayload;
33
33
  }
34
+ export interface ReconciliationSummaryPayload {
35
+ accounts: {
36
+ done: number;
37
+ failed: number;
38
+ in_progress: number;
39
+ total: number;
40
+ };
41
+ accounts_to_connect_count: number;
42
+ auto_matched: {
43
+ matched_txns: number;
44
+ total_txns: number;
45
+ };
46
+ needs_review: {
47
+ account_count: number;
48
+ txn_count: number;
49
+ };
50
+ time_saved_percentage: number;
51
+ }
34
52
  export interface ReconciliationPayload {
35
53
  accounts: AccountAndPaymentAccountPayload[];
36
54
  files: FilePayload[];
@@ -39,6 +57,7 @@ export interface ReconciliationPayload {
39
57
  detection_info?: DetectionInfoPayload;
40
58
  detection_reason?: string;
41
59
  excluded_accounts?: ExcludedAccountPayload[];
60
+ summary?: ReconciliationSummaryPayload;
42
61
  }
43
62
  export type ReconciliationResponse = ZeniAPIResponse<ReconciliationPayload>;
44
63
  export interface SaveReconciliationReviewPayload {
@@ -98,4 +117,67 @@ export interface UploadStatementResponsePayload {
98
117
  };
99
118
  }
100
119
  export type UploadStatementResponse = ZeniAPIResponse<UploadStatementResponsePayload>;
120
+ export interface BoundingBoxPayload {
121
+ bottom: number;
122
+ left: number;
123
+ right: number;
124
+ top: number;
125
+ }
126
+ export interface CitationPayload {
127
+ bounding_boxes: BoundingBoxPayload[];
128
+ page: number;
129
+ reference_text: string;
130
+ }
131
+ export interface StatementTransactionPayload {
132
+ amount: number;
133
+ citation: CitationPayload[];
134
+ is_user_added: boolean;
135
+ is_user_edited: boolean;
136
+ statement_transaction_id: string;
137
+ transaction_date: string;
138
+ transaction_direction: 'debit' | 'credit';
139
+ transaction_memo: string;
140
+ }
141
+ export interface ReconciliationMetaPayload {
142
+ end_date: string;
143
+ reconciliation_id: string;
144
+ start_date: string;
145
+ status: string;
146
+ }
147
+ export interface StatementMetaPayload {
148
+ closing_balance: number;
149
+ opening_balance: number;
150
+ statement_data_status: StatusCodeWithLabelPayload;
151
+ statement_end_date: string;
152
+ statement_start_date: string;
153
+ statement_status: StatusCodeWithLabelPayload;
154
+ statement_upload_id: string;
155
+ total_deposits: number;
156
+ total_payments: number;
157
+ }
158
+ export interface AccountInfoPayload {
159
+ account_id: string;
160
+ account_name: string;
161
+ account_type: string;
162
+ currency_code: string;
163
+ last_4_digits: string | null;
164
+ }
165
+ export interface FileInfoPayload {
166
+ file_id: string;
167
+ file_name: string;
168
+ signed_url: string;
169
+ }
170
+ export interface StatementUploadPayload {
171
+ account: AccountInfoPayload;
172
+ file: FileInfoPayload;
173
+ statement_meta: StatementMetaPayload;
174
+ statement_transactions: StatementTransactionPayload[];
175
+ }
176
+ export interface ParseStatementResponsePayload {
177
+ reconciliation: ReconciliationMetaPayload;
178
+ statement_upload: StatementUploadPayload;
179
+ }
180
+ export type ParseStatementResponse = ZeniAPIResponse<ParseStatementResponsePayload>;
181
+ export declare function transformParseStatementPayloadToState(payload: ParseStatementResponsePayload): ParsedStatementData;
182
+ export declare function transformStatementUpdateStateToPayload(localData: StatementUpdateLocalData): StatementUpdateLocalDataPayload;
101
183
  export {};
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createSaveReconciliationPayloadBasedOnActionAndMethod = createSaveReconciliationPayloadBasedOnActionAndMethod;
4
+ exports.transformParseStatementPayloadToState = transformParseStatementPayloadToState;
5
+ exports.transformStatementUpdateStateToPayload = transformStatementUpdateStateToPayload;
4
6
  const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
5
7
  const accountReconPayload_1 = require("../../../entity/accountRecon/accountReconPayload");
6
8
  const reconciliationTransactionPayloads_1 = require("../../../entity/transaction/payloadTypes/reconciliationTransactionPayloads");
@@ -70,3 +72,76 @@ function createReviewTransactionPayload(accountReconciliationEntity) {
70
72
  });
71
73
  return reviewTransactionsPayload;
72
74
  }
75
+ function transformParseStatementPayloadToState(payload) {
76
+ return {
77
+ statementUpload: {
78
+ account: {
79
+ accountId: payload.statement_upload.account.account_id,
80
+ accountName: payload.statement_upload.account.account_name,
81
+ accountType: payload.statement_upload.account.account_type,
82
+ currencyCode: payload.statement_upload.account.currency_code,
83
+ last4Digits: payload.statement_upload.account.last_4_digits,
84
+ },
85
+ file: {
86
+ fileId: payload.statement_upload.file.file_id,
87
+ fileName: payload.statement_upload.file.file_name,
88
+ signedUrl: payload.statement_upload.file.signed_url,
89
+ },
90
+ statementMeta: {
91
+ closingBalance: payload.statement_upload.statement_meta.closing_balance,
92
+ openingBalance: payload.statement_upload.statement_meta.opening_balance,
93
+ statementDataStatus: payload.statement_upload.statement_meta.statement_data_status,
94
+ statementEndDate: payload.statement_upload.statement_meta.statement_end_date,
95
+ statementStartDate: payload.statement_upload.statement_meta.statement_start_date,
96
+ statementStatus: payload.statement_upload.statement_meta.statement_status,
97
+ statementUploadId: payload.statement_upload.statement_meta.statement_upload_id,
98
+ totalDeposits: payload.statement_upload.statement_meta.total_deposits,
99
+ totalPayments: payload.statement_upload.statement_meta.total_payments,
100
+ },
101
+ statementTransactions: payload.statement_upload.statement_transactions.map((txn) => ({
102
+ amount: txn.amount,
103
+ citations: txn.citation.map((c) => ({
104
+ boundingBoxes: c.bounding_boxes,
105
+ page: c.page,
106
+ referenceText: c.reference_text,
107
+ })),
108
+ isUserAdded: txn.is_user_added,
109
+ isUserEdited: txn.is_user_edited,
110
+ statementTransactionId: txn.statement_transaction_id,
111
+ transactionDate: txn.transaction_date,
112
+ transactionDirection: txn.transaction_direction,
113
+ transactionMemo: txn.transaction_memo,
114
+ })),
115
+ },
116
+ };
117
+ }
118
+ function transformStatementUpdateStateToPayload(localData) {
119
+ const { statementMeta, statementTransactions } = localData;
120
+ return {
121
+ statement_meta: {
122
+ opening_balance: statementMeta.openingBalance,
123
+ statement_end_date: statementMeta.statementEndDate,
124
+ statement_start_date: statementMeta.statementStartDate,
125
+ total_deposits: statementMeta.totalDeposits,
126
+ total_payments: statementMeta.totalPayments,
127
+ },
128
+ statement_transactions: {
129
+ added: statementTransactions.added.map((txn) => ({
130
+ amount: txn.amount,
131
+ transaction_date: txn.transactionDate,
132
+ transaction_direction: txn.transactionDirection,
133
+ transaction_memo: txn.transactionMemo,
134
+ })),
135
+ deleted_ids: statementTransactions.deletedIds,
136
+ updated: statementTransactions.updated
137
+ .filter((txn) => txn.statementTransactionId != null)
138
+ .map((txn) => ({
139
+ amount: txn.amount,
140
+ statement_transaction_id: txn.statementTransactionId,
141
+ transaction_date: txn.transactionDate,
142
+ transaction_direction: txn.transactionDirection,
143
+ transaction_memo: txn.transactionMemo,
144
+ })),
145
+ },
146
+ };
147
+ }