@zeniai/client-epic-state 5.2.13 → 5.2.14-betaRD0

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 (126) hide show
  1. package/lib/entity/jeSchedules/jeScheduleHelper.d.ts +1 -0
  2. package/lib/entity/jeSchedules/jeScheduleHelper.js +7 -0
  3. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +78 -1
  4. package/lib/entity/jeSchedules/jeSchedulesPayload.js +183 -4
  5. package/lib/entity/jeSchedules/jeSchedulesReducer.d.ts +4 -2
  6. package/lib/entity/jeSchedules/jeSchedulesReducer.js +30 -2
  7. package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +11 -2
  8. package/lib/entity/jeSchedules/jeSchedulesSelector.js +38 -3
  9. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +123 -1
  10. package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +24 -1
  11. package/lib/entity/jeSchedules/jeSchedulesTypes.js +96 -1
  12. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  13. package/lib/entity/snackbar/snackbarTypes.js +3 -0
  14. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.d.ts +2 -0
  15. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.js +2 -0
  16. package/lib/entity/transaction/stateTypes/scheduleTransaction.d.ts +2 -0
  17. package/lib/epic.d.ts +9 -1
  18. package/lib/epic.js +16 -0
  19. package/lib/esm/entity/jeSchedules/jeScheduleHelper.js +6 -0
  20. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +183 -5
  21. package/lib/esm/entity/jeSchedules/jeSchedulesReducer.js +30 -2
  22. package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +36 -2
  23. package/lib/esm/entity/jeSchedules/jeSchedulesTypes.js +86 -0
  24. package/lib/esm/entity/snackbar/snackbarTypes.js +3 -0
  25. package/lib/esm/entity/transaction/payloadTypes/scheduleTransactionPayload.js +2 -0
  26. package/lib/esm/epic.js +16 -0
  27. package/lib/esm/index.js +17 -11
  28. package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +6 -3
  29. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +9 -1
  30. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +41 -5
  31. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +45 -0
  32. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +14 -2
  33. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +104 -0
  34. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +25 -0
  35. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +138 -0
  36. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +79 -0
  37. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +180 -0
  38. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +111 -0
  39. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +28 -0
  40. package/lib/esm/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +140 -0
  41. package/lib/esm/view/expenseAutomationView/payload/jeSchedulesPayload.js +55 -0
  42. package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +319 -29
  43. package/lib/esm/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +1 -0
  44. package/lib/esm/view/expenseAutomationView/selectors/jeAccountSettingsViewSelector.js +1 -0
  45. package/lib/esm/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +106 -0
  46. package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +327 -22
  47. package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +5 -6
  48. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.js +24 -7
  49. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +1 -1
  50. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewReducer.js +8 -1
  51. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +42 -8
  52. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogSubFamilyEpics.js +8 -2
  53. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +19 -10
  54. package/lib/esm/view/invoicing/invoicingCatalogItemDetailView/invoicingCatalogItemDetailViewSelector.js +2 -0
  55. package/lib/esm/view/invoicing/invoicingQboView/epics/fetchInvoicingAccountingPickersEpic.js +0 -1
  56. package/lib/esm/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +15 -36
  57. package/lib/esm/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +1 -1
  58. package/lib/esm/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +7 -2
  59. package/lib/esm/view/scheduleView/scheduleListView/scheduleListReducer.js +5 -3
  60. package/lib/index.d.ts +24 -18
  61. package/lib/index.js +93 -48
  62. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +6 -3
  63. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +9 -1
  64. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.d.ts +3 -2
  65. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +39 -3
  66. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.d.ts +21 -0
  67. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +49 -0
  68. package/lib/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +14 -2
  69. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.d.ts +9 -0
  70. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +108 -0
  71. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.d.ts +8 -0
  72. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +29 -0
  73. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.d.ts +9 -0
  74. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +142 -0
  75. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.d.ts +8 -0
  76. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +83 -0
  77. package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.d.ts +13 -0
  78. package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +187 -0
  79. package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.d.ts +65 -0
  80. package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +115 -0
  81. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.d.ts +6 -0
  82. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +32 -0
  83. package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.d.ts +36 -0
  84. package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +145 -0
  85. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  86. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +86 -3
  87. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.js +58 -1
  88. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +93 -12
  89. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +321 -29
  90. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +1 -1
  91. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +2 -2
  92. package/lib/view/expenseAutomationView/selectorTypes/jeAccountSettingsViewSelectorTypes.d.ts +1 -0
  93. package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.d.ts +42 -0
  94. package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +2 -0
  95. package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +41 -7
  96. package/lib/view/expenseAutomationView/selectors/jeAccountSettingsViewSelector.js +1 -0
  97. package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.d.ts +21 -0
  98. package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +112 -0
  99. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.d.ts +34 -0
  100. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +335 -21
  101. package/lib/view/expenseAutomationView/types/completedSubTab.d.ts +1 -1
  102. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +83 -8
  103. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +8 -8
  104. package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +1 -1
  105. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.d.ts +13 -21
  106. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.js +24 -7
  107. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.d.ts +7 -0
  108. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +4 -3
  109. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewReducer.d.ts +18 -9
  110. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewReducer.js +9 -2
  111. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.d.ts +15 -5
  112. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +43 -8
  113. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewState.d.ts +24 -0
  114. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogSubFamilyEpics.d.ts +1 -1
  115. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogSubFamilyEpics.js +8 -2
  116. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +18 -9
  117. package/lib/view/invoicing/invoicingCatalogItemDetailView/invoicingCatalogItemDetailViewSelector.d.ts +6 -0
  118. package/lib/view/invoicing/invoicingCatalogItemDetailView/invoicingCatalogItemDetailViewSelector.js +2 -0
  119. package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingAccountingPickersEpic.js +0 -1
  120. package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.d.ts +13 -13
  121. package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +17 -38
  122. package/lib/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +1 -1
  123. package/lib/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +7 -2
  124. package/lib/view/scheduleView/scheduleListView/scheduleListReducer.d.ts +4 -2
  125. package/lib/view/scheduleView/scheduleListView/scheduleListReducer.js +5 -3
  126. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  import { NestedAccountHierarchyForReport } from '../../../commonStateTypes/accountView/nestedAccountID';
