@mindbill/react 0.36.0 → 0.37.1

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/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 & {
@@ -831,21 +831,6 @@ type SurfaceProps$1 = {
831
831
  className?: string;
832
832
  style?: CSSProperties;
833
833
  };
834
- type ReportBillStatusId = "message_left" | "eor_pending" | "eor_sent" | "bill_not_on_file" | "forwarded";
835
- type ReportBillStatusInput = {
836
- status: ReportBillStatusId;
837
- company?: string;
838
- representativeName?: string;
839
- representativeRole?: string;
840
- phone?: string;
841
- callReference?: string;
842
- note?: string;
843
- };
844
- declare const REPORT_BILL_STATUS_OPTIONS: Array<{
845
- id: ReportBillStatusId;
846
- label: string;
847
- description: string;
848
- }>;
849
834
  type ReportBillStatusDialogProps = SurfaceProps$1 & {
850
835
  title?: ReactNode;
851
836
  claimsAdmin?: {
@@ -1069,6 +1054,8 @@ type UseBillLifecycleResult = {
1069
1054
  postPayment: BillLifecycleClient["postPayment"];
1070
1055
  submitSecondReview: BillLifecycleClient["submitSecondReview"];
1071
1056
  resubmitBill: BillLifecycleClient["resubmitBill"];
1057
+ sendDuplicateBill: BillLifecycleClient["sendDuplicateBill"];
1058
+ reportBillStatus: BillLifecycleClient["reportBillStatus"];
1072
1059
  simulateSandbox: BillLifecycleClient["simulateSandbox"];
1073
1060
  };
1074
1061
  declare function useBillLifecycle({ billId: providedBillId, sessionEndpoint, getSession, apiBaseUrl, refreshInterval, enabled, fetch: fetchOverride, }: UseBillLifecycleOptions): UseBillLifecycleResult;
@@ -1100,4 +1087,4 @@ type MindBillWidgetProps = {
1100
1087
  declare function MindBillBillTimeline(props: MindBillWidgetProps): ReactElement;
1101
1088
  declare function MindBillBillReview(props: MindBillWidgetProps): ReactElement;
1102
1089
 
1103
- 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
@@ -3614,34 +3614,11 @@ function BillSubmissionsRibbon({
3614
3614
 
3615
3615
  // src/report-bill-status-dialog.tsx
3616
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";
3617
3621
  import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
3618
- var REPORT_BILL_STATUS_OPTIONS = [
3619
- {
3620
- id: "message_left",
3621
- label: "Message Left Requesting Bill Payment Status",
3622
- description: "Claims Administrator/Bill Review representative unavailable."
3623
- },
3624
- {
3625
- id: "eor_pending",
3626
- label: "Explanation of Review (EOR) Pending",
3627
- description: "Claims Administrator/Bill Review reported the bill is still in process and an EOR has not been generated or sent."
3628
- },
3629
- {
3630
- id: "eor_sent",
3631
- label: "Explanation of Review (EOR) Sent",
3632
- description: "Claims Administrator/Bill Review reported sending an EOR to the provider."
3633
- },
3634
- {
3635
- id: "bill_not_on_file",
3636
- label: "Bill Not On File",
3637
- description: "Claims Administrator/Bill Review reported not receiving the bill."
3638
- },
3639
- {
3640
- id: "forwarded",
3641
- label: "Bill Forwarded to Different Payer / Network",
3642
- description: "Claims Administrator/Bill Review reported forwarding the bill to a different payer."
3643
- }
3644
- ];
3645
3622
  var css7 = `
3646
3623
  .mbbs-overlay{position:fixed;inset:0;z-index:1000;display:grid;place-items:center;padding:20px;background:rgba(15,30,40,.45)}
3647
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)}
@@ -4930,9 +4907,18 @@ import {
4930
4907
  import {
4931
4908
  DEFAULT_API_BASE_URL as DEFAULT_API_BASE_URL2,
4932
4909
  DEFAULT_SESSION_ENDPOINT as DEFAULT_SESSION_ENDPOINT2,
4933
- 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
4934
4921
  } from "@mindbill/browser";
4935
- import { createBillLifecycleClient as createBillLifecycleClient2 } from "@mindbill/browser";
4936
4922
  import { Fragment as Fragment9, jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
4937
4923
  var DEFAULT_REFRESH_INTERVAL2 = 6e4;
4938
4924
  function reservePreviewWindow() {
@@ -5078,6 +5064,8 @@ function useBillLifecycle({
5078
5064
  postPayment: (input) => mutate(() => client.postPayment(input)),
5079
5065
  submitSecondReview: (input) => mutate(() => client.submitSecondReview(input)),
5080
5066
  resubmitBill: (input) => mutate(() => client.resubmitBill(input)),
5067
+ sendDuplicateBill: (input) => mutate(() => client.sendDuplicateBill(input)),
5068
+ reportBillStatus: (input) => mutate(() => client.reportBillStatus(input)),
5081
5069
  simulateSandbox: (input) => mutate(() => client.simulateSandbox(input))
5082
5070
  };
5083
5071
  }
@@ -5181,12 +5169,18 @@ function today() {
5181
5169
  const now = /* @__PURE__ */ new Date();
5182
5170
  return new Date(now.getTime() - now.getTimezoneOffset() * 6e4).toISOString().slice(0, 10);
5183
5171
  }
5172
+ function usDate(isoDate) {
5173
+ const [year, month, day] = isoDate.split("-");
5174
+ return year && month && day ? `${month}/${day}/${year}` : isoDate;
5175
+ }
5184
5176
  function actionPanel(action) {
5185
5177
  if (action.id === "resubmit") return "resubmit";
5186
5178
  if (action.id === "second_review") return "second_review";
5187
5179
  if (action.id === "post_payment") return "payment";
5188
5180
  if (action.id === "close") return "close";
5189
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";
5190
5184
  return "";
5191
5185
  }
5192
5186
  function sandboxScenarios(state) {
@@ -5210,8 +5204,11 @@ function ConnectedBillLifecycle({ appearance, sandboxControls = false, className
5210
5204
  const [panel, setPanel] = useState10("");
5211
5205
  const [notice, setNotice] = useState10("");
5212
5206
  const [reason, setReason] = useState10("");
5207
+ const [correctionError, setCorrectionError] = useState10("");
5213
5208
  const [payment, setPayment] = useState10({ amount: 0, penaltyAmount: 0, interestAmount: 0, method: "check", checkNumber: "", depositDate: today(), note: "" });
5214
5209
  const [review, setReview] = useState10({ reason: "", payerClaimControlNumber: "", disputedAmount: void 0, attachmentIds: [], route: "ebill" });
5210
+ const [duplicateDelivery, setDuplicateDelivery] = useState10(null);
5211
+ const [duplicateDeliveryError, setDuplicateDeliveryError] = useState10("");
5215
5212
  const lastData = useRef5(null);
5216
5213
  const correctionInitialBill = useMemo8(() => data ? correctionBill(data) : null, [data]);
5217
5214
  const correctionAttachments = useMemo8(() => data ? data.bill.attachments.map((attachment) => {
@@ -5266,29 +5263,47 @@ function ConnectedBillLifecycle({ appearance, sandboxControls = false, className
5266
5263
  };
5267
5264
  const submitCorrection = async (value) => {
5268
5265
  setNotice("");
5269
- const documents = await prepareBillSubmissionDocuments({
5270
- attachments: correctionAttachments,
5271
- selectedIds: value.sourceAttachmentIds,
5272
- reportTypeCodeByAttachmentId: value.sourceAttachmentReportTypes,
5273
- uploads: value.uploads,
5274
- ...options.fetch ? { fetch: options.fetch } : {}
5275
- });
5276
- await lifecycle.resubmitBill({
5277
- bill: value.bill,
5278
- ...documents.length ? { documents } : {},
5279
- ...reason.trim() ? { reason: reason.trim() } : {}
5280
- });
5266
+ setCorrectionError("");
5267
+ try {
5268
+ const documents = await prepareBillSubmissionDocuments({
5269
+ attachments: correctionAttachments,
5270
+ selectedIds: value.sourceAttachmentIds,
5271
+ reportTypeCodeByAttachmentId: value.sourceAttachmentReportTypes,
5272
+ uploads: value.uploads,
5273
+ ...options.fetch ? { fetch: options.fetch } : {}
5274
+ });
5275
+ await lifecycle.resubmitBill({
5276
+ bill: value.bill,
5277
+ ...documents.length ? { documents } : {},
5278
+ ...reason.trim() ? { reason: reason.trim() } : {}
5279
+ });
5280
+ } catch (cause) {
5281
+ setCorrectionError(
5282
+ cause instanceof Error && cause.message ? cause.message : "The corrected bill could not be resubmitted."
5283
+ );
5284
+ return;
5285
+ }
5281
5286
  setPanel("");
5282
5287
  setReason("");
5283
5288
  setNotice("Corrected submission sent.");
5284
5289
  };
5290
+ const loadDuplicateDelivery = () => {
5291
+ setDuplicateDeliveryError("");
5292
+ if (duplicateDelivery) return;
5293
+ lifecycle.getDeliveryOptions().then((options2) => setDuplicateDelivery(options2)).catch((cause) => setDuplicateDeliveryError(cause instanceof Error ? cause.message : "Delivery options could not be loaded."));
5294
+ };
5285
5295
  const viewEor = data.lifecycle.actions.find((action) => action.id === "view_eor" && action.enabled);
5286
- const supportedActions = /* @__PURE__ */ new Set(["resubmit", "second_review", "post_payment", "close", "reopen"]);
5296
+ const supportedActions = /* @__PURE__ */ new Set(["resubmit", "second_review", "post_payment", "close", "reopen", "send_duplicate", "report_bill_status"]);
5287
5297
  const actions = data.lifecycle.actions.filter((action) => action.enabled && supportedActions.has(action.id));
5288
5298
  const showSandboxControls = shouldShowSandboxControls(data.environment, sandboxControls);
5289
5299
  const simulations = showSandboxControls ? sandboxScenarios(data.lifecycle.state) : [];
5300
+ const ribbonItems = data.history ? billSubmissionsRibbonFromHistory(data.history) : [];
5301
+ const statusContacts = reportBillStatusContacts(data.delivery);
5302
+ const receiptEntries = (data.history ?? []).filter((entry) => entry.kind === "submission" || entry.kind === "ack");
5303
+ const reviewDeadline = secondReviewDeadline(data.eors);
5290
5304
  return /* @__PURE__ */ jsxs13("section", { className: ["mb-connected-lifecycle", className].filter(Boolean).join(" "), style: mindBillAppearanceStyle(appearance, style), children: [
5291
5305
  /* @__PURE__ */ jsx13("style", { children: CONNECTED_LIFECYCLE_STYLES }),
5306
+ ribbonItems.length >= 2 ? /* @__PURE__ */ jsx13(BillSubmissionsRibbon, { items: ribbonItems, onSelect: () => setTab("history"), ...appearance ? { appearance } : {} }) : null,
5292
5307
  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 } : {} }),
5293
5308
  /* @__PURE__ */ jsxs13("header", { className: "mb-lifecycle-head", children: [
5294
5309
  /* @__PURE__ */ jsxs13("div", { children: [
@@ -5327,7 +5342,11 @@ function ConnectedBillLifecycle({ appearance, sandboxControls = false, className
5327
5342
  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,
5328
5343
  actions.map((action) => /* @__PURE__ */ jsx13("button", { type: "button", className: action.primary ? "mb-lifecycle-button primary" : "mb-lifecycle-button secondary", onClick: () => {
5329
5344
  const next = actionPanel(action);
5330
- if (next) setPanel(next);
5345
+ if (!next) return;
5346
+ if (next === "resubmit") setCorrectionError("");
5347
+ if (next === "send_duplicate") loadDuplicateDelivery();
5348
+ if (next === "second_review") setReview((current) => current.reason.trim() ? current : { ...current, reason: SECOND_REVIEW_REASON_TEMPLATE });
5349
+ setPanel(next);
5331
5350
  }, children: action.label }, action.id))
5332
5351
  ] }) : null,
5333
5352
  panel === "resubmit" && correctionInitialBill ? /* @__PURE__ */ jsx13(LifecycleDialog, { title: "Correct and resubmit", wide: true, onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs13("section", { className: "mb-lifecycle-correction", children: [
@@ -5378,13 +5397,21 @@ function ConnectedBillLifecycle({ appearance, sandboxControls = false, className
5378
5397
  ...options.fetch ? { fetch: options.fetch } : {},
5379
5398
  ...appearance ? { appearance } : {}
5380
5399
  }
5381
- )
5400
+ ),
5401
+ correctionError ? /* @__PURE__ */ jsx13("div", { className: "mb-lifecycle-message error", role: "alert", children: correctionError }) : null
5382
5402
  ] }) }) : null,
5383
5403
  panel === "second_review" ? /* @__PURE__ */ jsx13(LifecycleDialog, { title: "Submit Second Review", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs13("section", { className: "mb-lifecycle-panel", children: [
5384
5404
  /* @__PURE__ */ jsxs13("div", { children: [
5385
5405
  /* @__PURE__ */ jsx13("h3", { children: "Submit Second Review" }),
5386
5406
  /* @__PURE__ */ jsx13("p", { children: "Explain the dispute and include the payer control number and supporting documents." })
5387
5407
  ] }),
5408
+ reviewDeadline ? /* @__PURE__ */ jsxs13("p", { className: "mb-lifecycle-deadline-hint", children: [
5409
+ "Second Review must be requested within 90 days of the denial EOR (dated ",
5410
+ usDate(reviewDeadline.eorDate),
5411
+ ") \u2014 file by ",
5412
+ /* @__PURE__ */ jsx13("strong", { children: usDate(reviewDeadline.deadline) }),
5413
+ "."
5414
+ ] }) : null,
5388
5415
  /* @__PURE__ */ jsxs13("div", { className: "mb-lifecycle-fields two", children: [
5389
5416
  /* @__PURE__ */ jsxs13("label", { className: "full", children: [
5390
5417
  /* @__PURE__ */ jsx13("span", { children: "Reason" }),
@@ -5485,6 +5512,39 @@ function ConnectedBillLifecycle({ appearance, sandboxControls = false, className
5485
5512
  /* @__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" })
5486
5513
  ] })
5487
5514
  ] }) }) : null,
5515
+ panel === "send_duplicate" ? duplicateDelivery ? /* @__PURE__ */ jsx13(
5516
+ SendRouteDialog,
5517
+ {
5518
+ title: "Send duplicate bill",
5519
+ delivery: duplicateDelivery,
5520
+ submitting: lifecycle.isMutating,
5521
+ error: lifecycle.error?.message ?? null,
5522
+ onCancel: () => setPanel(""),
5523
+ onConfirm: (submission) => void complete("Duplicate bill sent.", () => lifecycle.sendDuplicateBill(submission))
5524
+ }
5525
+ ) : /* @__PURE__ */ jsx13(LifecycleDialog, { title: "Send duplicate bill", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs13("section", { className: "mb-lifecycle-panel", children: [
5526
+ /* @__PURE__ */ jsxs13("div", { children: [
5527
+ /* @__PURE__ */ jsx13("h3", { children: "Send duplicate bill" }),
5528
+ /* @__PURE__ */ jsx13("p", { children: duplicateDeliveryError || "Loading delivery options\u2026" })
5529
+ ] }),
5530
+ /* @__PURE__ */ jsxs13("div", { className: "mb-lifecycle-panel-actions", children: [
5531
+ /* @__PURE__ */ jsx13("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => setPanel(""), children: "Cancel" }),
5532
+ duplicateDeliveryError ? /* @__PURE__ */ jsx13("button", { type: "button", className: "mb-lifecycle-button primary", onClick: loadDuplicateDelivery, children: "Try again" }) : null
5533
+ ] })
5534
+ ] }) }) : null,
5535
+ panel === "report_status" ? /* @__PURE__ */ jsx13(
5536
+ ReportBillStatusDialog,
5537
+ {
5538
+ ...statusContacts.claimsAdmin ? { claimsAdmin: statusContacts.claimsAdmin } : {},
5539
+ ...statusContacts.billReview ? { billReview: statusContacts.billReview } : {},
5540
+ ...receiptEntries.length ? { receipt: /* @__PURE__ */ jsx13(BillHistoryTable, { entries: receiptEntries, ...appearance ? { appearance } : {} }) } : {},
5541
+ submitting: lifecycle.isMutating,
5542
+ error: lifecycle.error?.message ?? null,
5543
+ onCancel: () => setPanel(""),
5544
+ onSave: (input) => void complete("Bill status reported.", () => lifecycle.reportBillStatus(input)),
5545
+ ...appearance ? { appearance } : {}
5546
+ }
5547
+ ) : null,
5488
5548
  notice ? /* @__PURE__ */ jsx13("div", { className: "mb-lifecycle-message success", role: "status", children: notice }) : null,
5489
5549
  lifecycle.error ? /* @__PURE__ */ jsx13("div", { className: "mb-lifecycle-message error", role: "alert", children: lifecycle.error.message }) : null
5490
5550
  ] });
@@ -5494,6 +5554,7 @@ var CONNECTED_LIFECYCLE_STYLES = `
5494
5554
  .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}
5495
5555
  .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}
5496
5556
  .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}
5557
+ .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}
5497
5558
  @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}}
