@mindbill/react 0.77.35 → 0.77.36

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
@@ -1107,6 +1107,11 @@ type RfaDashboardProps = OrganizationClientOptions & TreatmentDraftAppearance &
1107
1107
  /** Host in-place editors for the selected practice or location (official form). */
1108
1108
  onEditPractice?: (practiceId: string) => void;
1109
1109
  onEditLocation?: (locationId: string | null, practiceId: string) => void;
1110
+ /** Practices or locations the host just saved; shown at once, ahead of the next profile reload. Pass a new object per save. */
1111
+ savedProfileChanges?: {
1112
+ billingProviders?: OrganizationProfileData["billingProviders"];
1113
+ locations?: OrganizationProfileData["locations"];
1114
+ };
1110
1115
  managePracticeHref?: string;
1111
1116
  manageLocationsHref?: string;
1112
1117
  /** Opens the actual saved packet. Creation first saves and attaches files, then selects its detail view. */
package/dist/index.js CHANGED
@@ -10422,6 +10422,7 @@ function TreatmentDraftShell({ title, description, children, hideHeading = false
10422
10422
  .mbtd form.mbrfa-official .mbrfa-request-types input[type=radio]:not(:checked){border-color:var(--mb-muted)}
10423
10423
  .mbtd form.mbrfa-official .mbrfa-request-details .mbrfa-check{min-height:32px;font-size:13px}
10424
10424
  .mbtd form.mbrfa-official .mbrfa-section-actions{margin-top:16px;padding-top:12px;border-top:1px dashed var(--mb-border)}
10425
+ .mbtd .mbrfa-section-actions>button{min-height:36px;padding:7px 14px;font-size:13px;font-weight:600}
10425
10426
  .mbtd form.mbrfa-official>div:has(>button:only-child)>button{border-style:dashed;color:var(--mb-accent);font-weight:500}
10426
10427
  .mbtd form.mbrfa-official>.mbtd-actions:last-child{position:sticky;bottom:12px;z-index:5;justify-content:flex-end;flex-direction:row-reverse;margin-top:0;padding:10px 14px;border:1px solid var(--mb-border);border-radius:var(--mb-radius);background:color-mix(in srgb,var(--mb-surface) 92%,transparent);backdrop-filter:blur(6px);box-shadow:0 6px 20px #00000014}
10427
10428
  .mbtd form.mbrfa-official>.mbtd-actions:last-child>[role=status]{margin-right:auto;order:9}
@@ -12596,6 +12597,15 @@ function RfaEmployeeFields({ name, dateOfInjury, claimNumber, details }) {
12596
12597
  /* @__PURE__ */ jsx37(RfaSavedField, { span: 3, label: "Employer", value: details?.employer })
12597
12598
  ] });
12598
12599
  }
