@paro.io/expert-shared-components 1.14.52 → 1.14.53
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/components/DocumentCenter/MultiFileUploadSection.js +220 -121
- package/lib/components/TaxAxis/TaxAxisApi.d.ts +1 -0
- package/lib/components/TaxAxis/TaxAxisShell.js +36 -9
- package/lib/index.d.ts +1 -14
- package/lib/index.js +1 -27
- package/lib/tax-axis/components/clientReport/TaxAxisClientReport.d.ts +6 -2
- package/lib/tax-axis/components/clientReport/TaxAxisClientReport.js +5 -3
- package/lib/tax-axis/components/dashboard/TaxAxisDashboard.d.ts +2 -1
- package/lib/tax-axis/components/dashboard/TaxAxisDashboard.js +163 -34
- package/lib/tax-axis/components/documents/DocumentCard.d.ts +3 -1
- package/lib/tax-axis/components/documents/DocumentCard.js +17 -5
- package/lib/tax-axis/components/documents/DocumentReviewModal.d.ts +13 -0
- package/lib/tax-axis/components/documents/DocumentReviewModal.js +248 -0
- package/lib/tax-axis/components/documents/DocumentTier.d.ts +3 -1
- package/lib/tax-axis/components/documents/DocumentTier.js +2 -2
- package/lib/tax-axis/components/documents/TaxAxisDocuments.d.ts +5 -1
- package/lib/tax-axis/components/documents/TaxAxisDocuments.js +86 -5
- package/lib/tax-axis/components/extractionReview/TaxAxisExtractionReview.js +17 -17
- package/lib/tax-axis/components/intake/ClientParametersSection.js +1 -1
- package/lib/tax-axis/components/intake/intakeSchema.js +1 -1
- package/lib/tax-axis/components/preparerWorkpaper/TaxAxisPreparerWorkpaper.d.ts +6 -2
- package/lib/tax-axis/components/preparerWorkpaper/TaxAxisPreparerWorkpaper.js +5 -3
- package/lib/tax-axis/index.d.ts +4 -0
- package/lib/tax-axis/index.js +6 -1
- package/lib/tax-axis/lib/adapters/useEngineOutput.d.ts +144 -0
- package/lib/tax-axis/lib/adapters/useEngineOutput.js +155 -0
- package/lib/tax-axis/lib/data/documents.d.ts +1 -0
- package/lib/tax-axis/lib/data/documents.js +5 -0
- package/lib/tax-axis/lib/documentFieldCatalog.d.ts +13 -0
- package/lib/tax-axis/lib/documentFieldCatalog.js +808 -0
- 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,155 @@
|
|
|
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
|
+
const steps = [];
|
|
75
|
+
// Emit formula as step 1
|
|
76
|
+
if (trace.formula) {
|
|
77
|
+
steps.push({
|
|
78
|
+
n: 1,
|
|
79
|
+
step: "Formula",
|
|
80
|
+
formula: trace.formula,
|
|
81
|
+
result: trace.result_gross != null ? `$${trace.result_gross.toLocaleString()}` : "See CI",
|
|
82
|
+
src: trace.irs_cite || "",
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
// Emit confidence interval as step 2 when present
|
|
86
|
+
if (trace.confidence_interval) {
|
|
87
|
+
steps.push({
|
|
88
|
+
n: 2,
|
|
89
|
+
step: "Confidence range",
|
|
90
|
+
formula: `Low × ${trace.confidence_interval.basis}`,
|
|
91
|
+
result: `$${trace.confidence_interval.low.toLocaleString()} – $${trace.confidence_interval.high.toLocaleString()}`,
|
|
92
|
+
src: trace.irs_cite || "",
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
return steps;
|
|
96
|
+
}
|
|
97
|
+
function adaptEngineOutput(engineOutput) {
|
|
98
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
99
|
+
const strategies = [];
|
|
100
|
+
const computedMap = new Map();
|
|
101
|
+
for (const analysis of engineOutput.strategy_analysis) {
|
|
102
|
+
if (analysis.priority_tier === "NOT_RECOMMENDED")
|
|
103
|
+
continue;
|
|
104
|
+
const rank = ENGINE_ID_TO_RANK[analysis.strategy_id];
|
|
105
|
+
const template = rank != null ? CATALOG_BY_RANK.get(rank) : undefined;
|
|
106
|
+
const trace = analysis.calculation_trace;
|
|
107
|
+
const ci = trace === null || trace === void 0 ? void 0 : trace.confidence_interval;
|
|
108
|
+
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;
|
|
109
|
+
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;
|
|
110
|
+
const timelineBucket = resolveTimelineBucket(analysis.strategy_id, engineOutput.implementation_roadmap);
|
|
111
|
+
const strategy = {
|
|
112
|
+
rank: rank !== null && rank !== void 0 ? rank : 99,
|
|
113
|
+
code: (_e = template === null || template === void 0 ? void 0 : template.code) !== null && _e !== void 0 ? _e : analysis.strategy_id,
|
|
114
|
+
name: analysis.strategy_name,
|
|
115
|
+
cat: (_f = template === null || template === void 0 ? void 0 : template.cat) !== null && _f !== void 0 ? _f : "deductions",
|
|
116
|
+
priority: mapPriority(analysis.priority_tier, analysis.quick_win),
|
|
117
|
+
score: Math.round(analysis.weighted_score),
|
|
118
|
+
entities: (_g = template === null || template === void 0 ? void 0 : template.entities) !== null && _g !== void 0 ? _g : ["S-Corporation", "C-Corporation", "Partnership/LLC", "Sole Proprietorship"],
|
|
119
|
+
lo,
|
|
120
|
+
hi,
|
|
121
|
+
timeline: (_h = template === null || template === void 0 ? void 0 : template.timeline) !== null && _h !== void 0 ? _h : timelineBucket,
|
|
122
|
+
timelineBucket,
|
|
123
|
+
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,
|
|
124
|
+
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,
|
|
125
|
+
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,
|
|
126
|
+
abstract: analysis.engagement_recommendation,
|
|
127
|
+
trace: traceFromEngine(trace),
|
|
128
|
+
needsPTE: template === null || template === void 0 ? void 0 : template.needsPTE,
|
|
129
|
+
onlyIndustry: template === null || template === void 0 ? void 0 : template.onlyIndustry,
|
|
130
|
+
excludeIndustry: template === null || template === void 0 ? void 0 : template.excludeIndustry,
|
|
131
|
+
preferIndustry: template === null || template === void 0 ? void 0 : template.preferIndustry,
|
|
132
|
+
minEmployees: template === null || template === void 0 ? void 0 : template.minEmployees,
|
|
133
|
+
needsOwnerComp: template === null || template === void 0 ? void 0 : template.needsOwnerComp,
|
|
134
|
+
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,
|
|
135
|
+
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,
|
|
136
|
+
};
|
|
137
|
+
strategies.push(strategy);
|
|
138
|
+
computedMap.set(strategy.rank, {
|
|
139
|
+
lo,
|
|
140
|
+
hi,
|
|
141
|
+
trace: strategy.trace,
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
// Sort by weighted_score descending (same ordering the FE uses)
|
|
145
|
+
strategies.sort((a, b) => b.score - a.score);
|
|
146
|
+
return { strategies, computedMap, engineOutput };
|
|
147
|
+
}
|
|
148
|
+
// ── React hook ────────────────────────────────────────────────────────
|
|
149
|
+
function useEngineOutput(engineOutput) {
|
|
150
|
+
return (0, react_1.useMemo)(() => {
|
|
151
|
+
if (!engineOutput)
|
|
152
|
+
return null;
|
|
153
|
+
return adaptEngineOutput(engineOutput);
|
|
154
|
+
}, [engineOutput]);
|
|
155
|
+
}
|
|
@@ -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>;
|