@bahmni/appointments-app 0.0.1-dev.404 → 0.0.1-dev.408

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
@@ -1,4 +1,4 @@
1
- import { b9 as t } from "./index-CvkiQs0R.js";
1
+ import { b9 as t } from "./index-SYnmvoqG.js";
2
2
  export {
3
3
  t as AppointmentsApp
4
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bahmni/appointments-app",
3
- "version": "0.0.1-dev.404",
3
+ "version": "0.0.1-dev.408",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -1,213 +0,0 @@
1
- import { jsxs as S, 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 D, x as J, C as Y, y as W, E as X, B as Z, D as ee } from "./index-CvkiQs0R.js";
3
- import { useQueries as ae, useQuery as te } from "@tanstack/react-query";
4
- import { useRef as se, useEffect as I, useMemo as T } from "react";
5
- const C = (a, n, d, l, b, r) => {
6
- const t = J(a, n, b), s = t.value, o = Y(s);
7
- let i = s;
8
- o === "Image" && (i = /* @__PURE__ */ u(
9
- X,
10
- {
11
- imageSrc: s,
12
- alt: s,
13
- id: `${s}-img`,
14
- hideThumbnail: r
15
- }
16
- )), o === "Video" && (i = /* @__PURE__ */ u(
17
- Z,
18
- {
19
- id: `${s}-video`,
20
- videoSrc: s,
21
- hideThumbnail: r
22
- }
23
- )), o === "PDF" && (i = /* @__PURE__ */ u(ee, { id: `${s}-pdf`, src: s }));
24
- const m = b("OBSERVATIONS_RECORDED_BY", {
25
- provider: t.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: t.header,
31
- value: i,
32
- info: m,
33
- id: c,
34
- testId: c,
35
- ariaLabel: c
36
- },
37
- `obs-${a.id}`
38
- );
39
- }, re = (a, n, d, l, b, 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, o) => C(
47
- s,
48
- o,
49
- b,
50
- r,
51
- n,
52
- t
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 = (r, t, s) => {
63
- const o = P(r.encounterDetails, l);
64
- return /* @__PURE__ */ S(
65
- D,
66
- {
67
- title: o,
68
- id: `encounter-${r.encounterId}`,
69
- open: t,
70
- children: [
71
- r.observations.map(
72
- (i, m) => C(
73
- i,
74
- m,
75
- s,
76
- n,
77
- l,
78
- d
79
- )
80
- ),
81
- r.groupedObservations.map(
82
- (i, m) => re(
83
- i,
84
- l,
85
- t,
86
- m,
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) => b(r, t === 0, t)
105
- )
106
- }
107
- );
108
- }, ie = "Observations-module_observations__RKSyo", ne = "Observations-module_title__TJL3z", $ = {
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, r = se(/* @__PURE__ */ new Set()), t = q(), { addNotification: s } = G(), { t: o } = N(), i = ae({
117
- queries: d.map((e) => ({
118
- queryKey: de(e),
119
- queryFn: () => k(e),
120
- enabled: !!e
121
- }))
122
- });
123
- I(() => {
124
- i.forEach((e, y) => {
125
- if (e.isError && !r.current.has(y)) {
126
- const U = d[y];
127
- s({
128
- title: o("ERROR_DEFAULT_TITLE"),
129
- message: o("ERROR_FETCHING_CONCEPT", { conceptName: U }),
130
- type: "error"
131
- }), r.current.add(y);
132
- } else e.isError || r.current.delete(y);
133
- });
134
- }, [i, d]);
135
- const m = T(() => i.map((e) => e.data?.uuid).filter((e) => !!e), [i]), p = T(() => [.../* @__PURE__ */ new Set([...m, ...l])], [m, l]), h = T(() => d.length === 0 ? !0 : i.every((e) => !e.isLoading), [i, d.length]), {
136
- data: c,
137
- isLoading: F,
138
- isError: R,
139
- refetch: g
140
- } = te({
141
- queryKey: le(t, p),
142
- queryFn: () => x(t, p),
143
- enabled: !!t && p.length > 0 && h
144
- });
145
- z(
146
- (e) => {
147
- e.patientUUID === t && e.updatedConcepts.size > 0 && [...e.updatedConcepts.keys()].some(
148
- (y) => p.includes(y)
149
- ) && g();
150
- },
151
- [t, g]
152
- ), I(() => {
153
- R && s({
154
- title: o("ERROR_DEFAULT_TITLE"),
155
- message: o("ERROR_FETCHING_OBSERVATIONS"),
156
- type: "error"
157
- });
158
- }, [R]);
159
- const O = T(() => {
160
- if (!c) return [];
161
- const e = Q(c), y = w(e);
162
- return H(y);
163
- }, [c]), L = [
164
- { key: "name", header: "name" },
165
- { key: "value", header: "value" },
166
- { key: "form", header: "form" }
167
- ], _ = F || !h, f = R && h, A = (!c || c.entry?.length === 0 || p.length === 0) && h, K = f ? o("ERROR_FETCHING_OBSERVATIONS") : null, V = A ? o("NO_OBSERVATIONS_FOUND") : void 0, B = O.length > 0 && !_ && !f, E = n.titleTranslationKey, v = E ? o(E) : "";
168
- return /* @__PURE__ */ S(
169
- "div",
170
- {
171
- id: "observations",
172
- "data-testid": E ? `observations-${v}` : "observations",
173
- "aria-label": "observations-aria-label",
174
- className: $.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: $.title,
183
- children: /* @__PURE__ */ u("p", { children: v })
184
- }
185
- ),
186
- B ? /* @__PURE__ */ u(
187
- oe,
188
- {
189
- groupedData: O,
190
- title: v,
191
- hideThumbnail: b
192
- }
193
- ) : /* @__PURE__ */ u(
194
- j,
195
- {
196
- headers: L,
197
- rows: [],
198
- ariaLabel: o("OBSERVATIONS"),
199
- loading: _,
200
- errorStateMessage: K,
201
- emptyStateMessage: V,
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
- };