@bahmni/clinical-app 0.0.1-dev.441 → 0.0.1-dev.442

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,5 +1,5 @@
1
- import { jsx as d, jsxs as h, Fragment as x } from "react/jsx-runtime";
2
- import { d as G, u as W, z as Y, P as J, s as X, h as Z, $ as ee, a as te } from "./index-CXVD8oVf.js";
1
+ import { jsx as d, jsxs as h, Fragment as G } from "react/jsx-runtime";
2
+ import { d as Q, u as W, z as J, a as Y, J as X, h as Z, $ as ee, b as te } from "./index-DUipt5G5.js";
3
3
  import { useQuery as ae } from "@tanstack/react-query";
4
4
  import { useState as l, useCallback as _, useEffect as I, useMemo as p } from "react";
5
5
  const ne = "DocumentsTable-module_documentsTableBody__6iR3w", oe = "DocumentsTable-module_viewAttachmentsLink__aQ1on", de = "DocumentsTable-module_documentViewerContainer__F5m8D", re = "DocumentsTable-module_attachmentItem__17KA7", se = "DocumentsTable-module_attachmentCounter__WFiI3", me = "DocumentsTable-module_attachmentError__RI4U2", ce = "DocumentsTable-module_documentIframe__ptq5I", le = "DocumentsTable-module_documentImage__KQVgS", r = {
@@ -38,13 +38,13 @@ const Te = [
38
38
  null
39
39
  ), [$, O] = l(
40
40
  /* @__PURE__ */ new Set()
41
- ), g = G(), { t: n } = W(), { addNotification: L } = Y(), k = Number(a?.pageSize) || 5, [f, C] = l(1), [u, V] = l(k), [F, A] = l(void 0), M = _((e) => {
41
+ ), g = Q(), { t: n } = W(), { addNotification: L } = J(), k = Number(a?.pageSize) || 5, [f, C] = l(1), [u, V] = l(k), [F, A] = l(void 0), M = _((e) => {
42
42
  U(e), w(!0);
43
43
  }, []), H = _(() => {
44
44
  w(!1), U(null), O(/* @__PURE__ */ new Set());
45
45
  }, []), v = _((e) => {
46
46
  O((t) => new Set(t).add(e));
47
- }, []), { data: i, isLoading: P, isError: y, error: b } = ae({
47
+ }, []), { data: i, isLoading: q, isError: y, error: b } = ae({
48
48
  queryKey: [
49
49
  "documents",
50
50
  g,
@@ -53,7 +53,7 @@ const Te = [
53
53
  u
54
54
  ],
55
55
  enabled: !!g,
56
- queryFn: () => J(
56
+ queryFn: () => Y(
57
57
  g,
58
58
  E,
59
59
  u,
@@ -89,7 +89,7 @@ const Te = [
89
89
  e.signal.aborted || O(t);
90
90
  })(), () => e.abort();
91
91
  }, [s, o]);
92
- const q = _(
92
+ const z = _(
93
93
  (e, t) => {
94
94
  t !== u ? (V(t), C(1), A(void 0)) : C(e);
95
95
  },
@@ -97,7 +97,7 @@ const Te = [
97
97
  ), N = p(
98
98
  () => a?.fields ?? Te,
99
99
  [a?.fields]
100
- ), z = p(() => [...i?.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), [i]), j = p(() => ie(N, n), [N, n]), K = p(
100
+ ), j = p(() => [...i?.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), [i]), P = p(() => ie(N, n), [N, n]), K = p(
101
101
  () => N.map((e) => ({
102
102
  key: e,
103
103
  sortable: e !== "attachments"
@@ -106,7 +106,7 @@ const Te = [
106
106
  ), T = p(
107
107
  () => o ? B(o) : [],
108
108
  [o]
109
- ), Q = _(
109
+ ), x = _(
110
110
  (e, t) => {
111
111
  switch (t) {
112
112
  case "documentIdentifier":
@@ -137,24 +137,24 @@ const Te = [
137
137
  },
138
138
  [M, n]
139
139
  );
140
- return /* @__PURE__ */ h(x, { children: [
140
+ return /* @__PURE__ */ h(G, { children: [
141
141
  /* @__PURE__ */ d("div", { "data-testid": "documents-table", children: /* @__PURE__ */ d(
142
142
  ee,
143
143
  {
144
- headers: j,
144
+ headers: P,
145
145
  ariaLabel: n("DOCUMENTS_TABLE_HEADING"),
146
- rows: z,
147
- loading: P,
146
+ rows: j,
147
+ loading: q,
148
148
  errorStateMessage: y ? b?.message : null,
149
149
  sortable: K,
150
150
  emptyStateMessage: n("DOCUMENTS_NO_RECORDS"),
151
- renderCell: Q,
151
+ renderCell: x,
152
152
  className: r.documentsTableBody,
153
153
  dataTestId: "documents-table",
154
154
  pageSize: u,
155
155
  totalItems: F,
156
156
  page: f,
157
- onPageChange: q
157
+ onPageChange: z
158
158
  }
159
159
  ) }),
160
160
  s && o && /* @__PURE__ */ d(
@@ -1,48 +1,48 @@
1
1
  import { jsx as n, jsxs as q, Fragment as ne } from "react/jsx-runtime";
2
- import { u as de, d as ie, v as le, k as me, H as ue, B as ce, b as fe, D as ye, w as Ne, N as he, c as ge, R as Te, h as pe, L as V, e as $, s as Oe, $ as K, W as be, q as Ie, a as Ee, f as _e, g as Ae } from "./index-CXVD8oVf.js";
3
- import { useQueryClient as ve, useQuery as E } from "@tanstack/react-query";
4
- import { useState as j, useMemo as d, useCallback as i } from "react";
5
- const Be = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_modalHeading__wnTmA", Re = "FormsTable-module_customAccordianItem__isszs", g = {
6
- formsTableBody: Be,
7
- modalHeading: Le,
8
- customAccordianItem: Re
9
- }, Ce = "startConsultation", Me = ({
10
- episodeOfCareUuids: _,
2
+ import { u as ie, d as de, c as le, k as me, H as ue, o as ce, E as fe, Q as ye, w as Te, D as he, R as Ne, e as ge, h as pe, L as V, T as $, J as Oe, $ as K, W as be, q as Ee, b as Ie, f as Ae, g as Re } from "./index-DUipt5G5.js";
3
+ import { useQueryClient as _e, useQuery as I } from "@tanstack/react-query";
4
+ import { useState as Q, useMemo as i, useCallback as d } from "react";
5
+ const Le = "FormsTable-module_formsTableBody__SvGha", Ce = "FormsTable-module_modalHeading__wnTmA", ve = "FormsTable-module_customAccordianItem__isszs", N = {
6
+ formsTableBody: Le,
7
+ modalHeading: Ce,
8
+ customAccordianItem: ve
9
+ }, Fe = "startConsultation", Me = ({
10
+ episodeOfCareUuids: A,
11
11
  encounterUuids: l,
12
- config: x,
13
- disableActions: z = !1,
12
+ config: z,
13
+ disableActions: j = !1,
14
14
  activeEncounterUuid: y = null
15
15
  }) => {
16
- const { t: o } = de(), m = ie(), [T, A] = j(!1), [t, v] = j(null), {
17
- numberOfVisits: Q,
16
+ const { t: o } = ie(), m = de(), [g, R] = Q(!1), [t, _] = Q(null), {
17
+ numberOfVisits: x,
18
18
  hideThumbnail: G = !1,
19
- forms: N
20
- } = x ?? {}, W = le(
21
- Ae.EDIT_OBSERVATIONS
22
- ), { userPrivileges: h } = me(), p = W && !z && !!y, B = ue(
23
- _,
19
+ forms: T
20
+ } = z ?? {}, J = le(
21
+ Re.EDIT_OBSERVATIONS
22
+ ), { userPrivileges: h } = me(), p = J && !j && !!y, L = ue(
23
+ A,
24
24
  l
25
- ), P = ve(), {
26
- data: L = [],
27
- isLoading: R,
28
- isError: C,
29
- error: Y,
30
- refetch: J
31
- } = E({
32
- queryKey: ["forms", m, _],
33
- queryFn: () => ce(m, void 0, Q),
34
- enabled: !!m && !B
35
- }), F = d(() => {
36
- let e = L;
25
+ ), W = _e(), {
26
+ data: C = [],
27
+ isLoading: v,
28
+ isError: F,
29
+ error: P,
30
+ refetch: Y
31
+ } = I({
32
+ queryKey: ["forms", m, A],
33
+ queryFn: () => ce(m, void 0, x),
34
+ enabled: !!m && !L
35
+ }), B = i(() => {
36
+ let e = C;
37
37
  return l && l.length > 0 && (e = e.filter(
38
38
  (r) => l.includes(r.encounterUuid)
39
- )), Array.isArray(N) && N.length > 0 && (e = e.filter(
40
- (r) => N.some((a) => a.toLowerCase() === r.formName.toLowerCase())
39
+ )), Array.isArray(T) && T.length > 0 && (e = e.filter(
40
+ (r) => T.some((a) => a.toLowerCase() === r.formName.toLowerCase())
41
41
  )), e;
42
- }, [L, l, N]), { data: D = [] } = E({
42
+ }, [C, l, T]), { data: D = [] } = I({
43
43
  queryKey: ["observationForms"],
44
44
  queryFn: () => fe()
45
- }), U = i(
45
+ }), U = d(
46
46
  (e) => {
47
47
  const r = D.find(
48
48
  (s) => s.name.toLowerCase() === e.toLowerCase()
@@ -55,7 +55,7 @@ const Be = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_mo
55
55
  );
56
56
  },
57
57
  [D, h]
58
- ), u = i(
58
+ ), u = d(
59
59
  (e) => !y || e.encounterUuid !== y ? !1 : U(e.formName),
60
60
  [y, U]
61
61
  ), {
@@ -63,40 +63,40 @@ const Be = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_mo
63
63
  isLoading: X,
64
64
  isError: Z,
65
65
  error: b
66
- } = E({
66
+ } = I({
67
67
  queryKey: ["formsEncounterFHIR", t?.encounterUuid],
68
68
  queryFn: () => ye(t.encounterUuid),
69
- enabled: !!t?.encounterUuid && T
69
+ enabled: !!t?.encounterUuid && g
70
70
  });
71
- Ne(
71
+ Te(
72
72
  (e) => {
73
- e.patientUUID === m && (J(), P.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
73
+ e.patientUUID === m && (Y(), W.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
74
74
  },
75
75
  [m]
76
76
  );
77
- const ee = d(() => !O?.entry || !t?.formName ? [] : O.entry.filter((e) => e.resource?.resourceType === "Observation").map((e) => e.resource).filter((e) => he(e) ? ge(e)?.toLowerCase() === t.formName.toLowerCase() : !0), [O, t?.formName]), re = d(() => {
77
+ const ee = i(() => !O?.entry || !t?.formName ? [] : O.entry.filter((e) => e.resource?.resourceType === "Observation").map((e) => e.resource).filter((e) => he(e) ? Ne(e)?.toLowerCase() === t.formName.toLowerCase() : !0), [O, t?.formName]), re = i(() => {
78
78
  if (b)
79
- return Te(b).message;
80
- }, [b]), c = d(
79
+ return ge(b).message;
80
+ }, [b]), c = i(
81
81
  () => [
82
82
  { key: "recordedOn", header: o("RECORDED_ON") },
83
83
  { key: "recordedBy", header: o("RECORDED_BY") }
84
84
  ],
85
85
  [o]
86
- ), S = d(
86
+ ), S = i(
87
87
  () => [...c, { key: "actions", header: o("ACTIONS") }],
88
88
  [c, o]
89
- ), ae = i(
89
+ ), ae = d(
90
90
  (e) => p && e.some((r) => u(r)) ? S : c,
91
91
  [p, u, S, c]
92
- ), oe = c, te = d(
92
+ ), oe = c, te = i(
93
93
  () => [
94
94
  { key: "recordedOn", sortable: !0 },
95
95
  { key: "recordedBy", sortable: !0 }
96
96
  ],
97
97
  []
98
- ), M = d(() => {
99
- const e = F.reduce(
98
+ ), M = i(() => {
99
+ const e = B.reduce(
100
100
  (r, a) => {
101
101
  const s = a.formName;
102
102
  r[s] ??= [];
@@ -120,13 +120,13 @@ const Be = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_mo
120
120
  )
121
121
  })
122
122
  ).sort((r, a) => r.formName.localeCompare(a.formName));
123
- }, [F, o]), k = i((e) => {
124
- v(e), A(!0);
125
- }, []), w = i(() => {
126
- A(!1), v(null);
127
- }, []), I = i((e) => {
123
+ }, [B, o]), k = d((e) => {
124
+ _(e), R(!0);
125
+ }, []), w = d(() => {
126
+ R(!1), _(null);
127
+ }, []), E = d((e) => {
128
128
  globalThis.dispatchEvent(
129
- new CustomEvent(Ce, {
129
+ new CustomEvent(Fe, {
130
130
  detail: {
131
131
  editOnly: "observationForms",
132
132
  editTitle: "EDIT_OBSERVATION_FORM_TITLE",
@@ -136,7 +136,7 @@ const Be = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_mo
136
136
  }
137
137
  })
138
138
  );
139
- }, []), H = i(
139
+ }, []), H = d(
140
140
  (e, r) => {
141
141
  switch (r) {
142
142
  case "recordedOn":
@@ -151,7 +151,7 @@ const Be = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_mo
151
151
  kind: "ghost",
152
152
  size: "sm",
153
153
  testId: `edit-form-${e.encounterUuid}`,
154
- onClick: () => I(e),
154
+ onClick: () => E(e),
155
155
  children: /* @__PURE__ */ n($, {})
156
156
  }
157
157
  ) : null;
@@ -159,29 +159,29 @@ const Be = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_mo
159
159
  return null;
160
160
  }
161
161
  },
162
- [k, I, u, o]
162
+ [k, E, u, o]
163
163
  );
164
164
  return /* @__PURE__ */ q(ne, { children: [
165
- /* @__PURE__ */ n("div", { id: "forms-table", "data-testid": "forms-table", children: R || C || M.length === 0 || B ? /* @__PURE__ */ n(
165
+ /* @__PURE__ */ n("div", { id: "forms-table", "data-testid": "forms-table", children: v || F || M.length === 0 || L ? /* @__PURE__ */ n(
166
166
  K,
167
167
  {
168
168
  headers: oe,
169
169
  ariaLabel: o("FORMS_HEADING"),
170
170
  rows: [],
171
- loading: R,
172
- errorStateMessage: C ? Y?.message : void 0,
171
+ loading: v,
172
+ errorStateMessage: F ? P?.message : void 0,
173
173
  emptyStateMessage: o("FORMS_UNAVAILABLE"),
174
174
  renderCell: H,
175
- className: g.formsTableBody,
175
+ className: N.formsTableBody,
176
176
  dataTestId: "forms-table"
177
177
  }
178
178
  ) : /* @__PURE__ */ n(be, { align: "start", children: M.map((e, r) => {
179
179
  const { formName: a, records: s } = e, f = ae(s);
180
180
  return /* @__PURE__ */ n(
181
- Ie,
181
+ Ee,
182
182
  {
183
183
  title: a,
184
- className: g.customAccordianItem,
184
+ className: N.customAccordianItem,
185
185
  testId: `accordian-title-${a}`,
186
186
  open: r === 0,
187
187
  children: /* @__PURE__ */ n(
@@ -195,7 +195,7 @@ const Be = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_mo
195
195
  sortable: te,
196
196
  emptyStateMessage: o("FORMS_UNAVAILABLE"),
197
197
  renderCell: H,
198
- className: g.formsTableBody,
198
+ className: N.formsTableBody,
199
199
  dataTestId: `forms-table-${a}`
200
200
  }
201
201
  )
@@ -203,14 +203,14 @@ const Be = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_mo
203
203
  a
204
204
  );
205
205
  }) }) }),
206
- T && t && /* @__PURE__ */ n(
207
- Ee,
206
+ g && t && /* @__PURE__ */ n(
207
+ Ie,
208
208
  {
209
209
  id: "modalIdForActionAreaLayout",
210
210
  portalId: "main-display-area",
211
- open: T,
211
+ open: g,
212
212
  onRequestClose: w,
213
- modalHeading: /* @__PURE__ */ q("div", { className: g.modalHeading, children: [
213
+ modalHeading: /* @__PURE__ */ q("div", { className: N.modalHeading, children: [
214
214
  /* @__PURE__ */ n("span", { children: t.formName }),
215
215
  p && u(t) && /* @__PURE__ */ n(
216
216
  V,
@@ -220,7 +220,7 @@ const Be = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_mo
220
220
  size: "sm",
221
221
  testId: `edit-form-modal-${t.encounterUuid}`,
222
222
  onClick: () => {
223
- w(), I(t);
223
+ w(), E(t);
224
224
  },
225
225
  children: /* @__PURE__ */ n($, {})
226
226
  }
@@ -231,7 +231,7 @@ const Be = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_mo
231
231
  size: "md",
232
232
  testId: "form-details-modal",
233
233
  children: /* @__PURE__ */ n(
234
- _e,
234
+ Ae,
235
235
  {
236
236
  observations: ee,
237
237
  isLoading: X,
@@ -1,5 +1,5 @@
1
- import { c as s, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-DHndX1Gs.js";
2
- import { c3 as d, c4 as f, c5 as e } from "./index-CXVD8oVf.js";
1
+ import { c as s, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-CACpDKFs.js";
2
+ import { c3 as d, c4 as f, c5 as e } from "./index-DUipt5G5.js";
3
3
  var p = (a) => {
4
4
  const [r, t] = s({
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-DHndX1Gs.js";
2
- import { c3 as v, c4 as C, c5 as e } from "./index-CXVD8oVf.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-CACpDKFs.js";
2
+ import { c3 as v, c4 as C, c5 as e } from "./index-DUipt5G5.js";
3
3
  var h = (t) => {
4
4
  const [r, o] = s({
5
5
  prefix: "TanstackQueryDevtools"
@@ -0,0 +1,246 @@
1
+ import { jsxs as S, jsx as n } from "react/jsx-runtime";
2
+ import { d as H, z as x, u as V, t as M, H as j, n as G, r as J, w as X, p as P, i as Y, j as W, m as Z, l as ee, $ as ae, s as se, S as B, v as te, x as re, h as ie, y as oe, A as ne, B as de, X as le } from "./index-DUipt5G5.js";
3
+ import { useQueries as ue, useQuery as ce } from "@tanstack/react-query";
4
+ import { useRef as pe, useEffect as L, useMemo as g } from "react";
5
+ const me = "Observations-module_observations__RKSyo", be = "Observations-module_title__TJL3z", he = "Observations-module_wrapper__muk2L", ve = "Observations-module_secondary__14nuS", O = {
6
+ observations: me,
7
+ title: be,
8
+ wrapper: he,
9
+ secondary: ve
10
+ }, U = (s, l, o, d, c, t) => {
11
+ const r = te(s, l, c), e = r.value, p = re(e);
12
+ let i = e;
13
+ p === "Image" && (i = /* @__PURE__ */ n(
14
+ ne,
15
+ {
16
+ imageSrc: e,
17
+ alt: e,
18
+ id: `${e}-img`,
19
+ hideThumbnail: t
20
+ }
21
+ )), p === "Video" && (i = /* @__PURE__ */ n(
22
+ de,
23
+ {
24
+ id: `${e}-video`,
25
+ videoSrc: e,
26
+ hideThumbnail: t
27
+ }
28
+ )), p === "PDF" && (i = /* @__PURE__ */ n(le, { id: `${e}-pdf`, src: e }));
29
+ const m = /* @__PURE__ */ S("div", { className: O.wrapper, children: [
30
+ /* @__PURE__ */ n("span", { children: r.header.display }),
31
+ r.header.referenceRange && /* @__PURE__ */ n("span", { className: O.secondary, children: r.header.referenceRange })
32
+ ] }), u = c("OBSERVATIONS_RECORDED_BY", {
33
+ provider: r.provider
34
+ }), b = s.effectiveDateTime ? ie(s.effectiveDateTime, c, !0).formattedResult : void 0, T = /* @__PURE__ */ S("div", { className: O.wrapper, children: [
35
+ /* @__PURE__ */ n("span", { children: u }),
36
+ b && /* @__PURE__ */ n("span", { className: O.secondary, children: b })
37
+ ] }), h = s.display, v = s.observationValue?.isAbnormal ? "abnormal-obs" : "obs", f = d ? `${d}-${v}-${h}-${o}-${l}` : `${v}-${h}-${o}-${l}`;
38
+ return /* @__PURE__ */ n(
39
+ oe,
40
+ {
41
+ header: m,
42
+ value: i,
43
+ info: T,
44
+ id: f,
45
+ testId: f,
46
+ ariaLabel: f
47
+ },
48
+ `obs-${s.id}`
49
+ );
50
+ }, ye = (s, l, o, d, c, t, r) => /* @__PURE__ */ n(
51
+ B,
52
+ {
53
+ title: s.display,
54
+ id: `grouped-obs-${s.display}-${d}`,
55
+ open: o,
56
+ children: s.members?.map(
57
+ (e, p) => U(
58
+ e,
59
+ p,
60
+ c,
61
+ t,
62
+ l,
63
+ r
64
+ )
65
+ )
66
+ },
67
+ `grouped-obs-${s.id}`
68
+ ), Oe = ({
69
+ groupedData: s,
70
+ title: l = "",
71
+ hideThumbnail: o
72
+ }) => {
73
+ const { t: d } = V(), c = (t, r, e) => {
74
+ const p = se(t.encounterDetails, d);
75
+ return /* @__PURE__ */ S(
76
+ B,
77
+ {
78
+ title: p,
79
+ id: `encounter-${t.encounterId}`,
80
+ open: r,
81
+ children: [
82
+ t.observations.map(
83
+ (i, m) => U(
84
+ i,
85
+ m,
86
+ e,
87
+ l,
88
+ d,
89
+ o
90
+ )
91
+ ),
92
+ t.groupedObservations.map(
93
+ (i, m) => ye(
94
+ i,
95
+ d,
96
+ r,
97
+ m,
98
+ e,
99
+ l,
100
+ o
101
+ )
102
+ )
103
+ ]
104
+ },
105
+ `encounter-${t.encounterId}`
106
+ );
107
+ };
108
+ return /* @__PURE__ */ n(
109
+ "div",
110
+ {
111
+ id: "obs-by-encounter",
112
+ "data-testid": "obs-by-encounter-test-id",
113
+ "aria-label": "obs-by-encounter-aria-label",
114
+ children: s.map(
115
+ (t, r) => c(t, r === 0, r)
116
+ )
117
+ }
118
+ );
119
+ }, fe = (s) => ["conceptUuid", s], Re = (s, l, o, d) => [
120
+ "observations",
121
+ s,
122
+ ...l,
123
+ o,
124
+ d
125
+ ], Se = ({
126
+ config: s,
127
+ episodeOfCareUuids: l,
128
+ encounterUuids: o
129
+ }) => {
130
+ const d = s, {
131
+ conceptNames: c = [],
132
+ conceptUuid: t = [],
133
+ hideThumbnail: r = !1,
134
+ scope: e = "all"
135
+ } = d, p = pe(/* @__PURE__ */ new Set()), i = H(), { addNotification: m } = x(), { t: u } = V(), b = ue({
136
+ queries: c.map((a) => ({
137
+ queryKey: fe(a),
138
+ queryFn: () => M(a),
139
+ enabled: !!a
140
+ }))
141
+ });
142
+ L(() => {
143
+ const a = b.some((z) => z.isError), y = p.current.size > 0;
144
+ a && !y ? (m({
145
+ title: u("ERROR_DEFAULT_TITLE"),
146
+ message: u("ERROR_FETCHING_OBSERVATIONS"),
147
+ type: "error"
148
+ }), p.current.add(0)) : !a && y && p.current.clear();
149
+ }, [b, m, u]);
150
+ const T = g(() => b.map((a) => a.data?.uuid).filter((a) => !!a), [b]), h = g(() => [.../* @__PURE__ */ new Set([...T, ...t])], [T, t]), v = g(() => c.length === 0 ? !0 : b.every((a) => !a.isLoading), [b, c.length]), f = e === "latest" || e === "latest-encounter", w = j(
151
+ l,
152
+ o
153
+ ), {
154
+ data: R,
155
+ isLoading: F,
156
+ isError: I,
157
+ refetch: N
158
+ } = ce({
159
+ queryKey: Re(
160
+ i,
161
+ h,
162
+ o,
163
+ e
164
+ ),
165
+ queryFn: () => f ? G(
166
+ i,
167
+ h,
168
+ o
169
+ ) : J(
170
+ i,
171
+ h,
172
+ o
173
+ ),
174
+ enabled: !!i && h.length > 0 && v && !w
175
+ });
176
+ X(
177
+ (a) => {
178
+ a.patientUUID === i && a.updatedConcepts.size > 0 && [...a.updatedConcepts.keys()].some(
179
+ (y) => h.includes(y)
180
+ ) && N();
181
+ },
182
+ [i, N]
183
+ ), L(() => {
184
+ I && m({
185
+ title: u("ERROR_DEFAULT_TITLE"),
186
+ message: u("ERROR_FETCHING_OBSERVATIONS"),
187
+ type: "error"
188
+ });
189
+ }, [I]);
190
+ const $ = g(() => {
191
+ if (!R) return [];
192
+ let a = P(R);
193
+ e === "latest-encounter" && (a = Y(a));
194
+ const y = W(a);
195
+ return Z(y);
196
+ }, [R, e]), C = [
197
+ { key: "name", header: "name" },
198
+ { key: "value", header: "value" },
199
+ { key: "form", header: "form" }
200
+ ], A = F || !v, D = I && v, K = (!R || R.entry?.length === 0 || h.length === 0) && v, k = D ? u("ERROR_FETCHING_OBSERVATIONS") : null, q = K ? u("NO_OBSERVATIONS_FOUND") : void 0, Q = $.length > 0 && !A && !D, E = d.titleTranslationKey, _ = E ? u(E) : "";
201
+ return /* @__PURE__ */ S(
202
+ "div",
203
+ {
204
+ id: "observations",
205
+ "data-testid": E ? `observations-${_}` : "observations",
206
+ "aria-label": "observations-aria-label",
207
+ className: O.observations,
208
+ children: [
209
+ /* @__PURE__ */ n(
210
+ ee,
211
+ {
212
+ id: "observations-title",
213
+ testId: E ? `observations-title-${_}` : "observations-title",
214
+ title: _,
215
+ className: O.title,
216
+ children: /* @__PURE__ */ n("p", { children: _ })
217
+ }
218
+ ),
219
+ Q ? /* @__PURE__ */ n(
220
+ Oe,
221
+ {
222
+ groupedData: $,
223
+ title: _,
224
+ hideThumbnail: r
225
+ }
226
+ ) : /* @__PURE__ */ n(
227
+ ae,
228
+ {
229
+ headers: C,
230
+ rows: [],
231
+ ariaLabel: u("OBSERVATIONS"),
232
+ loading: A,
233
+ errorStateMessage: k,
234
+ emptyStateMessage: q ?? u("NO_OBSERVATIONS_AVAILABLE"),
235
+ dataTestId: "observations-table"
236
+ }
237
+ )
238
+ ]
239
+ }
240
+ );
241
+ };
242
+ export {
243
+ fe as conceptUuidQueryKeys,
244
+ Se as default,
245
+ Re as observationsQueryKeys
246
+ };
@@ -1,4 +1,4 @@
1
- import { c6 as we, c7 as z, c8 as xt, c9 as B, c4 as q, c5 as y, ca as Ro, cb as ye, cc as R, cd as _, ce as k, cf as N, cg as A, ch as bs, ci as ir, cj as $e, ck as G, cl as Hn, cm as Vn, cn as dt, co as D, cp as xs, cq as cn, cr as Be, cs as ws, ct as qt, cu as zt, cv as $s, cw as Cs, cx as $n, cy as Ss, cz as Nr, cA as Bt, cB as zo, cC as ks, cD as Es, cE as j, cF as Gr, cG as Ms, cH as Ds, cI as sr, cJ as As, cK as Ts, cL as zn, cM as Fs, cN as Is, cO as Z, cP as Ps, cQ as Ls } from "./index-CXVD8oVf.js";
1
+ import { c6 as we, c7 as z, c8 as xt, c9 as B, c4 as q, c5 as y, ca as Ro, cb as ye, cc as R, cd as _, ce as k, cf as N, cg as A, ch as bs, ci as ir, cj as $e, ck as G, cl as Hn, cm as Vn, cn as dt, co as D, cp as xs, cq as cn, cr as Be, cs as ws, ct as qt, cu as zt, cv as $s, cw as Cs, cx as $n, cy as Ss, cz as Nr, cA as Bt, cB as zo, cC as ks, cD as Es, cE as j, cF as Gr, cG as Ms, cH as Ds, cI as sr, cJ as As, cK as Ts, cL as zn, cM as Fs, cN as Is, cO as Z, cP as Ps, cQ as Ls } from "./index-DUipt5G5.js";
2
2
  var Os = (e) => e != null, qs = (e) => e.filter(Os);
3
3
  function _s(e) {
4
4
  return (...t) => {
@@ -1,4 +1,4 @@
1
- import { c1 as i, c2 as o } from "./index-CXVD8oVf.js";
1
+ import { c1 as i, c2 as o } from "./index-DUipt5G5.js";
2
2
  import "react";
3
3
  import "react/jsx-runtime";
4
4
  import "@tanstack/react-query";
@@ -1,14 +1,14 @@
1
1
  import { jsx as s } from "react/jsx-runtime";
2
- import { u as g, k as u, bQ as b, b_ as f, b$ as x, c0 as _, aO as p, bW as N } from "./index-CXVD8oVf.js";
2
+ import { u as g, k as u, bQ as b, b_ as f, b$ as x, c0 as _, aO as p, bW as N } from "./index-DUipt5G5.js";
3
3
  import { lazy as h, useMemo as t, Suspense as C } from "react";
4
4
  import "@tanstack/react-query";
5
- import { u as E } from "./hook-CTrQG8ZB.js";
5
+ import { u as E } from "./hook-CovTOTdy.js";
6
6
  const L = {
7
7
  "org.bahmni.clinical.v2.search": h(
8
- () => import("./index-Da-7cqE_.js")
8
+ () => import("./index-BSNKwD2R.js")
9
9
  )
10
- }, v = "index-module_page__16xxw", I = "index-module_loading__wNI-4", O = "index-module_message__Ib5Iw", l = {
11
- page: v,
10
+ }, S = "index-module_page__16xxw", I = "index-module_loading__wNI-4", O = "index-module_message__Ib5Iw", l = {
11
+ page: S,
12
12
  loading: I,
13
13
  message: O
14
14
  }, k = () => {