@bahmni/home-app 0.0.1-dev.445 → 0.0.1-dev.446

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.
@@ -1,12 +1,12 @@
1
- import { jsx as e, jsxs as d, Fragment as E } from "react/jsx-runtime";
2
- import { C as _, E as f, u as m, F as u, G as O, I as g, z as h, K as H } from "./index-BZ5cXCFe.js";
3
- import { useRef as N, useEffect as S } from "react";
1
+ import { jsx as e, jsxs as d, Fragment as _ } from "react/jsx-runtime";
2
+ import { H as E, I as f, u as m, J as u, L as O, M as g, z as h, N as H } from "./index-COyiKQe1.js";
3
+ import { useRef as N, useEffect as M } from "react";
4
4
  import "@tanstack/react-query";
5
- import { useNavigate as I, useLocation as M } from "react-router-dom";
5
+ import { useNavigate as S, useLocation as I } from "react-router-dom";
6
6
  const p = "HomePageGrid-module_headerOffset__xmJ-q", P = {
7
7
  headerOffset: p
8
8
  }, y = () => /* @__PURE__ */ e(
9
- _,
9
+ E,
10
10
  {
11
11
  extensionPointId: f,
12
12
  loadingLabelKey: "HOME_LOADING_MODULES",
@@ -15,7 +15,7 @@ const p = "HomePageGrid-module_headerOffset__xmJ-q", P = {
15
15
  className: P.headerOffset,
16
16
  testId: "home-modules"
17
17
  }
18
- ), D = "HomePageHeader-module_locationSelector__foYmn", C = {
18
+ ), D = "HomePageHeader-module_locationSelector__foYmn", L = {
19
19
  locationSelector: D
20
20
  }, T = () => {
21
21
  const { t: o } = m();
@@ -26,27 +26,27 @@ const p = "HomePageGrid-module_headerOffset__xmJ-q", P = {
26
26
  brandPrefix: o("HOME_LABEL"),
27
27
  brandHref: "/",
28
28
  globalFeatures: [
29
- /* @__PURE__ */ e("div", { className: C.locationSelector, children: /* @__PURE__ */ e(g, {}) }, "location")
29
+ /* @__PURE__ */ e("div", { className: L.locationSelector, children: /* @__PURE__ */ e(g, {}) }, "location")
30
30
  ],
31
31
  userMenu: /* @__PURE__ */ e(O, {})
32
32
  }
33
33
  );
34
- }, L = "HomePage-module_homePageBody__0qtrS", A = {
35
- homePageBody: L
36
- }, b = () => {
37
- const { t: o } = m(), { addNotification: a } = h(), s = I(), { pathname: r, search: n, hash: c, state: l } = M(), t = l?.accessDenied, i = N(!1);
38
- return S(() => {
34
+ }, C = "HomePage-module_homePageBody__0qtrS", A = {
35
+ homePageBody: C
36
+ }, R = () => {
37
+ const { t: o } = m(), { addNotification: a } = h(), s = S(), { pathname: r, search: n, hash: c, state: l } = I(), t = l?.accessDenied, i = N(!1);
38
+ return M(() => {
39
39
  !t || i.current || (i.current = !0, a({
40
40
  title: o("HOME_ACCESS_DENIED_TITLE"),
41
41
  message: o("HOME_ACCESS_DENIED_MESSAGE", { app: t.app ?? "" }),
42
42
  type: "error",
43
43
  timeout: H
44
44
  }), s({ pathname: r, search: n, hash: c }, { replace: !0, state: null }));
45
- }, [t, a, o, s, r, n, c]), /* @__PURE__ */ d(E, { children: [
45
+ }, [t, a, o, s, r, n, c]), /* @__PURE__ */ d(_, { children: [
46
46
  /* @__PURE__ */ e(T, {}),
47
47
  /* @__PURE__ */ e("main", { className: A.homePageBody, children: /* @__PURE__ */ e(y, {}) })
48
48
  ] });
49
49
  };
50
50
  export {
51
- b as HomePage
51
+ R as HomePage
52
52
  };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { aG as a } from "./index-BZ5cXCFe.js";
1
+ import { aG as a } from "./index-COyiKQe1.js";
2
2
  export {
3
3
  a as HomeApp
4
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bahmni/home-app",
3
- "version": "0.0.1-dev.445",
3
+ "version": "0.0.1-dev.446",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -1,246 +0,0 @@
1
- import { jsxs as S, jsx as n } from "react/jsx-runtime";
2
- import { d as H, z as M, u as V, r as j, H as x, o as G, n as X, w as J, f as P, g as Y, m as Z, j as W, l as ee, $ as ae, p as se, s as B, t as re, v as te, h as ie, A as oe, X as ne, B as de, Q as le } from "./index-BZ5cXCFe.js";
3
- import { useQueries as ue, useQuery as ce } from "@tanstack/react-query";
4
- import { useRef as pe, useEffect as L, useMemo as E } from "react";
5
- const me = "Observations-module_observations__RKSyo", be = "Observations-module_title__TJL3z", he = "Observations-module_wrapper__muk2L", ve = "Observations-module_secondary__14nuS", f = {
6
- observations: me,
7
- title: be,
8
- wrapper: he,
9
- secondary: ve
10
- }, w = (s, l, o, d, c, r) => {
11
- const t = re(s, l, c), e = t.value, p = te(e);
12
- let i = e;
13
- p === "Image" && (i = /* @__PURE__ */ n(
14
- ne,
15
- {
16
- imageSrc: e,
17
- alt: e,
18
- id: `${e}-img`,
19
- hideThumbnail: r
20
- }
21
- )), p === "Video" && (i = /* @__PURE__ */ n(
22
- de,
23
- {
24
- id: `${e}-video`,
25
- videoSrc: e,
26
- hideThumbnail: r
27
- }
28
- )), p === "PDF" && (i = /* @__PURE__ */ n(le, { id: `${e}-pdf`, src: e }));
29
- const m = /* @__PURE__ */ S("div", { className: f.wrapper, children: [
30
- /* @__PURE__ */ n("span", { children: t.header.display }),
31
- t.header.referenceRange && /* @__PURE__ */ n("span", { className: f.secondary, children: t.header.referenceRange })
32
- ] }), u = c("OBSERVATIONS_RECORDED_BY", {
33
- provider: t.provider
34
- }), b = s.effectiveDateTime ? ie(s.effectiveDateTime, c, !0).formattedResult : void 0, g = /* @__PURE__ */ S("div", { className: f.wrapper, children: [
35
- /* @__PURE__ */ n("span", { children: u }),
36
- b && /* @__PURE__ */ n("span", { className: f.secondary, children: b })
37
- ] }), h = s.display, v = s.observationValue?.isAbnormal ? "abnormal-obs" : "obs", O = d ? `${d}-${v}-${h}-${o}-${l}` : `${v}-${h}-${o}-${l}`;
38
- return /* @__PURE__ */ n(
39
- oe,
40
- {
41
- header: m,
42
- value: i,
43
- info: g,
44
- id: O,
45
- testId: O,
46
- ariaLabel: O
47
- },
48
- `obs-${s.id}`
49
- );
50
- }, ye = (s, l, o, d, c, r, t) => /* @__PURE__ */ n(
51
- B,
52
- {
53
- title: s.display,
54
- id: `grouped-obs-${s.display}-${d}`,
55
- open: o,
56
- children: s.members?.map(
57
- (e, p) => w(
58
- e,
59
- p,
60
- c,
61
- r,
62
- l,
63
- t
64
- )
65
- )
66
- },
67
- `grouped-obs-${s.id}`
68
- ), fe = ({
69
- groupedData: s,
70
- title: l = "",
71
- hideThumbnail: o
72
- }) => {
73
- const { t: d } = V(), c = (r, t, e) => {
74
- const p = se(r.encounterDetails, d);
75
- return /* @__PURE__ */ S(
76
- B,
77
- {
78
- title: p,
79
- id: `encounter-${r.encounterId}`,
80
- open: t,
81
- children: [
82
- r.observations.map(
83
- (i, m) => w(
84
- i,
85
- m,
86
- e,
87
- l,
88
- d,
89
- o
90
- )
91
- ),
92
- r.groupedObservations.map(
93
- (i, m) => ye(
94
- i,
95
- d,
96
- t,
97
- m,
98
- e,
99
- l,
100
- o
101
- )
102
- )
103
- ]
104
- },
105
- `encounter-${r.encounterId}`
106
- );
107
- };
108
- return /* @__PURE__ */ n(
109
- "div",
110
- {
111
- id: "obs-by-encounter",
112
- "data-testid": "obs-by-encounter-test-id",
113
- "aria-label": "obs-by-encounter-aria-label",
114
- children: s.map(
115
- (r, t) => c(r, t === 0, t)
116
- )
117
- }
118
- );
119
- }, Oe = (s) => ["conceptUuid", s], Re = (s, l, o, d) => [
120
- "observations",
121
- s,
122
- ...l,
123
- o,
124
- d
125
- ], Se = ({
126
- config: s,
127
- episodeOfCareUuids: l,
128
- encounterUuids: o
129
- }) => {
130
- const d = s, {
131
- conceptNames: c = [],
132
- conceptUuid: r = [],
133
- hideThumbnail: t = !1,
134
- scope: e = "all"
135
- } = d, p = pe(/* @__PURE__ */ new Set()), i = H(), { addNotification: m } = M(), { t: u } = V(), b = ue({
136
- queries: c.map((a) => ({
137
- queryKey: Oe(a),
138
- queryFn: () => j(a),
139
- enabled: !!a
140
- }))
141
- });
142
- L(() => {
143
- const a = b.some((z) => z.isError), y = p.current.size > 0;
144
- a && !y ? (m({
145
- title: u("ERROR_DEFAULT_TITLE"),
146
- message: u("ERROR_FETCHING_OBSERVATIONS"),
147
- type: "error"
148
- }), p.current.add(0)) : !a && y && p.current.clear();
149
- }, [b, m, u]);
150
- const g = E(() => b.map((a) => a.data?.uuid).filter((a) => !!a), [b]), h = E(() => [.../* @__PURE__ */ new Set([...g, ...r])], [g, r]), v = E(() => c.length === 0 ? !0 : b.every((a) => !a.isLoading), [b, c.length]), O = e === "latest" || e === "latest-encounter", F = x(
151
- l,
152
- o
153
- ), {
154
- data: R,
155
- isLoading: U,
156
- isError: $,
157
- refetch: I
158
- } = ce({
159
- queryKey: Re(
160
- i,
161
- h,
162
- o,
163
- e
164
- ),
165
- queryFn: () => O ? G(
166
- i,
167
- h,
168
- o
169
- ) : X(
170
- i,
171
- h,
172
- o
173
- ),
174
- enabled: !!i && h.length > 0 && v && !F
175
- });
176
- J(
177
- (a) => {
178
- a.patientUUID === i && a.updatedConcepts.size > 0 && [...a.updatedConcepts.keys()].some(
179
- (y) => h.includes(y)
180
- ) && I();
181
- },
182
- [i, I]
183
- ), L(() => {
184
- $ && m({
185
- title: u("ERROR_DEFAULT_TITLE"),
186
- message: u("ERROR_FETCHING_OBSERVATIONS"),
187
- type: "error"
188
- });
189
- }, [$]);
190
- const N = E(() => {
191
- if (!R) return [];
192
- let a = P(R);
193
- e === "latest-encounter" && (a = Y(a));
194
- const y = Z(a);
195
- return W(y);
196
- }, [R, e]), C = [
197
- { key: "name", header: "name" },
198
- { key: "value", header: "value" },
199
- { key: "form", header: "form" }
200
- ], A = U || !v, D = $ && v, K = (!R || R.entry?.length === 0 || h.length === 0) && v, Q = D ? u("ERROR_FETCHING_OBSERVATIONS") : null, k = K ? u("NO_OBSERVATIONS_FOUND") : void 0, q = N.length > 0 && !A && !D, T = d.titleTranslationKey, _ = T ? u(T) : "";
201
- return /* @__PURE__ */ S(
202
- "div",
203
- {
204
- id: "observations",
205
- "data-testid": T ? `observations-${_}` : "observations",
206
- "aria-label": "observations-aria-label",
207
- className: f.observations,
208
- children: [
209
- /* @__PURE__ */ n(
210
- ee,
211
- {
212
- id: "observations-title",
213
- testId: T ? `observations-title-${_}` : "observations-title",
214
- title: _,
215
- className: f.title,
216
- children: /* @__PURE__ */ n("p", { children: _ })
217
- }
218
- ),
219
- q ? /* @__PURE__ */ n(
220
- fe,
221
- {
222
- groupedData: N,
223
- title: _,
224
- hideThumbnail: t
225
- }
226
- ) : /* @__PURE__ */ n(
227
- ae,
228
- {
229
- headers: C,
230
- rows: [],
231
- ariaLabel: u("OBSERVATIONS"),
232
- loading: A,
233
- errorStateMessage: Q,
234
- emptyStateMessage: k ?? u("NO_OBSERVATIONS_AVAILABLE"),
235
- dataTestId: "observations-table"
236
- }
237
- )
238
- ]
239
- }
240
- );
241
- };
242
- export {
243
- Oe as conceptUuidQueryKeys,
244
- Se as default,
245
- Re as observationsQueryKeys
246
- };