@paro.io/expert-shared-components 1.14.76 → 1.14.77

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.
@@ -6,8 +6,9 @@ export interface DocumentReviewModalProps {
6
6
  documentName: string;
7
7
  fileName: string;
8
8
  jobId: string;
9
+ documentType?: string;
9
10
  parsedData?: Record<string, unknown> | null;
10
11
  onSaveReviewedData?: (fields: Record<string, string>) => Promise<void>;
11
12
  onClose: () => void;
12
13
  }
13
- export declare function DocumentReviewModal({ documentId, documentName, fileName, jobId: _jobId, parsedData, onSaveReviewedData, onClose, }: DocumentReviewModalProps): React.JSX.Element;
14
+ export declare function DocumentReviewModal({ documentId, documentName, fileName, jobId: _jobId, documentType: documentTypeProp, parsedData, onSaveReviewedData, onClose, }: DocumentReviewModalProps): React.JSX.Element;
@@ -138,7 +138,7 @@ function getTotalFieldCount(sections) {
138
138
  return sections.reduce((sum, s) => sum + s.fields.length, 0);
139
139
  }
140
140
  // ── Component ──
141
- function DocumentReviewModal({ documentId, documentName, fileName, jobId: _jobId, parsedData, onSaveReviewedData, onClose, }) {
141
+ function DocumentReviewModal({ documentId, documentName, fileName, jobId: _jobId, documentType: documentTypeProp, parsedData, onSaveReviewedData, onClose, }) {
142
142
  const [loading, setLoading] = (0, react_1.useState)(true);
143
143
  const [sections, setSections] = (0, react_1.useState)([]);
144
144
  const [saveStatus, setSaveStatus] = (0, react_1.useState)("idle");
@@ -147,7 +147,8 @@ function DocumentReviewModal({ documentId, documentName, fileName, jobId: _jobId
147
147
  var _a;
148
148
  if (parsedData && typeof parsedData === "object") {
149
149
  const fields = ((_a = parsedData.fields) !== null && _a !== void 0 ? _a : parsedData);
150
- const documentType = parsedData.documentType || documentId;
150
+ // Prefer explicit prop, then parsedData.documentType, never fall back to documentId (UUID)
151
+ const documentType = documentTypeProp || parsedData.documentType || "";
151
152
  setSections(buildSectionsFromCatalog(documentType, fields));
152
153
  setLoading(false);
153
154
  return;
@@ -158,7 +159,7 @@ function DocumentReviewModal({ documentId, documentName, fileName, jobId: _jobId
158
159
  setLoading(false);
159
160
  }, 400);
160
161
  return () => clearTimeout(t);
161
- }, [documentId, parsedData]);
162
+ }, [documentId, documentTypeProp, parsedData]);
162
163
  const handleFieldChange = (0, react_1.useCallback)((sectionIdx, fieldIdx, newValue) => {
163
164
  setSections((prev) => prev.map((sec, si) => si === sectionIdx
164
165
  ? Object.assign(Object.assign({}, sec), { fields: sec.fields.map((f, fi) => fi === fieldIdx ? Object.assign(Object.assign({}, f), { value: newValue }) : f) }) : sec));
@@ -147,6 +147,7 @@ function TaxAxisDocuments({ profile, entityType, onContinue, onBack, onUploadDoc
147
147
  if (!fetchUploadedDocuments)
148
148
  return;
149
149
  fetchUploadedDocuments().then((uploaded) => {
150
+ var _a;
150
151
  if (!uploaded.length)
151
152
  return;
152
153
  const parsedByType = {};
@@ -171,14 +172,25 @@ function TaxAxisDocuments({ profile, entityType, onContinue, onBack, onUploadDoc
171
172
  }));
172
173
  // Populate document ID map in one batch
173
174
  setUploadedDocIds((prev) => (Object.assign(Object.assign({}, prev), nextDocIds)));
174
- // Populate review modal data
175
- for (const doc of uploaded) {
175
+ // Populate review modal data — sort newest-first so the most recent doc wins
176
+ // when multiple docs share the same documentType (e.g. two profit_loss years).
177
+ const uploadedSorted = [...uploaded].sort((a, b) => new Date(String(b.updatedAt || 0)).getTime() - new Date(String(a.updatedAt || 0)).getTime());
178
+ for (const doc of uploadedSorted) {
176
179
  if (!doc.documentType)
177
180
  continue;
178
- if (doc.parsedData)
179
- parsedByType[doc.documentType] = doc.parsedData;
181
+ // Only store parsedData if it has non-empty fields, and don't overwrite
182
+ // a richer entry already stored for this documentType.
183
+ const pData = doc.parsedData;
184
+ const pFields = pData ? ((_a = pData.fields) !== null && _a !== void 0 ? _a : pData) : null;
185
+ if (pFields && Object.keys(pFields).filter((k) => k !== '_line_items').length > 0) {
186
+ if (!(doc.documentType in parsedByType)) {
187
+ parsedByType[doc.documentType] = pData;
188
+ }
189
+ }
180
190
  if (doc.reviewedData && Object.keys(doc.reviewedData).length > 0) {
181
- reviewedByType[doc.documentType] = doc.reviewedData;
191
+ if (!(doc.documentType in reviewedByType)) {
192
+ reviewedByType[doc.documentType] = doc.reviewedData;
193
+ }
182
194
  }
183
195
  }
184
196
  if (Object.keys(parsedByType).length > 0)
@@ -416,7 +428,7 @@ function TaxAxisDocuments({ profile, entityType, onContinue, onBack, onUploadDoc
416
428
  : failedCount > 0
417
429
  ? `Continue (${failedCount} failed)`
418
430
  : "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
431
+ reviewDoc && (react_1.default.createElement(DocumentReviewModal_1.DocumentReviewModal, { documentId: reviewDoc.id, documentName: reviewDoc.name, fileName: reviewDoc.fileName || "", jobId: jobId, documentType: reviewDoc.documentType || undefined, parsedData: reviewParsedData, onSaveReviewedData: onSaveReviewedField
420
432
  ? (fields) => __awaiter(this, void 0, void 0, function* () {
421
433
  const docId = uploadedDocIds[docs.indexOf(reviewDoc)];
422
434
  if (docId)
@@ -39,58 +39,107 @@ exports.DOCUMENT_FIELD_CATALOG = {
39
39
  sections: [
40
40
  {
41
41
  head: "Revenue",
42
- fields: ["total_revenue", "gross_revenue", "cost_of_goods_sold", "gross_profit"],
42
+ fields: ["total_revenue", "cost_of_goods_sold", "gross_profit"],
43
43
  },
44
44
  {
45
45
  head: "Operating Expenses",
46
- fields: ["total_expenses", "payroll_expense", "rent_expense", "depreciation", "other_expenses"],
46
+ fields: [
47
+ "total_operating_expenses",
48
+ "salaries_wages_staff",
49
+ "rent_expense",
50
+ "depreciation_expense",
51
+ "amortization_expense",
52
+ "advertising_marketing",
53
+ "professional_fees",
54
+ "insurance_nonhealth",
55
+ "business_meals",
56
+ "other_expenses",
57
+ ],
47
58
  },
48
59
  {
49
60
  head: "Net Income",
50
- fields: ["net_income", "net_margin"],
61
+ fields: ["net_operating_income", "net_income"],
51
62
  },
52
63
  ],
53
64
  fields: {
54
65
  total_revenue: { label: "Total Revenue" },
55
- gross_revenue: { label: "Gross Revenue" },
56
66
  cost_of_goods_sold: { label: "Cost of Goods Sold (COGS)" },
57
67
  gross_profit: { label: "Gross Profit" },
58
- total_expenses: { label: "Total Operating Expenses" },
59
- payroll_expense: { label: "Payroll & Compensation" },
68
+ total_operating_expenses: { label: "Total Operating Expenses" },
69
+ salaries_wages_staff: { label: "Salaries & Wages" },
60
70
  rent_expense: { label: "Rent / Lease" },
61
- depreciation: { label: "Depreciation & Amortization" },
71
+ depreciation_expense: { label: "Depreciation" },
72
+ amortization_expense: { label: "Amortization" },
73
+ advertising_marketing: { label: "Advertising & Marketing" },
74
+ professional_fees: { label: "Professional Fees" },
75
+ insurance_nonhealth: { label: "Insurance" },
76
+ business_meals: { label: "Meals & Entertainment" },
62
77
  other_expenses: { label: "Other Expenses" },
78
+ net_operating_income: { label: "Net Operating Income" },
63
79
  net_income: { label: "Net Income" },
64
- net_margin: { label: "Net Profit Margin" },
65
80
  },
66
81
  },
67
82
  balance_sheet: {
68
83
  sections: [
69
84
  {
70
85
  head: "Assets",
71
- fields: ["total_assets", "current_assets", "cash", "accounts_receivable", "fixed_assets"],
86
+ fields: [
87
+ "total_current_assets",
88
+ "total_assets",
89
+ "cash_and_equivalents",
90
+ "accounts_receivable",
91
+ "inventory",
92
+ "prepaid_expenses",
93
+ "property_equipment_net",
94
+ "accumulated_depreciation",
95
+ ],
72
96
  },
73
97
  {
74
98
  head: "Liabilities",
75
- fields: ["total_liabilities", "current_liabilities", "accounts_payable", "long_term_debt"],
99
+ fields: [
100
+ "total_current_liabilities",
101
+ "total_liabilities",
102
+ "accounts_payable",
103
+ "accrued_liabilities",
104
+ "deferred_revenue",
105
+ "short_term_debt",
106
+ "long_term_debt",
107
+ "total_liabilities_and_equity",
108
+ ],
76
109
  },
77
110
  {
78
111
  head: "Equity",
79
- fields: ["total_equity", "retained_earnings"],
112
+ fields: [
113
+ "total_equity",
114
+ "retained_earnings",
115
+ "owners_equity",
116
+ "common_stock_par_value",
117
+ "additional_paid_in_capital",
118
+ ],
80
119
  },
81
120
  ],
82
121
  fields: {
122
+ total_current_assets: { label: "Total Current Assets" },
83
123
  total_assets: { label: "Total Assets" },
84
- current_assets: { label: "Current Assets" },
85
- cash: { label: "Cash & Equivalents" },
124
+ cash_and_equivalents: { label: "Cash & Equivalents" },
86
125
  accounts_receivable: { label: "Accounts Receivable" },
87
- fixed_assets: { label: "Fixed Assets (Net)" },
126
+ inventory: { label: "Inventory" },
127
+ prepaid_expenses: { label: "Prepaid Expenses" },
128
+ property_equipment_net: { label: "Fixed Assets (Net)" },
129
+ accumulated_depreciation: { label: "Accumulated Depreciation" },
130
+ total_current_liabilities: { label: "Total Current Liabilities" },
88
131
  total_liabilities: { label: "Total Liabilities" },
89
- current_liabilities: { label: "Current Liabilities" },
90
132
  accounts_payable: { label: "Accounts Payable" },
133
+ accrued_liabilities: { label: "Accrued Liabilities" },
134
+ deferred_revenue: { label: "Deferred Revenue" },
135
+ short_term_debt: { label: "Short-Term Debt" },
91
136
  long_term_debt: { label: "Long-Term Debt" },
137
+ total_liabilities_and_equity: { label: "Total Liabilities & Equity" },
92
138
  total_equity: { label: "Total Equity" },
93
139
  retained_earnings: { label: "Retained Earnings" },
140
+ owners_equity: { label: "Owner's Equity" },
141
+ common_stock_par_value: { label: "Common Stock" },
142
+ additional_paid_in_capital: { label: "Opening Balance Equity" },
94
143
  },
95
144
  },
96
145
  schedule_k1_s_corp: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paro.io/expert-shared-components",
3
- "version": "1.14.76",
3
+ "version": "1.14.77",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {