@zeniai/client-epic-state 4.8.62 → 4.8.63

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 (69) hide show
  1. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  2. package/lib/entity/snackbar/snackbarTypes.js +0 -2
  3. package/lib/entity/tenant/tenantPayload.d.ts +0 -5
  4. package/lib/entity/userRole/userRolePayload.d.ts +0 -5
  5. package/lib/entity/userRole/userRolePayload.js +0 -15
  6. package/lib/entity/userRole/userRoleType.d.ts +3 -18
  7. package/lib/entity/userRole/userRoleType.js +6 -226
  8. package/lib/epic.d.ts +1 -3
  9. package/lib/epic.js +1 -3
  10. package/lib/index.d.ts +12 -14
  11. package/lib/index.js +18 -52
  12. package/lib/view/commonVendorView/vendorView/epics/saveVendorEpic.js +4 -31
  13. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewReducer.d.ts +1 -5
  14. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewReducer.js +2 -18
  15. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.d.ts +0 -14
  16. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.js +4 -36
  17. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewState.d.ts +0 -7
  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/scheduleView/scheduleListView/scheduleListReducer.js +6 -9
  24. package/lib/view/settingsView/settingsViewPayload.d.ts +0 -7
  25. package/lib/view/settingsView/settingsViewReducer.d.ts +2 -7
  26. package/lib/view/settingsView/settingsViewReducer.js +2 -115
  27. package/lib/view/settingsView/settingsViewSelector.d.ts +0 -2
  28. package/lib/view/settingsView/settingsViewSelector.js +1 -4
  29. package/lib/view/settingsView/settingsViewState.d.ts +0 -18
  30. package/lib/view/settingsView/settingsViewState.js +0 -15
  31. package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.d.ts +0 -1
  32. package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +1 -2
  33. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.d.ts +0 -3
  34. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +24 -49
  35. package/lib/view/spendManagement/billPay/editBillView/editBillViewState.d.ts +0 -2
  36. package/lib/view/spendManagement/billPay/editBillView/editBillViewState.js +0 -2
  37. package/lib/view/spendManagement/billPay/editBillView/epics/initializeBillToLocalStoreEpic.js +9 -16
  38. package/lib/view/spendManagement/billPay/editBillView/epics/parseInvoiceToBillEpic.d.ts +1 -1
  39. package/lib/view/spendManagement/billPay/editBillView/epics/parseInvoiceToBillEpic.js +9 -21
  40. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListPayload.d.ts +1 -1
  41. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.d.ts +1 -2
  42. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.js +3 -6
  43. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.d.ts +1 -1
  44. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +6 -9
  45. package/lib/view/spendManagement/chargeCards/chargeCardList/fetchChargeCardListPageEpic.js +3 -6
  46. package/lib/view/spendManagement/helpers.js +4 -11
  47. package/lib/view/taskManager/taskDetailView/epics/saveTaskDetailEpic.js +1 -5
  48. package/lib/view/taskManager/taskDetailView/taskDetailReducer.d.ts +0 -1
  49. package/lib/view/taskManager/taskDetailView/taskDetailReducer.js +6 -8
  50. package/lib/view/taskManager/taskDetailView/taskDetailSelector.d.ts +0 -2
  51. package/lib/view/taskManager/taskDetailView/taskDetailSelector.js +1 -7
  52. package/lib/view/taskManager/taskListView/taskListSelector.js +1 -1
  53. package/lib/view/transactionList/fetchTransactionListByEntityEpic.js +0 -3
  54. package/lib/view/transactionList/transactionListByEntitySelector.d.ts +0 -4
  55. package/lib/view/transactionList/transactionListByEntitySelector.js +1 -62
  56. package/lib/view/transactionList/transactionListReducer.d.ts +1 -2
  57. package/lib/view/transactionList/transactionListReducer.js +2 -2
  58. package/lib/view/vendorReviewView/vendorFirstReviewView/epics/saveVendorFirstReviewViewEpic.js +10 -13
  59. package/lib/view/vendorReviewView/vendorFirstReviewView/vendorFirstReviewViewPayload.d.ts +0 -1
  60. package/lib/view/vendorReviewView/vendorFirstReviewView/vendorFirstReviewViewReducer.d.ts +3 -4
  61. package/lib/view/vendorReviewView/vendorFirstReviewView/vendorFirstReviewViewReducer.js +6 -8
  62. package/lib/zeniAPI.d.ts +0 -1
  63. package/package.json +1 -1
  64. package/lib/view/settingsView/epic/fetchNotificationSettingsEpic.d.ts +0 -17
  65. package/lib/view/settingsView/epic/fetchNotificationSettingsEpic.js +0 -23
  66. package/lib/view/settingsView/epic/saveNotificationSettingsEpic.d.ts +0 -31
  67. package/lib/view/settingsView/epic/saveNotificationSettingsEpic.js +0 -70
  68. package/lib/view/settingsView/settingsViewHelpers.d.ts +0 -2
  69. package/lib/view/settingsView/settingsViewHelpers.js +0 -11
