@zeniai/client-epic-state 5.0.10 → 5.0.11-betaAD01
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/common/aiCfo/aiCfoSuggestedQuestionsPageContext.d.ts +1 -1
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +20 -5
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +9 -1
- package/lib/esm/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +3 -3
- package/lib/esm/view/spendManagement/billPay/billDetailView/epics/fetchBillDetailEpic.js +5 -5
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +20 -5
- package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.d.ts +2 -2
- package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +8 -0
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +6 -0
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +3 -3
- package/lib/view/spendManagement/billPay/billDetailView/epics/fetchBillDetailEpic.js +5 -5
- package/package.json +1 -1
|
@@ -16,4 +16,4 @@
|
|
|
16
16
|
*
|
|
17
17
|
* @see README.md in this directory for maintenance expectations.
|
|
18
18
|
*/
|
|
19
|
-
export type AiCfoSuggestedQuestionsPageContext = 'balance_sheet' | 'profit_loss' | 'vendors' | 'transactions' | 'cash_flow' | 'accounts_receivable' | 'accounts_payable' | 'transaction_details' | 'dashboard' | 'cash_balance' | 'card_balance' | 'command_centre' | 'je_schedules' | 'reconciliation' | 'flux_analysis' | 'receipts' | 'mei' | 'task_checklist' | 'performance' | 'bills_list' | 'bills_details' | 'reimbursement_list' | 'reimbursement_details' | 'vendors_summary' | 'opex_by_vendor' | 'prepaid_expenses' | 'fixed_assets' | 'form_1099' | 'accrued_expenses' | 'forecast' | 'checking' | 'checking_details' | 'treasury' | 'cards' | 'cards_detail' | 'people' | 'rewards' | 'notifications';
|
|
19
|
+
export type AiCfoSuggestedQuestionsPageContext = 'balance_sheet' | 'profit_loss' | 'vendors' | 'transactions' | 'cash_flow' | 'accounts_receivable' | 'accounts_payable' | 'transaction_details' | 'dashboard' | 'cash_balance' | 'card_balance' | 'cash_in_cash_out' | 'net_burn_or_income' | 'cash_position' | 'top_expenses' | 'revenue' | 'operating_expenses' | 'command_centre' | 'je_schedules' | 'reconciliation' | 'flux_analysis' | 'receipts' | 'mei' | 'task_checklist' | 'performance' | 'bills_list' | 'bills_details' | 'reimbursement_list' | 'reimbursement_details' | 'vendors_summary' | 'opex_by_vendor' | 'prepaid_expenses' | 'fixed_assets' | 'form_1099' | 'accrued_expenses' | 'forecast' | 'checking' | 'checking_details' | 'treasury' | 'cards' | 'cards_detail' | 'people' | 'rewards' | 'notifications';
|
package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js
CHANGED
|
@@ -12,7 +12,13 @@ export const fetchCompletedTransactionsEpic = (actions$, state$, zeniAPI) => act
|
|
|
12
12
|
const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
|
|
13
13
|
const periodId = toMonthYearPeriodId(selectedPeriod);
|
|
14
14
|
const isInitialLoad = action.payload.pageToken == null;
|
|
15
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Snapshot sort config + subTab at request time so success/failure write
|
|
17
|
+
* into the same cache key the request was made under, even if the user
|
|
18
|
+
* toggles sort while the request is in flight.
|
|
19
|
+
*/
|
|
20
|
+
const { sortKey, sortOrder, completedSubTab } = bulkUpload;
|
|
21
|
+
const cacheKey = getCompletedTransactionsCacheKey(periodId, sortKey, sortOrder, completedSubTab);
|
|
16
22
|
const existingData = bulkUpload.completedTransactionsByPeriod[cacheKey];
|
|
17
23
|
if (isInitialLoad &&
|
|
18
24
|
action.payload.cacheOverride !== true &&
|
|
@@ -24,13 +30,13 @@ export const fetchCompletedTransactionsEpic = (actions$, state$, zeniAPI) => act
|
|
|
24
30
|
const queryPayload = {
|
|
25
31
|
start_date: period.start,
|
|
26
32
|
end_date: period.end,
|
|
27
|
-
sort_by:
|
|
28
|
-
sort_order:
|
|
33
|
+
sort_by: sortKey,
|
|
34
|
+
sort_order: sortOrder === 'ascending' ? 'asc' : 'desc',
|
|
29
35
|
page_token: action.payload.pageToken ?? null,
|
|
30
36
|
page_size: 25,
|
|
31
37
|
};
|
|
32
|
-
if (
|
|
33
|
-
queryPayload.match_type =
|
|
38
|
+
if (completedSubTab !== 'all') {
|
|
39
|
+
queryPayload.match_type = completedSubTab;
|
|
34
40
|
}
|
|
35
41
|
const encodedQuery = encodeURIComponent(JSON.stringify(queryPayload));
|
|
36
42
|
return zeniAPI
|
|
@@ -46,16 +52,25 @@ export const fetchCompletedTransactionsEpic = (actions$, state$, zeniAPI) => act
|
|
|
46
52
|
nextPageToken: response.data.next_page_token,
|
|
47
53
|
totalCount: response.data.total_count,
|
|
48
54
|
selectedPeriod,
|
|
55
|
+
sortKey,
|
|
56
|
+
sortOrder,
|
|
57
|
+
completedSubTab,
|
|
49
58
|
}));
|
|
50
59
|
return from(updateActions);
|
|
51
60
|
}
|
|
52
61
|
return of(fetchCompletedTransactionsFailure({
|
|
53
62
|
error: response.status,
|
|
54
63
|
selectedPeriod,
|
|
64
|
+
sortKey,
|
|
65
|
+
sortOrder,
|
|
66
|
+
completedSubTab,
|
|
55
67
|
}));
|
|
56
68
|
}), catchError((error) => of(fetchCompletedTransactionsFailure({
|
|
57
69
|
error: createZeniAPIStatus('Unexpected Error', 'Fetch completed transactions errored: ' +
|
|
58
70
|
JSON.stringify(error)),
|
|
59
71
|
selectedPeriod,
|
|
72
|
+
sortKey,
|
|
73
|
+
sortOrder,
|
|
74
|
+
completedSubTab,
|
|
60
75
|
}))));
|
|
61
76
|
}));
|
package/lib/esm/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js
CHANGED
|
@@ -5,7 +5,7 @@ import { updateTransactions } from '../../../../entity/transaction/transactionRe
|
|
|
5
5
|
import { isSuccessResponse } from '../../../../responsePayload';
|
|
6
6
|
import { BULK_UPLOAD_AUTOMATCHING_TIMEOUT_MS } from '../../helpers/bulkUploadTiming';
|
|
7
7
|
import { extractTransactionPayloadsFromBatchFiles, isBatchDetailsApiStatusCompleted, toBatchDetails, } from '../../payload/missingReceiptsPayload';
|
|
8
|
-
import { bulkUploadAutomatchingTimedOut, bulkUploadReceiptsSuccess, clearBulkUpload, fetchBulkUploadBatchDetailsSuccess, fetchBulkUploadBatches, pusherBatchStatusUpdate, requestMissingReceiptsTabNavigation, restoreBulkUploadMatchingState, } from '../../reducers/missingReceiptsViewReducer';
|
|
8
|
+
import { bulkUploadAutomatchingTimedOut, bulkUploadReceiptsSuccess, clearBulkUpload, fetchBulkUploadBatchDetails, fetchBulkUploadBatchDetailsSuccess, fetchBulkUploadBatches, pusherBatchStatusUpdate, requestMissingReceiptsTabNavigation, restoreBulkUploadMatchingState, } from '../../reducers/missingReceiptsViewReducer';
|
|
9
9
|
/** First poll after upload; then interval while batch not resolved via Pusher or API. */
|
|
10
10
|
const FALLBACK_FIRST_DELAY_MS = 30000;
|
|
11
11
|
/** Shorter first poll for restored sessions — batch may already be near completion. */
|
|
@@ -35,9 +35,17 @@ export const bulkUploadAutomatchingTimeoutEpic = (actions$, state$) => actions$.
|
|
|
35
35
|
if (bulk.phase !== 'matching' || bulk.currentBatchId !== batchId) {
|
|
36
36
|
return EMPTY;
|
|
37
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Also request the single-batch details directly so the "X out of Y Receipts Matched"
|
|
40
|
+
* toast still fires when the backend actually completed between the last Pusher ping
|
|
41
|
+
* and this timeout. If Pusher already tagged the batch as still `processing`,
|
|
42
|
+
* `fetchBulkUploadBatchDetailsEpic`'s guard will skip the call and we simply rely on
|
|
43
|
+
* the list refresh to eventually populate details via `fetchMultipleBatchDetailsEpic`.
|
|
44
|
+
*/
|
|
38
45
|
return from([
|
|
39
46
|
bulkUploadAutomatchingTimedOut(batchId),
|
|
40
47
|
fetchBulkUploadBatches({ cacheOverride: true }),
|
|
48
|
+
fetchBulkUploadBatchDetails(),
|
|
41
49
|
]);
|
|
42
50
|
}), takeUntil(merge(actions$.pipe(filter(clearBulkUpload.match)), actions$.pipe(filter(pusherBatchStatusUpdate.match), filter((a) => a.payload.batchId === batchId &&
|
|
43
51
|
a.payload.status === 'completed')), actions$.pipe(filter(fetchBulkUploadBatchDetailsSuccess.match), filter((a) => a.payload.batchId === batchId)))));
|
|
@@ -522,9 +522,9 @@ const expenseAutomationMissingReceiptsView = createSlice({
|
|
|
522
522
|
},
|
|
523
523
|
},
|
|
524
524
|
fetchCompletedTransactionsSuccess(draft, action) {
|
|
525
|
-
const { transactionIds, nextPageToken, totalCount, selectedPeriod, isInitialLoad, } = action.payload;
|
|
525
|
+
const { transactionIds, nextPageToken, totalCount, selectedPeriod, isInitialLoad, sortKey, sortOrder, completedSubTab, } = action.payload;
|
|
526
526
|
const periodId = toMonthYearPeriodId(selectedPeriod);
|
|
527
|
-
const cacheKey = getCompletedTransactionsCacheKey(periodId,
|
|
527
|
+
const cacheKey = getCompletedTransactionsCacheKey(periodId, sortKey, sortOrder, completedSubTab);
|
|
528
528
|
if (isInitialLoad) {
|
|
529
529
|
draft.bulkUpload.completedTransactionsByPeriod[cacheKey] = {
|
|
530
530
|
transactionIds,
|
|
@@ -553,7 +553,7 @@ const expenseAutomationMissingReceiptsView = createSlice({
|
|
|
553
553
|
},
|
|
554
554
|
fetchCompletedTransactionsFailure(draft, action) {
|
|
555
555
|
const periodId = toMonthYearPeriodId(action.payload.selectedPeriod);
|
|
556
|
-
const cacheKey = getCompletedTransactionsCacheKey(periodId,
|
|
556
|
+
const cacheKey = getCompletedTransactionsCacheKey(periodId, action.payload.sortKey, action.payload.sortOrder, action.payload.completedSubTab);
|
|
557
557
|
const existing = draft.bulkUpload.completedTransactionsByPeriod[cacheKey];
|
|
558
558
|
if (existing != null) {
|
|
559
559
|
existing.fetchState = {
|
|
@@ -53,7 +53,7 @@ export const fetchBillDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe(
|
|
|
53
53
|
response.data?.transaction?.transaction_id != null) {
|
|
54
54
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
55
55
|
const transcationId = response.data.transaction.transaction_id;
|
|
56
|
-
const vendorInResponse = response.data?.vendors[0];
|
|
56
|
+
const vendorInResponse = response.data?.vendors?.[0];
|
|
57
57
|
const flattenedContacts = vendorInResponse?.contacts ?? [];
|
|
58
58
|
const flattenedAddresses = getFlattenedAddress(response.data?.vendors ?? []);
|
|
59
59
|
const flattenedBankAccounts = vendorInResponse?.bank_accounts ?? [];
|
|
@@ -85,7 +85,7 @@ export const fetchBillDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe(
|
|
|
85
85
|
...response.data.bank_accounts,
|
|
86
86
|
]),
|
|
87
87
|
updatePaymentInstruments(flattenedPaymentInstruments),
|
|
88
|
-
updateVendors(response.data.vendors),
|
|
88
|
+
updateVendors(response.data.vendors ?? []),
|
|
89
89
|
// end: save all vendor related entities
|
|
90
90
|
];
|
|
91
91
|
if (vendorInResponse == null &&
|
|
@@ -94,15 +94,15 @@ export const fetchBillDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe(
|
|
|
94
94
|
fetchActions.push(fetchVendorsList({
|
|
95
95
|
searchString: response.data?.transaction.candidate_vendor_name,
|
|
96
96
|
}));
|
|
97
|
-
fetchActions.push(waitForVendorByNameThenUpdateBillDetail(billId, response.data,
|
|
97
|
+
fetchActions.push(waitForVendorByNameThenUpdateBillDetail(billId, response.data, undefined));
|
|
98
98
|
}
|
|
99
99
|
else {
|
|
100
100
|
fetchActions.push(updateBillDetail({ billId, billDetail: response.data }));
|
|
101
|
-
fetchActions.push(updateBillDetailFetchState(transcationId, 'Completed', undefined,
|
|
101
|
+
fetchActions.push(updateBillDetailFetchState(transcationId, 'Completed', undefined, vendorInResponse?.vendor_id));
|
|
102
102
|
const transactionInResponse = response.data?.transaction;
|
|
103
103
|
if (transactionInResponse != null &&
|
|
104
104
|
transactionInResponse.total_amount != null &&
|
|
105
|
-
|
|
105
|
+
vendorInResponse != null) {
|
|
106
106
|
fetchActions.push(fetchDuplicateBill(vendorInResponse.vendor_name, vendorInResponse.vendor_id, transactionInResponse.total_amount, transactionInResponse.recipient_total_amount, transactionInResponse.document_id, billId));
|
|
107
107
|
}
|
|
108
108
|
const billHasPaymentError = [
|