@mindbill/react 0.42.4 → 0.43.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 +12 -3
- package/dist/index.d.ts +40 -26
- package/dist/index.js +206 -89
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
// src/index.tsx
|
|
4
4
|
import "@mindbill/embed";
|
|
5
|
-
import { createElement, useEffect as
|
|
5
|
+
import { createElement, useEffect as useEffect11, useRef as useRef7 } from "react";
|
|
6
6
|
|
|
7
7
|
// src/appearance.ts
|
|
8
8
|
var mindBillThemePresets = {
|
|
@@ -2560,6 +2560,7 @@ function BillSubmissionForm({
|
|
|
2560
2560
|
modifierOptions,
|
|
2561
2561
|
taxonomyOptions,
|
|
2562
2562
|
deliveryRoutePicker = "auto",
|
|
2563
|
+
deliveryRouteDialogTitle = "Send bill",
|
|
2563
2564
|
attachmentReportTypeMode = "auto",
|
|
2564
2565
|
attachmentReportTypes = BILL_SUBMISSION_REPORT_TYPES,
|
|
2565
2566
|
defaultAttachmentReportType,
|
|
@@ -2854,37 +2855,42 @@ function BillSubmissionForm({
|
|
|
2854
2855
|
...administrator2 ? { claimsAdministrator: submittedClaimsAdministrator(administrator2) } : {}
|
|
2855
2856
|
}
|
|
2856
2857
|
};
|
|
2857
|
-
|
|
2858
|
-
setSubmitting(true);
|
|
2859
|
-
try {
|
|
2860
|
-
await onSubmit({ bill: complete, sourceAttachmentIds: selectedIds, sourceAttachmentReportTypes, uploads });
|
|
2861
|
-
} catch (caught) {
|
|
2862
|
-
setFormError(caught instanceof Error ? caught.message : "Unable to submit the bill.");
|
|
2863
|
-
} finally {
|
|
2864
|
-
setSubmitting(false);
|
|
2865
|
-
}
|
|
2866
|
-
return;
|
|
2867
|
-
}
|
|
2858
|
+
const value = { bill: complete, sourceAttachmentIds: selectedIds, sourceAttachmentReportTypes, uploads };
|
|
2868
2859
|
if (deliveryRoutePicker !== "off" && referenceClient) {
|
|
2869
2860
|
setSubmitting(true);
|
|
2870
2861
|
try {
|
|
2871
2862
|
const delivery = await referenceClient.getDeliveryPreview({
|
|
2872
2863
|
claimsAdministratorId: complete.claim.claimsAdministrator.id,
|
|
2864
|
+
...complete.claim.claimsAdministrator.payerId ? { payerId: complete.claim.claimsAdministrator.payerId } : {},
|
|
2873
2865
|
...complete.claim.injuryState ? { injuryState: complete.claim.injuryState } : {}
|
|
2874
2866
|
});
|
|
2875
2867
|
setSubmitting(false);
|
|
2876
2868
|
setRouteError(null);
|
|
2877
|
-
setRouteDialog({ delivery,
|
|
2869
|
+
setRouteDialog({ delivery, value });
|
|
2878
2870
|
return;
|
|
2879
|
-
} catch {
|
|
2871
|
+
} catch (caught) {
|
|
2880
2872
|
setSubmitting(false);
|
|
2873
|
+
if (deliveryRoutePicker === "required") {
|
|
2874
|
+
setFormError(caught instanceof Error ? caught.message : "Delivery routes could not be loaded. Nothing was sent.");
|
|
2875
|
+
return;
|
|
2876
|
+
}
|
|
2881
2877
|
}
|
|
2882
2878
|
}
|
|
2883
|
-
|
|
2879
|
+
if (deliveryRoutePicker === "required") {
|
|
2880
|
+
setFormError("Delivery confirmation is unavailable. Nothing was sent.");
|
|
2881
|
+
return;
|
|
2882
|
+
}
|
|
2883
|
+
await performSubmit(value);
|
|
2884
2884
|
}
|
|
2885
|
-
async function
|
|
2885
|
+
async function performSubmit(value) {
|
|
2886
2886
|
setSubmitting(true);
|
|
2887
2887
|
try {
|
|
2888
|
+
if (onSubmit) {
|
|
2889
|
+
await onSubmit(value);
|
|
2890
|
+
setRouteDialog(null);
|
|
2891
|
+
setRouteError(null);
|
|
2892
|
+
return;
|
|
2893
|
+
}
|
|
2888
2894
|
if (!submissionClient) throw new Error("The connected billing client is unavailable.");
|
|
2889
2895
|
const documents = await prepareBillSubmissionDocuments({
|
|
2890
2896
|
attachments,
|
|
@@ -2895,8 +2901,8 @@ function BillSubmissionForm({
|
|
|
2895
2901
|
...fetchOverride ? { fetch: fetchOverride } : {}
|
|
2896
2902
|
});
|
|
2897
2903
|
const result = await submissionClient.submitBill({
|
|
2898
|
-
bill:
|
|
2899
|
-
...submission ? { submission } : {},
|
|
2904
|
+
bill: value.bill,
|
|
2905
|
+
...value.submission ? { submission: value.submission } : {},
|
|
2900
2906
|
documents
|
|
2901
2907
|
});
|
|
2902
2908
|
setRouteDialog(null);
|
|
@@ -2904,7 +2910,7 @@ function BillSubmissionForm({
|
|
|
2904
2910
|
await onSubmitted?.(result);
|
|
2905
2911
|
} catch (caught) {
|
|
2906
2912
|
const message = caught instanceof Error ? caught.message : "Unable to submit the bill.";
|
|
2907
|
-
if (submission) setRouteError(message);
|
|
2913
|
+
if (value.submission) setRouteError(message);
|
|
2908
2914
|
else setFormError(message);
|
|
2909
2915
|
} finally {
|
|
2910
2916
|
setSubmitting(false);
|
|
@@ -3237,7 +3243,7 @@ function BillSubmissionForm({
|
|
|
3237
3243
|
routeDialog ? /* @__PURE__ */ jsx5(
|
|
3238
3244
|
SendRouteDialog,
|
|
3239
3245
|
{
|
|
3240
|
-
title:
|
|
3246
|
+
title: deliveryRouteDialogTitle,
|
|
3241
3247
|
delivery: routeDialog.delivery,
|
|
3242
3248
|
submitting,
|
|
3243
3249
|
error: routeError,
|
|
@@ -3248,7 +3254,7 @@ function BillSubmissionForm({
|
|
|
3248
3254
|
}
|
|
3249
3255
|
},
|
|
3250
3256
|
onConfirm: (submission) => {
|
|
3251
|
-
void
|
|
3257
|
+
void performSubmit({ ...routeDialog.value, submission });
|
|
3252
3258
|
}
|
|
3253
3259
|
}
|
|
3254
3260
|
) : null
|
|
@@ -3861,15 +3867,90 @@ function ribbonDate(iso) {
|
|
|
3861
3867
|
if (Number.isNaN(parsed.getTime())) return iso;
|
|
3862
3868
|
return new Intl.DateTimeFormat("en-US", { month: "2-digit", day: "2-digit", year: "numeric" }).format(parsed);
|
|
3863
3869
|
}
|
|
3864
|
-
function
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
]
|
|
3872
|
-
}
|
|
3870
|
+
function attemptStatus(entries, attempt) {
|
|
3871
|
+
const rejected = [...entries].reverse().find(
|
|
3872
|
+
(entry) => entry.kind === "ack" && (/reject|deni|error/i.test(entry.action) || entry.tone === "problem")
|
|
3873
|
+
);
|
|
3874
|
+
if (rejected) return {
|
|
3875
|
+
badge: rejected.action,
|
|
3876
|
+
badgeTone: "danger",
|
|
3877
|
+
meta: [{ label: "Rejected", value: ribbonDate(rejected.date) }]
|
|
3878
|
+
};
|
|
3879
|
+
const complianceDueDate = entries.flatMap((entry) => entry.details?.complianceDueDates ?? []).find((due) => /payment|working day/i.test(due.text));
|
|
3880
|
+
if (complianceDueDate) return {
|
|
3881
|
+
badge: complianceDueDate.text,
|
|
3882
|
+
badgeTone: "warning",
|
|
3883
|
+
meta: [{ label: "Effective date", value: ribbonDate(complianceDueDate.date) }]
|
|
3884
|
+
};
|
|
3885
|
+
const processed = [...entries].reverse().find((entry) => entry.kind === "eor" || entry.kind === "payment");
|
|
3886
|
+
if (processed) return {
|
|
3887
|
+
badge: "Processed",
|
|
3888
|
+
badgeTone: "success",
|
|
3889
|
+
meta: [{ label: "Processed", value: ribbonDate(processed.date) }]
|
|
3890
|
+
};
|
|
3891
|
+
const accepted = [...entries].reverse().find(
|
|
3892
|
+
(entry) => entry.kind === "ack" && (/accept/i.test(entry.action) || entry.tone === "success")
|
|
3893
|
+
);
|
|
3894
|
+
if (accepted) return {
|
|
3895
|
+
badge: accepted.action,
|
|
3896
|
+
badgeTone: "success",
|
|
3897
|
+
meta: [{ label: "Accepted", value: ribbonDate(accepted.date) }]
|
|
3898
|
+
};
|
|
3899
|
+
const closed = [...entries].reverse().find((entry) => entry.kind === "close");
|
|
3900
|
+
if (closed) return {
|
|
3901
|
+
badge: "Closed",
|
|
3902
|
+
badgeTone: "neutral",
|
|
3903
|
+
meta: [{ label: "Closed", value: ribbonDate(closed.date) }]
|
|
3904
|
+
};
|
|
3905
|
+
if (attempt?.ackLabel) return {
|
|
3906
|
+
badge: attempt.ackLabel,
|
|
3907
|
+
badgeTone: /reject|deni|error/i.test(attempt.ackLabel) ? "danger" : /accept/i.test(attempt.ackLabel) ? "success" : "neutral",
|
|
3908
|
+
...attempt.ackAt ? { meta: [{ label: /reject|deni|error/i.test(attempt.ackLabel) ? "Rejected" : "Acknowledged", value: ribbonDate(attempt.ackAt) }] } : {}
|
|
3909
|
+
};
|
|
3910
|
+
if (attempt?.status) return {
|
|
3911
|
+
badge: attempt.status.replaceAll("_", " "),
|
|
3912
|
+
badgeTone: "neutral"
|
|
3913
|
+
};
|
|
3914
|
+
return {};
|
|
3915
|
+
}
|
|
3916
|
+
function billSubmissionsRibbonFromHistory(history, attempts = []) {
|
|
3917
|
+
if (attempts.length) {
|
|
3918
|
+
return attempts.map((attempt) => {
|
|
3919
|
+
const attemptEntries = history.filter((entry) => entry.attemptId === attempt.id);
|
|
3920
|
+
const submission = attemptEntries.find((entry) => entry.kind === "submission");
|
|
3921
|
+
const status = attemptStatus(attemptEntries, attempt);
|
|
3922
|
+
return {
|
|
3923
|
+
id: attempt.id,
|
|
3924
|
+
...submission ? { historyEntryId: submission.id } : {},
|
|
3925
|
+
label: attempt.label,
|
|
3926
|
+
...status.badge ? { badge: status.badge } : {},
|
|
3927
|
+
...status.badgeTone ? { badgeTone: status.badgeTone } : {},
|
|
3928
|
+
meta: [
|
|
3929
|
+
{ label: "Delivery", value: attempt.deliveryLabel ?? (submission ? billSubmissionsRibbonDeliveryLabel(submission.summary) : "\u2014") },
|
|
3930
|
+
{ label: "Sent", value: attempt.sentAt ? ribbonDate(attempt.sentAt) : submission ? ribbonDate(submission.date) : "\u2014" },
|
|
3931
|
+
...status.meta ?? []
|
|
3932
|
+
],
|
|
3933
|
+
active: attempt.isCurrent
|
|
3934
|
+
};
|
|
3935
|
+
});
|
|
3936
|
+
}
|
|
3937
|
+
const submissions = history.map((entry, index) => ({ entry, index })).filter(({ entry }) => entry.kind === "submission");
|
|
3938
|
+
return submissions.map(({ entry, index }, submissionIndex) => {
|
|
3939
|
+
const nextSubmissionIndex = submissions[submissionIndex + 1]?.index ?? history.length;
|
|
3940
|
+
const status = attemptStatus(history.slice(index, nextSubmissionIndex));
|
|
3941
|
+
return {
|
|
3942
|
+
id: entry.id,
|
|
3943
|
+
historyEntryId: entry.id,
|
|
3944
|
+
label: entry.action,
|
|
3945
|
+
...status.badge ? { badge: status.badge } : {},
|
|
3946
|
+
...status.badgeTone ? { badgeTone: status.badgeTone } : {},
|
|
3947
|
+
meta: [
|
|
3948
|
+
{ label: "Delivery", value: billSubmissionsRibbonDeliveryLabel(entry.summary) },
|
|
3949
|
+
{ label: "Sent", value: ribbonDate(entry.date) },
|
|
3950
|
+
...status.meta ?? []
|
|
3951
|
+
]
|
|
3952
|
+
};
|
|
3953
|
+
});
|
|
3873
3954
|
}
|
|
3874
3955
|
var css7 = `
|
|
3875
3956
|
.mbsr{display:flex;gap:10px;overflow-x:auto;padding-bottom:4px;color:var(--mb-text);font-family:var(--mb-font);font-size:13px}
|
|
@@ -3879,7 +3960,10 @@ var css7 = `
|
|
|
3879
3960
|
.mbsr-chip[data-active=true]{border-color:var(--mb-accent);background:color-mix(in srgb,var(--mb-accent) 7%,var(--mb-surface));box-shadow:0 0 0 1px var(--mb-accent) inset}
|
|
3880
3961
|
.mbsr-top{display:flex;align-items:center;gap:8px;min-width:0}
|
|
3881
3962
|
.mbsr-label{font-size:13.5px;font-weight:760;line-height:1.3;overflow-wrap:anywhere}
|
|
3882
|
-
.mbsr-badge{flex:0 0 auto;padding:2px 8px;border:1px solid color-mix(in srgb,var(--mb-
|
|
3963
|
+
.mbsr-badge{flex:0 0 auto;padding:2px 8px;border:1px solid color-mix(in srgb,var(--mb-muted) 45%,var(--mb-border));border-radius:999px;background:var(--mb-soft);font-size:11px;font-weight:700;white-space:nowrap}
|
|
3964
|
+
.mbsr-badge[data-tone=success]{border-color:color-mix(in srgb,#23876f 52%,var(--mb-border));background:color-mix(in srgb,#23876f 11%,var(--mb-surface));color:#176452}
|
|
3965
|
+
.mbsr-badge[data-tone=warning]{border-color:color-mix(in srgb,var(--mb-warning) 55%,var(--mb-border));background:color-mix(in srgb,var(--mb-warning) 12%,var(--mb-surface))}
|
|
3966
|
+
.mbsr-badge[data-tone=danger]{border-color:color-mix(in srgb,var(--mb-danger) 45%,var(--mb-border));background:color-mix(in srgb,var(--mb-danger) 9%,var(--mb-surface));color:var(--mb-danger)}
|
|
3883
3967
|
.mbsr-meta{display:grid;grid-auto-flow:column;grid-auto-columns:minmax(0,auto);gap:2px 14px;justify-content:start}
|
|
3884
3968
|
.mbsr-meta>span{display:grid;gap:1px;min-width:0}
|
|
3885
3969
|
.mbsr-meta i{color:var(--mb-muted);font-size:10.5px;font-style:normal;font-weight:800;letter-spacing:.05em;text-transform:uppercase;white-space:nowrap}
|
|
@@ -3905,7 +3989,7 @@ function BillSubmissionsRibbon({
|
|
|
3905
3989
|
const content = /* @__PURE__ */ jsxs9(Fragment7, { children: [
|
|
3906
3990
|
/* @__PURE__ */ jsxs9("span", { className: "mbsr-top", children: [
|
|
3907
3991
|
/* @__PURE__ */ jsx9("span", { className: "mbsr-label", children: item.label }),
|
|
3908
|
-
item.badge ? /* @__PURE__ */ jsx9("span", { className: "mbsr-badge", children: item.badge }) : null
|
|
3992
|
+
item.badge ? /* @__PURE__ */ jsx9("span", { className: "mbsr-badge", "data-tone": item.badgeTone ?? "neutral", children: item.badge }) : null
|
|
3909
3993
|
] }),
|
|
3910
3994
|
item.meta?.length ? /* @__PURE__ */ jsx9("span", { className: "mbsr-meta", children: item.meta.slice(0, 3).map((pair) => /* @__PURE__ */ jsxs9("span", { children: [
|
|
3911
3995
|
/* @__PURE__ */ jsx9("i", { children: pair.label }),
|
|
@@ -3917,6 +4001,7 @@ function BillSubmissionsRibbon({
|
|
|
3917
4001
|
{
|
|
3918
4002
|
className: "mbsr-chip",
|
|
3919
4003
|
"data-active": Boolean(item.active),
|
|
4004
|
+
"aria-current": item.active ? "true" : void 0,
|
|
3920
4005
|
href: item.href,
|
|
3921
4006
|
role: "listitem",
|
|
3922
4007
|
onClick: () => onSelect?.(item),
|
|
@@ -3929,6 +4014,7 @@ function BillSubmissionsRibbon({
|
|
|
3929
4014
|
type: "button",
|
|
3930
4015
|
className: "mbsr-chip",
|
|
3931
4016
|
"data-active": Boolean(item.active),
|
|
4017
|
+
"aria-pressed": Boolean(item.active),
|
|
3932
4018
|
role: "listitem",
|
|
3933
4019
|
onClick: () => onSelect?.(item),
|
|
3934
4020
|
children: content
|
|
@@ -4672,7 +4758,7 @@ function ConnectedBillStatus({
|
|
|
4672
4758
|
}
|
|
4673
4759
|
|
|
4674
4760
|
// src/bill-lifecycle-surfaces.tsx
|
|
4675
|
-
import { useState as useState10 } from "react";
|
|
4761
|
+
import { useEffect as useEffect9, useRef as useRef5, useState as useState10 } from "react";
|
|
4676
4762
|
import { Fragment as Fragment10, jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
4677
4763
|
function visibleBillLifecycleActions(actions, showUnavailable = false) {
|
|
4678
4764
|
return actions.filter((action) => action.enabled || showUnavailable);
|
|
@@ -4746,8 +4832,15 @@ function historyDate(iso) {
|
|
|
4746
4832
|
if (Number.isNaN(parsed.getTime())) return iso;
|
|
4747
4833
|
return new Intl.DateTimeFormat("en-US", { month: "2-digit", day: "2-digit", year: "numeric" }).format(parsed);
|
|
4748
4834
|
}
|
|
4749
|
-
function BillHistoryTable({ entries, emptyLabel = "No bill history yet.", appearance, className, style, formatDate = historyDate, documentHref, onOpenDocument }) {
|
|
4835
|
+
function BillHistoryTable({ entries, selectedEntryId, emptyLabel = "No bill history yet.", appearance, className, style, formatDate = historyDate, documentHref, onOpenDocument }) {
|
|
4750
4836
|
const [expanded, setExpanded] = useState10({});
|
|
4837
|
+
const selectedRowRef = useRef5(null);
|
|
4838
|
+
useEffect9(() => {
|
|
4839
|
+
if (!selectedEntryId) return;
|
|
4840
|
+
const selected = entries.find((entry) => entry.id === selectedEntryId);
|
|
4841
|
+
if (selected?.details) setExpanded((current) => current[selectedEntryId] ? current : { ...current, [selectedEntryId]: true });
|
|
4842
|
+
selectedRowRef.current?.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
4843
|
+
}, [entries, selectedEntryId]);
|
|
4751
4844
|
return /* @__PURE__ */ jsxs13("section", { className: classes("mb-surface mb-history", className), style: mindBillAppearanceStyle(appearance, style), "aria-label": "Bill history", children: [
|
|
4752
4845
|
/* @__PURE__ */ jsx13("style", { children: lifecycleSurfaceStyles }),
|
|
4753
4846
|
/* @__PURE__ */ jsx13("header", { className: "mb-surface-heading", children: /* @__PURE__ */ jsxs13("div", { children: [
|
|
@@ -4762,6 +4855,7 @@ function BillHistoryTable({ entries, emptyLabel = "No bill history yet.", appear
|
|
|
4762
4855
|
/* @__PURE__ */ jsx13("span", { children: "Details" })
|
|
4763
4856
|
] }),
|
|
4764
4857
|
/* @__PURE__ */ jsx13("ul", { className: "mb-history-rows", children: entries.map((entry) => {
|
|
4858
|
+
const isSelected = entry.id === selectedEntryId;
|
|
4765
4859
|
const expandable = Boolean(entry.details);
|
|
4766
4860
|
const isOpen = expandable && Boolean(expanded[entry.id]);
|
|
4767
4861
|
const details = entry.details;
|
|
@@ -4774,43 +4868,52 @@ function BillHistoryTable({ entries, emptyLabel = "No bill history yet.", appear
|
|
|
4774
4868
|
entry.summary
|
|
4775
4869
|
] })
|
|
4776
4870
|
] });
|
|
4777
|
-
return /* @__PURE__ */ jsxs13(
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
/* @__PURE__ */
|
|
4795
|
-
|
|
4796
|
-
|
|
4797
|
-
|
|
4798
|
-
|
|
4799
|
-
|
|
4800
|
-
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
|
|
4804
|
-
|
|
4805
|
-
|
|
4806
|
-
|
|
4807
|
-
|
|
4808
|
-
|
|
4809
|
-
|
|
4810
|
-
|
|
4811
|
-
|
|
4812
|
-
|
|
4813
|
-
|
|
4871
|
+
return /* @__PURE__ */ jsxs13(
|
|
4872
|
+
"li",
|
|
4873
|
+
{
|
|
4874
|
+
ref: isSelected ? selectedRowRef : void 0,
|
|
4875
|
+
className: `mb-history-row is-${entry.tone}${isSelected ? " is-selected" : ""}`,
|
|
4876
|
+
"aria-current": isSelected ? "true" : void 0,
|
|
4877
|
+
children: [
|
|
4878
|
+
expandable ? /* @__PURE__ */ jsx13(
|
|
4879
|
+
"button",
|
|
4880
|
+
{
|
|
4881
|
+
type: "button",
|
|
4882
|
+
className: "mb-history-line is-expandable",
|
|
4883
|
+
"aria-expanded": isOpen,
|
|
4884
|
+
onClick: () => setExpanded((current) => ({ ...current, [entry.id]: !current[entry.id] })),
|
|
4885
|
+
children: lineContents
|
|
4886
|
+
}
|
|
4887
|
+
) : /* @__PURE__ */ jsx13("div", { className: "mb-history-line", children: lineContents }),
|
|
4888
|
+
isOpen && details ? /* @__PURE__ */ jsxs13("div", { className: "mb-history-details", children: [
|
|
4889
|
+
details.rows?.length ? /* @__PURE__ */ jsx13("dl", { className: "mb-history-kv", children: details.rows.map((row) => /* @__PURE__ */ jsxs13("div", { children: [
|
|
4890
|
+
/* @__PURE__ */ jsx13("dt", { children: row.label }),
|
|
4891
|
+
/* @__PURE__ */ jsx13("dd", { children: row.value })
|
|
4892
|
+
] }, `${row.label}-${row.value}`)) }) : null,
|
|
4893
|
+
details.documents?.length ? /* @__PURE__ */ jsx13("div", { className: "mb-history-kv", children: /* @__PURE__ */ jsxs13("div", { children: [
|
|
4894
|
+
/* @__PURE__ */ jsx13("dt", { children: "Documents" }),
|
|
4895
|
+
/* @__PURE__ */ jsx13("dd", { children: details.documents.map((doc) => {
|
|
4896
|
+
const href = documentHref?.(doc) ?? null;
|
|
4897
|
+
return href ? /* @__PURE__ */ jsx13("a", { className: "mb-history-doc", href, target: "_blank", rel: "noreferrer", children: doc.filename }, doc.id) : onOpenDocument ? /* @__PURE__ */ jsx13("button", { type: "button", className: "mb-history-doc", onClick: () => void onOpenDocument(doc), children: doc.filename }, doc.id) : /* @__PURE__ */ jsx13("span", { className: "mb-history-doc", children: doc.filename }, doc.id);
|
|
4898
|
+
}) })
|
|
4899
|
+
] }) }) : null,
|
|
4900
|
+
details.codes?.length ? /* @__PURE__ */ jsx13("dl", { className: "mb-history-codes", children: details.codes.map((code) => /* @__PURE__ */ jsxs13("div", { children: [
|
|
4901
|
+
/* @__PURE__ */ jsx13("dt", { children: code.code }),
|
|
4902
|
+
/* @__PURE__ */ jsx13("dd", { children: code.text })
|
|
4903
|
+
] }, code.code)) }) : null,
|
|
4904
|
+
details.complianceDueDates?.length ? /* @__PURE__ */ jsxs13("div", { className: "mb-history-due", children: [
|
|
4905
|
+
/* @__PURE__ */ jsx13("em", { children: "Compliance Due Dates" }),
|
|
4906
|
+
/* @__PURE__ */ jsx13("dl", { children: details.complianceDueDates.map((due) => /* @__PURE__ */ jsxs13("div", { children: [
|
|
4907
|
+
/* @__PURE__ */ jsx13("dt", { children: formatDate(due.date) }),
|
|
4908
|
+
/* @__PURE__ */ jsx13("dd", { children: due.text })
|
|
4909
|
+
] }, `${due.date}-${due.text}`)) })
|
|
4910
|
+
] }) : null,
|
|
4911
|
+
details.text ? /* @__PURE__ */ jsx13("p", { className: "mb-history-text", children: details.text }) : null
|
|
4912
|
+
] }) : null
|
|
4913
|
+
]
|
|
4914
|
+
},
|
|
4915
|
+
entry.id
|
|
4916
|
+
);
|
|
4814
4917
|
}) })
|
|
4815
4918
|
] })
|
|
4816
4919
|
] });
|
|
@@ -5214,6 +5317,7 @@ var lifecycleSurfaceStyles = `
|
|
|
5214
5317
|
.mb-history-rows{list-style:none;margin:0;padding:0}.mb-history-row{border-top:1px solid var(--mb-border)}
|
|
5215
5318
|
.mb-history-row.is-submission{background:color-mix(in srgb,var(--mb-accent) 9%,var(--mb-surface))}
|
|
5216
5319
|
.mb-history-row.is-note{background:color-mix(in srgb,#f2c344 13%,var(--mb-surface))}
|
|
5320
|
+
.mb-history-row.is-selected{position:relative;background:color-mix(in srgb,var(--mb-accent) 15%,var(--mb-surface));box-shadow:inset 4px 0 0 var(--mb-accent),inset 0 0 0 1px color-mix(in srgb,var(--mb-accent) 44%,transparent)}
|
|
5217
5321
|
.mb-history-line{display:grid;grid-template-columns:96px 160px 140px minmax(0,1fr);gap:12px;width:100%;padding:10px 14px;border:0;background:transparent;color:inherit;font:inherit;text-align:left}
|
|
5218
5322
|
.mb-history-line.is-expandable{cursor:pointer}.mb-history-line.is-expandable:hover .mb-history-summary{text-decoration:underline}
|
|
5219
5323
|
.mb-history-date{color:var(--mb-muted);font-size:13px}.mb-history-action{font-size:13.5px;font-weight:750}
|
|
@@ -5238,9 +5342,9 @@ var lifecycleSurfaceStyles = `
|
|
|
5238
5342
|
// src/connected-bill-lifecycle.tsx
|
|
5239
5343
|
import {
|
|
5240
5344
|
useCallback as useCallback4,
|
|
5241
|
-
useEffect as
|
|
5345
|
+
useEffect as useEffect10,
|
|
5242
5346
|
useMemo as useMemo8,
|
|
5243
|
-
useRef as
|
|
5347
|
+
useRef as useRef6,
|
|
5244
5348
|
useState as useState11
|
|
5245
5349
|
} from "react";
|
|
5246
5350
|
import {
|
|
@@ -5305,7 +5409,7 @@ function useBillLifecycle({
|
|
|
5305
5409
|
const [isLoading, setIsLoading] = useState11(enabled);
|
|
5306
5410
|
const [isRefreshing, setIsRefreshing] = useState11(false);
|
|
5307
5411
|
const [isMutating, setIsMutating] = useState11(false);
|
|
5308
|
-
const mounted =
|
|
5412
|
+
const mounted = useRef6(true);
|
|
5309
5413
|
const client = useMemo8(() => createBillLifecycleClient({
|
|
5310
5414
|
billId: providedBillId,
|
|
5311
5415
|
sessionEndpoint,
|
|
@@ -5313,12 +5417,12 @@ function useBillLifecycle({
|
|
|
5313
5417
|
apiBaseUrl,
|
|
5314
5418
|
fetch: fetchOverride
|
|
5315
5419
|
}), [apiBaseUrl, fetchOverride, getSession, providedBillId, sessionEndpoint]);
|
|
5316
|
-
|
|
5420
|
+
useEffect10(() => {
|
|
5317
5421
|
setData(null);
|
|
5318
5422
|
setError(null);
|
|
5319
5423
|
setIsLoading(enabled);
|
|
5320
5424
|
}, [enabled, providedBillId]);
|
|
5321
|
-
|
|
5425
|
+
useEffect10(() => {
|
|
5322
5426
|
mounted.current = true;
|
|
5323
5427
|
return () => {
|
|
5324
5428
|
mounted.current = false;
|
|
@@ -5342,7 +5446,7 @@ function useBillLifecycle({
|
|
|
5342
5446
|
}
|
|
5343
5447
|
}
|
|
5344
5448
|
}, [client, enabled]);
|
|
5345
|
-
|
|
5449
|
+
useEffect10(() => {
|
|
5346
5450
|
if (!enabled) return;
|
|
5347
5451
|
void refresh();
|
|
5348
5452
|
const interval = refreshInterval > 0 ? window.setInterval(() => void refresh(), refreshInterval) : null;
|
|
@@ -5411,10 +5515,10 @@ function useBillLifecycle({
|
|
|
5411
5515
|
};
|
|
5412
5516
|
}
|
|
5413
5517
|
function LifecycleDialog({ children, title, wide = false, onClose }) {
|
|
5414
|
-
const dialog =
|
|
5415
|
-
const onCloseRef =
|
|
5518
|
+
const dialog = useRef6(null);
|
|
5519
|
+
const onCloseRef = useRef6(onClose);
|
|
5416
5520
|
onCloseRef.current = onClose;
|
|
5417
|
-
|
|
5521
|
+
useEffect10(() => {
|
|
5418
5522
|
const previous = document.activeElement;
|
|
5419
5523
|
dialog.current?.focus();
|
|
5420
5524
|
const onKeyDown = (event) => event.key === "Escape" && onCloseRef.current();
|
|
@@ -5646,6 +5750,7 @@ function ConnectedBillLifecycle({ appearance, actorName, claimsAdministratorHint
|
|
|
5646
5750
|
const lifecycle = useBillLifecycle(options);
|
|
5647
5751
|
const { data } = lifecycle;
|
|
5648
5752
|
const [tab, setTab] = useState11("details");
|
|
5753
|
+
const [selectedSubmissionId, setSelectedSubmissionId] = useState11();
|
|
5649
5754
|
const [panel, setPanel] = useState11("");
|
|
5650
5755
|
const [notice, setNotice] = useState11("");
|
|
5651
5756
|
const [reason, setReason] = useState11("");
|
|
@@ -5656,7 +5761,7 @@ function ConnectedBillLifecycle({ appearance, actorName, claimsAdministratorHint
|
|
|
5656
5761
|
const [duplicateDelivery, setDuplicateDelivery] = useState11(null);
|
|
5657
5762
|
const [duplicateDeliveryError, setDuplicateDeliveryError] = useState11("");
|
|
5658
5763
|
const actor = actorName?.trim() ? { actorName: actorName.trim() } : {};
|
|
5659
|
-
const lastData =
|
|
5764
|
+
const lastData = useRef6(null);
|
|
5660
5765
|
const correctionInitialBill = useMemo8(() => data ? correctionBill(data) : null, [data]);
|
|
5661
5766
|
const correctionAttachments = useMemo8(() => data ? data.bill.attachments.map((attachment) => {
|
|
5662
5767
|
const documentType = correctionDocumentType(attachment.documentType);
|
|
@@ -5672,7 +5777,7 @@ function ConnectedBillLifecycle({ appearance, actorName, claimsAdministratorHint
|
|
|
5672
5777
|
};
|
|
5673
5778
|
}) : [], [data, lifecycle]);
|
|
5674
5779
|
const correctionAttentionFields = useMemo8(() => data?.rejection?.issues?.flatMap((issue) => issue.fieldPaths || []).filter((path, index, fields) => fields.indexOf(path) === index) || [], [data]);
|
|
5675
|
-
|
|
5780
|
+
useEffect10(() => {
|
|
5676
5781
|
if (!data || data === lastData.current) return;
|
|
5677
5782
|
lastData.current = data;
|
|
5678
5783
|
onChanged?.(data);
|
|
@@ -5721,6 +5826,7 @@ function ConnectedBillLifecycle({ appearance, actorName, claimsAdministratorHint
|
|
|
5721
5826
|
});
|
|
5722
5827
|
await lifecycle.resubmitBill({
|
|
5723
5828
|
bill: value.bill,
|
|
5829
|
+
...value.submission ? { submission: value.submission } : {},
|
|
5724
5830
|
...documents.length ? { documents } : {},
|
|
5725
5831
|
...reason.trim() ? { reason: reason.trim() } : {},
|
|
5726
5832
|
...actor
|
|
@@ -5729,7 +5835,7 @@ function ConnectedBillLifecycle({ appearance, actorName, claimsAdministratorHint
|
|
|
5729
5835
|
setCorrectionError(
|
|
5730
5836
|
cause instanceof Error && cause.message ? cause.message : "The corrected bill could not be resubmitted."
|
|
5731
5837
|
);
|
|
5732
|
-
|
|
5838
|
+
throw cause;
|
|
5733
5839
|
}
|
|
5734
5840
|
setPanel("");
|
|
5735
5841
|
setReason("");
|
|
@@ -5748,6 +5854,7 @@ function ConnectedBillLifecycle({ appearance, actorName, claimsAdministratorHint
|
|
|
5748
5854
|
});
|
|
5749
5855
|
await lifecycle.submitNewBill({
|
|
5750
5856
|
bill: value.bill,
|
|
5857
|
+
...value.submission ? { submission: value.submission } : {},
|
|
5751
5858
|
...documents.length ? { documents } : {},
|
|
5752
5859
|
...reason.trim() ? { reason: reason.trim() } : {},
|
|
5753
5860
|
...actor
|
|
@@ -5756,7 +5863,7 @@ function ConnectedBillLifecycle({ appearance, actorName, claimsAdministratorHint
|
|
|
5756
5863
|
setNewBillError(
|
|
5757
5864
|
cause instanceof Error && cause.message ? cause.message : "The new bill could not be submitted."
|
|
5758
5865
|
);
|
|
5759
|
-
|
|
5866
|
+
throw cause;
|
|
5760
5867
|
}
|
|
5761
5868
|
setPanel("");
|
|
5762
5869
|
setReason("");
|
|
@@ -5772,13 +5879,19 @@ function ConnectedBillLifecycle({ appearance, actorName, claimsAdministratorHint
|
|
|
5772
5879
|
const actions = data.lifecycle.actions.filter((action) => action.enabled && supportedActions.has(action.id));
|
|
5773
5880
|
const showSandboxControls = shouldShowSandboxControls(data.environment, sandboxControls);
|
|
5774
5881
|
const simulations = showSandboxControls ? sandboxScenarios(data.lifecycle.state) : [];
|
|
5775
|
-
const
|
|
5882
|
+
const mappedRibbonItems = data.history ? billSubmissionsRibbonFromHistory(data.history, data.attempts) : [];
|
|
5883
|
+
const activeSubmissionId = selectedSubmissionId ?? mappedRibbonItems.find((item) => item.active)?.id ?? mappedRibbonItems[mappedRibbonItems.length - 1]?.id;
|
|
5884
|
+
const ribbonItems = mappedRibbonItems.map((item) => ({ ...item, active: item.id === activeSubmissionId }));
|
|
5885
|
+
const selectedHistoryEntryId = ribbonItems.find((item) => item.id === activeSubmissionId)?.historyEntryId;
|
|
5776
5886
|
const statusContacts = reportBillStatusContacts(data.delivery);
|
|
5777
5887
|
const receiptEntries = (data.history ?? []).filter((entry) => entry.kind === "submission" || entry.kind === "ack");
|
|
5778
5888
|
const reviewDeadline = secondReviewDeadline(data.eors);
|
|
5779
5889
|
return /* @__PURE__ */ jsxs14("section", { className: ["mb-connected-lifecycle", className].filter(Boolean).join(" "), style: mindBillAppearanceStyle(appearance, style), children: [
|
|
5780
5890
|
/* @__PURE__ */ jsx14("style", { children: CONNECTED_LIFECYCLE_STYLES }),
|
|
5781
|
-
ribbonItems.length >= 2 ? /* @__PURE__ */ jsx14(BillSubmissionsRibbon, { items: ribbonItems, onSelect: () =>
|
|
5891
|
+
ribbonItems.length >= 2 ? /* @__PURE__ */ jsx14(BillSubmissionsRibbon, { items: ribbonItems, onSelect: (item) => {
|
|
5892
|
+
setSelectedSubmissionId(item.id);
|
|
5893
|
+
setTab("history");
|
|
5894
|
+
}, ...appearance ? { appearance } : {} }) : null,
|
|
5782
5895
|
data.lifecycle.state.toLowerCase() === "rejected" && data.rejection ? /* @__PURE__ */ jsx14(BillRejectionNotice, { rejection: data.rejection, submittedAt: data.lifecycle.submittedAt ?? null, ...appearance ? { appearance } : {} }) : /* @__PURE__ */ jsx14(BillLifecycleProgress, { state: data.lifecycle.state, nativeStatus: data.lifecycle.nativeStatus, submittedAt: data.lifecycle.submittedAt ?? null, agingDays: data.lifecycle.agingDays ?? null, ...appearance ? { appearance } : {} }),
|
|
5783
5896
|
/* @__PURE__ */ jsxs14("header", { className: "mb-lifecycle-head", children: [
|
|
5784
5897
|
/* @__PURE__ */ jsxs14("div", { children: [
|
|
@@ -5812,7 +5925,7 @@ function ConnectedBillLifecycle({ appearance, actorName, claimsAdministratorHint
|
|
|
5812
5925
|
] }, scenario.id)) }) : /* @__PURE__ */ jsx14("p", { className: "mb-lifecycle-simulator-idle", children: "No simulated payer transition is needed at this stage. Use the bill action below to continue." })
|
|
5813
5926
|
] }) : null,
|
|
5814
5927
|
/* @__PURE__ */ jsx14(BillReadOnlyForm, { data, onOpenAttachment: lifecycle.openAttachment, ...appearance ? { appearance } : {} })
|
|
5815
|
-
] }) : /* @__PURE__ */ jsx14("div", { className: "mb-lifecycle-tabpanel", role: "tabpanel", children: data.history?.length ? /* @__PURE__ */ jsx14(BillHistoryTable, { entries: data.history, onOpenDocument: lifecycle.openAttachment, ...appearance ? { appearance } : {} }) : /* @__PURE__ */ jsx14(BillActivityTimeline, { events: data.activity, ...appearance ? { appearance } : {} }) }),
|
|
5928
|
+
] }) : /* @__PURE__ */ jsx14("div", { className: "mb-lifecycle-tabpanel", role: "tabpanel", children: data.history?.length ? /* @__PURE__ */ jsx14(BillHistoryTable, { entries: data.history, ...selectedHistoryEntryId ? { selectedEntryId: selectedHistoryEntryId } : {}, onOpenDocument: lifecycle.openAttachment, ...appearance ? { appearance } : {} }) : /* @__PURE__ */ jsx14(BillActivityTimeline, { events: data.activity, ...appearance ? { appearance } : {} }) }),
|
|
5816
5929
|
viewEor || actions.length ? /* @__PURE__ */ jsxs14("aside", { className: "mb-lifecycle-actions-sheet", "aria-label": "Bill actions", children: [
|
|
5817
5930
|
viewEor && data.eors[0] ? /* @__PURE__ */ jsx14("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => void lifecycle.openEor(data.eors[0]).catch(() => void 0), children: viewEor.label }) : null,
|
|
5818
5931
|
actions.map((action) => /* @__PURE__ */ jsx14("button", { type: "button", className: action.primary ? "mb-lifecycle-button primary" : "mb-lifecycle-button secondary", onClick: () => {
|
|
@@ -5854,6 +5967,8 @@ function ConnectedBillLifecycle({ appearance, actorName, claimsAdministratorHint
|
|
|
5854
5967
|
attentionFields: correctionAttentionFields,
|
|
5855
5968
|
attentionMessage: correctionAttentionFields.length ? "The rejected response points to the highlighted fields. Confirm every required value before resubmitting." : "Confirm the bill information below before resubmitting.",
|
|
5856
5969
|
submitLabel: lifecycle.isMutating ? "Resubmitting\u2026" : "Resubmit bill",
|
|
5970
|
+
deliveryRoutePicker: "required",
|
|
5971
|
+
deliveryRouteDialogTitle: "Confirm corrected bill delivery",
|
|
5857
5972
|
heading: "Corrected bill information",
|
|
5858
5973
|
description: "The original submission stays unchanged. This form creates the next submission attempt.",
|
|
5859
5974
|
disabled: lifecycle.isMutating,
|
|
@@ -5888,6 +6003,8 @@ function ConnectedBillLifecycle({ appearance, actorName, claimsAdministratorHint
|
|
|
5888
6003
|
...claimsAdministratorSources ? { claimsAdministratorSources } : {},
|
|
5889
6004
|
attentionMessage: "Confirm every value carried over from the closed bill before submitting the new bill.",
|
|
5890
6005
|
submitLabel: lifecycle.isMutating ? "Submitting\u2026" : "Submit New Bill",
|
|
6006
|
+
deliveryRoutePicker: "required",
|
|
6007
|
+
deliveryRouteDialogTitle: "Confirm new bill delivery",
|
|
5891
6008
|
heading: "New bill information",
|
|
5892
6009
|
description: "The closed bill stays unchanged. This form submits a fresh bill linked to it.",
|
|
5893
6010
|
disabled: lifecycle.isMutating,
|
|
@@ -6060,9 +6177,9 @@ var CONNECTED_LIFECYCLE_STYLES = `
|
|
|
6060
6177
|
|
|
6061
6178
|
// src/index.tsx
|
|
6062
6179
|
function widget(tagName, props) {
|
|
6063
|
-
const ref =
|
|
6180
|
+
const ref = useRef7(null);
|
|
6064
6181
|
const { onMindBill, onMindBillError } = props;
|
|
6065
|
-
|
|
6182
|
+
useEffect11(() => {
|
|
6066
6183
|
const element = ref.current;
|
|
6067
6184
|
if (!element) return;
|
|
6068
6185
|
const handleEvent = (event) => onMindBill?.(event);
|