@@ -11,10 +11,9 @@ 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");
15
14
  const getTaskDetail = (state, taskId) => {
16
15
  var _a;
17
- const { taskDetailState, classListState, classState, fileState, fileViewState, userState, userRoleState, addressState, taskState, } = state;
16
+ const { taskDetailState, classListState, classState, fileState, fileViewState, taskState, } = state;
18
17
  const deleteFileStatusById = {};
19
18
  const updateFileStatusById = {};
20
19
  let showTaskDetailFormFooter = false;
@@ -27,13 +26,9 @@ const getTaskDetail = (state, taskId) => {
27
26
  error: undefined,
28
27
  };
29
28
  let taskHistory = [];
30
- let createdByUser = undefined;
31
29
  if (taskId != null && sourceTaskDetail != null) {
32
30
  const taskEntity = (0, taskSelector_1.getTaskById)(taskState, taskId);
33
31
  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
- }
37
32
  if (fileIdsInEntity.length > 0) {
38
33
  fetchStatus = (0, reduceFetchState_1.reduceFetchState)([
39
34
  fileViewState.fetchFilesStatus,
@@ -79,7 +74,6 @@ const getTaskDetail = (state, taskId) => {
79
74
  fetchState: fetchStatus.fetchState,
80
75
  error: fetchStatus.error,
81
76
  version: 0,
82
- createdByUser,
83
77
  showTaskDetailFormFooter,
84
78
  };
85
79
  };
@@ -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.toLowerCase();
49
+ return task.name;
50
50
  }
51
51
  }, sortOrder);
52
52
  return {
@@ -27,9 +27,6 @@ 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,
33
30
  };
34
31
  return zeniAPI
35
32
  .getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/transactions?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
@@ -4,13 +4,9 @@ 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';
9
7
  export interface TransactionListByEntityView extends SelectorView, TransactionListSelectorView {
10
8
  transactionOrder: EntityOrder;
11
9
  transactions: SupportedTransaction[];
12
10
  entity: Entity;
13
11
  }
14
12
  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.splitPeriodIntoQuarters = exports.getTransactionListByEntityForSinglePeriod = exports.getTransactionListByEntity = void 0;
6
+ 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,9 +12,6 @@ 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");
18
15
  const getTransactionListByEntity = (transactionState, transactionListState, filterByTimePeriod, entity) => {
19
16
  const timePeriods = (0, parallelFetchAccountTransactionListEpic_1.splitPeriod)((0, timeframeTick_1.toTimePeriod)(filterByTimePeriod)); // Note: Split by months.
20
17
  const entityTransactions = timePeriods
@@ -49,61 +46,3 @@ const getTransactionListByEntity = (transactionState, transactionListState, filt
49
46
  };
50
47
  };
