@bahmni/clinical-app 0.0.1-dev.413 → 0.0.1-dev.414

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