@mindbill/react 0.77.27 → 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
@@ -13317,6 +13317,24 @@ function SavedIdentityForm({ client, claimId, renderingProviderId, onSave, canCr
13317
13317
  active = false;
13318
13318
  };
13319
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]);
13320
13338
  const claim = context?.claims.find((value) => value.claimId === selectedClaim);
13321
13339
  const provider = context?.renderingProviders.find((value) => value.id === selectedProvider);
13322
13340
  const locked = disabled || loading;
@@ -13487,7 +13505,7 @@ function SavedIdentityForm({ client, claimId, renderingProviderId, onSave, canCr
13487
13505
  providerFields
13488
13506
  ] })
13489
13507
  ] }),
13490
- 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,
13491
13509
  error ? /* @__PURE__ */ jsx42("p", { role: "alert", children: error }) : null,
13492
13510
  claim && provider && !official ? /* @__PURE__ */ jsxs40("p", { className: "mbtd-note", children: [
13493
13511
  "Create a request for ",