@zeniai/client-epic-state 5.1.92-betaRD10 → 5.1.92-betaRD12

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.
@@ -15,7 +15,11 @@ export const initializeNewScheduleEpic = (actions$, state$) => actions$.pipe(fil
15
15
  if (classListState.fetchState === 'Not-Started') {
16
16
  newScheduleActions.push(fetchClassList());
17
17
  }
18
- newScheduleActions.push(resetNewScheduleLocalData({ scheduleType: action.payload.scheduleType }));
19
- newScheduleActions.push(clearSearchTransactionsForNewSchedule());
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
+ }
20
24
  return from(newScheduleActions);
21
25
  }));
@@ -6,8 +6,14 @@ import { updateScheduleTransactions } from '../../../../../entity/transaction/tr
6
6
  import { createZeniAPIStatus, isSuccessResponse, } from '../../../../../responsePayload';
7
7
  import { searchTransactionsForNewSchedule, searchTransactionsForNewScheduleFailure, searchTransactionsForNewScheduleSuccess, } from '../../../reducers/jeSchedulesViewReducer';
8
8
  import { MIN_NEW_SCHEDULE_SEARCH_LENGTH } from '../../../types/jeSchedulesViewState';
9
- /** Dropdown-sized result set — no pagination for Base Transaction search. */
10
- const NEW_SCHEDULE_SEARCH_PAGE_SIZE = 10;
9
+ /**
10
+ * Dropdown-sized result set. The endpoint is paginated — it takes a `page_token` $skip offset and
11
+ * returns `next_page_token` — but nothing here reads or sends those, so this is the whole result
12
+ * set the form ever sees. 20 rather than the backend's default of 10 because a text search for one
13
+ * known transaction was running out of room; the cap server-side is 100 if this needs raising again
14
+ * before infinite scroll is wired up.
15
+ */
16
+ const NEW_SCHEDULE_SEARCH_PAGE_SIZE = 20;
11
17
  /** Fallback when the backend sends a null currency for a search result. */
12
18
  const DEFAULT_CURRENCY_CODE = 'USD';
13
19
  const DEFAULT_CURRENCY_SYMBOL = '$';