51
48
  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,11 +32,10 @@ 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, isFetchAllTransactions?: any], {
35
+ }, string, never, never>, fetchEntityTransactionList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[entity: Entity, period: TimePeriod, cacheOverride?: any], {
36
36
  entity: Entity;
37
37
  period: TimePeriod;
38
38
  cacheOverride: any;
39
- isFetchAllTransactions: any;
40
39
  }, string, never, never>, updateTransactionListByEntity: import("@reduxjs/toolkit").ActionCreatorWithPayload<TransactionListByEntityPayload, string>, updateTransactionListByEntityFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[entity: Entity, period: TimePeriod, error: ZeniAPIStatus<Record<string, unknown>>], {
41
40
  entity: Entity;
42
41
  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, isFetchAllTransactions = false) {
146
+ prepare(entity, period, cacheOverride = false) {
147
147
  return {
148
- payload: { entity, period, cacheOverride, isFetchAllTransactions },
148
+ payload: { entity, period, cacheOverride },
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, markAsEmployee } = action.payload;
24
+ const { vendorId } = 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, markAsEmployee, currentVendor === null || currentVendor === void 0 ? void 0 : currentVendor.qboId, selectedGlobalMerchant));
29
+ const payload = Object.assign({}, prepareSaveVendorFirstReviewViewPayload(vendorName, recommendations, nonExistingRecommendations, 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, markAsEmployee, 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, 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,11 +66,9 @@ const saveVendorFirstReviewViewEpic = (actions$, state$, zeniAPI) => actions$.pi
66
66
  }
67
67
  else {
68
68
  actions.push((0, snackbarReducer_1.openSnackbar)({
69
- messageSection: payload.is_employee === true
70
- ? 'save_vendor_marked_as_employee'
71
- : 'save_vendor_sent_for_review',
69
+ messageSection: 'save_vendor_sent_for_review',
72
70
  messageText: 'success',
73
- type: payload.is_employee === true ? 'success' : 'info',
71
+ type: 'info',
74
72
  variables: [
75
73
  {
76
74
  variableName: '_vendor_name_',
@@ -88,7 +86,7 @@ const saveVendorFirstReviewViewEpic = (actions$, state$, zeniAPI) => actions$.pi
88
86
  vendorId,
89
87
  vendors: (_g = response.data.vendors) !== null && _g !== void 0 ? _g : [],
90
88
  }));
91
- actions.push((0, vendorFirstReviewViewReducer_1.saveVendorFirstReviewViewSuccessOrFailure)('Error', action.payload.vendorId, markAsEmployee, response.status));
89
+ actions.push((0, vendorFirstReviewViewReducer_1.saveVendorFirstReviewViewSuccessOrFailure)('Error', action.payload.vendorId, response.status));
92
90
  actions.push((0, vendorReducer_1.updateVendors)((0, fetchVendorFirstReviewViewEpic_1.mapVendorsPayloadFromVendorFirstReviewViewResponse)((_h = response.data.vendors) !== null && _h !== void 0 ? _h : [])), (0, userReducer_1.updateAllUsers)({
93
91
  users: (0, fetchVendorFirstReviewViewEpic_1.mapUsersPayloadFromVendorFirstReviewViewResponse)((_j = response.data.vendors) !== null && _j !== void 0 ? _j : []),
94
92
  updateType: 'merge',
@@ -125,7 +123,7 @@ const saveVendorFirstReviewViewEpic = (actions$, state$, zeniAPI) => actions$.pi
125
123
  return (0, rxjs_1.from)(actions);
126
124
  }
127
125
  else {
128
- return (0, rxjs_1.of)((0, vendorFirstReviewViewReducer_1.saveVendorFirstReviewViewSuccessOrFailure)('Error', action.payload.vendorId, markAsEmployee, response.status), (0, snackbarReducer_1.openSnackbar)({
126
+ return (0, rxjs_1.of)((0, vendorFirstReviewViewReducer_1.saveVendorFirstReviewViewSuccessOrFailure)('Error', action.payload.vendorId, response.status), (0, snackbarReducer_1.openSnackbar)({
129
127
  messageSection: 'save_vendor_sent_for_review',
130
128
  messageText: 'failed',
131
129
  type: 'error',
@@ -137,13 +135,13 @@ const saveVendorFirstReviewViewEpic = (actions$, state$, zeniAPI) => actions$.pi
137
135
  ],
138
136
  }));
139
137
  }
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)}`)))));
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)}`)))));
141
139
  }));
