@zeniai/client-epic-state 4.14.74 → 4.14.76

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 (28) hide show
  1. package/lib/epic.d.ts +5 -1
  2. package/lib/epic.js +5 -1
  3. package/lib/index.d.ts +12 -11
  4. package/lib/index.js +31 -29
  5. package/lib/view/accountMappingView/accountMappingTypeHelper.d.ts +17 -0
  6. package/lib/view/accountMappingView/accountMappingTypeHelper.js +2 -0
  7. package/lib/view/expenseAutomationView/epics/jeSchedule/accountSettings/fetchAccountSettingsListForAccountTypesEpic.d.ts +8 -0
  8. package/lib/view/expenseAutomationView/epics/jeSchedule/accountSettings/fetchAccountSettingsListForAccountTypesEpic.js +41 -0
  9. package/lib/view/expenseAutomationView/epics/jeSchedule/accountSettings/fetchRecommendationForAccountSettingsEpic.d.ts +7 -0
  10. package/lib/view/expenseAutomationView/epics/jeSchedule/accountSettings/fetchRecommendationForAccountSettingsEpic.js +27 -0
  11. package/lib/view/expenseAutomationView/epics/jeSchedule/accountSettings/initializeAccountSettingsViewEpic.d.ts +4 -0
  12. package/lib/view/expenseAutomationView/epics/jeSchedule/accountSettings/initializeAccountSettingsViewEpic.js +13 -0
  13. package/lib/view/expenseAutomationView/epics/jeSchedule/accountSettings/saveAccountSettingsViewEpic.d.ts +8 -0
  14. package/lib/view/expenseAutomationView/epics/jeSchedule/accountSettings/saveAccountSettingsViewEpic.js +50 -0
  15. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.d.ts +2 -2
  16. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +1 -0
  17. package/lib/view/expenseAutomationView/helpers/jeAccountSettingHelper.d.ts +3 -0
  18. package/lib/view/expenseAutomationView/helpers/jeAccountSettingHelper.js +50 -0
  19. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +19 -6
  20. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +153 -2
  21. package/lib/view/expenseAutomationView/selectorTypes/jeAccountSettingsViewSelectorTypes.d.ts +19 -0
  22. package/lib/view/expenseAutomationView/selectorTypes/jeAccountSettingsViewSelectorTypes.js +2 -0
  23. package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +2 -0
  24. package/lib/view/expenseAutomationView/selectors/jeAccountSettingsViewSelector.d.ts +3 -0
  25. package/lib/view/expenseAutomationView/selectors/jeAccountSettingsViewSelector.js +41 -0
  26. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +3 -0
  27. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +27 -0
  28. package/package.json +2 -2
@@ -1,11 +1,14 @@
1
1
  import { ID } from '../../../commonStateTypes/common';
2
2
  import { MonthYearPeriod, TimePeriod } from '../../../commonStateTypes/timePeriod';
3
+ import { AccountMetadataPayload } from '../../../entity/account/accountPayload';
3
4
  import { JEScheduledTransactionPayload } from '../../../entity/jeSchedules/jeSchedulesPayload';
4
5
  import { JEScheduleTransactionKey } from '../../../entity/jeSchedules/jeSchedulesTypes';
5
6
  import { ZeniAPIStatus } from '../../../responsePayload';
6
- import { JEScheduleLocalData, JESchedulesViewState } from '../types/jeSchedulesViewState';
7
+ import { AccountTypeRecommendationPayload } from '../../accountMappingView/accountTypeRecommendation/accountTypeRecommendationPayload';
8
+ import { AccountSettingsLocalData, AccountSettingsState, JEScheduleLocalData, JESchedulesViewState } from '../types/jeSchedulesViewState';
9
+ export declare const accountSettingsInitialState: AccountSettingsState;
7
10
  export declare const initialState: JESchedulesViewState;
