@zeniai/client-epic-state 4.8.63 → 4.8.64

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 (68) hide show
  1. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  2. package/lib/entity/snackbar/snackbarTypes.js +2 -0
  3. package/lib/entity/tenant/tenantPayload.d.ts +5 -0
  4. package/lib/entity/userRole/userRolePayload.d.ts +5 -0
  5. package/lib/entity/userRole/userRolePayload.js +15 -0
  6. package/lib/entity/userRole/userRoleType.d.ts +18 -3
  7. package/lib/entity/userRole/userRoleType.js +226 -6
  8. package/lib/epic.d.ts +3 -1
  9. package/lib/epic.js +3 -1
  10. package/lib/index.d.ts +14 -12
  11. package/lib/index.js +52 -18
  12. package/lib/view/commonVendorView/vendorView/epics/saveVendorEpic.js +31 -4
  13. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewReducer.d.ts +5 -1
  14. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewReducer.js +18 -2
  15. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.d.ts +14 -0
  16. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.js +36 -4
  17. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewState.d.ts +7 -0
  18. package/lib/view/people/changeZeniPersonRolesEpic.d.ts +1 -1
  19. package/lib/view/people/deletePersonEpic.d.ts +1 -1
  20. package/lib/view/people/invitePeopleEpic.d.ts +1 -1
  21. package/lib/view/people/inviteZeniPeopleEpic.d.ts +1 -1
  22. package/lib/view/people/resendInviteEpic.d.ts +1 -1
  23. package/lib/view/settingsView/epic/fetchNotificationSettingsEpic.d.ts +17 -0
  24. package/lib/view/settingsView/epic/fetchNotificationSettingsEpic.js +23 -0
  25. package/lib/view/settingsView/epic/saveNotificationSettingsEpic.d.ts +31 -0
  26. package/lib/view/settingsView/epic/saveNotificationSettingsEpic.js +70 -0
  27. package/lib/view/settingsView/settingsViewHelpers.d.ts +2 -0
  28. package/lib/view/settingsView/settingsViewHelpers.js +11 -0
  29. package/lib/view/settingsView/settingsViewPayload.d.ts +7 -0
  30. package/lib/view/settingsView/settingsViewReducer.d.ts +7 -2
  31. package/lib/view/settingsView/settingsViewReducer.js +115 -2
  32. package/lib/view/settingsView/settingsViewSelector.d.ts +2 -0
  33. package/lib/view/settingsView/settingsViewSelector.js +4 -1
  34. package/lib/view/settingsView/settingsViewState.d.ts +18 -0
  35. package/lib/view/settingsView/settingsViewState.js +15 -0
  36. package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.d.ts +1 -0
  37. package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +2 -1
  38. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.d.ts +3 -0
  39. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +49 -24
  40. package/lib/view/spendManagement/billPay/editBillView/editBillViewState.d.ts +2 -0
  41. package/lib/view/spendManagement/billPay/editBillView/editBillViewState.js +2 -0
  42. package/lib/view/spendManagement/billPay/editBillView/epics/initializeBillToLocalStoreEpic.js +16 -9
  43. package/lib/view/spendManagement/billPay/editBillView/epics/parseInvoiceToBillEpic.d.ts +1 -1
  44. package/lib/view/spendManagement/billPay/editBillView/epics/parseInvoiceToBillEpic.js +21 -9
  45. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListPayload.d.ts +1 -1
  46. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.d.ts +2 -1
  47. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.js +6 -3
  48. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.d.ts +1 -1
  49. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +9 -6
  50. package/lib/view/spendManagement/chargeCards/chargeCardList/fetchChargeCardListPageEpic.js +6 -3
  51. package/lib/view/spendManagement/helpers.js +11 -4
  52. package/lib/view/taskManager/taskDetailView/epics/saveTaskDetailEpic.js +5 -1
  53. package/lib/view/taskManager/taskDetailView/taskDetailReducer.d.ts +1 -0
  54. package/lib/view/taskManager/taskDetailView/taskDetailReducer.js +8 -6
  55. package/lib/view/taskManager/taskDetailView/taskDetailSelector.d.ts +2 -0
  56. package/lib/view/taskManager/taskDetailView/taskDetailSelector.js +7 -1
  57. package/lib/view/taskManager/taskListView/taskListSelector.js +1 -1
  58. package/lib/view/transactionList/fetchTransactionListByEntityEpic.js +3 -0
  59. package/lib/view/transactionList/transactionListByEntitySelector.d.ts +4 -0
  60. package/lib/view/transactionList/transactionListByEntitySelector.js +62 -1
  61. package/lib/view/transactionList/transactionListReducer.d.ts +2 -1
  62. package/lib/view/transactionList/transactionListReducer.js +2 -2
  63. package/lib/view/vendorReviewView/vendorFirstReviewView/epics/saveVendorFirstReviewViewEpic.js +13 -10
  64. package/lib/view/vendorReviewView/vendorFirstReviewView/vendorFirstReviewViewPayload.d.ts +1 -0
  65. package/lib/view/vendorReviewView/vendorFirstReviewView/vendorFirstReviewViewReducer.d.ts +4 -3
  66. package/lib/view/vendorReviewView/vendorFirstReviewView/vendorFirstReviewViewReducer.js +8 -6
  67. package/lib/zeniAPI.d.ts +1 -0
  68. package/package.json +1 -1
