@zeniai/client-epic-state 5.0.24 → 5.0.25-betaRD1
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.
- package/lib/coreEpics.js +4 -1
- package/lib/entity/tenant/epic/deleteConnectionEpic.d.ts +19 -0
- package/lib/entity/tenant/epic/deleteConnectionEpic.js +29 -0
- package/lib/entity/tenant/epic/saveAPIKeyConnectionEpic.d.ts +19 -0
- package/lib/entity/tenant/epic/saveAPIKeyConnectionEpic.js +31 -0
- package/lib/entity/tenant/epic/saveOAuthConnectionEpic.d.ts +19 -0
- package/lib/entity/tenant/epic/saveOAuthConnectionEpic.js +33 -0
- package/lib/entity/tenant/tenantPayload.d.ts +2 -0
- package/lib/entity/tenant/tenantReducer.d.ts +60 -1
- package/lib/entity/tenant/tenantReducer.js +143 -4
- package/lib/entity/tenant/tenantState.d.ts +8 -0
- package/lib/epic.js +4 -1
- package/lib/esm/coreEpics.js +4 -1
- package/lib/esm/entity/tenant/epic/deleteConnectionEpic.js +25 -0
- package/lib/esm/entity/tenant/epic/saveAPIKeyConnectionEpic.js +27 -0
- package/lib/esm/entity/tenant/epic/saveOAuthConnectionEpic.js +29 -0
- package/lib/esm/entity/tenant/tenantReducer.js +139 -2
- package/lib/esm/epic.js +4 -1
- package/lib/esm/index.js +2 -2
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +6 -2
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +7 -2
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +5 -5
- package/lib/esm/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +7 -3
- package/lib/esm/view/expenseAutomationView/selectors/missingReceiptsSelector.js +2 -0
- package/lib/esm/view/reportUIOptions/reportUIOptionsReducer.js +1 -1
- package/lib/esm/view/spendManagement/zeniAccounts/zeniAccountList/zeniAccountListSelector.js +3 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +42 -30
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +6 -2
- package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +7 -2
- package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.d.ts +6 -4
- package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +4 -4
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +7 -7
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +7 -3
- package/lib/view/expenseAutomationView/selectorTypes/missingReceiptsSelectorTypes.d.ts +4 -2
- package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.js +2 -0
- package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +2 -2
- package/lib/view/reportUIOptions/reportUIOptionsReducer.js +1 -1
- package/lib/view/spendManagement/zeniAccounts/zeniAccountList/zeniAccountListSelector.js +3 -1
- package/package.json +1 -1
package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js
CHANGED
|
@@ -33,11 +33,15 @@ const fetchCompletedTransactionsEpic = (actions$, state$, zeniAPI) => actions$.p
|
|
|
33
33
|
const queryPayload = {
|
|
34
34
|
start_date: period.start,
|
|
35
35
|
end_date: period.end,
|
|
36
|
-
sort_by: sortKey,
|
|
37
|
-
sort_order: sortOrder === 'ascending' ? 'asc' : 'desc',
|
|
38
36
|
page_token: action.payload.pageToken ?? null,
|
|
39
37
|
page_size: 25,
|
|
40
38
|
};
|
|
39
|
+
if (sortKey != null) {
|
|
40
|
+
queryPayload.sort_by = sortKey;
|
|
41
|
+
}
|
|
42
|
+
if (sortOrder != null) {
|
|
43
|
+
queryPayload.sort_order = sortOrder === 'ascending' ? 'asc' : 'desc';
|
|
44
|
+
}
|
|
41
45
|
if (completedSubTab !== 'all') {
|
|
42
46
|
queryPayload.match_type = completedSubTab;
|
|
43
47
|
}
|
package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js
CHANGED
|
@@ -35,12 +35,17 @@ const searchTransactionsForManualMatchEpic = (actions$, state$, zeniAPI) => {
|
|
|
35
35
|
const state = state$.value;
|
|
36
36
|
const { expenseAutomationMissingReceiptsViewState: { bulkUpload: { manualSearch, sortKey, sortOrder }, }, } = state;
|
|
37
37
|
const { end, start } = (0, rollingCalendarDateRangeInclusive_1.rollingCalendarDateRangeInclusive)(MANUAL_SEARCH_TRANSACTION_DATE_RANGE_DAYS);
|
|
38
|
+
// Manual search is independent of the Completed tab's optional sort: when the
|
|
39
|
+
// bulk upload sort is neutral (no user-applied sort), fall back to date/desc so
|
|
40
|
+
// search results stay deterministic for the matching UX.
|
|
41
|
+
const manualSearchSortKey = sortKey ?? 'date';
|
|
42
|
+
const manualSearchSortOrder = sortOrder ?? 'descending';
|
|
38
43
|
const queryParam = {
|
|
39
44
|
start_date: start,
|
|
40
45
|
end_date: end,
|
|
41
46
|
auto_categorized: exports.MANUAL_TRANSACTION_SEARCH_AUTO_CATEGORIZED,
|
|
42
|
-
sort_by: (0, transactionsViewState_1.toTransactionsSortKey)(
|
|
43
|
-
sort_order:
|
|
47
|
+
sort_by: (0, transactionsViewState_1.toTransactionsSortKey)(manualSearchSortKey),
|
|
48
|
+
sort_order: manualSearchSortOrder === 'ascending' ? 'asc' : 'desc',
|
|
44
49
|
page_token: pageToken ?? null,
|
|
45
50
|
page_size: manualSearch.pageSize,
|
|
46
51
|
search_text: query,
|
package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.d.ts
CHANGED
|
@@ -4,11 +4,13 @@ import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
|
4
4
|
import { updateTransactions } from '../../../../entity/transaction/transactionReducer';
|
|
5
5
|
import { RootState } from '../../../../reducer';
|
|
6
6
|
import { ZeniAPI } from '../../../../zeniAPI';
|
|
7
|
-
import { bulkUploadAutomatchingTimedOut, bulkUploadReceiptsSuccess, clearBulkUpload, fetchBulkUploadBatchDetails, fetchBulkUploadBatchDetailsSuccess, fetchBulkUploadBatches, pusherBatchStatusUpdate,
|
|
8
|
-
export type ActionType = ReturnType<typeof bulkUploadReceiptsSuccess> | ReturnType<typeof restoreBulkUploadMatchingState> | ReturnType<typeof pusherBatchStatusUpdate> | ReturnType<typeof fetchBulkUploadBatchDetails> | ReturnType<typeof fetchBulkUploadBatchDetailsSuccess> | ReturnType<typeof fetchBulkUploadBatches> | ReturnType<typeof
|
|
7
|
+
import { bulkUploadAutomatchingTimedOut, bulkUploadReceiptsSuccess, clearBulkUpload, fetchBulkUploadBatchDetails, fetchBulkUploadBatchDetailsSuccess, fetchBulkUploadBatches, pusherBatchStatusUpdate, restoreBulkUploadMatchingState } from '../../reducers/missingReceiptsViewReducer';
|
|
8
|
+
export type ActionType = ReturnType<typeof bulkUploadReceiptsSuccess> | ReturnType<typeof restoreBulkUploadMatchingState> | ReturnType<typeof pusherBatchStatusUpdate> | ReturnType<typeof fetchBulkUploadBatchDetails> | ReturnType<typeof fetchBulkUploadBatchDetailsSuccess> | ReturnType<typeof fetchBulkUploadBatches> | ReturnType<typeof updateTransactions> | ReturnType<typeof clearBulkUpload> | ReturnType<typeof openSnackbar> | ReturnType<typeof bulkUploadAutomatchingTimedOut>;
|
|
9
9
|
/**
|
|
10
|
-
* On Pusher batch completion: refresh batch list (then fetchMultipleBatchDetailsEpic runs)
|
|
11
|
-
*
|
|
10
|
+
* On Pusher batch completion: refresh batch list (then fetchMultipleBatchDetailsEpic runs).
|
|
11
|
+
* Debounced to reduce duplicate refreshes. The post-match tab decision
|
|
12
|
+
* (Unmatched vs Completed) is made client-side in `ExpenseAutomationPage` once fresh
|
|
13
|
+
* batch details land -- do not dispatch `requestMissingReceiptsTabNavigation` here.
|
|
12
14
|
*/
|
|
13
15
|
export declare const pusherBatchStatusCompletionEpic: (actions$: ActionsObservable<ActionType>) => Observable<ActionType>;
|
|
14
16
|
/**
|
package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js
CHANGED
|
@@ -15,15 +15,16 @@ const FALLBACK_FIRST_DELAY_MS = 30000;
|
|
|
15
15
|
const RESTORE_FIRST_DELAY_MS = 5000;
|
|
16
16
|
const FALLBACK_POLL_INTERVAL_MS = 10000;
|
|
17
17
|
/**
|
|
18
|
-
* On Pusher batch completion: refresh batch list (then fetchMultipleBatchDetailsEpic runs)
|
|
19
|
-
*
|
|
18
|
+
* On Pusher batch completion: refresh batch list (then fetchMultipleBatchDetailsEpic runs).
|
|
19
|
+
* Debounced to reduce duplicate refreshes. The post-match tab decision
|
|
20
|
+
* (Unmatched vs Completed) is made client-side in `ExpenseAutomationPage` once fresh
|
|
21
|
+
* batch details land -- do not dispatch `requestMissingReceiptsTabNavigation` here.
|
|
20
22
|
*/
|
|
21
23
|
const pusherBatchStatusCompletionEpic = (actions$) => actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.pusherBatchStatusUpdate.match), (0, operators_1.filter)((action) => action.payload.status === 'completed'), (0, operators_1.debounceTime)(300), (0, operators_1.mergeMap)(() => (0, rxjs_1.from)([
|
|
22
24
|
(0, missingReceiptsViewReducer_1.fetchBulkUploadBatches)({
|
|
23
25
|
cacheOverride: true,
|
|
24
26
|
invalidateBatchDetailsCache: true,
|
|
25
27
|
}),
|
|
26
|
-
(0, missingReceiptsViewReducer_1.requestMissingReceiptsTabNavigation)({ tab: 'unmatched' }),
|
|
27
28
|
])));
|
|
28
29
|
exports.pusherBatchStatusCompletionEpic = pusherBatchStatusCompletionEpic;
|
|
29
30
|
/**
|
|
@@ -81,7 +82,6 @@ const pollBulkUploadBatchStatusEpic = (actions$, _state$, zeniAPI) => actions$.p
|
|
|
81
82
|
}
|
|
82
83
|
actions.push((0, missingReceiptsViewReducer_1.fetchBulkUploadBatchDetailsSuccess)((0, missingReceiptsPayload_1.toBatchDetails)(response.data, zeniAPI.apiEndPoints.fileMicroServiceBaseUrl)));
|
|
83
84
|
actions.push((0, missingReceiptsViewReducer_1.fetchBulkUploadBatches)({ cacheOverride: true }));
|
|
84
|
-
actions.push((0, missingReceiptsViewReducer_1.requestMissingReceiptsTabNavigation)({ tab: 'unmatched' }));
|
|
85
85
|
return (0, rxjs_1.from)(actions);
|
|
86
86
|
}
|
|
87
87
|
}
|
|
@@ -7,7 +7,7 @@ import { TransactionPayload } from '../../../entity/transaction/payloadTypes/tra
|
|
|
7
7
|
import { SupportedTransactionPayload } from '../../../entity/transaction/transactionState';
|
|
8
8
|
import { ZeniAPIStatus } from '../../../responsePayload';
|
|
9
9
|
import { type BatchDetails, type BatchListItem, type BatchStatus, type BulkUploadResultsTab, type BulkUploadSortKey, type BulkUploadState, type CompletedSubTab, type ManualSearchResult, type MissingReceiptsViewState, type MissingReceiptsViewUIState } from '../types/missingReceiptsViewState';
|
|
10
|
-
export declare const getCompletedTransactionsCacheKey: (periodId: MonthYearPeriodId, sortKey: BulkUploadSortKey, sortOrder: SortOrder, subTab: CompletedSubTab) => string;
|
|
10
|
+
export declare const getCompletedTransactionsCacheKey: (periodId: MonthYearPeriodId, sortKey: BulkUploadSortKey | undefined, sortOrder: SortOrder | undefined, subTab: CompletedSubTab) => string;
|
|
11
11
|
export declare const initialBulkUploadState: BulkUploadState;
|
|
12
12
|
export declare const initialState: MissingReceiptsViewState;
|
|
13
13
|
/** Epic trigger only; batch-details fetch is handled in epics. */
|
|
@@ -85,8 +85,8 @@ export declare const fetchMissingReceipts: import("@reduxjs/toolkit").ActionCrea
|
|
|
85
85
|
}, "expenseAutomationMissingReceiptsView/confirmBulkUploadMatchSuccess">, confirmBulkUploadMatchFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
86
86
|
error: ZeniAPIStatus;
|
|
87
87
|
}, "expenseAutomationMissingReceiptsView/confirmBulkUploadMatchFailure">, setBulkUploadResultsTab: import("@reduxjs/toolkit").ActionCreatorWithPayload<"completed" | "unmatched", "expenseAutomationMissingReceiptsView/setBulkUploadResultsTab">, setBulkUploadCompletedSubTab: import("@reduxjs/toolkit").ActionCreatorWithPayload<"all" | "manual" | "ai_accountant", "expenseAutomationMissingReceiptsView/setBulkUploadCompletedSubTab">, setBulkUploadSortConfig: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
88
|
-
sortKey: BulkUploadSortKey;
|
|
89
|
-
sortOrder: SortOrder;
|
|
88
|
+
sortKey: BulkUploadSortKey | undefined;
|
|
89
|
+
sortOrder: SortOrder | undefined;
|
|
90
90
|
}, "expenseAutomationMissingReceiptsView/setBulkUploadSortConfig">, clearBulkUpload: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationMissingReceiptsView/clearBulkUpload">, searchTransactionsForManualMatch: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[query: string, pageToken?: string | null | undefined], {
|
|
91
91
|
query: string;
|
|
92
92
|
pageToken: string | undefined;
|
|
@@ -105,16 +105,16 @@ export declare const fetchMissingReceipts: import("@reduxjs/toolkit").ActionCrea
|
|
|
105
105
|
isInitialLoad: boolean;
|
|
106
106
|
nextPageToken: string | null;
|
|
107
107
|
selectedPeriod: MonthYearPeriod;
|
|
108
|
-
sortKey: BulkUploadSortKey;
|
|
109
|
-
sortOrder: SortOrder;
|
|
108
|
+
sortKey: BulkUploadSortKey | undefined;
|
|
109
|
+
sortOrder: SortOrder | undefined;
|
|
110
110
|
totalCount: number;
|
|
111
111
|
transactionIds: ID[];
|
|
112
112
|
}, "expenseAutomationMissingReceiptsView/fetchCompletedTransactionsSuccess">, fetchCompletedTransactionsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
113
113
|
completedSubTab: CompletedSubTab;
|
|
114
114
|
error: ZeniAPIStatus;
|
|
115
115
|
selectedPeriod: MonthYearPeriod;
|
|
116
|
-
sortKey: BulkUploadSortKey;
|
|
117
|
-
sortOrder: SortOrder;
|
|
116
|
+
sortKey: BulkUploadSortKey | undefined;
|
|
117
|
+
sortOrder: SortOrder | undefined;
|
|
118
118
|
}, "expenseAutomationMissingReceiptsView/fetchCompletedTransactionsFailure">;
|
|
119
119
|
declare const _default: import("redux").Reducer<MissingReceiptsViewState>;
|
|
120
120
|
export default _default;
|
|
@@ -5,7 +5,11 @@ exports.fetchCompletedTransactionsFailure = exports.fetchCompletedTransactionsSu
|
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
|
|
7
7
|
const missingReceiptsViewState_1 = require("../types/missingReceiptsViewState");
|
|
8
|
-
const getCompletedTransactionsCacheKey = (periodId, sortKey, sortOrder, subTab) =>
|
|
8
|
+
const getCompletedTransactionsCacheKey = (periodId, sortKey, sortOrder, subTab) => {
|
|
9
|
+
const sortKeyPart = sortKey ?? 'none';
|
|
10
|
+
const sortOrderPart = sortOrder == null ? 'none' : sortOrder === 'ascending' ? 'asc' : 'desc';
|
|
11
|
+
return `completed-${subTab}-${sortKeyPart}-${sortOrderPart}-${periodId}`;
|
|
12
|
+
};
|
|
9
13
|
exports.getCompletedTransactionsCacheKey = getCompletedTransactionsCacheKey;
|
|
10
14
|
exports.initialBulkUploadState = {
|
|
11
15
|
batchDetailsById: {},
|
|
@@ -30,8 +34,8 @@ exports.initialBulkUploadState = {
|
|
|
30
34
|
totalCount: 0,
|
|
31
35
|
},
|
|
32
36
|
phase: 'idle',
|
|
33
|
-
sortKey:
|
|
34
|
-
sortOrder:
|
|
37
|
+
sortKey: undefined,
|
|
38
|
+
sortOrder: undefined,
|
|
35
39
|
uploadedFileCount: 0,
|
|
36
40
|
uploadProgress: 0,
|
|
37
41
|
uploadStatus: { fetchState: 'Not-Started', error: undefined },
|
|
@@ -48,12 +48,14 @@ export interface BulkUploadSelectorData {
|
|
|
48
48
|
processed: number;
|
|
49
49
|
total: number;
|
|
50
50
|
};
|
|
51
|
-
sortKey: BulkUploadSortKey;
|
|
52
|
-
sortOrder: SortOrder;
|
|
51
|
+
sortKey: BulkUploadSortKey | undefined;
|
|
52
|
+
sortOrder: SortOrder | undefined;
|
|
53
53
|
unmatchedFiles: ResolvedBatchFile[];
|
|
54
54
|
uploadedFileCount: number;
|
|
55
55
|
uploadProgress: number;
|
|
56
56
|
uploadStatus: FetchStateAndError;
|
|
57
|
+
/** True iff `batchDetailsById[currentBatchId]` is populated -- signals post-match data is fresh. */
|
|
58
|
+
currentBatchDetailsFetched?: boolean;
|
|
57
59
|
currentBatchId?: ID;
|
|
58
60
|
}
|
|
59
61
|
export interface ResolvedBatchDetails {
|
|
@@ -205,6 +205,8 @@ function getExpenseAutomationMissingReceiptsView(state) {
|
|
|
205
205
|
batchDetails: resolvedBatchDetails,
|
|
206
206
|
completedSubTab: bulkUpload.completedSubTab,
|
|
207
207
|
currentBatchId: bulkUpload.currentBatchId,
|
|
208
|
+
currentBatchDetailsFetched: bulkUpload.currentBatchId != null &&
|
|
209
|
+
bulkUpload.batchDetailsById[bulkUpload.currentBatchId] != null,
|
|
208
210
|
completedTransactions: {
|
|
209
211
|
fetchState: completedTransactionsForPeriod?.fetchState ?? {
|
|
210
212
|
fetchState: 'Not-Started',
|
|
@@ -145,8 +145,8 @@ export interface BulkUploadState {
|
|
|
145
145
|
manualSearch: ManualSearchState;
|
|
146
146
|
manualSearchUiResetKey: number;
|
|
147
147
|
phase: BulkUploadPhase;
|
|
148
|
-
sortKey: BulkUploadSortKey;
|
|
149
|
-
sortOrder: SortOrder;
|
|
148
|
+
sortKey: BulkUploadSortKey | undefined;
|
|
149
|
+
sortOrder: SortOrder | undefined;
|
|
150
150
|
uploadedFileCount: number;
|
|
151
151
|
uploadProgress: number;
|
|
152
152
|
uploadStatus: FetchStateAndError;
|
|
@@ -7,7 +7,7 @@ exports.initialState = {
|
|
|
7
7
|
timeframe: 'month',
|
|
8
8
|
thisPeriod: undefined,
|
|
9
9
|
balancesOrder: 'ascending_date',
|
|
10
|
-
isCompareModeOn:
|
|
10
|
+
isCompareModeOn: false,
|
|
11
11
|
maxNumOfPeriodsToHighlight: 0,
|
|
12
12
|
compareMode: 'compare_mode_percent',
|
|
13
13
|
selectedForecast: undefined,
|
|
@@ -14,7 +14,9 @@ const getZeniAccountList = (state) => {
|
|
|
14
14
|
...baseDepositAccountsSelectorView,
|
|
15
15
|
depositAccounts: baseDepositAccountsSelectorView.depositAccounts.map((depositAccount) => ({
|
|
16
16
|
...depositAccount,
|
|
17
|
-
autoTransferRules: autotransferRulesState.rules.filter((rule) => !rule.isDeleted &&
|
|
17
|
+
autoTransferRules: autotransferRulesState.rules.filter((rule) => !rule.isDeleted &&
|
|
18
|
+
rule.isActive &&
|
|
19
|
+
rule.sourceBankAccountId === depositAccount.id),
|
|
18
20
|
})),
|
|
19
21
|
};
|
|
20
22
|
const zeniAccountsConfig = (0, zeniAccountsConfigSelector_1.getZeniAccountsConfigDetail)(state);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.25-betaRD1",
|
|
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",
|