@bahmni/home-app 0.0.1-dev.266 → 0.0.1-dev.270

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,7 +1,7 @@
1
- import { jsx as r, jsxs as p, Fragment as Y } from "react/jsx-runtime";
2
- import { d as K, u as Q, a as W, F as J, b as X, m as Z, c as ee, r as te } from "./index-UnkA1bKH.js";
1
+ import { jsx as r, jsxs as h, Fragment as Y } from "react/jsx-runtime";
2
+ import { u as K, a as Q, h as W, e as J, b as X, m as Z, c as ee, n as te } from "./index-DS-CiIQB.js";
3
3
  import { useQuery as ae } from "@tanstack/react-query";
4
- import { useState as m, useCallback as h, useEffect as O, useMemo as T } from "react";
4
+ import { useState as m, useCallback as p, useEffect as f, useMemo as T } from "react";
5
5
  const ne = "_documentsTableBody_1voj8_1", oe = "_viewAttachmentsLink_1voj8_11", re = "_documentViewerContainer_1voj8_15", de = "_attachmentItem_1voj8_23", se = "_attachmentCounter_1voj8_27", ce = "_attachmentError_1voj8_36", ie = "_documentIframe_1voj8_44", me = "_documentImage_1voj8_50", d = {
6
6
  documentsTableBody: ne,
7
7
  viewAttachmentsLink: oe,
@@ -33,16 +33,16 @@ const _e = [
33
33
  "uploadedOn",
34
34
  "uploadedBy",
35
35
  "action"
36
- ], pe = /\.(jpg|jpeg|png|gif|webp|bmp|svg)$/i, B = (a) => a.attachments.length > 0 ? a.attachments : a.documentUrl ? [{ url: a.documentUrl, contentType: a.contentType }] : [], fe = ({ config: a, encounterUuids: g }) => {
36
+ ], he = /\.(jpg|jpeg|png|gif|webp|bmp|svg)$/i, B = (a) => a.attachments.length > 0 ? a.attachments : a.documentUrl ? [{ url: a.documentUrl, contentType: a.contentType }] : [], Ne = ({ config: a, encounterUuids: g }) => {
37
37
  const [s, w] = m(!1), [o, L] = m(
38
38
  null
39
39
  ), [R, I] = m(
40
40
  /* @__PURE__ */ new Set()
41
- ), E = K(), { t: n } = Q(), { addNotification: U } = W(), $ = Number(a?.pageSize) || 5, [C, A] = m(1), [l, k] = m($), [F, y] = m(void 0), b = h((e) => {
41
+ ), E = K(), { t: n } = Q(), { addNotification: U } = W(), $ = Number(a?.pageSize) || 5, [C, A] = m(1), [l, k] = m($), [V, y] = m(void 0), b = p((e) => {
42
42
  L(e), w(!0);
43
- }, []), V = h(() => {
43
+ }, []), F = p(() => {
44
44
  w(!1), L(null), I(/* @__PURE__ */ new Set());
45
- }, []), M = h((e) => {
45
+ }, []), M = p((e) => {
46
46
  I((t) => new Set(t).add(e));
47
47
  }, []), { data: u, isLoading: H, isError: D, error: v } = ae({
48
48
  queryKey: [
@@ -60,17 +60,17 @@ const _e = [
60
60
  C
61
61
  )
62
62
  });
63
- O(() => {
63
+ f(() => {
64
64
  u && y(u.total);
65
- }, [u]), O(() => {
65
+ }, [u]), f(() => {
66
66
  A(1), y(void 0);
67
- }, [E]), O(() => {
67
+ }, [E]), f(() => {
68
68
  D && U({
69
69
  title: n("ERROR_DEFAULT_TITLE"),
70
70
  message: v?.message ?? "",
71
71
  type: "error"
72
72
  });
73
- }, [D, v, U, n]), O(() => {
73
+ }, [D, v, U, n]), f(() => {
74
74
  const e = new AbortController();
75
75
  return (async () => {
76
76
  if (!s || !o) return;
@@ -82,31 +82,31 @@ const _e = [
82
82
  method: "HEAD",
83
83
  signal: e.signal
84
84
  })).ok || t.add(i);
85
- } catch (N) {
86
- N instanceof Error && N.name !== "AbortError" && t.add(i);
85
+ } catch (O) {
86
+ O instanceof Error && O.name !== "AbortError" && t.add(i);
87
87
  }
88
88
  }
89
89
  e.signal.aborted || I(t);
90
90
  })(), () => e.abort();
91
91
  }, [s, o]);
92
- const q = h(
92
+ const q = p(
93
93
  (e, t) => {
94
94
  t !== l ? (k(t), A(1), y(void 0)) : A(e);
95
95
  },
96
96
  [l]
97
- ), f = T(
97
+ ), N = T(
98
98
  () => a?.fields ?? _e,
99
99
  [a?.fields]
100
- ), P = T(() => [...u?.documents ?? []].sort((e, t) => !e.uploadedOn && !t.uploadedOn ? 0 : e.uploadedOn ? t.uploadedOn ? new Date(t.uploadedOn).getTime() - new Date(e.uploadedOn).getTime() : -1 : 1), [u]), z = T(() => ue(f, n), [f, n]), x = T(
101
- () => f.map((e) => ({
100
+ ), P = T(() => [...u?.documents ?? []].sort((e, t) => !e.uploadedOn && !t.uploadedOn ? 0 : e.uploadedOn ? t.uploadedOn ? new Date(t.uploadedOn).getTime() - new Date(e.uploadedOn).getTime() : -1 : 1), [u]), z = T(() => ue(N, n), [N, n]), x = T(
101
+ () => N.map((e) => ({
102
102
  key: e,
103
103
  sortable: e !== "action"
104
104
  })),
105
- [f]
105
+ [N]
106
106
  ), _ = T(
107
107
  () => o ? B(o) : [],
108
108
  [o]
109
- ), G = h(
109
+ ), G = p(
110
110
  (e, t) => {
111
111
  switch (t) {
112
112
  case "documentIdentifier":
@@ -137,7 +137,7 @@ const _e = [
137
137
  },
138
138
  [b, n]
139
139
  );
140
- return /* @__PURE__ */ p(Y, { children: [
140
+ return /* @__PURE__ */ h(Y, { children: [
141
141
  /* @__PURE__ */ r("div", { "data-testid": "documents-table", children: /* @__PURE__ */ r(
142
142
  ee,
143
143
  {
@@ -152,7 +152,7 @@ const _e = [
152
152
  className: d.documentsTableBody,
153
153
  dataTestId: "documents-table",
154
154
  pageSize: l,
155
- totalItems: F,
155
+ totalItems: V,
156
156
  page: C,
157
157
  onPageChange: q
158
158
  }
@@ -163,20 +163,20 @@ const _e = [
163
163
  id: "modalIdForActionAreaLayout",
164
164
  portalId: "main-display-area",
165
165
  open: s,
166
- onRequestClose: V,
166
+ onRequestClose: F,
167
167
  modalHeading: o.documentIdentifier,
168
168
  passiveModal: !0,
169
169
  size: "lg",
170
170
  testId: "document-view-modal",
171
171
  children: /* @__PURE__ */ r("div", { className: d.documentViewerContainer, children: _.map((e, t) => {
172
- const c = j(e.url), i = e.contentType?.toLowerCase().includes("pdf"), S = (e.contentType?.toLowerCase().includes("image") ?? !1) || pe.test(e.url ?? ""), N = R.has(t);
173
- return c === "#" || N ? /* @__PURE__ */ p(
172
+ const c = j(e.url), i = e.contentType?.toLowerCase().includes("pdf"), S = (e.contentType?.toLowerCase().includes("image") ?? !1) || he.test(e.url ?? ""), O = R.has(t);
173
+ return c === "#" || O ? /* @__PURE__ */ h(
174
174
  "div",
175
175
  {
176
176
  className: d.attachmentError,
177
177
  "data-testid": `attachment-error-${t}`,
178
178
  children: [
179
- _.length > 1 && /* @__PURE__ */ p("p", { className: d.attachmentCounter, children: [
179
+ _.length > 1 && /* @__PURE__ */ h("p", { className: d.attachmentCounter, children: [
180
180
  t + 1,
181
181
  "/",
182
182
  _.length
@@ -185,13 +185,13 @@ const _e = [
185
185
  ]
186
186
  },
187
187
  `${o.id}-${e.url}`
188
- ) : /* @__PURE__ */ p(
188
+ ) : /* @__PURE__ */ h(
189
189
  "div",
190
190
  {
191
191
  className: d.attachmentItem,
192
192
  "data-testid": `attachment-item-${t}`,
193
193
  children: [
194
- _.length > 1 && /* @__PURE__ */ p("p", { className: d.attachmentCounter, children: [
194
+ _.length > 1 && /* @__PURE__ */ h("p", { className: d.attachmentCounter, children: [
195
195
  t + 1,
196
196
  "/",
197
197
  _.length
@@ -223,5 +223,5 @@ const _e = [
223
223
  ] });
224
224
  };
225
225
  export {
226
- fe as default
226
+ Ne as default
227
227
  };
@@ -0,0 +1,206 @@
1
+ import { jsx as s, jsxs as W, Fragment as Z } from "react/jsx-runtime";
2
+ import { a as ee, u as re, w as ae, X as oe, J as te, Q as se, G as ne, d as de, R as v, m as ie, b as me, c as U, C as ue, T as le, n as ce, f as fe, K as ye } from "./index-DS-CiIQB.js";
3
+ import { useQueryClient as pe, useQuery as f } from "@tanstack/react-query";
4
+ import { useState as S, useMemo as d, useCallback as y } from "react";
5
+ const be = "_formsTableBody_ourq9_5", Ne = "_customAccordianItem_ourq9_10", A = {
6
+ formsTableBody: be,
7
+ customAccordianItem: Ne
8
+ }, ge = (m) => m ? m.extension?.find(
9
+ (n) => n.url === ye
10
+ )?.valueString : void 0, Te = ({
11
+ episodeOfCareUuids: m,
12
+ encounterUuids: n,
13
+ config: w
14
+ }) => {
15
+ const { t } = ee(), u = re(), [l, O] = S(!1), [o, I] = S(null), {
16
+ numberOfVisits: K,
17
+ hideThumbnail: k = !1,
18
+ forms: c
19
+ } = w ?? {}, T = ae(
20
+ m,
21
+ n
22
+ ), H = pe(), {
23
+ data: L = [],
24
+ isLoading: B,
25
+ isError: C,
26
+ error: Q,
27
+ refetch: j
28
+ } = f({
29
+ queryKey: ["forms", u, m],
30
+ queryFn: () => oe(u, void 0, K),
31
+ enabled: !!u && !T
32
+ }), E = d(() => {
33
+ let e = L;
34
+ return n && n.length > 0 && (e = e.filter(
35
+ (r) => n.includes(r.encounterUuid)
36
+ )), Array.isArray(c) && c.length > 0 && (e = e.filter(
37
+ (r) => c.some((a) => a.toLowerCase() === r.formName.toLowerCase())
38
+ )), e;
39
+ }, [L, n, c]), { data: M = [] } = f({
40
+ queryKey: ["observationForms"],
41
+ queryFn: () => te()
42
+ }), R = y(
43
+ (e) => M.find((r) => r.name === e)?.uuid,
44
+ [M]
45
+ ), p = d(() => {
46
+ if (o)
47
+ return R(o.formName);
48
+ }, [o, R]), {
49
+ isLoading: x,
50
+ isError: G,
51
+ error: b
52
+ } = f({
53
+ queryKey: ["formMetadata", p],
54
+ queryFn: () => se(p),
55
+ enabled: !!p && l
56
+ }), {
57
+ data: N,
58
+ isLoading: V,
59
+ isError: $,
60
+ error: g
61
+ } = f({
62
+ queryKey: ["formsEncounterFHIR", o?.encounterUuid],
63
+ queryFn: () => ne(o.encounterUuid),
64
+ enabled: !!o?.encounterUuid && l
65
+ });
66
+ de(
67
+ (e) => {
68
+ e.patientUUID === u && e.updatedConcepts.size > 0 && (j(), H.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
69
+ },
70
+ [u]
71
+ );
72
+ const J = d(() => !N?.entry || !o?.formName ? [] : N.entry.filter((e) => e.resource?.resourceType === "Observation").map((e) => e.resource).filter((e) => {
73
+ const r = ge(e);
74
+ return !r || r.includes(o.formName);
75
+ }), [N, o?.formName]), z = d(() => {
76
+ if (b)
77
+ return v(b).message;
78
+ if (g)
79
+ return v(g).message;
80
+ }, [b, g]), _ = d(
81
+ () => [
82
+ { key: "recordedOn", header: t("RECORDED_ON") },
83
+ { key: "recordedBy", header: t("RECORDED_BY") }
84
+ ],
85
+ [t]
86
+ ), X = d(
87
+ () => [
88
+ { key: "recordedOn", sortable: !0 },
89
+ { key: "recordedBy", sortable: !0 }
90
+ ],
91
+ []
92
+ ), F = d(() => {
93
+ const e = E.reduce(
94
+ (r, a) => {
95
+ const i = a.formName;
96
+ r[i] ??= [];
97
+ const h = a.providers.map((Y) => Y.providerName).filter(Boolean).join(", ");
98
+ return r[i].push({
99
+ id: a.encounterUuid,
100
+ formName: a.formName,
101
+ recordedOn: ie(a.encounterDateTime, t, !0).formattedResult,
102
+ recordedBy: h ?? "--",
103
+ encounterDateTime: a.encounterDateTime,
104
+ encounterUuid: a.encounterUuid
105
+ }), r;
106
+ },
107
+ {}
108
+ );
109
+ return Object.entries(e).map(
110
+ ([r, a]) => ({
111
+ formName: r,
112
+ records: a.sort(
113
+ (i, h) => h.encounterDateTime - i.encounterDateTime
114
+ )
115
+ })
116
+ ).sort((r, a) => r.formName.localeCompare(a.formName));
117
+ }, [E, t]), D = y((e) => {
118
+ I(e), O(!0);
119
+ }, []), P = y(() => {
120
+ O(!1), I(null);
121
+ }, []), q = y(
122
+ (e, r) => {
123
+ switch (r) {
124
+ case "recordedOn":
125
+ return /* @__PURE__ */ s(me, { onClick: () => D(e), children: e.recordedOn });
126
+ case "recordedBy":
127
+ return e.recordedBy;
128
+ default:
129
+ return null;
130
+ }
131
+ },
132
+ [D]
133
+ );
134
+ return /* @__PURE__ */ W(Z, { children: [
135
+ /* @__PURE__ */ s("div", { id: "forms-table", "data-testid": "forms-table", children: B || C || F.length === 0 || T ? /* @__PURE__ */ s(
136
+ U,
137
+ {
138
+ headers: _,
139
+ ariaLabel: t("FORMS_HEADING"),
140
+ rows: [],
141
+ loading: B,
142
+ errorStateMessage: C ? Q?.message : void 0,
143
+ emptyStateMessage: t("FORMS_UNAVAILABLE"),
144
+ renderCell: q,
145
+ className: A.formsTableBody,
146
+ dataTestId: "forms-table"
147
+ }
148
+ ) : /* @__PURE__ */ s(ue, { align: "start", children: F.map((e, r) => {
149
+ const { formName: a, records: i } = e;
150
+ return /* @__PURE__ */ s(
151
+ le,
152
+ {
153
+ title: a,
154
+ className: A.customAccordianItem,
155
+ testId: `accordian-title-${a}`,
156
+ open: r === 0,
157
+ children: /* @__PURE__ */ s(
158
+ U,
159
+ {
160
+ headers: _,
161
+ ariaLabel: t("FORMS_HEADING"),
162
+ rows: i,
163
+ loading: !1,
164
+ errorStateMessage: "",
165
+ sortable: X,
166
+ emptyStateMessage: t("FORMS_UNAVAILABLE"),
167
+ renderCell: q,
168
+ className: A.formsTableBody,
169
+ dataTestId: `forms-table-${a}`
170
+ }
171
+ )
172
+ },
173
+ a
174
+ );
175
+ }) }) }),
176
+ l && o && /* @__PURE__ */ s(
177
+ ce,
178
+ {
179
+ id: "modalIdForActionAreaLayout",
180
+ portalId: "main-display-area",
181
+ open: l,
182
+ onRequestClose: P,
183
+ modalHeading: o.formName,
184
+ modalLabel: `${o.recordedOn} | ${o.recordedBy}`,
185
+ passiveModal: !0,
186
+ size: "md",
187
+ testId: "form-details-modal",
188
+ children: /* @__PURE__ */ s(
189
+ fe,
190
+ {
191
+ observations: J,
192
+ isLoading: x || V,
193
+ isError: G || $,
194
+ errorMessage: z,
195
+ emptyStateMessage: t("NO_FORM_DATA_AVAILABLE"),
196
+ testIdPrefix: o.formName,
197
+ hideThumbnail: k
198
+ }
199
+ )
200
+ }
201
+ )
202
+ ] });
203
+ };
204
+ export {
205
+ Te as default
206
+ };
@@ -1,5 +1,5 @@
1
- import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-DcdWoiKL.js";
2
- import { M as d, O as f, Q as e } from "./index-UnkA1bKH.js";
1
+ import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-B--5WOex.js";
2
+ import { P as d, U as f, V as e } from "./index-DS-CiIQB.js";
3
3
  var p = (a) => {
4
4
  const [r, t] = c({
5
5
  prefix: "TanstackQueryDevtools"
@@ -1,5 +1,5 @@
1
- import { c as s, T as c, P as u, a as i, b as m, C as P, Q as d } from "./YPM2AS64-DcdWoiKL.js";
2
- import { M as v, O as C, Q as e } from "./index-UnkA1bKH.js";
1
+ import { c as s, T as c, P as u, a as i, b as m, C as P, Q as d } from "./YPM2AS64-B--5WOex.js";
2
+ import { P as v, U as C, V as e } from "./index-DS-CiIQB.js";
3
3
  var h = (t) => {
4
4
  const [r, o] = s({
5
5
  prefix: "TanstackQueryDevtools"
@@ -1,12 +1,12 @@
1
- import { jsxs as I, jsx as u } from "react/jsx-runtime";
2
- import { d as V, a as w, u as S, $ as q, Z as G, X as H, f as Q, G as X, J as k, x as M, c as W, W as j, E as D, K as J, v as P, g as Y, H as Z, D as z, N as ee } from "./index-UnkA1bKH.js";
1
+ import { jsxs as S, jsx as u } from "react/jsx-runtime";
2
+ import { u as M, h as k, a as N, W as q, Y as x, d as K, g as Q, i as X, s as Y, z as j, c as z, j as G, _ as A, o as H, y as P, k as W, M as J, S as Z, A as ee } from "./index-DS-CiIQB.js";
3
3
  import { useQueries as ae, useQuery as te } from "@tanstack/react-query";
4
- import { useRef as se, useEffect as O, useMemo as g } from "react";
5
- const F = (a, n, d, l, p, r) => {
6
- const t = J(a, n, p), s = t.value, i = P(s);
4
+ import { useRef as se, useEffect as $, useMemo as g } from "react";
5
+ const D = (a, n, d, l, b, r) => {
6
+ const t = H(a, n, b), s = t.value, i = P(s);
7
7
  let o = s;
8
8
  i === "Image" && (o = /* @__PURE__ */ u(
9
- Z,
9
+ J,
10
10
  {
11
11
  imageSrc: s,
12
12
  alt: s,
@@ -14,39 +14,39 @@ const F = (a, n, d, l, p, r) => {
14
14
  hideThumbnail: r
15
15
  }
16
16
  )), i === "Video" && (o = /* @__PURE__ */ u(
17
- z,
17
+ Z,
18
18
  {
19
19
  id: `${s}-video`,
20
20
  videoSrc: s,
21
21
  hideThumbnail: r
22
22
  }
23
23
  )), i === "PDF" && (o = /* @__PURE__ */ u(ee, { id: `${s}-pdf`, src: s }));
24
- const b = p("OBSERVATIONS_RECORDED_BY", {
24
+ const p = b("OBSERVATIONS_RECORDED_BY", {
25
25
  provider: t.provider
26
- }), m = a.display, v = a.observationValue?.isAbnormal ? "abnormal-obs" : "obs", c = l ? `${l}-${v}-${m}-${d}-${n}` : `${v}-${m}-${d}-${n}`;
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
- Y,
28
+ W,
29
29
  {
30
30
  header: t.header,
31
31
  value: o,
32
- info: b,
32
+ info: p,
33
33
  id: c,
34
34
  testId: c,
35
35
  ariaLabel: c
36
36
  },
37
37
  `obs-${a.id}`
38
38
  );
39
- }, re = (a, n, d, l, p, r, t) => /* @__PURE__ */ u(
40
- D,
39
+ }, re = (a, n, d, l, b, r, t) => /* @__PURE__ */ u(
40
+ A,
41
41
  {
42
42
  title: a.display,
43
43
  id: `grouped-obs-${a.display}-${l}`,
44
44
  open: d,
45
45
  children: a.members?.map(
46
- (s, i) => F(
46
+ (s, i) => D(
47
47
  s,
48
48
  i,
49
- p,
49
+ b,
50
50
  r,
51
51
  n,
52
52
  t
@@ -59,19 +59,19 @@ const F = (a, n, d, l, p, r) => {
59
59
  title: n = "",
60
60
  hideThumbnail: d
61
61
  }) => {
62
- const { t: l } = S(), p = (r, t, s) => {
63
- const i = j(r.encounterDetails, l);
64
- return /* @__PURE__ */ I(
65
- D,
62
+ const { t: l } = N(), b = (r, t, s) => {
63
+ const i = G(r.encounterDetails, l);
64
+ return /* @__PURE__ */ S(
65
+ A,
66
66
  {
67
67
  title: i,
68
68
  id: `encounter-${r.encounterId}`,
69
69
  open: t,
70
70
  children: [
71
71
  r.observations.map(
72
- (o, b) => F(
72
+ (o, p) => D(
73
73
  o,
74
- b,
74
+ p,
75
75
  s,
76
76
  n,
77
77
  l,
@@ -79,11 +79,11 @@ const F = (a, n, d, l, p, r) => {
79
79
  )
80
80
  ),
81
81
  r.groupedObservations.map(
82
- (o, b) => re(
82
+ (o, p) => re(
83
83
  o,
84
84
  l,
85
85
  t,
86
- b,
86
+ p,
87
87
  s,
88
88
  n,
89
89
  d
@@ -101,104 +101,104 @@ const F = (a, n, d, l, p, r) => {
101
101
  "data-testid": "obs-by-encounter-test-id",
102
102
  "aria-label": "obs-by-encounter-aria-label",
103
103
  children: a.map(
104
- (r, t) => p(r, t === 0, t)
104
+ (r, t) => b(r, t === 0, t)
105
105
  )
106
106
  }
107
107
  );
108
- }, oe = "_observations_w45xp_1", ne = "_title_w45xp_18", N = {
108
+ }, oe = "_observations_w45xp_1", ne = "_title_w45xp_18", I = {
109
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
- hideThumbnail: p = !1
116
- } = n, r = se(/* @__PURE__ */ new Set()), t = V(), { addNotification: s } = w(), { t: i } = S(), o = ae({
115
+ hideThumbnail: b = !1
116
+ } = n, r = se(/* @__PURE__ */ new Set()), t = M(), { addNotification: s } = k(), { t: i } = N(), o = ae({
117
117
  queries: d.map((e) => ({
118
118
  queryKey: de(e),
119
119
  queryFn: () => q(e),
120
120
  enabled: !!e
121
121
  }))
122
122
  });
123
- O(() => {
123
+ $(() => {
124
124
  o.forEach((e, h) => {
125
125
  if (e.isError && !r.current.has(h)) {
126
- const K = d[h];
126
+ const w = d[h];
127
127
  s({
128
128
  title: i("ERROR_DEFAULT_TITLE"),
129
- message: i("ERROR_FETCHING_CONCEPT", { conceptName: K }),
129
+ message: i("ERROR_FETCHING_CONCEPT", { conceptName: w }),
130
130
  type: "error"
131
131
  }), r.current.add(h);
132
132
  } else e.isError || r.current.delete(h);
133
133
  });
134
134
  }, [o, d]);
135
- const b = g(() => o.map((e) => e.data?.uuid).filter((e) => !!e), [o]), m = g(() => [.../* @__PURE__ */ new Set([...b, ...l])], [b, l]), v = g(() => d.length === 0 ? !0 : o.every((e) => !e.isLoading), [o, d.length]), {
135
+ const p = g(() => o.map((e) => e.data?.uuid).filter((e) => !!e), [o]), m = g(() => [.../* @__PURE__ */ new Set([...p, ...l])], [p, l]), y = g(() => d.length === 0 ? !0 : o.every((e) => !e.isLoading), [o, d.length]), {
136
136
  data: c,
137
- isLoading: A,
137
+ isLoading: F,
138
138
  isError: R,
139
139
  refetch: T
140
140
  } = te({
141
141
  queryKey: le(t, m),
142
- queryFn: () => G(t, m),
143
- enabled: !!t && m.length > 0 && v
142
+ queryFn: () => x(t, m),
143
+ enabled: !!t && m.length > 0 && y
144
144
  });
145
- H(
145
+ K(
146
146
  (e) => {
147
147
  e.patientUUID === t && e.updatedConcepts.size > 0 && [...e.updatedConcepts.keys()].some(
148
148
  (h) => m.includes(h)
149
149
  ) && T();
150
150
  },
151
151
  [t, T]
152
- ), O(() => {
152
+ ), $(() => {
153
153
  R && s({
154
154
  title: i("ERROR_DEFAULT_TITLE"),
155
155
  message: i("ERROR_FETCHING_OBSERVATIONS"),
156
156
  type: "error"
157
157
  });
158
158
  }, [R]);
159
- const $ = g(() => {
159
+ const _ = g(() => {
160
160
  if (!c) return [];
161
161
  const e = Q(c), h = X(e);
162
- return k(h);
162
+ return Y(h);
163
163
  }, [c]), L = [
164
164
  { key: "name", header: "name" },
165
165
  { key: "value", header: "value" },
166
166
  { key: "form", header: "form" }
167
- ], f = A || !v, _ = R && v, C = (!c || c.entry?.length === 0 || m.length === 0) && v, U = _ ? i("ERROR_FETCHING_OBSERVATIONS") : null, x = C ? i("NO_OBSERVATIONS_FOUND") : void 0, B = $.length > 0 && !f && !_, E = n.titleTranslationKey, y = E ? i(E) : "";
168
- return /* @__PURE__ */ I(
167
+ ], f = F || !y, O = R && y, C = (!c || c.entry?.length === 0 || m.length === 0) && y, U = O ? i("ERROR_FETCHING_OBSERVATIONS") : null, B = C ? i("NO_OBSERVATIONS_FOUND") : void 0, V = _.length > 0 && !f && !O, E = n.titleTranslationKey, v = E ? i(E) : "";
168
+ return /* @__PURE__ */ S(
169
169
  "div",
170
170
  {
171
171
  id: "observations",
172
- "data-testid": E ? `observations-${y}` : "observations",
172
+ "data-testid": E ? `observations-${v}` : "observations",
173
173
  "aria-label": "observations-aria-label",
174
- className: N.observations,
174
+ className: I.observations,
175
175
  children: [
176
176
  /* @__PURE__ */ u(
177
- M,
177
+ j,
178
178
  {
179
179
  id: "observations-title",
180
- testId: E ? `observations-title-${y}` : "observations-title",
181
- title: y,
182
- className: N.title,
183
- children: /* @__PURE__ */ u("p", { children: y })
180
+ testId: E ? `observations-title-${v}` : "observations-title",
181
+ title: v,
182
+ className: I.title,
183
+ children: /* @__PURE__ */ u("p", { children: v })
184
184
  }
185
185
  ),
186
- B ? /* @__PURE__ */ u(
186
+ V ? /* @__PURE__ */ u(
187
187
  ie,
188
188
  {
189
- groupedData: $,
190
- title: y,
191
- hideThumbnail: p
189
+ groupedData: _,
190
+ title: v,
191
+ hideThumbnail: b
192
192
  }
193
193
  ) : /* @__PURE__ */ u(
194
- W,
194
+ z,
195
195
  {
196
196
  headers: L,
197
197
  rows: [],
198
198
  ariaLabel: i("OBSERVATIONS"),
199
199
  loading: f,
200
200
  errorStateMessage: U,
201
- emptyStateMessage: x,
201
+ emptyStateMessage: B,
202
202
  dataTestId: "observations-table"
203
203
  }
204
204
  )