@@ -460,12 +460,12 @@ const expenseAutomationJESchedulesView = createSlice({
460
460
  draft.accountSettings.localData = accountSettingsInitialState.localData;
461
461
  },
462
462
  initializeNewSchedule: {
463
- prepare({ scheduleType, }) {
464
- return { payload: { scheduleType } };
463
+ prepare({ scheduleType, shouldResetEnteredData = true, }) {
464
+ return { payload: { scheduleType, shouldResetEnteredData } };
465
465
  },
466
466
  reducer() {
467
467
  // Purely an epic-trigger action — the epic fans out the account/class
468
- // list fetches plus resetNewScheduleLocalData.
468
+ // list fetches, and clears entered data only when asked to.
469
469
  },
470
470
  },
471
471
  resetNewScheduleLocalData: {
@@ -194,7 +194,7 @@ export function getExpenseAutomationJESchedulesView(state) {
194
194
  const accruedSchedules = [];
195
195
  const oneTimeAccruals = [];
196
196
  const { accountState, accountListState, classState, classListState, expenseAutomationJESchedulesViewState, expenseAutomationViewState, monthEndCloseChecksState, monthEndCloseChecksViewState, } = state;
197
- const { jeScheduleTransactionKeysByPeriodAndTab, jeScheduleAccruedKeysByPeriodAndTab, jeScheduleOneTimeAccrualKeysByPeriodAndTab, failedJeScheduleTransactionKeysByPeriodAndTab, jeScheduleLocalDataById, postStatusById, ignoreStatusById, revertStatusById, uiState, error, fetchState, refreshStatus, newSchedule, } = expenseAutomationJESchedulesViewState;
197
+ const { jeScheduleTransactionKeysByPeriodAndTab, jeScheduleAccruedKeysByPeriodAndTab, jeScheduleOneTimeAccrualKeysByPeriodAndTab, failedJeScheduleTransactionKeysByPeriodAndTab, jeScheduleLocalDataById, postStatusById, ignoreStatusById, revertStatusById, oneTimeAccrualActionStatusById, uiState, error, fetchState, refreshStatus, newSchedule, } = expenseAutomationJESchedulesViewState;
198
198
  const accountSettingsView = getJEAccountSettingsView(state);
199
199
  const newScheduleView = newSchedule.selectedDetailScheduleType === 'fixed_assets' ||
200
200
  newSchedule.selectedDetailScheduleType === 'prepaid_expenses'
@@ -409,6 +409,7 @@ export function getExpenseAutomationJESchedulesView(state) {
409
409
  postStatusById: postStatusById,
410
410
  ignoreStatusById: ignoreStatusById,
411
411
  revertStatusById: revertStatusById,
412
+ oneTimeAccrualActionStatusById: oneTimeAccrualActionStatusById,
412
413
  fetchState: reducedFetchStatus.fetchState,
413
414
  jeScheduleLocalDataById: jeScheduleLocalDataById,
414
415
  uiState: uiState,
@@ -18,8 +18,12 @@ const initializeNewScheduleEpic = (actions$, state$) => actions$.pipe((0, operat
18
18
  if (classListState.fetchState === 'Not-Started') {
19
19
  newScheduleActions.push((0, classListReducer_1.fetchClassList)());
20
20
  }
21
- newScheduleActions.push((0, jeSchedulesViewReducer_1.resetNewScheduleLocalData)({ scheduleType: action.payload.scheduleType }));
22
- newScheduleActions.push((0, jeSchedulesViewReducer_1.clearSearchTransactionsForNewSchedule)());
21
+ // The account and class fetches above are idempotent (both guard on 'Not-Started'), so they
22
+ // can run on every open. Clearing what the user entered cannot, so it is opt-in.
23
+ if (action.payload.shouldResetEnteredData) {
24
+ newScheduleActions.push((0, jeSchedulesViewReducer_1.resetNewScheduleLocalData)({ scheduleType: action.payload.scheduleType }));
25
+ newScheduleActions.push((0, jeSchedulesViewReducer_1.clearSearchTransactionsForNewSchedule)());
26
+ }
23
27
  return (0, rxjs_1.from)(newScheduleActions);
24
28
  }));
25
29
  exports.initializeNewScheduleEpic = initializeNewScheduleEpic;
@@ -9,8 +9,14 @@ const transactionReducer_1 = require("../../../../../entity/transaction/transact
9
9
  const responsePayload_1 = require("../../../../../responsePayload");
10
10
  const jeSchedulesViewReducer_1 = require("../../../reducers/jeSchedulesViewReducer");
11
11
  const jeSchedulesViewState_1 = require("../../../types/jeSchedulesViewState");
12
- /** Dropdown-sized result set — no pagination for Base Transaction search. */
13
- const NEW_SCHEDULE_SEARCH_PAGE_SIZE = 10;
12
+ /**
13
+ * Dropdown-sized result set. The endpoint is paginated — it takes a `page_token` $skip offset and
14
+ * returns `next_page_token` — but nothing here reads or sends those, so this is the whole result
15
+ * set the form ever sees. 20 rather than the backend's default of 10 because a text search for one
16
+ * known transaction was running out of room; the cap server-side is 100 if this needs raising again
17
+ * before infinite scroll is wired up.
18
+ */
19
+ const NEW_SCHEDULE_SEARCH_PAGE_SIZE = 20;
14
20
  /** Fallback when the backend sends a null currency for a search result. */
15
21
  const DEFAULT_CURRENCY_CODE = 'USD';
16
22
  const DEFAULT_CURRENCY_SYMBOL = '$';
@@ -81,8 +81,10 @@ export declare const clearExpenseAutomationJESchedulesView: import("@reduxjs/too
81
81
  jeScheduleTransactionKeys: (`${string}_expense_${string}` | `${string}_check_${string}` | `${string}_refund_${string}` | `${string}_invoice_${string}` | `${string}_payment_${string}` | `${string}_credit_memo_${string}` | `${string}_sales_receipt_${string}` | `${string}_delayed_credit_${string}` | `${string}_delayed_charge_${string}` | `${string}_bill_${string}` | `${string}_bill_payment_${string}` | `${string}_bill_payment_check_${string}` | `${string}_bill_payment_credit_card_${string}` | `${string}_vendor_credit_${string}` | `${string}_credit_card_credit_${string}` | `${string}_transfer_${string}` | `${string}_credit_card_payment_${string}` | `${string}_deposit_${string}` | `${string}_journal_entry_${string}`)[];
82
82
  }, "expenseAutomationJESchedulesView/initializeJeScheduleLocalData", never, never>, initializeNewSchedule: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[{
83
83
  scheduleType: "fixed_assets" | "prepaid_expenses";
84
+ shouldResetEnteredData?: boolean;
84
85
  }], {
85
86
  scheduleType: "prepaid_expenses" | "fixed_assets";
87
+ shouldResetEnteredData: boolean;
86
88
  }, "expenseAutomationJESchedulesView/initializeNewSchedule", never, never>, removeFailedJeScheduleTransactionKey: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[failedJeScheduleKey: `${string}_expense_${string}` | `${string}_check_${string}` | `${string}_refund_${string}` | `${string}_invoice_${string}` | `${string}_payment_${string}` | `${string}_credit_memo_${string}` | `${string}_sales_receipt_${string}` | `${string}_delayed_credit_${string}` | `${string}_delayed_charge_${string}` | `${string}_bill_${string}` | `${string}_bill_payment_${string}` | `${string}_bill_payment_check_${string}` | `${string}_bill_payment_credit_card_${string}` | `${string}_vendor_credit_${string}` | `${string}_credit_card_credit_${string}` | `${string}_transfer_${string}` | `${string}_credit_card_payment_${string}` | `${string}_deposit_${string}` | `${string}_journal_entry_${string}`, selectedPeriod: MonthYearPeriod], {
87
89
  failedJeScheduleKey: `${string}_expense_${string}` | `${string}_check_${string}` | `${string}_refund_${string}` | `${string}_invoice_${string}` | `${string}_payment_${string}` | `${string}_credit_memo_${string}` | `${string}_sales_receipt_${string}` | `${string}_delayed_credit_${string}` | `${string}_delayed_charge_${string}` | `${string}_bill_${string}` | `${string}_bill_payment_${string}` | `${string}_bill_payment_check_${string}` | `${string}_bill_payment_credit_card_${string}` | `${string}_vendor_credit_${string}` | `${string}_credit_card_credit_${string}` | `${string}_transfer_${string}` | `${string}_credit_card_payment_${string}` | `${string}_deposit_${string}` | `${string}_journal_entry_${string}`;
88
90
  selectedPeriod: MonthYearPeriod;
@@ -466,12 +466,12 @@ const expenseAutomationJESchedulesView = (0, toolkit_1.createSlice)({
466
466
  draft.accountSettings.localData = exports.accountSettingsInitialState.localData;
467
467
  },
468
468
  initializeNewSchedule: {
469
- prepare({ scheduleType, }) {
470
- return { payload: { scheduleType } };
469
+ prepare({ scheduleType, shouldResetEnteredData = true, }) {
470
+ return { payload: { scheduleType, shouldResetEnteredData } };
471
471
  },
472
472
  reducer() {
473
473
  // Purely an epic-trigger action — the epic fans out the account/class
474
- // list fetches plus resetNewScheduleLocalData.
474
+ // list fetches, and clears entered data only when asked to.
475
475
  },
476
476
  },
477
477
  resetNewScheduleLocalData: {
@@ -48,6 +48,7 @@ export interface ExpenseAutomationJESchedulesViewSelector extends SelectorView {
48
48
  };
49
49
  kpiSummary: JEKpiSummary;
50
50
  newScheduleView: NewScheduleView | undefined;
51
+ oneTimeAccrualActionStatusById: Record<ID, FetchStateAndError>;
51
52
  pendingReviewSchedules: JEScheduleRow[];
52
53
  pendingReviewTotal: number;
53
54
  postStatusById: Record<ID, FetchStateAndError>;
@@ -209,7 +209,7 @@ function getExpenseAutomationJESchedulesView(state) {
209
209
  const accruedSchedules = [];
210
210
  const oneTimeAccruals = [];
211
211
  const { accountState, accountListState, classState, classListState, expenseAutomationJESchedulesViewState, expenseAutomationViewState, monthEndCloseChecksState, monthEndCloseChecksViewState, } = state;
212
- const { jeScheduleTransactionKeysByPeriodAndTab, jeScheduleAccruedKeysByPeriodAndTab, jeScheduleOneTimeAccrualKeysByPeriodAndTab, failedJeScheduleTransactionKeysByPeriodAndTab, jeScheduleLocalDataById, postStatusById, ignoreStatusById, revertStatusById, uiState, error, fetchState, refreshStatus, newSchedule, } = expenseAutomationJESchedulesViewState;
212
+ const { jeScheduleTransactionKeysByPeriodAndTab, jeScheduleAccruedKeysByPeriodAndTab, jeScheduleOneTimeAccrualKeysByPeriodAndTab, failedJeScheduleTransactionKeysByPeriodAndTab, jeScheduleLocalDataById, postStatusById, ignoreStatusById, revertStatusById, oneTimeAccrualActionStatusById, uiState, error, fetchState, refreshStatus, newSchedule, } = expenseAutomationJESchedulesViewState;
213
213
  const accountSettingsView = (0, jeAccountSettingsViewSelector_1.getJEAccountSettingsView)(state);
214
214
  const newScheduleView = newSchedule.selectedDetailScheduleType === 'fixed_assets' ||
215
215
  newSchedule.selectedDetailScheduleType === 'prepaid_expenses'
@@ -424,6 +424,7 @@ function getExpenseAutomationJESchedulesView(state) {
424
424
  postStatusById: postStatusById,
425
425
  ignoreStatusById: ignoreStatusById,
426
426
  revertStatusById: revertStatusById,
427
+ oneTimeAccrualActionStatusById: oneTimeAccrualActionStatusById,
427
428
  fetchState: reducedFetchStatus.fetchState,
428
429
  jeScheduleLocalDataById: jeScheduleLocalDataById,
429
430
  uiState: uiState,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.1.92-betaRD10",
3
+ "version": "5.1.92-betaRD12",
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",