142
140
  exports.saveVendorFirstReviewViewEpic = saveVendorFirstReviewViewEpic;
143
141
  /**
144
142
  * Helpers
145
143
  */
146
- const prepareSaveVendorFirstReviewViewPayload = (vendorName, recommendations, nonExistingRecommendations, markAsEmployee, vendorQboId, selectedGlobalMerchant) => {
144
+ const prepareSaveVendorFirstReviewViewPayload = (vendorName, recommendations, nonExistingRecommendations, vendorQboId, selectedGlobalMerchant) => {
147
145
  const selectedGlobalMerchantBase = (selectedGlobalMerchant === null || selectedGlobalMerchant === void 0 ? void 0 : selectedGlobalMerchant.globalMerchantId) != null
148
146
  ? (0, omit_1.default)((0, globalMerchantPayload_1.toGlobalMerchantBasePayload)(selectedGlobalMerchant), ['create_time', 'update_time'])
149
147
  : selectedGlobalMerchant != null
@@ -152,9 +150,8 @@ const prepareSaveVendorFirstReviewViewPayload = (vendorName, recommendations, no
152
150
  const payload = {
153
151
  vendor_name: vendorName,
154
152
  qbo_id: vendorQboId !== null && vendorQboId !== void 0 ? vendorQboId : null,
155
- selected_global_merchant: markAsEmployee === true ? null : selectedGlobalMerchantBase,
153
+ selected_global_merchant: selectedGlobalMerchantBase,
156
154
  recommendations: (0, commonTypes_2.toVendorReviewViewRecommendationPayload)(recommendations, nonExistingRecommendations),
157
- is_employee: markAsEmployee,
158
155
  };
159
156
  return payload;
160
157
  };
@@ -47,7 +47,6 @@ 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;
51
50
  recommendations: VendorReviewViewAllRecommendationsPayload;
52
51
  }
53
52
  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, markAsEmployee?: any], {
21
+ }, string>, saveVendorFirstReviewView: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[vendorId: string, vendorName?: string | undefined], {
22
22
  vendorId: string;
23
- markAsEmployee: any;
23
+ vendorName: string | undefined;
24
24
  }, string, never, never>, updateVendorFirstReviewSortUiState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
25
25
  sortOrder: SortOrder;
26
26
  sortkey: VendorFirstReviewViewColumnKey;
@@ -40,10 +40,9 @@ 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, markAsEmployee: boolean, 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, error?: ZeniAPIStatus<Record<string, unknown>> | undefined, reviewStatus?: ReviewStatusPayload | undefined], {
44
44
  fetchState: FetchState;
45
45
  vendorId: string;
46
- markAsEmployee: boolean;
47
46
  error: ZeniAPIStatus<Record<string, unknown>> | undefined;
48
47
  reviewStatus: ReviewStatusPayload | undefined;
49
48
  }, string, never, never>;
@@ -141,11 +141,11 @@ const vendorFirstReviewView = (0, toolkit_1.createSlice)({
141
141
  error: undefined,
142
142
  } });
143
143
  },
