@paro.io/expert-shared-components 1.14.52 → 1.14.54

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 (31) hide show
  1. package/lib/components/DocumentCenter/MultiFileUploadSection.js +220 -121
  2. package/lib/components/TaxAxis/TaxAxisApi.d.ts +1 -0
  3. package/lib/components/TaxAxis/TaxAxisShell.js +80 -17
  4. package/lib/index.d.ts +1 -14
  5. package/lib/index.js +1 -27
  6. package/lib/tax-axis/components/clientReport/TaxAxisClientReport.d.ts +6 -2
  7. package/lib/tax-axis/components/clientReport/TaxAxisClientReport.js +5 -3
  8. package/lib/tax-axis/components/dashboard/TaxAxisDashboard.d.ts +2 -1
  9. package/lib/tax-axis/components/dashboard/TaxAxisDashboard.js +163 -34
  10. package/lib/tax-axis/components/documents/DocumentCard.d.ts +3 -1
  11. package/lib/tax-axis/components/documents/DocumentCard.js +17 -5
  12. package/lib/tax-axis/components/documents/DocumentReviewModal.d.ts +13 -0
  13. package/lib/tax-axis/components/documents/DocumentReviewModal.js +248 -0
  14. package/lib/tax-axis/components/documents/DocumentTier.d.ts +3 -1
  15. package/lib/tax-axis/components/documents/DocumentTier.js +2 -2
  16. package/lib/tax-axis/components/documents/TaxAxisDocuments.d.ts +5 -1
  17. package/lib/tax-axis/components/documents/TaxAxisDocuments.js +86 -5
  18. package/lib/tax-axis/components/extractionReview/TaxAxisExtractionReview.js +17 -17
  19. package/lib/tax-axis/components/intake/ClientParametersSection.js +1 -1
  20. package/lib/tax-axis/components/intake/intakeSchema.js +1 -1
  21. package/lib/tax-axis/components/preparerWorkpaper/TaxAxisPreparerWorkpaper.d.ts +6 -2
  22. package/lib/tax-axis/components/preparerWorkpaper/TaxAxisPreparerWorkpaper.js +5 -3
  23. package/lib/tax-axis/index.d.ts +4 -0
  24. package/lib/tax-axis/index.js +6 -1
  25. package/lib/tax-axis/lib/adapters/useEngineOutput.d.ts +144 -0
  26. package/lib/tax-axis/lib/adapters/useEngineOutput.js +156 -0
  27. package/lib/tax-axis/lib/data/documents.d.ts +1 -0
  28. package/lib/tax-axis/lib/data/documents.js +5 -0
  29. package/lib/tax-axis/lib/documentFieldCatalog.d.ts +13 -0
  30. package/lib/tax-axis/lib/documentFieldCatalog.js +808 -0
  31. package/package.json +1 -1
