@crystaltech/hsms-shared-ui 0.6.7-alpha-1 → 0.6.7-alpha-0.0.1

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.es.js CHANGED
@@ -28667,8 +28667,14 @@ const hM = ({ redirectPath: e = "/login" }) => (console.log(e), /* @__PURE__ */
28667
28667
  }, R = (O) => {
28668
28668
  O.key === "hospital_info" && x();
28669
28669
  }, S = () => x();
28670
- return window.addEventListener("storage", R), window.addEventListener("hsms-hospital-updated", S), () => {
28671
- window.removeEventListener("storage", R), window.removeEventListener("hsms-hospital-updated", S);
28670
+ return window.addEventListener("storage", R), window.addEventListener(
28671
+ "hsms-hospital-updated",
28672
+ S
28673
+ ), () => {
28674
+ window.removeEventListener("storage", R), window.removeEventListener(
28675
+ "hsms-hospital-updated",
28676
+ S
28677
+ );
28672
28678
  };
28673
28679
  }, []);
28674
28680
  const v = B.useMemo(() => i.map((x) => {
@@ -29087,7 +29093,7 @@ const hM = ({ redirectPath: e = "/login" }) => (console.log(e), /* @__PURE__ */
29087
29093
  return;
29088
29094
  }
29089
29095
  if (d.split("-")[1] === "org") {
29090
- window.location.href = `${f}/hsms/${a == null ? void 0 : a.facilityId}/`, c();
29096
+ window.location.href = `${f}/${a == null ? void 0 : a.facilityId.toLowerCase()}`, c();
29091
29097
  return;
29092
29098
  }
29093
29099
  window.location.href = `${f}/hsms/${d.split("-")[1]}/`, c();
package/dist/index.es2.js CHANGED
@@ -1,26 +1,26 @@
1
- function u(t, e) {
1
+ function b(t, e) {
2
2
  try {
3
3
  let a = t.replace("#", "");
4
- a.length === 3 && (a = a.split("").map((s) => s + s).join(""));
5
- const r = (s) => Math.min(255, Math.max(0, s)), n = r(parseInt(a.slice(0, 2), 16) + e), i = r(parseInt(a.slice(2, 4), 16) + e), p = r(parseInt(a.slice(4, 6), 16) + e), o = (s) => {
6
- const l = s.toString(16);
7
- return (l.length === 1 ? "0" : "") + l;
4
+ a.length === 3 && (a = a.split("").map((i) => i + i).join(""));
5
+ const r = (i) => Math.min(255, Math.max(0, i)), n = r(parseInt(a.slice(0, 2), 16) + e), o = r(parseInt(a.slice(2, 4), 16) + e), d = r(parseInt(a.slice(4, 6), 16) + e), s = (i) => {
6
+ const m = i.toString(16);
7
+ return (m.length === 1 ? "0" : "") + m;
8
8
  };
9
- return "#" + o(n) + o(i) + o(p);
9
+ return "#" + s(n) + s(o) + s(d);
10
10
  } catch {
11
11
  return t;
12
12
  }
13
13
  }
14
- function g() {
14
+ function w() {
15
15
  try {
16
- const t = localStorage.getItem("theme"), e = t ? JSON.parse(t) : null, a = e && e.mode || "light", r = e && e.themeColor || "#2c5282", n = u(r, 24), i = a === "light" ? "#ffffff" : "#121212", p = a === "light" ? "#0f172a" : "#e5e7eb", o = document.documentElement;
17
- o.style.setProperty("--app-bg", i), o.style.setProperty("--app-fg", p), o.style.setProperty("--app-primary", r), o.style.setProperty("--app-primary-2", n);
16
+ const t = localStorage.getItem("theme"), e = t ? JSON.parse(t) : null, a = e && e.mode || "light", r = e && e.themeColor || "#2c5282", n = b(r, 24), o = a === "light" ? "#ffffff" : "#121212", d = a === "light" ? "#0f172a" : "#e5e7eb", s = document.documentElement;
17
+ s.style.setProperty("--app-bg", o), s.style.setProperty("--app-fg", d), s.style.setProperty("--app-primary", r), s.style.setProperty("--app-primary-2", n);
18
18
  } catch {
19
19
  const e = document.documentElement;
20
20
  e.style.setProperty("--app-bg", "#ffffff"), e.style.setProperty("--app-fg", "#0f172a"), e.style.setProperty("--app-primary", "#2c5282"), e.style.setProperty("--app-primary-2", "#3b82f6");
21
21
  }
22
22
  }
23
- function y() {
23
+ function g() {
24
24
  try {
25
25
  const t = localStorage.getItem("organization_name") || "", e = localStorage.getItem("organization_logo_full_url") || "";
26
26
  return { orgName: t, orgLogo: e };
@@ -28,7 +28,7 @@ function y() {
28
28
  return { orgName: "", orgLogo: "" };
29
29
  }
30
30
  }
31
- function f() {
31
+ function E() {
32
32
  if (document.getElementById("hsms-pre-splash-style")) return;
33
33
  const t = document.createElement("style");
34
34
  t.id = "hsms-pre-splash-style", t.textContent = `
@@ -73,14 +73,14 @@ function f() {
73
73
  @keyframes hsms-spin { to { transform: rotate(360deg); } }
74
74
  `, document.head.appendChild(t);
75
75
  }
76
- function v(t) {
76
+ function x(t) {
77
77
  if (t != null && t.rootId) {
78
78
  const e = document.getElementById(t.rootId);
79
79
  if (e) return e;
80
80
  }
81
81
  return document.getElementById("app") || document.getElementById("root") || document.body;
82
82
  }
83
- function d(t) {
83
+ function c(t) {
84
84
  try {
85
85
  const e = document.getElementById("hsms-pre-splash");
86
86
  if (!e) return;
@@ -102,15 +102,15 @@ function d(t) {
102
102
  } catch {
103
103
  }
104
104
  }
105
- function c(t) {
105
+ function u(t) {
106
106
  try {
107
107
  if (document.getElementById("hsms-pre-splash")) return;
108
108
  try {
109
109
  document.documentElement.classList.add("app-loading"), document.documentElement.classList.remove("app-ready"), window.__APP_READY__ = !1;
110
110
  } catch {
111
111
  }
112
- g(), f();
113
- const { orgName: e, orgLogo: a } = y(), r = v(t), n = document.createElement("div");
112
+ w(), E();
113
+ const { orgName: e, orgLogo: a } = g(), r = x(t), n = document.createElement("div");
114
114
  n.id = "hsms-pre-splash", n.className = "app-splash", n.setAttribute("role", "status"), n.setAttribute("aria-live", "polite"), n.innerHTML = `
115
115
  <div class="brand">
116
116
  <img id="hsms-splash-logo" src="/logo.png" alt="Organization Logo"
@@ -119,46 +119,68 @@ function c(t) {
119
119
  </div>
120
120
  <div class="splash-spinner" aria-hidden="true"></div>
121
121
  `, r.firstChild ? r.insertBefore(n, r.firstChild) : r.appendChild(n);
122
- const i = n.querySelector("#hsms-splash-logo"), p = n.querySelector("#hsms-splash-name");
123
- i && a && (i.src = a), p && e && (p.textContent = e);
124
- const o = new MutationObserver(() => {
125
- d(r), document.getElementById("hsms-pre-splash") || o.disconnect();
122
+ const o = n.querySelector("#hsms-splash-logo"), d = n.querySelector("#hsms-splash-name");
123
+ if (o && a && (o.src = a), d && e && (d.textContent = e), o) {
124
+ const l = "/logo.png", p = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(
125
+ `<svg xmlns="http://www.w3.org/2000/svg" width="80" height="40">
126
+ <rect width="100%" height="100%" rx="6" fill="rgba(255,255,255,0.18)"/>
127
+ <text x="50%" y="50%" dominant-baseline="middle" text-anchor="middle" fill="white" font-family="sans-serif" font-size="12">HSMS</text>
128
+ </svg>`
129
+ );
130
+ o.addEventListener("error", () => {
131
+ try {
132
+ const h = o.getAttribute("src") || "";
133
+ h !== l ? o.src = l : h !== p && (o.src = p);
134
+ } catch {
135
+ }
136
+ });
137
+ }
138
+ const s = () => {
139
+ try {
140
+ const { orgName: l, orgLogo: p } = g();
141
+ o && p && (o.src = p), d && l && (d.textContent = l);
142
+ } catch {
143
+ }
144
+ };
145
+ window.addEventListener("hsms-organization-updated", s);
146
+ const i = new MutationObserver(() => {
147
+ c(r), document.getElementById("hsms-pre-splash") || i.disconnect();
126
148
  });
127
- o.observe(r, { childList: !0, subtree: !1 });
128
- const s = () => d(r);
129
- window.addEventListener("load", s, { once: !0 });
130
- const l = () => d(r);
131
- window.addEventListener("hsms-app-mounted", l);
132
- const m = () => d(r);
133
- document.addEventListener("DOMContentLoaded", m, { once: !0 });
134
- const h = () => d(r);
135
- window.addEventListener("app-ready", h);
149
+ i.observe(r, { childList: !0, subtree: !1 });
150
+ const m = () => c(r);
151
+ window.addEventListener("load", m, { once: !0 });
152
+ const y = () => c(r);
153
+ window.addEventListener("hsms-app-mounted", y);
154
+ const f = () => c(r);
155
+ document.addEventListener("DOMContentLoaded", f, { once: !0 });
156
+ const v = () => c(r);
157
+ window.addEventListener("app-ready", v);
136
158
  } catch {
137
159
  }
138
160
  }
139
- function E() {
140
- d();
161
+ function L() {
162
+ c();
141
163
  }
142
- function b() {
164
+ function I() {
143
165
  try {
144
166
  window.__APP_READY__ = !0, window.dispatchEvent(new Event("app-ready"));
145
167
  } catch {
146
168
  }
147
169
  }
148
170
  try {
149
- c();
171
+ u();
150
172
  } catch {
151
173
  }
152
174
  try {
153
175
  window.HSMSPreMountSplash = {
154
- initPreMountSplash: c,
155
- hidePreMountSplash: E,
156
- markAppReady: b
176
+ initPreMountSplash: u,
177
+ hidePreMountSplash: L,
178
+ markAppReady: I
157
179
  };
158
180
  } catch {
159
181
  }
160
182
  export {
161
- E as hidePreMountSplash,
162
- c as initPreMountSplash,
163
- b as markAppReady
183
+ L as hidePreMountSplash,
184
+ u as initPreMountSplash,
185
+ I as markAppReady
164
186
  };