@bahmni/registration-app 0.0.1-dev.259 → 0.0.1-dev.261

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