@zeniai/client-epic-state 5.2.14-betaRD1 → 5.2.14

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 (109) hide show
  1. package/lib/entity/approvalRule/approvalRuleConflict.d.ts +0 -13
  2. package/lib/entity/approvalRule/approvalRuleConflict.js +1 -16
  3. package/lib/entity/jeSchedules/jeScheduleHelper.d.ts +0 -1
  4. package/lib/entity/jeSchedules/jeScheduleHelper.js +0 -7
  5. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +1 -78
  6. package/lib/entity/jeSchedules/jeSchedulesPayload.js +4 -183
  7. package/lib/entity/jeSchedules/jeSchedulesReducer.d.ts +2 -4
  8. package/lib/entity/jeSchedules/jeSchedulesReducer.js +2 -30
  9. package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +2 -11
  10. package/lib/entity/jeSchedules/jeSchedulesSelector.js +3 -38
  11. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +1 -123
  12. package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +1 -24
  13. package/lib/entity/jeSchedules/jeSchedulesTypes.js +1 -96
  14. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  15. package/lib/entity/snackbar/snackbarTypes.js +0 -3
  16. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.d.ts +0 -2
  17. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.js +0 -2
  18. package/lib/entity/transaction/stateTypes/scheduleTransaction.d.ts +0 -2
  19. package/lib/epic.d.ts +1 -9
  20. package/lib/epic.js +0 -16
  21. package/lib/esm/entity/approvalRule/approvalRuleConflict.js +1 -16
  22. package/lib/esm/entity/jeSchedules/jeScheduleHelper.js +0 -6
  23. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +5 -183
  24. package/lib/esm/entity/jeSchedules/jeSchedulesReducer.js +2 -30
  25. package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +2 -36
  26. package/lib/esm/entity/jeSchedules/jeSchedulesTypes.js +0 -86
  27. package/lib/esm/entity/snackbar/snackbarTypes.js +0 -3
  28. package/lib/esm/entity/transaction/payloadTypes/scheduleTransactionPayload.js +0 -2
  29. package/lib/esm/epic.js +0 -16
  30. package/lib/esm/index.js +8 -14
  31. package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +3 -6
  32. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +1 -9
  33. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +5 -41
  34. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +2 -14
  35. package/lib/esm/view/expenseAutomationView/payload/jeSchedulesPayload.js +0 -55
  36. package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +29 -319
  37. package/lib/esm/view/expenseAutomationView/selectors/jeAccountSettingsViewSelector.js +0 -1
  38. package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +22 -327
  39. package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +6 -5
  40. package/lib/esm/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +1 -1
  41. package/lib/esm/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +2 -7
  42. package/lib/esm/view/scheduleView/scheduleListView/scheduleListReducer.js +3 -5
  43. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelector.js +1 -20
  44. package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewSelector.js +1 -20
  45. package/lib/index.d.ts +12 -17
  46. package/lib/index.js +47 -91
  47. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +3 -6
  48. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +1 -9
  49. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.d.ts +2 -3
  50. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +3 -39
  51. package/lib/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +2 -14
  52. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  53. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +3 -86
  54. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.js +1 -58
  55. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +12 -93
  56. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +29 -321
  57. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +1 -1
  58. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +2 -2
  59. package/lib/view/expenseAutomationView/selectorTypes/jeAccountSettingsViewSelectorTypes.d.ts +0 -1
  60. package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +7 -41
  61. package/lib/view/expenseAutomationView/selectors/jeAccountSettingsViewSelector.js +0 -1
  62. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.d.ts +0 -34
  63. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +21 -335
  64. package/lib/view/expenseAutomationView/types/completedSubTab.d.ts +1 -1
  65. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +8 -83
  66. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +8 -8
  67. package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +1 -1
  68. package/lib/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +1 -1
  69. package/lib/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +2 -7
  70. package/lib/view/scheduleView/scheduleListView/scheduleListReducer.d.ts +2 -4
  71. package/lib/view/scheduleView/scheduleListView/scheduleListReducer.js +3 -5
  72. package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelector.js +1 -20
  73. package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelectorTypes.d.ts +0 -3
  74. package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewSelector.js +1 -20
  75. package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewSelectorTypes.d.ts +0 -3
  76. package/package.json +1 -1
  77. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +0 -45
  78. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +0 -104
  79. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +0 -25
  80. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +0 -138
  81. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +0 -79
  82. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +0 -180
  83. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +0 -111
  84. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +0 -28
  85. package/lib/esm/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +0 -140
  86. package/lib/esm/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +0 -1
  87. package/lib/esm/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +0 -106
  88. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.d.ts +0 -21
  89. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +0 -49
  90. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.d.ts +0 -9
  91. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +0 -108
  92. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.d.ts +0 -8
  93. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +0 -29
  94. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.d.ts +0 -9
  95. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +0 -142
  96. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.d.ts +0 -8
  97. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +0 -83
  98. package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.d.ts +0 -13
  99. package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +0 -187
  100. package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.d.ts +0 -65
  101. package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +0 -115
  102. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.d.ts +0 -6
  103. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +0 -32
  104. package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.d.ts +0 -36
  105. package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +0 -145
  106. package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.d.ts +0 -42
  107. package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +0 -2
  108. package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.d.ts +0 -21
  109. package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +0 -112
