@zeniai/client-epic-state 5.2.34 → 5.2.35-beta1MM

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 (97) hide show
  1. package/lib/entity/actualMatching/actualMatchingPayload.d.ts +25 -0
  2. package/lib/entity/actualMatching/actualMatchingPayload.js +45 -0
  3. package/lib/entity/actualMatching/actualMatchingReducer.d.ts +8 -0
  4. package/lib/entity/actualMatching/actualMatchingReducer.js +33 -0
  5. package/lib/entity/actualMatching/actualMatchingSelector.d.ts +3 -0
  6. package/lib/entity/actualMatching/actualMatchingSelector.js +6 -0
  7. package/lib/entity/actualMatching/actualMatchingState.d.ts +22 -0
  8. package/lib/entity/actualMatching/actualMatchingState.js +2 -0
  9. package/lib/entity/actualMatching/actualMatchingTypes.d.ts +1 -0
  10. package/lib/entity/actualMatching/actualMatchingTypes.js +2 -0
  11. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +29 -0
  12. package/lib/entity/jeSchedules/jeSchedulesPayload.js +49 -0
  13. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +31 -0
  14. package/lib/epic.d.ts +8 -1
  15. package/lib/epic.js +14 -0
  16. package/lib/esm/entity/actualMatching/actualMatchingPayload.js +42 -0
  17. package/lib/esm/entity/actualMatching/actualMatchingReducer.js +30 -0
  18. package/lib/esm/entity/actualMatching/actualMatchingSelector.js +3 -0
  19. package/lib/esm/entity/actualMatching/actualMatchingState.js +1 -0
  20. package/lib/esm/entity/actualMatching/actualMatchingTypes.js +1 -0
  21. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +49 -0
  22. package/lib/esm/epic.js +14 -0
  23. package/lib/esm/index.js +7 -3
  24. package/lib/esm/reducer.js +6 -0
  25. package/lib/esm/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingEpic.js +44 -0
  26. package/lib/esm/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingMatchEpic.js +35 -0
  27. package/lib/esm/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingPageEpic.js +7 -0
  28. package/lib/esm/view/expenseAutomationView/epics/actualMatching/matchAndReverseAccrualsEpic.js +51 -0
  29. package/lib/esm/view/expenseAutomationView/epics/actualMatching/searchMatchAccrualsEpic.js +48 -0
  30. package/lib/esm/view/expenseAutomationView/epics/actualMatching/searchMatchTransactionsEpic.js +77 -0
  31. package/lib/esm/view/expenseAutomationView/epics/actualMatching/undoReversalAccrualsEpic.js +51 -0
  32. package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +28 -11
  33. package/lib/esm/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js +9 -1
  34. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/prefetchOtherJeSchedulesTabEpic.js +3 -1
  35. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +5 -0
  36. package/lib/esm/view/expenseAutomationView/expenseAutomationViewSelector.js +23 -7
  37. package/lib/esm/view/expenseAutomationView/expenseAutomationViewState.js +4 -2
  38. package/lib/esm/view/expenseAutomationView/payload/actualMatchingPayload.js +68 -0
  39. package/lib/esm/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +371 -0
  40. package/lib/esm/view/expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.js +1 -0
  41. package/lib/esm/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +287 -0
  42. package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +4 -0
  43. package/lib/esm/view/expenseAutomationView/types/actualMatchingViewState.js +32 -0
  44. package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +8 -1
  45. package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewPayload.js +4 -0
  46. package/lib/index.d.ts +14 -6
  47. package/lib/index.js +79 -48
  48. package/lib/reducer.d.ts +2 -0
  49. package/lib/reducer.js +6 -0
  50. package/lib/rootStateTypes.d.ts +4 -0
  51. package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingEpic.d.ts +9 -0
  52. package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingEpic.js +48 -0
  53. package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingMatchEpic.d.ts +12 -0
  54. package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingMatchEpic.js +39 -0
  55. package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingPageEpic.d.ts +5 -0
  56. package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingPageEpic.js +11 -0
  57. package/lib/view/expenseAutomationView/epics/actualMatching/matchAndReverseAccrualsEpic.d.ts +8 -0
  58. package/lib/view/expenseAutomationView/epics/actualMatching/matchAndReverseAccrualsEpic.js +55 -0
  59. package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchAccrualsEpic.d.ts +9 -0
  60. package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchAccrualsEpic.js +52 -0
  61. package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchTransactionsEpic.d.ts +8 -0
  62. package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchTransactionsEpic.js +81 -0
  63. package/lib/view/expenseAutomationView/epics/actualMatching/undoReversalAccrualsEpic.d.ts +8 -0
  64. package/lib/view/expenseAutomationView/epics/actualMatching/undoReversalAccrualsEpic.js +55 -0
  65. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.d.ts +2 -1
  66. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +28 -11
  67. package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.d.ts +2 -1
  68. package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js +9 -1
  69. package/lib/view/expenseAutomationView/epics/jeSchedule/prefetchOtherJeSchedulesTabEpic.js +3 -1
  70. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.d.ts +2 -1
  71. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +5 -0
  72. package/lib/view/expenseAutomationView/expenseAutomationViewSelector.js +23 -7
  73. package/lib/view/expenseAutomationView/expenseAutomationViewState.d.ts +2 -1
  74. package/lib/view/expenseAutomationView/expenseAutomationViewState.js +6 -3
  75. package/lib/view/expenseAutomationView/payload/actualMatchingPayload.d.ts +85 -0
  76. package/lib/view/expenseAutomationView/payload/actualMatchingPayload.js +74 -0
  77. package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.d.ts +76 -0
  78. package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +375 -0
  79. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +4 -4
  80. package/lib/view/expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.d.ts +83 -0
  81. package/lib/view/expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.js +2 -0
  82. package/lib/view/expenseAutomationView/selectorTypes/expenseAutomationViewSelectorTypes.d.ts +11 -0
  83. package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.d.ts +31 -0
  84. package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +303 -0
  85. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +4 -0
  86. package/lib/view/expenseAutomationView/types/actualMatchingViewState.d.ts +99 -0
  87. package/lib/view/expenseAutomationView/types/actualMatchingViewState.js +38 -0
  88. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +1 -1
  89. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +8 -1
  90. package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewPayload.d.ts +1 -11
  91. package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewPayload.js +4 -0
  92. package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewReducer.d.ts +1 -2
  93. package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewSelector.d.ts +1 -2
  94. package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewState.d.ts +15 -1
  95. package/lib/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewReducer.d.ts +1 -1
  96. package/lib/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewState.d.ts +1 -1
  97. package/package.json +1 -1
