@paro.io/expert-shared-components 1.14.57 → 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.
Files changed (80) hide show
  1. package/lib/README.md +2 -0
  2. package/lib/components/DocumentCenter/MultiFileUploadSection.js +121 -220
  3. package/lib/components/TaxAxis/TaxAxisApi.d.ts +2 -0
  4. package/lib/components/TaxAxis/TaxAxisShell.d.ts +1 -1
  5. package/lib/components/TaxAxis/TaxAxisShell.js +104 -5
  6. package/lib/components/TaxAxis/types.d.ts +5 -0
  7. package/lib/components/shared/UploadClient.d.ts +1 -2
  8. package/lib/components/shared/UploadClient.js +2 -6
  9. package/lib/index.d.ts +13 -2
  10. package/lib/index.js +27 -3
  11. package/lib/package.json +68 -0
  12. package/lib/tax-axis/components/clientReport/ExecutiveSummary.d.ts +1 -4
  13. package/lib/tax-axis/components/clientReport/ExecutiveSummary.js +6 -10
  14. package/lib/tax-axis/components/clientReport/Methodology.js +2 -2
  15. package/lib/tax-axis/components/clientReport/RecommendedStrategies.d.ts +1 -6
  16. package/lib/tax-axis/components/clientReport/RecommendedStrategies.js +24 -26
  17. package/lib/tax-axis/components/clientReport/StrategyCard.d.ts +1 -1
  18. package/lib/tax-axis/components/clientReport/StrategyCard.js +23 -39
  19. package/lib/tax-axis/components/clientReport/TaxAxisClientReport.d.ts +2 -8
  20. package/lib/tax-axis/components/clientReport/TaxAxisClientReport.js +7 -9
  21. package/lib/tax-axis/components/dashboard/DashboardActions.js +4 -5
  22. package/lib/tax-axis/components/dashboard/DashboardSummary.d.ts +1 -6
  23. package/lib/tax-axis/components/dashboard/DashboardSummary.js +4 -14
  24. package/lib/tax-axis/components/dashboard/StrategyDetailPanel.d.ts +1 -1
  25. package/lib/tax-axis/components/dashboard/StrategyDetailPanel.js +91 -120
  26. package/lib/tax-axis/components/dashboard/TaxAxisDashboard.d.ts +2 -59
  27. package/lib/tax-axis/components/dashboard/TaxAxisDashboard.js +36 -412
  28. package/lib/tax-axis/components/documents/DocumentCard.d.ts +3 -7
  29. package/lib/tax-axis/components/documents/DocumentCard.js +12 -65
  30. package/lib/tax-axis/components/documents/DocumentTier.d.ts +2 -5
  31. package/lib/tax-axis/components/documents/DocumentTier.js +2 -2
  32. package/lib/tax-axis/components/documents/TaxAxisDocuments.d.ts +1 -25
  33. package/lib/tax-axis/components/documents/TaxAxisDocuments.js +52 -267
  34. package/lib/tax-axis/components/documents/qbo/QboAvailableReportsModal.d.ts +13 -0
  35. package/lib/tax-axis/components/documents/qbo/QboAvailableReportsModal.js +180 -0
  36. package/lib/tax-axis/components/documents/qbo/QboClientSelectorModal.d.ts +10 -0
  37. package/lib/tax-axis/components/documents/qbo/QboClientSelectorModal.js +155 -0
  38. package/lib/tax-axis/components/documents/qbo/QboConnectBanner.d.ts +9 -0
  39. package/lib/tax-axis/components/documents/qbo/QboConnectBanner.js +55 -0
  40. package/lib/tax-axis/components/documents/qbo/QboDocumentMappingModal.d.ts +10 -0
  41. package/lib/tax-axis/components/documents/qbo/QboDocumentMappingModal.js +202 -0
  42. package/lib/tax-axis/components/documents/qbo/QboImportingModal.d.ts +8 -0
  43. package/lib/tax-axis/components/documents/qbo/QboImportingModal.js +75 -0
  44. package/lib/tax-axis/components/documents/qbo/QboPermissionsModal.d.ts +8 -0
  45. package/lib/tax-axis/components/documents/qbo/QboPermissionsModal.js +126 -0
  46. package/lib/tax-axis/components/documents/qbo/index.d.ts +8 -0
  47. package/lib/tax-axis/components/documents/qbo/index.js +17 -0
  48. package/lib/tax-axis/components/documents/qbo/qboConstants.d.ts +24 -0
  49. package/lib/tax-axis/components/documents/qbo/qboConstants.js +71 -0
  50. package/lib/tax-axis/components/documents/qbo/types.d.ts +43 -0
  51. package/lib/tax-axis/components/documents/qbo/types.js +3 -0
  52. package/lib/tax-axis/components/documents/qbo/useQboFlow.d.ts +19 -0
  53. package/lib/tax-axis/components/documents/qbo/useQboFlow.js +207 -0
  54. package/lib/tax-axis/components/extractionReview/TaxAxisExtractionReview.js +17 -17
  55. package/lib/tax-axis/components/intake/ClientParametersSection.js +29 -13
  56. package/lib/tax-axis/components/intake/IntakeCtaCards.d.ts +2 -1
  57. package/lib/tax-axis/components/intake/IntakeCtaCards.js +13 -6
  58. package/lib/tax-axis/components/intake/TaxAxisIntake.js +44 -5
  59. package/lib/tax-axis/components/intake/intakeSchema.d.ts +3 -0
  60. package/lib/tax-axis/components/intake/intakeSchema.js +4 -2
  61. package/lib/tax-axis/components/preparerWorkpaper/TaxAxisPreparerWorkpaper.d.ts +2 -26
  62. package/lib/tax-axis/components/preparerWorkpaper/TaxAxisPreparerWorkpaper.js +4 -15
  63. package/lib/tax-axis/components/processing/TaxAxisProcessing.d.ts +1 -3
  64. package/lib/tax-axis/components/processing/TaxAxisProcessing.js +31 -102
  65. package/lib/tax-axis/components/prospectReport/ProspectPrintView.js +2 -0
  66. package/lib/tax-axis/components/prospectReport/ProspectStrategyCard.d.ts +8 -1
  67. package/lib/tax-axis/components/prospectReport/ProspectStrategyCard.js +5 -5
  68. package/lib/tax-axis/components/prospectReport/TaxAxisProspectReport.d.ts +27 -1
  69. package/lib/tax-axis/components/prospectReport/TaxAxisProspectReport.js +43 -25
  70. package/lib/tax-axis/index.d.ts +0 -4
  71. package/lib/tax-axis/index.js +1 -6
  72. package/lib/tax-axis/lib/adapters/useEngineOutput.d.ts +13 -138
  73. package/lib/tax-axis/lib/adapters/useEngineOutput.js +7 -156
  74. package/lib/tax-axis/lib/data/documents.d.ts +2 -3
  75. package/lib/tax-axis/lib/data/documents.js +25 -225
  76. package/lib/tax-axis/lib/data/strategies.js +9 -9
  77. package/lib/tax-axis/lib/documentFieldCatalog.d.ts +12 -7
  78. package/lib/tax-axis/lib/documentFieldCatalog.js +8 -805
  79. package/lib/tax-axis/lib/types/index.d.ts +1 -13
  80. package/package.json +1 -1