@@ -113,14 +113,16 @@ const taskDetailView = (0, toolkit_1.createSlice)({
113
113
  },
114
114
  },
115
115
  saveTaskSuccessOrFailure(draft, action) {
116
- if (action.payload.taskId != null) {
117
- const { taskId } = action.payload;
118
- draft.editTaskStateById[taskId].saveStatus.fetchState =
119
- action.payload.fetchState;
120
- draft.editTaskStateById[taskId].saveStatus.error = action.payload.error;
116
+ const { taskId, fetchState, error, newTaskId } = action.payload;
117
+ if (taskId != null) {
118
+ draft.editTaskStateById[taskId].saveStatus.fetchState = fetchState;
119
+ draft.editTaskStateById[taskId].saveStatus.error = error;
121
120
  }
122
121
  else {
123
- draft.newTaskState.saveStatus.fetchState = action.payload.fetchState;
122
+ if (newTaskId != null) {
123
+ draft.newTaskState.taskId = newTaskId;
124
+ }
125
+ draft.newTaskState.saveStatus.fetchState = fetchState;
124
126
  draft.newTaskState.saveStatus.error = action.payload.error;
125
127
  }
126
128
  },
@@ -7,6 +7,7 @@ import { File } from '../../../entity/file/fileState';
7
7
  import { UserListSelectorView } from '../../userListView/userListViewSelector';
8
8
  import { EditTaskDetail } from './taskDetail';
9
9
  import { HistoricEvent } from '../../spendManagement/commonHistoryView/commonHistory';
10
+ import { UserAndRole } from '../../companyView/types/userAndRole';
10
11
  export interface TaskDetailSelectorView extends SelectorView {
11
12
  taskDetailView: EditTaskDetail;
12
13
  userList: UserListSelectorView;
@@ -16,6 +17,7 @@ export interface TaskDetailSelectorView extends SelectorView {
16
17
  files: File[];
17
18
  taskHistory: HistoricEvent[];
18
19
  showTaskDetailFormFooter: boolean;
20
+ createdByUser?: UserAndRole;
19
21
  }
20
22
  export declare const getTaskDetail: (state: RootState, taskId?: string | undefined) => TaskDetailSelectorView;
21
23
  export declare const allTaskTags: TaskTag[];
@@ -11,9 +11,10 @@ const fileViewSelector_1 = require("../../fileView/fileViewSelector");
11
11
  const userListViewSelector_1 = require("../../userListView/userListViewSelector");
12
12
  const fileSelector_1 = require("../../../entity/file/fileSelector");
13
13
  const taskSelector_1 = require("../../../entity/task/taskSelector");
14
+ const userAndRole_1 = require("../../companyView/types/userAndRole");
14
15
  const getTaskDetail = (state, taskId) => {
15
16
  var _a;
16
- const { taskDetailState, classListState, classState, fileState, fileViewState, taskState, } = state;
17
+ const { taskDetailState, classListState, classState, fileState, fileViewState, userState, userRoleState, addressState, taskState, } = state;
17
18
  const deleteFileStatusById = {};
18
19
  const updateFileStatusById = {};
19
20
  let showTaskDetailFormFooter = false;
@@ -26,9 +27,13 @@ const getTaskDetail = (state, taskId) => {
26
27
  error: undefined,
27
28
  };
28
29
  let taskHistory = [];
30
+ let createdByUser = undefined;
29
31
  if (taskId != null && sourceTaskDetail != null) {
30
32
  const taskEntity = (0, taskSelector_1.getTaskById)(taskState, taskId);
31
33
  const fileIdsInEntity = (_a = taskEntity === null || taskEntity === void 0 ? void 0 : taskEntity.fileIds) !== null && _a !== void 0 ? _a : [];
34
+ if (taskEntity != null) {
35
+ createdByUser = (0, userAndRole_1.getUserAndUserRole)(userState, userRoleState, addressState, taskEntity.createdBy);
36
+ }
32
37
  if (fileIdsInEntity.length > 0) {
33
38
  fetchStatus = (0, reduceFetchState_1.reduceFetchState)([
34
39
  fileViewState.fetchFilesStatus,
@@ -74,6 +79,7 @@ const getTaskDetail = (state, taskId) => {
74
79
  fetchState: fetchStatus.fetchState,
75
80
  error: fetchStatus.error,
76
81
  version: 0,
82
+ createdByUser,
77
83
  showTaskDetailFormFooter,
78
84
  };
79
85
  };
@@ -46,7 +46,7 @@ const getAllTasks = (state) => {
46
46
  return (_c = task.createdByUser) === null || _c === void 0 ? void 0 : _c.user.firstName;
47
47
  case 'name':
48
48
  default:
49
- return task.name;
49
+ return task.name.toLowerCase();
50
50
  }
51
51
  }, sortOrder);
52
52
  return {
@@ -27,6 +27,9 @@ const fetchTransactionListByEntityEpic = (actions$, state$, zeniAPI) => actions$
27
27
  entity_id: action.payload.entity.id,
28
28
  entity_name: action.payload.entity.name,
29
29
  entity_type: action.payload.entity.type,
30
+ is_fetch_all_transactions: action.payload.isFetchAllTransactions === true
31
+ ? action.payload.isFetchAllTransactions
32
+ : null,
30
33
  };
31
34
  return zeniAPI
32
35
  .getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/transactions?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
@@ -4,9 +4,13 @@ import { SelectorView } from '../../commonStateTypes/viewAndReport/viewAndReport
4
4
  import { Entity } from '../../entity/genericEntity/entity';
5
5
  import { SupportedTransaction, TransactionState } from '../../entity/transaction/transactionState';
6
6
  import { TransactionListSelectorView, TransactionListState } from './transactionListState';
7
+ import { Month, TimePeriod } from '../../commonStateTypes/timePeriod';
8
+ import { RootState } from '../../reducer';
7
9
  export interface TransactionListByEntityView extends SelectorView, TransactionListSelectorView {
8
10
  transactionOrder: EntityOrder;
9
11
  transactions: SupportedTransaction[];
10
12
  entity: Entity;
11
13
  }
12
14
  export declare const getTransactionListByEntity: (transactionState: TransactionState, transactionListState: TransactionListState, filterByTimePeriod: TimeframeTick, entity: Entity) => TransactionListByEntityView;
15
+ export declare const getTransactionListByEntityForSinglePeriod: (state: RootState, entity: Entity, numberOfQuartersFetched: number) => TransactionListByEntityView;
16
+ export declare function splitPeriodIntoQuarters(numberOfQuartersFetched: number, firstMonthOfFY: Month): TimePeriod[];
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getTransactionListByEntity = void 0;
6
+ exports.splitPeriodIntoQuarters = exports.getTransactionListByEntityForSinglePeriod = exports.getTransactionListByEntity = void 0;
7
7
  const flatMap_1 = __importDefault(require("lodash/flatMap"));
8
8
  const get_1 = __importDefault(require("lodash/get"));
9
9
  const orderBy_1 = __importDefault(require("lodash/orderBy"));
@@ -12,6 +12,9 @@ const parallelFetchAccountTransactionListEpic_1 = require("./parallelFetchAccoun
12
12
  const reduceTransactionListFetchState_1 = require("./reduceTransactionListFetchState");
13
13
  const transactionListState_1 = require("./transactionListState");
14
14
  const transactionSelector_1 = require("../../entity/transaction/transactionSelector");
15
+ const tenantSelector_1 = require("../../entity/tenant/tenantSelector");
16
+ const vendorsTabVendorViewSelector_1 = require("../commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector");
17
+ const zeniDayJS_1 = require("../../zeniDayJS");
15
18
  const getTransactionListByEntity = (transactionState, transactionListState, filterByTimePeriod, entity) => {
16
19
  const timePeriods = (0, parallelFetchAccountTransactionListEpic_1.splitPeriod)((0, timeframeTick_1.toTimePeriod)(filterByTimePeriod)); // Note: Split by months.
17
20
  const entityTransactions = timePeriods
@@ -46,3 +49,61 @@ const getTransactionListByEntity = (transactionState, transactionListState, filt
46
49
  };
47
50
  };
48
51
  exports.getTransactionListByEntity = getTransactionListByEntity;
52
+ /*
53
+ NOTE: getTransactionListByEntityForSinglePeriod - this selector is to be used when we are not making parallel fetch
54
+ and thus, do not want to split period month wise - as done in above selector getTransactionListByEntity
55
+ This usecase is on vendors tab detail page, to fetch all transactions tab data
56
+ */
57
+ const getTransactionListByEntityForSinglePeriod = (state, entity, numberOfQuartersFetched) => {
58
+ var _a, _b;
59
+ const { transactionListState, transactionState } = state;
60
+ const firstMonthOfFY = (_b = (_a = (0, tenantSelector_1.getCurrentTenant)(state).company) === null || _a === void 0 ? void 0 : _a.companyInfo.firstMonthOfFY) !== null && _b !== void 0 ? _b : 1;
61
+ const initialFetchPeriod = (0, timeframeTick_1.toTimePeriod)({
62
+ startDate: (0, vendorsTabVendorViewSelector_1.getVendorAllTransactionsDefaultTimePeriod)(firstMonthOfFY, 2)
63
+ .startDate,
64
+ endDate: (0, zeniDayJS_1.dateNow)(),
65
+ });
66
+ const timePeriods = [
67
+ initialFetchPeriod,
68
+ ...splitPeriodIntoQuarters(numberOfQuartersFetched, firstMonthOfFY),
69
+ ];
70
+ const entityTransactions = timePeriods
71
+ .map((thisTimePeriod) => {
72
+ const key = (0, transactionListState_1.getEntityTranKey)(entity, thisTimePeriod);
73
+ return (0, get_1.default)(transactionListState.byEntity.transactionListByEntityKey, key, undefined);
74
+ })
75
+ .filter((eTransaction) => eTransaction != null);
76
+ const fetchState = (0, reduceTransactionListFetchState_1.reduceFetchState)(entityTransactions);
77
+ let transactions = [];
78
+ // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
79
+ if ((0, reduceTransactionListFetchState_1.isAnyFetchCompleted)(entityTransactions)) {
80
+ const allTransactionIDs = (0, flatMap_1.default)(entityTransactions, (value) => value.transactionIDs);
81
+ const transactionsUnsorted = allTransactionIDs
82
+ .map((transactionId) => (0, transactionSelector_1.getSupportedTransactionById)(transactionState, transactionId))
83
+ .filter((value) => {
84
+ if (value == null) {
85
+ console.error("Can't have null transaction at this stage!");
86
+ }
87
+ return value != null;
88
+ });
89
+ transactions = (0, orderBy_1.default)(transactionsUnsorted, (value) => value.date.valueOf(), 'desc');
90
+ }
91
+ return {
92
+ version: '1.0',
93
+ fetchState: fetchState.fetchState,
94
+ error: fetchState.error,
95
+ entity: entity,
96
+ transactionOrder: 'descending_transaction_date',
97
+ transactions,
98
+ latestTransactionId: transactionListState.latestTransactionId,
99
+ };
100
+ };
101
+ exports.getTransactionListByEntityForSinglePeriod = getTransactionListByEntityForSinglePeriod;
102
+ function splitPeriodIntoQuarters(numberOfQuartersFetched, firstMonthOfFY) {
103
+ const result = [];
104
+ for (let index = 0; index <= numberOfQuartersFetched - 1; index++) {
105
+ result.push((0, timeframeTick_1.toTimePeriod)((0, vendorsTabVendorViewSelector_1.getVendorAllTransactionsDefaultTimePeriod)(firstMonthOfFY, index)));
106
+ }
107
+ return result;
108
+ }
109
+ exports.splitPeriodIntoQuarters = splitPeriodIntoQuarters;
@@ -32,10 +32,11 @@ export declare const parallelFetchAccountTransactionList: import("@reduxjs/toolk
32
32
  entity: Entity;
33
33
  period: TimePeriod;
34
34
  cacheOverride: any;
35
- }, string, never, never>, fetchEntityTransactionList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[entity: Entity, period: TimePeriod, cacheOverride?: any], {
35
+ }, string, never, never>, fetchEntityTransactionList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[entity: Entity, period: TimePeriod, cacheOverride?: any, isFetchAllTransactions?: any], {
36
36
  entity: Entity;
37
37
  period: TimePeriod;
38
38
  cacheOverride: any;
39
+ isFetchAllTransactions: any;
39
40
  }, string, never, never>, updateTransactionListByEntity: import("@reduxjs/toolkit").ActionCreatorWithPayload<TransactionListByEntityPayload, string>, updateTransactionListByEntityFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[entity: Entity, period: TimePeriod, error: ZeniAPIStatus<Record<string, unknown>>], {
40
41
  entity: Entity;
41
42
  period: TimePeriod;
@@ -143,9 +143,9 @@ const transactionList = (0, toolkit_1.createSlice)({
143
143
  draft.byEntity.transactionListByEntityKey[key] = Object.assign(Object.assign({}, transactionListState_1.initialEntityTransactionState), { fetchState: 'In-Progress', error: undefined });
144
144
  }
145
145
  },
146
- prepare(entity, period, cacheOverride = false) {
146
+ prepare(entity, period, cacheOverride = false, isFetchAllTransactions = false) {
147
147
  return {
148
- payload: { entity, period, cacheOverride },
148
+ payload: { entity, period, cacheOverride, isFetchAllTransactions },
149
149
  };
150
150
  },
151
151
  },
@@ -21,12 +21,12 @@ const fetchVendorFirstReviewViewEpic_1 = require("./fetchVendorFirstReviewViewEp
21
21
  const globalMerchantSelector_1 = require("../../../../entity/globalMerchant/globalMerchantSelector");
22
22
  const saveVendorFirstReviewViewEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(vendorFirstReviewViewReducer_1.saveVendorFirstReviewView.match), (0, operators_1.mergeMap)((action) => {
23
23
  const { vendorFirstReviewViewState, globalMerchantState, vendorState } = state$.value;
24
- const { vendorId } = action.payload;
24
+ const { vendorId, markAsEmployee } = action.payload;
25
25
  const currentVendorLocalData = vendorFirstReviewViewState.vendorFirstReviewViewLocalDataById[vendorId]
26
26
  .vendorFirstReviewViewLocalData;
27
27
  const currentVendor = (0, vendorSelector_1.getVendorByVendorId)(state$.value.vendorState, vendorId);
28
28
  const { vendorName, selectedGlobalMerchant, recommendations, nonExistingRecommendations, } = getSaveVendorFirstReviewViewPayloadDetails(currentVendorLocalData, globalMerchantState, vendorState);
29
- const payload = Object.assign({}, prepareSaveVendorFirstReviewViewPayload(vendorName, recommendations, nonExistingRecommendations, currentVendor === null || currentVendor === void 0 ? void 0 : currentVendor.qboId, selectedGlobalMerchant));
29
+ const payload = Object.assign({}, prepareSaveVendorFirstReviewViewPayload(vendorName, recommendations, nonExistingRecommendations, markAsEmployee, currentVendor === null || currentVendor === void 0 ? void 0 : currentVendor.qboId, selectedGlobalMerchant));
30
30
  const queryParam = {
31
31
  view: 'merchant_review_list',
32
32
  };
@@ -45,7 +45,7 @@ const saveVendorFirstReviewViewEpic = (actions$, state$, zeniAPI) => actions$.pi
45
45
  vendorId,
46
46
  vendors: (_d = response.data.vendors) !== null && _d !== void 0 ? _d : [],
47
47
  }));
48
- actions.push((0, vendorFirstReviewViewReducer_1.saveVendorFirstReviewViewSuccessOrFailure)('Completed', action.payload.vendorId, response.status, (_e = response.data.vendors) === null || _e === void 0 ? void 0 : _e[0].status));
48
+ actions.push((0, vendorFirstReviewViewReducer_1.saveVendorFirstReviewViewSuccessOrFailure)('Completed', action.payload.vendorId, markAsEmployee, response.status, (_e = response.data.vendors) === null || _e === void 0 ? void 0 : _e[0].status));
49
49
  if (currentVendor != null) {
50
50
  if (((_f = response.data.vendors) === null || _f === void 0 ? void 0 : _f[0].status.code) === 'reviewed') {
51
51
  actions.push((0, snackbarReducer_1.openSnackbar)({
@@ -66,9 +66,11 @@ const saveVendorFirstReviewViewEpic = (actions$, state$, zeniAPI) => actions$.pi
66
66
  }
67
67
  else {
68
68
  actions.push((0, snackbarReducer_1.openSnackbar)({
69
- messageSection: 'save_vendor_sent_for_review',
69
+ messageSection: payload.is_employee === true
70
+ ? 'save_vendor_marked_as_employee'
71
+ : 'save_vendor_sent_for_review',
70
72
  messageText: 'success',
71
- type: 'info',
73
+ type: payload.is_employee === true ? 'success' : 'info',
72
74
  variables: [
73
75
  {
74
76
  variableName: '_vendor_name_',
@@ -86,7 +88,7 @@ const saveVendorFirstReviewViewEpic = (actions$, state$, zeniAPI) => actions$.pi
86
88
  vendorId,
87
89
  vendors: (_g = response.data.vendors) !== null && _g !== void 0 ? _g : [],
88
90
  }));
89
- actions.push((0, vendorFirstReviewViewReducer_1.saveVendorFirstReviewViewSuccessOrFailure)('Error', action.payload.vendorId, response.status));
91
+ actions.push((0, vendorFirstReviewViewReducer_1.saveVendorFirstReviewViewSuccessOrFailure)('Error', action.payload.vendorId, markAsEmployee, response.status));
90
92
  actions.push((0, vendorReducer_1.updateVendors)((0, fetchVendorFirstReviewViewEpic_1.mapVendorsPayloadFromVendorFirstReviewViewResponse)((_h = response.data.vendors) !== null && _h !== void 0 ? _h : [])), (0, userReducer_1.updateAllUsers)({
91
93
  users: (0, fetchVendorFirstReviewViewEpic_1.mapUsersPayloadFromVendorFirstReviewViewResponse)((_j = response.data.vendors) !== null && _j !== void 0 ? _j : []),
92
94
  updateType: 'merge',
@@ -123,7 +125,7 @@ const saveVendorFirstReviewViewEpic = (actions$, state$, zeniAPI) => actions$.pi
123
125
  return (0, rxjs_1.from)(actions);
124
126
  }
125
127
  else {
126
- return (0, rxjs_1.of)((0, vendorFirstReviewViewReducer_1.saveVendorFirstReviewViewSuccessOrFailure)('Error', action.payload.vendorId, response.status), (0, snackbarReducer_1.openSnackbar)({
128
+ return (0, rxjs_1.of)((0, vendorFirstReviewViewReducer_1.saveVendorFirstReviewViewSuccessOrFailure)('Error', action.payload.vendorId, markAsEmployee, response.status), (0, snackbarReducer_1.openSnackbar)({
127
129
  messageSection: 'save_vendor_sent_for_review',
128
130
  messageText: 'failed',
129
131
  type: 'error',
@@ -135,13 +137,13 @@ const saveVendorFirstReviewViewEpic = (actions$, state$, zeniAPI) => actions$.pi
135
137
  ],
136
138
  }));
137
139
  }
138
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, vendorFirstReviewViewReducer_1.saveVendorFirstReviewViewSuccessOrFailure)('Error', action.payload.vendorId, (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', `Save Vendor First Review View REST API call errored out ${JSON.stringify(error)}`)))));
140
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, vendorFirstReviewViewReducer_1.saveVendorFirstReviewViewSuccessOrFailure)('Error', action.payload.vendorId, markAsEmployee, (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', `Save Vendor First Review View REST API call errored out ${JSON.stringify(error)}`)))));
139
141
  }));
140
142
  exports.saveVendorFirstReviewViewEpic = saveVendorFirstReviewViewEpic;
141
143
  /**
142
144
  * Helpers
143
145
  */
144
- const prepareSaveVendorFirstReviewViewPayload = (vendorName, recommendations, nonExistingRecommendations, vendorQboId, selectedGlobalMerchant) => {
146
+ const prepareSaveVendorFirstReviewViewPayload = (vendorName, recommendations, nonExistingRecommendations, markAsEmployee, vendorQboId, selectedGlobalMerchant) => {
145
147
  const selectedGlobalMerchantBase = (selectedGlobalMerchant === null || selectedGlobalMerchant === void 0 ? void 0 : selectedGlobalMerchant.globalMerchantId) != null
146
148
  ? (0, omit_1.default)((0, globalMerchantPayload_1.toGlobalMerchantBasePayload)(selectedGlobalMerchant), ['create_time', 'update_time'])
147
149
  : selectedGlobalMerchant != null
@@ -150,8 +152,9 @@ const prepareSaveVendorFirstReviewViewPayload = (vendorName, recommendations, no
150
152
  const payload = {
151
153
  vendor_name: vendorName,
152
154
  qbo_id: vendorQboId !== null && vendorQboId !== void 0 ? vendorQboId : null,
153
- selected_global_merchant: selectedGlobalMerchantBase,
155
+ selected_global_merchant: markAsEmployee === true ? null : selectedGlobalMerchantBase,
154
156
  recommendations: (0, commonTypes_2.toVendorReviewViewRecommendationPayload)(recommendations, nonExistingRecommendations),
157
+ is_employee: markAsEmployee,
155
158
  };
156
159
  return payload;
157
160
  };
@@ -47,6 +47,7 @@ export interface SaveVendorFirstReviewViewQueryPayload {
47
47
  vendor_name: string;
48
48
  qbo_id: string | null;
49
49
  selected_global_merchant: AllGlobalMerchantBasePayload | null;
50
+ is_employee: boolean;
50
51
  recommendations: VendorReviewViewAllRecommendationsPayload;
51
52
  }
52
53
  export declare type SaveVendorFirstReviewResponse = ZeniAPIResponse<SaveVendorFirstReviewView>;
@@ -18,9 +18,9 @@ export declare const fetchVendorFirstReviewView: import("@reduxjs/toolkit").Acti
18
18
  scrollYOffset: number;
19
19
  }, string>, updateVendorFirstReviewViewPageToken: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
20
20
  pageToken: PageToken;
21
- }, string>, saveVendorFirstReviewView: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[vendorId: string, vendorName?: string | undefined], {
21
+ }, string>, saveVendorFirstReviewView: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[vendorId: string, markAsEmployee?: any], {
22
22
  vendorId: string;
23
- vendorName: string | undefined;
23
+ markAsEmployee: any;
24
24
  }, string, never, never>, updateVendorFirstReviewSortUiState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
25
25
  sortOrder: SortOrder;
26
26
  sortkey: VendorFirstReviewViewColumnKey;
@@ -40,9 +40,10 @@ export declare const fetchVendorFirstReviewView: import("@reduxjs/toolkit").Acti
40
40
  isQBOMergeError: boolean;
41
41
  oldRecommendation?: RecommendedNonExistingGlobalMerchant | undefined;
42
42
  newRecommendation?: RecommendedNonExistingGlobalMerchant | undefined;
43
- }, string>, clearRecentlySavedErroredVendorData: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, saveVendorFirstReviewViewSuccessOrFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[fetchState: FetchState, vendorId: string, error?: ZeniAPIStatus<Record<string, unknown>> | undefined, reviewStatus?: ReviewStatusPayload | undefined], {
43
+ }, string>, clearRecentlySavedErroredVendorData: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, saveVendorFirstReviewViewSuccessOrFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[fetchState: FetchState, vendorId: string, markAsEmployee: boolean, error?: ZeniAPIStatus<Record<string, unknown>> | undefined, reviewStatus?: ReviewStatusPayload | undefined], {
44
44
  fetchState: FetchState;
45
45
  vendorId: string;
46
+ markAsEmployee: boolean;
46
47
  error: ZeniAPIStatus<Record<string, unknown>> | undefined;
47
48
  reviewStatus: ReviewStatusPayload | undefined;
48
49
  }, string, never, never>;
@@ -141,11 +141,11 @@ const vendorFirstReviewView = (0, toolkit_1.createSlice)({
141
141
  error: undefined,
142
142
  } });
143
143
  },
144
- prepare(vendorId, vendorName) {
144
+ prepare(vendorId, markAsEmployee = false) {
145
145
  return {
146
146
  payload: {
147
147
  vendorId,
148
- vendorName,
148
+ markAsEmployee,
149
149
  },
150
150
  };
151
151
  },
@@ -182,18 +182,20 @@ const vendorFirstReviewView = (0, toolkit_1.createSlice)({
182
182
  draft.vendorFirstReviewViewLocalDataById[vendorId].saveStatus.fetchState = action.payload.fetchState;
183
183
  draft.vendorFirstReviewViewLocalDataById[vendorId].saveStatus.error =
184
184
  action.payload.error;
185
- // Note: We need to delete vendor local data when save is success with status code 'reviewed'
185
+ const status = action.payload.reviewStatus != null &&
186
+ (0, commonTypes_1.toVendorFirstReviewViewStatusesTypeStrict)(action.payload.reviewStatus.code);
187
+ // Note: We need to delete vendor local data when save is success with status code 'reviewed' OR it is marked as en employee
186
188
  if (action.payload.fetchState === 'Completed' &&
187
- action.payload.reviewStatus != null &&
188
- (0, commonTypes_1.toVendorFirstReviewViewStatusesTypeStrict)(action.payload.reviewStatus.code) === 'reviewed') {
189
+ (status === 'reviewed' || action.payload.markAsEmployee)) {
189
190
  delete draft.vendorFirstReviewViewLocalDataById[vendorId];
190
191
  }
191
192
  },
192
- prepare(fetchState, vendorId, error, reviewStatus) {
193
+ prepare(fetchState, vendorId, markAsEmployee, error, reviewStatus) {
193
194
  return {
194
195
  payload: {
195
196
  fetchState,
196
197
  vendorId,
198
+ markAsEmployee,
197
199
  error,
198
200
  reviewStatus,
199
201
  },
package/lib/zeniAPI.d.ts CHANGED
@@ -15,6 +15,7 @@ export interface RESTAPIEndpoints {
15
15
  readonly approvalMicroServiceBaseUrl: string;
16
16
  readonly cardMicroServiceBaseUrl: string;
17
17
  readonly taskMicroServiceBaseUrl: string;
18
+ readonly notificationMicroServiceBaseUrl: string;
18
19
  }
19
20
  export interface ZeniAPI<ResponseType = FetchResponse> {
20
21
  readonly apiEndPoints: RESTAPIEndpoints;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.8.63",
3
+ "version": "4.8.64",
4
4
  "description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",