@@ -4,10 +4,11 @@ import { RootState } from '../../../../rootStateTypes';
4
4
  import { fetchCompanyMonthEndReportTemplates, fetchCompanyMonthEndReportView } from '../../../companyMonthEndReportView/companyMonthEndReportViewReducer';
5
5
  import { fetchMonthEndCloseChecks } from '../../../monthEndCloseChecksView/monthEndCloseChecksViewReducer';
6
6
  import { refreshExpenseAutomationCurrentTab } from '../../expenseAutomationViewReducer';
7
+ import { fetchActualMatchingPage } from '../../reducers/actualMatchingViewReducer';
7
8
  import { fetchFluxAnalysisView } from '../../reducers/fluxAnalysisViewReducer';
8
9
  import { fetchJeSchedulesPage } from '../../reducers/jeSchedulesViewReducer';
9
10
  import { fetchMissingReceipts } from '../../reducers/missingReceiptsViewReducer';
10
11
  import { fetchReconciliation } from '../../reducers/reconciliationViewReducer';
11
12
  import { fetchTransactionCategorizationView } from '../../reducers/transactionsViewReducer';
12
- export type ActionType = ReturnType<typeof refreshExpenseAutomationCurrentTab> | ReturnType<typeof fetchCompanyMonthEndReportView> | ReturnType<typeof fetchCompanyMonthEndReportTemplates> | ReturnType<typeof fetchMissingReceipts> | ReturnType<typeof fetchMonthEndCloseChecks> | ReturnType<typeof fetchFluxAnalysisView> | ReturnType<typeof fetchReconciliation> | ReturnType<typeof fetchJeSchedulesPage> | ReturnType<typeof fetchTransactionCategorizationView>;
13
+ export type ActionType = ReturnType<typeof refreshExpenseAutomationCurrentTab> | ReturnType<typeof fetchActualMatchingPage> | ReturnType<typeof fetchCompanyMonthEndReportView> | ReturnType<typeof fetchCompanyMonthEndReportTemplates> | ReturnType<typeof fetchMissingReceipts> | ReturnType<typeof fetchMonthEndCloseChecks> | ReturnType<typeof fetchFluxAnalysisView> | ReturnType<typeof fetchReconciliation> | ReturnType<typeof fetchJeSchedulesPage> | ReturnType<typeof fetchTransactionCategorizationView>;
13
14
  export declare const refreshExpenseAutomationCurrentTabEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
@@ -7,6 +7,7 @@ const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
7
7
  const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
