@zeniai/client-epic-state 5.1.92-betaRD3 → 5.1.92-betaRD4

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.
@@ -1,12 +1,10 @@
1
1
  import { from } from 'rxjs';
2
2
  import { catchError, filter, mergeMap } from 'rxjs/operators';
3
3
  import { updateJESchedules, updateJESchedulesDetails, } from '../../../../entity/jeSchedules/jeSchedulesReducer';
4
- import { getJEScheduledTransactionByJEScheduleTransactionKey } from '../../../../entity/jeSchedules/jeSchedulesSelector';
5
4
  import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
6
5
  import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
7
6
  import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
8
7
  import { fetchMonthEndCloseChecks } from '../../../monthEndCloseChecksView/monthEndCloseChecksViewReducer';
9
- import { prepareIgnoreSchedulePayload } from '../../payload/jeSchedulesPayload';
10
8
  import { removeJeScheduleTransactionKey, revertJeSchedule, revertJeScheduleFailure, revertJeScheduleSuccess, } from '../../reducers/jeSchedulesViewReducer';
11
9
  /**
12
10
  * Undo a posted prepaid / fixed-asset schedule: deletes its posted QBO journal entry, then
@@ -19,26 +17,16 @@ import { removeJeScheduleTransactionKey, revertJeSchedule, revertJeScheduleFailu
19
17
  export const revertJeScheduleEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(revertJeSchedule.match), mergeMap((action) => {
20
18
  const state = state$.value;
21
19
  const { expenseAutomationViewState: { selectedPeriodByTenantId }, } = state;
22
- const { jeScheduleId, jeScheduleTransactionKey, scheduleType, reason, note, } = action.payload;
20
+ const { jeScheduleId, jeScheduleTransactionKey, reason, note } = action.payload;
23
21
  const currentTenant = getCurrentTenant(state);
24
22
  const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
25
- const jeScheduleTransactionState = getJEScheduledTransactionByJEScheduleTransactionKey(jeScheduleTransactionKey, state);
26
- // Same fat blob as ignore, with the schedule id echoed back: the endpoint compares it to the
27
- // URL id and rejects a mismatch. reason/note go under `feedback`, and `action` is stamped
28
- // server-side, so sending it would be rejected as an unexpected field.
29
- const schedulePayload = prepareIgnoreSchedulePayload(scheduleType, jeScheduleTransactionState, state);
23
+ // Just the feedback -- not the fat blob ignore takes. This endpoint validates the whole body
24
+ // as a feedback object and rejects anything else with
25
+ // "Unexpected fields: ['je_schedules', 'scheduled_journal_entries']". The schedule id travels
26
+ // in the URL, and `action` is stamped server-side.
30
27
  const payload = {
31
- ...schedulePayload,
32
- je_schedules: schedulePayload.je_schedules.map((schedule, index) => index === 0
33
- ? {
34
- ...schedule,
35
- je_schedule_id: jeScheduleId,
36
- feedback: {
37
- reason,
38
- ...(note != null && note !== '' ? { note } : {}),
39
- },
40
- }
41
- : schedule),
28
+ reason,
29
+ ...(note != null && note !== '' ? { note } : {}),
42
30
  };
43
31
  return zeniAPI
44
32
  .putAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/schedules/${jeScheduleId}/revert`, payload)
@@ -4,12 +4,10 @@ exports.revertJeScheduleEpic = void 0;
4
4
  const rxjs_1 = require("rxjs");
5
5
  const operators_1 = require("rxjs/operators");
6
6
  const jeSchedulesReducer_1 = require("../../../../entity/jeSchedules/jeSchedulesReducer");
7
- const jeSchedulesSelector_1 = require("../../../../entity/jeSchedules/jeSchedulesSelector");
8
7
  const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer");
9
8
  const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
10
9
  const responsePayload_1 = require("../../../../responsePayload");
11
10
  const monthEndCloseChecksViewReducer_1 = require("../../../monthEndCloseChecksView/monthEndCloseChecksViewReducer");
12
- const jeSchedulesPayload_1 = require("../../payload/jeSchedulesPayload");
13
11
  const jeSchedulesViewReducer_1 = require("../../reducers/jeSchedulesViewReducer");
14
12
  /**
15
13
  * Undo a posted prepaid / fixed-asset schedule: deletes its posted QBO journal entry, then
@@ -22,26 +20,16 @@ const jeSchedulesViewReducer_1 = require("../../reducers/jeSchedulesViewReducer"
22
20
  const revertJeScheduleEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(jeSchedulesViewReducer_1.revertJeSchedule.match), (0, operators_1.mergeMap)((action) => {
23
21
  const state = state$.value;
24
22
  const { expenseAutomationViewState: { selectedPeriodByTenantId }, } = state;
25
- const { jeScheduleId, jeScheduleTransactionKey, scheduleType, reason, note, } = action.payload;
23
+ const { jeScheduleId, jeScheduleTransactionKey, reason, note } = action.payload;
26
24
  const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
27
25
  const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
28
- const jeScheduleTransactionState = (0, jeSchedulesSelector_1.getJEScheduledTransactionByJEScheduleTransactionKey)(jeScheduleTransactionKey, state);
29
- // Same fat blob as ignore, with the schedule id echoed back: the endpoint compares it to the
30
- // URL id and rejects a mismatch. reason/note go under `feedback`, and `action` is stamped
31
- // server-side, so sending it would be rejected as an unexpected field.
32
- const schedulePayload = (0, jeSchedulesPayload_1.prepareIgnoreSchedulePayload)(scheduleType, jeScheduleTransactionState, state);
26
+ // Just the feedback -- not the fat blob ignore takes. This endpoint validates the whole body
27
+ // as a feedback object and rejects anything else with
28
+ // "Unexpected fields: ['je_schedules', 'scheduled_journal_entries']". The schedule id travels
29
+ // in the URL, and `action` is stamped server-side.
33
30
  const payload = {
34
- ...schedulePayload,
35
- je_schedules: schedulePayload.je_schedules.map((schedule, index) => index === 0
36
- ? {
37
- ...schedule,
38
- je_schedule_id: jeScheduleId,
39
- feedback: {
40
- reason,
41
- ...(note != null && note !== '' ? { note } : {}),
42
- },
43
- }
44
- : schedule),
31
+ reason,
32
+ ...(note != null && note !== '' ? { note } : {}),
45
33
  };
46
34
  return zeniAPI
47
35
  .putAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/schedules/${jeScheduleId}/revert`, payload)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.1.92-betaRD3",
3
+ "version": "5.1.92-betaRD4",
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",