@mindbill/react 0.35.0 → 0.37.0

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
@@ -114,6 +114,15 @@ import { BillReadOnlyForm } from "@mindbill/react";
114
114
 
115
115
  For older responses without `issues`, the component falls back to the singular `reason` and `code` fields. `appearance.dangerColor` can override the rejection color without changing the rest of the theme.
116
116
 
117
+ For the server-authorized **Correct and resubmit** action,
118
+ `ConnectedBillLifecycle` opens `BillSubmissionForm` with the complete submitted
119
+ snapshot and authenticated copies of its documents. API-provided rejection
120
+ `fieldPaths` call attention to likely problem controls, and payer contact
121
+ guidance remains visible while the user corrects the bill. Submitting creates
122
+ the next immutable attempt under the same logical `billId`; the original
123
+ attempt and rejection remain in history. The host application does not build a
124
+ second correction form or pass bill seed data back into the lifecycle.
125
+
117
126
  ## Lifecycle actions
118
127
 
119
128
  MindBill returns the actions that are valid for the bill's current state. Render that server-authoritative list instead of duplicating rejection, EOR, denial, review, payment, and closure rules in your application.
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { MindBillAppearance, MindBillEventDetail, MindBillErrorDetail } from '@mindbill/embed';
2
2
  export { MindBillAppearance, MindBillErrorDetail, MindBillEventDetail } from '@mindbill/embed';
3
3
  import { CSSProperties, ReactElement, ReactNode } from 'react';
4
- import { BillReviewData as BillReviewData$1, BillLifecycleDelivery, BillReviewAttachment as BillReviewAttachment$1, BrowserBillSubmissionResult, BillLifecycleSessionProvider, BillReviewPayer as BillReviewPayer$1, BrowserBillSubmissionDocument, BillDeliveryOptions as BillDeliveryOptions$1, SubmitBillInput, BillTasksDashboardData, BillTasksAgingBucket, BillHistoryEntry, OrganizationProfileData, BillRemittanceSummary, BillEorDocument, BillPaymentRecord, BillLifecycleAction, BillRejection, BillLifecycleData, BillLifecycleClientOptions, BillLifecycleClient } from '@mindbill/browser';
5
- export { BILL_TASKS_AGING_BUCKETS, BillActivityRecord, BillClaimsAdministratorContact, BillClaimsAdministratorDirectory, BillClaimsAdministratorMailingAddress, BillClaimsAdministratorPattern, BillEorDocument, BillLifecycleAction, BillLifecycleActionId, BillLifecycleClient, BillLifecycleClientOptions, BillLifecycleData, BillLifecycleDelivery, BillLifecycleSession, BillLifecycleSessionProvider, BillLifecycleSessionRequest, BillPaymentRecord, BillRejection, BillRemittanceSummary, BillTasksAgingBucket, BillTasksDashboardData, BillTasksDashboardItem, BillTasksDashboardRow, BillTasksDashboardSection, BillTasksDashboardSectionInput, BillTasksDashboardTone, BrowserBillSubmissionResult, CloseBillInput, PostBillPaymentInput, ReopenBillInput, SubmitSecondReviewInput, billTasksAgingBucketIndex, buildBillTasksDashboard, createBillLifecycleClient } from '@mindbill/browser';
4
+ import { BillReviewData as BillReviewData$1, BillLifecycleDelivery, BillReviewAttachment as BillReviewAttachment$1, BrowserBillSubmissionResult, BillLifecycleSessionProvider, BillReviewPayer as BillReviewPayer$1, BrowserBillSubmissionDocument, BillDeliveryOptions as BillDeliveryOptions$1, SubmitBillInput, BillTasksDashboardData, BillTasksAgingBucket, BillHistoryEntry, ReportBillStatusInput, OrganizationProfileData, BillRemittanceSummary, BillEorDocument, BillPaymentRecord, BillLifecycleAction, BillRejection, BillLifecycleData, BillLifecycleClientOptions, BillLifecycleClient } from '@mindbill/browser';
5
+ export { BILL_TASKS_AGING_BUCKETS, BillActivityRecord, BillClaimsAdministratorContact, BillClaimsAdministratorDirectory, BillClaimsAdministratorMailingAddress, BillClaimsAdministratorPattern, BillEorDocument, BillLifecycleAction, BillLifecycleActionId, BillLifecycleClient, BillLifecycleClientOptions, BillLifecycleData, BillLifecycleDelivery, BillLifecycleSession, BillLifecycleSessionProvider, BillLifecycleSessionRequest, BillPaymentRecord, BillRejection, BillRemittanceSummary, BillTasksAgingBucket, BillTasksDashboardData, BillTasksDashboardItem, BillTasksDashboardRow, BillTasksDashboardSection, BillTasksDashboardSectionInput, BillTasksDashboardTone, BrowserBillSubmissionResult, CloseBillInput, PostBillPaymentInput, REPORT_BILL_STATUS_OPTIONS, ReopenBillInput, ReportBillStatusContacts, ReportBillStatusId, ReportBillStatusInput, SECOND_REVIEW_REASON_TEMPLATE, SECOND_REVIEW_WINDOW_DAYS, SecondReviewDeadline, SendDuplicateBillInput, SubmitSecondReviewInput, billTasksAgingBucketIndex, buildBillTasksDashboard, createBillLifecycleClient, reportBillStatusContacts, secondReviewDeadline } from '@mindbill/browser';
6
6
 
7
7
  type MindBillThemePreset = "mindbill" | "qme-companion" | "orange-bright" | "clinical-blue" | "midnight-cyan";
