@mindbill/react 0.77.34 → 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
@@ -10418,17 +10418,15 @@ function TreatmentDraftShell({ title, description, children, hideHeading = false
10418
10418
  .mbtd form.mbrfa-official .mbrfa-form-grid>label>:is(input,textarea){color:var(--mb-text)}
10419
10419
  .mbtd form.mbrfa-official .mbrfa-saved>strong{font-size:14px;font-weight:500;color:var(--mb-text)}
10420
10420
  .mbtd form.mbrfa-official .mbrfa-request-details>.mbtd-grid{gap:4px}
10421
- .mbtd form.mbrfa-official .mbrfa-request-types{display:inline-grid;grid-auto-flow:column;grid-template-columns:none;gap:0;padding:3px;margin-bottom:10px;border:1px solid var(--mb-border);border-radius:calc(var(--mb-control-radius) + 3px);background:var(--mb-soft);justify-self:start;width:fit-content;max-width:100%}
10422
- .mbtd form.mbrfa-official .mbrfa-request-types .mbrfa-check{min-height:34px;padding:6px 16px;border-radius:var(--mb-control-radius);color:var(--mb-muted);font-size:13px}
10423
- .mbtd form.mbrfa-official .mbrfa-request-types .mbrfa-check:has(input:checked){background:var(--mb-surface);color:var(--mb-text);box-shadow:0 1px 2px #00000014}
10424
- .mbtd form.mbrfa-official .mbrfa-request-types input[type=radio]{position:absolute;opacity:0;width:1px;height:1px}
10425
- .mbtd form.mbrfa-official .mbrfa-request-types .mbrfa-check:has(input:focus-visible){outline:2px solid var(--mb-accent);outline-offset:2px}
10421
+ .mbtd form.mbrfa-official .mbrfa-request-types{display:flex;flex-wrap:wrap;gap:8px 28px;padding-bottom:0;margin-bottom:6px;border-bottom:0}
10422
+ .mbtd form.mbrfa-official .mbrfa-request-types input[type=radio]:not(:checked){border-color:var(--mb-muted)}
10426
10423
  .mbtd form.mbrfa-official .mbrfa-request-details .mbrfa-check{min-height:32px;font-size:13px}
10427
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}
10428
10426
  .mbtd form.mbrfa-official>div:has(>button:only-child)>button{border-style:dashed;color:var(--mb-accent);font-weight:500}
10429
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}
10430
10428
  .mbtd form.mbrfa-official>.mbtd-actions:last-child>[role=status]{margin-right:auto;order:9}
10431
- @media(max-width:760px){.mbtd form.mbrfa-official>.mbtd-actions:last-child{position:static;flex-direction:row}.mbtd form.mbrfa-official .mbrfa-request-types{grid-auto-flow:row;width:100%}}
10429
+ @media(max-width:760px){.mbtd form.mbrfa-official>.mbtd-actions:last-child{position:static;flex-direction:row}}
10432
10430
  @media(max-width:760px){.mbtd .mbrfa-pickers,.mbtd .mbrfa-pickers[data-columns="2"]{grid-template-columns:minmax(0,1fr)}.mbtd .mbrfa-form-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.mbtd .mbrfa-form-grid>*{grid-column:1/-1}.mbtd .mbrfa-form-grid>.mbrfa-s1,.mbtd .mbrfa-form-grid>.mbrfa-s2{grid-column:span 1}}
10433
10431
  @media(max-width:640px){.mbtd .mbrfa-request-types{grid-template-columns:1fr;gap:4px}}
10434
10432
  @media(forced-colors:active){.mbtd .mbrfa-request-types input[type=radio]{appearance:auto}.mbtd .mbrfa-request-types input[type=radio]::after{display:none}}
@@ -12599,6 +12597,15 @@ function RfaEmployeeFields({ name, dateOfInjury, claimNumber, details }) {
12599
12597
  /* @__PURE__ */ jsx37(RfaSavedField, { span: 3, label: "Employer", value: details?.employer })
12600
12598
  ] });
