@mindbill/react 0.39.0 → 0.40.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/dist/index.d.ts CHANGED
@@ -1020,6 +1020,18 @@ declare function BillHistoryTable({ entries, emptyLabel, appearance, className,
1020
1020
  type BillLifecycleStage = "submitted" | "accepted" | "processed" | "closed";
1021
1021
  /** Maps MindBill's detailed lifecycle state into a compact progress stage. */
1022
1022
  declare function billLifecycleStage(state: string): BillLifecycleStage;
1023
+ type BillLifecycleProgressStepsOptions = {
1024
+ /**
1025
+ * Render pre-submission bills ("draft") as a dedicated leading Draft stage
1026
+ * ahead of the Sent→Closed rail. Off by default: hosts whose bills are always
1027
+ * already submitted (the typical partner embed) never see a Draft stage, and
1028
+ * without the flag a draft state keeps the legacy rendering (Sent as the
1029
+ * current stage). Post-submission states render identically either way.
1030
+ */
1031
+ draftStage?: boolean;
1032
+ };
1033
+ /** True when the lifecycle state is a pre-submission draft. */
1034
+ declare function isBillLifecycleDraft(state: string): boolean;
1023
1035
  /** Returns the end-user label for a canonical lifecycle state. */
1024
1036
  declare function billLifecycleDisplayLabel(state: string, nativeStatus?: string): string;
1025
1037
  type BillLifecycleProgressProps = SurfaceProps & {
@@ -1027,8 +1039,10 @@ type BillLifecycleProgressProps = SurfaceProps & {
1027
1039
  nativeStatus?: string;
1028
1040
  submittedAt?: string | null;
1029
1041
  agingDays?: number | null;
1042
+ /** Opt-in leading Draft stage for pre-submission bills. See {@link BillLifecycleProgressStepsOptions}. */
1043
+ draftStage?: boolean;
1030
1044
  };
1031
- declare function BillLifecycleProgress({ state, nativeStatus, submittedAt, agingDays, appearance, className, style }: BillLifecycleProgressProps): ReactElement;
1045
+ declare function BillLifecycleProgress({ state, nativeStatus, submittedAt, agingDays, draftStage, appearance, className, style }: BillLifecycleProgressProps): ReactElement;
1032
1046
  type BillRejectionNoticeProps = SurfaceProps & {
1033
1047
  rejection: BillRejection;
1034
1048
  title?: string;
@@ -1121,4 +1135,4 @@ type MindBillWidgetProps = {
1121
1135
  declare function MindBillBillTimeline(props: MindBillWidgetProps): ReactElement;
1122
1136
  declare function MindBillBillReview(props: MindBillWidgetProps): ReactElement;
1123
1137
 
1124
- 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, chooseClaimsAdministrator, claimsAdministratorRecommendations, createBillStatusClient, ensureTrailingBillSubmissionLine, ensureTrailingProcedureLine, exactClaimsAdministratorMatch, extractSendRouteEmail, formatBillSubmissionDate, formatSendRouteFax, mindBillAppearanceStyle, mindBillThemePresets, normalizeClaimsAdministratorName, parseBillSubmissionDate, prepareBillSubmissionDocuments, resolveMindBillAppearance, submittedClaimsAdministrator, summarizeBillingDashboard, useBillLifecycle, useBillStatus, validateBillSubmission, visibleBillLifecycleActions };
1138
+ 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 BillLifecycleProgressStepsOptions, 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, chooseClaimsAdministrator, claimsAdministratorRecommendations, createBillStatusClient, ensureTrailingBillSubmissionLine, ensureTrailingProcedureLine, exactClaimsAdministratorMatch, extractSendRouteEmail, formatBillSubmissionDate, formatSendRouteFax, isBillLifecycleDraft, mindBillAppearanceStyle, mindBillThemePresets, normalizeClaimsAdministratorName, parseBillSubmissionDate, prepareBillSubmissionDocuments, resolveMindBillAppearance, submittedClaimsAdministrator, summarizeBillingDashboard, useBillLifecycle, useBillStatus, validateBillSubmission, visibleBillLifecycleActions };
package/dist/index.js CHANGED
@@ -4543,13 +4543,22 @@ function billLifecycleStage(state) {
4543
4543
  if (value.includes("accepted")) return "accepted";
4544
4544
  return "submitted";
4545
4545
  }
4546
- function billLifecycleProgressSteps(state) {
4546
+ function isBillLifecycleDraft(state) {
4547
+ return state.toLowerCase() === "draft";
4548
+ }
4549
+ function billLifecycleProgressSteps(state, options) {
4547
4550
  if (state.toLowerCase() === "rejected") {
4548
4551
  return [
4549
4552
  { id: "submitted", label: "Sent", status: "complete" },
4550
4553
  { id: "rejected", label: "Rejected", status: "current" }
4551
4554
  ];
4552
4555
  }
4556
+ if (options?.draftStage && isBillLifecycleDraft(state)) {
4557
+ return [
4558
+ { id: "draft", label: "Draft", status: "current" },
4559
+ ...lifecycleStages.map((stage) => ({ ...stage, status: "upcoming" }))
4560
+ ];
4561
+ }
4553
4562
  const current = billLifecycleStage(state);
4554
4563
  const currentIndex = lifecycleStages.findIndex((stage) => stage.id === current);
4555
4564
  return lifecycleStages.map((stage, index) => ({
@@ -4567,14 +4576,15 @@ function billLifecycleDisplayLabel(state, nativeStatus) {
4567
4576
  if (value === "written_off") return "Written off";
4568
4577
  return humanize(state || nativeStatus || "submitted");
4569
4578
  }
4570
- function BillLifecycleProgress({ state, nativeStatus, submittedAt, agingDays, appearance, className, style }) {
4579
+ function BillLifecycleProgress({ state, nativeStatus, submittedAt, agingDays, draftStage, appearance, className, style }) {
4571
4580
  const rejected = state.toLowerCase() === "rejected";
4572
- const steps = billLifecycleProgressSteps(state);
4581
+ const draft = Boolean(draftStage) && isBillLifecycleDraft(state);
4582
+ const steps = billLifecycleProgressSteps(state, { draftStage: Boolean(draftStage) });
4573
4583
  return /* @__PURE__ */ jsxs12("section", { className: classes(`mb-surface mb-progress${rejected ? " is-rejected" : ""}`, className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill lifecycle", children: [
4574
4584
  /* @__PURE__ */ jsx12("style", { children: lifecycleSurfaceStyles }),
4575
4585
  /* @__PURE__ */ jsx12("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs12("div", { children: [
4576
4586
  /* @__PURE__ */ jsx12("strong", { children: billLifecycleDisplayLabel(state, nativeStatus) }),
4577
- /* @__PURE__ */ jsx12("span", { children: rejected ? "The payer rejected this submission." : `${submittedAt ? `Submitted ${defaultFormatDate(submittedAt)}` : "Submitted"}${typeof agingDays === "number" ? ` \xB7 ${agingDays} days old` : ""}` })
4587
+ /* @__PURE__ */ jsx12("span", { children: rejected ? "The payer rejected this submission." : draft ? "Not yet sent" : `${submittedAt ? `Submitted ${defaultFormatDate(submittedAt)}` : "Submitted"}${typeof agingDays === "number" ? ` \xB7 ${agingDays} days old` : ""}` })
4578
4588
  ] }) }),
4579
4589
  /* @__PURE__ */ jsx12("ol", { className: "mb-progress-list", style: { gridTemplateColumns: `repeat(${steps.length}, minmax(0, 1fr))` }, children: steps.map((step, index) => /* @__PURE__ */ jsxs12("li", { className: `is-${step.status}`, "aria-current": step.status === "current" ? "step" : void 0, children: [
4580
4590
  /* @__PURE__ */ jsx12("span", { "aria-hidden": "true", children: step.status === "complete" ? "\u2713" : rejected && step.status === "current" ? "!" : index + 1 }),
@@ -5782,6 +5792,7 @@ export {
5782
5792
  extractSendRouteEmail,
5783
5793
  formatBillSubmissionDate,
5784
5794
  formatSendRouteFax,
5795
+ isBillLifecycleDraft,
5785
5796
  mindBillAppearanceStyle,
5786
5797
  mindBillThemePresets,
5787
5798
  normalizeClaimsAdministratorName,