5498
5559
  `;
5499
5560
 
@@ -5583,8 +5644,10 @@ export {
5583
5644
  MindBillBillTimeline,
5584
5645
  OrganizationOnboarding,
5585
5646
  PSYCH_QME_DEFAULT_DIAGNOSIS,
5586
- REPORT_BILL_STATUS_OPTIONS,
5647
+ REPORT_BILL_STATUS_OPTIONS2 as REPORT_BILL_STATUS_OPTIONS,
5587
5648
  ReportBillStatusDialog,
5649
+ SECOND_REVIEW_REASON_TEMPLATE2 as SECOND_REVIEW_REASON_TEMPLATE,
5650
+ SECOND_REVIEW_WINDOW_DAYS,
5588
5651
  SendRouteDialog,
5589
5652
  applyBillSubmissionEvaluationDiagnoses,
5590
5653
  applyBillSubmissionEvaluationModifiers,
@@ -5617,7 +5680,9 @@ export {
5617
5680
  normalizeClaimsAdministratorName,
5618
5681
  parseBillSubmissionDate,
5619
5682
  prepareBillSubmissionDocuments,
5683
+ reportBillStatusContacts2 as reportBillStatusContacts,
5620
5684
  resolveMindBillAppearance,
5685
+ secondReviewDeadline2 as secondReviewDeadline,
5621
5686
  summarizeBillingDashboard,
5622
5687
  useBillLifecycle,
5623
5688
  useBillStatus,