@@ -8,15 +8,15 @@ const react_1 = __importDefault(require("react"));
8
8
  const strategyNarrative_1 = require("../../lib/data/strategyNarrative");
9
9
  const strategyProspect_1 = require("../../lib/data/strategyProspect");
10
10
  const theme_1 = require("./theme");
11
- function ProspectStrategyCard({ strategy: s, index: i, profile, computed }) {
11
+ function ProspectStrategyCard({ strategy: s, index: i, profile, computed, backendNarrative }) {
12
12
  var _a, _b;
13
13
  const p = strategyProspect_1.STRATEGY_PROSPECT[s.rank];
14
14
  const narr = strategyNarrative_1.STRATEGY_NARRATIVE[s.rank];
15
15
  const c = computed.get(s.rank);
16
- const whyText = narr ? narr.whyMatters(profile) : strategyNarrative_1.NARRATIVE_FALLBACK.whyMatters(s);
17
- const breakdownText = narr ? narr.breakdown(profile, c) : strategyNarrative_1.NARRATIVE_FALLBACK.breakdown(s, c);
18
- const specialistText = (narr === null || narr === void 0 ? void 0 : narr.whySpecialist) || strategyNarrative_1.NARRATIVE_FALLBACK.whySpecialist(s);
19
- const nextText = narr ? narr.nextSteps : strategyNarrative_1.NARRATIVE_FALLBACK.nextSteps(s);
16
+ const whyText = (backendNarrative === null || backendNarrative === void 0 ? void 0 : backendNarrative.whyThisMatters) || (narr ? narr.whyMatters(profile) : strategyNarrative_1.NARRATIVE_FALLBACK.whyMatters(s));
17
+ const breakdownText = (backendNarrative === null || backendNarrative === void 0 ? void 0 : backendNarrative.howSavingsBreakDown) || (narr ? narr.breakdown(profile, c) : strategyNarrative_1.NARRATIVE_FALLBACK.breakdown(s, c));
18
+ const specialistText = (backendNarrative === null || backendNarrative === void 0 ? void 0 : backendNarrative.whyYouNeedSpecialist) || (narr === null || narr === void 0 ? void 0 : narr.whySpecialist) || strategyNarrative_1.NARRATIVE_FALLBACK.whySpecialist(s);
19
+ const nextText = (backendNarrative === null || backendNarrative === void 0 ? void 0 : backendNarrative.whatWeDoNext) || (narr ? narr.nextSteps : strategyNarrative_1.NARRATIVE_FALLBACK.nextSteps(s));
20
20
  const scaledLo = Math.round(((_a = c === null || c === void 0 ? void 0 : c.lo) !== null && _a !== void 0 ? _a : s.lo) / 1000);
21
21
  const scaledHi = Math.round(((_b = c === null || c === void 0 ? void 0 : c.hi) !== null && _b !== void 0 ? _b : s.hi) / 1000);
22
22
  return (react_1.default.createElement("div", { style: { background: theme_1.T.surface, border: `1px solid ${theme_1.T.border}`, borderRadius: 14, padding: "24px 28px", boxShadow: theme_1.T.shadow } },
@@ -1,9 +1,35 @@
1
1
  import React from "react";
2
2
  import type { ClientProfile, TaxAxisScreenProps } from "../../lib/types";
3
+ export interface BackendProspectResults {
4
+ sessionId: string;
5
+ strategies: Array<{
6
+ strategyId: string;
7
+ strategyName: string;
8
+ priorityTier: string;
9
+ savingsLo: number;
10
+ savingsHi: number;
11
+ score: number;
12
+ quickWin: boolean;
13
+ timeline: string;
14
+ ircCite: string;
15
+ narrative: {
16
+ whyThisMatters: string;
17
+ howSavingsBreakDown: string;
18
+ whyYouNeedSpecialist: string;
19
+ whatWeDoNext: string;
20
+ };
21
+ }>;
22
+ executiveSummary: string;
23
+ totalSavingsLo: number;
24
+ totalSavingsHi: number;
25
+ eligibleCount: number;
26
+ generatedAt: string;
27
+ }
3
28
  export interface TaxAxisProspectReportProps extends TaxAxisScreenProps {
4
29
  profile: ClientProfile;
30
+ backendResults?: BackendProspectResults | null;
5
31
  onUpgrade?: () => void;
6
32
  onPresent?: () => void;
7
33
  onReset?: () => void;
8
34
  }
9
- export declare function TaxAxisProspectReport({ profile, onUpgrade, onPresent, onReset, }: TaxAxisProspectReportProps): React.JSX.Element;
35
+ export declare function TaxAxisProspectReport({ profile, backendResults, onUpgrade, onPresent, onReset, }: TaxAxisProspectReportProps): React.JSX.Element;
@@ -35,10 +35,24 @@ const SampleAnalysisPreview_1 = require("./SampleAnalysisPreview");
35
35
  const ProspectDocuments_1 = require("./ProspectDocuments");
36
36
  const ProspectNextSteps_1 = require("./ProspectNextSteps");
37
37
  const ProspectPrintView_1 = require("./ProspectPrintView");
38
- function TaxAxisProspectReport({ profile, onUpgrade, onPresent, onReset, }) {
38
+ function TaxAxisProspectReport({ profile, backendResults, onUpgrade, onPresent, onReset, }) {
39
39
  const bizName = profile.bizName || "Client";
40
40
  const [confirmReset, setConfirmReset] = (0, react_1.useState)(false);
41
41
  const [printMode, setPrintMode] = (0, react_1.useState)(false);
42
+ // ═══ BACKEND NARRATIVE LOOKUP ═══
43
+ // Build a map from strategy rank (number) to backend narrative when available.
44
+ // strategyId format: "S1", "S2", etc.
45
+ const narrativeLookup = (0, react_1.useMemo)(() => {
46
+ if (!(backendResults === null || backendResults === void 0 ? void 0 : backendResults.strategies))
47
+ return null;
48
+ const map = new Map();
49
+ for (const s of backendResults.strategies) {
50
+ const rank = parseInt(s.strategyId.replace("S", ""), 10);
51
+ if (!isNaN(rank))
52
+ map.set(rank, s.narrative);
53
+ }
54
+ return map;
55
+ }, [backendResults]);
42
56
  // ═══ ELIGIBLE STRATEGIES ═══
43
57
  const eligible = (0, react_1.useMemo)(() => (0, compute_1.filterEligibleStrategies)(profile), [profile]);
44
58
  const high = eligible.filter(s => s.priority === "HIGH");
@@ -109,29 +123,30 @@ function TaxAxisProspectReport({ profile, onUpgrade, onPresent, onReset, }) {
109
123
  react_1.default.createElement("span", { style: { fontSize: 11, fontWeight: 700, color: theme_1.T.accent, fontFamily: theme_1.T.mono } }, "01"),
110
124
  react_1.default.createElement("span", { style: { fontSize: 11, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.12em", color: theme_1.T.text4, fontFamily: theme_1.T.body } }, "EXECUTIVE SUMMARY")),
111
125
  react_1.default.createElement("div", { style: { height: 2, background: theme_1.T.accent, width: 48, marginBottom: 16 } }),
112
- react_1.default.createElement("div", { style: { fontSize: 14, color: theme_1.T.text2, fontFamily: theme_1.T.body, lineHeight: 1.8, marginBottom: 12 } },
113
- "We evaluated ",
114
- bizName,
115
- "'s tax position against 25 federal strategies and identified ",
116
- react_1.default.createElement("strong", { style: { color: theme_1.T.white } },
117
- eligible.length,
118
- " applicable opportunities"),
119
- " with combined estimated savings of ",
120
- react_1.default.createElement("strong", { style: { color: theme_1.T.accentLt } },
121
- "$",
122
- displayLo,
123
- "K\u2013$",
124
- displayHi,
125
- "K annually"),
126
- ". ",
127
- high.length,
128
- " strategies could have significant impact."),
129
- react_1.default.createElement("div", { style: { fontSize: 14, color: theme_1.T.text2, fontFamily: theme_1.T.body, lineHeight: 1.8 } },
130
- "The top ",
131
- top3.length,
132
- " strategies are detailed below.",
133
- quick.length > 0 ? ` ${quick.length} can be implemented this week with no structural changes.` : "",
134
- " These are profile-based estimates \u2014 uploading financial documents will refine savings calculations and unlock all 25 strategies.")),
126
+ (backendResults === null || backendResults === void 0 ? void 0 : backendResults.executiveSummary) ? (react_1.default.createElement("div", { style: { fontSize: 14, color: theme_1.T.text2, fontFamily: theme_1.T.body, lineHeight: 1.8 } }, backendResults.executiveSummary)) : (react_1.default.createElement(react_1.default.Fragment, null,
127
+ react_1.default.createElement("div", { style: { fontSize: 14, color: theme_1.T.text2, fontFamily: theme_1.T.body, lineHeight: 1.8, marginBottom: 12 } },
128
+ "We evaluated ",
129
+ bizName,
130
+ "'s tax position against 25 federal strategies and identified ",
131
+ react_1.default.createElement("strong", { style: { color: theme_1.T.white } },
132
+ eligible.length,
133
+ " applicable opportunities"),
134
+ " with combined estimated savings of ",
135
+ react_1.default.createElement("strong", { style: { color: theme_1.T.accentLt } },
136
+ "$",
137
+ displayLo,
138
+ "K\u2013$",
139
+ displayHi,
140
+ "K annually"),
141
+ ". ",
142
+ high.length,
143
+ " strategies could have significant impact."),
144
+ react_1.default.createElement("div", { style: { fontSize: 14, color: theme_1.T.text2, fontFamily: theme_1.T.body, lineHeight: 1.8 } },
145
+ "The top ",
146
+ top3.length,
147
+ " strategies are detailed below.",
148
+ quick.length > 0 ? ` ${quick.length} can be implemented this week with no structural changes.` : "",
149
+ " These are profile-based estimates \u2014 uploading financial documents will refine savings calculations and unlock all 25 strategies.")))),
135
150
  react_1.default.createElement("div", { style: { background: theme_1.T.surface, border: `1px solid ${theme_1.T.border}`, borderRadius: 14, padding: "20px 24px", marginBottom: 24, boxShadow: theme_1.T.shadow } },
136
151
  react_1.default.createElement("div", { style: { fontSize: 10, fontWeight: 700, color: theme_1.T.text4, textTransform: "uppercase", letterSpacing: "0.12em", marginBottom: 12, fontFamily: theme_1.T.mono } }, "SAVINGS DISTRIBUTION"),
137
152
  barData.map((b, i) => (react_1.default.createElement("div", { key: i, style: { display: "flex", alignItems: "center", gap: 10, marginBottom: i < barData.length - 1 ? 8 : 0 } },
@@ -151,7 +166,10 @@ function TaxAxisProspectReport({ profile, onUpgrade, onPresent, onReset, }) {
151
166
  react_1.default.createElement("span", { style: { fontSize: 11, fontWeight: 700, color: theme_1.T.accent, fontFamily: theme_1.T.mono } }, "02"),
152
167
  react_1.default.createElement("span", { style: { fontSize: 11, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.12em", color: theme_1.T.text4, fontFamily: theme_1.T.body } }, "RECOMMENDED STRATEGIES")),
153
168
  react_1.default.createElement("div", { style: { height: 2, background: theme_1.T.accent, width: 48, marginBottom: 16 } }),
154
- react_1.default.createElement("div", { style: { display: "flex", flexDirection: "column", gap: 14 } }, top3.map((s, i) => (react_1.default.createElement(ProspectStrategyCard_1.ProspectStrategyCard, { key: s.rank, strategy: s, index: i, profile: profile, computed: computed }))))),
169
+ react_1.default.createElement("div", { style: { display: "flex", flexDirection: "column", gap: 14 } }, top3.map((s, i) => {
170
+ var _a;
171
+ return (react_1.default.createElement(ProspectStrategyCard_1.ProspectStrategyCard, { key: s.rank, strategy: s, index: i, profile: profile, computed: computed, backendNarrative: (_a = narrativeLookup === null || narrativeLookup === void 0 ? void 0 : narrativeLookup.get(s.rank)) !== null && _a !== void 0 ? _a : null }));
172
+ }))),
155
173
  remaining > 0 && (react_1.default.createElement("div", { style: { marginBottom: 24 } },
156
174
  react_1.default.createElement("div", { style: { display: "flex", alignItems: "baseline", gap: 10, marginBottom: 6 } },
157
175
  react_1.default.createElement("span", { style: { fontSize: 11, fontWeight: 700, color: theme_1.T.accent, fontFamily: theme_1.T.mono } }, "03"),
@@ -5,14 +5,10 @@ export { SectionHeader } from "./components/shared/SectionHeader";
5
5
  export * from "./lib/types";
6
6
  export * from "./lib/data";
7
7
  export * from "./lib/compute";
8
- export { useEngineOutput } from "./lib/adapters/useEngineOutput";
9
- export type { EngineOutput, EngineOutputAdapterResult, EngineStrategyAnalysis, EngineCpaWorkflow } from "./lib/adapters/useEngineOutput";
10
8
  export { TaxAxisIntake } from "./components/intake/TaxAxisIntake";
11
9
  export type { TaxAxisIntakeProps } from "./components/intake/TaxAxisIntake";
12
10
  export { TaxAxisDocuments } from "./components/documents/TaxAxisDocuments";
13
11
  export type { TaxAxisDocumentsProps } from "./components/documents/TaxAxisDocuments";
14
- export { DocumentReviewModal } from "./components/documents/DocumentReviewModal";
15
- export type { DocumentReviewModalProps } from "./components/documents/DocumentReviewModal";
16
12
  export { TaxAxisProcessing } from "./components/processing/TaxAxisProcessing";
17
13
  export type { TaxAxisProcessingProps } from "./components/processing/TaxAxisProcessing";
18
14
  export { TaxAxisDashboard } from "./components/dashboard/TaxAxisDashboard";
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.TaxAxisPresentationMode = exports.TaxAxisProspectReport = exports.TaxAxisExtractionReview = exports.TaxAxisPreparerWorkpaper = exports.TaxAxisClientReport = exports.TaxAxisDashboard = exports.TaxAxisProcessing = exports.DocumentReviewModal = exports.TaxAxisDocuments = exports.TaxAxisIntake = exports.useEngineOutput = exports.SectionHeader = exports.TaxAxisButton = exports.TaxAxisBadge = exports.TaxAxisCard = void 0;
17
+ exports.TaxAxisPresentationMode = exports.TaxAxisProspectReport = exports.TaxAxisExtractionReview = exports.TaxAxisPreparerWorkpaper = exports.TaxAxisClientReport = exports.TaxAxisDashboard = exports.TaxAxisProcessing = exports.TaxAxisDocuments = exports.TaxAxisIntake = exports.SectionHeader = exports.TaxAxisButton = exports.TaxAxisBadge = exports.TaxAxisCard = void 0;
18
18
  // Shared primitives
19
19
  var TaxAxisCard_1 = require("./components/shared/TaxAxisCard");
20
20
  Object.defineProperty(exports, "TaxAxisCard", { enumerable: true, get: function () { return TaxAxisCard_1.TaxAxisCard; } });
@@ -30,16 +30,11 @@ __exportStar(require("./lib/types"), exports);
30
30
  __exportStar(require("./lib/data"), exports);
31
31
  // Compute
32
32
  __exportStar(require("./lib/compute"), exports);
33
- // Adapters
34
- var useEngineOutput_1 = require("./lib/adapters/useEngineOutput");
35
- Object.defineProperty(exports, "useEngineOutput", { enumerable: true, get: function () { return useEngineOutput_1.useEngineOutput; } });
36
33
  // Screens
37
34
  var TaxAxisIntake_1 = require("./components/intake/TaxAxisIntake");
38
35
  Object.defineProperty(exports, "TaxAxisIntake", { enumerable: true, get: function () { return TaxAxisIntake_1.TaxAxisIntake; } });
39
36
  var TaxAxisDocuments_1 = require("./components/documents/TaxAxisDocuments");
40
37
  Object.defineProperty(exports, "TaxAxisDocuments", { enumerable: true, get: function () { return TaxAxisDocuments_1.TaxAxisDocuments; } });
41
- var DocumentReviewModal_1 = require("./components/documents/DocumentReviewModal");
42
- Object.defineProperty(exports, "DocumentReviewModal", { enumerable: true, get: function () { return DocumentReviewModal_1.DocumentReviewModal; } });
43
38
  var TaxAxisProcessing_1 = require("./components/processing/TaxAxisProcessing");
44
39
  Object.defineProperty(exports, "TaxAxisProcessing", { enumerable: true, get: function () { return TaxAxisProcessing_1.TaxAxisProcessing; } });
45
40
  var TaxAxisDashboard_1 = require("./components/dashboard/TaxAxisDashboard");
@@ -1,151 +1,26 @@
1
1
  import type { Strategy, ComputedMap } from "../types";
2
- export interface SourceDocumentRef {
3
- field_label: string;
4
- value_display: string;
5
- source_hint: string;
6
- }
7
- export interface EngineCalculationTrace {
8
- strategy_id: string;
9
- branch_executed: string | null;
10
- formula: string;
11
- inputs: Record<string, unknown>;
12
- result_gross: number | null;
13
- confidence_interval: {
14
- low: number;
15
- high: number;
16
- basis: string;
17
- } | null;
18
- position_strength: string;
19
- irs_cite: string;
20
- data_quality_flag: string | null;
21
- forms_required: string[];
22
- deadline_flag: string | null;
23
- amt_flag: boolean;
24
- source_documents?: SourceDocumentRef[];
25
- specialist_note?: string | null;
2
+ /** Raw engine output blob from the LLM run. */
3
+ export type EngineOutput = Record<string, unknown> | null;
4
+ /** Adapter result passed to client-report / preparer-workpaper components. */
5
+ export interface EngineOutputAdapterResult {
6
+ strategies: Strategy[];
7
+ computedMap: ComputedMap;
26
8
  }
9
+ /** Single strategy analysis entry from the engine. */
27
10
  export interface EngineStrategyAnalysis {
28
11
  strategy_id: string;
29
12
  strategy_name: string;
30
- priority_tier: "HIGH" | "MEDIUM" | "LOW" | "NOT_RECOMMENDED";
13
+ priority_tier: string;
31
14
  weighted_score: number;
32
- scores: {
33
- financial_impact: number;
34
- applicability: number;
35
- complexity: number;
36
- risk: number;
37
- cash_flow: number;
38
- };
39
15
  quick_win: boolean;
40
- calculation_trace: EngineCalculationTrace;
41
16
  engagement_recommendation: string;
42
- risk_disclosure: string | null;
43
- }
44
- export interface EngineClientSummaryStrategy {
45
- slot: number;
46
- strategy_name: string;
47
- savings_range: string;
48
- why_it_applies: string;
49
- next_step: string;
50
- quick_win_badge: boolean;
51
- deadline_flag?: string | null;
17
+ calculation_trace?: Record<string, unknown>;
18
+ [key: string]: unknown;
52
19
  }
20
+ /** CPA workflow section from the engine. */
53
21
  export interface EngineCpaWorkflow {
54
22
  workpaper_codes: string[] | null;
55
- section_6694_notices: Array<{
56
- strategy_id: string;
57
- position_strength: string;
58
- notice: string;
59
- }>;
60
- prior_year_flags: string[];
61
- conflict_of_interest_checklist: Array<{
62
- strategy_id: string;
63
- conflict_prompt: string;
64
- confirmed_no_conflict: boolean;
65
- }>;
66
23
  engagement_recommendations: string[];
24
+ [key: string]: unknown;
67
25
  }
68
- export interface EngineOutput {
69
- engagement_id: string;
70
- generated_at: string;
71
- algorithm_version: string;
72
- business_profile: {
73
- entity_type: string;
74
- industry: string;
75
- industry_vertical: string;
76
- states: string[];
77
- data_years: number;
78
- confidence_tier: string;
79
- effective_tax_rate: number | null;
80
- data_quality_flags: string[];
81
- };
82
- eligibility_screening: {
83
- excluded_strategies: Array<{
84
- strategy_id: string;
85
- status: "EXCLUDED";
86
- reason: string;
87
- irs_cite: string;
88
- }>;
89
- };
90
- strategy_analysis: EngineStrategyAnalysis[];
91
- strategy_interaction_warnings: Array<{
92
- strategy_pair: [string, string];
93
- warning_text: string;
94
- }>;
95
- implementation_roadmap: {
96
- quick_wins: Array<{
97
- strategy_id: string;
98
- action: string;
99
- deadline?: string | null;
100
- }>;
101
- immediate: Array<{
102
- strategy_id: string;
103
- action: string;
104
- deadline?: string | null;
105
- }>;
106
- thirty_day: Array<{
107
- strategy_id: string;
108
- action: string;
109
- deadline?: string | null;
110
- }>;
111
- ninety_day: Array<{
112
- strategy_id: string;
113
- action: string;
114
- deadline?: string | null;
115
- }>;
116
- annual: Array<{
117
- strategy_id: string;
118
- action: string;
119
- deadline?: string | null;
120
- }>;
121
- };
122
- cpa_workflow: EngineCpaWorkflow;
123
- client_summary: {
124
- opening: string;
125
- strategies: EngineClientSummaryStrategy[];
126
- data_quality_note: string | null;
127
- interaction_warning: string | null;
128
- closing: string;
129
- };
130
- risk_disclosures: string[];
131
- client_risk_disclosures: {
132
- accuracy_penalty_warning: string | null;
133
- applies_to_strategies: string[];
134
- };
135
- amt_flags: Array<{
136
- trigger: string;
137
- strategy_id: string;
138
- flag_text: string;
139
- }>;
140
- nexus_flags: Array<{
141
- state: string;
142
- nexus_type: string;
143
- flag_text: string;
144
- }>;
145
- }
146
- export interface EngineOutputAdapterResult {
147
- strategies: Strategy[];
148
- computedMap: ComputedMap;
149
- engineOutput: EngineOutput;
150
- }
151
- export declare function useEngineOutput(engineOutput: EngineOutput | null | undefined): EngineOutputAdapterResult | null;
26
+ export declare function useEngineOutput(_engineOutput: EngineOutput): EngineOutputAdapterResult | null;
@@ -1,161 +1,12 @@
1
1
  "use strict";
2
- // ═══════════════════════════════════════════════════════════════════
3
- // useEngineOutput adapts live EngineOutput from paro-graphql-api
4
- // into the Strategy[] + ComputedMap shapes the FE components consume.
5
- //
6
- // Strategy: use the static STRATEGIES catalog as a structural template
7
- // (rank, cat, entities, authority, etc.) and override savings/priority/score
8
- // from the live engine data. Falls back to static data when a strategy_id
9
- // has no match in the catalog (future-proofing for new strategies).
10
- // ═══════════════════════════════════════════════════════════════════
2
+ // useEngineOutput — minimal stub to unblock builds.
3
+ // TODO: centralise narrative-field mapping (why_it_applies, source_documents, specialistNote) here.
11
4
  Object.defineProperty(exports, "__esModule", { value: true });
12
5
  exports.useEngineOutput = useEngineOutput;
13
6
  const react_1 = require("react");
14
- const data_1 = require("../data");
15
- // ── Strategy ID rank mapping (S1..S26 rank 1..25 catalog) ───────
16
- // Maps engine strategy_ids like "S2", "S5" etc. to catalog ranks.
17
- // Built once from the static STRATEGIES array by matching code/name heuristics.
18
- const ENGINE_ID_TO_RANK = {
19
- S1: 1, // Business Entity Structure (S-Corp election)
20
- S2: 2, // Section 179
21
- S3: 3, // Bonus Depreciation §168(k)
22
- S4: 4, // QBI §199A
23
- S5: 5, // R&D Credit §41
24
- S6: 6, // WOTC §51
25
- S7: 7, // Retirement Plan
26
- S8: 8, // Cost Segregation
27
- S9: 9, // HSA
28
- S10: 10, // Business Meals
29
- S11: 11, // Professional Services / Legal
30
- S12: 12, // Home Office
31
- S13: 13, // Health Care Credit §45R
32
- S14: 14, // Charitable / DAF
33
- S15: 15, // SALT PTE
34
- S16: 16, // §163(j) Interest
35
- S17: 17, // Income Deferral
36
- S18: 18, // Opportunity Zone §1400Z
37
- S19: 19, // §179D Energy
38
- S20: 20, // Accounting Method
39
- S21: 21, // OBBBA Overtime
40
- S22: 22, // OBBBA Tips / Overtime
41
- S23: 23, // §174A R&E catch-up
42
- S24: 24, // Childcare §45F
43
- S25: 25, // OBBBA Trump Accounts
44
- };
45
- const CATALOG_BY_RANK = new Map(data_1.STRATEGIES.map((s) => [s.rank, s]));
46
- // ── Priority tier mapping ─────────────────────────────────────────────
47
- function mapPriority(tier, quickWin) {
48
- if (quickWin)
49
- return "QUICK WIN";
50
- if (tier === "HIGH")
51
- return "HIGH";
52
- if (tier === "MEDIUM")
53
- return "MEDIUM";
54
- if (tier === "LOW")
55
- return "LOW";
56
- return "NOT RECOMMENDED";
57
- }
58
- // ── Timeline bucket from implementation_roadmap ───────────────────────
59
- function resolveTimelineBucket(strategyId, roadmap) {
60
- if (roadmap.quick_wins.some((r) => r.strategy_id === strategyId))
61
- return "now";
62
- if (roadmap.immediate.some((r) => r.strategy_id === strategyId))
63
- return "now";
64
- if (roadmap.thirty_day.some((r) => r.strategy_id === strategyId))
65
- return "30d";
66
- if (roadmap.ninety_day.some((r) => r.strategy_id === strategyId))
67
- return "90d";
68
- if (roadmap.annual.some((r) => r.strategy_id === strategyId))
69
- return "filing";
70
- return "filing";
71
- }
72
- // ── CalculationTrace → StrategyTraceStep[] ───────────────────────────
73
- function traceFromEngine(trace) {
74
- var _a, _b;
75
- const steps = [];
76
- // Emit formula as step 1
77
- if (trace.formula) {
78
- steps.push({
79
- n: 1,
80
- step: "Formula",
81
- formula: trace.formula,
82
- result: trace.result_gross != null ? `$${trace.result_gross.toLocaleString()}` : "See CI",
83
- src: trace.irs_cite || "",
84
- });
85
- }
86
- // Emit confidence interval as step 2 when present
87
- if (((_a = trace.confidence_interval) === null || _a === void 0 ? void 0 : _a.low) != null && ((_b = trace.confidence_interval) === null || _b === void 0 ? void 0 : _b.high) != null) {
88
- steps.push({
89
- n: 2,
90
- step: "Confidence range",
91
- formula: `Low × ${trace.confidence_interval.basis}`,
92
- result: `$${trace.confidence_interval.low.toLocaleString()} – $${trace.confidence_interval.high.toLocaleString()}`,
93
- src: trace.irs_cite || "",
94
- });
95
- }
96
- return steps;
97
- }
98
- function adaptEngineOutput(engineOutput) {
99
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
100
- const strategies = [];
101
- const computedMap = new Map();
102
- for (const analysis of engineOutput.strategy_analysis) {
103
- if (analysis.priority_tier === "NOT_RECOMMENDED")
104
- continue;
105
- const rank = ENGINE_ID_TO_RANK[analysis.strategy_id];
106
- const template = rank != null ? CATALOG_BY_RANK.get(rank) : undefined;
107
- const trace = analysis.calculation_trace;
108
- const ci = trace === null || trace === void 0 ? void 0 : trace.confidence_interval;
109
- const lo = (_b = (_a = ci === null || ci === void 0 ? void 0 : ci.low) !== null && _a !== void 0 ? _a : template === null || template === void 0 ? void 0 : template.lo) !== null && _b !== void 0 ? _b : 0;
110
- const hi = (_d = (_c = ci === null || ci === void 0 ? void 0 : ci.high) !== null && _c !== void 0 ? _c : template === null || template === void 0 ? void 0 : template.hi) !== null && _d !== void 0 ? _d : 0;
111
- const timelineBucket = resolveTimelineBucket(analysis.strategy_id, engineOutput.implementation_roadmap);
112
- const clientSummaryEntry = engineOutput.client_summary.strategies.find((cs) => cs.strategy_name === analysis.strategy_name);
113
- const strategy = {
114
- rank: rank !== null && rank !== void 0 ? rank : 99,
115
- code: (_e = template === null || template === void 0 ? void 0 : template.code) !== null && _e !== void 0 ? _e : analysis.strategy_id,
116
- name: analysis.strategy_name,
117
- cat: (_f = template === null || template === void 0 ? void 0 : template.cat) !== null && _f !== void 0 ? _f : "deductions",
118
- priority: mapPriority(analysis.priority_tier, analysis.quick_win),
119
- score: Math.round(analysis.weighted_score),
120
- entities: (_g = template === null || template === void 0 ? void 0 : template.entities) !== null && _g !== void 0 ? _g : ["S-Corporation", "C-Corporation", "Partnership/LLC", "Sole Proprietorship"],
121
- lo,
122
- hi,
123
- timeline: (_h = template === null || template === void 0 ? void 0 : template.timeline) !== null && _h !== void 0 ? _h : timelineBucket,
124
- timelineBucket,
125
- authority: (_j = trace === null || trace === void 0 ? void 0 : trace.irs_cite) !== null && _j !== void 0 ? _j : template === null || template === void 0 ? void 0 : template.authority,
126
- forms: (_l = (_k = trace === null || trace === void 0 ? void 0 : trace.forms_required) === null || _k === void 0 ? void 0 : _k.join(", ")) !== null && _l !== void 0 ? _l : template === null || template === void 0 ? void 0 : template.forms,
127
- warning: (_o = (_m = analysis.risk_disclosure) !== null && _m !== void 0 ? _m : template === null || template === void 0 ? void 0 : template.warning) !== null && _o !== void 0 ? _o : null,
128
- abstract: analysis.engagement_recommendation,
129
- trace: traceFromEngine(trace),
130
- needsPTE: template === null || template === void 0 ? void 0 : template.needsPTE,
131
- onlyIndustry: template === null || template === void 0 ? void 0 : template.onlyIndustry,
132
- excludeIndustry: template === null || template === void 0 ? void 0 : template.excludeIndustry,
133
- preferIndustry: template === null || template === void 0 ? void 0 : template.preferIndustry,
134
- minEmployees: template === null || template === void 0 ? void 0 : template.minEmployees,
135
- needsOwnerComp: template === null || template === void 0 ? void 0 : template.needsOwnerComp,
136
- clientBrief: (_p = clientSummaryEntry === null || clientSummaryEntry === void 0 ? void 0 : clientSummaryEntry.why_it_applies) !== null && _p !== void 0 ? _p : template === null || template === void 0 ? void 0 : template.clientBrief,
137
- action: (_q = clientSummaryEntry === null || clientSummaryEntry === void 0 ? void 0 : clientSummaryEntry.next_step) !== null && _q !== void 0 ? _q : template === null || template === void 0 ? void 0 : template.action,
138
- sourceDocuments: (_r = trace === null || trace === void 0 ? void 0 : trace.source_documents) !== null && _r !== void 0 ? _r : [],
139
- quickWin: analysis.quick_win,
140
- positionStrength: (_s = trace === null || trace === void 0 ? void 0 : trace.position_strength) !== null && _s !== void 0 ? _s : undefined,
141
- specialistNote: (_t = trace === null || trace === void 0 ? void 0 : trace.specialist_note) !== null && _t !== void 0 ? _t : undefined,
142
- };
143
- strategies.push(strategy);
144
- computedMap.set(strategy.rank, {
145
- lo,
146
- hi,
147
- trace: strategy.trace,
148
- });
149
- }
150
- // Sort by weighted_score descending (same ordering the FE uses)
151
- strategies.sort((a, b) => b.score - a.score);
152
- return { strategies, computedMap, engineOutput };
153
- }
154
- // ── React hook ────────────────────────────────────────────────────────
155
- function useEngineOutput(engineOutput) {
156
- return (0, react_1.useMemo)(() => {
157
- if (!engineOutput)
158
- return null;
159
- return adaptEngineOutput(engineOutput);
160
- }, [engineOutput]);
7
+ // ---------------------------------------------------------------------------
8
+ // Hook pass-through stub (returns null, no mapping yet)
9
+ // ---------------------------------------------------------------------------
10
+ function useEngineOutput(_engineOutput) {
11
+ return (0, react_1.useMemo)(() => null, [_engineOutput]);
161
12
  }
@@ -1,4 +1,3 @@
1
- import { DocSpec } from "../types";
2
- export type TaxAxisEntityTypeKey = "S_CORP" | "C_CORP" | "PARTNERSHIP" | "LLC" | "SOLE_PROP";
1
+ import type { ClientProfile, DocSpec } from "../types";
3
2
  export declare const DOC_SPECS_BASE: DocSpec[];
4
- export declare function getDocSpecs(entityType?: TaxAxisEntityTypeKey | string | null): DocSpec[];
3
+ export declare function getDocSpecs(profile?: ClientProfile): DocSpec[];