@bahmni/clinical-app 0.0.1-dev.367 → 0.0.1-dev.369

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.
Files changed (34) hide show
  1. package/dist/{ConsultationPage-Crbvf2VG.js → ConsultationPage-CsvlKxDv.js} +1767 -1767
  2. package/dist/{DocumentsTable-7Vlcy4Vm-CybWF3rN.js → DocumentsTable-B-G7w_Ik-wcv6CsoB.js} +33 -33
  3. package/dist/{FormsTable-CJVrUcXB-C6R7Rku1.js → FormsTable-C8tKxM7t-1CbhozQB.js} +50 -50
  4. package/dist/{LNWAZHJI-BncRt-I9.js → LNWAZHJI-C15yUhzq.js} +2 -2
  5. package/dist/{MWZ6AO7Z-D47lwRxS.js → MWZ6AO7Z-BvWshUwD.js} +2 -2
  6. package/dist/{Observations-Be_tZGhM-C6wrZSOn.js → Observations-BZqdA0Xj-BRzAgAHR.js} +55 -55
  7. package/dist/{YPM2AS64-AgEWaI9q.js → YPM2AS64-jSyFdy12.js} +181 -181
  8. package/dist/{hook-CWMbSSog.js → hook-DcJywswg.js} +1 -1
  9. package/dist/{index-DET3dQtT.js → index-Ctx7k5_5.js} +47563 -46894
  10. package/dist/{index-zVFxStvV.js → index-DEgE4jS-.js} +2 -2
  11. package/dist/index-N1oQjWLz.js +80 -0
  12. package/dist/index.css +1 -1
  13. package/dist/index.js +1 -1
  14. package/dist/pages/list/__tests__/__mocks__/listMocks.d.ts +1 -1
  15. package/dist/pages/list/__tests__/__mocks__/listMocks.d.ts.map +1 -1
  16. package/dist/pages/list/constants.d.ts +1 -1
  17. package/dist/pages/list/constants.d.ts.map +1 -1
  18. package/dist/pages/list/extensions/searchHandler/__tests__/__mocks__/searchHandlerMocks.d.ts +1 -1
  19. package/dist/pages/list/extensions/searchHandler/__tests__/__mocks__/searchHandlerMocks.d.ts.map +1 -1
  20. package/dist/pages/list/extensions/searchHandler/index.d.ts +1 -1
  21. package/dist/pages/list/extensions/searchHandler/index.d.ts.map +1 -1
  22. package/dist/pages/list/index.d.ts.map +1 -1
  23. package/dist/providers/clinicalConfig/models.d.ts +1 -2
  24. package/dist/providers/clinicalConfig/models.d.ts.map +1 -1
  25. package/package.json +1 -1
  26. package/dist/extensions/__tests__/__mocks__/extensionsMocks.d.ts +0 -8
  27. package/dist/extensions/__tests__/__mocks__/extensionsMocks.d.ts.map +0 -1
  28. package/dist/extensions/index.d.ts +0 -3
  29. package/dist/extensions/index.d.ts.map +0 -1
  30. package/dist/extensions/models.d.ts +0 -15
  31. package/dist/extensions/models.d.ts.map +0 -1
  32. package/dist/extensions/utils.d.ts +0 -5
  33. package/dist/extensions/utils.d.ts.map +0 -1
  34. package/dist/index-Dv_k-Ow0.js +0 -89
@@ -1,7 +1,7 @@
1
- import { jsx as r, jsxs as p, Fragment as x } from "react/jsx-runtime";
2
- import { g as G, u as Y, K as W, w as J, a as X, b as Z, U as ee, p as te } from "./index-DET3dQtT.js";
1
+ import { jsx as r, jsxs as p, Fragment as Q } from "react/jsx-runtime";
2
+ import { g as W, u as x, G as Y, M as J, w as X, a as Z, W as ee, p as te } from "./index-Ctx7k5_5.js";
3
3
  import { useQuery as ae } from "@tanstack/react-query";