144
- prepare(vendorId, markAsEmployee = false) {
144
+ prepare(vendorId, vendorName) {
145
145
  return {
146
146
  payload: {
147
147
  vendorId,
148
- markAsEmployee,
148
+ vendorName,
149
149
  },
150
150
  };
151
151
  },
@@ -182,20 +182,18 @@ 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
- 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
185
+ // Note: We need to delete vendor local data when save is success with status code 'reviewed'
188
186
  if (action.payload.fetchState === 'Completed' &&
189
- (status === 'reviewed' || action.payload.markAsEmployee)) {
187
+ action.payload.reviewStatus != null &&
188
+ (0, commonTypes_1.toVendorFirstReviewViewStatusesTypeStrict)(action.payload.reviewStatus.code) === 'reviewed') {
190
189
  delete draft.vendorFirstReviewViewLocalDataById[vendorId];
191
190
  }
192
191
  },
193
- prepare(fetchState, vendorId, markAsEmployee, error, reviewStatus) {
192
+ prepare(fetchState, vendorId, error, reviewStatus) {
194
193
  return {
195
194
  payload: {
196
195
  fetchState,
197
196
  vendorId,
198
- markAsEmployee,
199
197
  error,
200
198
  reviewStatus,
201
199
  },
package/lib/zeniAPI.d.ts CHANGED
@@ -15,7 +15,6 @@ export interface RESTAPIEndpoints {
15
15
  readonly approvalMicroServiceBaseUrl: string;
16
16
  readonly cardMicroServiceBaseUrl: string;
17
17
  readonly taskMicroServiceBaseUrl: string;
18
- readonly notificationMicroServiceBaseUrl: string;
19
18
  }
20
19
  export interface ZeniAPI<ResponseType = FetchResponse> {
21
20
  readonly apiEndPoints: RESTAPIEndpoints;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.8.62",
3
+ "version": "4.8.63",
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",
@@ -1,17 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { fetchNotificationSettings, updateNotificationSettingsOnSuccess, updateNotificationSettingsOnFailure } from '../settingsViewReducer';
3
- import { ZeniAPI } from '../../../zeniAPI';
4
- import { RootState } from '../../../reducer';
5
- export declare type ActionType = ReturnType<typeof fetchNotificationSettings> | ReturnType<typeof updateNotificationSettingsOnSuccess> | ReturnType<typeof updateNotificationSettingsOnFailure>;
6
- export declare const fetchNotificationSettingsEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
7
- payload: undefined;
8
- type: string;
9
- } | {
10
- payload: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>>;
11
- type: string;
12
- } | {
13
- payload: {
14
- data: import("../settingsViewPayload").NotificationSettingsPayload;
15
- };
16
- type: string;
17
- }>;
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fetchNotificationSettingsEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const settingsViewReducer_1 = require("../settingsViewReducer");
7
- const responsePayload_1 = require("../../../responsePayload");
8
- const fetchNotificationSettingsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(settingsViewReducer_1.fetchNotificationSettings.match), (0, operators_1.switchMap)(() => {
9
- const URL = `${zeniAPI.apiEndPoints.notificationMicroServiceBaseUrl}/1.0/notification-preferences`;
10
- return zeniAPI.getJSON(URL).pipe((0, operators_1.mergeMap)((response) => {
11
- if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
12
- const updateActions = [
13
- (0, settingsViewReducer_1.updateNotificationSettingsOnSuccess)(response.data),
14
- ];
15
- return (0, rxjs_1.of)(...updateActions);
16
- }
17
- else {
18
- return (0, rxjs_1.of)((0, settingsViewReducer_1.updateNotificationSettingsOnFailure)(response.status));
19
- }
20
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, settingsViewReducer_1.updateNotificationSettingsOnFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'Fetch Notification Settings REST API call errored out' +
21
- JSON.stringify(error))))));
22
- }));
23
- exports.fetchNotificationSettingsEpic = fetchNotificationSettingsEpic;
@@ -1,31 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { saveNotificationSettings, updateNotificationSettingsOnSaveFailure, updateNotificationSettingsOnSaveSuccess } from '../settingsViewReducer';
3
- import { ZeniAPI } from '../../../zeniAPI';
4
- import { RootState } from '../../../reducer';
5
- import { NotificationSettingsPayload } from '../settingsViewPayload';
6
- import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
7
- export declare type ActionType = ReturnType<typeof saveNotificationSettings> | ReturnType<typeof openSnackbar> | ReturnType<typeof updateNotificationSettingsOnSaveSuccess> | ReturnType<typeof updateNotificationSettingsOnSaveFailure>;
8
- export declare const saveNotificationSettingsEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
9
- payload: undefined;
10
- type: string;
11
- } | {
12
- payload: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>>;
13
- type: string;
14
- } | {
15
- payload: {
16
- data: NotificationSettingsPayload;
17
- };
18
- type: string;
19
- } | {
20
- payload: {
21
- messageSection: "common" | "transactionDetails_updatingPastTransactions" | "transactionDetails_transactionUpdated" | "cockpit_monthEndEmailSent" | "cockpit_monthEndEmailSave" | "people_invite_people" | "people_invite_multiple_people" | "people_delete_person" | "people_update_person" | "reimbursement_updated" | "reimbursement_deleted" | "reimbursement_cancelled_deleted" | "reimbursement_cancelled" | "reimbursement_approved" | "reimbursement_rejected" | "reimbursement_sent_for_approval" | "account_added" | "business_verification_save" | "business_verification_submit" | "business_verification_from_bills_submit" | "plaid_connection" | "unlink_deposit_account" | "reimbursement_setup" | "reimbursement_approval_create" | "reimbursement_duplicate_approval_create" | "reimbursement_approval_update" | "reimbursement_duplicate_approval_update" | "reimbursement_approval_delete" | "reimbursement_create_mileage" | "reimbursement_update_mileage" | "reimbursement_accept_term" | "reimbursement_accept_employee_term" | "bill_pay_setup" | "zeni_accounts_setup" | "bill_pay_approval_create" | "bill_pay_duplicate_approval_create" | "bill_pay_approval_update" | "bill_pay_duplicate_approval_update" | "bill_pay_approval_delete" | "bill_pay_updated" | "bill_pay_deleted" | "bill_pay_cancelled_deleted" | "bill_pay_cancelled" | "bill_pay_approved" | "real_time_approver_added" | "bill_pay_rejected" | "bill_pay_sent_for_approval" | "bill_pay_accept_term" | "zeni_account_accept_term" | "update_vendor" | "delete_bank_account" | "create_bank_account" | "create_bank_account_ach" | "create_bank_account_wire" | "create_bank_account_international" | "transfer_money" | "update_zeni_account_nickname" | "create_checking_account" | "deposit_check" | "create_vendor" | "onboarding_customer_view" | "onboarding_customer_view_complete" | "onboarding_customer_identity_verification_save" | "onboarding_customer_identity_verification_submit" | "onboarding_customer_business_verification_save" | "onboarding_customer_business_verification_submit" | "retry_bank_account_connection" | "dashboard_invite_sent" | "onboarding_info_saved" | "approve_original_merchant" | "approve_global_merchant" | "reject_global_merchant" | "create_global_merchant" | "fetch_global_merchant_no_recommendation" | "save_vendor_renamed" | "save_vendor_sent_for_review" | "save_vendor_marked_as_employee" | "charge_card_setup" | "charge_card_accept_term" | "create_schedule" | "save_schedule" | "save_task_detail" | "delete_task" | "archive_task" | "update_charge_card" | "notification_settings_saved";
22
- messageText: "failed" | "success";
23
- type: import("../../..").SnackbarMessageType;
24
- showStatusIcon?: boolean | undefined;
25
- variables?: {
26
- variableName: string;
27
- variableValue: string;
28
- }[] | undefined;
29
- };
30
- type: string;
31
- }>;
@@ -1,70 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.saveNotificationSettingsEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const settingsViewReducer_1 = require("../settingsViewReducer");
7
- const responsePayload_1 = require("../../../responsePayload");
8
- const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
9
- const saveNotificationSettingsEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(settingsViewReducer_1.saveNotificationSettings.match), (0, operators_1.switchMap)(() => {
10
- const URL = `${zeniAPI.apiEndPoints.notificationMicroServiceBaseUrl}/1.0/notification-preferences`;
11
- const { notificationSettings, notificationSettingsLocalData } = state$.value.settingsViewState.notification;
12
- const payload = toSaveNotificationSettingsPayload(notificationSettingsLocalData, notificationSettings);
13
- return zeniAPI
14
- .putAndGetJSON(URL, payload)
15
- .pipe((0, operators_1.mergeMap)((response) => {
16
- if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
17
- const updateActions = [
18
- (0, settingsViewReducer_1.updateNotificationSettingsOnSaveSuccess)({ data: response.data }),
19
- (0, snackbarReducer_1.openSnackbar)({
20
- messageSection: 'notification_settings_saved',
21
- messageText: 'success',
22
- type: 'success',
23
- }),
24
- ];
25
- return (0, rxjs_1.of)(...updateActions);
26
- }
27
- else {
28
- return (0, rxjs_1.of)((0, settingsViewReducer_1.updateNotificationSettingsOnSaveFailure)(response.status));
29
- }
30
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, settingsViewReducer_1.updateNotificationSettingsOnSaveFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'Save Notification Settings REST API call errored out' +
31
- JSON.stringify(error))))));
32
- }));
33
- exports.saveNotificationSettingsEpic = saveNotificationSettingsEpic;
34
- function toSaveNotificationSettingsPayload(localData, notificationSettingsData) {
35
- const payload = {};
36
- if (localData.reminders.isMissingReceiptNotificationActive != null &&
37
- notificationSettingsData.missingReceiptNotification != null) {
38
- payload.is_missing_receipt_notification_active =
39
- localData.reminders.isMissingReceiptNotificationActive;
40
- payload.missing_receipt_notification = {
41
- preferred_mode: ['email'],
42
- };
43
- }
44
- if (localData.reminders.isPendingBillApprovalNotificationActive != null &&
45
- notificationSettingsData.pendingBillApprovalNotification != null) {
46
- payload.is_pending_bill_approval_notification_active =
47
- localData.reminders.isPendingBillApprovalNotificationActive;
48
- payload.pending_bill_approval_notification = {
49
- preferred_mode: ['email'],
50
- };
51
- }
52
- if (localData.reminders.isUncategorizedTransactionNotificationActive != null &&
53
- notificationSettingsData.uncategorizedTransactionNotification != null) {
54
- payload.is_uncategorized_transaction_notification_active =
55
- localData.reminders.isUncategorizedTransactionNotificationActive;
56
- payload.uncategorized_transaction_notification = {
57
- preferred_mode: ['email'],
58
- };
59
- }
60
- if (localData.reminders.isPendingReimbursementApprovalNotificationActive !=
61
- null &&
62
- notificationSettingsData.pendingReimbursementApprovalNotification != null) {
63
- payload.is_pending_reimbursement_approval_notification_active =
64
- localData.reminders.isPendingReimbursementApprovalNotificationActive;
65
- payload.pending_reimbursement_approval_notification = {
66
- preferred_mode: ['email'],
67
- };
68
- }
69
- return payload;
70
- }
@@ -1,2 +0,0 @@
1
- import { NotificationSettings } from './settingsViewState';
2
- export declare const isNotificationsTabVisible: (notificationSettingsView: NotificationSettings) => boolean;
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isNotificationsTabVisible = void 0;
4
- const isNotificationsTabVisible = (notificationSettingsView) => {
5
- const { notificationSettings } = notificationSettingsView;
6
- return (notificationSettings.missingReceiptNotification != null ||
7
- notificationSettings.pendingBillApprovalNotification != null ||
8
- notificationSettings.pendingReimbursementApprovalNotification != null ||
9
- notificationSettings.uncategorizedTransactionNotification != null);
10
- };
11
- exports.isNotificationsTabVisible = isNotificationsTabVisible;