@@ -0,0 +1,144 @@
1
+ import type { Strategy, ComputedMap } from "../types";
2
+ export interface EngineCalculationTrace {
3
+ strategy_id: string;
4
+ branch_executed: string | null;
5
+ formula: string;
6
+ inputs: Record<string, unknown>;
7
+ result_gross: number | null;
8
+ confidence_interval: {
9
+ low: number;
10
+ high: number;
11
+ basis: string;
12
+ } | null;
13
+ position_strength: string;
14
+ irs_cite: string;
15
+ data_quality_flag: string | null;
16
+ forms_required: string[];
17
+ deadline_flag: string | null;
18
+ amt_flag: boolean;
19
+ }
20
+ export interface EngineStrategyAnalysis {
21
+ strategy_id: string;
22
+ strategy_name: string;
23
+ priority_tier: "HIGH" | "MEDIUM" | "LOW" | "NOT_RECOMMENDED";
24
+ weighted_score: number;
25
+ scores: {
26
+ financial_impact: number;
27
+ applicability: number;
28
+ complexity: number;
29
+ risk: number;
30
+ cash_flow: number;
31
+ };
32
+ quick_win: boolean;
33
+ calculation_trace: EngineCalculationTrace;
34
+ engagement_recommendation: string;
35
+ risk_disclosure: string | null;
36
+ }
37
+ export interface EngineClientSummaryStrategy {
38
+ slot: number;
39
+ strategy_name: string;
40
+ savings_range: string;
41
+ why_it_applies: string;
42
+ next_step: string;
43
+ quick_win_badge: boolean;
44
+ deadline_flag?: string | null;
45
+ }
46
+ export interface EngineCpaWorkflow {
47
+ workpaper_codes: string[] | null;
48
+ section_6694_notices: Array<{
49
+ strategy_id: string;
50
+ position_strength: string;
51
+ notice: string;
52
+ }>;
53
+ prior_year_flags: string[];
54
+ conflict_of_interest_checklist: Array<{
55
+ strategy_id: string;
56
+ conflict_prompt: string;
57
+ confirmed_no_conflict: boolean;
58
+ }>;
59
+ engagement_recommendations: string[];
60
+ }
61
+ export interface EngineOutput {
62
+ engagement_id: string;
63
+ generated_at: string;
64
+ algorithm_version: string;
65
+ business_profile: {
66
+ entity_type: string;
67
+ industry: string;
68
+ industry_vertical: string;
69
+ states: string[];
70
+ data_years: number;
71
+ confidence_tier: string;
72
+ effective_tax_rate: number | null;
73
+ data_quality_flags: string[];
74
+ };
75
+ eligibility_screening: {
76
+ excluded_strategies: Array<{
77
+ strategy_id: string;
78
+ status: "EXCLUDED";
79
+ reason: string;
80
+ irs_cite: string;
81
+ }>;
82
+ };
83
+ strategy_analysis: EngineStrategyAnalysis[];
84
+ strategy_interaction_warnings: Array<{
85
+ strategy_pair: [string, string];
86
+ warning_text: string;
87
+ }>;
88
+ implementation_roadmap: {
89
+ quick_wins: Array<{
90
+ strategy_id: string;
91
+ action: string;
92
+ deadline?: string | null;
93
+ }>;
94
+ immediate: Array<{
95
+ strategy_id: string;
96
+ action: string;
97
+ deadline?: string | null;
98
+ }>;
99
+ thirty_day: Array<{
100
+ strategy_id: string;
101
+ action: string;
102
+ deadline?: string | null;
103
+ }>;
104
+ ninety_day: Array<{
105
+ strategy_id: string;
106
+ action: string;
107
+ deadline?: string | null;
108
+ }>;
109
+ annual: Array<{
110
+ strategy_id: string;
111
+ action: string;
112
+ deadline?: string | null;
113
+ }>;
114
+ };
115
+ cpa_workflow: EngineCpaWorkflow;
116
+ client_summary: {
117
+ opening: string;
118
+ strategies: EngineClientSummaryStrategy[];
119
+ data_quality_note: string | null;
120
+ interaction_warning: string | null;
121
+ closing: string;
122
+ };
123
+ risk_disclosures: string[];
124
+ client_risk_disclosures: {
125
+ accuracy_penalty_warning: string | null;
126
+ applies_to_strategies: string[];
127
+ };
128
+ amt_flags: Array<{
129
+ trigger: string;
130
+ strategy_id: string;
131
+ flag_text: string;
132
+ }>;
133
+ nexus_flags: Array<{
134
+ state: string;
135
+ nexus_type: string;
136
+ flag_text: string;
137
+ }>;
138
+ }
139
+ export interface EngineOutputAdapterResult {
140
+ strategies: Strategy[];
141
+ computedMap: ComputedMap;
142
+ engineOutput: EngineOutput;
143
+ }
144
+ export declare function useEngineOutput(engineOutput: EngineOutput | null | undefined): EngineOutputAdapterResult | null;
@@ -0,0 +1,156 @@
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
+ // ═══════════════════════════════════════════════════════════════════
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.useEngineOutput = useEngineOutput;
13
+ 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;
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 strategy = {
113
+ rank: rank !== null && rank !== void 0 ? rank : 99,
114
+ code: (_e = template === null || template === void 0 ? void 0 : template.code) !== null && _e !== void 0 ? _e : analysis.strategy_id,
115
+ name: analysis.strategy_name,
116
+ cat: (_f = template === null || template === void 0 ? void 0 : template.cat) !== null && _f !== void 0 ? _f : "deductions",
117
+ priority: mapPriority(analysis.priority_tier, analysis.quick_win),
118
+ score: Math.round(analysis.weighted_score),
119
+ entities: (_g = template === null || template === void 0 ? void 0 : template.entities) !== null && _g !== void 0 ? _g : ["S-Corporation", "C-Corporation", "Partnership/LLC", "Sole Proprietorship"],
120
+ lo,
121
+ hi,
122
+ timeline: (_h = template === null || template === void 0 ? void 0 : template.timeline) !== null && _h !== void 0 ? _h : timelineBucket,
123
+ timelineBucket,
124
+ 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,
125
+ 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,
126
+ 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,
127
+ abstract: analysis.engagement_recommendation,
128
+ trace: traceFromEngine(trace),
129
+ needsPTE: template === null || template === void 0 ? void 0 : template.needsPTE,
130
+ onlyIndustry: template === null || template === void 0 ? void 0 : template.onlyIndustry,
131
+ excludeIndustry: template === null || template === void 0 ? void 0 : template.excludeIndustry,
132
+ preferIndustry: template === null || template === void 0 ? void 0 : template.preferIndustry,
133
+ minEmployees: template === null || template === void 0 ? void 0 : template.minEmployees,
134
+ needsOwnerComp: template === null || template === void 0 ? void 0 : template.needsOwnerComp,
135
+ clientBrief: (_q = (_p = engineOutput.client_summary.strategies.find((cs) => cs.strategy_name === analysis.strategy_name)) === null || _p === void 0 ? void 0 : _p.why_it_applies) !== null && _q !== void 0 ? _q : template === null || template === void 0 ? void 0 : template.clientBrief,
136
+ action: (_s = (_r = engineOutput.client_summary.strategies.find((cs) => cs.strategy_name === analysis.strategy_name)) === null || _r === void 0 ? void 0 : _r.next_step) !== null && _s !== void 0 ? _s : template === null || template === void 0 ? void 0 : template.action,
137
+ };
138
+ strategies.push(strategy);
139
+ computedMap.set(strategy.rank, {
140
+ lo,
141
+ hi,
142
+ trace: strategy.trace,
143
+ });
144
+ }
145
+ // Sort by weighted_score descending (same ordering the FE uses)
146
+ strategies.sort((a, b) => b.score - a.score);
147
+ return { strategies, computedMap, engineOutput };
148
+ }
149
+ // ── React hook ────────────────────────────────────────────────────────
150
+ function useEngineOutput(engineOutput) {
151
+ return (0, react_1.useMemo)(() => {
152
+ if (!engineOutput)
153
+ return null;
154
+ return adaptEngineOutput(engineOutput);
155
+ }, [engineOutput]);
156
+ }
@@ -1,3 +1,4 @@
1
1
  import { DocSpec } from "../types";
