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

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