8
8
  const companyMonthEndReportViewReducer_1 = require("../../../companyMonthEndReportView/companyMonthEndReportViewReducer");
9
9
  const expenseAutomationViewReducer_1 = require("../../expenseAutomationViewReducer");
10
+ const actualMatchingViewReducer_1 = require("../../reducers/actualMatchingViewReducer");
10
11
  const fluxAnalysisViewReducer_1 = require("../../reducers/fluxAnalysisViewReducer");
11
12
  const jeSchedulesViewReducer_1 = require("../../reducers/jeSchedulesViewReducer");
12
13
  const missingReceiptsViewReducer_1 = require("../../reducers/missingReceiptsViewReducer");
@@ -41,10 +42,17 @@ const refreshExpenseAutomationCurrentTabEpic = (actions$, state$) => actions$.pi
41
42
  return (0, rxjs_1.from)([
42
43
  (0, fluxAnalysisViewReducer_1.fetchFluxAnalysisView)(selectedPeriod, true, true, null),
43
44
  ]);
44
- case 'je_schedules':
45
+ case 'je_schedules': {
46
+ const selectedPageTab = state.expenseAutomationJESchedulesViewState.uiState.selectedPageTab;
47
+ if (selectedPageTab === 'actual_matching') {
48
+ return (0, rxjs_1.from)([
49
+ (0, actualMatchingViewReducer_1.fetchActualMatchingPage)({ start: timePeriodStart, end: timePeriodEnd }, true),
50
+ ]);
51
+ }
45
52
  return (0, rxjs_1.from)([
46
53
  (0, jeSchedulesViewReducer_1.fetchJeSchedulesPage)({ start: timePeriodStart, end: timePeriodEnd }, true),
47
54
  ]);
55
+ }
48
56
  case 'month_end_insights':