2
2
  import { NestedClassHierarchyForReport } from '../../../commonStateTypes/classesView/nestedClassID';
3
3
  import { FetchStateAndError } from '../../../commonStateTypes/common';
4
- import { AccountBase, AccountType } from '../../../entity/account/accountState';
4
+ import { AccountBase } from '../../../entity/account/accountState';
5
5
  import { ClassBase } from '../../../entity/class/classState';
6
6
  import { RootState } from '../../../rootStateTypes';
7
7
  import { InvoicingQboConnection, InvoicingQboSyncHealth } from './invoicingQboViewPayload';
@@ -16,11 +16,6 @@ export declare const isInvoicingQboConnected: (state: RootState) => boolean;
16
16
  export declare const isInvoicingAccountingPickerDataLoading: (state: RootState) => boolean;
17
17
  /** The QBO connection fetch on its own, without building the bundled view. */
18
18
  export declare const getInvoicingQboConnectionFetchState: (state: RootState) => FetchStateAndError;
19
- /**
20
- * Account types that can back invoicing revenue. Named here so screens ask for
21
- * "income accounts" rather than repeating the accounting service's vocabulary.
22
- */
23
- export declare const INVOICING_INCOME_ACCOUNT_TYPES: readonly AccountType[];
24
19
  /**
25
20
  * The account behind a picker value. The pickers submit the QuickBooks id, so
26
21
  * that is what callers hold; the payload builders need the whole entity to send
@@ -29,6 +24,18 @@ export declare const INVOICING_INCOME_ACCOUNT_TYPES: readonly AccountType[];
29
24
  export declare const invoicingQboAccountByQboId: (state: RootState, qboId: string | undefined) => AccountBase | undefined;
30
25
  /** The class behind a picker value, for the same reason as the account above. */
