@bahmni/appointments-app 0.0.1-dev.177 → 0.0.1-dev.182

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