2
2
  export type TaxAxisEntityTypeKey = "S_CORP" | "C_CORP" | "PARTNERSHIP" | "LLC" | "SOLE_PROP";
3
+ export declare const DOC_SPECS_BASE: DocSpec[];
3
4
  export declare function getDocSpecs(entityType?: TaxAxisEntityTypeKey | string | null): DocSpec[];
@@ -7,6 +7,7 @@
7
7
  // uploadTaxAxisDocument mutation.
8
8
  // ═══════════════════════════════════════════════════════════════════
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.DOC_SPECS_BASE = void 0;
10
11
  exports.getDocSpecs = getDocSpecs;
11
12
  const DOC_META = {
12
13
  federal_tax_return: {
@@ -217,6 +218,10 @@ function buildDocSpec(documentType) {
217
218
  help: meta.help,
218
219
  };
219
220
  }
221
+ // All doc specs across all entity types — used for reverse-mapping strategy → document needs.
222
+ exports.DOC_SPECS_BASE = LLC_TYPES
223
+ .map(buildDocSpec)
224
+ .filter((s) => s !== null);
220
225
  function getDocSpecs(entityType) {
221
226
  var _a;
222
227
  const types = entityType
@@ -0,0 +1,13 @@
1
+ export interface FieldDef {
2
+ label: string;
3
+ sourceRef?: string;
4
+ }
5
+ export interface SectionDef {
6
+ head: string;
7
+ fields: string[];
8
+ }
9
+ export interface DocFieldCatalog {
10
+ sections: SectionDef[];
11
+ fields: Record<string, FieldDef>;
12
+ }
13
+ export declare const DOCUMENT_FIELD_CATALOG: Record<string, DocFieldCatalog>;