@paro.io/expert-shared-components 1.14.59 → 1.14.60
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/README.md +2 -0
- package/lib/components/DocumentCenter/MultiFileUploadSection.js +121 -220
- package/lib/components/TaxAxis/TaxAxisApi.d.ts +1 -0
- package/lib/components/TaxAxis/TaxAxisShell.js +52 -3
- package/lib/components/shared/UploadClient.d.ts +1 -2
- package/lib/components/shared/UploadClient.js +2 -6
- package/lib/index.d.ts +13 -2
- package/lib/index.js +27 -3
- package/lib/package.json +68 -0
- package/lib/tax-axis/components/clientReport/ExecutiveSummary.d.ts +1 -4
- package/lib/tax-axis/components/clientReport/ExecutiveSummary.js +6 -10
- package/lib/tax-axis/components/clientReport/Methodology.js +2 -2
- package/lib/tax-axis/components/clientReport/RecommendedStrategies.d.ts +1 -6
- package/lib/tax-axis/components/clientReport/RecommendedStrategies.js +24 -26
- package/lib/tax-axis/components/clientReport/StrategyCard.d.ts +1 -1
- package/lib/tax-axis/components/clientReport/StrategyCard.js +23 -39
- package/lib/tax-axis/components/clientReport/TaxAxisClientReport.d.ts +2 -8
- package/lib/tax-axis/components/clientReport/TaxAxisClientReport.js +7 -9
- package/lib/tax-axis/components/dashboard/DashboardActions.js +5 -6
- package/lib/tax-axis/components/dashboard/DashboardSummary.d.ts +1 -6
- package/lib/tax-axis/components/dashboard/DashboardSummary.js +10 -19
- package/lib/tax-axis/components/dashboard/StrategyDetailPanel.d.ts +1 -1
- package/lib/tax-axis/components/dashboard/StrategyDetailPanel.js +95 -122
- package/lib/tax-axis/components/dashboard/TaxAxisDashboard.d.ts +2 -59
- package/lib/tax-axis/components/dashboard/TaxAxisDashboard.js +49 -433
- package/lib/tax-axis/components/documents/DocumentCard.d.ts +3 -8
- package/lib/tax-axis/components/documents/DocumentCard.js +14 -83
- package/lib/tax-axis/components/documents/DocumentTier.d.ts +2 -5
- package/lib/tax-axis/components/documents/DocumentTier.js +2 -2
- package/lib/tax-axis/components/documents/TaxAxisDocuments.d.ts +1 -36
- package/lib/tax-axis/components/documents/TaxAxisDocuments.js +86 -363
- package/lib/tax-axis/components/extractionReview/TaxAxisExtractionReview.js +17 -17
- package/lib/tax-axis/components/intake/ClientParametersSection.js +30 -14
- package/lib/tax-axis/components/intake/CpaIntakeQuestionsSection.js +3 -3
- package/lib/tax-axis/components/intake/IntakeCtaCards.d.ts +2 -1
- package/lib/tax-axis/components/intake/IntakeCtaCards.js +13 -6
- package/lib/tax-axis/components/intake/RefineAnalysisSection.js +7 -7
- package/lib/tax-axis/components/intake/TaxAxisIntake.js +45 -6
- package/lib/tax-axis/components/intake/intakeSchema.d.ts +3 -0
- package/lib/tax-axis/components/intake/intakeSchema.js +4 -2
- package/lib/tax-axis/components/preparerWorkpaper/TaxAxisPreparerWorkpaper.d.ts +2 -26
- package/lib/tax-axis/components/preparerWorkpaper/TaxAxisPreparerWorkpaper.js +4 -15
- package/lib/tax-axis/components/processing/TaxAxisProcessing.d.ts +1 -3
- package/lib/tax-axis/components/processing/TaxAxisProcessing.js +31 -102
- package/lib/tax-axis/components/prospectReport/ProspectPrintView.js +2 -0
- package/lib/tax-axis/components/prospectReport/ProspectStrategyCard.d.ts +8 -1
- package/lib/tax-axis/components/prospectReport/ProspectStrategyCard.js +5 -5
- package/lib/tax-axis/components/prospectReport/TaxAxisProspectReport.d.ts +27 -1
- package/lib/tax-axis/components/prospectReport/TaxAxisProspectReport.js +43 -25
- package/lib/tax-axis/index.d.ts +0 -4
- package/lib/tax-axis/index.js +1 -6
- package/lib/tax-axis/lib/adapters/useEngineOutput.d.ts +13 -138
- package/lib/tax-axis/lib/adapters/useEngineOutput.js +7 -156
- package/lib/tax-axis/lib/data/documents.d.ts +2 -3
- package/lib/tax-axis/lib/data/documents.js +25 -225
- package/lib/tax-axis/lib/data/strategies.js +9 -9
- package/lib/tax-axis/lib/documentFieldCatalog.d.ts +12 -7
- package/lib/tax-axis/lib/documentFieldCatalog.js +8 -805
- package/lib/tax-axis/lib/types/index.d.ts +1 -13
- package/package.json +1 -1
|
@@ -22,29 +22,34 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
26
|
exports.TaxAxisDocuments = TaxAxisDocuments;
|
|
36
27
|
const react_1 = __importStar(require("react"));
|
|
37
28
|
const documents_1 = require("../../lib/data/documents");
|
|
38
29
|
const TaxAxisButton_1 = require("../shared/TaxAxisButton");
|
|
39
30
|
const DocumentTier_1 = require("./DocumentTier");
|
|
40
|
-
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
31
|
+
// Stub filenames assigned when the user clicks "Upload" (mock App.jsx:1237)
|
|
32
|
+
const STUB_FILENAMES = {
|
|
33
|
+
"1120s": "2025_1120S.pdf",
|
|
34
|
+
"state-return": "2025_State_Return.pdf",
|
|
35
|
+
"payroll": "2025_Payroll.xlsx",
|
|
36
|
+
"pnl": "QBO_PnL_2025.pdf",
|
|
37
|
+
"balance": "QBO_BS_2025.pdf",
|
|
38
|
+
"cashflow": "QBO_CashFlow_2025.pdf",
|
|
39
|
+
"fixed-assets": "Fixed_Assets.xlsx",
|
|
40
|
+
"prior-returns": "Prior_Returns.pdf",
|
|
41
|
+
};
|
|
42
|
+
// Short help text shown below each doc name when not yet uploaded
|
|
43
|
+
// (mock App.jsx:1384). Overrides the longer DOC_SPECS_BASE.help.
|
|
44
|
+
const HELP_OVERRIDES = {
|
|
45
|
+
"1120s": "Improves accuracy of every strategy",
|
|
46
|
+
"payroll": "Critical for Entity Structure and QBI calculations",
|
|
47
|
+
"fixed-assets": "Unlocks Cost Segregation (potential $15K\u201385K)",
|
|
48
|
+
"state-return": "If client operates in income-tax states",
|
|
49
|
+
"cashflow": "Helps with income deferral and timing strategies",
|
|
50
|
+
"prior-returns": "Improves confidence intervals (more years = tighter estimates)",
|
|
51
|
+
};
|
|
52
|
+
// Tier groupings from mock (App.jsx:1379-1383)
|
|
48
53
|
const TIER_DEFS = [
|
|
49
54
|
{
|
|
50
55
|
key: "required",
|
|
@@ -54,7 +59,7 @@ const TIER_DEFS = [
|
|
|
54
59
|
labelColor: "#C53030",
|
|
55
60
|
badgeColor: "red",
|
|
56
61
|
badgeText: "REQUIRED",
|
|
57
|
-
ids: [],
|
|
62
|
+
ids: ["pnl", "balance"],
|
|
58
63
|
},
|
|
59
64
|
{
|
|
60
65
|
key: "recommended",
|
|
@@ -64,7 +69,7 @@ const TIER_DEFS = [
|
|
|
64
69
|
labelColor: "#FB9A1D",
|
|
65
70
|
badgeColor: "orange",
|
|
66
71
|
badgeText: "RECOMMENDED",
|
|
67
|
-
ids: [],
|
|
72
|
+
ids: ["1120s", "payroll", "fixed-assets"],
|
|
68
73
|
},
|
|
69
74
|
{
|
|
70
75
|
key: "conditional",
|
|
@@ -74,361 +79,79 @@ const TIER_DEFS = [
|
|
|
74
79
|
labelColor: "#C8CCE5",
|
|
75
80
|
badgeColor: "neutral",
|
|
76
81
|
badgeText: "CONDITIONAL",
|
|
77
|
-
ids: [],
|
|
82
|
+
ids: ["state-return", "cashflow", "prior-returns"],
|
|
78
83
|
},
|
|
79
84
|
];
|
|
80
|
-
function TaxAxisDocuments({ profile,
|
|
81
|
-
|
|
82
|
-
const
|
|
83
|
-
//
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
.filter((s) => s.tier === def.key)
|
|
87
|
-
.map((s) => s.id) })));
|
|
88
|
-
}, [docSpecs]);
|
|
89
|
-
const [docs, setDocs] = (0, react_1.useState)(() => docSpecs.map((s) => (Object.assign(Object.assign({}, s), { status: "empty", fileName: null, parseError: null }))));
|
|
90
|
-
const [uploadedDocIds, setUploadedDocIds] = (0, react_1.useState)({});
|
|
91
|
-
const [continueError, setContinueError] = (0, react_1.useState)(null);
|
|
92
|
-
const [reviewDocId, setReviewDocId] = (0, react_1.useState)(null);
|
|
93
|
-
// parsedData keyed by documentType (e.g. "profit_loss") — populated from poll results
|
|
94
|
-
const [parsedDataByDocType, setParsedDataByDocType] = (0, react_1.useState)({});
|
|
95
|
-
// reviewedData keyed by documentType — populated after CPA saves corrections; takes priority over parsedData in modal
|
|
96
|
-
const [reviewedDataByDocType, setReviewedDataByDocType] = (0, react_1.useState)({});
|
|
97
|
-
// FIX A: handler for QBO import completion — updates doc card state and refreshes parsedData
|
|
98
|
-
const handleQboImportComplete = (0, react_1.useCallback)((mappedDocs) => {
|
|
99
|
-
setDocs((prev) => prev.map((d) => {
|
|
100
|
-
const match = mappedDocs.find((m) => m.slot === (d.documentType || d.id));
|
|
101
|
-
if (!match)
|
|
102
|
-
return d;
|
|
103
|
-
return Object.assign(Object.assign({}, d), { status: "valid", qboSource: true, fileName: match.fileName, parseError: null });
|
|
104
|
-
}));
|
|
105
|
-
// Refresh parsedData so the review modal has data immediately after import
|
|
106
|
-
if (fetchUploadedDocuments) {
|
|
107
|
-
fetchUploadedDocuments().then((uploaded) => {
|
|
108
|
-
const parsedByType = {};
|
|
109
|
-
for (const doc of uploaded) {
|
|
110
|
-
if (doc.documentType && doc.parsedData) {
|
|
111
|
-
parsedByType[doc.documentType] = doc.parsedData;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
if (Object.keys(parsedByType).length > 0) {
|
|
115
|
-
setParsedDataByDocType((prev) => (Object.assign(Object.assign({}, prev), parsedByType)));
|
|
116
|
-
}
|
|
117
|
-
}).catch(() => { });
|
|
118
|
-
}
|
|
119
|
-
if (onQboImport)
|
|
120
|
-
onQboImport(mappedDocs);
|
|
121
|
-
}, [onQboImport, fetchUploadedDocuments]);
|
|
122
|
-
// QBO connect flow
|
|
123
|
-
const qboFlow = (0, useQboFlow_1.useQboFlow)({
|
|
124
|
-
qboConnected,
|
|
125
|
-
qboCompanyName,
|
|
126
|
-
qboAuthorizeUrl,
|
|
127
|
-
onImportQboReport,
|
|
128
|
-
fetchUploadedDocuments,
|
|
129
|
-
sessionId: jobId,
|
|
130
|
-
profileYear: (profile === null || profile === void 0 ? void 0 : profile.year) ? Number(profile.year) : undefined,
|
|
131
|
-
onQboConnected,
|
|
132
|
-
onQboDisconnected,
|
|
133
|
-
onQboImportComplete: handleQboImportComplete,
|
|
134
|
-
});
|
|
135
|
-
const showQboBanner = !!qboAuthorizeUrl || qboConnected;
|
|
136
|
-
// FIX B: gate document list behind QBO client confirmation or manual skip
|
|
137
|
-
const [clientConfirmed, setClientConfirmed] = (0, react_1.useState)(!!(qboClientConfirmed || qboConnected || !showQboBanner));
|
|
138
|
-
// Sync when qboConnected prop updates (e.g. localStorage restore in parent)
|
|
139
|
-
(0, react_1.useEffect)(() => {
|
|
140
|
-
if (qboConnected)
|
|
141
|
-
setClientConfirmed(true);
|
|
142
|
-
}, [qboConnected]);
|
|
143
|
-
// On mount, restore card state from any already-uploaded documents in this session.
|
|
144
|
-
// This runs whenever the user re-enters the DOCUMENT_UPLOAD step (e.g. after an
|
|
145
|
-
// eval failure) so previously uploaded files appear as valid/failed instead of empty.
|
|
146
|
-
(0, react_1.useEffect)(() => {
|
|
147
|
-
if (!fetchUploadedDocuments)
|
|
148
|
-
return;
|
|
149
|
-
fetchUploadedDocuments().then((uploaded) => {
|
|
150
|
-
if (!uploaded.length)
|
|
151
|
-
return;
|
|
152
|
-
const parsedByType = {};
|
|
153
|
-
const reviewedByType = {};
|
|
154
|
-
const nextDocIds = {};
|
|
155
|
-
setDocs((prev) => prev.map((docState, idx) => {
|
|
156
|
-
// Match by documentType (canonical key) — find the most recently updated upload
|
|
157
|
-
const candidates = uploaded.filter((u) => String(u.documentType || '').toLowerCase() === (docState.documentType || docState.id).toLowerCase());
|
|
158
|
-
const match = candidates.sort((a, b) => new Date(String(b.updatedAt || 0)).getTime() - new Date(String(a.updatedAt || 0)).getTime())[0];
|
|
159
|
-
if (!match)
|
|
160
|
-
return docState;
|
|
161
|
-
// Populate uploadedDocIds for delete/review actions
|
|
162
|
-
if (match.documentId) {
|
|
163
|
-
nextDocIds[idx] = match.documentId;
|
|
164
|
-
}
|
|
165
|
-
const apiStatus = String(match.status || '').toUpperCase();
|
|
166
|
-
const nextStatus = apiStatus === 'PARSED' ? 'valid' :
|
|
167
|
-
apiStatus === 'FAILED' ? 'failed' :
|
|
168
|
-
apiStatus === 'PARSING' || apiStatus === 'UPLOADED' ? 'parsing' :
|
|
169
|
-
docState.status;
|
|
170
|
-
return Object.assign(Object.assign({}, docState), { status: nextStatus, fileName: match.fileName || docState.fileName, parseError: match.parseError || null });
|
|
171
|
-
}));
|
|
172
|
-
// Populate document ID map in one batch
|
|
173
|
-
setUploadedDocIds((prev) => (Object.assign(Object.assign({}, prev), nextDocIds)));
|
|
174
|
-
// Populate review modal data
|
|
175
|
-
for (const doc of uploaded) {
|
|
176
|
-
if (!doc.documentType)
|
|
177
|
-
continue;
|
|
178
|
-
if (doc.parsedData)
|
|
179
|
-
parsedByType[doc.documentType] = doc.parsedData;
|
|
180
|
-
if (doc.reviewedData && Object.keys(doc.reviewedData).length > 0) {
|
|
181
|
-
reviewedByType[doc.documentType] = doc.reviewedData;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
if (Object.keys(parsedByType).length > 0)
|
|
185
|
-
setParsedDataByDocType(parsedByType);
|
|
186
|
-
if (Object.keys(reviewedByType).length > 0)
|
|
187
|
-
setReviewedDataByDocType(reviewedByType);
|
|
188
|
-
}).catch(() => { });
|
|
189
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
190
|
-
}, []);
|
|
191
|
-
const reviewDoc = reviewDocId
|
|
192
|
-
? (_a = docs.find((d) => d.id === reviewDocId)) !== null && _a !== void 0 ? _a : null
|
|
193
|
-
: null;
|
|
194
|
-
// Prefer reviewedData (CPA-corrected) over parsedData (raw LLM extraction)
|
|
195
|
-
const reviewParsedData = reviewDoc
|
|
196
|
-
? ((_e = (_d = (_c = (_b = reviewedDataByDocType[reviewDoc.documentType || reviewDoc.id]) !== null && _b !== void 0 ? _b : reviewedDataByDocType[reviewDoc.id]) !== null && _c !== void 0 ? _c : parsedDataByDocType[reviewDoc.documentType || reviewDoc.id]) !== null && _d !== void 0 ? _d : parsedDataByDocType[reviewDoc.id]) !== null && _e !== void 0 ? _e : null)
|
|
197
|
-
: null;
|
|
198
|
-
const pollForParseStatus = (idx, fileName, documentType) => __awaiter(this, void 0, void 0, function* () {
|
|
199
|
-
if (!fetchUploadedDocuments)
|
|
200
|
-
return;
|
|
201
|
-
const maxAttempts = 80;
|
|
202
|
-
const pollIntervalMs = 1500;
|
|
203
|
-
for (let attempt = 0; attempt < maxAttempts; attempt += 1) {
|
|
204
|
-
try {
|
|
205
|
-
const uploaded = yield fetchUploadedDocuments();
|
|
206
|
-
// Match by documentType first (exact lowercase key), fall back to fileName.
|
|
207
|
-
const typeMatch = uploaded.filter((doc) => doc.fileName === fileName &&
|
|
208
|
-
String(doc.documentType || "").toLowerCase() === documentType.toLowerCase());
|
|
209
|
-
const nameMatch = uploaded.filter((doc) => doc.fileName === fileName);
|
|
210
|
-
const candidates = typeMatch.length > 0 ? typeMatch : nameMatch;
|
|
211
|
-
const match = candidates
|
|
212
|
-
.slice()
|
|
213
|
-
.sort((a, b) => new Date(String(b.updatedAt || "")).getTime() -
|
|
214
|
-
new Date(String(a.updatedAt || "")).getTime())[0];
|
|
215
|
-
if (match) {
|
|
216
|
-
const status = String(match.status || "").toUpperCase();
|
|
217
|
-
if (status === "FAILED") {
|
|
218
|
-
setDocs((prev) => prev.map((d, i) => i === idx
|
|
219
|
-
? Object.assign(Object.assign({}, d), { status: "failed", fileName, parseError: match.parseError || "Parsing failed. Try a different file." }) : d));
|
|
220
|
-
return;
|
|
221
|
-
}
|
|
222
|
-
if (status === "PARSED") {
|
|
223
|
-
setDocs((prev) => prev.map((d, i) => i === idx
|
|
224
|
-
? Object.assign(Object.assign({}, d), { status: "valid", fileName, parseError: null }) : d));
|
|
225
|
-
if (match.parsedData && documentType) {
|
|
226
|
-
setParsedDataByDocType((prev) => (Object.assign(Object.assign({}, prev), { [documentType]: match.parsedData })));
|
|
227
|
-
}
|
|
228
|
-
return;
|
|
229
|
-
}
|
|
230
|
-
if (status === "PARSING" || status === "UPLOADED") {
|
|
231
|
-
setDocs((prev) => prev.map((d, i) => i === idx
|
|
232
|
-
? Object.assign(Object.assign({}, d), { status: "parsing", fileName }) : d));
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
catch (_pollError) {
|
|
237
|
-
// keep polling
|
|
238
|
-
}
|
|
239
|
-
yield new Promise((resolve) => setTimeout(resolve, pollIntervalMs));
|
|
240
|
-
}
|
|
241
|
-
setDocs((prev) => prev.map((d, i) => i === idx ? Object.assign(Object.assign({}, d), { status: "failed", fileName, parseError: "Parsing timed out. Please try again." }) : d));
|
|
242
|
-
});
|
|
243
|
-
const handleUpload = (idx, file) => __awaiter(this, void 0, void 0, function* () {
|
|
244
|
-
const selectedDoc = docs[idx];
|
|
245
|
-
if (!selectedDoc)
|
|
246
|
-
return;
|
|
247
|
-
setContinueError(null);
|
|
85
|
+
function TaxAxisDocuments({ profile, onContinue, onBack, userContext: _userContext = "expert", }) {
|
|
86
|
+
const docSpecs = (0, react_1.useMemo)(() => (0, documents_1.getDocSpecs)(profile), [profile]);
|
|
87
|
+
const [docs, setDocs] = (0, react_1.useState)(() => docSpecs.map((s) => (Object.assign(Object.assign({}, s), { status: "empty", fileName: null }))));
|
|
88
|
+
// Stub upload: empty -> validating -> valid after a short delay
|
|
89
|
+
// (mock App.jsx:1238-1241)
|
|
90
|
+
const handleUpload = (idx) => {
|
|
248
91
|
setDocs((prev) => prev.map((d, i) => i === idx
|
|
249
|
-
? Object.assign(Object.assign({}, d), { status: "validating", fileName:
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
? yield onUploadDocument(selectedDoc, file)
|
|
253
|
-
: undefined;
|
|
254
|
-
const nextFileName = file.name;
|
|
255
|
-
// Use the canonical documentType from the catalog entry.
|
|
256
|
-
const documentType = selectedDoc.documentType;
|
|
257
|
-
const immediateStatus = String((uploadResult === null || uploadResult === void 0 ? void 0 : uploadResult.status) || "").toUpperCase();
|
|
258
|
-
if (uploadResult === null || uploadResult === void 0 ? void 0 : uploadResult.documentId) {
|
|
259
|
-
setUploadedDocIds((prev) => (Object.assign(Object.assign({}, prev), { [idx]: uploadResult.documentId })));
|
|
260
|
-
}
|
|
261
|
-
if (immediateStatus === "PARSED") {
|
|
262
|
-
setDocs((prev) => prev.map((d, i) => i === idx
|
|
263
|
-
? Object.assign(Object.assign({}, d), { status: "valid", fileName: (uploadResult === null || uploadResult === void 0 ? void 0 : uploadResult.fileName) || nextFileName, parseError: null }) : d));
|
|
264
|
-
// parsedData is not on the upload mutation response — fetch it now via one poll call.
|
|
265
|
-
if (fetchUploadedDocuments && documentType) {
|
|
266
|
-
try {
|
|
267
|
-
const uploaded = yield fetchUploadedDocuments();
|
|
268
|
-
const match = uploaded.find((d) => String(d.documentType || "").toLowerCase() === documentType.toLowerCase());
|
|
269
|
-
if (match === null || match === void 0 ? void 0 : match.parsedData) {
|
|
270
|
-
setParsedDataByDocType((prev) => (Object.assign(Object.assign({}, prev), { [documentType]: match.parsedData })));
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
catch (_a) {
|
|
274
|
-
// non-fatal — user can still open modal, will show empty state
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
return;
|
|
278
|
-
}
|
|
279
|
-
if (immediateStatus === "FAILED") {
|
|
280
|
-
setDocs((prev) => prev.map((d, i) => i === idx
|
|
281
|
-
? Object.assign(Object.assign({}, d), { status: "failed", fileName: (uploadResult === null || uploadResult === void 0 ? void 0 : uploadResult.fileName) || nextFileName, parseError: (uploadResult === null || uploadResult === void 0 ? void 0 : uploadResult.parseError) || "Parsing failed. Please upload a correct document." }) : d));
|
|
282
|
-
return;
|
|
283
|
-
}
|
|
284
|
-
setDocs((prev) => prev.map((d, i) => i === idx ? Object.assign(Object.assign({}, d), { status: "parsing", fileName: nextFileName }) : d));
|
|
285
|
-
yield pollForParseStatus(idx, nextFileName, documentType);
|
|
286
|
-
}
|
|
287
|
-
catch (uploadError) {
|
|
288
|
-
const errorMessage = uploadError instanceof Error
|
|
289
|
-
? uploadError.message
|
|
290
|
-
: "Upload failed. Please try again.";
|
|
291
|
-
setDocs((prev) => prev.map((d, i) => i === idx
|
|
292
|
-
? Object.assign(Object.assign({}, d), { status: "failed", parseError: errorMessage }) : d));
|
|
293
|
-
}
|
|
294
|
-
});
|
|
92
|
+
? Object.assign(Object.assign({}, d), { status: "validating", fileName: STUB_FILENAMES[d.id] || "document.pdf" }) : d));
|
|
93
|
+
setTimeout(() => setDocs((prev) => prev.map((d, i) => i === idx ? Object.assign(Object.assign({}, d), { status: "valid" }) : d)), 500 + Math.random() * 400);
|
|
94
|
+
};
|
|
295
95
|
const handleClear = (idx) => {
|
|
296
96
|
setDocs((prev) => prev.map((d, i) => i === idx
|
|
297
|
-
? Object.assign(Object.assign({}, d), { status: "empty", fileName: null
|
|
298
|
-
setContinueError(null);
|
|
97
|
+
? Object.assign(Object.assign({}, d), { status: "empty", fileName: null }) : d));
|
|
299
98
|
};
|
|
300
|
-
const handleRemove = (idx) => __awaiter(this, void 0, void 0, function* () {
|
|
301
|
-
const docId = uploadedDocIds[idx];
|
|
302
|
-
if (docId && onDeleteDocument) {
|
|
303
|
-
try {
|
|
304
|
-
yield onDeleteDocument(docId);
|
|
305
|
-
}
|
|
306
|
-
catch (_deleteError) {
|
|
307
|
-
// clear from UI even if backend delete fails
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
setUploadedDocIds((prev) => {
|
|
311
|
-
const next = Object.assign({}, prev);
|
|
312
|
-
delete next[idx];
|
|
313
|
-
return next;
|
|
314
|
-
});
|
|
315
|
-
handleClear(idx);
|
|
316
|
-
});
|
|
317
|
-
const handleContinue = () => __awaiter(this, void 0, void 0, function* () {
|
|
318
|
-
const failedDocs = docs.filter((d) => d.status === "failed");
|
|
319
|
-
if (failedDocs.length > 0) {
|
|
320
|
-
const names = failedDocs.map((d) => d.name).join(", ");
|
|
321
|
-
setContinueError(`Cannot continue — ${failedDocs.length === 1 ? "this document has" : "these documents have"} errors: ${names}. Please re-upload correct files or remove them.`);
|
|
322
|
-
return;
|
|
323
|
-
}
|
|
324
|
-
setContinueError(null);
|
|
325
|
-
// For every parsed doc that was not manually reviewed, persist parsedData.fields
|
|
326
|
-
// as reviewedData so the engine always has a reviewedData record to read from.
|
|
327
|
-
if (onSaveReviewedField) {
|
|
328
|
-
const validDocs = docs.filter((d) => d.status === "valid");
|
|
329
|
-
yield Promise.all(validDocs.map((doc) => __awaiter(this, void 0, void 0, function* () {
|
|
330
|
-
var _a;
|
|
331
|
-
const idx = docs.indexOf(doc);
|
|
332
|
-
const documentId = uploadedDocIds[idx];
|
|
333
|
-
if (!documentId)
|
|
334
|
-
return;
|
|
335
|
-
const parsed = parsedDataByDocType[doc.documentType || doc.id];
|
|
336
|
-
if (!parsed)
|
|
337
|
-
return;
|
|
338
|
-
const fields = ((_a = parsed.fields) !== null && _a !== void 0 ? _a : parsed);
|
|
339
|
-
// Convert all scalar values to strings for reviewedData
|
|
340
|
-
const reviewedFields = {};
|
|
341
|
-
for (const [k, v] of Object.entries(fields)) {
|
|
342
|
-
if (v !== null && v !== undefined && typeof v !== "object") {
|
|
343
|
-
reviewedFields[k] = v;
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
if (Object.keys(reviewedFields).length > 0) {
|
|
347
|
-
try {
|
|
348
|
-
yield onSaveReviewedField(documentId, reviewedFields);
|
|
349
|
-
}
|
|
350
|
-
catch ( /* non-fatal */_b) { /* non-fatal */ }
|
|
351
|
-
}
|
|
352
|
-
})));
|
|
353
|
-
}
|
|
354
|
-
onContinue();
|
|
355
|
-
});
|
|
356
99
|
const validCount = docs.filter((d) => d.status === "valid").length;
|
|
357
|
-
const
|
|
358
|
-
const
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
100
|
+
const requiredCount = docs.filter((d) => d.required === true).length;
|
|
101
|
+
const requiredValid = docs.filter((d) => d.required === true && d.status === "valid").length;
|
|
102
|
+
// Coverage heuristic from mock (App.jsx:1361)
|
|
103
|
+
const coveragePct = validCount === 0
|
|
104
|
+
? 32
|
|
105
|
+
: validCount === 1
|
|
106
|
+
? 50
|
|
107
|
+
: validCount === 2
|
|
108
|
+
? 60
|
|
109
|
+
: validCount <= 4
|
|
110
|
+
? 75
|
|
111
|
+
: validCount <= 6
|
|
112
|
+
? 90
|
|
364
113
|
: 100;
|
|
365
114
|
const strategiesCovered = Math.round((25 * coveragePct) / 100);
|
|
366
115
|
return (react_1.default.createElement("div", { className: "max-w-[580px] mx-auto" },
|
|
367
116
|
react_1.default.createElement("div", { className: "text-center mb-5 pt-5" },
|
|
368
117
|
react_1.default.createElement("h1", { className: "text-[28px] font-bold text-white font-tax-axis-head mb-1.5" }, "Source Documents"),
|
|
369
118
|
react_1.default.createElement("p", { className: "text-sm text-tax-axis-text-2 font-tax-axis-body" }, "Upload documents to run the full analysis.")),
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
"
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
"
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
react_1.default.createElement("
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
border: "1px solid rgba(197,48,48,0.3)",
|
|
409
|
-
color: "#FEB2B2",
|
|
410
|
-
} }, continueError)),
|
|
411
|
-
tierDefs.map((tier) => (react_1.default.createElement(DocumentTier_1.DocumentTier, { key: tier.key, tier: tier, docs: docs, helpOverrides: {}, fieldCounts: parsedFieldCounts, onUpload: handleUpload, onClear: handleClear, onRemove: handleRemove, onReview: (docId) => setReviewDocId(docId) }))),
|
|
412
|
-
react_1.default.createElement("div", { className: "flex gap-3 mt-6" },
|
|
413
|
-
react_1.default.createElement(TaxAxisButton_1.TaxAxisButton, { variant: "secondary", onClick: onBack }, "Back"),
|
|
414
|
-
react_1.default.createElement(TaxAxisButton_1.TaxAxisButton, { onClick: handleContinue, className: "flex-1", disabled: busyCount > 0 }, busyCount > 0
|
|
415
|
-
? "Processing..."
|
|
416
|
-
: failedCount > 0
|
|
417
|
-
? `Continue (${failedCount} failed)`
|
|
418
|
-
: "Continue")))),
|
|
419
|
-
reviewDoc && (react_1.default.createElement(DocumentReviewModal_1.DocumentReviewModal, { documentId: reviewDoc.id, documentName: reviewDoc.name, fileName: reviewDoc.fileName || "", jobId: jobId, parsedData: reviewParsedData, onSaveReviewedData: onSaveReviewedField
|
|
420
|
-
? (fields) => __awaiter(this, void 0, void 0, function* () {
|
|
421
|
-
const docId = uploadedDocIds[docs.indexOf(reviewDoc)];
|
|
422
|
-
if (docId)
|
|
423
|
-
yield onSaveReviewedField(docId, fields);
|
|
424
|
-
// Store locally so reopening the modal shows corrected values
|
|
425
|
-
const docTypeKey = reviewDoc.documentType || reviewDoc.id;
|
|
426
|
-
setReviewedDataByDocType((prev) => (Object.assign(Object.assign({}, prev), { [docTypeKey]: fields })));
|
|
427
|
-
})
|
|
428
|
-
: undefined, onClose: () => setReviewDocId(null) })),
|
|
429
|
-
react_1.default.createElement(QboPermissionsModal_1.QboPermissionsModal, { open: qboFlow.modalStep === "permissions", onCancel: qboFlow.closeModal, onContinue: qboFlow.handlePermissionsContinue }),
|
|
430
|
-
react_1.default.createElement(QboClientSelectorModal_1.QboClientSelectorModal, { open: qboFlow.modalStep === "client_selector", companies: qboFlow.companies, onCancel: qboFlow.closeModal, onSelect: qboFlow.handleCompanySelected }),
|
|
431
|
-
react_1.default.createElement(QboAvailableReportsModal_1.QboAvailableReportsModal, { open: qboFlow.modalStep === "available_reports", companyName: ((_f = qboFlow.selectedCompany) === null || _f === void 0 ? void 0 : _f.name) || "", selectedYear: qboFlow.selectedYear, onYearChange: qboFlow.setSelectedYear, onCancel: qboFlow.closeModal, onConfirm: qboFlow.handleReportsConfirmed }),
|
|
432
|
-
react_1.default.createElement(QboDocumentMappingModal_1.QboDocumentMappingModal, { open: qboFlow.modalStep === "mapping", companyName: ((_g = qboFlow.selectedCompany) === null || _g === void 0 ? void 0 : _g.name) || "", selectedReports: qboFlow.selectedReports, onCancel: qboFlow.closeModal, onConfirm: qboFlow.handleMappingConfirm }),
|
|
433
|
-
react_1.default.createElement(QboImportingModal_1.QboImportingModal, { open: qboFlow.modalStep === "importing", currentStepIndex: qboFlow.importStepIndex, companyName: ((_h = qboFlow.selectedCompany) === null || _h === void 0 ? void 0 : _h.name) || "" })));
|
|
119
|
+
react_1.default.createElement("div", { className: "py-3.5 px-[18px] mb-4 text-xs leading-relaxed font-tax-axis-body", style: {
|
|
120
|
+
background: "#171B44",
|
|
121
|
+
borderLeft: "3px solid #248384",
|
|
122
|
+
borderRadius: "0 8px 8px 0",
|
|
123
|
+
color: "#E6E8F5",
|
|
124
|
+
} }, "The minimum to run an analysis is the current-year P&L and Balance Sheet. However, accuracy and strategy coverage improve significantly with additional documents \u2014 particularly the federal tax return, fixed asset schedule, and W-2 forms."),
|
|
125
|
+
react_1.default.createElement("div", { className: "bg-tax-axis-surface border border-tax-axis-border rounded-[10px] px-[18px] py-3.5 mb-4" },
|
|
126
|
+
react_1.default.createElement("div", { className: "text-[10px] font-bold text-tax-axis-text-3 uppercase tracking-widest mb-2.5 font-tax-axis-mono" }, "Analysis Coverage"),
|
|
127
|
+
react_1.default.createElement("div", { className: "flex justify-between mb-1.5" },
|
|
128
|
+
react_1.default.createElement("span", { className: "text-xs text-tax-axis-text-2 font-tax-axis-body" },
|
|
129
|
+
"Documents uploaded:",
|
|
130
|
+
" ",
|
|
131
|
+
react_1.default.createElement("strong", { className: "text-white" },
|
|
132
|
+
validCount,
|
|
133
|
+
" / ",
|
|
134
|
+
docs.length)),
|
|
135
|
+
react_1.default.createElement("span", { className: "text-xs text-tax-axis-text-2 font-tax-axis-body" },
|
|
136
|
+
"Strategies covered:",
|
|
137
|
+
" ",
|
|
138
|
+
react_1.default.createElement("strong", { className: "text-tax-axis-teal-light" },
|
|
139
|
+
strategiesCovered,
|
|
140
|
+
" / 25"))),
|
|
141
|
+
react_1.default.createElement("div", { className: "h-1.5 bg-tax-axis-surface-2 rounded-sm overflow-hidden mb-1.5" },
|
|
142
|
+
react_1.default.createElement("div", { className: "h-full rounded-sm transition-[width] duration-[400ms]", style: {
|
|
143
|
+
width: `${coveragePct}%`,
|
|
144
|
+
background: "linear-gradient(90deg, #248384, #A1E5E6)",
|
|
145
|
+
} })),
|
|
146
|
+
react_1.default.createElement("div", { className: "flex justify-between" },
|
|
147
|
+
react_1.default.createElement("span", { className: "text-[10px] text-tax-axis-text-4 font-tax-axis-mono" },
|
|
148
|
+
coveragePct,
|
|
149
|
+
"% coverage"),
|
|
150
|
+
validCount < docs.length && (react_1.default.createElement("span", { className: "text-[10px] text-tax-axis-text-4 font-tax-axis-body" }, "Upload more documents to increase strategy coverage")))),
|
|
151
|
+
TIER_DEFS.map((tier) => (react_1.default.createElement(DocumentTier_1.DocumentTier, { key: tier.key, tier: tier, docs: docs, helpOverrides: HELP_OVERRIDES, onUpload: handleUpload, onClear: handleClear }))),
|
|
152
|
+
react_1.default.createElement("div", { className: "flex gap-3 mt-6" },
|
|
153
|
+
react_1.default.createElement(TaxAxisButton_1.TaxAxisButton, { variant: "secondary", onClick: onBack }, "Back"),
|
|
154
|
+
react_1.default.createElement(TaxAxisButton_1.TaxAxisButton, { onClick: onContinue, disabled: requiredCount > requiredValid, className: "flex-1" }, requiredCount > requiredValid
|
|
155
|
+
? `Upload ${requiredCount - requiredValid} more required doc${requiredCount - requiredValid > 1 ? "s" : ""}`
|
|
156
|
+
: "Run Analysis"))));
|
|
434
157
|
}
|
|
@@ -89,22 +89,6 @@ function TaxAxisExtractionReview({ onStatusChange, onConfirmAndUnlock, onBack, }
|
|
|
89
89
|
return (react_1.default.createElement("div", null,
|
|
90
90
|
react_1.default.createElement("style", null, `@keyframes spin{to{transform:rotate(360deg)}}`),
|
|
91
91
|
react_1.default.createElement(PurposeBlock_1.PurposeBlock, { totalFields: totalFields, totalDocs: data_1.EXTRACTED_DATA.length }),
|
|
92
|
-
onConfirmAndUnlock && (react_1.default.createElement("div", { style: {
|
|
93
|
-
marginBottom: 16,
|
|
94
|
-
background: "linear-gradient(135deg, rgba(36,131,132,0.12), rgba(36,131,132,0.06))",
|
|
95
|
-
border: "1px solid rgba(36,131,132,0.3)",
|
|
96
|
-
borderRadius: 12,
|
|
97
|
-
padding: "18px 20px",
|
|
98
|
-
} },
|
|
99
|
-
react_1.default.createElement("div", { className: "flex items-center gap-4" },
|
|
100
|
-
react_1.default.createElement("div", { className: "flex-1" },
|
|
101
|
-
react_1.default.createElement("div", { className: "text-[15px] font-bold text-white font-tax-axis-head mb-1" }, "Ready to view your report?"),
|
|
102
|
-
react_1.default.createElement("div", { className: "text-[13px] text-tax-axis-text leading-relaxed font-tax-axis-body" }, totalFlags - totalEdits > 0
|
|
103
|
-
? (totalFlags - totalEdits) + " value" + (totalFlags - totalEdits > 1 ? "s" : "") + " still flagged. You can confirm now or correct values first."
|
|
104
|
-
: "All extracted values look good. Confirm to unlock the Intelligence Report.")),
|
|
105
|
-
react_1.default.createElement("div", { className: "flex gap-2.5" },
|
|
106
|
-
onBack && (react_1.default.createElement(TaxAxisButton_1.TaxAxisButton, { variant: "secondary", onClick: onBack }, "Back to Dashboard")),
|
|
107
|
-
react_1.default.createElement(TaxAxisButton_1.TaxAxisButton, { onClick: onConfirmAndUnlock }, totalFlags - totalEdits > 0 ? "Confirm & Unlock Report" : "Confirm & View Report"))))),
|
|
108
92
|
react_1.default.createElement("div", { style: { display: "flex", alignItems: "center", gap: 10, marginBottom: 12 } },
|
|
109
93
|
react_1.default.createElement("div", { style: {
|
|
110
94
|
width: 8,
|
|
@@ -182,5 +166,21 @@ function TaxAxisExtractionReview({ onStatusChange, onConfirmAndUnlock, onBack, }
|
|
|
182
166
|
borderRadius: 4,
|
|
183
167
|
border: "1px solid #2E3160",
|
|
184
168
|
} }, d.code))))))),
|
|
185
|
-
react_1.default.createElement(RerunFooter_1.RerunFooter, { totalEdits: totalEdits, rerunning: rerunning, onRerun: handleRerun })
|
|
169
|
+
react_1.default.createElement(RerunFooter_1.RerunFooter, { totalEdits: totalEdits, rerunning: rerunning, onRerun: handleRerun }),
|
|
170
|
+
onConfirmAndUnlock && (react_1.default.createElement("div", { style: {
|
|
171
|
+
marginTop: 16,
|
|
172
|
+
background: "linear-gradient(135deg, rgba(36,131,132,0.12), rgba(36,131,132,0.06))",
|
|
173
|
+
border: "1px solid rgba(36,131,132,0.3)",
|
|
174
|
+
borderRadius: 12,
|
|
175
|
+
padding: "18px 20px",
|
|
176
|
+
} },
|
|
177
|
+
react_1.default.createElement("div", { className: "flex items-center gap-4" },
|
|
178
|
+
react_1.default.createElement("div", { className: "flex-1" },
|
|
179
|
+
react_1.default.createElement("div", { className: "text-[15px] font-bold text-white font-tax-axis-head mb-1" }, "Ready to view your report?"),
|
|
180
|
+
react_1.default.createElement("div", { className: "text-[13px] text-tax-axis-text leading-relaxed font-tax-axis-body" }, totalFlags - totalEdits > 0
|
|
181
|
+
? (totalFlags - totalEdits) + " value" + (totalFlags - totalEdits > 1 ? "s" : "") + " still flagged. You can confirm now or correct values first."
|
|
182
|
+
: "All extracted values look good. Confirm to unlock the Intelligence Report.")),
|
|
183
|
+
react_1.default.createElement("div", { className: "flex gap-2.5" },
|
|
184
|
+
onBack && (react_1.default.createElement(TaxAxisButton_1.TaxAxisButton, { variant: "secondary", onClick: onBack }, "Back to Dashboard")),
|
|
185
|
+
react_1.default.createElement(TaxAxisButton_1.TaxAxisButton, { onClick: onConfirmAndUnlock }, totalFlags - totalEdits > 0 ? "Confirm & Unlock Report" : "Confirm & View Report")))))));
|
|
186
186
|
}
|