@mindbill/react 0.77.26 → 0.77.27

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,