4
- import { useState as l, useCallback as h, useEffect as I, useMemo as _ } from "react";
4
+ import { useState as l, useCallback as h, useEffect as D, 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,15 +33,15 @@ const Te = [
33
33
  "attachments",
34
34
  "uploadedOn",
35
35
  "uploadedBy"
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: g }) => {
37
- const [s, S] = l(!1), [o, U] = l(
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 }] : [], Ie = ({ config: a, encounterUuids: g }) => {
37
+ const [s, w] = l(!1), [o, M] = l(
38
38
  null
39
39
  ), [$, O] = l(
40
40
  /* @__PURE__ */ new Set()
41
- ), E = G(), { t: n } = Y(), { addNotification: L } = W(), k = Number(a?.pageSize) || 5, [f, C] = l(1), [u, V] = l(k), [F, A] = l(void 0), M = h((e) => {
42
- U(e), S(!0);
41
+ ), E = W(), { t: n } = x(), { addNotification: U } = Y(), k = Number(a?.pageSize) || 5, [f, C] = l(1), [u, V] = l(k), [F, A] = l(void 0), L = h((e) => {
42
+ M(e), w(!0);
43
43
  }, []), H = h(() => {
44
- S(!1), U(null), O(/* @__PURE__ */ new Set());
44
+ w(!1), M(null), O(/* @__PURE__ */ new Set());
45
45
  }, []), v = h((e) => {
46
46
  O((t) => new Set(t).add(e));
47
47
  }, []), { data: i, isLoading: q, isError: b, error: y } = ae({
@@ -60,53 +60,53 @@ const Te = [
60
60
  f
61
61
  )
62
62
  });
63
- I(() => {
63
+ D(() => {
64
64
  i && A(i.total);
65
- }, [i]), I(() => {
65
+ }, [i]), D(() => {
66
66
  C(1), A(void 0);
67
- }, [E]), I(() => {
68
- b && L({
67
+ }, [E]), D(() => {
68
+ b && U({
69
69
  title: n("ERROR_DEFAULT_TITLE"),
70
70
  message: y?.message ?? "",
71
71
  type: "error"
72
72
  });
73
- }, [b, y, L, n]), I(() => {
73
+ }, [b, y, U, n]), D(() => {
74
74
  const e = new AbortController();
75
75
  return (async () => {
76
76
  if (!s || !o) return;
77
77
  const t = /* @__PURE__ */ new Set(), m = B(o);
78
78
  for (let c = 0; c < m.length; c++) {
79
- const w = R(m[c].url);
79
+ const S = R(m[c].url);
80
80
  try {
81
- (await fetch(w, {
81
+ (await fetch(S, {
82
82
  method: "HEAD",
83
83
  signal: e.signal
84
84
  })).ok || t.add(c);
85
- } catch (D) {
86
- D instanceof Error && D.name !== "AbortError" && t.add(c);
85
+ } catch (N) {
86
+ N instanceof Error && N.name !== "AbortError" && t.add(c);
87
87
  }
88
88
  }
89
89
  e.signal.aborted || O(t);
90
90
  })(), () => e.abort();
91
91
  }, [s, o]);
92
- const K = h(
92
+ const j = h(
93
93
  (e, t) => {
94
94
  t !== u ? (V(t), C(1), A(void 0)) : C(e);
95
95
  },
96
96
  [u]
97
- ), N = _(
97
+ ), I = _(
98
98
  () => a?.fields ?? Te,
99
99
  [a?.fields]
100
- ), j = _(() => [...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 = _(() => ie(N, n), [N, n]), z = _(
101
- () => N.map((e) => ({
100
+ ), G = _(() => [...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 = _(() => ie(I, n), [I, n]), z = _(
101
+ () => I.map((e) => ({
102
102
  key: e,
103
103
  sortable: e !== "attachments"
104
104
  })),
105
- [N]
105
+ [I]
106
106
  ), T = _(
107
107
  () => o ? B(o) : [],
108
108
  [o]
109
- ), Q = h(
109
+ ), K = h(
110
110
  (e, t) => {
111
111
  switch (t) {
112
112
  case "documentIdentifier":
@@ -125,7 +125,7 @@ const Te = [
125
125
  return e.attachments.length > 0 || e.documentUrl ? /* @__PURE__ */ r(
126
126
  X,
127
127
  {
128
- onClick: () => M(e),
128
+ onClick: () => L(e),
129
129
  className: d.viewAttachmentsLink,
130
130
  "data-testid": `view-attachments-${e.id}`,
131
131
  children: n("DOCUMENTS_VIEW_ATTACHMENTS")
@@ -135,26 +135,26 @@ const Te = [
135
135
  return null;
136
136
  }
137
137
  },
138
- [M, n]
138
+ [L, n]
139
139
  );
140
- return /* @__PURE__ */ p(x, { children: [
140
+ return /* @__PURE__ */ p(Q, { children: [
141
141
  /* @__PURE__ */ r("div", { "data-testid": "documents-table", children: /* @__PURE__ */ r(
142
142
  ee,
143
143
  {
144
144
  headers: P,
145
145
  ariaLabel: n("DOCUMENTS_TABLE_HEADING"),
146
- rows: j,
146
+ rows: G,
147
147
  loading: q,
148
148
  errorStateMessage: b ? y?.message : null,
149
149
  sortable: z,
150
150
  emptyStateMessage: n("DOCUMENTS_NO_RECORDS"),
151
- renderCell: Q,
151
+ renderCell: K,
152
152
  className: d.documentsTableBody,
153
153
  dataTestId: "documents-table",
154
154
  pageSize: u,
155
155
  totalItems: F,
156
156
  page: f,
157
- onPageChange: K
157
+ onPageChange: j
158
158
  }
159
159
  ) }),
160
160
  s && o && /* @__PURE__ */ r(
@@ -169,8 +169,8 @@ 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"), w = (e.contentType?.toLowerCase().includes("image") ?? !1) || pe.test(e.url ?? ""), D = $.has(t);
173
- return m === "#" || D ? /* @__PURE__ */ p(
172
+ const m = R(e.url), c = e.contentType?.toLowerCase().includes("pdf"), S = (e.contentType?.toLowerCase().includes("image") ?? !1) || pe.test(e.url ?? ""), N = $.has(t);
173
+ return m === "#" || N ? /* @__PURE__ */ p(
174
174
  "div",
175
175
  {
176
176
  className: d.attachmentError,
@@ -196,7 +196,7 @@ const Te = [
196
196
  "/",
197
197
  T.length
198
198
  ] }),
199
- w ? /* @__PURE__ */ r(
199
+ S ? /* @__PURE__ */ r(
200
200
  "img",
201
201
  {
202
202
  src: m,
@@ -223,5 +223,5 @@ const Te = [
223
223
  ] });
224
224
  };
225
225
  export {
226
- Ne as default
226
+ Ie as default
227
227
  };
@@ -1,37 +1,37 @@
1
1
  import { jsx as i, jsxs as z, Fragment as ye } from "react/jsx-runtime";
2
- import { u as ge, g as pe, E as be, J as Oe, c as Ne, m as Te, h as Ee, f as Ie, e as Ae, d as _e, R as ve, H as Se, s as K, b as Fe, i as x, t as P, a as Re, U as G, S as Ue, $ as Ce, p as Be, Y as Le, O as De } from "./index-DET3dQtT.js";
3
- import { useQueryClient as Me, useQuery as N } from "@tanstack/react-query";
2
+ import { u as ge, g as pe, V as be, X as Ne, b as Oe, H as Te, h as Ie, c as Ee, e as Ae, f as _e, D as ve, C as Se, s as K, a as Fe, d as x, r as P, w as Ce, W as G, S as Re, $ as Be, p as De, Y as Le, Z as Ue } from "./index-Ctx7k5_5.js";
3
+ import { useQueryClient as Me, useQuery as O } from "@tanstack/react-query";
4
4
  import { useState as Q, useMemo as d, useCallback as l } from "react";
5
- const ke = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_modalHeading__wnTmA", we = "FormsTable-module_customAccordianItem__isszs", T = {
5
+ const ke = "FormsTable-module_formsTableBody__SvGha", we = "FormsTable-module_modalHeading__wnTmA", qe = "FormsTable-module_customAccordianItem__isszs", T = {
6
6
  formsTableBody: ke,
7
- modalHeading: qe,
8
- customAccordianItem: we
7
+ modalHeading: we,
8
+ customAccordianItem: qe
9
9
  }, He = "startConsultation", ze = ({
10
- episodeOfCareUuids: R,
10
+ episodeOfCareUuids: C,
11
11
  encounterUuids: u,
12
- config: J,
13
- disableActions: X = !1,
12
+ config: X,
13
+ disableActions: Z = !1,
14
14
  activeEncounterUuid: y = null
15
15
  }) => {
16
- const { t: n } = ge(), c = pe(), [g, U] = Q(!1), [s, C] = Q(null), {
17
- numberOfVisits: Z,
18
- hideThumbnail: W = !1,
16
+ const { t: n } = ge(), c = pe(), [g, R] = Q(!1), [s, B] = Q(null), {
17
+ numberOfVisits: W,
18
+ hideThumbnail: J = !1,
19
19
  forms: p
20
- } = J ?? {}, ee = be(
21
- De.EDIT_OBSERVATIONS
22
- ), { userPrivileges: b } = Oe(), E = ee && !X && !!y, B = Ne(
23
- R,
20
+ } = X ?? {}, ee = be(
21
+ Ue.EDIT_OBSERVATIONS
22
+ ), { userPrivileges: b } = Ne(), I = ee && !Z && !!y, D = Oe(
23
+ C,
24
24
  u
25
25
  ), re = Me(), {
26
26
  data: L = [],
27
- isLoading: D,
27
+ isLoading: U,
28
28
  isError: M,
29
29
  error: oe,
30
30
  refetch: ae
31
- } = N({
32
- queryKey: ["forms", c, R],
33
- queryFn: () => Te(c, void 0, Z),
34
- enabled: !!c && !B
31
+ } = O({
32
+ queryKey: ["forms", c, C],
33
+ queryFn: () => Te(c, void 0, W),
34
+ enabled: !!c && !D
35
35
  }), k = d(() => {
36
36
  let e = L;
37
37
  return u && u.length > 0 && (e = e.filter(
@@ -39,12 +39,12 @@ const ke = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
39
39
  )), Array.isArray(p) && p.length > 0 && (e = e.filter(
40
40
  (r) => p.some((o) => o.toLowerCase() === r.formName.toLowerCase())
41
41
  )), e;
42
- }, [L, u, p]), { data: O = [] } = N({
42
+ }, [L, u, p]), { data: N = [] } = O({
43
43
  queryKey: ["observationForms"],
44
- queryFn: () => Ee()
45
- }), q = l(
44
+ queryFn: () => Ie()
45
+ }), w = l(
46
46
  (e) => {
47
- const r = O.find((a) => a.name === e);
47
+ const r = N.find((a) => a.name === e);
48
48
  if (!r?.privileges || r.privileges.length === 0) return !0;
49
49
  if (!b || b.length === 0) return !1;
50
50
  const o = new Set(b.map((a) => a.name));
@@ -52,31 +52,31 @@ const ke = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
52
52
  (a) => o.has(a.privilegeName) && a.editable
53
53
  );
54
54
  },
55
- [O, b]
55
+ [N, b]
56
56
  ), f = l(
57
- (e) => !y || e.encounterUuid !== y ? !1 : q(e.formName),
58
- [y, q]
59
- ), w = l(
60
- (e) => O.find((r) => r.name === e)?.uuid,
61
- [O]
62
- ), I = d(() => {
57
+ (e) => !y || e.encounterUuid !== y ? !1 : w(e.formName),
58
+ [y, w]
59
+ ), q = l(
60
+ (e) => N.find((r) => r.name === e)?.uuid,
61
+ [N]
62
+ ), E = d(() => {
63
63
  if (s)
64
- return w(s.formName);
65
- }, [s, w]), {
64
+ return q(s.formName);
65
+ }, [s, q]), {
66
66
  data: m,
67
67
  isLoading: te,
68
68
  isError: se,
69
69
  error: A
70
- } = N({
71
- queryKey: ["formMetadata", I],
72
- queryFn: () => Ie(I),
73
- enabled: !!I && g
70
+ } = O({
71
+ queryKey: ["formMetadata", E],
72
+ queryFn: () => Ee(E),
73
+ enabled: !!E && g
74
74
  }), {
75
75
  data: _,
76
76
  isLoading: ne,
77
77
  isError: ie,
78
78
  error: v
79
- } = N({
79
+ } = O({
80
80
  queryKey: ["formsEncounterFHIR", s?.encounterUuid],
81
81
  queryFn: () => Ae(s.encounterUuid),
82
82
  enabled: !!s?.encounterUuid && g
@@ -127,8 +127,8 @@ const ke = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
127
127
  () => [...h, { key: "actions", header: n("ACTIONS") }],
128
128
  [h, n]
129
129
  ), ce = l(
130
- (e) => E && e.some((r) => f(r)) ? H : h,
131
- [E, f, H, h]
130
+ (e) => I && e.some((r) => f(r)) ? H : h,
131
+ [I, f, H, h]
132
132
  ), fe = h, he = d(
133
133
  () => [
134
134
  { key: "recordedOn", sortable: !0 },
@@ -161,9 +161,9 @@ const ke = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
161
161
  })
162
162
  ).sort((r, o) => r.formName.localeCompare(o.formName));
163
163
  }, [k, n]), $ = l((e) => {
164
- C(e), U(!0);
164
+ B(e), R(!0);
165
165
  }, []), Y = l(() => {
166
- U(!1), C(null);
166
+ R(!1), B(null);
167
167
  }, []), S = l((e) => {
168
168
  globalThis.dispatchEvent(
169
169
  new CustomEvent(He, {
@@ -180,7 +180,7 @@ const ke = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
180
180
  (e, r) => {
181
181
  switch (r) {
182
182
  case "recordedOn":
183
- return /* @__PURE__ */ i(Re, { onClick: () => $(e), children: e.recordedOn });
183
+ return /* @__PURE__ */ i(Ce, { onClick: () => $(e), children: e.recordedOn });
184
184
  case "recordedBy":
185
185
  return e.recordedBy;
186
186
  case "actions":
@@ -202,23 +202,23 @@ const ke = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
202
202
  [$, S, f, n]
203
203
  );
204
204
  return /* @__PURE__ */ z(ye, { children: [
205
- /* @__PURE__ */ i("div", { id: "forms-table", "data-testid": "forms-table", children: D || M || V.length === 0 || B ? /* @__PURE__ */ i(
205
+ /* @__PURE__ */ i("div", { id: "forms-table", "data-testid": "forms-table", children: U || M || V.length === 0 || D ? /* @__PURE__ */ i(
206
206
  G,
207
207
  {
208
208
  headers: fe,
209
209
  ariaLabel: n("FORMS_HEADING"),
210
210
  rows: [],
211
- loading: D,
211
+ loading: U,
212
212
  errorStateMessage: M ? oe?.message : void 0,
213
213
  emptyStateMessage: n("FORMS_UNAVAILABLE"),
214
214
  renderCell: j,
215
215
  className: T.formsTableBody,
216
216
  dataTestId: "forms-table"
217
217
  }
218
- ) : /* @__PURE__ */ i(Ue, { align: "start", children: V.map((e, r) => {
218
+ ) : /* @__PURE__ */ i(Re, { align: "start", children: V.map((e, r) => {
219
219
  const { formName: o, records: a } = e, t = ce(a);
220
220
  return /* @__PURE__ */ i(
221
- Ce,
221
+ Be,
222
222
  {
223
223
  title: o,
224
224
  className: T.customAccordianItem,
@@ -244,7 +244,7 @@ const ke = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
244
244
  );
245
245
  }) }) }),
246
246
  g && s && /* @__PURE__ */ i(
247
- Be,
247
+ De,
248
248
  {
249
249
  id: "modalIdForActionAreaLayout",
250
250
  portalId: "main-display-area",
@@ -252,7 +252,7 @@ const ke = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
252
252
  onRequestClose: Y,
253
253
  modalHeading: /* @__PURE__ */ z("div", { className: T.modalHeading, children: [
254
254
  /* @__PURE__ */ i("span", { children: s.formName }),
255
- E && f(s) && /* @__PURE__ */ i(
255
+ I && f(s) && /* @__PURE__ */ i(
256
256
  x,
257
257
  {
258
258
  label: n("EDIT_OBSERVATION_FORM"),
@@ -279,7 +279,7 @@ const ke = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
279
279
  errorMessage: ue,
280
280
  emptyStateMessage: n("NO_FORM_DATA_AVAILABLE"),
281
281
  testIdPrefix: s.formName,
282
- hideThumbnail: W,
282
+ hideThumbnail: J,
283
283
  controlOrder: le,
284
284
  sectionMap: me
285
285
  }
@@ -1,5 +1,5 @@
1
- import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-AgEWaI9q.js";
2
- import { bN as d, bO as f, bP as e } from "./index-DET3dQtT.js";
1
+ import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-jSyFdy12.js";
2
+ import { bP as d, bQ as f, bR as e } from "./index-Ctx7k5_5.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-AgEWaI9q.js";
2
- import { bN as v, bO as C, bP as e } from "./index-DET3dQtT.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-jSyFdy12.js";
2
+ import { bP as v, bQ as C, bR as e } from "./index-Ctx7k5_5.js";
3
3
  var h = (t) => {
4
4
  const [r, o] = s({
5
5
  prefix: "TanstackQueryDevtools"
@@ -1,11 +1,11 @@
1
1
  import { jsxs as S, jsx as u } from "react/jsx-runtime";
2
- import { g as B, K as V, u as N, j as M, k, d as x, x as Q, A as G, _ as j, l as w, U as H, M as z, q as A, n as P, v as J, I as W, o as X, r as Z, y as ee } from "./index-DET3dQtT.js";
2
+ import { g as k, G as K, u as N, E as q, y as G, f as Q, O as z, L as M, R as j, i as w, W as x, z as H, j as L, T as P, v as W, k as J, l as X, m as Z, n as ee } from "./index-Ctx7k5_5.js";
3
3
  import { useQueries as ae, useQuery as te } from "@tanstack/react-query";
4
4
  import { useRef as se, useEffect as $, useMemo as E } from "react";
5
5
  const D = (a, n, d, l, b, r) => {
6
- const t = P(a, n, b), s = t.value, o = J(s);
7
- let i = s;
8
- o === "Image" && (i = /* @__PURE__ */ u(
6
+ const t = P(a, n, b), s = t.value, i = W(s);
7
+ let o = s;
8
+ i === "Image" && (o = /* @__PURE__ */ u(
9
9
  X,
10
10
  {
11
11
  imageSrc: s,
@@ -13,22 +13,22 @@ const D = (a, n, d, l, b, r) => {
13
13
  id: `${s}-img`,
14
14
  hideThumbnail: r
15
15
  }
16
- )), o === "Video" && (i = /* @__PURE__ */ u(
16
+ )), i === "Video" && (o = /* @__PURE__ */ u(
17
17
  Z,
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 m = b("OBSERVATIONS_RECORDED_BY", {
25
25
  provider: t.provider
26
- }), p = a.display, v = a.observationValue?.isAbnormal ? "abnormal-obs" : "obs", c = l ? `${l}-${v}-${p}-${d}-${n}` : `${v}-${p}-${d}-${n}`;
26
+ }), p = a.display, y = a.observationValue?.isAbnormal ? "abnormal-obs" : "obs", c = l ? `${l}-${y}-${p}-${d}-${n}` : `${y}-${p}-${d}-${n}`;
27
27
  return /* @__PURE__ */ u(
28
- W,
28
+ J,
29
29
  {
30
30
  header: t.header,
31
- value: i,
31
+ value: o,
32
32
  info: m,
33
33
  id: c,
34
34
  testId: c,
@@ -37,15 +37,15 @@ const D = (a, n, d, l, b, r) => {
37
37
  `obs-${a.id}`
38
38
  );
39
39
  }, re = (a, n, d, l, b, r, t) => /* @__PURE__ */ u(
40
- A,
40
+ L,
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, o) => D(
46
+ (s, i) => D(
47
47
  s,
48
- o,
48
+ i,
49
49
  b,
50
50
  r,
51
51
  n,
@@ -54,23 +54,23 @@ const D = (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 } = N(), b = (r, t, s) => {
63
- const o = z(r.encounterDetails, l);
63
+ const i = H(r.encounterDetails, l);
64
64
  return /* @__PURE__ */ S(
65
- A,
65
+ L,
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, m) => D(
73
- i,
72
+ (o, m) => D(
73
+ o,
74
74
  m,
75
75
  s,
76
76
  n,
@@ -79,8 +79,8 @@ const D = (a, n, d, l, b, r) => {
79
79
  )
80
80
  ),
81
81
  r.groupedObservations.map(
82
- (i, m) => re(
83
- i,
82
+ (o, m) => re(
83
+ o,
84
84
  l,
85
85
  t,
86
86
  m,
@@ -105,71 +105,71 @@ const D = (a, n, d, l, b, r) => {
105
105
  )
106
106
  }
107
107
  );
108
- }, ie = "Observations-module_observations__RKSyo", ne = "Observations-module_title__TJL3z", I = {
109
- observations: ie,
108
+ }, oe = "Observations-module_observations__RKSyo", ne = "Observations-module_title__TJL3z", I = {
109
+ observations: oe,
110
110
  title: ne
111
111
  }, de = (a) => ["conceptUuid", a], le = (a, n) => ["observations", a, ...n], pe = ({ 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 = B(), { addNotification: s } = V(), { t: o } = N(), i = ae({
116
+ } = n, r = se(/* @__PURE__ */ new Set()), t = k(), { addNotification: s } = K(), { t: i } = N(), o = ae({
117
117
  queries: d.map((e) => ({
118
118
  queryKey: de(e),
119
- queryFn: () => M(e),
119
+ queryFn: () => q(e),
120
120
  enabled: !!e
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
- const q = d[h];
126
+ const V = d[h];
127
127
  s({
128
- title: o("ERROR_DEFAULT_TITLE"),
129
- message: o("ERROR_FETCHING_CONCEPT", { conceptName: q }),
128
+ title: i("ERROR_DEFAULT_TITLE"),
129
+ message: i("ERROR_FETCHING_CONCEPT", { conceptName: V }),
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 m = E(() => i.map((e) => e.data?.uuid).filter((e) => !!e), [i]), p = E(() => [.../* @__PURE__ */ new Set([...m, ...l])], [m, l]), v = E(() => d.length === 0 ? !0 : i.every((e) => !e.isLoading), [i, d.length]), {
134
+ }, [o, d]);
135
+ const m = E(() => o.map((e) => e.data?.uuid).filter((e) => !!e), [o]), p = E(() => [.../* @__PURE__ */ new Set([...m, ...l])], [m, l]), y = E(() => d.length === 0 ? !0 : o.every((e) => !e.isLoading), [o, d.length]), {
136
136
  data: c,
137
137
  isLoading: F,
138
138
  isError: T,
139
- refetch: g
139
+ refetch: O
140
140
  } = te({
141
141
  queryKey: le(t, p),
142
- queryFn: () => k(t, p),
143
- enabled: !!t && p.length > 0 && v
142
+ queryFn: () => G(t, p),
143
+ enabled: !!t && p.length > 0 && y
144
144
  });
145
- x(
145
+ Q(
146
146
  (e) => {
147
147
  e.patientUUID === t && e.updatedConcepts.size > 0 && [...e.updatedConcepts.keys()].some(
148
148
  (h) => p.includes(h)
149
- ) && g();
149
+ ) && O();
150
150
  },
151
- [t, g]
151
+ [t, O]
152
152
  ), $(() => {
153
153
  T && 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
  }, [T]);
159
- const O = E(() => {
159
+ const g = E(() => {
160
160
  if (!c) return [];
161
- const e = Q(c), h = G(e);
161
+ const e = z(c), h = M(e);
162
162
  return j(h);
163
- }, [c]), L = [
163
+ }, [c]), A = [
164
164
  { key: "name", header: "name" },
165
165
  { key: "value", header: "value" },
166
166
  { key: "form", header: "form" }
167
- ], _ = F || !v, f = T && v, U = (!c || c.entry?.length === 0 || p.length === 0) && v, C = f ? o("ERROR_FETCHING_OBSERVATIONS") : null, K = U ? o("NO_OBSERVATIONS_FOUND") : void 0, Y = O.length > 0 && !_ && !f, R = n.titleTranslationKey, y = R ? o(R) : "";
167
+ ], f = F || !y, _ = T && y, Y = (!c || c.entry?.length === 0 || p.length === 0) && y, C = _ ? i("ERROR_FETCHING_OBSERVATIONS") : null, U = Y ? i("NO_OBSERVATIONS_FOUND") : void 0, B = g.length > 0 && !f && !_, R = n.titleTranslationKey, v = R ? i(R) : "";
168
168
  return /* @__PURE__ */ S(
169
169
  "div",
170
170
  {
171
171
  id: "observations",
172
- "data-testid": R ? `observations-${y}` : "observations",
172
+ "data-testid": R ? `observations-${v}` : "observations",
173
173
  "aria-label": "observations-aria-label",
174
174
  className: I.observations,
175
175
  children: [
@@ -177,28 +177,28 @@ const D = (a, n, d, l, b, r) => {
177
177
  w,
178
178
  {
179
179
  id: "observations-title",
180
- testId: R ? `observations-title-${y}` : "observations-title",
181
- title: y,
180
+ testId: R ? `observations-title-${v}` : "observations-title",
181
+ title: v,
182
182
  className: I.title,
183
- children: /* @__PURE__ */ u("p", { children: y })
183
+ children: /* @__PURE__ */ u("p", { children: v })
184
184
  }
185
185
  ),
186
- Y ? /* @__PURE__ */ u(
187
- oe,
186
+ B ? /* @__PURE__ */ u(
187
+ ie,
188
188
  {
189
- groupedData: O,
190
- title: y,
189
+ groupedData: g,
190
+ title: v,
191
191
  hideThumbnail: b
192
192
  }
193
193
  ) : /* @__PURE__ */ u(
194
- H,
194
+ x,
195
195
  {
196
- headers: L,
196
+ headers: A,
197
197
  rows: [],
198
- ariaLabel: o("OBSERVATIONS"),
199
- loading: _,
198
+ ariaLabel: i("OBSERVATIONS"),
199
+ loading: f,
200
200
  errorStateMessage: C,
201
- emptyStateMessage: K,
201
+ emptyStateMessage: U,
202
202
  dataTestId: "observations-table"
203
203
  }
204
204
  )