@bahmni/appointments-app 0.0.1-dev.405 → 0.0.1-dev.409

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