@paro.io/expert-shared-components 1.14.73 → 1.14.75

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.
@@ -195,20 +195,68 @@ const TaxAxisShell = ({ taxAxisApi, userContext = 'expert', initialSessionId, in
195
195
  }
196
196
  }), [taxAxisApi]);
197
197
  // On mount: if a sessionId was injected (e.g. returning to an existing session),
198
- // reload the last GENERATION llmRun so the report screens get live data.
198
+ // fetch the session stage and resume at the correct step.
199
199
  (0, react_1.useEffect)(() => {
200
- if (!initialSessionId || !taxAxisApi.getLlmRun)
200
+ if (!initialSessionId)
201
201
  return;
202
- taxAxisApi.getLlmRun(initialSessionId, 'GENERATION')
203
- .then((run) => {
204
- if (run === null || run === void 0 ? void 0 : run.outputPayload) {
205
- setLlmResult(run.outputPayload);
202
+ taxAxisApi.getSession(initialSessionId)
203
+ .then((session) => __awaiter(void 0, void 0, void 0, function* () {
204
+ var _a;
205
+ if (!session)
206
+ return;
207
+ // Restore profile from session fields so DOCUMENT_UPLOAD header renders correctly
208
+ setSessionId(initialSessionId);
209
+ setProfile((prev) => {
210
+ var _a, _b, _c, _d, _e, _f, _g, _h;
211
+ return prev !== null && prev !== void 0 ? prev : {
212
+ bizName: (_a = session.businessName) !== null && _a !== void 0 ? _a : '',
213
+ entity: (_b = session.entityType) !== null && _b !== void 0 ? _b : '',
214
+ industry: (_c = session.industry) !== null && _c !== void 0 ? _c : '',
215
+ year: String((_d = session.taxYear) !== null && _d !== void 0 ? _d : new Date().getFullYear()),
216
+ revenue: String((_e = session.annualRevenue) !== null && _e !== void 0 ? _e : ''),
217
+ ownerComp: String((_f = session.w2Compensation) !== null && _f !== void 0 ? _f : ''),
218
+ employees: String((_g = session.employeeCount) !== null && _g !== void 0 ? _g : ''),
219
+ states: (_h = session.states) !== null && _h !== void 0 ? _h : [],
220
+ };
221
+ });
222
+ const stage = (_a = session.stage) !== null && _a !== void 0 ? _a : '';
223
+ if (stage === 'REPORT_READY' || stage === 'COMPLETED') {
224
+ // Load LLM run data and jump to dashboard
225
+ if (taxAxisApi.getLlmRun) {
226
+ try {
227
+ const run = yield taxAxisApi.getLlmRun(initialSessionId, 'GENERATION');
228
+ if (run === null || run === void 0 ? void 0 : run.outputPayload) {
229
+ setLlmResult(run.outputPayload);
230
+ }
231
+ }
232
+ catch ( /* non-blocking */_b) { /* non-blocking */ }
233
+ }
234
+ yield fetchAndSetParsedDocuments(initialSessionId);
206
235
  setStep('DASHBOARD');
207
- fetchAndSetParsedDocuments(initialSessionId);
236
+ if (onSessionChange)
237
+ onSessionChange(initialSessionId);
238
+ return;
239
+ }
240
+ if (stage === 'LLM_RUNNING' || stage === 'EVAL_RUNNING') {
241
+ // Jump straight to processing screen and start polling
242
+ setStep('PROCESSING');
243
+ pollForResult(initialSessionId);
244
+ if (onSessionChange)
245
+ onSessionChange(initialSessionId);
246
+ return;
208
247
  }
209
- })
210
- .catch(() => { });
211
- // fetchAndSetParsedDocuments intentionally excluded: only runs on mount for initial session restore
248
+ // INITIALIZED, DOCUMENTS_UPLOADED, PARSING, PARSED, EXTRACTION_REVIEW, FAILED, EVAL_FAILED
249
+ // Resume at document upload so the user can review/add documents or retry
250
+ setStep('DOCUMENT_UPLOAD');
251
+ if (onSessionChange)
252
+ onSessionChange(initialSessionId);
253
+ }))
254
+ .catch(() => {
255
+ // On error fall back to SESSION_SETUP — clear skeleton so page isn't stuck
256
+ if (onSessionChange)
257
+ onSessionChange(null);
258
+ });
259
+ // fetchAndSetParsedDocuments and pollForResult intentionally excluded: only runs on mount
212
260
  // eslint-disable-next-line react-hooks/exhaustive-deps
213
261
  }, [initialSessionId]);
214
262
  const updateSessionId = (0, react_1.useCallback)((nextSessionId) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paro.io/expert-shared-components",
3
- "version": "1.14.73",
3
+ "version": "1.14.75",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {