@mindbill/react 0.23.1 → 0.23.2

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/README.md CHANGED
@@ -153,7 +153,7 @@ The component includes the interaction model, not just the markup:
153
153
  - ZIP-to-city/state completion through MindBill's authenticated postal directory;
154
154
  - complete, server-backed ICD-10 search with an alphabetized 100-code first page, automatic 100-code scroll paging, common-injury quick picks, and removable chips;
155
155
  - canonical claims-administrator search through the authenticated MindBill payer directory;
156
- - QME, AME, and Psych QME evaluation modes with medical-legal modifier defaults;
156
+ - QME, AME, and Psych QME evaluation modes with medical-legal modifier defaults; Psych QME also seeds `Z04.6` when no more specific diagnosis was supplied, and exposes it as a Psych quick pick;
157
157
  - searchable workers-comp procedure/modifier controls, medical-legal fee-schedule amounts, totals, valid manual CPT/HCPCS entry, and an automatically maintained empty line;
158
158
  - removable source documents with new-tab previews, a locked auto-attached practice W-9, and a full-width click, panel-drop, or whole-page PDF upload area. Every visible source document is included until removed; uploaded PDFs do not require document-type tagging.
159
159
 
package/dist/index.d.ts CHANGED
@@ -519,6 +519,9 @@ declare function ensureTrailingBillSubmissionLine(lines: BillSubmissionInput["se
519
519
  declare function parseBillSubmissionDate(value: string): string | undefined;
520
520
  declare function formatBillSubmissionDate(value: string | null | undefined): string;
521
521
  declare function applyBillSubmissionEvaluationModifiers(lines: BillSubmissionInput["serviceLines"], type: BillSubmissionEvaluationType): BillSubmissionInput["serviceLines"];
522
+ declare const PSYCH_QME_DEFAULT_DIAGNOSIS = "Z04.6";
523
+ /** Seed Psych QME's general examination code only when no diagnosis was supplied. */
524
+ declare function applyBillSubmissionEvaluationDiagnoses(diagnoses: string[] | undefined, type: BillSubmissionEvaluationType): string[];
522
525
  declare function validateBillSubmission(bill: BillSubmissionInput): BillSubmissionValidation;
523
526
  type BillSubmissionSectionId = "header" | "patient" | "claim" | "providers" | "serviceLines" | "attachments" | "actions";
524
527
  declare function BillSubmissionHeader(): ReactElement;
@@ -790,4 +793,4 @@ type MindBillWidgetProps = {
790
793
  declare function MindBillBillTimeline(props: MindBillWidgetProps): ReactElement;
791
794
  declare function MindBillBillReview(props: MindBillWidgetProps): ReactElement;
792
795
 
793
- export { BILL_SUBMISSION_DIAGNOSIS_QUICK_PICKS, BILL_SUBMISSION_DOCUMENT_TYPES, BILL_SUBMISSION_REQUIRED_FIELDS, type BillActivityEvent, BillActivityTimeline, type BillActivityTimelineProps, type BillAgingBucket, type BillAgingBucketId, BillAgingSummary, type BillAgingSummaryProps, BillLifecycleActions, type BillLifecycleActionsProps, BillLifecycleProgress, type BillLifecycleProgressProps, type BillLifecycleStage, BillList, type BillListProps, BillPayerContactCard, type BillPayerContactCardProps, BillPaymentLedger, type BillPaymentLedgerProps, BillReadOnlyForm, type BillReadOnlyFormProps, BillRemittanceCard, type BillRemittanceCardProps, type BillReviewAttachment, type BillReviewBillingProvider, type BillReviewClinician, type BillReviewData, type BillReviewDocumentType, type BillReviewDraft, type BillReviewFeatures, BillReviewForm, type BillReviewFormProps, type BillReviewLineItem, type BillReviewLocation, type BillReviewPayer, type BillReviewSaveInput, BillSnapshotSummary, type BillSnapshotSummaryProps, type BillStatusAction, type BillStatusClient, type BillStatusClientOptions, type BillStatusData, type BillStatusSession, type BillStatusSessionProvider, type BillStatusSessionRequest, BillStatusSummary, type BillStatusSummaryProps, BillSubmissionActions, type BillSubmissionAddress, BillSubmissionAttachmentsSection, BillSubmissionClaimSection, type BillSubmissionDiagnosisOption, type BillSubmissionDocumentType, type BillSubmissionEvaluationType, BillSubmissionForm, type BillSubmissionFormProps, type BillSubmissionFormValue, BillSubmissionHeader, type BillSubmissionInput, type BillSubmissionModifierOption, BillSubmissionPatientSection, type BillSubmissionPostalPlace, type BillSubmissionProcedureOption, BillSubmissionProvidersSection, type BillSubmissionRoute, type BillSubmissionSectionId, BillSubmissionServiceLinesSection, type BillSubmissionSourceAttachment, type BillSubmissionUpload, type BillSubmissionValidation, type BillingComponentProps, BillingDashboard, type BillingDashboardBill, type BillingDashboardProps, type BillingDashboardSummary, BillingReport, type BillingReportDimension, type BillingReportProps, type BillingReportRow, ConnectedBillLifecycle, type ConnectedBillLifecycleProps, ConnectedBillStatus, type ConnectedBillStatusProps, DEFAULT_BILL_SUBMISSION_MODIFIERS, DEFAULT_BILL_SUBMISSION_PROCEDURES, MindBillBillReview, MindBillBillTimeline, type MindBillReactAppearance, type MindBillThemePreset, type MindBillWidgetProps, type UseBillLifecycleOptions, type UseBillLifecycleResult, type UseBillStatusOptions, type UseBillStatusResult, applyBillSubmissionEvaluationModifiers, billActivityEventLabel, billAgingBucket, billAgingDays, billLifecycleDisplayLabel, billLifecycleStage, buildBillReviewSaveInput, buildBillingReportCsv, buildBillingReportRows, calculateBillSubmissionAllowedAmount, createBillStatusClient, ensureTrailingBillSubmissionLine, ensureTrailingProcedureLine, formatBillSubmissionDate, mindBillAppearanceStyle, mindBillThemePresets, parseBillSubmissionDate, prepareBillSubmissionDocuments, resolveMindBillAppearance, summarizeBillingDashboard, useBillLifecycle, useBillStatus, validateBillSubmission, visibleBillLifecycleActions };
796
+ export { BILL_SUBMISSION_DIAGNOSIS_QUICK_PICKS, BILL_SUBMISSION_DOCUMENT_TYPES, BILL_SUBMISSION_REQUIRED_FIELDS, type BillActivityEvent, BillActivityTimeline, type BillActivityTimelineProps, type BillAgingBucket, type BillAgingBucketId, BillAgingSummary, type BillAgingSummaryProps, BillLifecycleActions, type BillLifecycleActionsProps, BillLifecycleProgress, type BillLifecycleProgressProps, type BillLifecycleStage, BillList, type BillListProps, BillPayerContactCard, type BillPayerContactCardProps, BillPaymentLedger, type BillPaymentLedgerProps, BillReadOnlyForm, type BillReadOnlyFormProps, BillRemittanceCard, type BillRemittanceCardProps, type BillReviewAttachment, type BillReviewBillingProvider, type BillReviewClinician, type BillReviewData, type BillReviewDocumentType, type BillReviewDraft, type BillReviewFeatures, BillReviewForm, type BillReviewFormProps, type BillReviewLineItem, type BillReviewLocation, type BillReviewPayer, type BillReviewSaveInput, BillSnapshotSummary, type BillSnapshotSummaryProps, type BillStatusAction, type BillStatusClient, type BillStatusClientOptions, type BillStatusData, type BillStatusSession, type BillStatusSessionProvider, type BillStatusSessionRequest, BillStatusSummary, type BillStatusSummaryProps, BillSubmissionActions, type BillSubmissionAddress, BillSubmissionAttachmentsSection, BillSubmissionClaimSection, type BillSubmissionDiagnosisOption, type BillSubmissionDocumentType, type BillSubmissionEvaluationType, BillSubmissionForm, type BillSubmissionFormProps, type BillSubmissionFormValue, BillSubmissionHeader, type BillSubmissionInput, type BillSubmissionModifierOption, BillSubmissionPatientSection, type BillSubmissionPostalPlace, type BillSubmissionProcedureOption, BillSubmissionProvidersSection, type BillSubmissionRoute, type BillSubmissionSectionId, BillSubmissionServiceLinesSection, type BillSubmissionSourceAttachment, type BillSubmissionUpload, type BillSubmissionValidation, type BillingComponentProps, BillingDashboard, type BillingDashboardBill, type BillingDashboardProps, type BillingDashboardSummary, BillingReport, type BillingReportDimension, type BillingReportProps, type BillingReportRow, ConnectedBillLifecycle, type ConnectedBillLifecycleProps, ConnectedBillStatus, type ConnectedBillStatusProps, DEFAULT_BILL_SUBMISSION_MODIFIERS, DEFAULT_BILL_SUBMISSION_PROCEDURES, MindBillBillReview, MindBillBillTimeline, type MindBillReactAppearance, type MindBillThemePreset, type MindBillWidgetProps, PSYCH_QME_DEFAULT_DIAGNOSIS, type UseBillLifecycleOptions, type UseBillLifecycleResult, type UseBillStatusOptions, type UseBillStatusResult, applyBillSubmissionEvaluationDiagnoses, applyBillSubmissionEvaluationModifiers, billActivityEventLabel, billAgingBucket, billAgingDays, billLifecycleDisplayLabel, billLifecycleStage, buildBillReviewSaveInput, buildBillingReportCsv, buildBillingReportRows, calculateBillSubmissionAllowedAmount, createBillStatusClient, ensureTrailingBillSubmissionLine, ensureTrailingProcedureLine, formatBillSubmissionDate, mindBillAppearanceStyle, mindBillThemePresets, parseBillSubmissionDate, prepareBillSubmissionDocuments, resolveMindBillAppearance, summarizeBillingDashboard, useBillLifecycle, useBillStatus, validateBillSubmission, visibleBillLifecycleActions };
package/dist/index.js CHANGED
@@ -1233,6 +1233,7 @@ var DEFAULT_BILL_SUBMISSION_MODIFIERS = [
1233
1233
  { code: "XU", description: "Unusual non-overlapping service" }
1234
1234
  ];
1235
1235
  var BILL_SUBMISSION_DIAGNOSIS_QUICK_PICKS = [
1236
+ { label: "Psych", code: "Z04.6", description: "General psychiatric examination requested by authority" },
1236
1237
  { label: "Back", code: "M54.50", description: "Low back pain, unspecified" },
1237
1238
  { label: "Neck", code: "M54.2", description: "Cervicalgia" },
1238
1239
  { label: "Left hand", code: "M79.642", description: "Pain in left hand" },
@@ -1416,6 +1417,20 @@ function applyBillSubmissionEvaluationModifiers(lines, type) {
1416
1417
  return { ...line, modifiers: auto ? [auto, ...modifiers] : modifiers };
1417
1418
  });
1418
1419
  }
1420
+ var PSYCH_QME_DEFAULT_DIAGNOSIS = "Z04.6";
1421
+ function applyBillSubmissionEvaluationDiagnoses(diagnoses, type) {
1422
+ const current = [...diagnoses ?? []];
1423
+ return type === "psych_qme" && !current.some((code) => code.trim()) ? [PSYCH_QME_DEFAULT_DIAGNOSIS] : current;
1424
+ }
1425
+ function initialEvaluationType(bill) {
1426
+ if (bill.renderingProvider?.isAme) return "ame";
1427
+ return bill.renderingProvider?.specialty?.toLowerCase().includes("psych") ? "psych_qme" : "qme";
1428
+ }
1429
+ function cloneInitialBill(bill) {
1430
+ const cloned = cloneBill(bill);
1431
+ cloned.diagnoses = applyBillSubmissionEvaluationDiagnoses(cloned.diagnoses, initialEvaluationType(bill));
1432
+ return cloned;
1433
+ }
1419
1434
  function submittedLines(lines) {
1420
1435
  return lines.filter(lineHasContent).map((line) => ({ ...line, code: line.code.trim(), modifiers: [...line.modifiers ?? []] }));
1421
1436
  }
@@ -1626,7 +1641,7 @@ function BillSubmissionForm({
1626
1641
  description = "Review the bill details, add attachments, and submit.",
1627
1642
  children
1628
1643
  }) {
1629
- const [bill, setBill] = useState2(() => cloneBill(initialBill));
1644
+ const [bill, setBill] = useState2(() => cloneInitialBill(initialBill));
1630
1645
  const [selectedIds, setSelectedIds] = useState2(() => attachments.map((item) => item.id));
1631
1646
  const [removedSourceIds, setRemovedSourceIds] = useState2([]);
1632
1647
  const [uploads, setUploads] = useState2([]);
@@ -1649,13 +1664,14 @@ function BillSubmissionForm({
1649
1664
  const diagnosisAppendPending = useRef2(false);
1650
1665
  const procedures = useMemo2(() => mergeOptions(DEFAULT_BILL_SUBMISSION_PROCEDURES, procedureOptions), [procedureOptions]);
1651
1666
  const modifiers = useMemo2(() => mergeOptions(DEFAULT_BILL_SUBMISSION_MODIFIERS, modifierOptions), [modifierOptions]);
1652
- const [evaluationType, setEvaluationType] = useState2(() => initialBill.renderingProvider?.isAme ? "ame" : initialBill.renderingProvider?.specialty?.toLowerCase().includes("psych") ? "psych_qme" : "qme");
1667
+ const [evaluationType, setEvaluationType] = useState2(() => initialEvaluationType(initialBill));
1653
1668
  const connected = !onSubmit;
1654
1669
  const referenceClient = useMemo2(() => getSession || sessionEndpoint || connected ? createBillReferenceClient({ getSession, sessionEndpoint, apiBaseUrl, fetch: fetchOverride }) : null, [getSession, sessionEndpoint, apiBaseUrl, fetchOverride, connected]);
1655
1670
  const submissionClient = useMemo2(() => connected ? createBillSubmissionClient({ getSession, sessionEndpoint, apiBaseUrl, fetch: fetchOverride }) : null, [getSession, sessionEndpoint, apiBaseUrl, fetchOverride, connected]);
1656
1671
  const locked = disabled || submitting;
1657
1672
  useEffect2(() => {
1658
- setBill(cloneBill(initialBill));
1673
+ setBill(cloneInitialBill(initialBill));
1674
+ setEvaluationType(initialEvaluationType(initialBill));
1659
1675
  setSelectedIds(attachments.map((item) => item.id));
1660
1676
  setRemovedSourceIds([]);
1661
1677
  setUploads([]);
@@ -1785,7 +1801,7 @@ function BillSubmissionForm({
1785
1801
  };
1786
1802
  const changeEvaluation = (type) => {
1787
1803
  setEvaluationType(type);
1788
- setBill((current) => ({ ...current, renderingProvider: { ...current.renderingProvider, isAme: type === "ame", isQme: type !== "ame", ...type === "psych_qme" && !current.renderingProvider?.specialty ? { specialty: "Psychiatry" } : {} }, serviceLines: applyBillSubmissionEvaluationModifiers(current.serviceLines, type) }));
1804
+ setBill((current) => ({ ...current, diagnoses: applyBillSubmissionEvaluationDiagnoses(current.diagnoses, type), renderingProvider: { ...current.renderingProvider, isAme: type === "ame", isQme: type !== "ame", ...type === "psych_qme" && !current.renderingProvider?.specialty ? { specialty: "Psychiatry" } : {} }, serviceLines: applyBillSubmissionEvaluationModifiers(current.serviceLines, type) }));
1789
1805
  };
1790
1806
  const lineCharge = (line) => calculateBillSubmissionAllowedAmount(line, procedures) ?? (Number.isFinite(line.charge) ? Number(line.charge) : void 0);
1791
1807
  const total = submittedLines(bill.serviceLines).reduce((sum, line) => sum + (lineCharge(line) ?? 0), 0);
@@ -3269,6 +3285,8 @@ export {
3269
3285
  DEFAULT_BILL_SUBMISSION_PROCEDURES,
3270
3286
  MindBillBillReview,
3271
3287
  MindBillBillTimeline,
3288
+ PSYCH_QME_DEFAULT_DIAGNOSIS,
3289
+ applyBillSubmissionEvaluationDiagnoses,
3272
3290
  applyBillSubmissionEvaluationModifiers,
3273
3291
  billActivityEventLabel,
3274
3292
  billAgingBucket,