@bahmni/home-app 0.0.1-dev.266

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.
Files changed (51) hide show
  1. package/LICENSE +9 -0
  2. package/README.md +32 -0
  3. package/dist/App.d.ts +3 -0
  4. package/dist/App.d.ts.map +1 -0
  5. package/dist/DocumentsTable-CnklBHjw-eoBszhUZ.js +227 -0
  6. package/dist/FormsTable-CBcQZdmr-OHeauqLa.js +197 -0
  7. package/dist/LNWAZHJI-1TGLWK9p.js +33 -0
  8. package/dist/MWZ6AO7Z-DzFqoedB.js +42 -0
  9. package/dist/Observations-C7p_jHRY-CqvdCO-Y.js +213 -0
  10. package/dist/YPM2AS64-DcdWoiKL.js +8975 -0
  11. package/dist/components/AppTile/AppTile.d.ts +10 -0
  12. package/dist/components/AppTile/AppTile.d.ts.map +1 -0
  13. package/dist/components/AppTile/__tests__/__mocks__/AppTileMocks.d.ts +7 -0
  14. package/dist/components/AppTile/__tests__/__mocks__/AppTileMocks.d.ts.map +1 -0
  15. package/dist/components/AppTile/index.d.ts +2 -0
  16. package/dist/components/AppTile/index.d.ts.map +1 -0
  17. package/dist/components/HomePage/HomePage.d.ts +3 -0
  18. package/dist/components/HomePage/HomePage.d.ts.map +1 -0
  19. package/dist/components/HomePage/index.d.ts +2 -0
  20. package/dist/components/HomePage/index.d.ts.map +1 -0
  21. package/dist/components/HomePageGrid/HomePageGrid.d.ts +3 -0
  22. package/dist/components/HomePageGrid/HomePageGrid.d.ts.map +1 -0
  23. package/dist/components/HomePageGrid/__tests__/__mocks__/homePageGridMocks.d.ts +5 -0
  24. package/dist/components/HomePageGrid/__tests__/__mocks__/homePageGridMocks.d.ts.map +1 -0
  25. package/dist/components/HomePageGrid/index.d.ts +2 -0
  26. package/dist/components/HomePageGrid/index.d.ts.map +1 -0
  27. package/dist/components/HomePageHeader/HomePageHeader.d.ts +3 -0
  28. package/dist/components/HomePageHeader/HomePageHeader.d.ts.map +1 -0
  29. package/dist/components/HomePageHeader/index.d.ts +2 -0
  30. package/dist/components/HomePageHeader/index.d.ts.map +1 -0
  31. package/dist/components/UserProfileMenu/UserProfileMenu.d.ts +3 -0
  32. package/dist/components/UserProfileMenu/UserProfileMenu.d.ts.map +1 -0
  33. package/dist/components/UserProfileMenu/index.d.ts +2 -0
  34. package/dist/components/UserProfileMenu/index.d.ts.map +1 -0
  35. package/dist/config/tanstackQuery.d.ts +3 -0
  36. package/dist/config/tanstackQuery.d.ts.map +1 -0
  37. package/dist/constants/app.d.ts +5 -0
  38. package/dist/constants/app.d.ts.map +1 -0
  39. package/dist/index-CF1vHfBR.js +10135 -0
  40. package/dist/index-UnkA1bKH.js +166198 -0
  41. package/dist/index.css +1 -0
  42. package/dist/index.d.ts +2 -0
  43. package/dist/index.d.ts.map +1 -0
  44. package/dist/index.js +4 -0
  45. package/dist/locales/locale_en.json +15 -0
  46. package/dist/locales/locale_es.json +15 -0
  47. package/dist/routes/index.d.ts +4 -0
  48. package/dist/routes/index.d.ts.map +1 -0
  49. package/dist/routes/model.d.ts +8 -0
  50. package/dist/routes/model.d.ts.map +1 -0
  51. package/package.json +31 -0
@@ -0,0 +1,213 @@
1
+ import { jsxs as I, jsx as u } from "react/jsx-runtime";
2
+ import { d as V, a as w, u as S, $ as q, Z as G, X as H, f as Q, G as X, J as k, x as M, c as W, W as j, E as D, K as J, v as P, g as Y, H as Z, D as z, N as ee } from "./index-UnkA1bKH.js";
3
+ import { useQueries as ae, useQuery as te } from "@tanstack/react-query";
4
+ import { useRef as se, useEffect as O, useMemo as g } from "react";
5
+ const F = (a, n, d, l, p, r) => {
6
+ const t = J(a, n, p), s = t.value, i = P(s);
7
+ let o = s;
8
+ i === "Image" && (o = /* @__PURE__ */ u(
9
+ Z,
10
+ {
11
+ imageSrc: s,
12
+ alt: s,
13
+ id: `${s}-img`,
14
+ hideThumbnail: r
15
+ }
16
+ )), i === "Video" && (o = /* @__PURE__ */ u(
17
+ z,
18
+ {
19
+ id: `${s}-video`,
20
+ videoSrc: s,
21
+ hideThumbnail: r
22
+ }
23
+ )), i === "PDF" && (o = /* @__PURE__ */ u(ee, { id: `${s}-pdf`, src: s }));
24
+ const b = p("OBSERVATIONS_RECORDED_BY", {
25
+ provider: t.provider
26
+ }), m = a.display, v = a.observationValue?.isAbnormal ? "abnormal-obs" : "obs", c = l ? `${l}-${v}-${m}-${d}-${n}` : `${v}-${m}-${d}-${n}`;
27
+ return /* @__PURE__ */ u(
28
+ Y,
29
+ {
30
+ header: t.header,
31
+ value: o,
32
+ info: b,
33
+ id: c,
34
+ testId: c,
35
+ ariaLabel: c
36
+ },
37
+ `obs-${a.id}`
38
+ );
39
+ }, re = (a, n, d, l, p, r, t) => /* @__PURE__ */ u(
40
+ D,
41
+ {
42
+ title: a.display,
43
+ id: `grouped-obs-${a.display}-${l}`,
44
+ open: d,
45
+ children: a.members?.map(
46
+ (s, i) => F(
47
+ s,
48
+ i,
49
+ p,
50
+ r,
51
+ n,
52
+ t
53
+ )
54
+ )
55
+ },
56
+ `grouped-obs-${a.id}`
57
+ ), ie = ({
58
+ groupedData: a,
59
+ title: n = "",
60
+ hideThumbnail: d
61
+ }) => {
62
+ const { t: l } = S(), p = (r, t, s) => {
63
+ const i = j(r.encounterDetails, l);
64
+ return /* @__PURE__ */ I(
65
+ D,
66
+ {
67
+ title: i,
68
+ id: `encounter-${r.encounterId}`,
69
+ open: t,
70
+ children: [
71
+ r.observations.map(
72
+ (o, b) => F(
73
+ o,
74
+ b,
75
+ s,
76
+ n,
77
+ l,
78
+ d
79
+ )
80
+ ),
81
+ r.groupedObservations.map(
82
+ (o, b) => re(
83
+ o,
84
+ l,
85
+ t,
86
+ b,
87
+ s,
88
+ n,
89
+ d
90
+ )
91
+ )
92
+ ]
93
+ },
94
+ `encounter-${r.encounterId}`
95
+ );
96
+ };
97
+ return /* @__PURE__ */ u(
98
+ "div",
99
+ {
100
+ id: "obs-by-encounter",
101
+ "data-testid": "obs-by-encounter-test-id",
102
+ "aria-label": "obs-by-encounter-aria-label",
103
+ children: a.map(
104
+ (r, t) => p(r, t === 0, t)
105
+ )
106
+ }
107
+ );
108
+ }, oe = "_observations_w45xp_1", ne = "_title_w45xp_18", N = {
109
+ observations: oe,
110
+ title: ne
111
+ }, de = (a) => ["conceptUuid", a], le = (a, n) => ["observations", a, ...n], me = ({ config: a }) => {
112
+ const n = a, {
113
+ conceptNames: d = [],
114
+ conceptUuid: l = [],
115
+ hideThumbnail: p = !1
116
+ } = n, r = se(/* @__PURE__ */ new Set()), t = V(), { addNotification: s } = w(), { t: i } = S(), o = ae({
117
+ queries: d.map((e) => ({
118
+ queryKey: de(e),
119
+ queryFn: () => q(e),
120
+ enabled: !!e
121
+ }))
122
+ });
123
+ O(() => {
124
+ o.forEach((e, h) => {
125
+ if (e.isError && !r.current.has(h)) {
126
+ const K = d[h];
127
+ s({
128
+ title: i("ERROR_DEFAULT_TITLE"),
129
+ message: i("ERROR_FETCHING_CONCEPT", { conceptName: K }),
130
+ type: "error"
131
+ }), r.current.add(h);
132
+ } else e.isError || r.current.delete(h);
133
+ });
134
+ }, [o, d]);
135
+ const b = g(() => o.map((e) => e.data?.uuid).filter((e) => !!e), [o]), m = g(() => [.../* @__PURE__ */ new Set([...b, ...l])], [b, l]), v = g(() => d.length === 0 ? !0 : o.every((e) => !e.isLoading), [o, d.length]), {
136
+ data: c,
137
+ isLoading: A,
138
+ isError: R,
139
+ refetch: T
140
+ } = te({
141
+ queryKey: le(t, m),
142
+ queryFn: () => G(t, m),
143
+ enabled: !!t && m.length > 0 && v
144
+ });
145
+ H(
146
+ (e) => {
147
+ e.patientUUID === t && e.updatedConcepts.size > 0 && [...e.updatedConcepts.keys()].some(
148
+ (h) => m.includes(h)
149
+ ) && T();
150
+ },
151
+ [t, T]
152
+ ), O(() => {
153
+ R && s({
154
+ title: i("ERROR_DEFAULT_TITLE"),
155
+ message: i("ERROR_FETCHING_OBSERVATIONS"),
156
+ type: "error"
157
+ });
158
+ }, [R]);
159
+ const $ = g(() => {
160
+ if (!c) return [];
161
+ const e = Q(c), h = X(e);
162
+ return k(h);
163
+ }, [c]), L = [
164
+ { key: "name", header: "name" },
165
+ { key: "value", header: "value" },
166
+ { key: "form", header: "form" }
167
+ ], f = A || !v, _ = R && v, C = (!c || c.entry?.length === 0 || m.length === 0) && v, U = _ ? i("ERROR_FETCHING_OBSERVATIONS") : null, x = C ? i("NO_OBSERVATIONS_FOUND") : void 0, B = $.length > 0 && !f && !_, E = n.titleTranslationKey, y = E ? i(E) : "";
168
+ return /* @__PURE__ */ I(
169
+ "div",
170
+ {
171
+ id: "observations",
172
+ "data-testid": E ? `observations-${y}` : "observations",
173
+ "aria-label": "observations-aria-label",
174
+ className: N.observations,
175
+ children: [
176
+ /* @__PURE__ */ u(
177
+ M,
178
+ {
179
+ id: "observations-title",
180
+ testId: E ? `observations-title-${y}` : "observations-title",
181
+ title: y,
182
+ className: N.title,
183
+ children: /* @__PURE__ */ u("p", { children: y })
184
+ }
185
+ ),
186
+ B ? /* @__PURE__ */ u(
187
+ ie,
188
+ {
189
+ groupedData: $,
190
+ title: y,
191
+ hideThumbnail: p
192
+ }
193
+ ) : /* @__PURE__ */ u(
194
+ W,
195
+ {
196
+ headers: L,
197
+ rows: [],
198
+ ariaLabel: i("OBSERVATIONS"),
199
+ loading: f,
200
+ errorStateMessage: U,
201
+ emptyStateMessage: x,
202
+ dataTestId: "observations-table"
203
+ }
204
+ )
205
+ ]
206
+ }
207
+ );
208
+ };
209
+ export {
210
+ de as conceptUuidQueryKeys,
211
+ me as default,
212
+ le as observationsQueryKeys
213
+ };