49
57
  return (0, rxjs_1.from)([
50
58
  (0, companyMonthEndReportViewReducer_1.fetchCompanyMonthEndReportView)(true, companyId, currentTenant.tenantId, period.end, true),
@@ -17,7 +17,9 @@ const prefetchOtherJeSchedulesTabEpic = (actions$, state$) => actions$.pipe((0,
17
17
  const state = state$.value;
18
18
  const { period } = action.payload;
19
19
  const { selectedPageTab } = state.expenseAutomationJESchedulesViewState.uiState;
20
- const otherPageTab = jeSchedulesViewState_1.ALL_JE_PAGE_TABS.find((pageTab) => pageTab !== selectedPageTab);
20
+ // Actual Matching has its own CES slice and API; warming it with fetchJeSchedules
21
+ // would prefetch the wrong endpoint. Only Review <-> Existing share that fetch.
22
+ const otherPageTab = jeSchedulesViewState_1.ALL_JE_PAGE_TABS.find((pageTab) => pageTab !== selectedPageTab && pageTab !== 'actual_matching');
21
23
  if (otherPageTab == null) {
22
24
  return rxjs_1.EMPTY;
23
25
  }
@@ -1,6 +1,7 @@
1
1
  import { ActionsObservable, StateObservable } from 'redux-observable';
2
2
  import { Observable } from 'rxjs';
3
3
  import { RootState } from '../../../../reducer';
4
+ import { fetchActualMatchingPage } from '../../reducers/actualMatchingViewReducer';
4
5
  import { fetchJeSchedulesPage, updateJESchedulesUIState } from '../../reducers/jeSchedulesViewReducer';
5
- export type ActionType = ReturnType<typeof fetchJeSchedulesPage> | ReturnType<typeof updateJESchedulesUIState>;
6
+ export type ActionType = ReturnType<typeof fetchActualMatchingPage> | ReturnType<typeof fetchJeSchedulesPage> | ReturnType<typeof updateJESchedulesUIState>;
6
7
  export declare const switchJESchedulesTabEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
@@ -5,6 +5,7 @@ const rxjs_1 = require("rxjs");
5
5
  const operators_1 = require("rxjs/operators");
6
6
  const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
7
7
  const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
8
+ const actualMatchingViewReducer_1 = require("../../reducers/actualMatchingViewReducer");
8
9
  const jeSchedulesViewReducer_1 = require("../../reducers/jeSchedulesViewReducer");
9
10
  const switchJESchedulesTabEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(jeSchedulesViewReducer_1.updateJESchedulesUIState.match), (0, operators_1.filter)((action) => action.payload.selectedPageTab != null), (0, operators_1.mergeMap)(() => {
10
11
  const state = state$.value;
@@ -27,6 +28,10 @@ const switchJESchedulesTabEpic = (actions$, state$) => actions$.pipe((0, operato
27
28
  if (timePeriodStart == null || timePeriodEnd == null) {
28
29
  return rxjs_1.EMPTY;
29
30
  }
31
+ const { selectedPageTab } = state.expenseAutomationJESchedulesViewState.uiState;
32
+ if (selectedPageTab === 'actual_matching') {
33
+ return (0, rxjs_1.of)((0, actualMatchingViewReducer_1.fetchActualMatchingPage)({ start: timePeriodStart, end: timePeriodEnd }, true));
34
+ }
30
35
  return (0, rxjs_1.of)((0, jeSchedulesViewReducer_1.fetchJeSchedulesPage)({ start: timePeriodStart, end: timePeriodEnd }, true));
31
36
  }));
32
37
  exports.switchJESchedulesTabEpic = switchJESchedulesTabEpic;
@@ -7,6 +7,7 @@ const monthEndCloseChecksSelector_1 = require("../../entity/monthEndCloseChecks/
7
7
  const tenantSelector_1 = require("../../entity/tenant/tenantSelector");
8
8
  const companyMonthEndReportViewSelector_1 = require("../companyMonthEndReportView/companyMonthEndReportViewSelector");
9
9
  const monthEndCloseChecksViewSelector_1 = require("../monthEndCloseChecksView/monthEndCloseChecksViewSelector");
10
+ const actualMatchingViewSelector_1 = require("./selectors/actualMatchingViewSelector");
10
11
  const fluxAnalysisViewSelector_1 = require("./selectors/fluxAnalysisViewSelector");
11
12
  const getAllStepsHelper_1 = require("./selectors/getAllStepsHelper");
12
13
  const jeSchedulesViewSelector_1 = require("./selectors/jeSchedulesViewSelector");
@@ -24,7 +25,7 @@ const isPreviousStepDisabled = (selectedTransactionCategorizationTab, allSteps,
24
25
  return allSteps[stepIndex - 1].isDisabled;
25
26
  };
26
27
  function getExpenseAutomationView(state) {
27
- const { expenseAutomationViewState, tenantState, expenseAutomationMissingReceiptsViewState, expenseAutomationJESchedulesViewState, expenseAutomationTransactionsViewState, expenseAutomationReconciliationViewState, monthEndCloseChecksState, companyState, } = state;
28
+ const { expenseAutomationViewState, tenantState, expenseAutomationMissingReceiptsViewState, expenseAutomationJESchedulesViewState, expenseAutomationActualMatchingViewState, expenseAutomationTransactionsViewState, expenseAutomationReconciliationViewState, monthEndCloseChecksState, companyState, } = state;
28
29
  const { loggedInUser, currentTenantId } = tenantState;
29
30
  const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
30
31
  const { currentSelectedView, selectedPeriodByTenantId } = expenseAutomationViewState;
@@ -45,6 +46,8 @@ function getExpenseAutomationView(state) {
45
46
  const reconciliation = (0, reconciliationViewSelector_1.getExpenseAutomationReconciliationView)(state);
46
47
  const expenseAutomationTransactionsView = (0, transactionCategorizationSelector_1.getExpenseAutomationTransactionView)(state);
47
48
  const jeSchedules = (0, jeSchedulesViewSelector_1.getExpenseAutomationJESchedulesView)(state);
49
+ // Top-level sibling of `jeSchedules`: see ExpenseAutomationViewSelector.
50
+ const actualMatching = (0, actualMatchingViewSelector_1.getExpenseAutomationActualMatchingView)(state);
48
51
  switch (currentSelectedView) {
49
52
  case 'reconciliation':
50
53
  currentSelectedViewFetchState = reconciliation.fetchStatus;
@@ -57,12 +60,23 @@ function getExpenseAutomationView(state) {
57
60
  fluxAnalysis.refreshStatus;
58
61
  break;
59
62
  case 'je_schedules':
60
- currentSelectedViewFetchState = {
61
- fetchState: jeSchedules.fetchState,
62
- error: jeSchedules.error,
63
- };
64
- currentSelectedViewBackgroundRefreshFetchState =
65
- jeSchedules.refreshStatus;
63
+ if (expenseAutomationJESchedulesViewState.uiState.selectedPageTab ===
64
+ 'actual_matching') {
65
+ currentSelectedViewFetchState = {
66
+ fetchState: actualMatching.fetchState,
67
+ error: actualMatching.error,
68
+ };
69
+ currentSelectedViewBackgroundRefreshFetchState =
70
+ actualMatching.refreshStatus;
71
+ }
72
+ else {
73
+ currentSelectedViewFetchState = {
74
+ fetchState: jeSchedules.fetchState,
75
+ error: jeSchedules.error,
76
+ };
77
+ currentSelectedViewBackgroundRefreshFetchState =
78
+ jeSchedules.refreshStatus;
79
+ }
66
80
  break;
67
81
  case 'missing_receipts':
68
82
  currentSelectedViewFetchState = {
@@ -94,6 +108,7 @@ function getExpenseAutomationView(state) {
94
108
  const fetchStateVariables = [
95
109
  expenseAutomationMissingReceiptsViewState,
96
110
  expenseAutomationJESchedulesViewState,
111
+ expenseAutomationActualMatchingViewState,
97
112
  expenseAutomationTransactionsView,
98
113
  expenseAutomationReconciliationViewState,
99
114
  ];
@@ -179,6 +194,7 @@ function getExpenseAutomationView(state) {
179
194
  ]);
180
195
  return {
181
196
  jeSchedules,
197
+ actualMatching,
182
198
  transactionView: expenseAutomationTransactionsView,
183
199
  missingReceipts,
184
200
  reconciliation,
@@ -1,8 +1,9 @@
1
1
  import { FetchStateAndError, FetchedState, ID } from '../../commonStateTypes/common';
2
2
  import { MonthYearPeriod } from '../../commonStateTypes/timePeriod';
3
- export declare const EXPENSE_AUTOMATION_VIEW_TYPES: readonly ["transaction_categorization", "je_schedules", "reconciliation", "missing_receipts", "flux_analysis", "month_end_insights"];
4
3
  export declare const toExpenseAutomationViewType: (v: string) => "transaction_categorization" | "je_schedules" | "reconciliation" | "missing_receipts" | "flux_analysis" | "month_end_insights";
5
4
  export type ExpenseAutomationViewType = ReturnType<typeof toExpenseAutomationViewType>;
5
+ /** Unlike `toExpenseAutomationViewType`, unknown strings return `undefined`. */
6
+ export declare const toExpenseAutomationViewTypeStrict: (v: string) => ExpenseAutomationViewType | undefined;
6
7
  export interface ExpenseAutomationViewState extends FetchedState {
7
8
  currentSelectedView: ExpenseAutomationViewType;
8
9
  saveStatus: FetchStateAndError;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toExpenseAutomationViewType = exports.EXPENSE_AUTOMATION_VIEW_TYPES = void 0;
3
+ exports.toExpenseAutomationViewTypeStrict = exports.toExpenseAutomationViewType = void 0;
4
4
  const stringToUnion_1 = require("../../commonStateTypes/stringToUnion");
5
- exports.EXPENSE_AUTOMATION_VIEW_TYPES = [
5
+ const EXPENSE_AUTOMATION_VIEW_TYPES = [
6
6
  'transaction_categorization',
7
7
  'je_schedules',
8
8
  'reconciliation',
@@ -10,5 +10,8 @@ exports.EXPENSE_AUTOMATION_VIEW_TYPES = [
10
10
  'flux_analysis',
11
11
  'month_end_insights',
12
12
  ];
13
- const toExpenseAutomationViewType = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.EXPENSE_AUTOMATION_VIEW_TYPES);
13
+ const toExpenseAutomationViewType = (v) => (0, stringToUnion_1.stringToUnion)(v, EXPENSE_AUTOMATION_VIEW_TYPES);
14
14
  exports.toExpenseAutomationViewType = toExpenseAutomationViewType;
15
+ /** Unlike `toExpenseAutomationViewType`, unknown strings return `undefined`. */
16
+ const toExpenseAutomationViewTypeStrict = (v) => (0, stringToUnion_1.stringToUnionStrict)(v, EXPENSE_AUTOMATION_VIEW_TYPES);
17
+ exports.toExpenseAutomationViewTypeStrict = toExpenseAutomationViewTypeStrict;
@@ -0,0 +1,85 @@
1
+ import { ID } from '../../../commonStateTypes/common';
2
+ import { TimePeriod } from '../../../commonStateTypes/timePeriod';
3
+ import { ActualMatchingListResponsePayload } from '../../../entity/actualMatching/actualMatchingPayload';
4
+ import { JEOneTimeAccrualPayload } from '../../../entity/jeSchedules/jeSchedulesPayload';
5
+ import { ZeniAPIResponse } from '../../../responsePayload';
6
+ import { ActualMatchingTransactionSearchResult, MatchAndReverseResult, UndoReversalResult } from '../types/actualMatchingViewState';
7
+ export declare function toServiceMonthFromPeriod(period: TimePeriod): string;
8
+ export type ActualMatchingListResponse = ZeniAPIResponse<ActualMatchingListResponsePayload>;
9
+ export interface ActualMatchingAccrualSearchResponsePayload {
10
+ accruals: JEOneTimeAccrualPayload[];
11
+ total: number;
12
+ limit?: number | null;
13
+ offset?: number | null;
14
+ }
15
+ export type ActualMatchingAccrualSearchResponse = ZeniAPIResponse<ActualMatchingAccrualSearchResponsePayload>;
16
+ export interface MatchTransactionSearchQueryPayload {
17
+ page_size: number;
18
+ search_text: string;
19
+ page_token?: string | null;
20
+ transaction_integration_id?: string;
21
+ transaction_type?: string;
22
+ }
23
+ export interface MatchTransactionSearchResultPayload {
24
+ line_id: string;
25
+ transaction_date: string;
26
+ transaction_id: ID;
27
+ transaction_integration_id: string;
28
+ transaction_type: string;
29
+ account_description?: string | null;
30
+ account_id?: ID | null;
31
+ account_name?: string | null;
32
+ accounting_class_id?: ID | null;
33
+ accounting_class_name?: string | null;
34
+ amount?: number | null;
35
+ currency_code?: string | null;
36
+ currency_symbol?: string | null;
37
+ sync_token?: string | null;
38
+ total_amount?: number | null;
39
+ transaction_description?: string | null;
40
+ transaction_memo?: string | null;
41
+ transaction_type_name?: string | null;
42
+ vendor_id?: ID | null;
43
+ vendor_name?: string | null;
44
+ }
45
+ export interface MatchTransactionSearchResponsePayload {
46
+ transactions: MatchTransactionSearchResultPayload[];
47
+ next_page_token?: string | null;
48
+ }
49
+ export type MatchTransactionSearchResponse = ZeniAPIResponse<MatchTransactionSearchResponsePayload>;
50
+ export declare function toActualMatchingTransactionSearchResult(payload: MatchTransactionSearchResultPayload): ActualMatchingTransactionSearchResult;
51
+ export interface MatchAndReverseRequestPayload {
52
+ accrual_ids: ID[];
53
+ line_id: string;
54
+ transaction_id: ID;
55
+ transaction_integration_id: string;
56
+ transaction_sync_token: string;
57
+ transaction_type: string;
58
+ }
59
+ export interface MatchAndReverseResultPayload {
60
+ accrual_id: ID;
61
+ status: string;
62
+ reason?: string | null;
63
+ }
64
+ export interface MatchAndReverseResponsePayload {
65
+ match_batch_id: string;
66
+ results: MatchAndReverseResultPayload[];
67
+ transaction_id: ID;
68
+ transaction_integration_id: string;
69
+ }
70
+ export type MatchAndReverseResponse = ZeniAPIResponse<MatchAndReverseResponsePayload>;
71
+ export declare function toMatchAndReverseResult(payload: MatchAndReverseResultPayload): MatchAndReverseResult;
72
+ export interface UndoReversalRequestPayload {
73
+ accrual_ids: ID[];
74
+ }
75
+ export interface UndoReversalResultPayload {
76
+ accrual_id: ID;
77
+ status: string;
78
+ reason?: string | null;
79
+ }
80
+ export interface UndoReversalResponsePayload {
81
+ match_batch_id: string;
82
+ results: UndoReversalResultPayload[];
83
+ }
84
+ export type UndoReversalResponse = ZeniAPIResponse<UndoReversalResponsePayload>;
85
+ export declare function toUndoReversalResult(payload: UndoReversalResultPayload): UndoReversalResult;
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toServiceMonthFromPeriod = toServiceMonthFromPeriod;
4
+ exports.toActualMatchingTransactionSearchResult = toActualMatchingTransactionSearchResult;
5
+ exports.toMatchAndReverseResult = toMatchAndReverseResult;
6
+ exports.toUndoReversalResult = toUndoReversalResult;
7
+ const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
8
+ const actualMatchingViewState_1 = require("../types/actualMatchingViewState");
9
+ function toServiceMonthFromPeriod(period) {
10
+ return (0, timePeriod_1.toString)(period.start).slice(0, 7);
11
+ }
12
+ const DEFAULT_CURRENCY_CODE = 'USD';
13
+ const DEFAULT_CURRENCY_SYMBOL = '$';
14
+ function resolveMatchSearchAmount(payload) {
15
+ const raw = payload.total_amount ?? payload.amount;
16
+ if (typeof raw === 'number' && Number.isFinite(raw)) {
17
+ return raw;
18
+ }
19
+ if (typeof raw === 'string' && raw !== '') {
20
+ const parsed = Number(raw);
21
+ if (Number.isFinite(parsed)) {
22
+ return parsed;
23
+ }
24
+ }
25
+ return 0;
26
+ }
27
+ function resolveMatchSearchCurrencySymbol(payload, currencyCode) {
28
+ if (payload.currency_symbol != null && payload.currency_symbol !== '') {
29
+ return payload.currency_symbol;
30
+ }
31
+ return currencyCode === DEFAULT_CURRENCY_CODE
32
+ ? DEFAULT_CURRENCY_SYMBOL
33
+ : currencyCode;
34
+ }
35
+ function toActualMatchingTransactionSearchResult(payload) {
36
+ const currencyCode = payload.currency_code != null && payload.currency_code !== ''
37
+ ? payload.currency_code
38
+ : DEFAULT_CURRENCY_CODE;
39
+ return {
40
+ transactionId: payload.transaction_id,
41
+ transactionIntegrationId: payload.transaction_integration_id,
42
+ transactionType: payload.transaction_type,
43
+ lineId: payload.line_id,
44
+ vendorId: payload.vendor_id ?? undefined,
45
+ vendorName: payload.vendor_name ?? '',
46
+ amount: resolveMatchSearchAmount(payload),
47
+ transactionDate: payload.transaction_date,
48
+ accountId: payload.account_id ?? undefined,
49
+ accountName: payload.account_name ?? undefined,
50
+ accountDescription: payload.account_description ?? undefined,
51
+ accountingClassId: payload.accounting_class_id ?? undefined,
52
+ accountingClassName: payload.accounting_class_name ?? undefined,
53
+ currencyCode,
54
+ currencySymbol: resolveMatchSearchCurrencySymbol(payload, currencyCode),
55
+ transactionMemo: payload.transaction_memo ?? undefined,
56
+ transactionDescription: payload.transaction_description ?? undefined,
57
+ transactionTypeName: payload.transaction_type_name ?? undefined,
58
+ syncToken: payload.sync_token == null ? '' : String(payload.sync_token),
59
+ };
60
+ }
61
+ function toMatchAndReverseResult(payload) {
62
+ return {
63
+ accrualId: payload.accrual_id,
64
+ status: (0, actualMatchingViewState_1.toMatchAndReverseResultStatus)(payload.status),
65
+ reason: payload.reason ?? undefined,
66
+ };
67
+ }
68
+ function toUndoReversalResult(payload) {
69
+ return {
70
+ accrualId: payload.accrual_id,
71
+ status: (0, actualMatchingViewState_1.toUndoReversalResultStatus)(payload.status),
72
+ reason: payload.reason ?? undefined,
73
+ };
74
+ }
@@ -0,0 +1,76 @@
1
+ import { MonthYearPeriod, TimePeriod } from '../../../commonStateTypes/timePeriod';
2
+ import { ActualMatchingMatchId } from '../../../entity/actualMatching/actualMatchingTypes';
3
+ import { JEOneTimeAccrualPayload } from '../../../entity/jeSchedules/jeSchedulesPayload';
4
+ import { ZeniAPIStatus } from '../../../responsePayload';
5
+ import { ActualMatchingAccrualSearchState, ActualMatchingMatchModalState, ActualMatchingTransactionSearchResult, ActualMatchingTransactionSearchState, ActualMatchingViewState, ActualMatchingViewUIState, MatchAndReverseAccrualsParams, MatchAndReverseResult, UndoReversalAccrualsParams, UndoReversalResult } from '../types/actualMatchingViewState';
6
+ export declare const initialTransactionSearchState: ActualMatchingTransactionSearchState;
7
+ export declare const initialAccrualSearchState: ActualMatchingAccrualSearchState;
8
+ export declare const initialMatchModalState: ActualMatchingMatchModalState;
9
+ export declare const initialState: ActualMatchingViewState;
10
+ export declare const clearActualMatchingView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationActualMatchingView/clearActualMatchingView">, clearMatchNewModal: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationActualMatchingView/clearMatchNewModal">, closeMatchNewModal: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationActualMatchingView/closeMatchNewModal">, fetchActualMatching: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[period: TimePeriod, refreshViewInBackground?: any], {
11
+ period: TimePeriod;
12
+ refreshViewInBackground: any;
13
+ }, "expenseAutomationActualMatchingView/fetchActualMatching", never, never>, fetchActualMatchingFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
14
+ refreshViewInBackground: boolean;
15
+ selectedPeriod: MonthYearPeriod;
16
+ status: ZeniAPIStatus;
17
+ }, "expenseAutomationActualMatchingView/fetchActualMatchingFailure">, fetchActualMatchingMatch: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[matchId: string, refreshViewInBackground?: any], {
18
+ matchId: string;
19
+ refreshViewInBackground: any;
20
+ }, "expenseAutomationActualMatchingView/fetchActualMatchingMatch", never, never>, fetchActualMatchingMatchFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
21
+ matchId: ActualMatchingMatchId;
22
+ refreshViewInBackground: boolean;
23
+ status: ZeniAPIStatus;
24
+ }, "expenseAutomationActualMatchingView/fetchActualMatchingMatchFailure">, fetchActualMatchingMatchSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
25
+ matchId: ActualMatchingMatchId;
26
+ refreshViewInBackground: boolean;
27
+ }, "expenseAutomationActualMatchingView/fetchActualMatchingMatchSuccess">, fetchActualMatchingPage: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[period: TimePeriod, refreshViewInBackground?: any], {
28
+ period: TimePeriod;
29
+ refreshViewInBackground: any;
30
+ }, "expenseAutomationActualMatchingView/fetchActualMatchingPage", never, never>, fetchActualMatchingSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
31
+ matchIds: ActualMatchingMatchId[];
32
+ refreshViewInBackground: boolean;
33
+ selectedPeriod: MonthYearPeriod;
34
+ }, "expenseAutomationActualMatchingView/fetchActualMatchingSuccess">, matchAndReverseAccruals: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[params: MatchAndReverseAccrualsParams], MatchAndReverseAccrualsParams, "expenseAutomationActualMatchingView/matchAndReverseAccruals", never, never>, matchAndReverseAccrualsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
35
+ status: ZeniAPIStatus;
36
+ }, "expenseAutomationActualMatchingView/matchAndReverseAccrualsFailure">, matchAndReverseAccrualsSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
37
+ results: MatchAndReverseResult[];
38
+ }, "expenseAutomationActualMatchingView/matchAndReverseAccrualsSuccess">, openMatchNewModal: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[matchId?: string | undefined], {
39
+ matchId: string | undefined;
40
+ }, "expenseAutomationActualMatchingView/openMatchNewModal", never, never>, searchMatchAccruals: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[{
41
+ query: string;
42
+ pageToken?: string | null;
43
+ }], {
44
+ query: string;
45
+ pageToken: string | undefined;
46
+ }, "expenseAutomationActualMatchingView/searchMatchAccruals", never, never>, searchMatchAccrualsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
47
+ error: ZeniAPIStatus;
48
+ }, "expenseAutomationActualMatchingView/searchMatchAccrualsFailure">, searchMatchAccrualsSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
49
+ append: boolean;
50
+ nextPageToken: string | null;
51
+ results: JEOneTimeAccrualPayload[];
52
+ }, "expenseAutomationActualMatchingView/searchMatchAccrualsSuccess">, searchMatchTransactions: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[{
53
+ query: string;
54
+ pageToken?: string | null;
55
+ transactionIntegrationId?: string;
56
+ transactionType?: string;
57
+ }], {
58
+ query: string;
59
+ pageToken: string | undefined;
60
+ transactionType: string | undefined;
61
+ transactionIntegrationId: string | undefined;
62
+ }, "expenseAutomationActualMatchingView/searchMatchTransactions", never, never>, searchMatchTransactionsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
63
+ error: ZeniAPIStatus;
64
+ }, "expenseAutomationActualMatchingView/searchMatchTransactionsFailure">, searchMatchTransactionsSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
65
+ append: boolean;
66
+ nextPageToken: string | null;
67
+ results: ActualMatchingTransactionSearchResult[];
68
+ }, "expenseAutomationActualMatchingView/searchMatchTransactionsSuccess">, undoReversalAccruals: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[params: UndoReversalAccrualsParams], UndoReversalAccrualsParams, "expenseAutomationActualMatchingView/undoReversalAccruals", never, never>, undoReversalAccrualsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
69
+ status: ZeniAPIStatus;
70
+ }, "expenseAutomationActualMatchingView/undoReversalAccrualsFailure">, undoReversalAccrualsSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[payload: {
71
+ results: UndoReversalResult[];
72
+ }], {
73
+ results: UndoReversalResult[];
74
+ }, "expenseAutomationActualMatchingView/undoReversalAccrualsSuccess", never, never>, updateActualMatchingUIState: import("@reduxjs/toolkit").ActionCreatorWithPayload<Partial<ActualMatchingViewUIState>, "expenseAutomationActualMatchingView/updateActualMatchingUIState">;
75
+ declare const _default: import("redux").Reducer<ActualMatchingViewState>;
76
+ export default _default;