@zeniai/client-epic-state 4.19.37-betaVR1 → 4.19.37-betaVR11
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.
Potentially problematic release.
This version of @zeniai/client-epic-state might be problematic. Click here for more details.
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +1 -0
- package/lib/epic.d.ts +3 -1
- package/lib/epic.js +3 -1
- package/lib/esm/entity/snackbar/snackbarTypes.js +1 -0
- package/lib/esm/epic.js +3 -1
- package/lib/esm/index.js +2 -2
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +4 -8
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/confirmBulkUploadMatchEpic.js +37 -13
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchDetailsEpic.js +3 -3
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +41 -11
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +23 -14
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchMoreBatchDetailsEpic.js +31 -0
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.js +39 -0
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +35 -27
- package/lib/esm/view/expenseAutomationView/payload/missingReceiptsPayload.js +12 -80
- package/lib/esm/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +79 -44
- package/lib/esm/view/expenseAutomationView/selectors/missingReceiptsSelector.js +25 -5
- package/lib/index.d.ts +3 -3
- package/lib/index.js +35 -32
- package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.d.ts +2 -5
- package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +3 -7
- package/lib/view/expenseAutomationView/epics/missingReceipts/confirmBulkUploadMatchEpic.d.ts +2 -1
- package/lib/view/expenseAutomationView/epics/missingReceipts/confirmBulkUploadMatchEpic.js +36 -12
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchDetailsEpic.js +3 -3
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.d.ts +3 -2
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +40 -10
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +22 -13
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMoreBatchDetailsEpic.d.ts +8 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMoreBatchDetailsEpic.js +35 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.d.ts +9 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.js +44 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.d.ts +3 -10
- package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +33 -25
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/payload/missingReceiptsPayload.d.ts +19 -84
- package/lib/view/expenseAutomationView/payload/missingReceiptsPayload.js +12 -82
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +15 -5
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +80 -45
- package/lib/view/expenseAutomationView/selectorTypes/missingReceiptsSelectorTypes.d.ts +5 -1
- package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.js +25 -5
- package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +7 -3
- package/package.json +2 -2
- package/lib/tsconfig.typecheck.tsbuildinfo +0 -1
|
@@ -3,22 +3,25 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.toBatchFile = toBatchFile;
|
|
4
4
|
exports.extractTransactionPayloadsFromBatchFiles = extractTransactionPayloadsFromBatchFiles;
|
|
5
5
|
exports.toBatchSummary = toBatchSummary;
|
|
6
|
-
exports.toBatchStatus = toBatchStatus;
|
|
7
6
|
exports.toBatchDetails = toBatchDetails;
|
|
8
7
|
exports.toBatchListItem = toBatchListItem;
|
|
9
8
|
exports.toManualSearchResult = toManualSearchResult;
|
|
10
|
-
|
|
9
|
+
const urlPayload_1 = require("../../../commonPayloadTypes/urlPayload");
|
|
11
10
|
// -- Converter functions --
|
|
12
|
-
function toBatchFile(payload) {
|
|
11
|
+
function toBatchFile(payload, filesEndPoint) {
|
|
13
12
|
return {
|
|
14
13
|
attachmentId: payload.attachment_id,
|
|
15
14
|
candidates: payload.candidates?.map((c) => ({
|
|
16
15
|
transactionId: c.transaction_id,
|
|
17
16
|
matchScore: c.match_score,
|
|
18
17
|
})),
|
|
18
|
+
fileDownloadUrl: payload.file_id != null && filesEndPoint != null
|
|
19
|
+
? `${filesEndPoint}/1.0/files/${payload.file_id}?query=${encodeURIComponent(JSON.stringify({ download_file: true }))}`
|
|
20
|
+
: null,
|
|
19
21
|
fileId: payload.file_id,
|
|
20
22
|
filePreviewUrl: payload.file_preview_url,
|
|
21
23
|
filename: payload.filename,
|
|
24
|
+
matchSource: payload.match_source,
|
|
22
25
|
matchedTransactionId: payload.matched_transaction?.transaction_id,
|
|
23
26
|
status: payload.status,
|
|
24
27
|
};
|
|
@@ -49,10 +52,12 @@ function extractTransactionPayloadsFromBatchFiles(files) {
|
|
|
49
52
|
function matchedTransactionPayloadToSupportedTransactionPayload(payload) {
|
|
50
53
|
return {
|
|
51
54
|
transaction_id: payload.transaction_id,
|
|
52
|
-
|
|
55
|
+
transaction_type: payload.transaction_type ?? 'expense',
|
|
56
|
+
transaction_date: payload.transaction_date ?? '',
|
|
53
57
|
currency_code: payload.currency_code,
|
|
54
58
|
total_amount: payload.amount,
|
|
55
59
|
vendor_name: payload.vendor_name,
|
|
60
|
+
logo: payload.vendor_logo == null ? undefined : (0, urlPayload_1.toURL)(payload.vendor_logo),
|
|
56
61
|
};
|
|
57
62
|
}
|
|
58
63
|
function toBatchSummary(payload) {
|
|
@@ -64,18 +69,11 @@ function toBatchSummary(payload) {
|
|
|
64
69
|
total: payload.total,
|
|
65
70
|
};
|
|
66
71
|
}
|
|
67
|
-
function
|
|
68
|
-
return {
|
|
69
|
-
batchId: payload.batch_id,
|
|
70
|
-
progress: payload.progress,
|
|
71
|
-
status: payload.status,
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
function toBatchDetails(payload) {
|
|
72
|
+
function toBatchDetails(payload, filesEndPoint) {
|
|
75
73
|
return {
|
|
76
74
|
batchId: payload.batch_id,
|
|
77
75
|
createdAt: payload.created_at,
|
|
78
|
-
files: payload.files.map(toBatchFile),
|
|
76
|
+
files: payload.files.map((f) => toBatchFile(f, filesEndPoint)),
|
|
79
77
|
status: payload.status,
|
|
80
78
|
summary: toBatchSummary(payload.summary),
|
|
81
79
|
};
|
|
@@ -95,7 +93,7 @@ function toBatchListItem(payload) {
|
|
|
95
93
|
function toManualSearchResult(payload) {
|
|
96
94
|
return {
|
|
97
95
|
amount: payload.amount,
|
|
98
|
-
|
|
96
|
+
currencyCode: payload.currency,
|
|
99
97
|
entityId: payload.entity_id,
|
|
100
98
|
memo: payload.memo,
|
|
101
99
|
transactionDate: payload.transaction_date,
|
|
@@ -104,71 +102,3 @@ function toManualSearchResult(payload) {
|
|
|
104
102
|
vendorName: payload.vendor_name,
|
|
105
103
|
};
|
|
106
104
|
}
|
|
107
|
-
function completedTransactionAttachmentToAttachmentPayload(payload) {
|
|
108
|
-
return {
|
|
109
|
-
attachment_create_time: payload.attachment_create_time ?? '',
|
|
110
|
-
attachment_id: payload.attachment_id,
|
|
111
|
-
attachment_update_time: payload.attachment_update_time ?? '',
|
|
112
|
-
content_type: payload.content_type,
|
|
113
|
-
file_checksum: null,
|
|
114
|
-
file_download_url: payload.file_download_url,
|
|
115
|
-
file_name: payload.file_name,
|
|
116
|
-
file_size: payload.file_size,
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
function completedTransactionLineToLinePayload(payload) {
|
|
120
|
-
return {
|
|
121
|
-
amount: payload.amount,
|
|
122
|
-
line_description: payload.line_description,
|
|
123
|
-
line_detail_type: payload.line_detail_type,
|
|
124
|
-
line_id: payload.line_id,
|
|
125
|
-
categorization_status: payload.categorization_status,
|
|
126
|
-
line_detail: {
|
|
127
|
-
account: {
|
|
128
|
-
account_id: payload.line_detail.account?.account_id ?? '',
|
|
129
|
-
account_name: payload.line_detail.account?.account_name ?? '',
|
|
130
|
-
labels: [],
|
|
131
|
-
coa_id: payload.line_detail.account?.coa_id,
|
|
132
|
-
qbo_id: payload.line_detail.account?.qbo_id,
|
|
133
|
-
},
|
|
134
|
-
class: {
|
|
135
|
-
accounting_class_id: payload.line_detail.class?.accounting_class_id ?? '',
|
|
136
|
-
accounting_class_name: payload.line_detail.class?.accounting_class_name ?? '',
|
|
137
|
-
accounting_class_number: payload.line_detail.class?.accounting_class_number,
|
|
138
|
-
fully_qualified_accounting_class_name: payload.line_detail.class?.fully_qualified_accounting_class_name,
|
|
139
|
-
qbo_id: payload.line_detail.class?.qbo_id,
|
|
140
|
-
},
|
|
141
|
-
line_detail_type: payload.line_detail_type,
|
|
142
|
-
customer: payload.line_detail.customer != null
|
|
143
|
-
? {
|
|
144
|
-
customer_id: payload.line_detail.customer.customer_id,
|
|
145
|
-
customer_name: payload.line_detail.customer.customer_name,
|
|
146
|
-
qbo_id: payload.line_detail.customer.qbo_id,
|
|
147
|
-
}
|
|
148
|
-
: undefined,
|
|
149
|
-
vendor: payload.line_detail.vendor != null
|
|
150
|
-
? {
|
|
151
|
-
vendor_id: payload.line_detail.vendor.vendor_id,
|
|
152
|
-
vendor_name: payload.line_detail.vendor.vendor_name,
|
|
153
|
-
}
|
|
154
|
-
: undefined,
|
|
155
|
-
},
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
function completedTransactionPayloadToSupportedTransactionPayload(payload) {
|
|
159
|
-
return {
|
|
160
|
-
transaction_id: payload.transaction_id,
|
|
161
|
-
transaction_type: payload.transaction_type,
|
|
162
|
-
transaction_date: payload.transaction_date,
|
|
163
|
-
transaction_type_name: payload.transaction_type_name,
|
|
164
|
-
currency_code: payload.currency_code,
|
|
165
|
-
currency_symbol: payload.currency_symbol,
|
|
166
|
-
total_amount: payload.total_amount,
|
|
167
|
-
vendor_id: payload.vendor_id,
|
|
168
|
-
vendor_name: payload.vendor_name,
|
|
169
|
-
account_id: payload.account_id,
|
|
170
|
-
account_name: payload.account_name,
|
|
171
|
-
attachments: payload.attachments.map(completedTransactionAttachmentToAttachmentPayload),
|
|
172
|
-
lines: payload.lines.map(completedTransactionLineToLinePayload),
|
|
173
|
-
};
|
|
174
|
-
}
|
|
@@ -34,14 +34,24 @@ export declare const fetchMissingReceipts: import("@reduxjs/toolkit").ActionCrea
|
|
|
34
34
|
batchId: ID;
|
|
35
35
|
}, "expenseAutomationMissingReceiptsView/bulkUploadReceiptsSuccess">, bulkUploadReceiptsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
36
36
|
error: ZeniAPIStatus;
|
|
37
|
-
}, "expenseAutomationMissingReceiptsView/bulkUploadReceiptsFailure">,
|
|
37
|
+
}, "expenseAutomationMissingReceiptsView/bulkUploadReceiptsFailure">, pusherBatchStatusUpdate: import("@reduxjs/toolkit").ActionCreatorWithPayload<BatchStatus, "expenseAutomationMissingReceiptsView/pusherBatchStatusUpdate">, fetchBulkUploadBatchDetails: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationMissingReceiptsView/fetchBulkUploadBatchDetails">, fetchBulkUploadBatchDetailsSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<BatchDetails, "expenseAutomationMissingReceiptsView/fetchBulkUploadBatchDetailsSuccess">, fetchBulkUploadBatchDetailsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
38
38
|
error: ZeniAPIStatus;
|
|
39
|
-
}, "expenseAutomationMissingReceiptsView/fetchBulkUploadBatchDetailsFailure">,
|
|
39
|
+
}, "expenseAutomationMissingReceiptsView/fetchBulkUploadBatchDetailsFailure">, storeBatchDetails: import("@reduxjs/toolkit").ActionCreatorWithPayload<BatchDetails, "expenseAutomationMissingReceiptsView/storeBatchDetails">, fetchMoreBatchDetails: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationMissingReceiptsView/fetchMoreBatchDetails">, fetchMoreBatchDetailsComplete: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationMissingReceiptsView/fetchMoreBatchDetailsComplete">, fetchMoreBatchDetailsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
40
40
|
error: ZeniAPIStatus;
|
|
41
|
-
}, "expenseAutomationMissingReceiptsView/
|
|
41
|
+
}, "expenseAutomationMissingReceiptsView/fetchMoreBatchDetailsFailure">, fetchBulkUploadBatches: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[cacheOverride?: any], {
|
|
42
|
+
cacheOverride: any;
|
|
43
|
+
}, "expenseAutomationMissingReceiptsView/fetchBulkUploadBatches", never, never>, fetchBulkUploadBatchesSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
44
|
+
batchList: BatchListItem[];
|
|
45
|
+
selectedPeriod: MonthYearPeriod;
|
|
46
|
+
}, "expenseAutomationMissingReceiptsView/fetchBulkUploadBatchesSuccess">, fetchBulkUploadBatchesFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
47
|
+
error: ZeniAPIStatus;
|
|
48
|
+
selectedPeriod: MonthYearPeriod;
|
|
49
|
+
}, "expenseAutomationMissingReceiptsView/fetchBulkUploadBatchesFailure">, confirmBulkUploadMatch: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[batchId: string, attachmentId: string, transactionId: string, transactionType: string, fileName: string], {
|
|
42
50
|
batchId: string;
|
|
43
51
|
attachmentId: string;
|
|
44
52
|
transactionId: string;
|
|
53
|
+
transactionType: string;
|
|
54
|
+
fileName: string;
|
|
45
55
|
}, "expenseAutomationMissingReceiptsView/confirmBulkUploadMatch", never, never>, confirmBulkUploadMatchSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
46
56
|
attachmentId: ID;
|
|
47
57
|
batchId: ID;
|
|
@@ -55,10 +65,10 @@ export declare const fetchMissingReceipts: import("@reduxjs/toolkit").ActionCrea
|
|
|
55
65
|
query: string;
|
|
56
66
|
}, "expenseAutomationMissingReceiptsView/searchTransactionsForManualMatch", never, never>, searchTransactionsForManualMatchSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<ManualSearchResult[], "expenseAutomationMissingReceiptsView/searchTransactionsForManualMatchSuccess">, searchTransactionsForManualMatchFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
57
67
|
error: ZeniAPIStatus;
|
|
58
|
-
}, "expenseAutomationMissingReceiptsView/searchTransactionsForManualMatchFailure">, clearManualSearchResults: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationMissingReceiptsView/clearManualSearchResults">, fetchCompletedTransactions: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[
|
|
59
|
-
selectedPeriod: MonthYearPeriod;
|
|
68
|
+
}, "expenseAutomationMissingReceiptsView/searchTransactionsForManualMatchFailure">, clearManualSearchResults: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationMissingReceiptsView/clearManualSearchResults">, fetchCompletedTransactions: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[pageToken?: string | undefined], {
|
|
60
69
|
pageToken: string | undefined;
|
|
61
70
|
}, "expenseAutomationMissingReceiptsView/fetchCompletedTransactions", never, never>, fetchCompletedTransactionsSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
71
|
+
isInitialLoad: boolean;
|
|
62
72
|
nextPageToken: string | null;
|
|
63
73
|
selectedPeriod: MonthYearPeriod;
|
|
64
74
|
totalCount: number;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.fetchCompletedTransactionsFailure = exports.fetchCompletedTransactionsSuccess = exports.fetchCompletedTransactions = exports.clearManualSearchResults = exports.searchTransactionsForManualMatchFailure = exports.searchTransactionsForManualMatchSuccess = exports.searchTransactionsForManualMatch = exports.clearBulkUpload = exports.setBulkUploadSortConfig = exports.setBulkUploadCompletedSubTab = exports.setBulkUploadResultsTab = exports.confirmBulkUploadMatchFailure = exports.confirmBulkUploadMatchSuccess = exports.confirmBulkUploadMatch = exports.fetchBulkUploadBatchesFailure = exports.fetchBulkUploadBatchesSuccess = exports.fetchBulkUploadBatches = exports.
|
|
4
|
+
exports.fetchCompletedTransactionsFailure = exports.fetchCompletedTransactionsSuccess = exports.fetchCompletedTransactions = exports.clearManualSearchResults = exports.searchTransactionsForManualMatchFailure = exports.searchTransactionsForManualMatchSuccess = exports.searchTransactionsForManualMatch = exports.clearBulkUpload = exports.setBulkUploadSortConfig = exports.setBulkUploadCompletedSubTab = exports.setBulkUploadResultsTab = exports.confirmBulkUploadMatchFailure = exports.confirmBulkUploadMatchSuccess = exports.confirmBulkUploadMatch = exports.fetchBulkUploadBatchesFailure = exports.fetchBulkUploadBatchesSuccess = exports.fetchBulkUploadBatches = exports.fetchMoreBatchDetailsFailure = exports.fetchMoreBatchDetailsComplete = exports.fetchMoreBatchDetails = exports.storeBatchDetails = exports.fetchBulkUploadBatchDetailsFailure = exports.fetchBulkUploadBatchDetailsSuccess = exports.fetchBulkUploadBatchDetails = exports.pusherBatchStatusUpdate = exports.bulkUploadReceiptsFailure = exports.bulkUploadReceiptsSuccess = exports.updateBulkUploadProgress = exports.bulkUploadReceipts = exports.clearExpenseAutomationMissingReceiptsView = exports.markMissingReceiptAsDone = exports.updateMissingReceiptsUIState = exports.updateMissingReceiptUploadState = exports.uploadMissingReceiptSuccess = exports.fetchMissingReceiptsFailure = exports.fetchMissingReceiptsSuccess = exports.fetchMissingReceipts = exports.initialState = exports.initialBulkUploadState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
|
|
7
7
|
exports.initialBulkUploadState = {
|
|
8
8
|
batchDetailsById: {},
|
|
9
|
-
|
|
9
|
+
batchDetailsPaginationState: { fetchState: 'Not-Started', error: undefined },
|
|
10
|
+
batchListByPeriod: {},
|
|
10
11
|
batchListFetchState: { fetchState: 'Not-Started', error: undefined },
|
|
11
12
|
batchStatusById: {},
|
|
12
13
|
completedSubTab: 'all',
|
|
@@ -179,10 +180,6 @@ const expenseAutomationMissingReceiptsView = (0, toolkit_1.createSlice)({
|
|
|
179
180
|
};
|
|
180
181
|
draft.bulkUpload.phase = 'idle';
|
|
181
182
|
},
|
|
182
|
-
updateBulkUploadBatchStatus(draft, action) {
|
|
183
|
-
const batchStatus = action.payload;
|
|
184
|
-
draft.bulkUpload.batchStatusById[batchStatus.batchId] = batchStatus;
|
|
185
|
-
},
|
|
186
183
|
pusherBatchStatusUpdate(draft, action) {
|
|
187
184
|
const batchStatus = action.payload;
|
|
188
185
|
draft.bulkUpload.batchStatusById[batchStatus.batchId] = batchStatus;
|
|
@@ -200,14 +197,44 @@ const expenseAutomationMissingReceiptsView = (0, toolkit_1.createSlice)({
|
|
|
200
197
|
fetchBulkUploadBatchDetailsFailure(draft, _action) {
|
|
201
198
|
draft.bulkUpload.phase = 'completed';
|
|
202
199
|
},
|
|
203
|
-
|
|
204
|
-
|
|
200
|
+
storeBatchDetails(draft, action) {
|
|
201
|
+
const details = action.payload;
|
|
202
|
+
draft.bulkUpload.batchDetailsById[details.batchId] = details;
|
|
203
|
+
},
|
|
204
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
205
|
+
fetchMoreBatchDetails(_draft) {
|
|
206
|
+
_draft.bulkUpload.batchDetailsPaginationState = {
|
|
205
207
|
fetchState: 'In-Progress',
|
|
206
208
|
error: undefined,
|
|
207
209
|
};
|
|
208
210
|
},
|
|
211
|
+
fetchMoreBatchDetailsComplete(draft) {
|
|
212
|
+
draft.bulkUpload.batchDetailsPaginationState = {
|
|
213
|
+
fetchState: 'Completed',
|
|
214
|
+
error: undefined,
|
|
215
|
+
};
|
|
216
|
+
},
|
|
217
|
+
fetchMoreBatchDetailsFailure(draft, action) {
|
|
218
|
+
draft.bulkUpload.batchDetailsPaginationState = {
|
|
219
|
+
fetchState: 'Error',
|
|
220
|
+
error: action.payload.error,
|
|
221
|
+
};
|
|
222
|
+
},
|
|
223
|
+
fetchBulkUploadBatches: {
|
|
224
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
225
|
+
reducer(draft, _action) {
|
|
226
|
+
draft.bulkUpload.batchListFetchState = {
|
|
227
|
+
fetchState: 'In-Progress',
|
|
228
|
+
error: undefined,
|
|
229
|
+
};
|
|
230
|
+
},
|
|
231
|
+
prepare(cacheOverride = false) {
|
|
232
|
+
return { payload: { cacheOverride } };
|
|
233
|
+
},
|
|
234
|
+
},
|
|
209
235
|
fetchBulkUploadBatchesSuccess(draft, action) {
|
|
210
|
-
|
|
236
|
+
const periodId = (0, timePeriod_1.toMonthYearPeriodId)(action.payload.selectedPeriod);
|
|
237
|
+
draft.bulkUpload.batchListByPeriod[periodId] = action.payload.batchList;
|
|
211
238
|
draft.bulkUpload.batchListFetchState = {
|
|
212
239
|
fetchState: 'Completed',
|
|
213
240
|
error: undefined,
|
|
@@ -227,8 +254,8 @@ const expenseAutomationMissingReceiptsView = (0, toolkit_1.createSlice)({
|
|
|
227
254
|
error: undefined,
|
|
228
255
|
};
|
|
229
256
|
},
|
|
230
|
-
prepare(batchId, attachmentId, transactionId) {
|
|
231
|
-
return { payload: { batchId, attachmentId, transactionId } };
|
|
257
|
+
prepare(batchId, attachmentId, transactionId, transactionType, fileName) {
|
|
258
|
+
return { payload: { batchId, attachmentId, transactionId, transactionType, fileName } };
|
|
232
259
|
},
|
|
233
260
|
},
|
|
234
261
|
confirmBulkUploadMatchSuccess(draft, action) {
|
|
@@ -241,12 +268,18 @@ const expenseAutomationMissingReceiptsView = (0, toolkit_1.createSlice)({
|
|
|
241
268
|
if (details != null) {
|
|
242
269
|
const file = details.files.find((f) => f.attachmentId === attachmentId);
|
|
243
270
|
if (file != null) {
|
|
271
|
+
const originalStatus = file.status;
|
|
244
272
|
file.status = 'matched';
|
|
245
273
|
file.matchedTransactionId = transactionId;
|
|
246
274
|
file.candidates = undefined;
|
|
275
|
+
details.summary.matched += 1;
|
|
276
|
+
if (originalStatus === 'no_match') {
|
|
277
|
+
details.summary.noMatch = Math.max(0, details.summary.noMatch - 1);
|
|
278
|
+
}
|
|
279
|
+
else {
|
|
280
|
+
details.summary.possibleMatches = Math.max(0, details.summary.possibleMatches - 1);
|
|
281
|
+
}
|
|
247
282
|
}
|
|
248
|
-
details.summary.matched += 1;
|
|
249
|
-
details.summary.possibleMatches = Math.max(0, details.summary.possibleMatches - 1);
|
|
250
283
|
}
|
|
251
284
|
},
|
|
252
285
|
confirmBulkUploadMatchFailure(draft, action) {
|
|
@@ -301,43 +334,28 @@ const expenseAutomationMissingReceiptsView = (0, toolkit_1.createSlice)({
|
|
|
301
334
|
// -- Completed Transactions Actions --
|
|
302
335
|
fetchCompletedTransactions: {
|
|
303
336
|
reducer(draft, action) {
|
|
304
|
-
const
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
}
|
|
317
|
-
else {
|
|
318
|
-
draft.bulkUpload.completedTransactionsByPeriod[periodId] = {
|
|
319
|
-
fetchState: { fetchState: 'In-Progress', error: undefined },
|
|
320
|
-
nextPageToken: null,
|
|
321
|
-
totalCount: 0,
|
|
322
|
-
transactionIds: [],
|
|
323
|
-
};
|
|
337
|
+
const { pageToken } = action.payload;
|
|
338
|
+
if (pageToken != null) {
|
|
339
|
+
const periods = draft.bulkUpload.completedTransactionsByPeriod;
|
|
340
|
+
for (const entry of Object.values(periods)) {
|
|
341
|
+
if (entry.nextPageToken === pageToken) {
|
|
342
|
+
entry.fetchState = {
|
|
343
|
+
fetchState: 'In-Progress',
|
|
344
|
+
error: undefined,
|
|
345
|
+
};
|
|
346
|
+
break;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
324
349
|
}
|
|
325
350
|
},
|
|
326
|
-
prepare(
|
|
327
|
-
return { payload: {
|
|
351
|
+
prepare(pageToken) {
|
|
352
|
+
return { payload: { pageToken } };
|
|
328
353
|
},
|
|
329
354
|
},
|
|
330
355
|
fetchCompletedTransactionsSuccess(draft, action) {
|
|
331
|
-
const { transactionIds, nextPageToken, totalCount, selectedPeriod } = action.payload;
|
|
356
|
+
const { transactionIds, nextPageToken, totalCount, selectedPeriod, isInitialLoad } = action.payload;
|
|
332
357
|
const periodId = (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod);
|
|
333
|
-
|
|
334
|
-
if (existing != null) {
|
|
335
|
-
existing.transactionIds.push(...transactionIds);
|
|
336
|
-
existing.nextPageToken = nextPageToken;
|
|
337
|
-
existing.totalCount = totalCount;
|
|
338
|
-
existing.fetchState = { fetchState: 'Completed', error: undefined };
|
|
339
|
-
}
|
|
340
|
-
else {
|
|
358
|
+
if (isInitialLoad) {
|
|
341
359
|
draft.bulkUpload.completedTransactionsByPeriod[periodId] = {
|
|
342
360
|
transactionIds,
|
|
343
361
|
nextPageToken,
|
|
@@ -345,6 +363,23 @@ const expenseAutomationMissingReceiptsView = (0, toolkit_1.createSlice)({
|
|
|
345
363
|
fetchState: { fetchState: 'Completed', error: undefined },
|
|
346
364
|
};
|
|
347
365
|
}
|
|
366
|
+
else {
|
|
367
|
+
const existing = draft.bulkUpload.completedTransactionsByPeriod[periodId];
|
|
368
|
+
if (existing != null) {
|
|
369
|
+
existing.transactionIds.push(...transactionIds);
|
|
370
|
+
existing.nextPageToken = nextPageToken;
|
|
371
|
+
existing.totalCount = totalCount;
|
|
372
|
+
existing.fetchState = { fetchState: 'Completed', error: undefined };
|
|
373
|
+
}
|
|
374
|
+
else {
|
|
375
|
+
draft.bulkUpload.completedTransactionsByPeriod[periodId] = {
|
|
376
|
+
transactionIds,
|
|
377
|
+
nextPageToken,
|
|
378
|
+
totalCount,
|
|
379
|
+
fetchState: { fetchState: 'Completed', error: undefined },
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
}
|
|
348
383
|
},
|
|
349
384
|
fetchCompletedTransactionsFailure(draft, action) {
|
|
350
385
|
const periodId = (0, timePeriod_1.toMonthYearPeriodId)(action.payload.selectedPeriod);
|
|
@@ -368,7 +403,7 @@ const expenseAutomationMissingReceiptsView = (0, toolkit_1.createSlice)({
|
|
|
368
403
|
});
|
|
369
404
|
_a = expenseAutomationMissingReceiptsView.actions, exports.fetchMissingReceipts = _a.fetchMissingReceipts, exports.fetchMissingReceiptsSuccess = _a.fetchMissingReceiptsSuccess, exports.fetchMissingReceiptsFailure = _a.fetchMissingReceiptsFailure, exports.uploadMissingReceiptSuccess = _a.uploadMissingReceiptSuccess, exports.updateMissingReceiptUploadState = _a.updateMissingReceiptUploadState, exports.updateMissingReceiptsUIState = _a.updateMissingReceiptsUIState, exports.markMissingReceiptAsDone = _a.markMissingReceiptAsDone, exports.clearExpenseAutomationMissingReceiptsView = _a.clearExpenseAutomationMissingReceiptsView,
|
|
370
405
|
// Bulk Upload
|
|
371
|
-
exports.bulkUploadReceipts = _a.bulkUploadReceipts, exports.updateBulkUploadProgress = _a.updateBulkUploadProgress, exports.bulkUploadReceiptsSuccess = _a.bulkUploadReceiptsSuccess, exports.bulkUploadReceiptsFailure = _a.bulkUploadReceiptsFailure, exports.
|
|
406
|
+
exports.bulkUploadReceipts = _a.bulkUploadReceipts, exports.updateBulkUploadProgress = _a.updateBulkUploadProgress, exports.bulkUploadReceiptsSuccess = _a.bulkUploadReceiptsSuccess, exports.bulkUploadReceiptsFailure = _a.bulkUploadReceiptsFailure, exports.pusherBatchStatusUpdate = _a.pusherBatchStatusUpdate, exports.fetchBulkUploadBatchDetails = _a.fetchBulkUploadBatchDetails, exports.fetchBulkUploadBatchDetailsSuccess = _a.fetchBulkUploadBatchDetailsSuccess, exports.fetchBulkUploadBatchDetailsFailure = _a.fetchBulkUploadBatchDetailsFailure, exports.storeBatchDetails = _a.storeBatchDetails, exports.fetchMoreBatchDetails = _a.fetchMoreBatchDetails, exports.fetchMoreBatchDetailsComplete = _a.fetchMoreBatchDetailsComplete, exports.fetchMoreBatchDetailsFailure = _a.fetchMoreBatchDetailsFailure, exports.fetchBulkUploadBatches = _a.fetchBulkUploadBatches, exports.fetchBulkUploadBatchesSuccess = _a.fetchBulkUploadBatchesSuccess, exports.fetchBulkUploadBatchesFailure = _a.fetchBulkUploadBatchesFailure, exports.confirmBulkUploadMatch = _a.confirmBulkUploadMatch, exports.confirmBulkUploadMatchSuccess = _a.confirmBulkUploadMatchSuccess, exports.confirmBulkUploadMatchFailure = _a.confirmBulkUploadMatchFailure, exports.setBulkUploadResultsTab = _a.setBulkUploadResultsTab, exports.setBulkUploadCompletedSubTab = _a.setBulkUploadCompletedSubTab, exports.setBulkUploadSortConfig = _a.setBulkUploadSortConfig, exports.clearBulkUpload = _a.clearBulkUpload, exports.searchTransactionsForManualMatch = _a.searchTransactionsForManualMatch, exports.searchTransactionsForManualMatchSuccess = _a.searchTransactionsForManualMatchSuccess, exports.searchTransactionsForManualMatchFailure = _a.searchTransactionsForManualMatchFailure, exports.clearManualSearchResults = _a.clearManualSearchResults,
|
|
372
407
|
// Completed Transactions
|
|
373
408
|
exports.fetchCompletedTransactions = _a.fetchCompletedTransactions, exports.fetchCompletedTransactionsSuccess = _a.fetchCompletedTransactionsSuccess, exports.fetchCompletedTransactionsFailure = _a.fetchCompletedTransactionsFailure;
|
|
374
409
|
exports.default = expenseAutomationMissingReceiptsView.reducer;
|
|
@@ -15,9 +15,10 @@ export interface ResolvedCandidate {
|
|
|
15
15
|
}
|
|
16
16
|
export interface ResolvedBatchFile {
|
|
17
17
|
attachmentId: ID;
|
|
18
|
+
fileDownloadUrl: string | null;
|
|
18
19
|
fileId: ID;
|
|
19
20
|
filename: string;
|
|
20
|
-
filePreviewUrl: string;
|
|
21
|
+
filePreviewUrl: string | null;
|
|
21
22
|
status: BatchFileStatus;
|
|
22
23
|
candidates?: ResolvedCandidate[];
|
|
23
24
|
matchedTransaction?: SupportedTransaction;
|
|
@@ -25,6 +26,7 @@ export interface ResolvedBatchFile {
|
|
|
25
26
|
}
|
|
26
27
|
export interface BulkUploadSelectorData {
|
|
27
28
|
batchDetails: ResolvedBatchDetails | undefined;
|
|
29
|
+
batchDetailsPaginationState: FetchStateAndError;
|
|
28
30
|
batchList: BatchListItem[];
|
|
29
31
|
batchListFetchState: FetchStateAndError;
|
|
30
32
|
batchStatus: BatchStatus | undefined;
|
|
@@ -32,9 +34,11 @@ export interface BulkUploadSelectorData {
|
|
|
32
34
|
completedTransactions: CompletedTransactionsSelectorData;
|
|
33
35
|
confirmMatchStatus: FetchStateAndError;
|
|
34
36
|
currentResultsTab: BulkUploadResultsTab;
|
|
37
|
+
hasMoreBatchDetails: boolean;
|
|
35
38
|
manualSearch: ManualSearchState;
|
|
36
39
|
matchedFiles: ResolvedBatchFile[];
|
|
37
40
|
pastBatches: BatchListItem[];
|
|
41
|
+
pastUnmatchedFiles: ResolvedBatchFile[];
|
|
38
42
|
phase: BulkUploadPhase;
|
|
39
43
|
progress: {
|
|
40
44
|
percentage: number;
|
|
@@ -57,10 +57,16 @@ function getExpenseAutomationMissingReceiptsView(state) {
|
|
|
57
57
|
const currentBatchStatus = bulkUpload.currentBatchId != null
|
|
58
58
|
? bulkUpload.batchStatusById[bulkUpload.currentBatchId]
|
|
59
59
|
: undefined;
|
|
60
|
-
const
|
|
61
|
-
? bulkUpload.
|
|
60
|
+
const batchList = monthYearPeriodId != null
|
|
61
|
+
? bulkUpload.batchListByPeriod[monthYearPeriodId] ?? []
|
|
62
|
+
: [];
|
|
63
|
+
const completedBatchesSorted = (0, orderBy_1.default)(batchList.filter((b) => b.status === 'completed'), (b) => b.createdAt, 'desc');
|
|
64
|
+
const effectiveCurrentBatchId = bulkUpload.currentBatchId ?? completedBatchesSorted[0]?.batchId;
|
|
65
|
+
const currentBatchDetails = effectiveCurrentBatchId != null
|
|
66
|
+
? bulkUpload.batchDetailsById[effectiveCurrentBatchId]
|
|
62
67
|
: undefined;
|
|
63
68
|
const resolvedFiles = currentBatchDetails?.files.map((file) => resolveBatchFile(file, transactionState));
|
|
69
|
+
const hasMoreBatchDetails = completedBatchesSorted.some((b) => bulkUpload.batchDetailsById[b.batchId] == null);
|
|
64
70
|
const getSortValue = (file) => {
|
|
65
71
|
const t = file.matchedTransaction;
|
|
66
72
|
if (t == null) {
|
|
@@ -98,7 +104,17 @@ function getExpenseAutomationMissingReceiptsView(state) {
|
|
|
98
104
|
: 0,
|
|
99
105
|
}
|
|
100
106
|
: { total: 0, processed: 0, percentage: 0 };
|
|
101
|
-
const
|
|
107
|
+
const batchListFetchState = bulkUpload.batchListFetchState;
|
|
108
|
+
const pastBatches = batchList.filter((b) => b.batchId !== effectiveCurrentBatchId);
|
|
109
|
+
const pastUnmatchedFiles = pastBatches.flatMap((b) => {
|
|
110
|
+
const details = bulkUpload.batchDetailsById[b.batchId];
|
|
111
|
+
if (details == null) {
|
|
112
|
+
return [];
|
|
113
|
+
}
|
|
114
|
+
return details.files
|
|
115
|
+
.filter((f) => f.status === 'un_matched' || f.status === 'no_match')
|
|
116
|
+
.map((f) => resolveBatchFile(f, transactionState));
|
|
117
|
+
});
|
|
102
118
|
const completedTransactionsForPeriod = monthYearPeriodId != null
|
|
103
119
|
? bulkUpload.completedTransactionsByPeriod[monthYearPeriodId]
|
|
104
120
|
: undefined;
|
|
@@ -142,10 +158,13 @@ function getExpenseAutomationMissingReceiptsView(state) {
|
|
|
142
158
|
currentResultsTab: bulkUpload.currentResultsTab,
|
|
143
159
|
sortKey: bulkUpload.sortKey,
|
|
144
160
|
sortOrder: bulkUpload.sortOrder,
|
|
145
|
-
batchList
|
|
146
|
-
batchListFetchState
|
|
161
|
+
batchList,
|
|
162
|
+
batchListFetchState,
|
|
147
163
|
pastBatches,
|
|
164
|
+
pastUnmatchedFiles,
|
|
148
165
|
confirmMatchStatus: bulkUpload.confirmMatchStatus,
|
|
166
|
+
hasMoreBatchDetails,
|
|
167
|
+
batchDetailsPaginationState: bulkUpload.batchDetailsPaginationState,
|
|
149
168
|
manualSearch: bulkUpload.manualSearch,
|
|
150
169
|
uploadProgress: bulkUpload.uploadProgress,
|
|
151
170
|
},
|
|
@@ -165,6 +184,7 @@ function resolveBatchFile(file, transactionState) {
|
|
|
165
184
|
.filter((c) => c != null);
|
|
166
185
|
return {
|
|
167
186
|
attachmentId: file.attachmentId,
|
|
187
|
+
fileDownloadUrl: file.fileDownloadUrl,
|
|
168
188
|
fileId: file.fileId,
|
|
169
189
|
filename: file.filename,
|
|
170
190
|
filePreviewUrl: file.filePreviewUrl,
|
|
@@ -17,6 +17,7 @@ export type BatchStatusValue = 'pending' | 'processing' | 'completed';
|
|
|
17
17
|
export type BatchFileStatus = 'matched' | 'un_matched' | 'no_match' | 'failed';
|
|
18
18
|
export type BulkUploadPhase = 'idle' | 'uploading' | 'matching' | 'completed';
|
|
19
19
|
export type BulkUploadResultsTab = 'completed' | 'unmatched';
|
|
20
|
+
export type MissingReceiptsTab = 'missing' | BulkUploadResultsTab;
|
|
20
21
|
export type CompletedSubTab = 'all' | 'ai_accountant' | 'manual';
|
|
21
22
|
export type MatchSource = 'ai' | 'manual';
|
|
22
23
|
export interface CandidateRef {
|
|
@@ -29,14 +30,16 @@ export interface MatchCandidate {
|
|
|
29
30
|
matchScore: number;
|
|
30
31
|
transactionDate: string;
|
|
31
32
|
transactionId: ID;
|
|
33
|
+
transactionType: string;
|
|
32
34
|
vendorName: string;
|
|
33
35
|
vendorLogo?: string;
|
|
34
36
|
}
|
|
35
37
|
export interface BatchFile {
|
|
36
38
|
attachmentId: ID;
|
|
39
|
+
fileDownloadUrl: string | null;
|
|
37
40
|
fileId: ID;
|
|
38
41
|
filename: string;
|
|
39
|
-
filePreviewUrl: string;
|
|
42
|
+
filePreviewUrl: string | null;
|
|
40
43
|
status: BatchFileStatus;
|
|
41
44
|
candidates?: CandidateRef[];
|
|
42
45
|
matchedTransactionId?: ID;
|
|
@@ -76,7 +79,7 @@ export interface BatchListItem {
|
|
|
76
79
|
}
|
|
77
80
|
export interface ManualSearchResult {
|
|
78
81
|
amount: number;
|
|
79
|
-
|
|
82
|
+
currencyCode: string;
|
|
80
83
|
entityId: string;
|
|
81
84
|
memo: string;
|
|
82
85
|
transactionDate: string;
|
|
@@ -98,7 +101,8 @@ export interface CompletedTransactionsState {
|
|
|
98
101
|
}
|
|
99
102
|
export interface BulkUploadState {
|
|
100
103
|
batchDetailsById: Record<ID, BatchDetails>;
|
|
101
|
-
|
|
104
|
+
batchDetailsPaginationState: FetchStateAndError;
|
|
105
|
+
batchListByPeriod: Record<MonthYearPeriodId, BatchListItem[]>;
|
|
102
106
|
batchListFetchState: FetchStateAndError;
|
|
103
107
|
batchStatusById: Record<ID, BatchStatus>;
|
|
104
108
|
completedSubTab: CompletedSubTab;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.19.37-
|
|
3
|
+
"version": "4.19.37-betaVR11",
|
|
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",
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"find-dead-code": "ts-prune | grep -v '(used in module)'",
|
|
112
112
|
"find-unused-exports": "ts-unused-exports ./tsconfig.json",
|
|
113
113
|
"circular-dependency": "npx madge --circular --extensions ts ./src",
|
|
114
|
-
"build": "concurrently --kill-others-on-fail --handle-input \"echo 'Running ESLint...' && eslint . --ext .js,.jsx,.ts,.tsx\" \"echo 'TypeScript build in progress...' && time tsc && echo 'ESM build...' && tsc -p tsconfig.esm.json\"
|
|
114
|
+
"build": "concurrently --kill-others-on-fail --handle-input \"echo 'Running ESLint...' && eslint . --ext .js,.jsx,.ts,.tsx\" \"echo 'TypeScript build in progress...' && time tsc && echo 'ESM build...' && tsc -p tsconfig.esm.json\"",
|
|
115
115
|
"only-build": "eslint . --ext .js,.jsx,.ts,.tsx && time tsc && tsc -p tsconfig.esm.json && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
|
|
116
116
|
"format": "prettier --write --ignore-unknown \"src/**/*\" && pnpm lint",
|
|
117
117
|
"format-watch": "(git diff --name-only --diff-filter=ACM && git ls-files --others --exclude-standard) | grep -E '\\.(ts|tsx)$' | xargs prettier --write",
|