12601
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
+ }
12602
12609
  var contactRows = [
12603
12610
  ["address", "Address", 500, 3],
12604
12611
  ["city", "City", 100, 2],
@@ -12608,14 +12615,15 @@ var contactRows = [
12608
12615
  ["fax", "Fax Number", 30, 2]
12609
12616
  ];
12610
12617
  function RfaOfficialContactFields({ nameLabel, value, onChange, before, beforeEmail, faxHint, editable = true }) {
12618
+ const dial = (key2) => key2 === "phone" || key2 === "fax";
12611
12619
  const hint = (key2) => key2 === "fax" && faxHint && !value?.fax?.trim() ? /* @__PURE__ */ jsx37("small", { className: "mbrfa-field-hint", children: faxHint }) : null;
12612
12620
  const field = (key2, label5, max, span) => editable ? /* @__PURE__ */ jsxs35("label", { className: `mbrfa-s${span}`, children: [
12613
12621
  label5,
12614
- /* @__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 }) }),
12615
12623
  hint(key2)
12616
12624
  ] }, key2) : /* @__PURE__ */ jsxs35("div", { className: `mbrfa-s${span} mbrfa-saved`, children: [
12617
12625
  /* @__PURE__ */ jsx37("span", { children: label5 }),
12618
- /* @__PURE__ */ jsx37("strong", { children: value?.[key2]?.trim() || "\u2014" }),
12626
+ /* @__PURE__ */ jsx37("strong", { children: (dial(key2) ? formatRfaPhone(value?.[key2]) : value?.[key2])?.trim() || "\u2014" }),
12619
12627
  hint(key2)
12620
12628
  ] }, key2);
12621
12629
  return /* @__PURE__ */ jsxs35("div", { className: "mbrfa-form-grid", children: [
@@ -12629,8 +12637,8 @@ function RfaOfficialContactFields({ nameLabel, value, onChange, before, beforeEm
12629
12637
  }
12630
12638
  function RfaManualToggle({ manual, onChange, disabled }) {
12631
12639
  return /* @__PURE__ */ jsxs35("div", { className: "mbrfa-section-actions", children: [
12632
- /* @__PURE__ */ jsx37("button", { type: "button", className: "mbrfa-link", disabled, "aria-pressed": manual, onClick: () => onChange(!manual), children: manual ? "Done editing" : "Edit manually" }),
12633
- 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
12634
12642
  ] });
12635
12643
  }
12636
12644
  function useRfaFormDetails(client, claimId, renderingProviderId, enabled) {
@@ -13144,8 +13152,7 @@ function RfaDraftForm({ initialDraft, identity, officialForm = false, formDetail
13144
13152
  /* @__PURE__ */ jsx41(RfaSavedField, { span: 3, label: "NPI Number", value: draft2.providerNpi })
13145
13153
  ] })
13146
13154
  }
13147
- ) }),
13148
- /* @__PURE__ */ jsx41(RfaManualToggle, { manual: practiceManual, onChange: setPracticeManual, disabled: locked })
13155
+ ) })
13149
13156
  ] }),
13150
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) => {
13151
13158
  setAdministratorOverride({ id });
@@ -14268,7 +14275,7 @@ function RfaDashboard({ sessionEndpoint, getSession, apiBaseUrl, fetch: fetchOve
14268
14275
  const identity = useMemo12(() => ({ client, signatureClient, key: key() }), [client, signatureClient]);
14269
14276
  return /* @__PURE__ */ jsx45(RfaDashboardContent, { ...props, ...patientId ? { patientId } : {}, ...claimId ? { claimId } : {}, ...renderingProviderId ? { renderingProviderId } : {}, client, signatureClient, options }, `${identity.key}:${patientId ?? ""}:${claimId ?? ""}:${renderingProviderId ?? ""}`);
14270
14277
  }
14271
- 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 }) {
14272
14279
  const active = useRef22(true);
14273
14280
  useEffect26(() => {
14274
14281
  active.current = true;
@@ -14278,6 +14285,11 @@ function RfaDashboardContent({ client, signatureClient, options, patientId, clai
14278
14285
  }, []);
14279
14286
  const references = useMemo12(() => createBillReferenceClient2(options), [options]);
14280
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]);
14281
14293
  const draftFormProps = { officialForm, ...onEditPractice ? { onEditPractice } : {}, ...onEditLocation ? { onEditLocation } : {}, ...managePracticeHref ? { managePracticeHref } : {}, ...manageLocationsHref ? { manageLocationsHref } : {}, onRefreshProfile: async () => {
14282
14294
  const next = await createOrganizationClient4(options).getBillingProfile();
14283
14295
  if (active.current) setProfile(next);