@@ -200,7 +200,7 @@ export interface SaveReconciliationDetailFailurePayload {
200
200
  }
201
201
  export declare const toReconciliationTabsType: (v: string) => "review" | "reconcile";
202
202
  export declare type ReconciliationViewTabType = ReturnType<typeof toReconciliationTabsType>;
203
- declare const toReconReconcileSortKeysType: (v: string) => "type" | "date" | "amount" | "memo" | "account" | "recommended" | "clearedDate" | "payee" | "transactionDirection";
203
+ declare const toReconReconcileSortKeysType: (v: string) => "type" | "date" | "amount" | "memo" | "account" | "clearedDate" | "payee" | "transactionDirection" | "recommended";
204
204
  export declare type ReconReconcileSortKey = ReturnType<typeof toReconReconcileSortKeysType>;
205
205
  export interface ReconciliationReconcileTabLocalData {
206
206
  selectedTransactionIds: ID[];
@@ -33,7 +33,7 @@ const fetchAccruedScheduleListEpic = (actions$, state$, zeniAPI) => actions$.pip
33
33
  je_schedule_type: scheduleType,
34
34
  sort_by: 'transaction_date',
35
35
  sort_order: 'desc',
36
- filter: action.payload.statusFilter,
36
+ filter: 'all',
37
37
  };
38
38
  return zeniAPI
39
39
  .getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/schedules?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
@@ -10,14 +10,9 @@ const responsePayload_1 = require("../../../../responsePayload");
10
10
  const scheduleListReducer_1 = require("../scheduleListReducer");
11
11
  const scheduleListTypes_1 = require("../scheduleListTypes");
12
12
  const fetchDownloadSchedulesEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(scheduleListReducer_1.fetchDownloadSchedules.match), (0, operators_1.mergeMap)((action) => {
13
- const { scheduleType, downloadCategories, statusFilter } = action.payload;
13
+ const { scheduleType, downloadCategories } = action.payload;
14
14
  const scheduleListState = state$.value.scheduleListState;
15
15
  // if parameters are provided, use those. else go to localdata
16
- // Accrued is deliberately not served here. Its rows come back in a different shape, this
17
- // epic writes them through updateJESchedules (the prepaid / fixed mapper), and
18
- // doUpdateScheduleList never flips downloadState for accrued -- so a request would store the
19
- // wrong data and then never report completion. Accrued downloads go through
20
- // fetchAccruedScheduleList, which owns that shape end to end.
21
16
  let scheduleState;
22
17
  if (scheduleType !== 'accrued_expenses') {
23
18
  scheduleState = (0, scheduleListReducer_1.getState)(scheduleListState, scheduleType);
@@ -42,7 +37,7 @@ const fetchDownloadSchedulesEpic = (actions$, state$, zeniAPI) => actions$.pipe(
42
37
  base_txn_account_ids: downloadCategories,
43
38
  sort_by: 'transaction_date',
44
39
  sort_order: 'desc',
45
- filter: statusFilter,
40
+ filter: 'all',
46
41
  };
47
42
  return zeniAPI
48
43
  .getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/schedules/download?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
@@ -16,7 +16,7 @@ export declare const initialState: ScheduleListViewState;
16
16
  export declare const fetchDownloadSchedules: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue", timeframeAndCategory: {
17
17
  selectedCategoryId: ID;
18
18
  selectedTimeframe: TimeframeTick;
19
- }, downloadCategories: string[], statusFilter?: "completed" | "new" | "ongoing" | "all" | undefined, cacheOverride?: any], {
19
+ }, downloadCategories: string[], cacheOverride?: any], {
20
20
  timeframeAndCategory: {
21
21
  selectedCategoryId: ID;
22
22
  selectedTimeframe: TimeframeTick;
@@ -24,18 +24,16 @@ export declare const fetchDownloadSchedules: import("@reduxjs/toolkit").ActionCr
24
24
  scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue";
25
25
  cacheOverride: any;
26
26
  downloadCategories: string[];
27
- statusFilter: "completed" | "new" | "ongoing" | "all";
28
27
  }, "scheduleListView/fetchDownloadSchedules", never, never>, fetchAccruedScheduleList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue", timeframeAndCategory?: {
29
28
  selectedCategoryId: ID;
30
29
  selectedTimeframe: TimeframeTick;
31
- } | undefined, cacheOverride?: any, statusFilter?: "completed" | "new" | "ongoing" | "all" | undefined], {
30
+ } | undefined, cacheOverride?: any], {
32
31
  timeframeAndCategory: {
33
32
  selectedCategoryId: ID;
34
33
  selectedTimeframe: TimeframeTick;
35
34
  } | undefined;
36
35
  scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue";
37
36
  cacheOverride: any;
38
- statusFilter: "completed" | "new" | "ongoing" | "all";
39
37
  }, "scheduleListView/fetchAccruedScheduleList", never, never>, fetchScheduleList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue", timeframeAndCategory?: {