12600
+ function formatRfaPhone(value) {
12601
+ const raw = value ?? "";
12602
+ if (/[^\d\s().+-]/.test(raw)) return raw;
12603
+ let digits = raw.replace(/\D/g, "");
12604
+ if (digits.length === 11 && digits.startsWith("1")) digits = digits.slice(1);
12605
+ if (digits.length > 10) return raw;
12606
+ if (digits.length < 4) return digits;
12607
+ return digits.length < 7 ? `(${digits.slice(0, 3)}) ${digits.slice(3)}` : `(${digits.slice(0, 3)}) ${digits.slice(3, 6)}-${digits.slice(6)}`;
12608
+ }
12599
12609
  var contactRows = [
12600
12610
  ["address", "Address", 500, 3],
12601
12611
  ["city", "City", 100, 2],
@@ -12605,14 +12615,15 @@ var contactRows = [
12605
12615
  ["fax", "Fax Number", 30, 2]
12606
12616
  ];
12607
12617
  function RfaOfficialContactFields({ nameLabel, value, onChange, before, beforeEmail, faxHint, editable = true }) {
12618
+ const dial = (key2) => key2 === "phone" || key2 === "fax";
12608
12619
  const hint = (key2) => key2 === "fax" && faxHint && !value?.fax?.trim() ? /* @__PURE__ */ jsx37("small", { className: "mbrfa-field-hint", children: faxHint }) : null;
12609
12620
  const field = (key2, label5, max, span) => editable ? /* @__PURE__ */ jsxs35("label", { className: `mbrfa-s${span}`, children: [
12610
12621
  label5,
12611
- /* @__PURE__ */ jsx37("input", { type: key2 === "email" ? "email" : key2 === "phone" || key2 === "fax" ? "tel" : "text", maxLength: max, value: value?.[key2] ?? "", onChange: (event) => onChange({ ...value, [key2]: event.target.value }) }),
12622
+ /* @__PURE__ */ jsx37("input", { type: key2 === "email" ? "email" : key2 === "phone" || key2 === "fax" ? "tel" : "text", maxLength: max, value: dial(key2) ? formatRfaPhone(value?.[key2]) : value?.[key2] ?? "", onChange: (event) => onChange({ ...value, [key2]: dial(key2) ? formatRfaPhone(event.target.value) : event.target.value }) }),
12612
12623
  hint(key2)
12613
12624
  ] }, key2) : /* @__PURE__ */ jsxs35("div", { className: `mbrfa-s${span} mbrfa-saved`, children: [
12614
12625
  /* @__PURE__ */ jsx37("span", { children: label5 }),
12615
- /* @__PURE__ */ jsx37("strong", { children: value?.[key2]?.trim() || "\u2014" }),
12626
+ /* @__PURE__ */ jsx37("strong", { children: (dial(key2) ? formatRfaPhone(value?.[key2]) : value?.[key2])?.trim() || "\u2014" }),
12616
12627
  hint(key2)
12617
12628
  ] }, key2);
12618
12629
  return /* @__PURE__ */ jsxs35("div", { className: "mbrfa-form-grid", children: [
@@ -12626,8 +12637,8 @@ function RfaOfficialContactFields({ nameLabel, value, onChange, before, beforeEm
12626
12637
  }
12627
12638
  function RfaManualToggle({ manual, onChange, disabled }) {
12628
12639
  return /* @__PURE__ */ jsxs35("div", { className: "mbrfa-section-actions", children: [
12629
- /* @__PURE__ */ jsx37("button", { type: "button", className: "mbrfa-link", disabled, "aria-pressed": manual, onClick: () => onChange(!manual), children: manual ? "Done editing" : "Edit manually" }),
12630
- manual ? /* @__PURE__ */ jsx37("span", { children: "These values are saved on this request only." }) : null
12640
+ /* @__PURE__ */ jsx37("button", { type: "button", className: manual ? "mbtd-primary" : void 0, disabled, "aria-pressed": manual, onClick: () => onChange(!manual), children: manual ? "Save" : "Edit manually" }),
12641
+ manual ? /* @__PURE__ */ jsx37("span", { children: "Applies to this request only. The saved record is not changed." }) : null
12631
12642
  ] });
12632
12643
  }
12633
12644
  function useRfaFormDetails(client, claimId, renderingProviderId, enabled) {
@@ -13141,8 +13152,7 @@ function RfaDraftForm({ initialDraft, identity, officialForm = false, formDetail
13141
13152
  /* @__PURE__ */ jsx41(RfaSavedField, { span: 3, label: "NPI Number", value: draft2.providerNpi })
13142
13153
  ] })
13143
13154
  }
13144
- ) }),
13145
- /* @__PURE__ */ jsx41(RfaManualToggle, { manual: practiceManual, onChange: setPracticeManual, disabled: locked })
13155
+ ) })
13146
13156
  ] }),