31
26
  export declare const invoicingQboClassByQboId: (state: RootState, qboId: string | undefined) => ClassBase | undefined;
27
+ /**
28
+ * The resolver every catalog and settings payload builder needs: a picked
29
+ * QuickBooks id turned back into the account or class record the request body
30
+ * carries. Deliberately not memoized — epics call it once per action, where a
31
+ * fresh pair of closures costs nothing. Keep it out of `mapStateToProps`: the
32
+ * object identity changes per call, so a component reading it would re-render on
33
+ * every unrelated action.
34
+ */
35
+ export declare const getInvoicingCatalogAccountingLookup: (state: RootState) => {
36
+ accountByQboId: (qboId: string) => AccountBase | undefined;
37
+ classByQboId: (qboId: string) => ClassBase | undefined;
38
+ };
32
39
  /** An account or class as the invoicing pickers render and submit it. */
33
40
  export interface InvoicingAccountingOption {
34
41
  id: string;
@@ -60,13 +67,6 @@ export interface InvoicingQboView {
60
67
  * required would post a mapping QuickBooks rejects.
61
68
  */
62
69
  export declare const invoicingAccountsForQboAccountTypes: (accounts: InvoicingAccountingOption[], accountTypes: string) => InvoicingAccountingOption[];
63
- /**
64
- * The account tree narrowed to the given account types. The tree itself carries
65
- * no account type, so the flat account list supplies that and the matching
66
- * `qboId`s are kept — which is why callers that only need "income accounts, as a
67
- * tree" do not have to hold a second flat list to filter with.
68
- */
69
- export declare const invoicingAccountHierarchyForTypes: (state: RootState, accountTypes: readonly AccountType[]) => NestedAccountHierarchyForReport[];
70
70
  /**
71
71
  * Single bundled view for the QBO integration settings screen — the
72
72
  * connection, the account and class options, sync health, and the fetch/action
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getInvoicingQboView = exports.invoicingAccountHierarchyForTypes = exports.invoicingAccountsForQboAccountTypes = exports.invoicingQboClassByQboId = exports.invoicingQboAccountByQboId = exports.INVOICING_INCOME_ACCOUNT_TYPES = exports.getInvoicingQboConnectionFetchState = exports.isInvoicingAccountingPickerDataLoading = exports.isInvoicingQboConnected = exports.INVOICING_ACCOUNT_LIST_KEY = void 0;
3
+ exports.getInvoicingQboView = exports.invoicingAccountsForQboAccountTypes = exports.getInvoicingCatalogAccountingLookup = exports.invoicingQboClassByQboId = exports.invoicingQboAccountByQboId = exports.getInvoicingQboConnectionFetchState = exports.isInvoicingAccountingPickerDataLoading = exports.isInvoicingQboConnected = exports.INVOICING_ACCOUNT_LIST_KEY = void 0;
4
4
  const accountListSelector_1 = require("../../accountList/accountListSelector");
5
5
  const classListSelector_1 = require("../../classList/classListSelector");
6
6
  // The shared bucket, fetched with the same arguments as the other consumers so
7
- // whichever screen loads first satisfies the rest. Invoicing narrows to income
8
- // accounts when it builds its options, so it does not need its own copy.
7
+ // whichever screen loads first satisfies the rest. Invoicing renders the same
8
+ // accounts they do, so it does not need its own copy.
9
9
  exports.INVOICING_ACCOUNT_LIST_KEY = 'accountList';
10
10
  /** Whether QBO is connected, without building the option lists to find out. */
11
11
  const isInvoicingQboConnected = (state) => state.invoicingQboViewState.connection?.connected === true;
@@ -35,14 +35,6 @@ exports.isInvoicingAccountingPickerDataLoading = isInvoicingAccountingPickerData
35
35
  /** The QBO connection fetch on its own, without building the bundled view. */
36
36
  const getInvoicingQboConnectionFetchState = (state) => state.invoicingQboViewState.connectionFetchState;
37
37
  exports.getInvoicingQboConnectionFetchState = getInvoicingQboConnectionFetchState;
38
- /**
39
- * Account types that can back invoicing revenue. Named here so screens ask for
40
- * "income accounts" rather than repeating the accounting service's vocabulary.
41
- */
42
- exports.INVOICING_INCOME_ACCOUNT_TYPES = [
43
- 'income',
44
- 'other_income',
45
- ];
46
38
  /**
47
39
  * The account behind a picker value. The pickers submit the QuickBooks id, so
48
40
  * that is what callers hold; the payload builders need the whole entity to send
@@ -85,6 +77,19 @@ const invoicingQboClassByQboId = (state, qboId) => {
85
77
  }
86
78
  };
87
79
  exports.invoicingQboClassByQboId = invoicingQboClassByQboId;
80
+ /**
81
+ * The resolver every catalog and settings payload builder needs: a picked
82
+ * QuickBooks id turned back into the account or class record the request body
83
+ * carries. Deliberately not memoized — epics call it once per action, where a
84
+ * fresh pair of closures costs nothing. Keep it out of `mapStateToProps`: the
85
+ * object identity changes per call, so a component reading it would re-render on
86
+ * every unrelated action.
87
+ */
88
+ const getInvoicingCatalogAccountingLookup = (state) => ({
89
+ accountByQboId: (qboId) => (0, exports.invoicingQboAccountByQboId)(state, qboId),
90
+ classByQboId: (qboId) => (0, exports.invoicingQboClassByQboId)(state, qboId),
91
+ });
92
+ exports.getInvoicingCatalogAccountingLookup = getInvoicingCatalogAccountingLookup;
88
93
  /**
89
94
  * Accounts and classes as the invoicing pickers need them. Both come from the
90
95
  * shared accounting-service lists, so whatever another screen already loaded
@@ -92,17 +97,12 @@ exports.invoicingQboClassByQboId = invoicingQboClassByQboId;
92
97
  * API stores; an account without one cannot be posted, so it is dropped rather
93
98
  * than offered.
94
99
  */
95
- const invoicingAccountingOptions = (state, accountTypes) => {
100
+ const invoicingAccountingOptions = (state) => {
96
101
  const { accounts } = (0, accountListSelector_1.getAccountList)(state.accountState, state.accountListState, exports.INVOICING_ACCOUNT_LIST_KEY);
97
102
  return accounts.flatMap((account) => {
98
103
  if (account.qboId == null || account.isDeleted === true) {
99
104
  return [];
100
105
  }
101
- if (accountTypes != null &&
102
- (account.accountType == null ||
103
- !accountTypes.includes(account.accountType))) {
104
- return [];
105
- }
106
106
  return [
107
107
  {
108
108
  id: String(account.qboId),
@@ -160,27 +160,6 @@ const invoicingAccountingClassOptions = (state) => {
160
160
  },
161
161
  ]);
162
162
  };
163
- /**
164
- * The account tree narrowed to the given account types. The tree itself carries
165
- * no account type, so the flat account list supplies that and the matching
166
- * `qboId`s are kept — which is why callers that only need "income accounts, as a
167
- * tree" do not have to hold a second flat list to filter with.
168
- */
169
- const invoicingAccountHierarchyForTypes = (state, accountTypes) => {
170
- const allowedQboIds = new Set(invoicingAccountingOptions(state, accountTypes).map((account) => account.id));
171
- const keepMatching = (nodes) => nodes.flatMap((node) => {
172
- const children = keepMatching(node.children);
173
- const isMatch = node.qboId != null && allowedQboIds.has(String(node.qboId));
174
- // A parent that is not itself a match is still kept when it holds one, so
175
- // the tree's shape survives the filter.
176
- if (!isMatch && children.length === 0) {
177
- return [];
178
- }
179
- return [{ ...node, children }];
180
- });
181
- return keepMatching((0, accountListSelector_1.getNestedAccountListHierarchy)(state.accountListState, exports.INVOICING_ACCOUNT_LIST_KEY));
182
- };
183
- exports.invoicingAccountHierarchyForTypes = invoicingAccountHierarchyForTypes;
184
163
  /**
185
164
  * Single bundled view for the QBO integration settings screen — the
186
165
  * connection, the account and class options, sync health, and the fetch/action
@@ -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: 'all',
36
+ filter: action.payload.statusFilter,
37
37
  };
38
38
  return zeniAPI
39
39
  .getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/schedules?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
@@ -10,9 +10,14 @@ 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 } = action.payload;
13
+ const { scheduleType, downloadCategories, statusFilter } = 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.
16
21
  let scheduleState;
17
22
  if (scheduleType !== 'accrued_expenses') {
18
23
  scheduleState = (0, scheduleListReducer_1.getState)(scheduleListState, scheduleType);
@@ -37,7 +42,7 @@ const fetchDownloadSchedulesEpic = (actions$, state$, zeniAPI) => actions$.pipe(
37
42
  base_txn_account_ids: downloadCategories,
38
43
  sort_by: 'transaction_date',
39
44
  sort_order: 'desc',
40
- filter: 'all',
45
+ filter: statusFilter,
41
46
  };
42
47
  return zeniAPI
43
48
  .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[], cacheOverride?: any], {
19
+ }, downloadCategories: string[], statusFilter?: "completed" | "new" | "ongoing" | "all" | undefined, cacheOverride?: any], {
20
20
  timeframeAndCategory: {
21
21
  selectedCategoryId: ID;
22
22
  selectedTimeframe: TimeframeTick;
@@ -24,16 +24,18 @@ 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";
27
28
  }, "scheduleListView/fetchDownloadSchedules", never, never>, fetchAccruedScheduleList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue", timeframeAndCategory?: {
28
29
  selectedCategoryId: ID;
29
30
  selectedTimeframe: TimeframeTick;
30
- } | undefined, cacheOverride?: any], {
31
+ } | undefined, cacheOverride?: any, statusFilter?: "completed" | "new" | "ongoing" | "all" | undefined], {
31
32
  timeframeAndCategory: {
32
33
  selectedCategoryId: ID;
33
34
  selectedTimeframe: TimeframeTick;
34
35
  } | undefined;
35
36
  scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue";
36
37
  cacheOverride: any;
38
+ statusFilter: "completed" | "new" | "ongoing" | "all";
37
39
  }, "scheduleListView/fetchAccruedScheduleList", never, never>, fetchScheduleList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue", timeframeAndCategory?: {
38
40
  selectedCategoryId: ID;
39
41
  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.
93
94
  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,13 +115,14 @@ const scheduleListView = (0, toolkit_1.createSlice)({
115
115
  updateState(draft, action.payload.scheduleType, state);
116
116
  }
117
117
  },
118
- prepare(scheduleType, timeframeAndCategory, downloadCategories, cacheOverride = false) {
118
+ prepare(scheduleType, timeframeAndCategory, downloadCategories, statusFilter = 'all', cacheOverride = false) {
119
119
  return {
120
120
  payload: {
121
121
  timeframeAndCategory,
122
122
  scheduleType,
123
123
  cacheOverride,
124
124
  downloadCategories,
125
+ statusFilter,
125
126
  },
126
127
  };
127
128
  },
@@ -157,12 +158,13 @@ const scheduleListView = (0, toolkit_1.createSlice)({
157
158
  updateState(draft, action.payload.scheduleType, state);
158
159
  }
159
160
  },
160
- prepare(scheduleType, timeframeAndCategory, cacheOverride = false) {
161
+ prepare(scheduleType, timeframeAndCategory, cacheOverride = false, statusFilter = 'all') {
161
162
  return {
162
163
  payload: {
163
164
  timeframeAndCategory,
164
165
  scheduleType,
165
166
  cacheOverride,
167
+ statusFilter,
166
168
  },
167
169
  };
168
170
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.2.13",
3
+ "version": "5.2.14-betaRD0",
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",