8
- export declare const clearExpenseAutomationJESchedulesView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationJESchedulesView/clearExpenseAutomationJESchedulesView">, clearJeScheduleLocalData: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationJESchedulesView/clearJeScheduleLocalData">, fetchJeSchedules: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[period: TimePeriod, refreshViewInBackground?: any], {
11
+ export declare const clearExpenseAutomationJESchedulesView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationJESchedulesView/clearExpenseAutomationJESchedulesView">, clearJeAccountSettingsLocalData: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationJESchedulesView/clearJeAccountSettingsLocalData">, clearJeScheduleLocalData: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationJESchedulesView/clearJeScheduleLocalData">, fetchAccountSettingsListForAccountTypes: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationJESchedulesView/fetchAccountSettingsListForAccountTypes">, fetchJeSchedules: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[period: TimePeriod, refreshViewInBackground?: any], {
9
12
  period: TimePeriod;
10
13
  refreshViewInBackground: any;
11
14
  }, "expenseAutomationJESchedulesView/fetchJeSchedules", never, never>, fetchJeSchedulesFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
@@ -19,7 +22,7 @@ export declare const clearExpenseAutomationJESchedulesView: import("@reduxjs/too
19
22
  failedJeSchedules: JEScheduledTransactionPayload[];
20
23
  selectedPeriod: MonthYearPeriod;
21
24
  refreshViewInBackground: boolean;
22
- }, "expenseAutomationJESchedulesView/fetchJeSchedulesSuccess">, ignoreRecommendedJeSchedule: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[jeScheduleTransactionKey: `${string}_transfer` | `${string}_invoice` | `${string}_payment` | `${string}_credit_memo` | `${string}_sales_receipt` | `${string}_delayed_credit` | `${string}_delayed_charge` | `${string}_refund` | `${string}_expense` | `${string}_check` | `${string}_bill` | `${string}_bill_payment` | `${string}_bill_payment_check` | `${string}_bill_payment_credit_card` | `${string}_vendor_credit` | `${string}_credit_card_credit` | `${string}_credit_card_payment` | `${string}_deposit` | `${string}_journal_entry`, scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue"], {
25
+ }, "expenseAutomationJESchedulesView/fetchJeSchedulesSuccess">, fetchRecommendationForAccountSettings: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationJESchedulesView/fetchRecommendationForAccountSettings">, ignoreRecommendedJeSchedule: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[jeScheduleTransactionKey: `${string}_transfer` | `${string}_invoice` | `${string}_payment` | `${string}_credit_memo` | `${string}_sales_receipt` | `${string}_delayed_credit` | `${string}_delayed_charge` | `${string}_refund` | `${string}_expense` | `${string}_check` | `${string}_bill` | `${string}_bill_payment` | `${string}_bill_payment_check` | `${string}_bill_payment_credit_card` | `${string}_vendor_credit` | `${string}_credit_card_credit` | `${string}_credit_card_payment` | `${string}_deposit` | `${string}_journal_entry`, scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue"], {
23
26
  jeScheduleTransactionKey: `${string}_transfer` | `${string}_invoice` | `${string}_payment` | `${string}_credit_memo` | `${string}_sales_receipt` | `${string}_delayed_credit` | `${string}_delayed_charge` | `${string}_refund` | `${string}_expense` | `${string}_check` | `${string}_bill` | `${string}_bill_payment` | `${string}_bill_payment_check` | `${string}_bill_payment_credit_card` | `${string}_vendor_credit` | `${string}_credit_card_credit` | `${string}_credit_card_payment` | `${string}_deposit` | `${string}_journal_entry`;
24
27
  scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue";
25
28
  }, "expenseAutomationJESchedulesView/ignoreRecommendedJeSchedule", never, never>, ignoreRecommendedJeScheduleFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
@@ -27,7 +30,7 @@ export declare const clearExpenseAutomationJESchedulesView: import("@reduxjs/too
27
30
  status: ZeniAPIStatus;
28
31
  }, "expenseAutomationJESchedulesView/ignoreRecommendedJeScheduleFailure">, ignoreRecommendedJeScheduleSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[jeScheduleTransactionKey: `${string}_transfer` | `${string}_invoice` | `${string}_payment` | `${string}_credit_memo` | `${string}_sales_receipt` | `${string}_delayed_credit` | `${string}_delayed_charge` | `${string}_refund` | `${string}_expense` | `${string}_check` | `${string}_bill` | `${string}_bill_payment` | `${string}_bill_payment_check` | `${string}_bill_payment_credit_card` | `${string}_vendor_credit` | `${string}_credit_card_credit` | `${string}_credit_card_payment` | `${string}_deposit` | `${string}_journal_entry`], {
29
32
  jeScheduleTransactionKey: `${string}_transfer` | `${string}_invoice` | `${string}_payment` | `${string}_credit_memo` | `${string}_sales_receipt` | `${string}_delayed_credit` | `${string}_delayed_charge` | `${string}_refund` | `${string}_expense` | `${string}_check` | `${string}_bill` | `${string}_bill_payment` | `${string}_bill_payment_check` | `${string}_bill_payment_credit_card` | `${string}_vendor_credit` | `${string}_credit_card_credit` | `${string}_credit_card_payment` | `${string}_deposit` | `${string}_journal_entry`;
30
- }, "expenseAutomationJESchedulesView/ignoreRecommendedJeScheduleSuccess", never, never>, initializeJeScheduleLocalData: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[jeSchedules: JEScheduledTransactionPayload[]], {
33
+ }, "expenseAutomationJESchedulesView/ignoreRecommendedJeScheduleSuccess", never, never>, initializeAccountSettingsView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationJESchedulesView/initializeAccountSettingsView">, initializeJeScheduleLocalData: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[jeSchedules: JEScheduledTransactionPayload[]], {
31
34
  jeScheduleTransactionKeys: (`${string}_transfer` | `${string}_invoice` | `${string}_payment` | `${string}_credit_memo` | `${string}_sales_receipt` | `${string}_delayed_credit` | `${string}_delayed_charge` | `${string}_refund` | `${string}_expense` | `${string}_check` | `${string}_bill` | `${string}_bill_payment` | `${string}_bill_payment_check` | `${string}_bill_payment_credit_card` | `${string}_vendor_credit` | `${string}_credit_card_credit` | `${string}_credit_card_payment` | `${string}_deposit` | `${string}_journal_entry`)[];
