@zeniai/client-epic-state 4.19.99-betaRD2 → 4.19.99-betaRD21
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/entity/billPay/billTransaction/billTransactionState.d.ts +2 -2
- package/lib/entity/chargeCard/chargeCard.d.ts +1 -1
- package/lib/entity/depositAccountTransaction/depositAccountTransaction.d.ts +1 -1
- package/lib/entity/entityApprovalStatus/entityApprovalStatusState.d.ts +2 -2
- package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +9 -6
- package/lib/entity/jeSchedules/jeSchedulesPayload.js +36 -2
- package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +4 -2
- package/lib/entity/jeSchedules/jeSchedulesSelector.js +5 -2
- package/lib/entity/jeSchedules/jeSchedulesState.d.ts +26 -2
- package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/tenant/clearAllEpic.d.ts +1 -3
- package/lib/entity/tenant/clearAllEpic.js +0 -4
- package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.d.ts +4 -1
- package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.js +1 -0
- package/lib/entity/transaction/stateTypes/scheduleTransaction.d.ts +1 -0
- package/lib/entity/userRole/userRoleType.d.ts +2 -2
- package/lib/epic.d.ts +1 -5
- package/lib/epic.js +1 -5
- package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +36 -2
- package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +5 -2
- package/lib/esm/entity/tenant/clearAllEpic.js +0 -4
- package/lib/esm/entity/transaction/payloadTypes/scheduleTransactionPayload.js +1 -0
- package/lib/esm/epic.js +1 -5
- package/lib/esm/index.js +0 -7
- package/lib/esm/reducer.js +0 -6
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +2 -2
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +2 -2
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +4 -3
- package/lib/esm/view/expenseAutomationView/expenseAutomationViewSelector.js +0 -1
- package/lib/esm/view/expenseAutomationView/selectors/fluxAnalysisViewSelector.js +10 -2
- package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +13 -3
- package/lib/esm/view/expenseAutomationView/selectors/missingReceiptsSelector.js +11 -3
- package/lib/esm/view/expenseAutomationView/selectors/reconciliationViewSelector.js +22 -9
- package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +12 -6
- package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +1 -0
- package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +3 -8
- package/lib/esm/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.js +144 -63
- package/lib/esm/view/transactionDetail/transactionDetailSelector.js +9 -2
- package/lib/index.d.ts +2 -10
- package/lib/index.js +2 -30
- package/lib/reducer.d.ts +0 -6
- package/lib/reducer.js +0 -6
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
- package/lib/view/companyView/types/cockpitTypes.d.ts +5 -6
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +2 -2
- package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +1 -1
- package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +4 -3
- package/lib/view/expenseAutomationView/expenseAutomationViewSelector.js +0 -1
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +1 -1
- package/lib/view/expenseAutomationView/selectors/fluxAnalysisViewSelector.js +10 -2
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +13 -3
- package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.js +11 -3
- package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.js +22 -9
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +11 -5
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +1 -1
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +1 -0
- package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +1 -1
- package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +3 -8
- package/lib/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.js +144 -63
- package/lib/view/reviewCompanyView/reviewCompanyViewState.d.ts +1 -1
- package/lib/view/spendManagement/billPay/billList/billListReducer.d.ts +1 -1
- package/lib/view/spendManagement/billPay/billList/billListState.d.ts +1 -1
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.d.ts +4 -4
- package/lib/view/spendManagement/reimbursement/remiListView/remiListReducer.d.ts +1 -1
- package/lib/view/spendManagement/reimbursement/remiListView/remiListState.d.ts +3 -3
- package/lib/view/subscriptionView/types/subscriptionTypes.d.ts +1 -1
- package/lib/view/transactionDetail/transactionDetailSelector.d.ts +1 -0
- package/lib/view/transactionDetail/transactionDetailSelector.js +9 -2
- package/package.json +1 -1
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerPayload.d.ts +0 -44
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerPayload.js +0 -53
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerReducer.d.ts +0 -9
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerReducer.js +0 -40
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerSelector.d.ts +0 -47
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerSelector.js +0 -54
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerState.d.ts +0 -52
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerState.js +0 -36
- package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerPayload.js +0 -47
- package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerReducer.js +0 -36
- package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerSelector.js +0 -50
- package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerState.js +0 -30
- package/lib/esm/view/aiAccountantView/aiAccountantViewPayload.js +0 -2
- package/lib/esm/view/aiAccountantView/aiAccountantViewReducer.js +0 -145
- package/lib/esm/view/aiAccountantView/aiAccountantViewSelector.js +0 -72
- package/lib/esm/view/aiAccountantView/aiAccountantViewState.js +0 -11
- package/lib/esm/view/aiAccountantView/epics/cancelAiAccountantOnboardingEpic.js +0 -26
- package/lib/esm/view/aiAccountantView/epics/fetchAiAccountantCustomersEpic.js +0 -27
- package/lib/esm/view/aiAccountantView/epics/fetchAiAccountantJobsEpic.js +0 -37
- package/lib/esm/view/aiAccountantView/epics/triggerAiAccountantJobEpic.js +0 -39
- package/lib/view/aiAccountantView/aiAccountantViewPayload.d.ts +0 -31
- package/lib/view/aiAccountantView/aiAccountantViewPayload.js +0 -8
- package/lib/view/aiAccountantView/aiAccountantViewReducer.d.ts +0 -27
- package/lib/view/aiAccountantView/aiAccountantViewReducer.js +0 -149
- package/lib/view/aiAccountantView/aiAccountantViewSelector.d.ts +0 -13
- package/lib/view/aiAccountantView/aiAccountantViewSelector.js +0 -78
- package/lib/view/aiAccountantView/aiAccountantViewState.d.ts +0 -26
- package/lib/view/aiAccountantView/aiAccountantViewState.js +0 -13
- package/lib/view/aiAccountantView/epics/cancelAiAccountantOnboardingEpic.d.ts +0 -20
- package/lib/view/aiAccountantView/epics/cancelAiAccountantOnboardingEpic.js +0 -30
- package/lib/view/aiAccountantView/epics/fetchAiAccountantCustomersEpic.d.ts +0 -23
- package/lib/view/aiAccountantView/epics/fetchAiAccountantCustomersEpic.js +0 -31
- package/lib/view/aiAccountantView/epics/fetchAiAccountantJobsEpic.d.ts +0 -26
- package/lib/view/aiAccountantView/epics/fetchAiAccountantJobsEpic.js +0 -41
- package/lib/view/aiAccountantView/epics/triggerAiAccountantJobEpic.d.ts +0 -15
- package/lib/view/aiAccountantView/epics/triggerAiAccountantJobEpic.js +0 -43
|
@@ -28,30 +28,31 @@ function enrichHorizontalSection(report, section) {
|
|
|
28
28
|
return total?.balance.amount ?? 0;
|
|
29
29
|
});
|
|
30
30
|
section.sectionHeaderBalancesSlice = buildHorizontalClassColumnBalancesSlice(report, classAmounts, section.sectionTotal.amount);
|
|
31
|
-
const
|
|
31
|
+
const parentIndices = computeHorizontalAccountParentIndices(section.accounts);
|
|
32
|
+
const childrenRowIndicesByParent = buildHorizontalAccountChildIndicesByParent(parentIndices);
|
|
32
33
|
const childrenRecord = {};
|
|
33
34
|
childrenRowIndicesByParent.forEach((childIndices, parentIndex) => {
|
|
34
35
|
childrenRecord[parentIndex] = childIndices;
|
|
35
36
|
});
|
|
36
37
|
section.treeLayout = {
|
|
37
38
|
rootAccountRowIndices: section.accounts
|
|
38
|
-
.map((_, i) =>
|
|
39
|
+
.map((_, i) => (parentIndices[i] === -1 ? i : -1))
|
|
39
40
|
.filter((i) => i >= 0),
|
|
40
41
|
childrenRowIndicesByParent: childrenRecord,
|
|
41
42
|
};
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
const siblingsPerRow = buildSiblingIndicesPerRow(section.accounts, parentIndices);
|
|
44
|
+
const hasChildFlags = computeHorizontalHasChildFlags(parentIndices);
|
|
45
|
+
for (let accountIndex = 0; accountIndex < section.accounts.length; accountIndex++) {
|
|
46
|
+
const row = section.accounts[accountIndex];
|
|
47
|
+
// Same column order as `report.classColumns` (see `pivotSectionToHorizontal`).
|
|
48
|
+
const classRowAmounts = row.classBalances.map((classBalance) => classBalance.balance.amount);
|
|
48
49
|
row.accountReportData = {
|
|
49
50
|
accountId: row.accountId,
|
|
50
51
|
accountName: row.accountName,
|
|
51
52
|
accountType: row.accountType,
|
|
52
53
|
depth: row.depth,
|
|
53
54
|
balancesInTimeframe: buildHorizontalClassColumnBalancesSlice(report, classRowAmounts, row.rowTotal.amount),
|
|
54
|
-
horizontalTreeView:
|
|
55
|
+
horizontalTreeView: buildHorizontalTreeViewFromPrecomputed(section.accounts, accountIndex, parentIndices, siblingsPerRow, hasChildFlags),
|
|
55
56
|
};
|
|
56
57
|
}
|
|
57
58
|
}
|
|
@@ -83,9 +84,9 @@ function buildHorizontalClassColumnBalancesSlice(report, classAmounts, totalAmou
|
|
|
83
84
|
return emptySlice;
|
|
84
85
|
}
|
|
85
86
|
const { startDate, endDate } = report.selectedPeriod;
|
|
86
|
-
const balances = report.classColumns.map((col,
|
|
87
|
+
const balances = report.classColumns.map((col, columnIndex) => ({
|
|
87
88
|
balance: {
|
|
88
|
-
amount: classAmounts[
|
|
89
|
+
amount: classAmounts[columnIndex] ?? 0,
|
|
89
90
|
currencyCode,
|
|
90
91
|
currencySymbol,
|
|
91
92
|
},
|
|
@@ -123,64 +124,157 @@ function buildHorizontalClassColumnBalancesSlice(report, classAmounts, totalAmou
|
|
|
123
124
|
},
|
|
124
125
|
};
|
|
125
126
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
127
|
+
/**
|
|
128
|
+
* Parent index per DFS row — O(n). Matches the scan in the former
|
|
129
|
+
* `findHorizontalAccountParentIndex` (depth <= 2 rows have no parent).
|
|
130
|
+
*/
|
|
131
|
+
function computeHorizontalAccountParentIndices(rows) {
|
|
132
|
+
const accountRowCount = rows.length;
|
|
133
|
+
const parentIndex = new Array(accountRowCount).fill(-1);
|
|
134
|
+
const stack = [];
|
|
135
|
+
for (let rowIndex = 0; rowIndex < accountRowCount; rowIndex++) {
|
|
136
|
+
const accountRow = rows[rowIndex];
|
|
137
|
+
if (accountRow == null) {
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
const depth = accountRow.depth;
|
|
141
|
+
while (stack.length > 0) {
|
|
142
|
+
const topIndex = stack[stack.length - 1];
|
|
143
|
+
if (topIndex == null) {
|
|
144
|
+
break;
|
|
136
145
|
}
|
|
137
|
-
|
|
146
|
+
const topRow = rows[topIndex];
|
|
147
|
+
if (topRow == null) {
|
|
148
|
+
stack.pop();
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
if (topRow.depth < depth) {
|
|
152
|
+
break;
|
|
153
|
+
}
|
|
154
|
+
stack.pop();
|
|
155
|
+
}
|
|
156
|
+
if (depth <= 2) {
|
|
157
|
+
parentIndex[rowIndex] = -1;
|
|
158
|
+
}
|
|
159
|
+
else if (stack.length === 0) {
|
|
160
|
+
parentIndex[rowIndex] = -1;
|
|
138
161
|
}
|
|
162
|
+
else {
|
|
163
|
+
const peek = stack[stack.length - 1];
|
|
164
|
+
if (peek == null) {
|
|
165
|
+
parentIndex[rowIndex] = -1;
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
const parentRow = rows[peek];
|
|
169
|
+
parentIndex[rowIndex] =
|
|
170
|
+
parentRow != null && parentRow.depth === depth - 1 ? peek : -1;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
stack.push(rowIndex);
|
|
139
174
|
}
|
|
140
|
-
return
|
|
175
|
+
return parentIndex;
|
|
141
176
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
const
|
|
145
|
-
const
|
|
146
|
-
for (let
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
177
|
+
/** Sibling row indices (same parent + depth), in traversal order — O(n). */
|
|
178
|
+
function buildSiblingIndicesPerRow(rows, parentIndices) {
|
|
179
|
+
const accountRowCount = rows.length;
|
|
180
|
+
const keyToIndices = new Map();
|
|
181
|
+
for (let rowIndex = 0; rowIndex < accountRowCount; rowIndex++) {
|
|
182
|
+
const parentRowIndex = parentIndices[rowIndex];
|
|
183
|
+
const accountRow = rows[rowIndex];
|
|
184
|
+
if (parentRowIndex == null || accountRow == null) {
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
const key = `${parentRowIndex}:${accountRow.depth}`;
|
|
188
|
+
let siblingGroup = keyToIndices.get(key);
|
|
189
|
+
if (siblingGroup == null) {
|
|
190
|
+
siblingGroup = [];
|
|
191
|
+
keyToIndices.set(key, siblingGroup);
|
|
151
192
|
}
|
|
193
|
+
siblingGroup.push(rowIndex);
|
|
152
194
|
}
|
|
153
|
-
|
|
195
|
+
const siblingsPerRow = new Array(accountRowCount);
|
|
196
|
+
for (let rowIndex = 0; rowIndex < accountRowCount; rowIndex++) {
|
|
197
|
+
const parentRowIndex = parentIndices[rowIndex];
|
|
198
|
+
const accountRow = rows[rowIndex];
|
|
199
|
+
if (parentRowIndex == null || accountRow == null) {
|
|
200
|
+
siblingsPerRow[rowIndex] = [rowIndex];
|
|
201
|
+
continue;
|
|
202
|
+
}
|
|
203
|
+
const key = `${parentRowIndex}:${accountRow.depth}`;
|
|
204
|
+
const group = keyToIndices.get(key);
|
|
205
|
+
siblingsPerRow[rowIndex] = group != null ? group : [rowIndex];
|
|
206
|
+
}
|
|
207
|
+
return siblingsPerRow;
|
|
154
208
|
}
|
|
155
|
-
function
|
|
156
|
-
|
|
157
|
-
|
|
209
|
+
function computeHorizontalHasChildFlags(parentIndices) {
|
|
210
|
+
const rowCount = parentIndices.length;
|
|
211
|
+
const flags = new Array(rowCount).fill(false);
|
|
212
|
+
for (let rowIndex = 0; rowIndex < rowCount; rowIndex++) {
|
|
213
|
+
const parentRowIndex = parentIndices[rowIndex];
|
|
214
|
+
if (parentRowIndex != null &&
|
|
215
|
+
parentRowIndex >= 0 &&
|
|
216
|
+
parentRowIndex < rowCount) {
|
|
217
|
+
flags[parentRowIndex] = true;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
return flags;
|
|
158
221
|
}
|
|
159
|
-
function
|
|
160
|
-
const
|
|
222
|
+
function buildHorizontalSubAccountAncestorMetadataFromPrecomputed(dfsOrderedAccountRows, currentRowIndex, parentIndices, siblingsPerRow, hasChildFlags) {
|
|
223
|
+
const chain = [];
|
|
161
224
|
let walkRowIndex = currentRowIndex;
|
|
162
225
|
while (walkRowIndex >= 0) {
|
|
163
|
-
|
|
164
|
-
|
|
226
|
+
chain.unshift(walkRowIndex);
|
|
227
|
+
const parentRowIndex = parentIndices[walkRowIndex];
|
|
228
|
+
if (parentRowIndex == null) {
|
|
229
|
+
break;
|
|
230
|
+
}
|
|
231
|
+
walkRowIndex = parentRowIndex;
|
|
165
232
|
}
|
|
166
|
-
return
|
|
167
|
-
const
|
|
233
|
+
return chain.map((rowIndex) => {
|
|
234
|
+
const accountRow = dfsOrderedAccountRows[rowIndex];
|
|
235
|
+
const siblingIndices = siblingsPerRow[rowIndex];
|
|
236
|
+
const hasChild = hasChildFlags[rowIndex];
|
|
237
|
+
if (accountRow == null || siblingIndices == null) {
|
|
238
|
+
return {
|
|
239
|
+
depth: 0,
|
|
240
|
+
hasSibling: false,
|
|
241
|
+
hasChildren: hasChild === true,
|
|
242
|
+
isLastNode: true,
|
|
243
|
+
name: '',
|
|
244
|
+
};
|
|
245
|
+
}
|
|
168
246
|
return {
|
|
169
|
-
depth:
|
|
247
|
+
depth: accountRow.depth - 2,
|
|
170
248
|
hasSibling: siblingIndices.length > 1,
|
|
171
|
-
hasChildren:
|
|
249
|
+
hasChildren: hasChild === true,
|
|
172
250
|
isLastNode: rowIndex === siblingIndices[siblingIndices.length - 1],
|
|
173
|
-
name:
|
|
251
|
+
name: accountRow.accountName,
|
|
174
252
|
};
|
|
175
253
|
});
|
|
176
254
|
}
|
|
177
|
-
function
|
|
255
|
+
function buildHorizontalTreeViewFromPrecomputed(dfsOrderedAccountRows, currentRowIndex, parentIndices, siblingsPerRow, hasChildFlags) {
|
|
256
|
+
const siblingIndices = siblingsPerRow[currentRowIndex];
|
|
257
|
+
const accountRow = dfsOrderedAccountRows[currentRowIndex];
|
|
258
|
+
const hasChildrenFlag = hasChildFlags[currentRowIndex];
|
|
259
|
+
const treeDepth = accountRow != null ? Math.max(0, accountRow.depth - 2) : 0;
|
|
260
|
+
const hasChildren = hasChildrenFlag === true;
|
|
261
|
+
const siblings = siblingIndices ?? [currentRowIndex];
|
|
262
|
+
return {
|
|
263
|
+
subAccountAncestorMetadata: buildHorizontalSubAccountAncestorMetadataFromPrecomputed(dfsOrderedAccountRows, currentRowIndex, parentIndices, siblingsPerRow, hasChildFlags),
|
|
264
|
+
treeDepth,
|
|
265
|
+
hasChildren,
|
|
266
|
+
hasSiblings: siblings.length > 1,
|
|
267
|
+
isLeaf: !hasChildren,
|
|
268
|
+
isLastNode: currentRowIndex === siblings[siblings.length - 1],
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
function buildHorizontalAccountChildIndicesByParent(parentIndices) {
|
|
178
272
|
const childIndicesByParentRowIndex = new Map();
|
|
179
|
-
for (let rowIndex = 0; rowIndex <
|
|
180
|
-
const parentRowIndex =
|
|
181
|
-
if (parentRowIndex >= 0) {
|
|
273
|
+
for (let rowIndex = 0; rowIndex < parentIndices.length; rowIndex++) {
|
|
274
|
+
const parentRowIndex = parentIndices[rowIndex];
|
|
275
|
+
if (parentRowIndex != null && parentRowIndex >= 0) {
|
|
182
276
|
let childRowIndices = childIndicesByParentRowIndex.get(parentRowIndex);
|
|
183
|
-
if (childRowIndices
|
|
277
|
+
if (childRowIndices == null) {
|
|
184
278
|
childRowIndices = [];
|
|
185
279
|
childIndicesByParentRowIndex.set(parentRowIndex, childRowIndices);
|
|
186
280
|
}
|
|
@@ -189,16 +283,3 @@ function buildHorizontalAccountChildIndicesByParent(dfsOrderedAccountRows) {
|
|
|
189
283
|
}
|
|
190
284
|
return childIndicesByParentRowIndex;
|
|
191
285
|
}
|
|
192
|
-
function buildHorizontalTreeView(dfsOrderedAccountRows, currentRowIndex) {
|
|
193
|
-
const treeDepth = Math.max(0, dfsOrderedAccountRows[currentRowIndex].depth - 2);
|
|
194
|
-
const siblingIndices = getHorizontalAccountSiblingIndices(dfsOrderedAccountRows, currentRowIndex);
|
|
195
|
-
const hasChildren = horizontalAccountHasChildRows(dfsOrderedAccountRows, currentRowIndex);
|
|
196
|
-
return {
|
|
197
|
-
subAccountAncestorMetadata: buildHorizontalSubAccountAncestorMetadata(dfsOrderedAccountRows, currentRowIndex),
|
|
198
|
-
treeDepth,
|
|
199
|
-
hasChildren,
|
|
200
|
-
hasSiblings: siblingIndices.length > 1,
|
|
201
|
-
isLeaf: !hasChildren,
|
|
202
|
-
isLastNode: currentRowIndex === siblingIndices[siblingIndices.length - 1],
|
|
203
|
-
};
|
|
204
|
-
}
|
|
@@ -3,7 +3,7 @@ import { SortOrder } from '../../commonStateTypes/selectorTypes/sortOrderTypes';
|
|
|
3
3
|
import { OnboardingInfo } from '../../entity/company/companyStateTypes';
|
|
4
4
|
import { ZeniDate } from '../../zeniDayJS';
|
|
5
5
|
import { AuditSummaryPayload, ReviewCompanyPayload } from './reviewCompanyPayload';
|
|
6
|
-
export declare const toReviewColumnKeyType: (v: string) => "
|
|
6
|
+
export declare const toReviewColumnKeyType: (v: string) => "uncategorized" | "companyName" | "auditScore" | "miscategorized" | "notes" | "warnings" | "vendorReview" | "reviewVendor";
|
|
7
7
|
export type ReviewCompanyColumnKey = ReturnType<typeof toReviewColumnKeyType>;
|
|
8
8
|
export type ReviewTransactionsType = 'income' | 'expense';
|
|
9
9
|
export interface AuditSummary {
|
|
@@ -21,7 +21,7 @@ export declare const fetchBillList: import("@reduxjs/toolkit").ActionCreatorWith
|
|
|
21
21
|
period: TimePeriod;
|
|
22
22
|
tab: "paid" | "pending_approval" | "scheduled" | "draft";
|
|
23
23
|
error: ZeniAPIStatus<Record<string, unknown>>;
|
|
24
|
-
}, "billList/updateBillListFailure", never, never>, updateTab: import("@reduxjs/toolkit").ActionCreatorWithPayload<"paid" | "pending_approval" | "scheduled" | "draft", "billList/updateTab">, updateSubTab: import("@reduxjs/toolkit").ActionCreatorWithPayload<"
|
|
24
|
+
}, "billList/updateBillListFailure", never, never>, updateTab: import("@reduxjs/toolkit").ActionCreatorWithPayload<"paid" | "pending_approval" | "scheduled" | "draft", "billList/updateTab">, updateSubTab: import("@reduxjs/toolkit").ActionCreatorWithPayload<"rejected" | "failed" | "ach" | "wire" | "cancelled" | "deleted" | "overdue" | "all" | "awaiting_approval" | "awaiting_my_approval" | "offline", "billList/updateSubTab">, updateSelectedBillId: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "billList/updateSelectedBillId">, clearBillList: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"billList/clearBillList">, updateBillDetailSaveBillCode: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<SaveBillStageCode, "billList/updateBillDetailSaveBillCode">, updateBillListUIState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
25
25
|
period: TimePeriod;
|
|
26
26
|
uiState: Partial<BillListUIState>;
|
|
27
27
|
}, "billList/updateBillListUIState">, updateSearchResult: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "billList/updateSearchResult">, updateFilterResult: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
@@ -35,7 +35,7 @@ export type SaveBillStageCode = 'draft' | 'pending_approval' | undefined;
|
|
|
35
35
|
export declare const ALL_BILL_TABS: readonly ["paid", "pending_approval", "scheduled", "draft"];
|
|
36
36
|
declare const toBillTabType: (v: string) => "paid" | "pending_approval" | "scheduled" | "draft";
|
|
37
37
|
export type BillTab = ReturnType<typeof toBillTabType>;
|
|
38
|
-
declare const toBillsSubTabType: (v: string) => "
|
|
38
|
+
declare const toBillsSubTabType: (v: string) => "rejected" | "failed" | "ach" | "wire" | "cancelled" | "deleted" | "overdue" | "all" | "awaiting_approval" | "awaiting_my_approval" | "offline";
|
|
39
39
|
export type BillsSubTabType = ReturnType<typeof toBillsSubTabType>;
|
|
40
40
|
declare const toBillPaySortKeyType: (v: string) => "amount" | "status" | "name" | "dueDate" | "paymentMethod" | "invoiceNumber" | "invoiceDate";
|
|
41
41
|
export declare type BillPayViewSortKey = ReturnType<typeof toBillPaySortKeyType>;
|
|
@@ -52,12 +52,12 @@ export declare const fetchChargeCardDetailPage: import("@reduxjs/toolkit").Actio
|
|
|
52
52
|
chargeCardId: ID;
|
|
53
53
|
fetchState: FetchState;
|
|
54
54
|
error?: ZeniAPIStatus;
|
|
55
|
-
}, "chargeCardDetail/updatePhysicalChargeCardAttemptSuccessOrFailure">, updatePhysicalChargeCardAttempt: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[chargeCardId: string, statusCode: "
|
|
55
|
+
}, "chargeCardDetail/updatePhysicalChargeCardAttemptSuccessOrFailure">, updatePhysicalChargeCardAttempt: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[chargeCardId: string, statusCode: "success" | "failed"], {
|
|
56
56
|
chargeCardId: string;
|
|
57
|
-
statusCode: "
|
|
58
|
-
}, "chargeCardDetail/updatePhysicalChargeCardAttempt", never, never>, updateDebitCardPinAttempt: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[chargeCardId: string, statusCode: "
|
|
57
|
+
statusCode: "success" | "failed";
|
|
58
|
+
}, "chargeCardDetail/updatePhysicalChargeCardAttempt", never, never>, updateDebitCardPinAttempt: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[chargeCardId: string, statusCode: "success" | "failed"], {
|
|
59
59
|
chargeCardId: string;
|
|
60
|
-
statusCode: "
|
|
60
|
+
statusCode: "success" | "failed";
|
|
61
61
|
}, "chargeCardDetail/updateDebitCardPinAttempt", never, never>, updateDebitCardPinAttemptSuccessOrFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
62
62
|
chargeCardId: ID;
|
|
63
63
|
fetchState: FetchState;
|
|
@@ -27,7 +27,7 @@ export declare const fetchRemiList: import("@reduxjs/toolkit").ActionCreatorWith
|
|
|
27
27
|
}, "remiList/updateRemiListFailure", never, never>, updateRemiListUIState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
28
28
|
period: TimePeriod;
|
|
29
29
|
uiState: Partial<RemiListUIState>;
|
|
30
|
-
}, "remiList/updateRemiListUIState">, updateTab: import("@reduxjs/toolkit").ActionCreatorWithPayload<"paid" | "pending_approval" | "scheduled" | "draft", "remiList/updateTab">, updateSubTab: import("@reduxjs/toolkit").ActionCreatorWithPayload<"
|
|
30
|
+
}, "remiList/updateRemiListUIState">, updateTab: import("@reduxjs/toolkit").ActionCreatorWithPayload<"paid" | "pending_approval" | "scheduled" | "draft", "remiList/updateTab">, updateSubTab: import("@reduxjs/toolkit").ActionCreatorWithPayload<"rejected" | "failed" | "ach" | "wire" | "cancelled" | "deleted" | "overdue" | "all" | "myDrafts" | "awaitingApproval" | "awaitingMyApproval" | "awaitingAllApproval", "remiList/updateSubTab">, updateSelectedRemiId: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "remiList/updateSelectedRemiId">, clearRemiList: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"remiList/clearRemiList">, updateRemiDetailSaveRemiCode: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<SaveRemiStageCode, "remiList/updateRemiDetailSaveRemiCode">, updateSearchResult: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "remiList/updateSearchResult">, updateFilterResult: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
31
31
|
filters: ReimbursementFilters;
|
|
32
32
|
}, "remiList/updateFilterResult">, updateRemiListDownloadUIState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
33
33
|
uiState: Partial<RemiListDownloadUIState>;
|
|
@@ -33,10 +33,10 @@ export declare const ALL_REMI_TABS: readonly ["paid", "pending_approval", "sched
|
|
|
33
33
|
export declare const toRemiTabType: (v: string) => "paid" | "pending_approval" | "scheduled" | "draft";
|
|
34
34
|
export declare const toRemiTabTypeStrict: (v: string) => "paid" | "pending_approval" | "scheduled" | "draft" | undefined;
|
|
35
35
|
export type RemiTabType = ReturnType<typeof toRemiTabType>;
|
|
36
|
-
export declare const toRemiSubTabType: (v: string) => "
|
|
37
|
-
export declare const toRemiSubTabTypeStrict: (v: string) => "
|
|
36
|
+
export declare const toRemiSubTabType: (v: string) => "rejected" | "failed" | "ach" | "wire" | "cancelled" | "deleted" | "overdue" | "all" | "myDrafts" | "awaitingApproval" | "awaitingMyApproval" | "awaitingAllApproval";
|
|
37
|
+
export declare const toRemiSubTabTypeStrict: (v: string) => "rejected" | "failed" | "ach" | "wire" | "cancelled" | "deleted" | "overdue" | "all" | "myDrafts" | "awaitingApproval" | "awaitingMyApproval" | "awaitingAllApproval" | undefined;
|
|
38
38
|
export type RemiSubTabType = ReturnType<typeof toRemiSubTabType>;
|
|
39
|
-
export declare const toRemiSubTabUnderScoreType: (v: string) => "
|
|
39
|
+
export declare const toRemiSubTabUnderScoreType: (v: string) => "rejected" | "failed" | "ach" | "wire" | "cancelled" | "deleted" | "overdue" | "all" | "awaiting_approval" | "awaiting_my_approval" | "my_drafts" | "awaiting_all_approval";
|
|
40
40
|
export type RemiSubTabUnderScoreType = ReturnType<typeof toRemiSubTabUnderScoreType>;
|
|
41
41
|
declare const toReimbursementSortKeyType: (v: string) => "amount" | "status" | "type" | "createdBy" | "submittedOn" | "reportName";
|
|
42
42
|
export type ReimbursementViewSortKey = ReturnType<typeof toReimbursementSortKeyType>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const toSubscriptionSortKeyType: (v: string) => "status" | "
|
|
1
|
+
export declare const toSubscriptionSortKeyType: (v: string) => "status" | "controller" | "avg2MonthExpenses" | "companyName" | "monthlyRecurringRevenue" | "notes" | "plans" | "planLowerLimit" | "planHigherLimit" | "addons" | "upgradeStatus";
|
|
2
2
|
export type SubscriptionViewSortKey = ReturnType<typeof toSubscriptionSortKeyType>;
|
|
3
3
|
export declare const SUBSCRIPTION_STATUS_CODES: string[];
|
|
4
4
|
declare const toSubscriptionStatusCodeType: (v: string) => string;
|
|
@@ -17,6 +17,7 @@ export interface TransactionDetailReport extends SelectorView {
|
|
|
17
17
|
classHierarchyList: NestedClassHierarchyForReport[];
|
|
18
18
|
classList: ClassListSelectorView;
|
|
19
19
|
deleteStatusByAttachmentName: Record<string, FetchStateAndError>;
|
|
20
|
+
isAccountingClassesEnabled: boolean;
|
|
20
21
|
linkedTransactions: SupportedTransactionWithCOT[];
|
|
21
22
|
transactionDetailLocalData: TransactionDetailLocalData;
|
|
22
23
|
transactionDetailUpdateStatus: FetchStateAndError;
|
|
@@ -7,6 +7,7 @@ exports.getInitialUpdatablePeriodsForTransactionRecommendations = exports.getTra
|
|
|
7
7
|
exports.getTransactionDetailForTransaction = getTransactionDetailForTransaction;
|
|
8
8
|
const get_1 = __importDefault(require("lodash/get"));
|
|
9
9
|
const reduceFetchState_1 = require("../../commonStateTypes/reduceFetchState");
|
|
10
|
+
const tenantSelector_1 = require("../../entity/tenant/tenantSelector");
|
|
10
11
|
const transactionType_1 = require("../../entity/transaction/stateTypes/transactionType");
|
|
11
12
|
const transactionHelper_1 = require("../../entity/transaction/transactionHelper");
|
|
12
13
|
const transactionSelector_1 = require("../../entity/transaction/transactionSelector");
|
|
@@ -58,9 +59,14 @@ const getTransactionDetail = (state, transactionId, fetchLinkedTransactions = tr
|
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
61
|
const accountsList = (0, accountListSelector_1.getAccountList)(accountState, accountListState, 'accountList');
|
|
61
|
-
const
|
|
62
|
+
const isAccountingClassesEnabled = (0, tenantSelector_1.getIsAccountingClassesEnabled)(state);
|
|
63
|
+
const classList = isAccountingClassesEnabled
|
|
64
|
+
? (0, classListSelector_1.getClassList)(classState, classListState)
|
|
65
|
+
: { classes: [], nestedClassHierarchy: [], fetchState: 'Completed', error: undefined, version: 0 };
|
|
62
66
|
const accountsHierarchyList = (0, accountListSelector_1.getNestedAccountListHierarchy)(accountListState, 'accountList');
|
|
63
|
-
const classHierarchyList =
|
|
67
|
+
const classHierarchyList = isAccountingClassesEnabled
|
|
68
|
+
? (0, classListSelector_1.getNestedClassListHierarchy)(classListState)
|
|
69
|
+
: [];
|
|
64
70
|
const transactionDetailAnyUpdateStatus = reduceUpdateFetchStates(transactionDetail);
|
|
65
71
|
const vendors = (0, vendorSelector_1.getVendorsByVendorIds)(vendorState, vendorListState.vendorIds);
|
|
66
72
|
return {
|
|
@@ -78,6 +84,7 @@ const getTransactionDetail = (state, transactionId, fetchLinkedTransactions = tr
|
|
|
78
84
|
classHierarchyList,
|
|
79
85
|
accountsHierarchyList,
|
|
80
86
|
classList: classList,
|
|
87
|
+
isAccountingClassesEnabled,
|
|
81
88
|
isUpdateNotAllowed: transactionDetail?.isUpdateNotAllowed,
|
|
82
89
|
transactionDetailLocalData: transactionDetail?.transactionDetailLocalData ??
|
|
83
90
|
transactionDetailState_1.initialSupportedTransactionDetail.transactionDetailLocalData,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.19.99-
|
|
3
|
+
"version": "4.19.99-betaRD21",
|
|
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",
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { AiAccountantCustomer, AiAccountantEnrollment, AiAccountantJob } from './aiAccountantCustomerState';
|
|
2
|
-
export interface AiAccountantEnrollmentPayload {
|
|
3
|
-
status: string;
|
|
4
|
-
accuracy?: Record<string, number>;
|
|
5
|
-
latest_training?: string;
|
|
6
|
-
latest_transaction_sync?: string;
|
|
7
|
-
offboarded_at?: string;
|
|
8
|
-
offboarded_by?: string;
|
|
9
|
-
onboarded_at?: string;
|
|
10
|
-
onboarded_by?: string;
|
|
11
|
-
validation_results?: Array<{
|
|
12
|
-
accuracy: number;
|
|
13
|
-
model_type: string;
|
|
14
|
-
passed: boolean;
|
|
15
|
-
threshold: number;
|
|
16
|
-
}>;
|
|
17
|
-
}
|
|
18
|
-
export interface AiAccountantCustomerPayload {
|
|
19
|
-
company_id: string;
|
|
20
|
-
company_name: string;
|
|
21
|
-
tenant_id: string;
|
|
22
|
-
bookclose_date?: string;
|
|
23
|
-
enrollment?: AiAccountantEnrollmentPayload | null;
|
|
24
|
-
}
|
|
25
|
-
export interface AiAccountantJobPayload {
|
|
26
|
-
company_id: string;
|
|
27
|
-
created_at: string;
|
|
28
|
-
job_id: string;
|
|
29
|
-
operation_type: string;
|
|
30
|
-
status: string;
|
|
31
|
-
tenant_id: string;
|
|
32
|
-
triggered_by: string;
|
|
33
|
-
company_namespace?: string;
|
|
34
|
-
completed_at?: string;
|
|
35
|
-
error_message?: string;
|
|
36
|
-
parameters?: Record<string, unknown>;
|
|
37
|
-
retry_count?: number;
|
|
38
|
-
started_at?: string;
|
|
39
|
-
steps?: Array<Record<string, unknown>>;
|
|
40
|
-
validation_results?: Array<Record<string, unknown>>;
|
|
41
|
-
}
|
|
42
|
-
export declare const toAiAccountantEnrollment: (payload: AiAccountantEnrollmentPayload) => AiAccountantEnrollment;
|
|
43
|
-
export declare const toAiAccountantCustomer: (payload: AiAccountantCustomerPayload) => AiAccountantCustomer;
|
|
44
|
-
export declare const toAiAccountantJob: (payload: AiAccountantJobPayload) => AiAccountantJob;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toAiAccountantJob = exports.toAiAccountantCustomer = exports.toAiAccountantEnrollment = void 0;
|
|
4
|
-
const zeniDayJS_1 = require("../../zeniDayJS");
|
|
5
|
-
const aiAccountantCustomerState_1 = require("./aiAccountantCustomerState");
|
|
6
|
-
// ── Mapping functions (payload → state) ──
|
|
7
|
-
const toAiAccountantEnrollment = (payload) => ({
|
|
8
|
-
status: (0, aiAccountantCustomerState_1.toAiAccountantEnrollmentStatus)(payload.status),
|
|
9
|
-
accuracy: payload.accuracy,
|
|
10
|
-
latestTraining: payload.latest_training,
|
|
11
|
-
latestTransactionSync: payload.latest_transaction_sync != null
|
|
12
|
-
? (0, zeniDayJS_1.date)(payload.latest_transaction_sync)
|
|
13
|
-
: undefined,
|
|
14
|
-
offboardedAt: payload.offboarded_at != null ? (0, zeniDayJS_1.date)(payload.offboarded_at) : undefined,
|
|
15
|
-
offboardedBy: payload.offboarded_by,
|
|
16
|
-
onboardedAt: payload.onboarded_at != null ? (0, zeniDayJS_1.date)(payload.onboarded_at) : undefined,
|
|
17
|
-
onboardedBy: payload.onboarded_by,
|
|
18
|
-
validationResults: payload.validation_results?.map((vr) => ({
|
|
19
|
-
accuracy: vr.accuracy,
|
|
20
|
-
modelType: vr.model_type,
|
|
21
|
-
passed: vr.passed,
|
|
22
|
-
threshold: vr.threshold,
|
|
23
|
-
})),
|
|
24
|
-
});
|
|
25
|
-
exports.toAiAccountantEnrollment = toAiAccountantEnrollment;
|
|
26
|
-
const toAiAccountantCustomer = (payload) => ({
|
|
27
|
-
companyId: payload.company_id,
|
|
28
|
-
companyName: payload.company_name,
|
|
29
|
-
tenantId: payload.tenant_id,
|
|
30
|
-
bookcloseDate: payload.bookclose_date != null ? (0, zeniDayJS_1.date)(payload.bookclose_date) : undefined,
|
|
31
|
-
enrollment: payload.enrollment != null
|
|
32
|
-
? (0, exports.toAiAccountantEnrollment)(payload.enrollment)
|
|
33
|
-
: undefined,
|
|
34
|
-
});
|
|
35
|
-
exports.toAiAccountantCustomer = toAiAccountantCustomer;
|
|
36
|
-
const toAiAccountantJob = (payload) => ({
|
|
37
|
-
companyId: payload.company_id,
|
|
38
|
-
createdAt: (0, zeniDayJS_1.date)(payload.created_at),
|
|
39
|
-
jobId: payload.job_id,
|
|
40
|
-
operationType: (0, aiAccountantCustomerState_1.toAiAccountantOperationType)(payload.operation_type),
|
|
41
|
-
status: (0, aiAccountantCustomerState_1.toAiAccountantJobStatus)(payload.status),
|
|
42
|
-
tenantId: payload.tenant_id,
|
|
43
|
-
triggeredBy: payload.triggered_by,
|
|
44
|
-
companyNamespace: payload.company_namespace,
|
|
45
|
-
completedAt: payload.completed_at != null ? (0, zeniDayJS_1.date)(payload.completed_at) : undefined,
|
|
46
|
-
errorMessage: payload.error_message,
|
|
47
|
-
parameters: payload.parameters,
|
|
48
|
-
retryCount: payload.retry_count,
|
|
49
|
-
startedAt: payload.started_at != null ? (0, zeniDayJS_1.date)(payload.started_at) : undefined,
|
|
50
|
-
steps: payload.steps,
|
|
51
|
-
validationResults: payload.validation_results,
|
|
52
|
-
});
|
|
53
|
-
exports.toAiAccountantJob = toAiAccountantJob;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { AiAccountantCustomerPayload, AiAccountantJobPayload } from './aiAccountantCustomerPayload';
|
|
2
|
-
import { AiAccountantCustomerState } from './aiAccountantCustomerState';
|
|
3
|
-
export declare const initialAiAccountantCustomerState: AiAccountantCustomerState;
|
|
4
|
-
export declare const clearAllAiAccountantCustomers: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"aiAccountantCustomer/clearAllAiAccountantCustomers">, updateAiAccountantCustomers: import("@reduxjs/toolkit").ActionCreatorWithPayload<AiAccountantCustomerPayload[], "aiAccountantCustomer/updateAiAccountantCustomers">, updateAiAccountantCustomer: import("@reduxjs/toolkit").ActionCreatorWithPayload<AiAccountantCustomerPayload, "aiAccountantCustomer/updateAiAccountantCustomer">, updateAiAccountantJobs: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, jobs: AiAccountantJobPayload[]], {
|
|
5
|
-
tenantId: string;
|
|
6
|
-
jobs: AiAccountantJobPayload[];
|
|
7
|
-
}, "aiAccountantCustomer/updateAiAccountantJobs", never, never>;
|
|
8
|
-
declare const _default: import("redux").Reducer<AiAccountantCustomerState>;
|
|
9
|
-
export default _default;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var _a;
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.updateAiAccountantJobs = exports.updateAiAccountantCustomer = exports.updateAiAccountantCustomers = exports.clearAllAiAccountantCustomers = exports.initialAiAccountantCustomerState = void 0;
|
|
5
|
-
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
-
const aiAccountantCustomerPayload_1 = require("./aiAccountantCustomerPayload");
|
|
7
|
-
exports.initialAiAccountantCustomerState = {
|
|
8
|
-
customerByTenantId: {},
|
|
9
|
-
jobsByTenantId: {},
|
|
10
|
-
};
|
|
11
|
-
const aiAccountantCustomer = (0, toolkit_1.createSlice)({
|
|
12
|
-
name: 'aiAccountantCustomer',
|
|
13
|
-
initialState: exports.initialAiAccountantCustomerState,
|
|
14
|
-
reducers: {
|
|
15
|
-
updateAiAccountantCustomers(draft, action) {
|
|
16
|
-
action.payload.forEach((payload) => {
|
|
17
|
-
const customer = (0, aiAccountantCustomerPayload_1.toAiAccountantCustomer)(payload);
|
|
18
|
-
draft.customerByTenantId[customer.tenantId] = customer;
|
|
19
|
-
});
|
|
20
|
-
},
|
|
21
|
-
updateAiAccountantCustomer(draft, action) {
|
|
22
|
-
const customer = (0, aiAccountantCustomerPayload_1.toAiAccountantCustomer)(action.payload);
|
|
23
|
-
draft.customerByTenantId[customer.tenantId] = customer;
|
|
24
|
-
},
|
|
25
|
-
updateAiAccountantJobs: {
|
|
26
|
-
reducer(draft, action) {
|
|
27
|
-
draft.jobsByTenantId[action.payload.tenantId] =
|
|
28
|
-
action.payload.jobs.map(aiAccountantCustomerPayload_1.toAiAccountantJob);
|
|
29
|
-
},
|
|
30
|
-
prepare(tenantId, jobs) {
|
|
31
|
-
return { payload: { tenantId, jobs } };
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
clearAllAiAccountantCustomers(draft) {
|
|
35
|
-
Object.assign(draft, exports.initialAiAccountantCustomerState);
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
});
|
|
39
|
-
_a = aiAccountantCustomer.actions, exports.clearAllAiAccountantCustomers = _a.clearAllAiAccountantCustomers, exports.updateAiAccountantCustomers = _a.updateAiAccountantCustomers, exports.updateAiAccountantCustomer = _a.updateAiAccountantCustomer, exports.updateAiAccountantJobs = _a.updateAiAccountantJobs;
|
|
40
|
-
exports.default = aiAccountantCustomer.reducer;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { ID } from '../../commonStateTypes/common';
|
|
2
|
-
import { User } from '../user/userState';
|
|
3
|
-
import { UserState } from '../user/userState';
|
|
4
|
-
import { ZeniDate } from '../../zeniDayJS';
|
|
5
|
-
import { AiAccountantCustomerState, AiAccountantEnrollmentStatus, AiAccountantJobStatus, AiAccountantOperationType } from './aiAccountantCustomerState';
|
|
6
|
-
export interface AiAccountantEnrollmentView {
|
|
7
|
-
status: AiAccountantEnrollmentStatus;
|
|
8
|
-
accuracy?: Record<string, number>;
|
|
9
|
-
latestTraining?: string;
|
|
10
|
-
latestTransactionSync?: ZeniDate;
|
|
11
|
-
offboardedAt?: ZeniDate;
|
|
12
|
-
offboardedBy?: User;
|
|
13
|
-
onboardedAt?: ZeniDate;
|
|
14
|
-
onboardedBy?: User;
|
|
15
|
-
validationResults?: Array<{
|
|
16
|
-
accuracy: number;
|
|
17
|
-
modelType: string;
|
|
18
|
-
passed: boolean;
|
|
19
|
-
threshold: number;
|
|
20
|
-
}>;
|
|
21
|
-
}
|
|
22
|
-
export interface AiAccountantCustomerView {
|
|
23
|
-
companyId: ID;
|
|
24
|
-
companyName: string;
|
|
25
|
-
tenantId: ID;
|
|
26
|
-
bookcloseDate?: ZeniDate;
|
|
27
|
-
enrollment?: AiAccountantEnrollmentView;
|
|
28
|
-
}
|
|
29
|
-
export interface AiAccountantJobView {
|
|
30
|
-
companyId: ID;
|
|
31
|
-
createdAt: ZeniDate;
|
|
32
|
-
jobId: ID;
|
|
33
|
-
operationType: AiAccountantOperationType;
|
|
34
|
-
status: AiAccountantJobStatus;
|
|
35
|
-
tenantId: ID;
|
|
36
|
-
companyNamespace?: string;
|
|
37
|
-
completedAt?: ZeniDate;
|
|
38
|
-
errorMessage?: string;
|
|
39
|
-
parameters?: Record<string, unknown>;
|
|
40
|
-
retryCount?: number;
|
|
41
|
-
startedAt?: ZeniDate;
|
|
42
|
-
steps?: Array<Record<string, unknown>>;
|
|
43
|
-
triggeredBy?: User;
|
|
44
|
-
validationResults?: Array<Record<string, unknown>>;
|
|
45
|
-
}
|
|
46
|
-
export declare function getAiAccountantCustomers(customerState: AiAccountantCustomerState, userState: UserState): AiAccountantCustomerView[];
|
|
47
|
-
export declare function getAiAccountantJobsByTenantId(customerState: AiAccountantCustomerState, userState: UserState, tenantId: string): AiAccountantJobView[];
|