@zeniai/client-epic-state 5.2.22-betaAM2 → 5.2.22-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 (78) hide show
  1. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +0 -24
  2. package/lib/entity/jeSchedules/jeSchedulesPayload.js +0 -40
  3. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +0 -26
  4. package/lib/epic.d.ts +2 -6
  5. package/lib/epic.js +2 -10
  6. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +0 -40
  7. package/lib/esm/epic.js +2 -10
  8. package/lib/esm/index.js +4 -8
  9. package/lib/esm/reducer.js +0 -3
  10. package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +11 -28
  11. package/lib/esm/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js +1 -9
  12. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +45 -7
  13. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +13 -6
  14. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/prefetchOtherJeSchedulesTabEpic.js +35 -0
  15. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +0 -5
  16. package/lib/esm/view/expenseAutomationView/expenseAutomationViewSelector.js +7 -22
  17. package/lib/esm/view/expenseAutomationView/payload/jeSchedulesPayload.js +1 -1
  18. package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +31 -7
  19. package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +1 -3
  20. package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +1 -5
  21. package/lib/index.d.ts +6 -11
  22. package/lib/index.js +49 -73
  23. package/lib/reducer.d.ts +0 -1
  24. package/lib/reducer.js +0 -3
  25. package/lib/rootStateTypes.d.ts +0 -2
  26. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.d.ts +1 -2
  27. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +11 -28
  28. package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.d.ts +1 -2
  29. package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js +1 -9
  30. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.d.ts +1 -1
  31. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +45 -7
  32. package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.d.ts +2 -2
  33. package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +12 -5
  34. package/lib/view/expenseAutomationView/epics/jeSchedule/prefetchOtherJeSchedulesTabEpic.d.ts +12 -0
  35. package/lib/view/expenseAutomationView/epics/jeSchedule/prefetchOtherJeSchedulesTabEpic.js +39 -0
  36. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.d.ts +1 -2
  37. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +0 -5
  38. package/lib/view/expenseAutomationView/expenseAutomationViewSelector.js +7 -22
  39. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +54 -1
  40. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.js +3 -3
  41. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +13 -8
  42. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +33 -9
  43. package/lib/view/expenseAutomationView/selectorTypes/expenseAutomationViewSelectorTypes.d.ts +0 -2
  44. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.d.ts +2 -0
  45. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +1 -3
  46. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +3 -1
  47. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +1 -5
  48. package/package.json +1 -1
  49. package/lib/esm/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingEpic.js +0 -46
  50. package/lib/esm/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingPageEpic.js +0 -7
  51. package/lib/esm/view/expenseAutomationView/epics/actualMatching/matchAndReverseAccrualsEpic.js +0 -50
  52. package/lib/esm/view/expenseAutomationView/epics/actualMatching/searchMatchAccrualsEpic.js +0 -44
  53. package/lib/esm/view/expenseAutomationView/epics/actualMatching/searchMatchTransactionsEpic.js +0 -44
  54. package/lib/esm/view/expenseAutomationView/payload/actualMatchingPayload.js +0 -60
  55. package/lib/esm/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +0 -260
  56. package/lib/esm/view/expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.js +0 -1
  57. package/lib/esm/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +0 -196
  58. package/lib/esm/view/expenseAutomationView/types/actualMatchingViewState.js +0 -22
  59. package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingEpic.d.ts +0 -9
  60. package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingEpic.js +0 -50
  61. package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingPageEpic.d.ts +0 -5
  62. package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingPageEpic.js +0 -11
  63. package/lib/view/expenseAutomationView/epics/actualMatching/matchAndReverseAccrualsEpic.d.ts +0 -8
  64. package/lib/view/expenseAutomationView/epics/actualMatching/matchAndReverseAccrualsEpic.js +0 -54
  65. package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchAccrualsEpic.d.ts +0 -8
  66. package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchAccrualsEpic.js +0 -48
  67. package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchTransactionsEpic.d.ts +0 -8
  68. package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchTransactionsEpic.js +0 -48
  69. package/lib/view/expenseAutomationView/payload/actualMatchingPayload.d.ts +0 -72
  70. package/lib/view/expenseAutomationView/payload/actualMatchingPayload.js +0 -65
  71. package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.d.ts +0 -53
  72. package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +0 -264
  73. package/lib/view/expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.d.ts +0 -59
  74. package/lib/view/expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.js +0 -2
  75. package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.d.ts +0 -11
  76. package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +0 -208
  77. package/lib/view/expenseAutomationView/types/actualMatchingViewState.d.ts +0 -81
  78. package/lib/view/expenseAutomationView/types/actualMatchingViewState.js +0 -27
@@ -1,48 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.searchMatchAccrualsEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const jeSchedulesReducer_1 = require("../../../../entity/jeSchedules/jeSchedulesReducer");
7
- const responsePayload_1 = require("../../../../responsePayload");
8
- const actualMatchingViewReducer_1 = require("../../reducers/actualMatchingViewReducer");
9
- const actualMatchingViewState_1 = require("../../types/actualMatchingViewState");
10
- const searchMatchAccrualsEpic = (actions$, _state$, zeniAPI) => {
11
- const searchActions$ = actions$.pipe((0, operators_1.filter)(actualMatchingViewReducer_1.searchMatchAccruals.match));
12
- const pagination$ = searchActions$.pipe((0, operators_1.filter)((action) => action.payload.pageToken != null));
13
- const newSearchDebounced$ = searchActions$.pipe((0, operators_1.filter)((action) => action.payload.pageToken == null), (0, operators_1.debounceTime)(actualMatchingViewState_1.MATCH_SEARCH_DEBOUNCE_MS));
14
- return (0, rxjs_1.merge)(pagination$, newSearchDebounced$).pipe((0, operators_1.switchMap)((action) => {
15
- const { query, pageToken } = action.payload;
16
- const offset = pageToken != null && pageToken.length > 0 ? Number(pageToken) : 0;
17
- const searchText = encodeURIComponent(query);
18
- const limit = actualMatchingViewState_1.MATCH_ACCRUAL_SEARCH_LIMIT;
19
- return zeniAPI
20
- .getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals?status=posted&reversal_policy=on_bill_match&search_text=${searchText}&limit=${limit}&offset=${offset}`)
21
- .pipe((0, operators_1.mergeMap)((response) => {
22
- if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
23
- const accruals = response.data.accruals ?? [];
24
- const append = pageToken != null;
25
- const nextOffset = offset + accruals.length;
26
- const total = response.data.total ?? nextOffset;
27
- const nextPageToken = nextOffset < total ? String(nextOffset) : null;
28
- const actionsOut = [];
29
- if (accruals.length > 0) {
30
- actionsOut.push((0, jeSchedulesReducer_1.updateJEOneTimeAccruals)(accruals));
31
- }
32
- actionsOut.push((0, actualMatchingViewReducer_1.searchMatchAccrualsSuccess)({
33
- append,
34
- nextPageToken,
35
- results: accruals,
36
- }));
37
- return (0, rxjs_1.from)(actionsOut);
38
- }
39
- return (0, rxjs_1.of)((0, actualMatchingViewReducer_1.searchMatchAccrualsFailure)({
40
- error: response.status,
41
- }));
42
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, actualMatchingViewReducer_1.searchMatchAccrualsFailure)({
43
- error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Search match accruals REST API call errored out' +
44
- JSON.stringify(error)),
45
- }))));
46
- }));
47
- };
48
- exports.searchMatchAccrualsEpic = searchMatchAccrualsEpic;
@@ -1,8 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { Observable } from 'rxjs';
3
- import { clearAll } from '../../../../rootActions';
4
- import { RootState } from '../../../../rootStateTypes';
5
- import { ZeniAPI } from '../../../../zeniAPI';
6
- import { openMatchNewModal, searchMatchAccruals, searchMatchTransactions, searchMatchTransactionsFailure, searchMatchTransactionsSuccess } from '../../reducers/actualMatchingViewReducer';
7
- export type ActionType = ReturnType<typeof clearAll> | ReturnType<typeof openMatchNewModal> | ReturnType<typeof searchMatchAccruals> | ReturnType<typeof searchMatchTransactions> | ReturnType<typeof searchMatchTransactionsFailure> | ReturnType<typeof searchMatchTransactionsSuccess>;
8
- export declare const searchMatchTransactionsEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -1,48 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.searchMatchTransactionsEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const responsePayload_1 = require("../../../../responsePayload");
7
- const actualMatchingPayload_1 = require("../../payload/actualMatchingPayload");
8
- const actualMatchingViewReducer_1 = require("../../reducers/actualMatchingViewReducer");
9
- const actualMatchingViewState_1 = require("../../types/actualMatchingViewState");
10
- const searchMatchTransactionsEpic = (actions$, _state$, zeniAPI) => {
11
- const openModal$ = actions$.pipe((0, operators_1.filter)(actualMatchingViewReducer_1.openMatchNewModal.match), (0, operators_1.mergeMap)(() => (0, rxjs_1.from)([
12
- (0, actualMatchingViewReducer_1.searchMatchTransactions)({ query: '' }),
13
- (0, actualMatchingViewReducer_1.searchMatchAccruals)({ query: '' }),
14
- ])));
15
- const searchActions$ = actions$.pipe((0, operators_1.filter)(actualMatchingViewReducer_1.searchMatchTransactions.match));
16
- const pagination$ = searchActions$.pipe((0, operators_1.filter)((action) => action.payload.pageToken != null));
17
- const newSearchDebounced$ = searchActions$.pipe((0, operators_1.filter)((action) => action.payload.pageToken == null), (0, operators_1.debounceTime)(actualMatchingViewState_1.MATCH_SEARCH_DEBOUNCE_MS));
18
- const search$ = (0, rxjs_1.merge)(pagination$, newSearchDebounced$).pipe((0, operators_1.switchMap)((action) => {
19
- const { query, pageToken } = action.payload;
20
- const queryParam = {
21
- search_text: query,
22
- page_size: actualMatchingViewState_1.MATCH_TRANSACTION_SEARCH_PAGE_SIZE,
23
- ...(pageToken != null ? { page_token: pageToken } : {}),
24
- };
25
- return zeniAPI
26
- .getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals/match-transaction-search?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
27
- .pipe((0, operators_1.mergeMap)((response) => {
28
- if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
29
- const { transactions, next_page_token } = response.data;
30
- const append = pageToken != null;
31
- const results = (transactions ?? []).map(actualMatchingPayload_1.toActualMatchingTransactionSearchResult);
32
- return (0, rxjs_1.of)((0, actualMatchingViewReducer_1.searchMatchTransactionsSuccess)({
33
- append,
34
- nextPageToken: next_page_token ?? null,
35
- results,
36
- }));
37
- }
38
- return (0, rxjs_1.of)((0, actualMatchingViewReducer_1.searchMatchTransactionsFailure)({
39
- error: response.status,
40
- }));
41
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, actualMatchingViewReducer_1.searchMatchTransactionsFailure)({
42
- error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Search match transactions REST API call errored out' +
43
- JSON.stringify(error)),
44
- }))));
45
- }));
46
- return (0, rxjs_1.merge)(openModal$, search$);
47
- };
48
- exports.searchMatchTransactionsEpic = searchMatchTransactionsEpic;
@@ -1,72 +0,0 @@
1
- import { ID } from '../../../commonStateTypes/common';
2
- import { TimePeriod } from '../../../commonStateTypes/timePeriod';
3
- import { JEOneTimeAccrualPayload } from '../../../entity/jeSchedules/jeSchedulesPayload';
4
- import { ZeniAPIResponse } from '../../../responsePayload';
5
- import { ActualMatchingTransactionSearchResult, MatchAndReverseResult } from '../types/actualMatchingViewState';
6
- export declare function toServiceMonthFromPeriod(period: TimePeriod): string;
7
- export interface ActualMatchingListResponsePayload {
8
- accruals: JEOneTimeAccrualPayload[];
9
- total: number;
10
- limit?: number | null;
11
- offset?: number | null;
12
- }
13
- export type ActualMatchingListResponse = ZeniAPIResponse<ActualMatchingListResponsePayload>;
14
- export interface ActualMatchingAccrualSearchResponsePayload {
15
- accruals: JEOneTimeAccrualPayload[];
16
- total: number;
17
- limit?: number | null;
18
- offset?: number | null;
19
- }
20
- export type ActualMatchingAccrualSearchResponse = ZeniAPIResponse<ActualMatchingAccrualSearchResponsePayload>;
21
- export interface MatchTransactionSearchQueryPayload {
22
- page_size: number;
23
- search_text: string;
24
- page_token?: string | null;
25
- }
26
- export interface MatchTransactionSearchResultPayload {
27
- line_id: string;
28
- transaction_date: string;
29
- transaction_id: ID;
30
- transaction_integration_id: string;
31
- transaction_type: string;
32
- account_description?: string | null;
33
- account_id?: ID | null;
34
- account_name?: string | null;
35
- accounting_class_id?: ID | null;
36
- accounting_class_name?: string | null;
37
- amount?: number | null;
38
- currency_code?: string | null;
39
- currency_symbol?: string | null;
40
- total_amount?: number | null;
41
- transaction_description?: string | null;
42
- transaction_memo?: string | null;
43
- transaction_type_name?: string | null;
44
- vendor_id?: ID | null;
45
- vendor_name?: string | null;
46
- }
47
- export interface MatchTransactionSearchResponsePayload {
48
- transactions: MatchTransactionSearchResultPayload[];
49
- next_page_token?: string | null;
50
- }
51
- export type MatchTransactionSearchResponse = ZeniAPIResponse<MatchTransactionSearchResponsePayload>;
52
- export declare function toActualMatchingTransactionSearchResult(payload: MatchTransactionSearchResultPayload): ActualMatchingTransactionSearchResult;
53
- export interface MatchAndReverseRequestPayload {
54
- accrual_ids: ID[];
55
- line_id: string;
56
- transaction_id: ID;
57
- transaction_integration_id: string;
58
- transaction_type: string;
59
- }
60
- export interface MatchAndReverseResultPayload {
61
- accrual_id: ID;
62
- status: string;
63
- reason?: string | null;
64
- }
65
- export interface MatchAndReverseResponsePayload {
66
- match_batch_id: string;
67
- results: MatchAndReverseResultPayload[];
68
- transaction_id: ID;
69
- transaction_integration_id: string;
70
- }
71
- export type MatchAndReverseResponse = ZeniAPIResponse<MatchAndReverseResponsePayload>;
72
- export declare function toMatchAndReverseResult(payload: MatchAndReverseResultPayload): MatchAndReverseResult;
@@ -1,65 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toServiceMonthFromPeriod = toServiceMonthFromPeriod;
4
- exports.toActualMatchingTransactionSearchResult = toActualMatchingTransactionSearchResult;
5
- exports.toMatchAndReverseResult = toMatchAndReverseResult;
6
- const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
7
- const actualMatchingViewState_1 = require("../types/actualMatchingViewState");
8
- function toServiceMonthFromPeriod(period) {
9
- return (0, timePeriod_1.toString)(period.start).slice(0, 7);
10
- }
11
- const DEFAULT_CURRENCY_CODE = 'USD';
12
- const DEFAULT_CURRENCY_SYMBOL = '$';
13
- function resolveMatchSearchAmount(payload) {
14
- const raw = payload.total_amount ?? payload.amount;
15
- if (typeof raw === 'number' && Number.isFinite(raw)) {
16
- return raw;
17
- }
18
- if (typeof raw === 'string' && raw !== '') {
19
- const parsed = Number(raw);
20
- if (Number.isFinite(parsed)) {
21
- return parsed;
22
- }
23
- }
24
- return 0;
25
- }
26
- function resolveMatchSearchCurrencySymbol(payload, currencyCode) {
27
- if (payload.currency_symbol != null && payload.currency_symbol !== '') {
28
- return payload.currency_symbol;
29
- }
30
- return currencyCode === DEFAULT_CURRENCY_CODE
31
- ? DEFAULT_CURRENCY_SYMBOL
32
- : currencyCode;
33
- }
34
- function toActualMatchingTransactionSearchResult(payload) {
35
- const currencyCode = payload.currency_code != null && payload.currency_code !== ''
36
- ? payload.currency_code
37
- : DEFAULT_CURRENCY_CODE;
38
- return {
39
- transactionId: payload.transaction_id,
40
- transactionIntegrationId: payload.transaction_integration_id,
41
- transactionType: payload.transaction_type,
42
- lineId: payload.line_id,
43
- vendorId: payload.vendor_id ?? undefined,
44
- vendorName: payload.vendor_name ?? '',
45
- amount: resolveMatchSearchAmount(payload),
46
- transactionDate: payload.transaction_date,
47
- accountId: payload.account_id ?? undefined,
48
- accountName: payload.account_name ?? undefined,
49
- accountDescription: payload.account_description ?? undefined,
50
- accountingClassId: payload.accounting_class_id ?? undefined,
51
- accountingClassName: payload.accounting_class_name ?? undefined,
52
- currencyCode,
53
- currencySymbol: resolveMatchSearchCurrencySymbol(payload, currencyCode),
54
- transactionMemo: payload.transaction_memo ?? undefined,
55
- transactionDescription: payload.transaction_description ?? undefined,
56
- transactionTypeName: payload.transaction_type_name ?? undefined,
57
- };
58
- }
59
- function toMatchAndReverseResult(payload) {
60
- return {
61
- accrualId: payload.accrual_id,
62
- status: (0, actualMatchingViewState_1.toMatchAndReverseResultStatus)(payload.status),
63
- reason: payload.reason ?? undefined,
64
- };
65
- }
@@ -1,53 +0,0 @@
1
- import { MonthYearPeriod, TimePeriod } from '../../../commonStateTypes/timePeriod';
2
- import { JEOneTimeAccrualPayload } from '../../../entity/jeSchedules/jeSchedulesPayload';
3
- import { ZeniAPIStatus } from '../../../responsePayload';
4
- import { ActualMatchingAccrualSearchState, ActualMatchingMatchModalState, ActualMatchingTransactionSearchResult, ActualMatchingTransactionSearchState, ActualMatchingViewState, ActualMatchingViewUIState, MatchAndReverseAccrualsParams, MatchAndReverseResult } from '../types/actualMatchingViewState';
5
- export declare const initialTransactionSearchState: ActualMatchingTransactionSearchState;
6
- export declare const initialAccrualSearchState: ActualMatchingAccrualSearchState;
7
- export declare const initialMatchModalState: ActualMatchingMatchModalState;
8
- export declare const initialState: ActualMatchingViewState;
9
- 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], {
10
- period: TimePeriod;
11
- refreshViewInBackground: any;
12
- }, "expenseAutomationActualMatchingView/fetchActualMatching", never, never>, fetchActualMatchingFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
13
- refreshViewInBackground: boolean;
14
- selectedPeriod: MonthYearPeriod;
15
- status: ZeniAPIStatus;
16
- }, "expenseAutomationActualMatchingView/fetchActualMatchingFailure">, fetchActualMatchingPage: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[period: TimePeriod, refreshViewInBackground?: any], {
17
- period: TimePeriod;
18
- refreshViewInBackground: any;
19
- }, "expenseAutomationActualMatchingView/fetchActualMatchingPage", never, never>, fetchActualMatchingSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
20
- accruals: JEOneTimeAccrualPayload[];
21
- refreshViewInBackground: boolean;
22
- selectedPeriod: MonthYearPeriod;
23
- }, "expenseAutomationActualMatchingView/fetchActualMatchingSuccess">, matchAndReverseAccruals: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[params: MatchAndReverseAccrualsParams], MatchAndReverseAccrualsParams, "expenseAutomationActualMatchingView/matchAndReverseAccruals", never, never>, matchAndReverseAccrualsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
24
- status: ZeniAPIStatus;
25
- }, "expenseAutomationActualMatchingView/matchAndReverseAccrualsFailure">, matchAndReverseAccrualsSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
26
- results: MatchAndReverseResult[];
27
- }, "expenseAutomationActualMatchingView/matchAndReverseAccrualsSuccess">, openMatchNewModal: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationActualMatchingView/openMatchNewModal">, searchMatchAccruals: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[{
28
- query: string;
29
- pageToken?: string | null;
30
- }], {
31
- query: string;
32
- pageToken: string | undefined;
33
- }, "expenseAutomationActualMatchingView/searchMatchAccruals", never, never>, searchMatchAccrualsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
34
- error: ZeniAPIStatus;
35
- }, "expenseAutomationActualMatchingView/searchMatchAccrualsFailure">, searchMatchAccrualsSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
36
- append: boolean;
37
- nextPageToken: string | null;
38
- results: JEOneTimeAccrualPayload[];
39
- }, "expenseAutomationActualMatchingView/searchMatchAccrualsSuccess">, searchMatchTransactions: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[{
40
- query: string;
41
- pageToken?: string | null;
42
- }], {
43
- query: string;
44
- pageToken: string | undefined;
45
- }, "expenseAutomationActualMatchingView/searchMatchTransactions", never, never>, searchMatchTransactionsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
46
- error: ZeniAPIStatus;
47
- }, "expenseAutomationActualMatchingView/searchMatchTransactionsFailure">, searchMatchTransactionsSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
48
- append: boolean;
49
- nextPageToken: string | null;
50
- results: ActualMatchingTransactionSearchResult[];
51
- }, "expenseAutomationActualMatchingView/searchMatchTransactionsSuccess">, updateActualMatchingUIState: import("@reduxjs/toolkit").ActionCreatorWithPayload<Partial<ActualMatchingViewUIState>, "expenseAutomationActualMatchingView/updateActualMatchingUIState">;
52
- declare const _default: import("redux").Reducer<ActualMatchingViewState>;
53
- export default _default;
@@ -1,264 +0,0 @@
1
- "use strict";
2
- var _a;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.updateActualMatchingUIState = exports.searchMatchTransactionsSuccess = exports.searchMatchTransactionsFailure = exports.searchMatchTransactions = exports.searchMatchAccrualsSuccess = exports.searchMatchAccrualsFailure = exports.searchMatchAccruals = exports.openMatchNewModal = exports.matchAndReverseAccrualsSuccess = exports.matchAndReverseAccrualsFailure = exports.matchAndReverseAccruals = exports.fetchActualMatchingSuccess = exports.fetchActualMatchingPage = exports.fetchActualMatchingFailure = exports.fetchActualMatching = exports.closeMatchNewModal = exports.clearMatchNewModal = exports.clearActualMatchingView = exports.initialState = exports.initialMatchModalState = exports.initialAccrualSearchState = exports.initialTransactionSearchState = void 0;
5
- const toolkit_1 = require("@reduxjs/toolkit");
6
- const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
7
- const jeScheduleHelper_1 = require("../../../entity/jeSchedules/jeScheduleHelper");
8
- const rootActions_1 = require("../../../rootActions");
9
- exports.initialTransactionSearchState = {
10
- query: '',
11
- results: [],
12
- fetchState: 'Not-Started',
13
- error: undefined,
14
- nextPageToken: null,
15
- isLoadingMore: false,
16
- };
17
- exports.initialAccrualSearchState = {
18
- query: '',
19
- results: [],
20
- fetchState: 'Not-Started',
21
- error: undefined,
22
- nextPageToken: null,
23
- isLoadingMore: false,
24
- };
25
- exports.initialMatchModalState = {
26
- isOpen: false,
27
- transactionSearch: exports.initialTransactionSearchState,
28
- accrualSearch: exports.initialAccrualSearchState,
29
- confirmStatus: { fetchState: 'Not-Started', error: undefined },
30
- };
31
- exports.initialState = {
32
- accrualKeysByPeriod: {},
33
- fetchState: 'Not-Started',
34
- error: undefined,
35
- refreshStatus: {
36
- fetchState: 'Not-Started',
37
- error: undefined,
38
- },
39
- uiState: {
40
- sortKey: 'date',
41
- sortOrder: 'descending',
42
- searchString: '',
43
- scrollPosition: { scrollTop: 0, scrollLeft: undefined },
44
- },
45
- matchModal: exports.initialMatchModalState,
46
- hasValidState() {
47
- return this.fetchState == 'Completed';
48
- },
49
- };
50
- function resetMatchModalSearches(draft) {
51
- draft.matchModal.transactionSearch = exports.initialTransactionSearchState;
52
- draft.matchModal.accrualSearch = exports.initialAccrualSearchState;
53
- draft.matchModal.confirmStatus = {
54
- fetchState: 'Not-Started',
55
- error: undefined,
56
- };
57
- draft.matchModal.lastBatchResults = undefined;
58
- }
59
- const expenseAutomationActualMatchingView = (0, toolkit_1.createSlice)({
60
- name: 'expenseAutomationActualMatchingView',
61
- initialState: exports.initialState,
62
- reducers: {
63
- fetchActualMatchingPage: {
64
- prepare(period, refreshViewInBackground = false) {
65
- return {
66
- payload: {
67
- period,
68
- refreshViewInBackground,
69
- },
70
- };
71
- },
72
- reducer() {
73
- // Epic-only fan-out.
74
- },
75
- },
76
- fetchActualMatching: {
77
- reducer(draft, action) {
78
- const { refreshViewInBackground } = action.payload;
79
- if (refreshViewInBackground) {
80
- draft.refreshStatus = { fetchState: 'In-Progress', error: undefined };
81
- }
82
- else {
83
- draft.fetchState = 'In-Progress';
84
- draft.error = undefined;
85
- }
86
- },
87
- prepare(period, refreshViewInBackground = false) {
88
- return {
89
- payload: {
90
- period,
91
- refreshViewInBackground,
92
- },
93
- };
94
- },
95
- },
96
- fetchActualMatchingSuccess(draft, action) {
97
- const { accruals, selectedPeriod, refreshViewInBackground } = action.payload;
98
- const periodId = (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod);
99
- draft.accrualKeysByPeriod[periodId] = accruals.map((accrual) => (0, jeScheduleHelper_1.generateJEOneTimeAccrualKey)(accrual._id));
100
- if (refreshViewInBackground) {
101
- draft.refreshStatus = { fetchState: 'Completed', error: undefined };
102
- }
103
- else {
104
- draft.fetchState = 'Completed';
105
- draft.error = undefined;
106
- }
107
- },
108
- fetchActualMatchingFailure(draft, action) {
109
- const { status, refreshViewInBackground } = action.payload;
110
- if (refreshViewInBackground) {
111
- draft.refreshStatus = { fetchState: 'Error', error: status };
112
- }
113
- else {
114
- draft.fetchState = 'Error';
115
- draft.error = status;
116
- }
117
- },
118
- updateActualMatchingUIState(draft, action) {
119
- if (action.payload.sortKey != null) {
120
- draft.uiState.sortKey = action.payload.sortKey;
121
- }
122
- if (action.payload.sortOrder != null) {
123
- draft.uiState.sortOrder = action.payload.sortOrder;
124
- }
125
- if (action.payload.searchString != null) {
126
- draft.uiState.searchString = action.payload.searchString;
127
- }
128
- if (action.payload.scrollPosition != null) {
129
- draft.uiState.scrollPosition = action.payload.scrollPosition;
130
- }
131
- },
132
- openMatchNewModal(draft) {
133
- draft.matchModal.isOpen = true;
134
- },
135
- closeMatchNewModal(draft) {
136
- draft.matchModal.isOpen = false;
137
- resetMatchModalSearches(draft);
138
- },
139
- clearMatchNewModal(draft) {
140
- draft.matchModal.isOpen = false;
141
- resetMatchModalSearches(draft);
142
- },
143
- searchMatchTransactions: {
144
- reducer(draft, action) {
145
- const { query, pageToken } = action.payload;
146
- const isLoadMore = pageToken != null;
147
- draft.matchModal.transactionSearch.query = query;
148
- if (isLoadMore) {
149
- draft.matchModal.transactionSearch.isLoadingMore = true;
150
- }
151
- else {
152
- draft.matchModal.transactionSearch.isLoadingMore = false;
153
- draft.matchModal.transactionSearch.results = [];
154
- draft.matchModal.transactionSearch.nextPageToken = null;
155
- draft.matchModal.transactionSearch.fetchState = 'In-Progress';
156
- draft.matchModal.transactionSearch.error = undefined;
157
- }
158
- },
159
- prepare({ query, pageToken }) {
160
- return { payload: { query, pageToken: pageToken ?? undefined } };
161
- },
162
- },
163
- searchMatchTransactionsSuccess(draft, action) {
164
- const { append, nextPageToken, results } = action.payload;
165
- if (append) {
166
- const merged = [
167
- ...draft.matchModal.transactionSearch.results,
168
- ...results,
169
- ];
170
- const byKey = new Map(merged.map((result) => [
171
- `${result.transactionId}:${result.lineId}`,
172
- result,
173
- ]));
174
- draft.matchModal.transactionSearch.results = Array.from(byKey.values());
175
- }
176
- else {
177
- draft.matchModal.transactionSearch.results = results;
178
- }
179
- draft.matchModal.transactionSearch.nextPageToken = nextPageToken;
180
- draft.matchModal.transactionSearch.isLoadingMore = false;
181
- draft.matchModal.transactionSearch.fetchState = 'Completed';
182
- draft.matchModal.transactionSearch.error = undefined;
183
- },
184
- searchMatchTransactionsFailure(draft, action) {
185
- draft.matchModal.transactionSearch.isLoadingMore = false;
186
- draft.matchModal.transactionSearch.fetchState = 'Error';
187
- draft.matchModal.transactionSearch.error = action.payload.error;
188
- },
189
- searchMatchAccruals: {
190
- reducer(draft, action) {
191
- const { query, pageToken } = action.payload;
192
- const isLoadMore = pageToken != null;
193
- draft.matchModal.accrualSearch.query = query;
194
- if (isLoadMore) {
195
- draft.matchModal.accrualSearch.isLoadingMore = true;
196
- }
197
- else {
198
- draft.matchModal.accrualSearch.isLoadingMore = false;
199
- draft.matchModal.accrualSearch.results = [];
200
- draft.matchModal.accrualSearch.nextPageToken = null;
201
- draft.matchModal.accrualSearch.fetchState = 'In-Progress';
202
- draft.matchModal.accrualSearch.error = undefined;
203
- }
204
- },
205
- prepare({ query, pageToken }) {
206
- return { payload: { query, pageToken: pageToken ?? undefined } };
207
- },
208
- },
209
- searchMatchAccrualsSuccess(draft, action) {
210
- const { append, nextPageToken, results } = action.payload;
211
- const keys = results.map((accrual) => (0, jeScheduleHelper_1.generateJEOneTimeAccrualKey)(accrual._id));
212
- if (append) {
213
- const merged = [...draft.matchModal.accrualSearch.results, ...keys];
214
- draft.matchModal.accrualSearch.results = Array.from(new Set(merged));
215
- }
216
- else {
217
- draft.matchModal.accrualSearch.results = keys;
218
- }
219
- draft.matchModal.accrualSearch.nextPageToken = nextPageToken;
220
- draft.matchModal.accrualSearch.isLoadingMore = false;
221
- draft.matchModal.accrualSearch.fetchState = 'Completed';
222
- draft.matchModal.accrualSearch.error = undefined;
223
- },
224
- searchMatchAccrualsFailure(draft, action) {
225
- draft.matchModal.accrualSearch.isLoadingMore = false;
226
- draft.matchModal.accrualSearch.fetchState = 'Error';
227
- draft.matchModal.accrualSearch.error = action.payload.error;
228
- },
229
- matchAndReverseAccruals: {
230
- reducer(draft) {
231
- draft.matchModal.confirmStatus = {
232
- fetchState: 'In-Progress',
233
- error: undefined,
234
- };
235
- },
236
- prepare(params) {
237
- return { payload: params };
238
- },
239
- },
240
- matchAndReverseAccrualsSuccess(draft, action) {
241
- draft.matchModal.confirmStatus = {
242
- fetchState: 'Completed',
243
- error: undefined,
244
- };
245
- draft.matchModal.lastBatchResults = action.payload.results;
246
- },
247
- matchAndReverseAccrualsFailure(draft, action) {
248
- draft.matchModal.confirmStatus = {
249
- fetchState: 'Error',
250
- error: action.payload.status,
251
- };
252
- },
253
- clearActualMatchingView(draft) {
254
- Object.assign(draft, exports.initialState);
255
- },
256
- },
257
- extraReducers: (builder) => {
258
- builder.addCase(rootActions_1.clearAll, (draft) => {
259
- Object.assign(draft, exports.initialState);
260
- });
261
- },
262
- });
263
- _a = expenseAutomationActualMatchingView.actions, exports.clearActualMatchingView = _a.clearActualMatchingView, exports.clearMatchNewModal = _a.clearMatchNewModal, exports.closeMatchNewModal = _a.closeMatchNewModal, exports.fetchActualMatching = _a.fetchActualMatching, exports.fetchActualMatchingFailure = _a.fetchActualMatchingFailure, exports.fetchActualMatchingPage = _a.fetchActualMatchingPage, exports.fetchActualMatchingSuccess = _a.fetchActualMatchingSuccess, exports.matchAndReverseAccruals = _a.matchAndReverseAccruals, exports.matchAndReverseAccrualsFailure = _a.matchAndReverseAccrualsFailure, exports.matchAndReverseAccrualsSuccess = _a.matchAndReverseAccrualsSuccess, exports.openMatchNewModal = _a.openMatchNewModal, exports.searchMatchAccruals = _a.searchMatchAccruals, exports.searchMatchAccrualsFailure = _a.searchMatchAccrualsFailure, exports.searchMatchAccrualsSuccess = _a.searchMatchAccrualsSuccess, exports.searchMatchTransactions = _a.searchMatchTransactions, exports.searchMatchTransactionsFailure = _a.searchMatchTransactionsFailure, exports.searchMatchTransactionsSuccess = _a.searchMatchTransactionsSuccess, exports.updateActualMatchingUIState = _a.updateActualMatchingUIState;
264
- exports.default = expenseAutomationActualMatchingView.reducer;
@@ -1,59 +0,0 @@
1
- import { FetchStateAndError } from '../../../commonStateTypes/common';
2
- import { SelectorView } from '../../../commonStateTypes/viewAndReport/viewAndReport';
3
- import { JEOneTimeAccrual } from '../../../entity/jeSchedules/jeSchedulesSelector';
4
- import { ZeniDate } from '../../../zeniDayJS';
5
- import { ActualMatchingTransactionSearchResult, ActualMatchingViewUIState, MatchAndReverseResult } from '../types/actualMatchingViewState';
6
- export type ActualMatchingRowKind = 'auto_reversed' | 'pending_review' | 'manually_reversed';
7
- export interface ActualMatchingRow extends JEOneTimeAccrual {
8
- kind: ActualMatchingRowKind;
9
- reversalDate?: ZeniDate;
10
- }
11
- export interface ActualMatchingKpiSummary {
12
- ai: {
13
- count: number;
14
- };
15
- autoReversed: {
16
- amount: number;
17
- count: number;
18
- };
19
- manual: {
20
- count: number;
21
- };
22
- pendingReview: {
23
- amount: number;
24
- count: number;
25
- };
26
- totalThisClose: {
27
- amount: number;
28
- count: number;
29
- };
30
- }
31
- export interface ActualMatchingMatchModalView {
32
- accrualSearch: {
33
- fetchState: FetchStateAndError;
34
- isLoadingMore: boolean;
35
- nextPageToken: string | null;
36
- query: string;
37
- results: JEOneTimeAccrual[];
38
- };
39
- confirmStatus: FetchStateAndError;
40
- isOpen: boolean;
41
- transactionSearch: {
42
- fetchState: FetchStateAndError;
43
- isLoadingMore: boolean;
44
- nextPageToken: string | null;
45
- query: string;
46
- results: ActualMatchingTransactionSearchResult[];
47
- };
48
- lastBatchResults?: MatchAndReverseResult[];
49
- }
50
- export interface ExpenseAutomationActualMatchingViewSelector extends SelectorView {
51
- autoReversed: ActualMatchingRow[];
52
- hasLoadedForSelectedPeriod: boolean;
53
- kpiSummary: ActualMatchingKpiSummary;
54
- manuallyReversed: ActualMatchingRow[];
55
- matchModal: ActualMatchingMatchModalView;
56
- pendingReview: ActualMatchingRow[];
57
- refreshStatus: FetchStateAndError;
58
- uiState: ActualMatchingViewUIState;
59
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,11 +0,0 @@
1
- import { JEOneTimeAccrual } from '../../../entity/jeSchedules/jeSchedulesSelector';
2
- import { RootState } from '../../../rootStateTypes';
3
- import { ZeniDate } from '../../../zeniDayJS';
4
- import { ExpenseAutomationActualMatchingViewSelector } from '../selectorTypes/actualMatchingViewSelectorTypes';
5
- export declare function isAutoReversedAccrual(accrual: JEOneTimeAccrual): boolean;
6
- export declare function isManuallyReversedAccrual(accrual: JEOneTimeAccrual): boolean;
7
- export declare function isPendingReviewAccrual(accrual: JEOneTimeAccrual): boolean;
8
- export declare function getClearedMatchedAmount(accrual: JEOneTimeAccrual): number | undefined;
9
- export declare function getActualMatchingAmount(accrual: JEOneTimeAccrual): number;
10
- export declare function getActualMatchingReversalDate(accrual: JEOneTimeAccrual): ZeniDate | undefined;
11
- export declare function getExpenseAutomationActualMatchingView(state: RootState): ExpenseAutomationActualMatchingViewSelector;