32
35
  }, "expenseAutomationJESchedulesView/initializeJeScheduleLocalData", never, never>, removeFailedJeScheduleTransactionKey: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[failedJeScheduleKey: `${string}_transfer` | `${string}_invoice` | `${string}_payment` | `${string}_credit_memo` | `${string}_sales_receipt` | `${string}_delayed_credit` | `${string}_delayed_charge` | `${string}_refund` | `${string}_expense` | `${string}_check` | `${string}_bill` | `${string}_bill_payment` | `${string}_bill_payment_check` | `${string}_bill_payment_credit_card` | `${string}_vendor_credit` | `${string}_credit_card_credit` | `${string}_credit_card_payment` | `${string}_deposit` | `${string}_journal_entry`, selectedPeriod: MonthYearPeriod], {
33
36
  failedJeScheduleKey: `${string}_transfer` | `${string}_invoice` | `${string}_payment` | `${string}_credit_memo` | `${string}_sales_receipt` | `${string}_delayed_credit` | `${string}_delayed_charge` | `${string}_refund` | `${string}_expense` | `${string}_check` | `${string}_bill` | `${string}_bill_payment` | `${string}_bill_payment_check` | `${string}_bill_payment_credit_card` | `${string}_vendor_credit` | `${string}_credit_card_credit` | `${string}_credit_card_payment` | `${string}_deposit` | `${string}_journal_entry`;
@@ -45,12 +48,22 @@ export declare const clearExpenseAutomationJESchedulesView: import("@reduxjs/too
45
48
  status: ZeniAPIStatus;
46
49
  }, "expenseAutomationJESchedulesView/retryJeScheduleFailure">, retryJeScheduleSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
47
50
  scheduledJournalEntryID: ID;
48
- }, "expenseAutomationJESchedulesView/retryJeScheduleSuccess">, updateJeScheduleLocalDataById: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
51
+ }, "expenseAutomationJESchedulesView/retryJeScheduleSuccess">, saveAccountSettings: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationJESchedulesView/saveAccountSettings">, saveAccountSettingsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
52
+ status: ZeniAPIStatus;
53
+ }, "expenseAutomationJESchedulesView/saveAccountSettingsFailure">, saveAccountSettingsLocalData: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
54
+ data: Partial<AccountSettingsLocalData>;
55
+ }, "expenseAutomationJESchedulesView/saveAccountSettingsLocalData">, saveAccountSettingsSuccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationJESchedulesView/saveAccountSettingsSuccess">, updateAccountSettingsListForAccountTypes: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
56
+ accountPayload: AccountMetadataPayload[];
57
+ }, "expenseAutomationJESchedulesView/updateAccountSettingsListForAccountTypes">, updateAccountSettingsListForAccountTypesFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
58
+ status: ZeniAPIStatus;
59
+ }, "expenseAutomationJESchedulesView/updateAccountSettingsListForAccountTypesFailure">, updateJeScheduleLocalDataById: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
49
60
  scheduledJournalEntryID: ID;
50
61
  localData: Partial<JEScheduleLocalData>;
51
62
  }, "expenseAutomationJESchedulesView/updateJeScheduleLocalDataById">, updateJeScheduleTransactionKeys: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[jeScheduleKeys: (`${string}_transfer` | `${string}_invoice` | `${string}_payment` | `${string}_credit_memo` | `${string}_sales_receipt` | `${string}_delayed_credit` | `${string}_delayed_charge` | `${string}_refund` | `${string}_expense` | `${string}_check` | `${string}_bill` | `${string}_bill_payment` | `${string}_bill_payment_check` | `${string}_bill_payment_credit_card` | `${string}_vendor_credit` | `${string}_credit_card_credit` | `${string}_credit_card_payment` | `${string}_deposit` | `${string}_journal_entry`)[], selectedPeriod: MonthYearPeriod], {
52
63
  jeScheduleKeys: (`${string}_transfer` | `${string}_invoice` | `${string}_payment` | `${string}_credit_memo` | `${string}_sales_receipt` | `${string}_delayed_credit` | `${string}_delayed_charge` | `${string}_refund` | `${string}_expense` | `${string}_check` | `${string}_bill` | `${string}_bill_payment` | `${string}_bill_payment_check` | `${string}_bill_payment_credit_card` | `${string}_vendor_credit` | `${string}_credit_card_credit` | `${string}_credit_card_payment` | `${string}_deposit` | `${string}_journal_entry`)[];
53
64
  selectedPeriod: MonthYearPeriod;
54
- }, "expenseAutomationJESchedulesView/updateJeScheduleTransactionKeys", never, never>;
65
+ }, "expenseAutomationJESchedulesView/updateJeScheduleTransactionKeys", never, never>, updateRecommendationForAccountSettings: import("@reduxjs/toolkit").ActionCreatorWithPayload<AccountTypeRecommendationPayload, "expenseAutomationJESchedulesView/updateRecommendationForAccountSettings">, updateRecommendationForAccountSettingsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
66
+ status: ZeniAPIStatus;
67
+ }, "expenseAutomationJESchedulesView/updateRecommendationForAccountSettingsFailure">;
55
68
  declare const _default: import("redux").Reducer<JESchedulesViewState>;
56
69
  export default _default;
