@mindbill/react 0.53.0 → 0.53.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.js CHANGED
@@ -6980,6 +6980,15 @@ function billTeamNotes(data) {
6980
6980
  const legacy = (data.history ?? []).filter((entry) => entry.kind === "note" && !canonicalIds.has(entry.id) && !notes.some((note) => entry.id.endsWith(`:ev-${note.id}`)));
6981
6981
  return [...legacy, ...notes.map((note) => ({ id: note.id, summary: note.body, actor: note.author, date: note.createdAt }))].sort((left, right) => right.date.localeCompare(left.date));
6982
6982
  }
6983
+ function billLifecycleSubmissionSelection(data, selectedSubmissionId) {
6984
+ const mappedRibbonItems = billSubmissionsRibbonFromHistory(data.history ?? [], data.attempts);
6985
+ const activeSubmissionId = (mappedRibbonItems.some((item) => item.id === selectedSubmissionId) ? selectedSubmissionId : null) ?? mappedRibbonItems.find((item) => item.active)?.id ?? mappedRibbonItems[mappedRibbonItems.length - 1]?.id;
6986
+ const ribbonItems = mappedRibbonItems.map((item) => ({ ...item, active: item.id === activeSubmissionId }));
6987
+ const selectedAttempt = data.attempts?.find((attempt) => attempt.id === activeSubmissionId);
6988
+ const historical = selectedAttempt ? !selectedAttempt.isCurrent : !!activeSubmissionId && activeSubmissionId !== mappedRibbonItems.at(-1)?.id;
6989
+ const selectedDetail = selectedAttempt ? data.submissionDetails?.find((item) => item.attemptId === activeSubmissionId && item.billId === selectedAttempt.billId) : null;
6990
+ return { activeSubmissionId, ribbonItems, selectedAttempt, historical, selectedDetail };
6991
+ }
6983
6992
  function reservePreviewWindow() {
6984
6993
  const preview = window.open("about:blank", "_blank");
6985
6994
  if (preview) {
@@ -7560,12 +7569,7 @@ function ConnectedBillLifecycle({ appearance, actorName, claimsAdministratorHint
7560
7569
  const viewEor = data.lifecycle.actions.find((action) => action.id === "view_eor" && action.enabled);
7561
7570
  const supportedActions = /* @__PURE__ */ new Set(["resubmit", "submit_new_bill", "second_review", "independent_bill_review", "post_payment", "close", "reopen", "send_duplicate", "report_bill_status"]);
7562
7571
  const actions = data.lifecycle.actions.filter((action) => action.enabled && supportedActions.has(action.id));
7563
- const mappedRibbonItems = data.history ? billSubmissionsRibbonFromHistory(data.history, data.attempts) : [];
7564
- const activeSubmissionId = (mappedRibbonItems.some((item) => item.id === selectedSubmissionId) ? selectedSubmissionId : null) ?? mappedRibbonItems.find((item) => item.active)?.id ?? mappedRibbonItems[mappedRibbonItems.length - 1]?.id;
7565
- const ribbonItems = mappedRibbonItems.map((item) => ({ ...item, active: item.id === activeSubmissionId }));
7566
- const selectedAttempt = data.attempts?.find((attempt) => attempt.id === activeSubmissionId);
7567
- const historical = selectedAttempt ? !selectedAttempt.isCurrent : !!activeSubmissionId && activeSubmissionId !== mappedRibbonItems.at(-1)?.id;
7568
- const selectedDetail = historical && selectedAttempt ? data.submissionDetails?.find((item) => item.attemptId === activeSubmissionId && item.billId === selectedAttempt.billId) : null;
7572
+ const { activeSubmissionId, ribbonItems, selectedAttempt, historical, selectedDetail } = billLifecycleSubmissionSelection(data, selectedSubmissionId);
7569
7573
  const activePanel = historical ? "" : panel;
7570
7574
  const showSandboxControls = shouldShowSandboxControls(data.environment, sandboxControls) && !historical;
7571
7575
  const simulations = showSandboxControls ? sandboxScenarios(data.lifecycle.state) : [];
@@ -7648,7 +7652,7 @@ function ConnectedBillLifecycle({ appearance, actorName, claimsAdministratorHint
7648
7652
  ] }) : null,
7649
7653
  historical ? /* @__PURE__ */ jsx21("p", { className: "mb-lifecycle-card", children: selectedDetail?.source === "submission_snapshot" ? "Saved as submitted. This previous submission is read-only; payment balances and current actions are shown on the current bill." : displayedData ? "Historical bill record. An exact as-submitted snapshot was not recorded for this older attempt; these are the stored bill values, not a guaranteed copy of the original packet." : "Detailed values were not saved for this historical submission. Select the current submission to see the current bill. We will not substitute current data for this older attempt." }) : null,
7650
7654
  displayedData ? /* @__PURE__ */ jsx21(BillReadOnlyForm, { data: displayedData, ...!historical ? { onOpenAttachment: lifecycle.openAttachment } : {}, ...appearance ? { appearance } : {} }, activeSubmissionId) : null,
7651
- historical && selectedAttempt ? /* @__PURE__ */ jsxs21("section", { className: "mb-lifecycle-card", "aria-label": "Retained submission files", children: [
7655
+ selectedAttempt ? /* @__PURE__ */ jsxs21("section", { className: "mb-lifecycle-card", "aria-label": "Retained submission files", children: [
7652
7656
  /* @__PURE__ */ jsx21("h3", { children: "Retained submission files" }),
7653
7657
  /* @__PURE__ */ jsx21("p", { children: "Exact files saved for this submission. These downloads do not include a regenerated current bill or a later EOR." }),
7654
7658
  selectedDetail?.artifacts?.length ? selectedDetail.artifacts.map((artifact) => /* @__PURE__ */ jsxs21("button", { type: "button", className: "mb-lifecycle-button secondary", onClick: () => void lifecycle.downloadSubmissionArtifact(selectedAttempt.id, artifact.id, artifact.label).catch(() => void 0), children: [