@mindbill/react 0.77.30 → 0.77.31

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
@@ -10312,7 +10312,7 @@ function TreatmentDraftShell({ title, description, children, hideHeading = false
10312
10312
  .mbtd .mbrfa-pickers[data-columns="1"]{grid-template-columns:minmax(0,1fr)}.mbtd .mbrfa-pickers[data-columns="2"]{grid-template-columns:repeat(2,minmax(0,1fr))}
10313
10313
  .mbtd .mbrfa-picker{display:grid;gap:5px;min-width:0;font-size:13px;align-content:start}.mbtd .mbrfa-picker>span:first-child{font-weight:600}
10314
10314
  .mbtd .mbrfa-form-grid .mbrfa-picker{padding-bottom:2px}
10315
- .mbtd .mbrfa-picker a,.mbtd .mbrfa-picker-links{font-size:12px}.mbtd .mbrfa-picker-links{display:flex;gap:12px;flex-wrap:wrap;align-items:center}
10315
+ .mbtd .mbrfa-picker a,.mbtd .mbrfa-picker-links{font-size:12px}.mbtd .mbrfa-picker-links{display:flex;gap:12px;flex-wrap:wrap;align-items:center;min-height:18px}
10316
10316
  .mbtd .mbrfa-picker p,.mbtd .mbrfa-guidance p{margin:0;font-size:12px}.mbtd .mbrfa-guidance{display:grid;gap:4px}
10317
10317
  .mbtd button.mbrfa-link.mbrfa-link{border:0;background:none;padding:0;min-height:0;color:var(--mb-accent);font-size:12px;text-decoration:underline}
10318
10318
  .mbtd fieldset.mbrfa-plain.mbrfa-plain{border:0;padding:0;margin:0;background:none;border-radius:0;min-width:0}
@@ -12351,14 +12351,17 @@ function RfaIdentitySelect({ label: label5, placeholder, searchPlaceholder, quer
12351
12351
  trigger.current?.focus();
12352
12352
  }
12353
12353
  }, children: [
12354
- /* @__PURE__ */ jsx35("style", { children: `.mbrfa-identity-select{position:relative;min-width:0}.mbrfa-identity-select>button{display:flex;justify-content:space-between;align-items:center;width:100%;text-align:left;gap:12px;min-height:44px}.mbrfa-identity-select small{display:block;opacity:.75;font-size:12px;margin-top:3px}.mbrfa-identity-menu{position:absolute;z-index:40;top:calc(100% + 6px);left:0;right:0;padding:10px;background:var(--mbtd-surface,#fff);color:inherit;border:1px solid var(--mbtd-border,#d6d3cc);border-radius:8px;box-shadow:0 8px 24px #0002}.mbrfa-identity-menu input{width:100%;box-sizing:border-box}.mbrfa-identity-options{max-height:280px;overflow:auto;margin-top:6px}.mbrfa-identity-options button{display:block;width:100%;text-align:left;padding:10px 12px;border:0;border-radius:4px;min-height:44px}.mbrfa-identity-options button:hover,.mbrfa-identity-options button[data-active=true]{background:#1c595918}.mbrfa-identity-menu p{padding:8px;margin:0}` }),
12354
+ /* @__PURE__ */ jsx35("style", { children: `.mbrfa-identity-select{position:relative;min-width:0}.mbrfa-identity-select>button{display:flex;justify-content:space-between;align-items:center;width:100%;text-align:left;gap:12px;min-height:44px}.mbrfa-identity-select small{display:block;opacity:.75;font-size:12px;margin-top:3px}.mbrfa-identity-select>button{height:44px}.mbrfa-identity-value{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.mbrfa-identity-value small{display:inline;margin:0}.mbrfa-identity-menu{position:absolute;z-index:40;top:calc(100% + 6px);left:0;right:0;padding:10px;background:var(--mbtd-surface,#fff);color:inherit;border:1px solid var(--mbtd-border,#d6d3cc);border-radius:8px;box-shadow:0 8px 24px #0002}.mbrfa-identity-menu input{width:100%;box-sizing:border-box}.mbrfa-identity-options{max-height:280px;overflow:auto;margin-top:6px}.mbrfa-identity-options button{display:block;width:100%;text-align:left;padding:10px 12px;border:0;border-radius:4px;min-height:44px}.mbrfa-identity-options button:hover,.mbrfa-identity-options button[data-active=true]{background:#1c595918}.mbrfa-identity-menu p{padding:8px;margin:0}` }),
12355
12355
  /* @__PURE__ */ jsxs33("button", { ref: trigger, type: "button", "aria-label": label5, "aria-haspopup": "listbox", "aria-expanded": open, "aria-controls": open ? `${id}-list` : void 0, disabled, onClick: () => {
12356
12356
  setOpen(!open);
12357
12357
  setActive(0);
12358
12358
  }, children: [
12359
- /* @__PURE__ */ jsx35("span", { children: selected ? /* @__PURE__ */ jsxs33(Fragment20, { children: [
12359
+ /* @__PURE__ */ jsx35("span", { className: "mbrfa-identity-value", children: selected ? /* @__PURE__ */ jsxs33(Fragment20, { children: [
12360
12360
  selected.label,
12361
- selected.detail ? /* @__PURE__ */ jsx35("small", { children: selected.detail }) : null
12361
+ selected.detail ? /* @__PURE__ */ jsxs33("small", { children: [
12362
+ " \xB7 ",
12363
+ selected.detail
12364
+ ] }) : null
12362
12365
  ] }) : placeholder }),
12363
12366
  /* @__PURE__ */ jsx35("span", { "aria-hidden": "true", children: "\u2304" })
12364
12367
  ] }),
@@ -12588,15 +12591,13 @@ function useRfaFormDetails(client, claimId, renderingProviderId, enabled) {
12588
12591
 
12589
12592
  // src/rfa-practice-picker.tsx
12590
12593
  import { Fragment as Fragment21, jsx as jsx38, jsxs as jsxs36 } from "react/jsx-runtime";
12591
- function RfaPracticePicker({ profile, value, onChange, managePracticeHref, manageLocationsHref, onRefreshProfile }) {
12594
+ function RfaPracticePicker({ profile, value, onChange, managePracticeHref, manageLocationsHref }) {
12592
12595
  const practices = profile?.billingProviders ?? [];
12593
12596
  const [practice, setPractice] = useState23(() => practices.find((item) => item.name === value?.name)?.id ?? "");
12594
12597
  const [location, setLocation] = useState23(() => practice ? (profile?.locations ?? []).find((item) => item.active !== false && item.street === value?.address && (!item.billingProviderId || item.billingProviderId === practice))?.id ?? "" : "");
12595
12598
  const located = (chosen, phone) => ({ address: chosen.street, city: chosen.city, state: chosen.state, zip: chosen.zip, ...chosen.contact?.name ? { contactName: chosen.contact.name } : {}, ...chosen.contact?.phone || phone ? { phone: chosen.contact?.phone || phone } : {}, ...chosen.contact?.fax ? { fax: chosen.contact.fax } : {}, ...chosen.contact?.email ? { email: chosen.contact.email } : {} });
12596
12599
  const [practiceQuery, setPracticeQuery] = useState23("");
12597
12600
  const [locationQuery, setLocationQuery] = useState23("");
12598
- const [refreshing, setRefreshing] = useState23(false);
12599
- const [error, setError] = useState23("");
12600
12601
  const locations = (profile?.locations ?? []).filter((item) => item.active !== false && (item.billingProviderId ? item.billingProviderId === practice : practices.length <= 1));
12601
12602
  return /* @__PURE__ */ jsxs36(Fragment21, { children: [
12602
12603
  /* @__PURE__ */ jsxs36(RfaPicker, { label: "Practice", children: [
@@ -12611,7 +12612,7 @@ function RfaPracticePicker({ profile, value, onChange, managePracticeHref, manag
12611
12612
  setLocation(chosen?.id ?? "");
12612
12613
  onChange({ ...value, name: provider.name, phone: provider.phone ?? "", address: provider.billingStreet ?? "", city: provider.billingCity ?? "", state: provider.billingState ?? "", zip: provider.billingZip ?? "", ...chosen ? located(chosen, provider.phone) : {} });
12613
12614
  } }),
12614
- managePracticeHref ? /* @__PURE__ */ jsx38("a", { href: managePracticeHref, target: "_blank", rel: "noopener noreferrer", children: "Add / manage practices" }) : null
12615
+ /* @__PURE__ */ jsx38("span", { className: "mbrfa-picker-links", children: managePracticeHref ? /* @__PURE__ */ jsx38("a", { href: managePracticeHref, target: "_blank", rel: "noopener noreferrer", children: "Add / manage practices" }) : null })
12615
12616
  ] }),
12616
12617
  /* @__PURE__ */ jsxs36(RfaPicker, { label: "Practice location", children: [
12617
12618
  /* @__PURE__ */ jsx38(RfaIdentitySelect, { label: "Practice location", placeholder: practice ? "Choose a location" : "Choose a practice first", searchPlaceholder: "Search locations", query: locationQuery, onSearch: setLocationQuery, searchable: true, disabled: !practice, value: location, options: locations.filter((item) => item.id === location || item.name.toLowerCase().includes(locationQuery.toLowerCase())).map((item) => ({ id: item.id, label: item.name, detail: `${item.street}, ${item.city}` })), onSelect: (id) => {
@@ -12621,15 +12622,7 @@ function RfaPracticePicker({ profile, value, onChange, managePracticeHref, manag
12621
12622
  setLocationQuery("");
12622
12623
  onChange({ ...value, ...located(chosen, practices.find((item) => item.id === practice)?.phone) });
12623
12624
  } }),
12624
- /* @__PURE__ */ jsxs36("span", { className: "mbrfa-picker-links", children: [
12625
- manageLocationsHref ? /* @__PURE__ */ jsx38("a", { href: manageLocationsHref, target: "_blank", rel: "noopener noreferrer", children: "Add / manage locations" }) : null,
12626
- onRefreshProfile ? /* @__PURE__ */ jsx38("button", { type: "button", className: "mbrfa-link", disabled: refreshing, onClick: () => {
12627
- setRefreshing(true);
12628
- setError("");
12629
- void onRefreshProfile().catch(() => setError("Could not refresh saved practices. Try again.")).finally(() => setRefreshing(false));
12630
- }, children: refreshing ? "Refreshing\u2026" : "Refresh saved choices" }) : null
12631
- ] }),
12632
- error ? /* @__PURE__ */ jsx38("p", { role: "alert", children: error }) : null
12625
+ /* @__PURE__ */ jsx38("span", { className: "mbrfa-picker-links", children: manageLocationsHref ? /* @__PURE__ */ jsx38("a", { href: manageLocationsHref, target: "_blank", rel: "noopener noreferrer", children: "Add / manage locations" }) : null })
12633
12626
  ] })
12634
12627
  ] });
12635
12628
  }
@@ -12908,6 +12901,21 @@ function RfaDraftForm({ initialDraft, identity, officialForm = false, formDetail
12908
12901
  filledEmail.current = physicianEmail;
12909
12902
  setDraft((current) => current.requestingPractice?.email && current.requestingPractice.email !== previous ? current : { ...current, requestingPractice: { ...current.requestingPractice, email: physicianEmail } });
12910
12903
  }, [officialForm, physicianEmail]);
12904
+ useEffect22(() => {
12905
+ if (!officialForm || !onRefreshProfile) return;
12906
+ let last = Date.now();
12907
+ const refresh = () => {
12908
+ if (document.visibilityState === "hidden" || Date.now() - last < 2e3) return;
12909
+ last = Date.now();
12910
+ void onRefreshProfile().catch(() => void 0);
12911
+ };
12912
+ window.addEventListener("focus", refresh);
12913
+ document.addEventListener("visibilitychange", refresh);
12914
+ return () => {
12915
+ window.removeEventListener("focus", refresh);
12916
+ document.removeEventListener("visibilitychange", refresh);
12917
+ };
12918
+ }, [officialForm, onRefreshProfile]);
12911
12919
  const [administratorOverride, setAdministratorOverride] = useState26(null);
12912
12920
  const identityKey = `${identity?.claimId ?? ""}:${identity?.claimsAdminId ?? ""}`;
12913
12921
  const previousClaim = useRef18(identityKey);
@@ -13026,7 +13034,7 @@ function RfaDraftForm({ initialDraft, identity, officialForm = false, formDetail
13026
13034
  /* @__PURE__ */ jsx41("legend", { children: "Requesting Physician Information" }),
13027
13035
  /* @__PURE__ */ jsxs39("div", { className: "mbrfa-pickers", "data-columns": selectors?.physician ? 3 : 2, children: [
13028
13036
  selectors?.physician ? /* @__PURE__ */ jsx41(RfaPicker, { label: "Requesting physician", children: selectors.physician }) : null,
13029
- /* @__PURE__ */ jsx41(RfaPracticePicker, { profile: organizationProfile, value: draft2.requestingPractice, onChange: (requestingPractice) => update({ requestingPractice }), ...managePracticeHref ? { managePracticeHref } : {}, ...manageLocationsHref ? { manageLocationsHref } : {}, ...onRefreshProfile ? { onRefreshProfile } : {} })
13037
+ /* @__PURE__ */ jsx41(RfaPracticePicker, { profile: organizationProfile, value: draft2.requestingPractice, onChange: (requestingPractice) => update({ requestingPractice }), ...managePracticeHref ? { managePracticeHref } : {}, ...manageLocationsHref ? { manageLocationsHref } : {} })
13030
13038
  ] }),
13031
13039
  /* @__PURE__ */ jsx41("fieldset", { className: "mbrfa-plain", disabled: locked, children: /* @__PURE__ */ jsx41(
13032
13040
  RfaOfficialContactFields,
@@ -13312,7 +13320,6 @@ function SavedIdentityForm({ client, claimId, renderingProviderId, onSave, canCr
13312
13320
  active = false;
13313
13321
  };
13314
13322
  }, [client, query, effectiveClaimId, effectiveProviderId, renderingProviderId, reload]);
13315
- const refreshProfile = draftFormProps?.officialForm ? draftFormProps.onRefreshProfile : void 0;
13316
13323
  const refreshOnReturn = !!draftFormProps?.officialForm;
13317
13324
  useEffect23(() => {
13318
13325
  if (!refreshOnReturn) return;
@@ -13321,7 +13328,6 @@ function SavedIdentityForm({ client, claimId, renderingProviderId, onSave, canCr
13321
13328
  if (document.visibilityState === "hidden" || Date.now() - last < 2e3) return;
13322
13329
  last = Date.now();
13323
13330
  setReload((value) => value + 1);
13324
- void refreshProfile?.().catch(() => void 0);
13325
13331
  };
13326
13332
  window.addEventListener("focus", refresh);
13327
13333
  document.addEventListener("visibilitychange", refresh);
@@ -13329,7 +13335,7 @@ function SavedIdentityForm({ client, claimId, renderingProviderId, onSave, canCr
13329
13335
  window.removeEventListener("focus", refresh);
13330
13336
  document.removeEventListener("visibilitychange", refresh);
13331
13337
  };
13332
- }, [refreshOnReturn, refreshProfile]);
13338
+ }, [refreshOnReturn]);
13333
13339
  const claim = context?.claims.find((value) => value.claimId === selectedClaim);
13334
13340
  const provider = context?.renderingProviders.find((value) => value.id === selectedProvider);
13335
13341
  const locked = disabled || loading;