13147
13157
  /* @__PURE__ */ jsx41(RfaContactPicker, { officialForm: true, ...searchClaimsAdministrators ? { searchClaimsAdministrators } : {}, ...getClaimsAdministratorDirectory ? { getClaimsAdministratorDirectory } : {}, ...draft2.claimsAdminId ? { administratorId: draft2.claimsAdminId } : {}, ...draft2.claimNumber ? { claimNumber: draft2.claimNumber } : {}, contextKey: draft2.claimId, value: draft2.authorizationContact, disabled: locked, onChange: (id, authorizationContact) => {
13148
13158
  setAdministratorOverride({ id });
@@ -14265,7 +14275,7 @@ function RfaDashboard({ sessionEndpoint, getSession, apiBaseUrl, fetch: fetchOve
14265
14275
  const identity = useMemo12(() => ({ client, signatureClient, key: key() }), [client, signatureClient]);
14266
14276
  return /* @__PURE__ */ jsx45(RfaDashboardContent, { ...props, ...patientId ? { patientId } : {}, ...claimId ? { claimId } : {}, ...renderingProviderId ? { renderingProviderId } : {}, client, signatureClient, options }, `${identity.key}:${patientId ?? ""}:${claimId ?? ""}:${renderingProviderId ?? ""}`);
14267
14277
  }
14268
- function RfaDashboardContent({ client, signatureClient, options, patientId, claimId, renderingProviderId, initialDraft, initialView = "overview", initialOverviewView, initialStatus = "", initialAgingBucket = "", taskPresentation, taskQuery: taskQuery2, renderTaskIdentity, navigation, permissions = [], canCreateClaim = false, renderClaimSelector, renderProviderSelector, officialForm = false, managePracticeHref, onEditPractice, onEditLocation, manageLocationsHref, onPreviewRequest, canManageProviderSignatures = false, environment = "sandbox", actorReference, onCreated, onContinue, selectedRfaId, selectedTreatmentId, selectedResponseDocumentId: controlledResponseDocumentId, onSelectRfa, getRfaHref, getPatientHref, getClaimHref, getProviderHref, formPreviewUrl, hideBackButton = false, hideHeading = false, layout = "classic", ...appearance }) {
14278
+ function RfaDashboardContent({ client, signatureClient, options, patientId, claimId, renderingProviderId, initialDraft, initialView = "overview", initialOverviewView, initialStatus = "", initialAgingBucket = "", taskPresentation, taskQuery: taskQuery2, renderTaskIdentity, navigation, permissions = [], canCreateClaim = false, renderClaimSelector, renderProviderSelector, officialForm = false, managePracticeHref, onEditPractice, onEditLocation, savedProfileChanges, manageLocationsHref, onPreviewRequest, canManageProviderSignatures = false, environment = "sandbox", actorReference, onCreated, onContinue, selectedRfaId, selectedTreatmentId, selectedResponseDocumentId: controlledResponseDocumentId, onSelectRfa, getRfaHref, getPatientHref, getClaimHref, getProviderHref, formPreviewUrl, hideBackButton = false, hideHeading = false, layout = "classic", ...appearance }) {
14269
14279
  const active = useRef22(true);
14270
14280
  useEffect26(() => {
14271
14281
  active.current = true;
@@ -14275,6 +14285,11 @@ function RfaDashboardContent({ client, signatureClient, options, patientId, clai
14275
14285
  }, []);
14276
14286
  const references = useMemo12(() => createBillReferenceClient2(options), [options]);
14277
14287
  const [profile, setProfile] = useState30();
14288
+ useEffect26(() => {
14289
+ if (!savedProfileChanges) return;
14290
+ const merge = (current, saved) => saved?.length ? [...current.map((item) => saved.find((next) => next.id === item.id) ?? item), ...saved.filter((next) => !current.some((item) => item.id === next.id))] : current;
14291
+ setProfile((current) => current ? { ...current, billingProviders: merge(current.billingProviders, savedProfileChanges.billingProviders), locations: merge(current.locations, savedProfileChanges.locations) } : current);
14292
+ }, [savedProfileChanges]);
14278
14293
  const draftFormProps = { officialForm, ...onEditPractice ? { onEditPractice } : {}, ...onEditLocation ? { onEditLocation } : {}, ...managePracticeHref ? { managePracticeHref } : {}, ...manageLocationsHref ? { manageLocationsHref } : {}, onRefreshProfile: async () => {
14279
14294
  const next = await createOrganizationClient4(options).getBillingProfile();
14280
14295
  if (active.current) setProfile(next);