@@ -1,12 +1,46 @@
1
1
  "use strict";
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.updateJeScheduleTransactionKeys = exports.updateJeScheduleLocalDataById = exports.retryJeScheduleSuccess = exports.retryJeScheduleFailure = exports.retryJeSchedule = exports.removeJeScheduleTransactionKey = exports.removeJeScheduleLocalDataById = exports.removeFailedJeScheduleTransactionKey = exports.initializeJeScheduleLocalData = exports.ignoreRecommendedJeScheduleSuccess = exports.ignoreRecommendedJeScheduleFailure = exports.ignoreRecommendedJeSchedule = exports.fetchJeSchedulesSuccess = exports.fetchJeSchedulesPage = exports.fetchJeSchedulesFailure = exports.fetchJeSchedules = exports.clearJeScheduleLocalData = exports.clearExpenseAutomationJESchedulesView = exports.initialState = void 0;
4
+ exports.updateRecommendationForAccountSettingsFailure = exports.updateRecommendationForAccountSettings = exports.updateJeScheduleTransactionKeys = exports.updateJeScheduleLocalDataById = exports.updateAccountSettingsListForAccountTypesFailure = exports.updateAccountSettingsListForAccountTypes = exports.saveAccountSettingsSuccess = exports.saveAccountSettingsLocalData = exports.saveAccountSettingsFailure = exports.saveAccountSettings = exports.retryJeScheduleSuccess = exports.retryJeScheduleFailure = exports.retryJeSchedule = exports.removeJeScheduleTransactionKey = exports.removeJeScheduleLocalDataById = exports.removeFailedJeScheduleTransactionKey = exports.initializeJeScheduleLocalData = exports.initializeAccountSettingsView = exports.ignoreRecommendedJeScheduleSuccess = exports.ignoreRecommendedJeScheduleFailure = exports.ignoreRecommendedJeSchedule = exports.fetchRecommendationForAccountSettings = exports.fetchJeSchedulesSuccess = exports.fetchJeSchedulesPage = exports.fetchJeSchedulesFailure = exports.fetchJeSchedules = exports.fetchAccountSettingsListForAccountTypes = exports.clearJeScheduleLocalData = exports.clearJeAccountSettingsLocalData = exports.clearExpenseAutomationJESchedulesView = exports.initialState = exports.accountSettingsInitialState = void 0;
5
5
  const toolkit_1 = require("@reduxjs/toolkit");
6
+ const getNestedAccountIDHierarchyForReport_1 = require("../../../commonStateTypes/accountView/getNestedAccountIDHierarchyForReport");
6
7
  const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
8
+ const accountPayload_1 = require("../../../entity/account/accountPayload");
7
9
  const jeSchedulesPayload_1 = require("../../../entity/jeSchedules/jeSchedulesPayload");
8
10
  const transactionIDPayload_1 = require("../../../entity/transaction/payloadTypes/transactionIDPayload");
11
+ const accountTypeRecommendationPayload_1 = require("../../accountMappingView/accountTypeRecommendation/accountTypeRecommendationPayload");
9
12
  const transactionDetailState_1 = require("../../transactionDetail/transactionDetailState");
13
+ exports.accountSettingsInitialState = {
14
+ localData: {
15
+ selectedPrepaidExpensesAccountIds: [],
16
+ selectedFixedAssetsAccountIds: [],
17
+ selectedAccruedExpensesAccountIds: [],
18
+ previousPrepaidExpensesAccount: [],
19
+ previousFixedAssetsAccount: [],
20
+ previousAccruedExpensesAccount: [],
21
+ },
22
+ accountListFetchState: {
23
+ error: undefined,
24
+ fetchState: 'Not-Started',
25
+ },
26
+ recommendationFetchState: {
27
+ error: undefined,
28
+ fetchState: 'Not-Started',
29
+ },
30
+ updateFetchState: {
31
+ error: undefined,
32
+ fetchState: 'Not-Started',
33
+ },
34
+ prepaidExpensesAccountIdList: [], // list of prepaid expenses accounts
35
+ prepaidExpensesNestedAccountListHierarchy: [],
36
+ prepaidExpensesRecommendations: [],
37
+ fixedAssetsAccountIdList: [], // list of fixed assets accounts
38
+ fixedAssetsNestedAccountListHierarchy: [],
39
+ fixedAssetsRecommendations: [],
40
+ accruedExpensesAccountIdList: [], // list of accrued expenses accounts
41
+ accruedExpensesNestedAccountListHierarchy: [],
42
+ accruedExpensesRecommendations: [],
43
+ };
10
44
  exports.initialState = {
11
45
  jeScheduleTransactionKeysByPeriod: {},
12
46
  failedJeScheduleTransactionKeysByPeriod: {},
@@ -23,6 +57,7 @@ exports.initialState = {
23
57
  fetchState: 'Not-Started',
24
58
  error: undefined,
25
59
  },
60
+ accountSettings: exports.accountSettingsInitialState,
26
61
  fetchState: 'Not-Started',
27
62
  error: undefined,
28
63
  hasValidState() {
@@ -256,10 +291,126 @@ const expenseAutomationJESchedulesView = (0, toolkit_1.createSlice)({
256
291
  const { scheduledJournalEntryID } = action.payload;
257
292
  delete draft.jeScheduleLocalDataById[scheduledJournalEntryID];
258
293
  },
294
+ initializeAccountSettingsView(draft) {
295
+ draft.accountSettings.localData = exports.accountSettingsInitialState.localData;
296
+ },
297
+ fetchRecommendationForAccountSettings(draft) {
298
+ draft.accountSettings.recommendationFetchState = {
299
+ error: undefined,
300
+ fetchState: 'In-Progress',
301
+ };
302
+ },
303
+ fetchAccountSettingsListForAccountTypes(draft) {
304
+ draft.accountSettings.accountListFetchState = {
305
+ error: undefined,
306
+ fetchState: 'In-Progress',
307
+ };
308
+ },
309
+ updateRecommendationForAccountSettings(draft, action) {
310
+ doUpdateRecommendationForAccountSettings(draft.accountSettings, action.payload);
311
+ },
312
+ updateRecommendationForAccountSettingsFailure(draft, action) {
313
+ const { status } = action.payload;
314
+ draft.accountSettings.recommendationFetchState = {
315
+ error: status,
316
+ fetchState: 'Error',
317
+ };
318
+ },
319
+ updateAccountSettingsListForAccountTypesFailure(draft, action) {
320
+ const { status } = action.payload;
321
+ draft.accountSettings.accountListFetchState = {
322
+ error: status,
323
+ fetchState: 'Error',
324
+ };
325
+ },
326
+ updateAccountSettingsListForAccountTypes(draft, action) {
327
+ doUpdateAccountSettingsListForAccountTypes(draft.accountSettings, action.payload.accountPayload);
328
+ },
329
+ saveAccountSettings(draft) {
330
+ draft.accountSettings.updateFetchState = {
331
+ error: undefined,
332
+ fetchState: 'In-Progress',
333
+ };
334
+ },
335
+ saveAccountSettingsSuccess(draft) {
336
+ draft.accountSettings.updateFetchState = {
337
+ error: undefined,
338
+ fetchState: 'Completed',
339
+ };
340
+ },
341
+ saveAccountSettingsLocalData(draft, action) {
342
+ const { data } = action.payload;
343
+ draft.accountSettings.localData = Object.assign(Object.assign({}, draft.accountSettings.localData), data);
344
+ },
345
+ saveAccountSettingsFailure(draft, action) {
346
+ const { status } = action.payload;
347
+ draft.accountSettings.updateFetchState = {
348
+ error: status,
349
+ fetchState: 'Error',
350
+ };
351
+ },
352
+ clearJeAccountSettingsLocalData(draft) {
353
+ draft.accountSettings.localData = exports.accountSettingsInitialState.localData;
354
+ },
259
355
  clearExpenseAutomationJESchedulesView(draft) {
260
356
  Object.assign(draft, exports.initialState);
261
357
  },
262
358
  },
263
359
  });