40
38
  selectedCategoryId: ID;
41
39
  selectedTimeframe: TimeframeTick;
@@ -90,8 +90,8 @@ const scheduleListView = (0, toolkit_1.createSlice)({
90
90
  reducers: {
91
91
  fetchDownloadSchedules: {
92
92
  reducer(draft, action) {
93
- // Accrued is not downloaded through this action -- see fetchDownloadSchedulesEpic for why.
94
93
  if (action.payload.scheduleType !== 'accrued_expenses') {
94
+ //if condition added for type narrowing
95
95
  const state = getState(draft, action.payload.scheduleType);
96
96
  const selectedTimeframe = action.payload.timeframeAndCategory.selectedTimeframe;
97
97
  const selectedCategoryId = action.payload.timeframeAndCategory.selectedCategoryId;
@@ -115,14 +115,13 @@ const scheduleListView = (0, toolkit_1.createSlice)({
115
115
  updateState(draft, action.payload.scheduleType, state);
116
116
  }
117
117
  },
118
- prepare(scheduleType, timeframeAndCategory, downloadCategories, statusFilter = 'all', cacheOverride = false) {
118
+ prepare(scheduleType, timeframeAndCategory, downloadCategories, cacheOverride = false) {
119
119
  return {
120
120
  payload: {
121
121
  timeframeAndCategory,
122
122
  scheduleType,
123
123
  cacheOverride,
124
124
  downloadCategories,
125
- statusFilter,
126
125
  },
127
126
  };
128
127
  },
@@ -158,13 +157,12 @@ const scheduleListView = (0, toolkit_1.createSlice)({
158
157
  updateState(draft, action.payload.scheduleType, state);
159
158
  }
160
159
  },
161
- prepare(scheduleType, timeframeAndCategory, cacheOverride = false, statusFilter = 'all') {
160
+ prepare(scheduleType, timeframeAndCategory, cacheOverride = false) {
162
161
  return {
163
162
  payload: {
164
163
  timeframeAndCategory,
165
164
  scheduleType,
166
165
  cacheOverride,
167
- statusFilter,
168
166
  },
169
167
  };
170
168
  },
@@ -13,7 +13,7 @@ const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
13
13
  const userSelector_1 = require("../../../../entity/user/userSelector");
14
14
  const userRoleSelector_1 = require("../../../../entity/userRole/userRoleSelector");
15
15
  exports.getBillPaySetupApproverView = (0, toolkit_1.createSelector)((state) => state.billPaySetupApproverViewState, (state) => state.approvalRuleState, (state) => state.userState, (billPaySetupApproverViewState, approvalRuleState, userState) => {
16
- const { approvalRulesDeleteStatusById, approvalRuleIds, approverListState, fetchState, error, listeningToPusherEvent, newApprovalRuleId, } = billPaySetupApproverViewState;
16
+ const { approvalRulesDeleteStatusById, approvalRuleIds, fetchState, error, listeningToPusherEvent, newApprovalRuleId, } = billPaySetupApproverViewState;
17
17
  const deleteStateList = Object.values(approvalRulesDeleteStatusById);
18
18
  const approvalRules = (0, approvalRuleSelector_1.getApprovalRulesByIds)(approvalRuleState, approvalRuleIds);
19
19
  const allApprovalRules = approvalRules.map((approvalRule) => {
@@ -41,15 +41,10 @@ exports.getBillPaySetupApproverView = (0, toolkit_1.createSelector)((state) => s
41
41
  name: 'Require Info',
42
42
  code: 'require_info',
43
43
  };
44
- const activeApproverIds = new Set(approverListState.approverIds);
45
- const referencedApproverIds = new Set(allApprovalRules.flatMap((approvalRule) => approvalRule.steps.flatMap((step) => step.actors.map((actor) => actor.userId))));
46
- const inactiveApproverIds = Array.from(referencedApproverIds).filter((userId) => !activeApproverIds.has(userId));
47
44
  return {
48
45
  allApprovalRules,
49
46
  deleteStatus: (0, reduceFetchState_1.reduceAnyFetchState)(deleteStateList),
50
47
  approvalRulesStatus,
51
- approverListFetchStatus: approverListState.fetchStatus,
52
- inactiveApproverIds,
53
48
  fetchState,
54
49
  error,
55
50
  listeningToPusherEvent,
@@ -68,19 +63,6 @@ exports.getBillPaySetupApproverUpdateDataView = (0, toolkit_1.createSelector)((s
68
63
  };
69
64
  })
70
65
  .filter((approver) => approver.user != null);
71
- const activeApproverIds = new Set(approverIds);
72
- const currentRuleSteps = billPaySetupApproverViewUpdateData?.data?.steps ?? [];
73
- const inactiveActorUserIds = new Set(currentRuleSteps
74
- .flatMap((step) => step.actors.map((actor) => actor.userId))
75
- .filter((userId) => userId != null && !activeApproverIds.has(userId)));
76
- const inactiveActorApprovers = Array.from(inactiveActorUserIds)
77
- .map((userId) => {
78
- return {
79
- user: (0, userSelector_1.getUserByUserId)(userState, userId),
80
- role: (0, userRoleSelector_1.getUserRoleByUserId)(userRoleState, userId),
81
- };
82
- })
83
- .filter((approver) => approver.user != null);
84
66
  const allAttributes = attributes;
85
67
  const filteredApprovers = (0, cloneDeep_1.default)(allApprovers);
86
68
  const filteredAttributes = (0, cloneDeep_1.default)(attributes);
@@ -114,7 +96,6 @@ exports.getBillPaySetupApproverUpdateDataView = (0, toolkit_1.createSelector)((s
114
96
  allApprovalRules,
115
97
  allApprovers,
116
98
  filteredApprovers,
117
- inactiveActorApprovers,
118
99
  allAttributes,
119
100
  filteredAttributes,
120
101
  billPaySetupApproverViewUpdateData,
@@ -49,9 +49,7 @@ export interface ApprovalRuleWithUser extends Omit<ApprovalRule, 'steps'> {
49
49
  export interface BillPaySetupApproverView extends SelectorView {
50
50
  allApprovalRules: ApprovalRuleWithUser[];
51
51
  approvalRulesStatus: AllowedValueWithCode;
52
- approverListFetchStatus: FetchStateAndError;
53
52
  deleteStatus: FetchStateAndError;
54
- inactiveApproverIds: ID[];
55
53
  listeningToPusherEvent?: boolean;
56
54
  newApprovalRuleId?: ID;
57
55
  }
@@ -63,7 +61,6 @@ export interface BillPaySetupApproverUpdateDataView extends SelectorView {
63
61
  approverListFetchStatus: FetchStateAndError;
64
62
  filteredApprovers: UserAndRole[];
65
63
  filteredAttributes: AttributeType[];
66
- inactiveActorApprovers: UserAndRole[];
67
64
  affectedEntityIds?: ID[];
68
65
  billPaySetupApproverViewUpdateData?: ApproverViewUpdateData;
69
66
  listeningToPusherEvent?: boolean;
@@ -13,7 +13,7 @@ const userSelector_1 = require("../../../../entity/user/userSelector");
13
13
  const userRoleSelector_1 = require("../../../../entity/userRole/userRoleSelector");
14
14
  const getRemiSetupApproverView = (state, filterAdmins = true) => {
15
15
  const { remiSetupApproverViewState, approvalRuleState, userState } = state;
16
- const { approvalRulesDeleteStatusById, approvalRuleIds, approverListState, fetchState, error, listeningToPusherEvent, newApprovalRuleId, } = remiSetupApproverViewState;
16
+ const { approvalRulesDeleteStatusById, approvalRuleIds, fetchState, error, listeningToPusherEvent, newApprovalRuleId, } = remiSetupApproverViewState;
17
17
  const deleteStateList = Object.values(approvalRulesDeleteStatusById);
18
18
  const approvalRules = (0, approvalRuleSelector_1.getApprovalRulesByIds)(approvalRuleState, approvalRuleIds);
19
19
  const allApprovalRules = approvalRules.map((approvalRule) => {
@@ -42,15 +42,10 @@ const getRemiSetupApproverView = (state, filterAdmins = true) => {
42
42
  name: 'Require Info',
43
43
  code: 'require_info',
44
44
  };
45
- const activeApproverIds = new Set(approverListState.approverIds);
46
- const referencedApproverIds = new Set(allApprovalRules.flatMap((approvalRule) => approvalRule.steps.flatMap((step) => step.actors.map((actor) => actor.userId))));
47
- const inactiveApproverIds = Array.from(referencedApproverIds).filter((userId) => !activeApproverIds.has(userId));
48
45
  return {
49
46
  allApprovalRules,
50
47
  deleteStatus: (0, reduceFetchState_1.reduceAnyFetchState)(deleteStateList),
51
48
  approvalRulesStatus,
52
- approverListFetchStatus: approverListState.fetchStatus,
53
- inactiveApproverIds,
54
49
  fetchState,
55
50
  error,
56
51
  listeningToPusherEvent,
@@ -86,19 +81,6 @@ exports.getRemiSetupApproverUpdateDataView = (0, toolkit_1.createSelector)((stat
86
81
  };
87
82
  })
88
83
  .filter((approver) => approver.user != null);
89
- const activeApproverIds = new Set(approverIds);
90
- const currentRuleSteps = remiSetupApproverViewUpdateData?.data?.steps ?? [];
91
- const inactiveActorUserIds = new Set(currentRuleSteps
92
- .flatMap((step) => step.actors.map((actor) => actor.userId))
93
- .filter((userId) => userId != null && !activeApproverIds.has(userId)));
94
- const inactiveActorApprovers = Array.from(inactiveActorUserIds)
95
- .map((userId) => {
96
- return {
97
- user: (0, userSelector_1.getUserByUserId)(userState, userId),
98
- role: (0, userRoleSelector_1.getUserRoleByUserId)(userRoleState, userId),
99
- };
100
- })
101
- .filter((approver) => approver.user != null);
102
84
  const allAttributes = attributes;
103
85
  const filteredApprovers = (0, cloneDeep_1.default)(allApprovers);
104
86
  const filteredAttributes = (0, cloneDeep_1.default)(attributes);
@@ -133,7 +115,6 @@ exports.getRemiSetupApproverUpdateDataView = (0, toolkit_1.createSelector)((stat
133
115
  allAttributes,
134
116
  filteredApprovers,
135
117
  filteredAttributes,
136
- inactiveActorApprovers,
137
118
  allAccountingClasses,
138
119
  remiSetupApproverViewUpdateData,
139
120
  approversDetailsFetchStatus: (0, reduceFetchState_1.reduceAllFetchState)([
@@ -48,9 +48,7 @@ export interface ApprovalRuleWithUser extends Omit<ApprovalRule, 'steps'> {
48
48
  export interface RemiSetupApproverView extends SelectorView {
49
49
  allApprovalRules: ApprovalRuleWithUser[];
50
50
  approvalRulesStatus: AllowedValueWithCode;
51
- approverListFetchStatus: FetchStateAndError;
52
51
  deleteStatus: FetchStateAndError;
53
- inactiveApproverIds: ID[];
54
52
  listeningToPusherEvent?: boolean;
55
53
  newApprovalRuleId?: ID;
56
54
  }
@@ -62,7 +60,6 @@ export interface RemiSetupApproverUpdateDataView extends SelectorView {
62
60
  approversDetailsFetchStatus: FetchStateAndError;
63
61
  filteredApprovers: UserAndRole[];
64
62
  filteredAttributes: AttributeType[];
65
- inactiveActorApprovers: UserAndRole[];
66
63
  affectedEntityIds?: ID[];
67
64
  listeningToPusherEvent?: boolean;
68
65
  remiSetupApproverViewUpdateData?: ApproverViewUpdateData;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.2.14-betaRD1",
3
+ "version": "5.2.14",
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
  "module": "lib/esm/index.js",
@@ -1,45 +0,0 @@
1
- import { from } from 'rxjs';
2
- import { catchError, filter, mergeMap, takeUntil } from 'rxjs/operators';
3
- import { updateJEOneTimeAccruals } from '../../../../entity/jeSchedules/jeSchedulesReducer';
4
- import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
5
- import { clearAll } from '../../../../rootActions';
6
- import { fetchOneTimeAccrual, fetchOneTimeAccrualFailure, fetchOneTimeAccrualSuccess, } from '../../reducers/jeSchedulesViewReducer';
7
- /**
8
- * Read one accrual by id so its detail page can render from a URL alone.
9
- *
10
- * Every other row on this page arrives with the JE Schedules list, and the accrual detail page used
11
- * to render only from what that list had already put in the store -- so opening its URL directly, on
12
- * a refresh or a shared link, had nothing to render and showed not-found. This is the read that
13
- * makes the URL self-sufficient.
14
- *
15
- * The response is the same `{accrual}` envelope promote / ignore / revert return, and it goes through
16
- * the same `updateJEOneTimeAccruals`, so a page loaded cold holds exactly the entity a page reached
17
- * through the list holds.
18
- */
19
- export const fetchOneTimeAccrualEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchOneTimeAccrual.match), mergeMap((action) => {
20
- const { accrualId } = action.payload;
21
- return zeniAPI
22
- .getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals/${accrualId}`)
23
- .pipe(mergeMap((response) => {
24
- if (isSuccessResponse(response) && response.data != null) {
25
- return from([
26
- updateJEOneTimeAccruals([response.data.accrual]),
27
- fetchOneTimeAccrualSuccess({ accrualId }),
28
- ]);
29
- }
30
- // A deleted or ignored accrual answers 404 here, the same as an id that never existed.
31
- // Both end as an error state the page turns into not-found, rather than a spinner that
32
- // never resolves.
33
- return from([
34
- fetchOneTimeAccrualFailure({ accrualId, status: response.status }),
35
- ]);
36
- }), catchError((error) => from([
37
- fetchOneTimeAccrualFailure({
38
- accrualId,
39
- status: createZeniAPIStatus('Unexpected Error', `Fetch one-time accrual REST API call errored out ${JSON.stringify(error)}`),
40
- }),
41
- ])),
42
- // A tenant switch clears the store while this request is in flight. Without this the old
43
- // tenant's accrual is written back into the freshly cleared store.
44
- takeUntil(actions$.pipe(filter(clearAll.match))));
45
- }));
@@ -1,104 +0,0 @@
1
- import { from } from 'rxjs';
2
- import { catchError, filter, mergeMap, takeUntil } from 'rxjs/operators';
3
- import { convertToPeriod, toAbsoluteDay, } from '../../../../../commonStateTypes/timePeriod';
4
- import { updateJEOneTimeAccruals } from '../../../../../entity/jeSchedules/jeSchedulesReducer';
5
- import { openSnackbar } from '../../../../../entity/snackbar/snackbarReducer';
6
- import { getCurrentTenant } from '../../../../../entity/tenant/tenantSelector';
7
- import { clearAll } from '../../../../../rootActions';
8
- import { createZeniAPIStatus, isSuccessResponse, } from '../../../../../responsePayload';
9
- import { prepareCreateOneTimeAccrualPayload, } from '../../../payload/jeSchedulesPayload';
10
- import { createOneTimeAccrual, createOneTimeAccrualFailure, createOneTimeAccrualSuccess, fetchJeSchedules, } from '../../../reducers/jeSchedulesViewReducer';
11
- export const createOneTimeAccrualEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(createOneTimeAccrual.match), mergeMap((action) => {
12
- const state = state$.value;
13
- const { localData } = action.payload;
14
- /*
15
- * Idempotency for the create. agent-je dedupes on this: the same key again returns the
16
- * existing accrual rather than posting a second JE to QBO.
17
- *
18
- * Body `request_id` rather than the `Idempotency-Key` header the API doc prefers, on Mohit's
19
- * call (2026-08-24). The header cannot reach the service from a browser -- common's
20
- * Access-Control-Allow-Headers does not list it, so cross-origin preflight rejects the
21
- * request. Same meaning either way; the header simply wins when both are sent.
22
- *
23
- * Minted here, per create action, and deliberately not held in local data or the form: a new
24
- * Save must produce a new key, and only a retry of *this* request may reuse one. Nothing
25
- * retries today -- if a retry operator is ever added below, it has to sit inside this
26
- * mergeMap so the key is not re-minted, or the guarantee is silently lost.
27
- */
28
- const requestId = crypto.randomUUID();
29
- const payload = {
30
- ...prepareCreateOneTimeAccrualPayload(state, localData),
31
- request_id: requestId,
32
- };
33
- // convertToPeriod destructures, so an unset period would throw here and take the epic
34
- // subscription down for the whole session — a missed refresh is the cheaper failure.
35
- const selectedMonthYear = state.expenseAutomationViewState.selectedPeriodByTenantId[getCurrentTenant(state).tenantId];
36
- const selectedPeriod = selectedMonthYear != null
37
- ? convertToPeriod(selectedMonthYear)
38
- : undefined;
39
- const periodStart = selectedPeriod != null
40
- ? toAbsoluteDay(selectedPeriod.start)
41
- : undefined;
42
- const periodEnd = selectedPeriod != null ? toAbsoluteDay(selectedPeriod.end) : undefined;
43
- return zeniAPI
44
- .postAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals`, payload)
45
- .pipe(mergeMap((response) => {
46
- if (isSuccessResponse(response) && response.data != null) {
47
- const successActions = [
48
- updateJEOneTimeAccruals([response.data.accrual]),
49
- createOneTimeAccrualSuccess(),
50
- openSnackbar({
51
- messageSection: 'create_schedule',
52
- messageText: 'success',
53
- type: 'success',
54
- variables: [
55
- {
56
- variableName: '_vendor_name_',
57
- variableValue: localData.vendorName,
58
- },
59
- ],
60
- }),
61
- ];
62
- // The tab buckets (jeScheduleOneTimeAccrualKeysByPeriodAndTab) are rebuilt wholesale
63
- // per fetch, and the backend decides whether a freshly posted accrual belongs to
64
- // Review or Existing — so refetch rather than guess which bucket to insert into.
65
- if (periodStart != null && periodEnd != null) {
66
- successActions.push(fetchJeSchedules({ start: periodStart, end: periodEnd }, true));
67
- }
68
- return from(successActions);
69
- }
70
- return from([
71
- createOneTimeAccrualFailure({ status: response.status }),
72
- openSnackbar({
73
- messageSection: 'create_schedule',
74
- messageText: 'failed',
75
- type: 'error',
76
- variables: [
77
- {
78
- variableName: '_api-error_',
79
- variableValue: response.status.message,
80
- },
81
- ],
82
- }),
83
- ]);
84
- }), catchError((error) => from([
85
- openSnackbar({
86
- messageSection: 'create_schedule',
87
- messageText: 'failed',
88
- type: 'error',
89
- variables: [
90
- {
91
- variableName: '_api-error_',
92
- variableValue: JSON.stringify(error),
93
- },
94
- ],
95
- }),
96
- createOneTimeAccrualFailure({
97
- status: createZeniAPIStatus('Unexpected Error', `Create One Time Accrual REST API call errored out ${JSON.stringify(error)}`),
98
- }),
99
- ])),
100
- // A tenant switch clears the store while this request is still in flight.
101
- // Without this the old tenant's response is written back into the freshly
102
- // cleared store and stays on screen under the new tenant.
103
- takeUntil(actions$.pipe(filter(clearAll.match))));
104
- }));
@@ -1,25 +0,0 @@
1
- import { from } from 'rxjs';
2
- import { filter, mergeMap } from 'rxjs/operators';
3
- import { fetchAccountList } from '../../../../accountList/accountListReducer';
4
- import { fetchClassList } from '../../../../classList/classListReducer';
5
- import { getAccountsTypesForScheduleEpics } from '../../../../scheduleView/scheduleListView/scheduleListHelper';
6
- import { clearSearchTransactionsForNewSchedule, initializeNewSchedule, resetNewScheduleLocalData, } from '../../../reducers/jeSchedulesViewReducer';
7
- export const initializeNewScheduleEpic = (actions$, state$) => actions$.pipe(filter(initializeNewSchedule.match), mergeMap((action) => {
8
- const newScheduleActions = [];
9
- const accountType = getAccountsTypesForScheduleEpics();
10
- const { accountListState, classListState } = state$.value;
11
- if (accountListState.byReportId[accountType.accountListKey]?.fetchState ===
12
- 'Not-Started') {
13
- newScheduleActions.push(fetchAccountList(accountType.accountListKey, true, false, false, false, accountType.allowedAccountList));
14
- }
15
- if (classListState.fetchState === 'Not-Started') {
16
- newScheduleActions.push(fetchClassList());
17
- }
18
- // The account and class fetches above are idempotent (both guard on 'Not-Started'), so they
19
- // can run on every open. Clearing what the user entered cannot, so it is opt-in.
20
- if (action.payload.shouldResetEnteredData) {
21
- newScheduleActions.push(resetNewScheduleLocalData({ scheduleType: action.payload.scheduleType }));
22
- newScheduleActions.push(clearSearchTransactionsForNewSchedule());
23
- }
24
- return from(newScheduleActions);
25
- }));
@@ -1,138 +0,0 @@
1
- import { from } from 'rxjs';
2
- import { catchError, filter, mergeMap, takeUntil } from 'rxjs/operators';
3
- import { convertToPeriod, toAbsoluteDay, } from '../../../../../commonStateTypes/timePeriod';
4
- import { getCurrentTenant } from '../../../../../entity/tenant/tenantSelector';
5
- import { clearAll } from '../../../../../rootActions';
6
- import { updateJESchedules, updateJESchedulesDetails, } from '../../../../../entity/jeSchedules/jeSchedulesReducer';
7
- import { getJEScheduleTransactionKey } from '../../../../../entity/jeSchedules/jeSchedulesTypes';
8
- import { openSnackbar } from '../../../../../entity/snackbar/snackbarReducer';
9
- import { getScheduleTransactionById } from '../../../../../entity/transaction/transactionSelector';
10
- import { createZeniAPIStatus, isSuccessResponse, } from '../../../../../responsePayload';
11
- import { prepareNewSchedulePayload, } from '../../../helpers/newScheduleLocalDataHelper';
12
- import { fetchJeSchedules, resetNewScheduleLocalData, saveNewSchedule, saveNewScheduleFailure, saveNewScheduleSuccess, } from '../../../reducers/jeSchedulesViewReducer';
13
- const FAILURE_REASON_MESSAGES = {
14
- missing_third_party_id: 'This transaction is missing a QuickBooks reference and cannot be scheduled.',
15
- // The form cannot satisfy this: the vendor field is hard-disabled and inherited from the base
16
- // transaction, so the fix is on the transaction, not here.
17
- missing_vendor: 'This transaction has no vendor and cannot be scheduled. Add a vendor to the transaction first.',
18
- };
19
- export const saveNewScheduleEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(saveNewSchedule.match), mergeMap((action) => {
20
- const { scheduleType } = action.payload;
21
- const state = state$.value;
22
- const localData = state.expenseAutomationJESchedulesViewState.newSchedule
23
- .newScheduleState[scheduleType];
24
- const { selectedBaseTransactionId } = localData;
25
- const transaction = selectedBaseTransactionId != null
26
- ? getScheduleTransactionById(state.transactionState, getJEScheduleTransactionKey(selectedBaseTransactionId))
27
- : undefined;
28
- if (transaction == null) {
29
- return from([
30
- saveNewScheduleFailure({
31
- status: createZeniAPIStatus('Unexpected Error', 'No base transaction selected for this schedule.'),
32
- }),
33
- openSnackbar({
34
- messageSection: 'create_schedule',
35
- messageText: 'failed',
36
- type: 'error',
37
- variables: [
38
- {
39
- variableName: '_api-error_',
40
- variableValue: 'No base transaction selected.',
41
- },
42
- ],
43
- }),
44
- ]);
45
- }
46
- const result = prepareNewSchedulePayload(transaction, localData, scheduleType);
47
- if (!result.ok) {
48
- const message = FAILURE_REASON_MESSAGES[result.reason];
49
- return from([
50
- saveNewScheduleFailure({
51
- status: createZeniAPIStatus('Unexpected Error', message),
52
- }),
53
- openSnackbar({
54
- messageSection: 'create_schedule',
55
- messageText: 'failed',
56
- type: 'error',
57
- variables: [{ variableName: '_api-error_', variableValue: message }],
58
- }),
59
- ]);
60
- }
61
- const vendorName = localData.selectedVendor?.name ?? transaction.vendorName ?? '';
62
- const queryParam = {
63
- je_schedule_type: scheduleType,
64
- };
65
- const payload = { ...result.payload };
66
- // convertToPeriod destructures, so an unset period would throw here and take the epic
67
- // subscription down for the whole session -- a missed refresh is the cheaper failure.
68
- const selectedMonthYear = state.expenseAutomationViewState.selectedPeriodByTenantId[getCurrentTenant(state).tenantId];
69
- const selectedPeriod = selectedMonthYear != null
70
- ? convertToPeriod(selectedMonthYear)
71
- : undefined;
72
- const periodStart = selectedPeriod != null
73
- ? toAbsoluteDay(selectedPeriod.start)
74
- : undefined;
75
- const periodEnd = selectedPeriod != null ? toAbsoluteDay(selectedPeriod.end) : undefined;
76
- return zeniAPI
77
- .postAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/schedules?query=${encodeURIComponent(JSON.stringify(queryParam))}`, payload)
78
- .pipe(mergeMap((response) => {
79
- if (isSuccessResponse(response) && response.data != null) {
80
- const successActions = [
81
- updateJESchedules(response.data.je_schedules),
82
- updateJESchedulesDetails(response.data.je_schedules, response.data.scheduled_journal_entries),
83
- resetNewScheduleLocalData({ scheduleType }),
84
- saveNewScheduleSuccess(),
85
- openSnackbar({
86
- messageSection: 'create_schedule',
87
- messageText: 'success',
88
- type: 'success',
89
- variables: [
90
- { variableName: '_vendor_name_', variableValue: vendorName },
91
- ],
92
- }),
93
- ];
94
- // Writing the entity is not enough: the list reads
95
- // jeScheduleTransactionKeysByPeriodAndTab, which is rebuilt wholesale per fetch, so
96
- // without this the new schedule stays invisible until some later fetch. The page
97
- // only refetches when the save also changes tab, so saving from the tab the row
98
- // lands on showed nothing. Same reasoning as createOneTimeAccrualEpic.
99
- if (periodStart != null && periodEnd != null) {
100
- successActions.push(fetchJeSchedules({ start: periodStart, end: periodEnd }, true));
101
- }
102
- return from(successActions);
103
- }
104
- return from([
105
- saveNewScheduleFailure({ status: response.status }),
106
- openSnackbar({
107
- messageSection: 'create_schedule',
108
- messageText: 'failed',
109
- type: 'error',
110
- variables: [
111
- {
112
- variableName: '_api-error_',
113
- variableValue: response.status.message,
114
- },
115
- ],
116
- }),
117
- ]);
118
- }), catchError((error) => from([
119
- openSnackbar({
120
- messageSection: 'create_schedule',
121
- messageText: 'failed',
122
- type: 'error',
123
- variables: [
124
- {
125
- variableName: '_api-error_',
126
- variableValue: JSON.stringify(error),
127
- },
128
- ],
129
- }),
130
- saveNewScheduleFailure({
131
- status: createZeniAPIStatus('Unexpected Error', `Save New Schedule REST API call errored out ${JSON.stringify(error)}`),
132
- }),
133
- ])),
134
- // A tenant switch clears the store while this request is still in flight.
135
- // Without this the old tenant's response is written back into the freshly
136
- // cleared store and stays on screen under the new tenant.
137
- takeUntil(actions$.pipe(filter(clearAll.match))));
138
- }));