8
8
  type MindBillReactAppearance = MindBillAppearance & {
@@ -520,6 +520,8 @@ type BillSubmissionSourceAttachment = {
520
520
  autoAttached?: boolean;
521
521
  removable?: boolean;
522
522
  previewUrl?: string;
523
+ /** Authenticated source loader used when the document is not available at a public URL. */
524
+ loadBlob?: () => Promise<Blob>;
523
525
  reportTypeCode?: string;
524
526
  };
525
527
  type BillSubmissionUpload = {
@@ -574,6 +576,9 @@ type BillSubmissionFormProps = {
574
576
  submitLabel?: string;
575
577
  heading?: ReactNode;
576
578
  description?: ReactNode;
579
+ /** Rejected-field paths to visually call out while the user corrects the next submission. */
580
+ attentionFields?: string[];
581
+ attentionMessage?: ReactNode;
577
582
  /**
578
583
  * Optional composable layout. Use the exported section components as children;
579
584
  * the parent form continues to own validation, directory lookups, uploads, and submission.
@@ -612,7 +617,7 @@ declare function BillSubmissionProvidersSection(): ReactElement;
612
617
  declare function BillSubmissionServiceLinesSection(): ReactElement;
613
618
  declare function BillSubmissionAttachmentsSection(): ReactElement;
614
619
  declare function BillSubmissionActions(): ReactElement;
615
- declare function BillSubmissionForm({ initialBill, attachments, onSubmit, onSubmitted, getSession, sessionEndpoint, apiBaseUrl, fetch: fetchOverride, onSearchClaimsAdministrators, diagnosisOptions, onSearchDiagnoses, onLookupPostalCode, procedureOptions, modifierOptions, taxonomyOptions, deliveryRoutePicker, attachmentReportTypeMode, attachmentReportTypes, defaultAttachmentReportType, appearance, className, style, disabled, submitLabel, heading, description, children, }: BillSubmissionFormProps): ReactElement;
620
+ declare function BillSubmissionForm({ initialBill, attachments, onSubmit, onSubmitted, getSession, sessionEndpoint, apiBaseUrl, fetch: fetchOverride, onSearchClaimsAdministrators, diagnosisOptions, onSearchDiagnoses, onLookupPostalCode, procedureOptions, modifierOptions, taxonomyOptions, deliveryRoutePicker, attachmentReportTypeMode, attachmentReportTypes, defaultAttachmentReportType, appearance, className, style, disabled, submitLabel, heading, description, attentionFields, attentionMessage, children, }: BillSubmissionFormProps): ReactElement;
616
621
 
617
622
  /** First plausible email address inside a raw contact string, or null. */
618
623
  declare function extractSendRouteEmail(raw: string | null | undefined): string | null;
@@ -826,21 +831,6 @@ type SurfaceProps$1 = {
826
831
  className?: string;
827
832
  style?: CSSProperties;
828
833
  };
829
- type ReportBillStatusId = "message_left" | "eor_pending" | "eor_sent" | "bill_not_on_file" | "forwarded";
830
- type ReportBillStatusInput = {
831
- status: ReportBillStatusId;
832
- company?: string;
833
- representativeName?: string;
834
- representativeRole?: string;
835
- phone?: string;
836
- callReference?: string;
837
- note?: string;
838
- };
839
- declare const REPORT_BILL_STATUS_OPTIONS: Array<{
840
- id: ReportBillStatusId;
841
- label: string;
842
- description: string;
843
- }>;
844
834
  type ReportBillStatusDialogProps = SurfaceProps$1 & {
845
835
  title?: ReactNode;
846
836
  claimsAdmin?: {
@@ -1055,6 +1045,7 @@ type UseBillLifecycleResult = {
1055
1045
  refresh: () => Promise<void>;
1056
1046
  searchClaimsAdministrators: BillLifecycleClient["searchClaimsAdministrators"];
1057
1047
  getDeliveryOptions: BillLifecycleClient["getDeliveryOptions"];
1048
+ getAttachment: BillLifecycleClient["getAttachment"];
1058
1049
  openAttachment: (attachment: BillReviewAttachment) => Promise<void>;
1059
1050
  openEor: (document: BillEorDocument) => Promise<void>;
1060
1051
  downloadPacket: () => Promise<void>;
@@ -1063,6 +1054,8 @@ type UseBillLifecycleResult = {
1063
1054
  postPayment: BillLifecycleClient["postPayment"];
1064
1055
  submitSecondReview: BillLifecycleClient["submitSecondReview"];
1065
1056
  resubmitBill: BillLifecycleClient["resubmitBill"];
1057
+ sendDuplicateBill: BillLifecycleClient["sendDuplicateBill"];
1058
+ reportBillStatus: BillLifecycleClient["reportBillStatus"];
1066
1059
  simulateSandbox: BillLifecycleClient["simulateSandbox"];
1067
1060
  };
1068
1061
  declare function useBillLifecycle({ billId: providedBillId, sessionEndpoint, getSession, apiBaseUrl, refreshInterval, enabled, fetch: fetchOverride, }: UseBillLifecycleOptions): UseBillLifecycleResult;
@@ -1094,4 +1087,4 @@ type MindBillWidgetProps = {
1094
1087
  declare function MindBillBillTimeline(props: MindBillWidgetProps): ReactElement;
1095
1088
  declare function MindBillBillReview(props: MindBillWidgetProps): ReactElement;
1096
1089
 
1097
- export { BILL_STATUS_AGING_BUCKETS, BILL_SUBMISSION_DIAGNOSIS_QUICK_PICKS, BILL_SUBMISSION_DOCUMENT_TYPES, BILL_SUBMISSION_REPORT_TYPES, BILL_SUBMISSION_REQUIRED_FIELDS, type BillActivityEvent, BillActivityTimeline, type BillActivityTimelineProps, type BillAgingBucket, type BillAgingBucketId, BillAgingSummary, type BillAgingSummaryProps, BillExplanationOfReview, type BillExplanationOfReviewProps, BillHistoryTable, type BillHistoryTableProps, BillLifecycleActions, type BillLifecycleActionsProps, BillLifecycleProgress, type BillLifecycleProgressProps, type BillLifecycleStage, BillList, type BillListProps, BillPayerContactCard, type BillPayerContactCardProps, BillPaymentLedger, type BillPaymentLedgerProps, BillReadOnlyForm, type BillReadOnlyFormProps, BillRejectionNotice, type BillRejectionNoticeProps, 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 BillStatusAgingCell, BillStatusAgingMatrix, type BillStatusAgingMatrixData, type BillStatusAgingMatrixProps, type BillStatusAgingRow, type BillStatusClient, type BillStatusClientOptions, type BillStatusData, type BillStatusSession, type BillStatusSessionProvider, type BillStatusSessionRequest, BillStatusSummary, type BillStatusSummaryProps, BillSubmissionActions, type BillSubmissionAddress, type BillSubmissionAttachmentReportTypeMode, 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 BillSubmissionReportTypeOption, type BillSubmissionRibbonItem, type BillSubmissionRoute, type BillSubmissionSectionId, BillSubmissionServiceLinesSection, type BillSubmissionSourceAttachment, type BillSubmissionTaxonomyOption, type BillSubmissionUpload, type BillSubmissionValidation, BillSubmissionsRibbon, type BillSubmissionsRibbonProps, BillTasksDashboard, type BillTasksDashboardCell, type BillTasksDashboardProps, type BillingComponentProps, BillingDashboard, type BillingDashboardBill, type BillingDashboardProps, type BillingDashboardSummary, BillingReport, type BillingReportDimension, type BillingReportProps, type BillingReportRow, BillingSettings, ConnectedBillLifecycle, type ConnectedBillLifecycleProps, ConnectedBillStatus, type ConnectedBillStatusProps, DEFAULT_BILL_SUBMISSION_MODIFIERS, DEFAULT_BILL_SUBMISSION_PROCEDURES, DEFAULT_BILL_SUBMISSION_TAXONOMIES, MED_LEGAL_REPORT_TYPE_CODE, MindBillBillReview, MindBillBillTimeline, type MindBillReactAppearance, type MindBillThemePreset, type MindBillWidgetProps, OrganizationOnboarding, type OrganizationOnboardingProps, PSYCH_QME_DEFAULT_DIAGNOSIS, REPORT_BILL_STATUS_OPTIONS, ReportBillStatusDialog, type ReportBillStatusDialogProps, type ReportBillStatusId, type ReportBillStatusInput, SendRouteDialog, type SendRouteDialogProps, type SendRouteSubmission, type UseBillLifecycleOptions, type UseBillLifecycleResult, type UseBillStatusOptions, type UseBillStatusResult, applyBillSubmissionEvaluationDiagnoses, applyBillSubmissionEvaluationModifiers, billActivityEventLabel, billAgingBucket, billAgingDays, billLifecycleDisplayLabel, billLifecycleStage, billSubmissionsRibbonDeliveryLabel, billSubmissionsRibbonFromHistory, buildBillReviewSaveInput, buildBillStatusAgingCsv, buildBillStatusAgingMatrix, buildBillingReportCsv, buildBillingReportRows, calculateBillSubmissionAllowedAmount, claimsAdministratorRecommendations, createBillStatusClient, ensureTrailingBillSubmissionLine, ensureTrailingProcedureLine, exactClaimsAdministratorMatch, extractSendRouteEmail, formatBillSubmissionDate, formatSendRouteFax, mindBillAppearanceStyle, mindBillThemePresets, normalizeClaimsAdministratorName, parseBillSubmissionDate, prepareBillSubmissionDocuments, resolveMindBillAppearance, summarizeBillingDashboard, useBillLifecycle, useBillStatus, validateBillSubmission, visibleBillLifecycleActions };
1090
+ export { BILL_STATUS_AGING_BUCKETS, BILL_SUBMISSION_DIAGNOSIS_QUICK_PICKS, BILL_SUBMISSION_DOCUMENT_TYPES, BILL_SUBMISSION_REPORT_TYPES, BILL_SUBMISSION_REQUIRED_FIELDS, type BillActivityEvent, BillActivityTimeline, type BillActivityTimelineProps, type BillAgingBucket, type BillAgingBucketId, BillAgingSummary, type BillAgingSummaryProps, BillExplanationOfReview, type BillExplanationOfReviewProps, BillHistoryTable, type BillHistoryTableProps, BillLifecycleActions, type BillLifecycleActionsProps, BillLifecycleProgress, type BillLifecycleProgressProps, type BillLifecycleStage, BillList, type BillListProps, BillPayerContactCard, type BillPayerContactCardProps, BillPaymentLedger, type BillPaymentLedgerProps, BillReadOnlyForm, type BillReadOnlyFormProps, BillRejectionNotice, type BillRejectionNoticeProps, 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 BillStatusAgingCell, BillStatusAgingMatrix, type BillStatusAgingMatrixData, type BillStatusAgingMatrixProps, type BillStatusAgingRow, type BillStatusClient, type BillStatusClientOptions, type BillStatusData, type BillStatusSession, type BillStatusSessionProvider, type BillStatusSessionRequest, BillStatusSummary, type BillStatusSummaryProps, BillSubmissionActions, type BillSubmissionAddress, type BillSubmissionAttachmentReportTypeMode, 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 BillSubmissionReportTypeOption, type BillSubmissionRibbonItem, type BillSubmissionRoute, type BillSubmissionSectionId, BillSubmissionServiceLinesSection, type BillSubmissionSourceAttachment, type BillSubmissionTaxonomyOption, type BillSubmissionUpload, type BillSubmissionValidation, BillSubmissionsRibbon, type BillSubmissionsRibbonProps, BillTasksDashboard, type BillTasksDashboardCell, type BillTasksDashboardProps, type BillingComponentProps, BillingDashboard, type BillingDashboardBill, type BillingDashboardProps, type BillingDashboardSummary, BillingReport, type BillingReportDimension, type BillingReportProps, type BillingReportRow, BillingSettings, ConnectedBillLifecycle, type ConnectedBillLifecycleProps, ConnectedBillStatus, type ConnectedBillStatusProps, DEFAULT_BILL_SUBMISSION_MODIFIERS, DEFAULT_BILL_SUBMISSION_PROCEDURES, DEFAULT_BILL_SUBMISSION_TAXONOMIES, MED_LEGAL_REPORT_TYPE_CODE, MindBillBillReview, MindBillBillTimeline, type MindBillReactAppearance, type MindBillThemePreset, type MindBillWidgetProps, OrganizationOnboarding, type OrganizationOnboardingProps, PSYCH_QME_DEFAULT_DIAGNOSIS, ReportBillStatusDialog, type ReportBillStatusDialogProps, SendRouteDialog, type SendRouteDialogProps, type SendRouteSubmission, type UseBillLifecycleOptions, type UseBillLifecycleResult, type UseBillStatusOptions, type UseBillStatusResult, applyBillSubmissionEvaluationDiagnoses, applyBillSubmissionEvaluationModifiers, billActivityEventLabel, billAgingBucket, billAgingDays, billLifecycleDisplayLabel, billLifecycleStage, billSubmissionsRibbonDeliveryLabel, billSubmissionsRibbonFromHistory, buildBillReviewSaveInput, buildBillStatusAgingCsv, buildBillStatusAgingMatrix, buildBillingReportCsv, buildBillingReportRows, calculateBillSubmissionAllowedAmount, claimsAdministratorRecommendations, createBillStatusClient, ensureTrailingBillSubmissionLine, ensureTrailingProcedureLine, exactClaimsAdministratorMatch, extractSendRouteEmail, formatBillSubmissionDate, formatSendRouteFax, mindBillAppearanceStyle, mindBillThemePresets, normalizeClaimsAdministratorName, parseBillSubmissionDate, prepareBillSubmissionDocuments, resolveMindBillAppearance, summarizeBillingDashboard, useBillLifecycle, useBillStatus, validateBillSubmission, visibleBillLifecycleActions };
package/dist/index.js CHANGED
@@ -2007,13 +2007,18 @@ async function prepareBillSubmissionDocuments({
2007
2007
  fetch: fetchOverride
2008
2008
  }) {
2009
2009
  const fetcher = fetchOverride ?? globalThis.fetch;
2010
- if (typeof fetcher !== "function") throw new Error("A Fetch API implementation is required.");
2011
2010
  const selected = selectedIds.map((id) => attachments.find((item) => item.id === id)).filter((item) => Boolean(item));
2012
2011
  const sourceDocuments = await Promise.all(selected.map(async (attachment) => {
2013
- if (!attachment.previewUrl) throw new Error(`${attachment.fileName} cannot be submitted because its document URL is missing.`);
2014
- const response = await fetcher(attachment.previewUrl, { credentials: "same-origin" });
2015
- if (!response.ok) throw new Error(`${attachment.fileName} could not be loaded for submission.`);
2016
- return pdfDocument(await response.blob(), {
2012
+ let blob;
2013
+ if (attachment.loadBlob) blob = await attachment.loadBlob();
2014
+ else {
2015
+ if (!attachment.previewUrl) throw new Error(`${attachment.fileName} cannot be submitted because its document URL is missing.`);
2016
+ if (typeof fetcher !== "function") throw new Error("A Fetch API implementation is required.");
2017
+ const response = await fetcher(attachment.previewUrl, { credentials: "same-origin" });
2018
+ if (!response.ok) throw new Error(`${attachment.fileName} could not be loaded for submission.`);
2019
+ blob = await response.blob();
2020
+ }
2021
+ return pdfDocument(blob, {
2017
2022
  externalId: attachment.id,
2018
2023
  filename: attachment.fileName,
2019
2024
  documentType: attachment.documentType,
@@ -2170,6 +2175,7 @@ function validateBillSubmission(bill) {
2170
2175
  }
2171
2176
  var css2 = `
2172
2177
  .mbsf{display:grid;gap:20px;color:var(--mb-text);font-family:var(--mb-font);font-size:15px}.mbsf *{box-sizing:border-box}
2178
+ .mbsf-attention{padding:14px 16px;border-left:4px solid var(--mb-danger);border-radius:var(--mb-control-radius);background:color-mix(in srgb,var(--mb-danger) 8%,var(--mb-surface));color:var(--mb-text)}.mbsf [data-attention=true] .mbsf-input,.mbsf [data-attention=true] .mbsf-select,.mbsf [data-attention=true].mbsf-lines{border-color:var(--mb-danger);background:color-mix(in srgb,var(--mb-danger) 4%,var(--mb-input))}.mbsf [data-attention=true]>.mbsf-label{color:var(--mb-danger)}
2173
2179
  .mbsf-head,.mbsf-section-head,.mbsf-attach-row,.mbsf-actions{display:flex;align-items:center;justify-content:space-between;gap:16px}.mbsf-title{margin:0;font-size:24px}.mbsf-copy,.mbsf-help{color:var(--mb-muted);margin:5px 0 0}.mbsf-required{font-size:13px;color:var(--mb-muted);white-space:nowrap}.mbsf-star,.mbsf-error{color:var(--mb-danger)}
2174
2180
  .mbsf-card{min-width:0;margin:0;padding:24px;border:1px solid var(--mb-border);border-radius:var(--mb-radius);background:var(--mb-surface);box-shadow:var(--mb-shadow)}.mbsf-card[data-invalid=true]{border-color:var(--mb-danger)}.mbsf-legend{padding:0 10px;font-size:18px;font-weight:760}.mbsf-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px 24px}.mbsf-subhead{grid-column:1/-1;margin:6px 0 -2px;padding-top:14px;border-top:1px solid var(--mb-border);font-size:15px;font-weight:780;letter-spacing:.01em}.mbsf-subhead:first-child{margin-top:0;padding-top:0;border-top:0}.mbsf-span{grid-column:1/-1}.mbsf-field{display:grid;align-content:start;gap:7px;min-width:0}.mbsf-label{font-weight:680}.mbsf-input,.mbsf-select{width:100%;min-height:46px;padding:10px 12px;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius);background:var(--mb-input);color:var(--mb-text);font:inherit}.mbsf-input:focus,.mbsf-select:focus{outline:3px solid color-mix(in srgb,var(--mb-accent) 22%,transparent);border-color:var(--mb-accent)}.mbsf-field[data-invalid=true] .mbsf-input,.mbsf-field[data-invalid=true] .mbsf-select,.mbsf-invalid-control .mbsf-input{border-color:var(--mb-danger);background:color-mix(in srgb,var(--mb-danger) 4%,var(--mb-input))}.mbsf-field[data-invalid=true] .mbsf-input:focus,.mbsf-field[data-invalid=true] .mbsf-select:focus{outline-color:color-mix(in srgb,var(--mb-danger) 24%,transparent)}
2175
2181
  .mbsf-combo{position:relative}.mbsf-menu{position:absolute;z-index:20;top:calc(100% + 5px);left:0;right:0;max-height:min(360px,46vh);overflow:auto;overscroll-behavior:contain;padding:7px;border:1px solid var(--mb-border);border-radius:12px;background:var(--mb-surface);box-shadow:0 14px 35px rgba(17,38,49,.16)}.mbsf-option{display:grid;width:100%;gap:2px;padding:10px;border:0;border-radius:8px;background:transparent;color:var(--mb-text);font:inherit;text-align:left;cursor:pointer}.mbsf-option:hover,.mbsf-option:focus{background:color-mix(in srgb,var(--mb-accent) 9%,var(--mb-surface))}.mbsf-option small{color:var(--mb-muted)}.mbsf-menu-status{padding:12px;text-align:center;color:var(--mb-muted);font-size:13px}
@@ -2346,6 +2352,8 @@ function BillSubmissionForm({
2346
2352
  submitLabel = "Submit bill",
2347
2353
  heading = "Bill information",
2348
2354
  description = "Review the bill details, add attachments, and submit.",
2355
+ attentionFields = [],
2356
+ attentionMessage,
2349
2357
  children
2350
2358
  }) {
2351
2359
  const [bill, setBill] = useState4(() => cloneInitialBill(initialBill));
@@ -2406,6 +2414,21 @@ function BillSubmissionForm({
2406
2414
  const next = validateBillSubmission(bill).fieldErrors;
2407
2415
  setErrors(missingAttachmentReportType ? { ...next, attachments: "Select a report type for every attachment." } : next);
2408
2416
  }, [bill, missingAttachmentReportType, validationActive]);
2417
+ useEffect4(() => {
2418
+ const root = formRef.current;
2419
+ if (!root) return;
2420
+ const nodes = Array.from(root.querySelectorAll("[data-field-path]"));
2421
+ nodes.forEach((node) => node.removeAttribute("data-attention"));
2422
+ for (const requested of attentionFields) {
2423
+ const normalized = requested.replace(/\[\]/g, "");
2424
+ for (const node of nodes) {
2425
+ const actual = node.dataset.fieldPath ?? "";
2426
+ if (actual === requested || actual === normalized || actual.startsWith(`${normalized}.`) || normalized.startsWith(`${actual}.`)) {
2427
+ node.dataset.attention = "true";
2428
+ }
2429
+ }
2430
+ }
2431
+ }, [attentionFields]);
2409
2432
  const addFiles = useCallback((fileList) => {
2410
2433
  const files = Array.from(fileList);
2411
2434
  if (!files.length) return;
@@ -2895,6 +2918,7 @@ function BillSubmissionForm({
2895
2918
  void submit();
2896
2919
  }, noValidate: true, children: [
2897
2920
  /* @__PURE__ */ jsx4("style", { children: css2 }),
2921
+ attentionMessage ? /* @__PURE__ */ jsx4("div", { className: "mbsf-attention", role: "status", children: attentionMessage }) : null,
2898
2922
  children ?? defaultLayout,
2899
2923
  routeDialog ? /* @__PURE__ */ jsx4(
2900
2924
  SendRouteDialog,
@@ -3590,34 +3614,11 @@ function BillSubmissionsRibbon({
3590
3614
 
3591
3615
  // src/report-bill-status-dialog.tsx
3592
3616
  import { useEffect as useEffect5, useState as useState6 } from "react";
3617
+ import {
3618
+ REPORT_BILL_STATUS_OPTIONS
3619
+ } from "@mindbill/browser";
3620
+ import { REPORT_BILL_STATUS_OPTIONS as REPORT_BILL_STATUS_OPTIONS2 } from "@mindbill/browser";
3593
3621
  import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
3594
- var REPORT_BILL_STATUS_OPTIONS = [
3595
- {
3596
- id: "message_left",
3597
- label: "Message Left Requesting Bill Payment Status",
3598
- description: "Claims Administrator/Bill Review representative unavailable."
3599
- },
3600
- {
3601
- id: "eor_pending",
3602
- label: "Explanation of Review (EOR) Pending",
3603
- description: "Claims Administrator/Bill Review reported the bill is still in process and an EOR has not been generated or sent."
3604
- },
3605
- {
3606
- id: "eor_sent",
3607
- label: "Explanation of Review (EOR) Sent",
3608
- description: "Claims Administrator/Bill Review reported sending an EOR to the provider."
3609
- },
3610
- {
3611
- id: "bill_not_on_file",
3612
- label: "Bill Not On File",
3613
- description: "Claims Administrator/Bill Review reported not receiving the bill."
3614
- },
3615
- {
3616
- id: "forwarded",
3617
- label: "Bill Forwarded to Different Payer / Network",
3618
- description: "Claims Administrator/Bill Review reported forwarding the bill to a different payer."
3619
- }
3620
- ];
3621
3622
  var css7 = `
3622
3623
  .mbbs-overlay{position:fixed;inset:0;z-index:1000;display:grid;place-items:center;padding:20px;background:rgba(15,30,40,.45)}
3623
3624
  .mbbs{display:grid;gap:18px;width:min(860px,100%);max-height:min(90vh,960px);overflow:auto;overscroll-behavior:contain;padding:24px;border:1px solid var(--mb-border);border-radius:var(--mb-radius);background:var(--mb-surface);color:var(--mb-text);font-family:var(--mb-font);font-size:14px;box-shadow:0 24px 60px rgba(17,38,49,.28)}
@@ -4906,9 +4907,18 @@ import {
4906
4907
  import {
4907
4908
  DEFAULT_API_BASE_URL as DEFAULT_API_BASE_URL2,
4908
4909
  DEFAULT_SESSION_ENDPOINT as DEFAULT_SESSION_ENDPOINT2,
4909
- createBillLifecycleClient
4910
+ SECOND_REVIEW_REASON_TEMPLATE,
4911
+ createBillLifecycleClient,
4912
+ reportBillStatusContacts,
4913
+ secondReviewDeadline
4914
+ } from "@mindbill/browser";
4915
+ import {
4916
+ SECOND_REVIEW_REASON_TEMPLATE as SECOND_REVIEW_REASON_TEMPLATE2,
4917
+ SECOND_REVIEW_WINDOW_DAYS,
4918
+ createBillLifecycleClient as createBillLifecycleClient2,
4919
+ reportBillStatusContacts as reportBillStatusContacts2,
4920
+ secondReviewDeadline as secondReviewDeadline2
4910
4921
  } from "@mindbill/browser";
4911
- import { createBillLifecycleClient as createBillLifecycleClient2 } from "@mindbill/browser";
4912
4922
  import { Fragment as Fragment9, jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
4913
4923
  var DEFAULT_REFRESH_INTERVAL2 = 6e4;
4914
4924
  function reservePreviewWindow() {
@@ -5045,6 +5055,7 @@ function useBillLifecycle({
5045
5055
  refresh,
5046
5056
  searchClaimsAdministrators: (query, claimNumber) => client.searchClaimsAdministrators(query, claimNumber),
5047
5057
  getDeliveryOptions: () => client.getDeliveryOptions(),
5058
+ getAttachment: (attachmentId) => client.getAttachment(attachmentId),
5048
5059
  openAttachment,
5049
5060
  openEor,
5050
5061
  downloadPacket,
@@ -5053,10 +5064,12 @@ function useBillLifecycle({
5053
5064
  postPayment: (input) => mutate(() => client.postPayment(input)),
5054
5065
  submitSecondReview: (input) => mutate(() => client.submitSecondReview(input)),
5055
5066
  resubmitBill: (input) => mutate(() => client.resubmitBill(input)),
5067
+ sendDuplicateBill: (input) => mutate(() => client.sendDuplicateBill(input)),
5068
+ reportBillStatus: (input) => mutate(() => client.reportBillStatus(input)),
5056
5069
  simulateSandbox: (input) => mutate(() => client.simulateSandbox(input))
5057
5070
  };
5058
5071
  }
5059
- function LifecycleDialog({ children, title, onClose }) {
5072
+ function LifecycleDialog({ children, title, wide = false, onClose }) {
5060
5073
  const dialog = useRef5(null);
5061
5074
  useEffect8(() => {
5062
5075
  const previous = document.activeElement;
@@ -5068,21 +5081,106 @@ function LifecycleDialog({ children, title, onClose }) {
5068
5081
  previous?.focus();
5069
5082
  };
5070
5083
  }, [onClose]);
5071
- return /* @__PURE__ */ jsx13("div", { className: "mb-lifecycle-dialog-backdrop", onMouseDown: (event) => event.currentTarget === event.target && onClose(), children: /* @__PURE__ */ jsxs13("div", { ref: dialog, className: "mb-lifecycle-dialog", role: "dialog", "aria-modal": "true", "aria-label": title, tabIndex: -1, children: [
5084
+ return /* @__PURE__ */ jsx13("div", { className: "mb-lifecycle-dialog-backdrop", onMouseDown: (event) => event.currentTarget === event.target && onClose(), children: /* @__PURE__ */ jsxs13("div", { ref: dialog, className: ["mb-lifecycle-dialog", wide ? "wide" : ""].filter(Boolean).join(" "), role: "dialog", "aria-modal": "true", "aria-label": title, tabIndex: -1, children: [
5072
5085
  /* @__PURE__ */ jsx13("button", { type: "button", className: "mb-lifecycle-dialog-close", "aria-label": "Close", onClick: onClose, children: "\xD7" }),
5073
5086
  children
5074
5087
  ] }) });
5075
5088
  }
5089
+ function correctionDocumentType(value) {
5090
+ return BILL_SUBMISSION_DOCUMENT_TYPES.includes(value) ? value : "other";
5091
+ }
5092
+ function correctionBill(data) {
5093
+ const billing = data.bill.billingSnapshot?.billingProvider;
5094
+ const rendering = data.bill.billingSnapshot?.renderingProvider;
5095
+ const location = data.bill.billingSnapshot?.placeOfService;
5096
+ const nameParts = data.patient.name.trim().split(/\s+/);
5097
+ const firstName = data.patient.firstName || nameParts[0] || "";
5098
+ const lastName = data.patient.lastName || nameParts.slice(1).join(" ") || "";
5099
+ return {
5100
+ billingMode: data.bill.billingMode,
5101
+ patient: {
5102
+ firstName,
5103
+ ...data.patient.middleName ? { middleName: data.patient.middleName } : {},
5104
+ lastName,
5105
+ dateOfBirth: data.patient.dob || "",
5106
+ ...data.patient.phone ? { phone: data.patient.phone } : {},
5107
+ address: {
5108
+ line1: data.patient.address?.line1 || "",
5109
+ city: data.patient.address?.city || "",
5110
+ state: data.patient.address?.state || "",
5111
+ postalCode: data.patient.address?.postalCode || ""
5112
+ }
5113
+ },
5114
+ claim: {
5115
+ claimNumber: data.injury.claimNumber || "",
5116
+ ...data.injury.adjNumber ? { adjNumber: data.injury.adjNumber } : {},
5117
+ employer: data.injury.employer || "",
5118
+ dateOfInjury: data.injury.doi || "",
5119
+ ...data.injury.injuryDescription ? { description: data.injury.injuryDescription } : {},
5120
+ ...data.injury.claimsAdminId && data.injury.claimsAdminName ? {
5121
+ claimsAdministrator: { id: data.injury.claimsAdminId, name: data.injury.claimsAdminName }
5122
+ } : {}
5123
+ },
5124
+ service: {
5125
+ date: data.bill.dos,
5126
+ ...data.bill.dosEnd !== void 0 ? { endDate: data.bill.dosEnd } : {},
5127
+ ...data.bill.authorizationNumber !== void 0 ? { authorizationNumber: data.bill.authorizationNumber } : {}
5128
+ },
5129
+ ...billing ? { billingProvider: {
5130
+ name: billing.name,
5131
+ taxId: billing.taxId,
5132
+ npi: billing.npi,
5133
+ ...billing.phone ? { phone: billing.phone } : {},
5134
+ address: {
5135
+ line1: billing.billingStreet || "",
5136
+ city: billing.billingCity || "",
5137
+ state: billing.billingState || "",
5138
+ postalCode: billing.billingZip || ""
5139
+ }
5140
+ } } : {},
5141
+ ...rendering ? { renderingProvider: {
5142
+ name: rendering.name,
5143
+ npi: rendering.npi,
5144
+ ...rendering.taxonomy ? { taxonomy: rendering.taxonomy } : {},
5145
+ ...rendering.specialty ? { specialty: rendering.specialty } : {},
5146
+ ...rendering.licenseNumber ? { licenseNumber: rendering.licenseNumber } : {},
5147
+ ...rendering.licenseState ? { licenseState: rendering.licenseState } : {},
5148
+ ...rendering.isQME !== void 0 ? { isQme: rendering.isQME } : {},
5149
+ ...rendering.isAME !== void 0 ? { isAme: rendering.isAME } : {}
5150
+ } } : {},
5151
+ ...location ? { serviceLocation: {
5152
+ ...location.name ? { name: location.name } : {},
5153
+ address: { line1: location.street, city: location.city, state: location.state, postalCode: location.zip },
5154
+ ...location.posCode ? { placeOfServiceCode: location.posCode } : {}
5155
+ } } : {},
5156
+ diagnoses: [...data.injury.diagnosisCodes || []],
5157
+ serviceLines: data.bill.lineItems.map((line) => ({
5158
+ code: line.code,
5159
+ modifiers: [...line.modifiers],
5160
+ units: line.units,
5161
+ charge: line.charge,
5162
+ ...line.serviceDate ? { serviceDate: line.serviceDate } : {},
5163
+ ...line.serviceDateEnd !== void 0 ? { serviceDateEnd: line.serviceDateEnd } : {},
5164
+ ...line.diagnosisPointers ? { diagnosisPointers: [...line.diagnosisPointers] } : {}
5165
+ }))
5166
+ };
5167
+ }
5076
5168
  function today() {
5077
5169
  const now = /* @__PURE__ */ new Date();
5078
5170
  return new Date(now.getTime() - now.getTimezoneOffset() * 6e4).toISOString().slice(0, 10);
5079
5171
  }
5172
+ function usDate(isoDate) {
5173
+ const [year, month, day] = isoDate.split("-");
5174
+ return year && month && day ? `${month}/${day}/${year}` : isoDate;
5175
+ }
5080
5176
  function actionPanel(action) {
5081
5177
  if (action.id === "resubmit") return "resubmit";
5082
5178
  if (action.id === "second_review") return "second_review";
5083
5179
  if (action.id === "post_payment") return "payment";
5084
5180
  if (action.id === "close") return "close";
5085
5181
  if (action.id === "reopen") return "reopen";
5182
+ if (action.id === "send_duplicate") return "send_duplicate";
5183
+ if (action.id === "report_bill_status") return "report_status";
5086
5184
  return "";
5087
5185
  }
5088
5186
  function sandboxScenarios(state) {
@@ -5108,7 +5206,24 @@ function ConnectedBillLifecycle({ appearance, sandboxControls = false, className
5108
5206
  const [reason, setReason] = useState10("");
5109
5207
  const [payment, setPayment] = useState10({ amount: 0, penaltyAmount: 0, interestAmount: 0, method: "check", checkNumber: "", depositDate: today(), note: "" });
5110
5208
  const [review, setReview] = useState10({ reason: "", payerClaimControlNumber: "", disputedAmount: void 0, attachmentIds: [], route: "ebill" });
5209
+ const [duplicateDelivery, setDuplicateDelivery] = useState10(null);
5210
+ const [duplicateDeliveryError, setDuplicateDeliveryError] = useState10("");
5111
5211
  const lastData = useRef5(null);
5212
+ const correctionInitialBill = useMemo8(() => data ? correctionBill(data) : null, [data]);
5213
+ const correctionAttachments = useMemo8(() => data ? data.bill.attachments.map((attachment) => {
5214
+ const documentType = correctionDocumentType(attachment.documentType);
5215
+ const isW9 = documentType === "w9";
5216
+ return {
5217
+ id: attachment.id,
5218
+ fileName: attachment.filename,
5219
+ documentType,
5220
+ ...attachment.description ? { description: attachment.description } : {},
5221
+ ...attachment.reportType ? { reportTypeCode: attachment.reportType } : {},
5222
+ loadBlob: () => lifecycle.getAttachment(attachment.id),
5223
+ ...isW9 ? { autoAttached: true, removable: false } : { removable: true }
5224
+ };
5225
+ }) : [], [data, lifecycle]);
5226
+ const correctionAttentionFields = useMemo8(() => data?.rejection?.issues?.flatMap((issue) => issue.fieldPaths || []).filter((path, index, fields) => fields.indexOf(path) === index) || [], [data]);
5112
5227
  useEffect8(() => {
5113
5228
  if (!data || data === lastData.current) return;
5114
5229
  lastData.current = data;
@@ -5145,13 +5260,41 @@ function ConnectedBillLifecycle({ appearance, sandboxControls = false, className
5145
5260
  } catch {
5146
5261
  }
5147
5262
  };
5263
+ const submitCorrection = async (value) => {
5264
+ setNotice("");
5265
+ const documents = await prepareBillSubmissionDocuments({
5266
+ attachments: correctionAttachments,
5267
+ selectedIds: value.sourceAttachmentIds,
5268
+ reportTypeCodeByAttachmentId: value.sourceAttachmentReportTypes,
5269
+ uploads: value.uploads,
5270
+ ...options.fetch ? { fetch: options.fetch } : {}
5271
+ });
5272
+ await lifecycle.resubmitBill({
5273
+ bill: value.bill,
5274
+ ...documents.length ? { documents } : {},
5275
+ ...reason.trim() ? { reason: reason.trim() } : {}
5276
+ });
5277
+ setPanel("");
5278
+ setReason("");
5279
+ setNotice("Corrected submission sent.");
5280
+ };
5281
+ const loadDuplicateDelivery = () => {
5282
+ setDuplicateDeliveryError("");
5283
+ if (duplicateDelivery) return;
5284
+ lifecycle.getDeliveryOptions().then((options2) => setDuplicateDelivery(options2)).catch((cause) => setDuplicateDeliveryError(cause instanceof Error ? cause.message : "Delivery options could not be loaded."));
5285
+ };
5148
5286
  const viewEor = data.lifecycle.actions.find((action) => action.id === "view_eor" && action.enabled);
5149
- const supportedActions = /* @__PURE__ */ new Set(["resubmit", "second_review", "post_payment", "close", "reopen"]);
5287
+ const supportedActions = /* @__PURE__ */ new Set(["resubmit", "second_review", "post_payment", "close", "reopen", "send_duplicate", "report_bill_status"]);
5150
5288
  const actions = data.lifecycle.actions.filter((action) => action.enabled && supportedActions.has(action.id));
5151
5289
  const showSandboxControls = shouldShowSandboxControls(data.environment, sandboxControls);
5152
5290
  const simulations = showSandboxControls ? sandboxScenarios(data.lifecycle.state) : [];
5291
+ const ribbonItems = data.history ? billSubmissionsRibbonFromHistory(data.history) : [];
5292
+ const statusContacts = reportBillStatusContacts(data.delivery);
5293
+ const receiptEntries = (data.history ?? []).filter((entry) => entry.kind === "submission" || entry.kind === "ack");
5294
+ const reviewDeadline = secondReviewDeadline(data.eors);
5153
5295
  return /* @__PURE__ */ jsxs13("section", { className: ["mb-connected-lifecycle", className].filter(Boolean).join(" "), style: mindBillAppearanceStyle(appearance, style), children: [
5154
5296
  /* @__PURE__ */ jsx13("style", { children: CONNECTED_LIFECYCLE_STYLES }),
5297
+ ribbonItems.length >= 2 ? /* @__PURE__ */ jsx13(BillSubmissionsRibbon, { items: ribbonItems, onSelect: () => setTab("history"), ...appearance ? { appearance } : {} }) : null,
5155
5298
  data.lifecycle.state.toLowerCase() === "rejected" && data.rejection ? /* @__PURE__ */ jsx13(BillRejectionNotice, { rejection: data.rejection, submittedAt: data.lifecycle.submittedAt ?? null, ...appearance ? { appearance } : {} }) : /* @__PURE__ */ jsx13(BillLifecycleProgress, { state: data.lifecycle.state, nativeStatus: data.lifecycle.nativeStatus, submittedAt: data.lifecycle.submittedAt ?? null, agingDays: data.lifecycle.agingDays ?? null, ...appearance ? { appearance } : {} }),
5156
5299
  /* @__PURE__ */ jsxs13("header", { className: "mb-lifecycle-head", children: [
5157
5300
  /* @__PURE__ */ jsxs13("div", { children: [
@@ -5190,28 +5333,74 @@ function ConnectedBillLifecycle({ appearance, sandboxControls = false, className
5190
5333
  viewEor && data.eors[0] ? /* @__PURE__ */ jsx13("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => void lifecycle.openEor(data.eors[0]).catch(() => void 0), children: viewEor.label }) : null,
5191
5334
  actions.map((action) => /* @__PURE__ */ jsx13("button", { type: "button", className: action.primary ? "mb-lifecycle-button primary" : "mb-lifecycle-button secondary", onClick: () => {
5192
5335
  const next = actionPanel(action);
5193
- if (next) setPanel(next);
5336
+ if (!next) return;
5337
+ if (next === "send_duplicate") loadDuplicateDelivery();
5338
+ if (next === "second_review") setReview((current) => current.reason.trim() ? current : { ...current, reason: SECOND_REVIEW_REASON_TEMPLATE });
5339
+ setPanel(next);
5194
5340
  }, children: action.label }, action.id))
5195
5341
  ] }) : null,
5196
- panel === "resubmit" ? /* @__PURE__ */ jsx13(LifecycleDialog, { title: "Correct and resubmit", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs13("section", { className: "mb-lifecycle-panel", children: [
5197
- /* @__PURE__ */ jsxs13("div", { children: [
5198
- /* @__PURE__ */ jsx13("h3", { children: "Correct and resubmit" }),
5199
- /* @__PURE__ */ jsx13("p", { children: "The original submission remains immutable. This records a new submission attempt after the routing issue is corrected." })
5342
+ panel === "resubmit" && correctionInitialBill ? /* @__PURE__ */ jsx13(LifecycleDialog, { title: "Correct and resubmit", wide: true, onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs13("section", { className: "mb-lifecycle-correction", children: [
5343
+ /* @__PURE__ */ jsxs13("header", { children: [
5344
+ /* @__PURE__ */ jsxs13("div", { children: [
5345
+ /* @__PURE__ */ jsx13("h3", { children: "Correct and resubmit" }),
5346
+ /* @__PURE__ */ jsx13("p", { children: "Review the rejected snapshot, correct the highlighted information, and submit a new immutable attempt under this bill." })
5347
+ ] }),
5348
+ /* @__PURE__ */ jsx13("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" })
5200
5349
  ] }),
5201
- /* @__PURE__ */ jsxs13("label", { children: [
5350
+ data.rejection ? /* @__PURE__ */ jsxs13("div", { className: "mb-lifecycle-correction-reason", children: [
5351
+ /* @__PURE__ */ jsx13("strong", { children: data.rejection.reason }),
5352
+ data.rejection.issues?.map((issue, index) => /* @__PURE__ */ jsxs13("span", { children: [
5353
+ issue.code ? `${issue.code}: ` : "",
5354
+ issue.description
5355
+ ] }, `${issue.code || "issue"}-${index}`))
5356
+ ] }) : null,
5357
+ data.delivery.contacts.adjusterPhone || data.delivery.contacts.claimsEmail ? /* @__PURE__ */ jsxs13("aside", { className: "mb-lifecycle-correction-contact", children: [
5358
+ /* @__PURE__ */ jsx13("strong", { children: "Need to verify the rejected information?" }),
5359
+ /* @__PURE__ */ jsxs13("span", { children: [
5360
+ "Contact ",
5361
+ data.delivery.payerName,
5362
+ data.delivery.contacts.adjusterPhone ? ` at ${data.delivery.contacts.adjusterPhone}` : "",
5363
+ data.delivery.contacts.claimsEmail ? ` \xB7 ${data.delivery.contacts.claimsEmail}` : "",
5364
+ "."
5365
+ ] })
5366
+ ] }) : null,
5367
+ /* @__PURE__ */ jsxs13("label", { className: "mb-lifecycle-correction-note", children: [
5202
5368
  /* @__PURE__ */ jsx13("span", { children: "Correction note (optional)" }),
5203
5369
  /* @__PURE__ */ jsx13("textarea", { value: reason, placeholder: "What changed before resubmission?", onChange: (event) => setReason(event.target.value) })
5204
5370
  ] }),
5205
- /* @__PURE__ */ jsxs13("div", { className: "mb-lifecycle-panel-actions", children: [
5206
- /* @__PURE__ */ jsx13("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
5207
- /* @__PURE__ */ jsx13("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating, onClick: () => void complete("Bill resubmitted.", () => lifecycle.resubmitBill({ reason })), children: lifecycle.isMutating ? "Resubmitting\u2026" : "Resubmit bill" })
5208
- ] })
5371
+ /* @__PURE__ */ jsx13(
5372
+ BillSubmissionForm,
5373
+ {
5374
+ initialBill: correctionInitialBill,
5375
+ attachments: correctionAttachments,
5376
+ onSubmit: submitCorrection,
5377
+ onSearchClaimsAdministrators: lifecycle.searchClaimsAdministrators,
5378
+ attentionFields: correctionAttentionFields,
5379
+ attentionMessage: correctionAttentionFields.length ? "The rejected response points to the highlighted fields. Confirm every required value before resubmitting." : "Confirm the bill information below before resubmitting.",
5380
+ submitLabel: lifecycle.isMutating ? "Resubmitting\u2026" : "Resubmit bill",
5381
+ heading: "Corrected bill information",
5382
+ description: "The original submission stays unchanged. This form creates the next submission attempt.",
5383
+ disabled: lifecycle.isMutating,
5384
+ ...options.getSession ? { getSession: options.getSession } : {},
5385
+ ...options.sessionEndpoint ? { sessionEndpoint: options.sessionEndpoint } : {},
5386
+ ...options.apiBaseUrl ? { apiBaseUrl: options.apiBaseUrl } : {},
5387
+ ...options.fetch ? { fetch: options.fetch } : {},
5388
+ ...appearance ? { appearance } : {}
5389
+ }
5390
+ )
5209
5391
  ] }) }) : null,
5210
5392
  panel === "second_review" ? /* @__PURE__ */ jsx13(LifecycleDialog, { title: "Submit Second Review", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs13("section", { className: "mb-lifecycle-panel", children: [
5211
5393
  /* @__PURE__ */ jsxs13("div", { children: [
5212
5394
  /* @__PURE__ */ jsx13("h3", { children: "Submit Second Review" }),
5213
5395
  /* @__PURE__ */ jsx13("p", { children: "Explain the dispute and include the payer control number and supporting documents." })
5214
5396
  ] }),
5397
+ reviewDeadline ? /* @__PURE__ */ jsxs13("p", { className: "mb-lifecycle-deadline-hint", children: [
5398
+ "Second Review must be requested within 90 days of the denial EOR (dated ",
5399
+ usDate(reviewDeadline.eorDate),
5400
+ ") \u2014 file by ",
5401
+ /* @__PURE__ */ jsx13("strong", { children: usDate(reviewDeadline.deadline) }),
5402
+ "."
5403
+ ] }) : null,
5215
5404
  /* @__PURE__ */ jsxs13("div", { className: "mb-lifecycle-fields two", children: [
5216
5405
  /* @__PURE__ */ jsxs13("label", { className: "full", children: [
5217
5406
  /* @__PURE__ */ jsx13("span", { children: "Reason" }),
@@ -5312,6 +5501,39 @@ function ConnectedBillLifecycle({ appearance, sandboxControls = false, className
5312
5501
  /* @__PURE__ */ jsx13("button", { type: "button", className: "mb-lifecycle-button primary", disabled: lifecycle.isMutating || !reason.trim(), onClick: () => void complete(panel === "close" ? "Bill closed." : "Bill reopened.", () => panel === "close" ? lifecycle.closeBill({ reason }) : lifecycle.reopenBill({ reason })), children: lifecycle.isMutating ? "Saving\u2026" : panel === "close" ? "Close bill" : "Reopen bill" })
5313
5502
  ] })
5314
5503
  ] }) }) : null,
5504
+ panel === "send_duplicate" ? duplicateDelivery ? /* @__PURE__ */ jsx13(
5505
+ SendRouteDialog,
5506
+ {
5507
+ title: "Send duplicate bill",
5508
+ delivery: duplicateDelivery,
5509
+ submitting: lifecycle.isMutating,
5510
+ error: lifecycle.error?.message ?? null,
5511
+ onCancel: () => setPanel(""),
5512
+ onConfirm: (submission) => void complete("Duplicate bill sent.", () => lifecycle.sendDuplicateBill(submission))
5513
+ }
5514
+ ) : /* @__PURE__ */ jsx13(LifecycleDialog, { title: "Send duplicate bill", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs13("section", { className: "mb-lifecycle-panel", children: [
5515
+ /* @__PURE__ */ jsxs13("div", { children: [
5516
+ /* @__PURE__ */ jsx13("h3", { children: "Send duplicate bill" }),
5517
+ /* @__PURE__ */ jsx13("p", { children: duplicateDeliveryError || "Loading delivery options\u2026" })
5518
+ ] }),
5519
+ /* @__PURE__ */ jsxs13("div", { className: "mb-lifecycle-panel-actions", children: [
5520
+ /* @__PURE__ */ jsx13("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
5521
+ duplicateDeliveryError ? /* @__PURE__ */ jsx13("button", { type: "button", className: "mb-lifecycle-button primary", onClick: loadDuplicateDelivery, children: "Try again" }) : null
5522
+ ] })
5523
+ ] }) }) : null,
5524
+ panel === "report_status" ? /* @__PURE__ */ jsx13(
5525
+ ReportBillStatusDialog,
5526
+ {
5527
+ ...statusContacts.claimsAdmin ? { claimsAdmin: statusContacts.claimsAdmin } : {},
5528
+ ...statusContacts.billReview ? { billReview: statusContacts.billReview } : {},
5529
+ ...receiptEntries.length ? { receipt: /* @__PURE__ */ jsx13(BillHistoryTable, { entries: receiptEntries, ...appearance ? { appearance } : {} }) } : {},
5530
+ submitting: lifecycle.isMutating,
5531
+ error: lifecycle.error?.message ?? null,
5532
+ onCancel: () => setPanel(""),
5533
+ onSave: (input) => void complete("Bill status reported.", () => lifecycle.reportBillStatus(input)),
5534
+ ...appearance ? { appearance } : {}
5535
+ }
5536
+ ) : null,
5315
5537
  notice ? /* @__PURE__ */ jsx13("div", { className: "mb-lifecycle-message success", role: "status", children: notice }) : null,
5316
5538
  lifecycle.error ? /* @__PURE__ */ jsx13("div", { className: "mb-lifecycle-message error", role: "alert", children: lifecycle.error.message }) : null
5317
5539
  ] });
@@ -5319,8 +5541,10 @@ function ConnectedBillLifecycle({ appearance, sandboxControls = false, className
5319
5541
  var CONNECTED_LIFECYCLE_STYLES = `
5320
5542
  .mb-lifecycle-simulator{display:grid;gap:14px;padding:18px;border:1px solid #b8dadd;border-radius:var(--mb-radius,14px);background:#f2fbfb}.mb-lifecycle-simulator>div:first-child>span{color:var(--mb-accent);font-size:.72rem;font-weight:850;letter-spacing:.09em;text-transform:uppercase}.mb-lifecycle-simulator h3{margin:3px 0 0;font-size:1.05rem}.mb-lifecycle-simulator p{margin:4px 0 0;color:var(--mb-muted)}.mb-lifecycle-simulator-actions{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:10px}.mb-lifecycle-simulator-actions button{min-height:76px;border:1px solid #a9cccf;border-radius:10px;background:var(--mb-surface);color:var(--mb-text);cursor:pointer;padding:12px 14px;text-align:left;font:inherit}.mb-lifecycle-simulator-actions button:hover{border-color:var(--mb-accent);box-shadow:0 3px 14px rgba(23,108,112,.1)}.mb-lifecycle-simulator-actions button:disabled{cursor:not-allowed;opacity:.55}.mb-lifecycle-simulator-actions button strong,.mb-lifecycle-simulator-actions button span{display:block}.mb-lifecycle-simulator-actions button span{margin-top:3px;color:var(--mb-muted);font-size:.83rem}.mb-lifecycle-simulator-idle{padding:10px 12px;border-radius:8px;background:rgba(255,255,255,.72)}
5321
5543
  .mb-connected-lifecycle{--mb-accent:#176c70;--mb-text:#17282d;--mb-muted:#607176;--mb-border:#d7e0df;--mb-soft:#f4f7f6;--mb-surface:#fff;display:grid;gap:18px;color:var(--mb-text);font:14px/1.45 var(--mb-font,Inter,ui-sans-serif,system-ui,sans-serif)}.mb-connected-lifecycle *{box-sizing:border-box}.mb-lifecycle-head{display:flex;align-items:center;justify-content:space-between;gap:20px}.mb-lifecycle-title{display:flex;align-items:center;flex-wrap:wrap;gap:10px}.mb-lifecycle-title h2{margin:0;font-size:1.7rem}.mb-lifecycle-head p{margin:3px 0 0;color:var(--mb-muted)}.mb-lifecycle-tabs{display:grid;grid-template-columns:1fr 1fr;border:1px solid var(--mb-border);border-radius:12px;background:var(--mb-surface);padding:6px}.mb-lifecycle-tabs button{min-height:46px;border:0;border-radius:8px;background:transparent;color:var(--mb-muted);font:inherit;font-size:1rem;font-weight:750;cursor:pointer}.mb-lifecycle-tabs button[aria-selected=true]{background:var(--mb-accent);color:white}.mb-lifecycle-tabpanel{display:grid;gap:18px}.mb-lifecycle-button{min-height:40px;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius,8px);background:var(--mb-input,#fff);color:var(--mb-text);cursor:pointer;font:inherit;font-weight:750;padding:9px 14px}.mb-lifecycle-button.primary{border-color:var(--mb-accent);background:var(--mb-accent);color:var(--mb-accent-contrast,#fff)}.mb-lifecycle-button:disabled{cursor:not-allowed;opacity:.5}.mb-lifecycle-actions-sheet{position:sticky;bottom:12px;z-index:24;display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:9px;padding:10px;border:1px solid var(--mb-border);border-radius:12px;background:color-mix(in srgb,var(--mb-surface) 94%,transparent);box-shadow:0 10px 34px rgba(18,35,43,.16);backdrop-filter:blur(12px)}.mb-lifecycle-card,.mb-lifecycle-panel{padding:20px;border:1px solid var(--mb-border);border-radius:var(--mb-radius,14px);background:var(--mb-surface)}.mb-lifecycle-card header{display:flex;align-items:center;justify-content:space-between;gap:20px}.mb-lifecycle-card h3,.mb-lifecycle-panel h3{margin:0;font-size:1.08rem}.mb-lifecycle-card p,.mb-lifecycle-panel p{margin:3px 0 0;color:var(--mb-muted)}.mb-lifecycle-card header>span{display:grid;place-items:center;min-width:28px;height:28px;border-radius:999px;background:var(--mb-soft);font-weight:750}.mb-lifecycle-documents{list-style:none;margin:14px 0 0;padding:0}.mb-lifecycle-documents li{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:12px 0;border-top:1px solid var(--mb-border)}.mb-lifecycle-documents li>div{display:grid;gap:3px;min-width:0}.mb-lifecycle-documents li span{color:var(--mb-muted);font-size:.85rem}.mb-lifecycle-dialog-backdrop{position:fixed;z-index:2147483000;inset:0;display:grid;place-items:center;padding:20px;background:rgba(18,35,43,.56);backdrop-filter:blur(3px)}.mb-lifecycle-dialog{position:relative;width:min(760px,100%);max-height:calc(100vh - 40px);overflow:auto;outline:0}.mb-lifecycle-dialog-close{position:absolute;z-index:1;top:12px;right:12px;width:34px;height:34px;border:1px solid var(--mb-border);border-radius:8px;background:var(--mb-surface);color:var(--mb-text);cursor:pointer;font:22px/1 inherit}.mb-lifecycle-panel{display:grid;gap:17px;padding-top:24px;box-shadow:0 24px 70px rgba(18,35,43,.22)}.mb-lifecycle-panel label{display:grid;gap:6px;font-size:.85rem;font-weight:750}.mb-lifecycle-panel label small{color:var(--mb-muted);font-weight:500}.mb-lifecycle-panel input,.mb-lifecycle-panel select,.mb-lifecycle-panel textarea{width:100%;min-height:44px;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius,8px);background:var(--mb-input,#fff);color:var(--mb-text);font:inherit;padding:10px 12px}.mb-lifecycle-panel textarea{min-height:100px;resize:vertical}.mb-lifecycle-fields{display:grid;gap:13px}.mb-lifecycle-fields.two{grid-template-columns:repeat(2,minmax(0,1fr))}.mb-lifecycle-fields .full{grid-column:1/-1}.mb-lifecycle-panel-actions{display:flex;justify-content:flex-end;gap:8px}.mb-lifecycle-packet{display:grid;gap:0;margin:0;padding:0;border:0}.mb-lifecycle-packet legend{margin-bottom:7px;font-size:.85rem;font-weight:800}.mb-lifecycle-packet>label{display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:10px;padding:10px 2px;border-top:1px solid var(--mb-border)}.mb-lifecycle-packet>label>input{width:16px;min-height:16px}.mb-lifecycle-packet>label>span{display:grid}.mb-lifecycle-packet button{border:0;background:transparent;color:var(--mb-accent);cursor:pointer;font:inherit}.mb-lifecycle-message,.mb-lifecycle-error,.mb-lifecycle-loading{padding:12px 14px;border-radius:9px}.mb-lifecycle-message.success{background:#edf9f2;color:#217449}.mb-lifecycle-message.error,.mb-lifecycle-error{background:#fff0ef;color:#9d3029}.mb-lifecycle-error{display:flex;align-items:center;gap:12px}.mb-lifecycle-error span{flex:1}.mb-lifecycle-error button{border:1px solid currentColor;border-radius:7px;background:transparent;color:inherit;padding:7px 10px}
5544
+ .mb-lifecycle-dialog.wide{width:min(1280px,100%)}.mb-lifecycle-correction{display:grid;gap:16px;padding:22px;border-radius:var(--mb-radius,14px);background:var(--mb-surface);box-shadow:0 24px 70px rgba(18,35,43,.22)}.mb-lifecycle-correction>header{display:flex;align-items:flex-start;justify-content:space-between;gap:18px;padding-right:42px}.mb-lifecycle-correction h3{margin:0;font-size:1.2rem}.mb-lifecycle-correction header p{margin:4px 0 0;color:var(--mb-muted)}.mb-lifecycle-correction-reason,.mb-lifecycle-correction-contact{display:grid;gap:4px;padding:13px 15px;border-radius:10px}.mb-lifecycle-correction-reason{border-left:4px solid #c5443f;background:#fff2f1;color:#812d29}.mb-lifecycle-correction-contact{border:1px solid color-mix(in srgb,var(--mb-accent) 35%,var(--mb-border));background:color-mix(in srgb,var(--mb-accent) 7%,var(--mb-surface))}.mb-lifecycle-correction-note{display:grid;gap:6px;font-size:.85rem;font-weight:750}.mb-lifecycle-correction-note textarea{min-height:76px;border:1px solid var(--mb-border);border-radius:var(--mb-control-radius,8px);background:var(--mb-input,#fff);color:var(--mb-text);font:inherit;padding:10px 12px;resize:vertical}
5322
5545
  .mb-payment-total{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 14px;border-radius:9px;background:var(--mb-soft)}.mb-payment-total strong{font-size:1.12rem}
5323
- @media(max-width:700px){.mb-lifecycle-head,.mb-lifecycle-card header{align-items:stretch;flex-direction:column}.mb-lifecycle-head>.mb-lifecycle-button{width:100%}.mb-lifecycle-actions-sheet{bottom:calc(var(--mb-host-bottom-offset,72px) + env(safe-area-inset-bottom) + 8px);grid-template-columns:repeat(2,minmax(0,1fr))}.mb-lifecycle-actions-sheet .mb-lifecycle-button:last-child:nth-child(odd){grid-column:1/-1}.mb-lifecycle-fields.two{grid-template-columns:1fr}.mb-lifecycle-fields .full{grid-column:auto}.mb-lifecycle-dialog-backdrop{align-items:end;padding:0}.mb-lifecycle-dialog{max-height:92vh}.mb-lifecycle-dialog .mb-lifecycle-panel{border-radius:18px 18px 0 0}.mb-lifecycle-tabs button{font-size:.9rem}.mb-lifecycle-title h2{font-size:1.4rem}}
5546
+ .mb-lifecycle-deadline-hint{margin:0;padding:10px 12px;border-radius:9px;background:color-mix(in srgb,var(--mb-warning,#8a5c17) 10%,var(--mb-surface));color:var(--mb-warning,#8a5c17);font-size:.85rem}
5547
+ @media(max-width:700px){.mb-lifecycle-head,.mb-lifecycle-card header{align-items:stretch;flex-direction:column}.mb-lifecycle-head>.mb-lifecycle-button{width:100%}.mb-lifecycle-actions-sheet{bottom:calc(var(--mb-host-bottom-offset,72px) + env(safe-area-inset-bottom) + 8px);grid-template-columns:repeat(2,minmax(0,1fr))}.mb-lifecycle-actions-sheet .mb-lifecycle-button:last-child:nth-child(odd){grid-column:1/-1}.mb-lifecycle-fields.two{grid-template-columns:1fr}.mb-lifecycle-fields .full{grid-column:auto}.mb-lifecycle-dialog-backdrop{align-items:end;padding:0}.mb-lifecycle-dialog{max-height:96vh}.mb-lifecycle-dialog .mb-lifecycle-panel,.mb-lifecycle-correction{border-radius:18px 18px 0 0}.mb-lifecycle-correction{padding:18px 12px}.mb-lifecycle-correction>header{align-items:stretch;flex-direction:column;padding-right:42px}.mb-lifecycle-tabs button{font-size:.9rem}.mb-lifecycle-title h2{font-size:1.4rem}}
5324
5548
  `;
5325
5549
 
5326
5550
  // src/index.tsx
@@ -5409,8 +5633,10 @@ export {
5409
5633
  MindBillBillTimeline,
5410
5634
  OrganizationOnboarding,
5411
5635
  PSYCH_QME_DEFAULT_DIAGNOSIS,
5412
- REPORT_BILL_STATUS_OPTIONS,
5636
+ REPORT_BILL_STATUS_OPTIONS2 as REPORT_BILL_STATUS_OPTIONS,
5413
5637
  ReportBillStatusDialog,
5638
+ SECOND_REVIEW_REASON_TEMPLATE2 as SECOND_REVIEW_REASON_TEMPLATE,
5639
+ SECOND_REVIEW_WINDOW_DAYS,
5414
5640
  SendRouteDialog,
5415
5641
  applyBillSubmissionEvaluationDiagnoses,
5416
5642
  applyBillSubmissionEvaluationModifiers,
@@ -5443,7 +5669,9 @@ export {
5443
5669
  normalizeClaimsAdministratorName,
5444
5670
  parseBillSubmissionDate,
5445
5671
  prepareBillSubmissionDocuments,
5672
+ reportBillStatusContacts2 as reportBillStatusContacts,
5446
5673
  resolveMindBillAppearance,
5674
+ secondReviewDeadline2 as secondReviewDeadline,
5447
5675
  summarizeBillingDashboard,
5448
5676
  useBillLifecycle,
5449
5677
  useBillStatus,