264
- _a = expenseAutomationJESchedulesView.actions, exports.clearExpenseAutomationJESchedulesView = _a.clearExpenseAutomationJESchedulesView, exports.clearJeScheduleLocalData = _a.clearJeScheduleLocalData, exports.fetchJeSchedules = _a.fetchJeSchedules, exports.fetchJeSchedulesFailure = _a.fetchJeSchedulesFailure, exports.fetchJeSchedulesPage = _a.fetchJeSchedulesPage, exports.fetchJeSchedulesSuccess = _a.fetchJeSchedulesSuccess, exports.ignoreRecommendedJeSchedule = _a.ignoreRecommendedJeSchedule, exports.ignoreRecommendedJeScheduleFailure = _a.ignoreRecommendedJeScheduleFailure, exports.ignoreRecommendedJeScheduleSuccess = _a.ignoreRecommendedJeScheduleSuccess, exports.initializeJeScheduleLocalData = _a.initializeJeScheduleLocalData, exports.removeFailedJeScheduleTransactionKey = _a.removeFailedJeScheduleTransactionKey, exports.removeJeScheduleLocalDataById = _a.removeJeScheduleLocalDataById, exports.removeJeScheduleTransactionKey = _a.removeJeScheduleTransactionKey, exports.retryJeSchedule = _a.retryJeSchedule, exports.retryJeScheduleFailure = _a.retryJeScheduleFailure, exports.retryJeScheduleSuccess = _a.retryJeScheduleSuccess, exports.updateJeScheduleLocalDataById = _a.updateJeScheduleLocalDataById, exports.updateJeScheduleTransactionKeys = _a.updateJeScheduleTransactionKeys;
360
+ _a = expenseAutomationJESchedulesView.actions, exports.clearExpenseAutomationJESchedulesView = _a.clearExpenseAutomationJESchedulesView, exports.clearJeAccountSettingsLocalData = _a.clearJeAccountSettingsLocalData, exports.clearJeScheduleLocalData = _a.clearJeScheduleLocalData, exports.fetchAccountSettingsListForAccountTypes = _a.fetchAccountSettingsListForAccountTypes, exports.fetchJeSchedules = _a.fetchJeSchedules, exports.fetchJeSchedulesFailure = _a.fetchJeSchedulesFailure, exports.fetchJeSchedulesPage = _a.fetchJeSchedulesPage, exports.fetchJeSchedulesSuccess = _a.fetchJeSchedulesSuccess, exports.fetchRecommendationForAccountSettings = _a.fetchRecommendationForAccountSettings, exports.ignoreRecommendedJeSchedule = _a.ignoreRecommendedJeSchedule, exports.ignoreRecommendedJeScheduleFailure = _a.ignoreRecommendedJeScheduleFailure, exports.ignoreRecommendedJeScheduleSuccess = _a.ignoreRecommendedJeScheduleSuccess, exports.initializeAccountSettingsView = _a.initializeAccountSettingsView, exports.initializeJeScheduleLocalData = _a.initializeJeScheduleLocalData, exports.removeFailedJeScheduleTransactionKey = _a.removeFailedJeScheduleTransactionKey, exports.removeJeScheduleLocalDataById = _a.removeJeScheduleLocalDataById, exports.removeJeScheduleTransactionKey = _a.removeJeScheduleTransactionKey, exports.retryJeSchedule = _a.retryJeSchedule, exports.retryJeScheduleFailure = _a.retryJeScheduleFailure, exports.retryJeScheduleSuccess = _a.retryJeScheduleSuccess, exports.saveAccountSettings = _a.saveAccountSettings, exports.saveAccountSettingsFailure = _a.saveAccountSettingsFailure, exports.saveAccountSettingsLocalData = _a.saveAccountSettingsLocalData, exports.saveAccountSettingsSuccess = _a.saveAccountSettingsSuccess, exports.updateAccountSettingsListForAccountTypes = _a.updateAccountSettingsListForAccountTypes, exports.updateAccountSettingsListForAccountTypesFailure = _a.updateAccountSettingsListForAccountTypesFailure, exports.updateJeScheduleLocalDataById = _a.updateJeScheduleLocalDataById, exports.updateJeScheduleTransactionKeys = _a.updateJeScheduleTransactionKeys, exports.updateRecommendationForAccountSettings = _a.updateRecommendationForAccountSettings, exports.updateRecommendationForAccountSettingsFailure = _a.updateRecommendationForAccountSettingsFailure;
265
361
  exports.default = expenseAutomationJESchedulesView.reducer;
