@mindbill/react 0.77.26 → 0.77.28

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
@@ -12592,6 +12592,7 @@ function RfaPracticePicker({ profile, value, onChange, managePracticeHref, manag
12592
12592
  const practices = profile?.billingProviders ?? [];
12593
12593
  const [practice, setPractice] = useState23(() => practices.find((item) => item.name === value?.name)?.id ?? "");
12594
12594
  const [location, setLocation] = useState23(() => practice ? (profile?.locations ?? []).find((item) => item.active !== false && item.street === value?.address && (!item.billingProviderId || item.billingProviderId === practice))?.id ?? "" : "");
12595
+ 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 } : {} });
12595
12596
  const [practiceQuery, setPracticeQuery] = useState23("");
12596
12597
  const [locationQuery, setLocationQuery] = useState23("");
12597
12598
  const [refreshing, setRefreshing] = useState23(false);
@@ -12608,7 +12609,7 @@ function RfaPracticePicker({ profile, value, onChange, managePracticeHref, manag
12608
12609
  const primary = matching.filter((item) => item.isPrimary);
12609
12610
  const chosen = matching.length === 1 ? matching[0] : primary.length === 1 ? primary[0] : void 0;
12610
12611
  setLocation(chosen?.id ?? "");
12611
- onChange({ ...value, name: provider.name, phone: provider.phone ?? "", address: chosen?.street ?? provider.billingStreet ?? "", city: chosen?.city ?? provider.billingCity ?? "", state: chosen?.state ?? provider.billingState ?? "", zip: chosen?.zip ?? provider.billingZip ?? "" });
12612
+ 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) : {} });
12612
12613
  } }),
12613
12614
  managePracticeHref ? /* @__PURE__ */ jsx38("a", { href: managePracticeHref, target: "_blank", rel: "noopener noreferrer", children: "Add / manage practices" }) : null
12614
12615
  ] }),
@@ -12618,7 +12619,7 @@ function RfaPracticePicker({ profile, value, onChange, managePracticeHref, manag
12618
12619
  if (!chosen) return;
12619
12620
  setLocation(id);
12620
12621
  setLocationQuery("");
12621
- onChange({ ...value, address: chosen.street, city: chosen.city, state: chosen.state, zip: chosen.zip });
12622
+ onChange({ ...value, ...located(chosen, practices.find((item) => item.id === practice)?.phone) });
12622
12623
  } }),
12623
12624
  /* @__PURE__ */ jsxs36("span", { className: "mbrfa-picker-links", children: [
12624
12625
  manageLocationsHref ? /* @__PURE__ */ jsx38("a", { href: manageLocationsHref, target: "_blank", rel: "noopener noreferrer", children: "Add / manage locations" }) : null,
@@ -13316,6 +13317,24 @@ function SavedIdentityForm({ client, claimId, renderingProviderId, onSave, canCr
13316
13317
  active = false;
13317
13318
  };
13318
13319
  }, [client, query, effectiveClaimId, effectiveProviderId, renderingProviderId, reload]);
13320
+ const refreshProfile = draftFormProps?.officialForm ? draftFormProps.onRefreshProfile : void 0;
13321
+ const refreshOnReturn = !!draftFormProps?.officialForm;
13322
+ useEffect23(() => {
13323
+ if (!refreshOnReturn) return;
13324
+ let last = Date.now();
13325
+ const refresh = () => {
13326
+ if (document.visibilityState === "hidden" || Date.now() - last < 2e3) return;
13327
+ last = Date.now();
13328
+ setReload((value) => value + 1);
13329
+ void refreshProfile?.().catch(() => void 0);
13330
+ };
13331
+ window.addEventListener("focus", refresh);
13332
+ document.addEventListener("visibilitychange", refresh);
13333
+ return () => {
13334
+ window.removeEventListener("focus", refresh);
13335
+ document.removeEventListener("visibilitychange", refresh);
13336
+ };
13337
+ }, [refreshOnReturn, refreshProfile]);
13319
13338
  const claim = context?.claims.find((value) => value.claimId === selectedClaim);
13320
13339
  const provider = context?.renderingProviders.find((value) => value.id === selectedProvider);
13321
13340
  const locked = disabled || loading;
@@ -13486,7 +13505,7 @@ function SavedIdentityForm({ client, claimId, renderingProviderId, onSave, canCr
13486
13505
  providerFields
13487
13506
  ] })
13488
13507
  ] }),
13489
- loading ? /* @__PURE__ */ jsx42("p", { role: "status", children: "Loading saved claims and providers\u2026" }) : null,
13508
+ loading && !(official && context) ? /* @__PURE__ */ jsx42("p", { role: "status", children: "Loading saved claims and providers\u2026" }) : null,
13490
13509
  error ? /* @__PURE__ */ jsx42("p", { role: "alert", children: error }) : null,
13491
13510
  claim && provider && !official ? /* @__PURE__ */ jsxs40("p", { className: "mbtd-note", children: [
13492
13511
  "Create a request for ",