362
+ const doUpdateRecommendationForAccountSettings = (draft, payload) => {
363
+ const { prepaidExpensesRecommendations, fixedAssetsRecommendations, accruedExpensesRecommendations, } = (0, accountTypeRecommendationPayload_1.mapAccountTypeRecommendationPayloadToAccountRecommendationByType)(payload);
364
+ draft.prepaidExpensesRecommendations = prepaidExpensesRecommendations;
365
+ draft.fixedAssetsRecommendations = fixedAssetsRecommendations;
366
+ draft.accruedExpensesRecommendations = accruedExpensesRecommendations;
367
+ draft.recommendationFetchState = {
368
+ error: undefined,
369
+ fetchState: 'Completed',
370
+ };
371
+ };
372
+ const doUpdateAccountSettingsListForAccountTypes = (draft, accountPayloadList) => {
373
+ const prepaidExpensesList = [];
374
+ const fixedAssetsList = [];
375
+ const accruedExpensesList = [];
376
+ accountPayloadList.forEach((account) => {
377
+ if (account.account_type === 'other_current_assets') {
378
+ prepaidExpensesList.push(account); // list of prepaid expenses
379
+ }
380
+ else if (account.account_type === 'fixed_assets' ||
381
+ account.account_type === 'other_assets') {
382
+ fixedAssetsList.push(account); // list for fixed assets
383
+ }
384
+ else if (account.account_type === 'other_current_liabilities') {
385
+ accruedExpensesList.push(account); // list for accrued expenses
386
+ }
387
+ });
388
+ draft.prepaidExpensesAccountIdList = prepaidExpensesList.map((account) => account.account_id);
389
+ draft.fixedAssetsAccountIdList = fixedAssetsList.map((account) => account.account_id);
390
+ draft.accruedExpensesAccountIdList = accruedExpensesList.map((account) => account.account_id);
391
+ // Prepaid expenses
392
+ const prepaidExpensesAccountMetadata = prepaidExpensesList.map((acc) => (0, accountPayload_1.mapAccountMetadataPayloadToAccountMetadata)(acc));
393
+ const prepaidExpensesAccountBase = prepaidExpensesList.map((acc) => (0, accountPayload_1.mapAccountBasePayloadToAccountBase)(acc));
394
+ const prepaidExpensesAccountsIdentified = prepaidExpensesAccountBase.filter((account) => account.labels.includes('prepaid_expenses'));
395
+ draft.localData = Object.assign(Object.assign({}, draft.localData), { selectedPrepaidExpensesAccountIds: prepaidExpensesAccountsIdentified.map((account) => account.accountId), previousPrepaidExpensesAccount: prepaidExpensesAccountsIdentified });
396
+ draft.prepaidExpensesNestedAccountListHierarchy =
397
+ (0, getNestedAccountIDHierarchyForReport_1.geNestedAccountIDHierarchyForReport)(prepaidExpensesAccountMetadata);
398
+ // Fixed assets
399
+ const fixedAssetsAccountMetadata = fixedAssetsList.map((acc) => (0, accountPayload_1.mapAccountMetadataPayloadToAccountMetadata)(acc));
400
+ const fixedAssetsAccountBase = fixedAssetsList.map((acc) => (0, accountPayload_1.mapAccountBasePayloadToAccountBase)(acc));
401
+ const fixedAssetsAccountsIdentified = fixedAssetsAccountBase.filter((account) => account.labels.includes('fixed_assets'));
402
+ draft.localData = Object.assign(Object.assign({}, draft.localData), { selectedFixedAssetsAccountIds: fixedAssetsAccountsIdentified.map((account) => account.accountId), previousFixedAssetsAccount: fixedAssetsAccountsIdentified });
403
+ draft.fixedAssetsNestedAccountListHierarchy =
404
+ (0, getNestedAccountIDHierarchyForReport_1.geNestedAccountIDHierarchyForReport)(fixedAssetsAccountMetadata);
405
+ // Accrued expenses
406
+ const accruedExpensesAccountMetadata = accruedExpensesList.map((acc) => (0, accountPayload_1.mapAccountMetadataPayloadToAccountMetadata)(acc));
407
+ const accruedExpensesAccountBase = accruedExpensesList.map((acc) => (0, accountPayload_1.mapAccountBasePayloadToAccountBase)(acc));
408
+ const accruedExpensesAccountsIdentified = accruedExpensesAccountBase.filter((account) => account.labels.includes('accrued_expenses'));
409
+ draft.localData = Object.assign(Object.assign({}, draft.localData), { selectedAccruedExpensesAccountIds: accruedExpensesAccountsIdentified.map((account) => account.accountId), previousAccruedExpensesAccount: accruedExpensesAccountsIdentified });
410
+ draft.accruedExpensesNestedAccountListHierarchy =
411
+ (0, getNestedAccountIDHierarchyForReport_1.geNestedAccountIDHierarchyForReport)(accruedExpensesAccountMetadata);
412
+ draft.accountListFetchState = {
413
+ error: undefined,
414
+ fetchState: 'Completed',
415
+ };
416
+ };
@@ -0,0 +1,19 @@
1
+ import { NestedAccountHierarchyForReport } from '../../../commonStateTypes/accountView/nestedAccountID';
2
+ import { FetchStateAndError } from '../../../commonStateTypes/common';
3
+ import { Recommendation } from '../../../commonStateTypes/recommendationBase';
4
+ import { SelectorView } from '../../../commonStateTypes/viewAndReport/viewAndReport';
5
+ import { AccountBase } from '../../../entity/account/accountState';
6
+ import { AccountSettingsLocalData } from '../types/jeSchedulesViewState';
7
+ export interface JEAccountSettingsView extends SelectorView {
8
+ prepaidExpensesAccountList: AccountBase[];
9
+ fixedAssetsAccountList: AccountBase[];
10
+ accruedExpensesAccountList: AccountBase[];
11
+ prepaidExpensesRecommendations: Recommendation[];
12
+ fixedAssetsRecommendations: Recommendation[];
13
+ accruedExpensesRecommendations: Recommendation[];
14
+ prepaidExpensesAccountHierarchy: NestedAccountHierarchyForReport[];
15
+ fixedAssetsAccountHierarchy: NestedAccountHierarchyForReport[];
16
+ accruedExpensesAccountHierarchy: NestedAccountHierarchyForReport[];
17
+ accountSettingsLocalData: AccountSettingsLocalData;
18
+ saveState: FetchStateAndError;
19
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -7,6 +7,7 @@ import { ClassBase } from '../../../entity/class/classState';
7
7
  import { JEScheduledTransaction } from '../../../entity/jeSchedules/jeSchedulesSelector';
8
8
  import { JEScheduleTransactionKey } from '../../../entity/jeSchedules/jeSchedulesTypes';
9
9
  import { UncategorizedAccounts } from '../../accountList/accountListSelector';
10
+ import { JEAccountSettingsView } from '../selectorTypes/jeAccountSettingsViewSelectorTypes';
10
11
  import { JEScheduledTransactionWithFailedEntries } from '../selectors/jeSchedulesViewSelector';
11
12
  import { JEScheduleLocalData, JESchedulesViewUIState } from '../types/jeSchedulesViewState';
12
13
  export interface ExpenseAutomationJESchedulesViewSelector extends SelectorView {
@@ -19,6 +20,7 @@ export interface ExpenseAutomationJESchedulesViewSelector extends SelectorView {
19
20
  allAccountList: AccountBase[];
20
21
  uncategorizedAccounts: UncategorizedAccounts;
21
22
  accountListNestedAccountHierarchy: NestedAccountHierarchyForReport[];
23
+ accountSettingsView: JEAccountSettingsView;
22
24
  allClassList: ClassBase[];
23
25
  classListNestedAccountHierarchy: NestedClassHierarchyForReport[];
24
26
  allDepreciationAccountList: AccountBase[];
@@ -0,0 +1,3 @@
1
+ import { RootState } from '../../../reducer';
2
+ import { JEAccountSettingsView } from '../selectorTypes/jeAccountSettingsViewSelectorTypes';
3
+ export declare const getJEAccountSettingsView: (state: RootState) => JEAccountSettingsView;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getJEAccountSettingsView = void 0;
4
+ const toolkit_1 = require("@reduxjs/toolkit");
5
+ const reduceFetchState_1 = require("../../../commonStateTypes/reduceFetchState");
6
+ const accountSelector_1 = require("../../../entity/account/accountSelector");
7
+ exports.getJEAccountSettingsView = (0, toolkit_1.createSelector)((state) => state.expenseAutomationJESchedulesViewState.accountSettings, (state) => state.accountState, (jeAccountMappingState, accountState) => {
8
+ const prepaidExpensesAccountList = buildAccountList(jeAccountMappingState.prepaidExpensesAccountIdList, accountState);
9
+ const fixedAssetsAccountList = buildAccountList(jeAccountMappingState.fixedAssetsAccountIdList, accountState);
10
+ const accruedExpensesAccountList = buildAccountList(jeAccountMappingState.accruedExpensesAccountIdList, accountState);
11
+ const fetchState = (0, reduceFetchState_1.reduceAllFetchState)([
12
+ jeAccountMappingState.accountListFetchState,
13
+ jeAccountMappingState.recommendationFetchState,
14
+ ]);
15
+ const saveState = jeAccountMappingState.updateFetchState;
16
+ return {
17
+ prepaidExpensesAccountList,
18
+ fixedAssetsAccountList,
19
+ accruedExpensesAccountList,
20
+ prepaidExpensesRecommendations: jeAccountMappingState.prepaidExpensesRecommendations,
21
+ fixedAssetsRecommendations: jeAccountMappingState.fixedAssetsRecommendations,
22
+ accruedExpensesRecommendations: jeAccountMappingState.accruedExpensesRecommendations,
23
+ accountSettingsLocalData: jeAccountMappingState.localData,
24
+ prepaidExpensesAccountHierarchy: jeAccountMappingState.prepaidExpensesNestedAccountListHierarchy,
25
+ fixedAssetsAccountHierarchy: jeAccountMappingState.fixedAssetsNestedAccountListHierarchy,
26
+ accruedExpensesAccountHierarchy: jeAccountMappingState.accruedExpensesNestedAccountListHierarchy,
27
+ fetchState: fetchState.fetchState,
28
+ saveState,
29
+ };
30
+ });
31
+ // Helper function to build account lists
32
+ const buildAccountList = (accountIdList, accountState) => {
33
+ const accountList = [];
34
+ accountIdList.forEach((accountId) => {
35
+ const account = (0, accountSelector_1.getAccountBase)(accountState, accountId, 'account_list_by_type');
36
+ if (account != null) {
37
+ accountList.push(account);
38
+ }
39
+ });
40
+ return accountList;
41
+ };
@@ -12,12 +12,14 @@ const scheduleDetailLocalDataHelper_1 = require("../../scheduleView/scheduleDeta
12
12
  const scheduleDetailSelector_1 = require("../../scheduleView/scheduleDetailView/scheduleDetailSelector");
13
13
  const scheduleListHelper_1 = require("../../scheduleView/scheduleListView/scheduleListHelper");
14
14
  const expenseAutomationViewSelectorTypes_1 = require("../selectorTypes/expenseAutomationViewSelectorTypes");
15
+ const jeAccountSettingsViewSelector_1 = require("./jeAccountSettingsViewSelector");
15
16
  function getExpenseAutomationJESchedulesView(state) {
16
17
  var _a;
17
18
  const jeScheduledTransaction = [];
18
19
  const failedJeScheduledTransaction = [];
19
20
  const { accountState, accountListState, classState, classListState, expenseAutomationJESchedulesViewState, expenseAutomationViewState, monthEndCloseChecksState, } = state;
20
21
  const { jeScheduleTransactionKeysByPeriod, failedJeScheduleTransactionKeysByPeriod, jeScheduleLocalDataById, postStatusById, ignoreStatusById, uiState, error, fetchState, refreshStatus, } = expenseAutomationJESchedulesViewState;
22
+ const accountSettingsView = (0, jeAccountSettingsViewSelector_1.getJEAccountSettingsView)(state);
21
23
  const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
22
24
  const { selectedPeriodByTenantId } = expenseAutomationViewState;
23
25
  const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
@@ -83,6 +85,7 @@ function getExpenseAutomationJESchedulesView(state) {
83
85
  allClassList: allClasses,
84
86
  draftSchedules,
85
87
  resolveSchedules: resolveSchedules,
88
+ accountSettingsView,
86
89
  postStatusById: postStatusById,
87
90
  ignoreStatusById: ignoreStatusById,
88
91
  fetchState: fetchState,
@@ -1,5 +1,8 @@
1
+ import { NestedAccountHierarchyForReport } from '../../../commonStateTypes/accountView/nestedAccountID';
1
2
  import { FetchStateAndError, FetchedState, ID } from '../../../commonStateTypes/common';
3
+ import { Recommendation } from '../../../commonStateTypes/recommendationBase';
2
4
  import { MonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
5
+ import { AccountBase } from '../../../entity/account/accountState';
3
6
  import { JEScheduleTransactionKey, ScheduleTypes } from '../../../entity/jeSchedules/jeSchedulesTypes';
4
7
  import { VendorBase } from '../../../entity/vendor/vendorState';
5
8
  export interface JESchedulesViewUIState {
@@ -24,8 +27,32 @@ export interface JESchedulesViewState extends FetchedState {
24
27
  jeScheduleTransactionKeysByPeriod: Record<MonthYearPeriodId, JEScheduleTransactionKey[]>;
25
28
  failedJeScheduleTransactionKeysByPeriod: Record<MonthYearPeriodId, JEScheduleTransactionKey[]>;
26
29
  jeScheduleLocalDataById: Record<ID, JEScheduleLocalData>;
30
+ accountSettings: AccountSettingsState;
27
31
  postStatusById: Record<ID, FetchStateAndError>;
28
32
  ignoreStatusById: Record<JEScheduleTransactionKey, FetchStateAndError>;
29
33
  refreshStatus: FetchStateAndError;
30
34
  uiState: JESchedulesViewUIState;
31
35
  }
36
+ export interface AccountSettingsLocalData {
37
+ selectedFixedAssetsAccountIds: ID[];
38
+ selectedPrepaidExpensesAccountIds: ID[];
39
+ selectedAccruedExpensesAccountIds: ID[];
40
+ previousPrepaidExpensesAccount: AccountBase[];
41
+ previousFixedAssetsAccount: AccountBase[];
42
+ previousAccruedExpensesAccount: AccountBase[];
43
+ }
44
+ export interface AccountSettingsState {
45
+ localData: AccountSettingsLocalData;
46
+ accountListFetchState: FetchStateAndError;
47
+ recommendationFetchState: FetchStateAndError;
48
+ updateFetchState: FetchStateAndError;
49
+ prepaidExpensesAccountIdList: ID[];
50
+ prepaidExpensesNestedAccountListHierarchy: NestedAccountHierarchyForReport[];
51
+ prepaidExpensesRecommendations: Recommendation[];
52
+ fixedAssetsAccountIdList: ID[];
53
+ fixedAssetsNestedAccountListHierarchy: NestedAccountHierarchyForReport[];
54
+ fixedAssetsRecommendations: Recommendation[];
55
+ accruedExpensesAccountIdList: ID[];
56
+ accruedExpensesNestedAccountListHierarchy: NestedAccountHierarchyForReport[];
57
+ accruedExpensesRecommendations: Recommendation[];
58
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.14.74",
3
+ "version": "4.14.76",
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",
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "homepage": "https://github.com/zeni-ai/client-epic-state#readme",
27
27
  "devDependencies": {
28
- "@liveblocks/client": "^2.20.0",
28
+ "@liveblocks/client": "^2.22.1",
29
29
  "@trivago/prettier-plugin-sort-imports": "^5.2.2",
30
30
  "@types/chai": "^5.0.1",
31
31
  "@types/jest": "^29.5.14",