@bahmni/registration-app 0.0.1-dev.215 → 0.0.1-dev.216

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 r, jsxs as _, Fragment as Y } from "react/jsx-runtime";
2
- import { c as K, u as Q, e as W, p as J, H as X, T as Z, x as ee, R as te } from "./index-D9Vb4M0I.js";
1
+ import { jsx as r, jsxs as p, Fragment as Y } from "react/jsx-runtime";
2
+ import { u as K, a as Q, e as W, y as J, E as X, T as Z, h as ee, b as te } from "./index-DNRQhRAW.js";
3
3
  import { useQuery as ae } from "@tanstack/react-query";
4
4
  import { useState as m, useCallback as h, 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 = {
@@ -18,53 +18,53 @@ const ne = "_documentsTableBody_1voj8_1", oe = "_viewAttachmentsLink_1voj8_11",
18
18
  uploadedBy: "DOCUMENTS_UPLOADED_BY",
19
19
  action: "DOCUMENTS_ACTION"
20
20
  };
21
- function R(a) {
21
+ function j(a) {
22
22
  return !a || a.includes(":") ? "#" : `/openmrs/auth?requested_document=/document_images/${a}`;
23
23
  }
24
- function ue(a, g) {
24
+ function ue(a, E) {
25
25
  return a.map((s) => ({
26
26
  key: s,
27
- header: g(le[s])
27
+ header: E(le[s])
28
28
  }));
29
29
  }
30
- const pe = [
30
+ const _e = [
31
31
  "documentIdentifier",
32
32
  "documentType",
33
33
  "uploadedOn",
34
34
  "uploadedBy",
35
35
  "action"
36
- ], _e = /\.(jpg|jpeg|png|gif|webp|bmp|svg)$/i, j = (a) => a.attachments.length > 0 ? a.attachments : a.documentUrl ? [{ url: a.documentUrl, contentType: a.contentType }] : [], Ne = ({ config: a, encounterUuids: g }) => {
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] = m(!1), [o, L] = m(
38
38
  null
39
- ), [B, I] = m(
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($), [H, y] = m(void 0), M = h((e) => {
41
+ ), g = K(), { t: n } = Q(), { addNotification: U } = W(), $ = Number(a?.pageSize) || 5, [C, y] = m(1), [l, k] = m($), [V, A] = m(void 0), b = h((e) => {
42
42
  L(e), w(!0);
43
- }, []), V = h(() => {
43
+ }, []), F = h(() => {
44
44
  w(!1), L(null), I(/* @__PURE__ */ new Set());
45
- }, []), b = h((e) => {
45
+ }, []), M = h((e) => {
46
46
  I((t) => new Set(t).add(e));
47
- }, []), { data: u, isLoading: F, isError: D, error: v } = ae({
47
+ }, []), { data: u, isLoading: H, isError: D, error: v } = ae({
48
48
  queryKey: [
49
49
  "documents",
50
- E,
51
50
  g,
51
+ E,
52
52
  C,
53
53
  l
54
54
  ],
55
- enabled: !!E,
55
+ enabled: !!g,
56
56
  queryFn: () => J(
57
- E,
58
57
  g,
58
+ E,
59
59
  l,
60
60
  C
61
61
  )
62
62
  });
63
63
  f(() => {
64
- u && y(u.total);
64
+ u && A(u.total);
65
65
  }, [u]), f(() => {
66
- A(1), y(void 0);
67
- }, [E]), f(() => {
66
+ y(1), A(void 0);
67
+ }, [g]), f(() => {
68
68
  D && U({
69
69
  title: n("ERROR_DEFAULT_TITLE"),
70
70
  message: v?.message ?? "",
@@ -74,9 +74,9 @@ const pe = [
74
74
  const e = new AbortController();
75
75
  return (async () => {
76
76
  if (!s || !o) return;
77
- const t = /* @__PURE__ */ new Set(), c = j(o);
77
+ const t = /* @__PURE__ */ new Set(), c = B(o);
78
78
  for (let i = 0; i < c.length; i++) {
79
- const S = R(c[i].url);
79
+ const S = j(c[i].url);
80
80
  try {
81
81
  (await fetch(S, {
82
82
  method: "HEAD",
@@ -91,20 +91,20 @@ const pe = [
91
91
  }, [s, o]);
92
92
  const q = h(
93
93
  (e, t) => {
94
- t !== l ? (k(t), A(1), y(void 0)) : A(e);
94
+ t !== l ? (k(t), y(1), A(void 0)) : y(e);
95
95
  },
96
96
  [l]
97
97
  ), N = T(
98
- () => a?.fields ?? pe,
98
+ () => a?.fields ?? _e,
99
99
  [a?.fields]
100
- ), x = 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]), P = T(() => ue(N, n), [N, n]), z = T(
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
101
  () => N.map((e) => ({
102
102
  key: e,
103
103
  sortable: e !== "action"
104
104
  })),
105
105
  [N]
106
- ), p = T(
107
- () => o ? j(o) : [],
106
+ ), _ = T(
107
+ () => o ? B(o) : [],
108
108
  [o]
109
109
  ), G = h(
110
110
  (e, t) => {
@@ -125,7 +125,7 @@ const pe = [
125
125
  return e.attachments.length > 0 || e.documentUrl ? /* @__PURE__ */ r(
126
126
  X,
127
127
  {
128
- onClick: () => M(e),
128
+ onClick: () => b(e),
129
129
  className: d.viewAttachmentsLink,
130
130
  "data-testid": `view-attachments-${e.id}`,
131
131
  children: n("DOCUMENTS_VIEW_ATTACHMENTS")
@@ -135,24 +135,24 @@ const pe = [
135
135
  return null;
136
136
  }
137
137
  },
138
- [M, n]
138
+ [b, n]
139
139
  );
140
- return /* @__PURE__ */ _(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
  {
144
- headers: P,
144
+ headers: z,
145
145
  ariaLabel: n("DOCUMENTS_TABLE_HEADING"),
146
- rows: x,
147
- loading: F,
146
+ rows: P,
147
+ loading: H,
148
148
  errorStateMessage: D ? v?.message : null,
149
- sortable: z,
149
+ sortable: x,
150
150
  emptyStateMessage: n("DOCUMENTS_NO_RECORDS"),
151
151
  renderCell: G,
152
152
  className: d.documentsTableBody,
153
153
  dataTestId: "documents-table",
154
154
  pageSize: l,
155
- totalItems: H,
155
+ totalItems: V,
156
156
  page: C,
157
157
  onPageChange: q
158
158
  }
@@ -163,38 +163,38 @@ const pe = [
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
- children: /* @__PURE__ */ r("div", { className: d.documentViewerContainer, children: p.map((e, t) => {
172
- const c = R(e.url), i = e.contentType?.toLowerCase().includes("pdf"), S = (e.contentType?.toLowerCase().includes("image") ?? !1) || _e.test(e.url ?? ""), O = B.has(t);
173
- return c === "#" || O ? /* @__PURE__ */ _(
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 ?? ""), O = R.has(t);
173
+ return c === "#" || O ? /* @__PURE__ */ p(
174
174
  "div",
175
175
  {
176
176
  className: d.attachmentError,
177
177
  "data-testid": `attachment-error-${t}`,
178
178
  children: [
179
- p.length > 1 && /* @__PURE__ */ _("p", { className: d.attachmentCounter, children: [
179
+ _.length > 1 && /* @__PURE__ */ p("p", { className: d.attachmentCounter, children: [
180
180
  t + 1,
181
181
  "/",
182
- p.length
182
+ _.length
183
183
  ] }),
184
184
  /* @__PURE__ */ r("p", { children: n("DOCUMENTS_ERROR_LOADING_ATTACHMENT") })
185
185
  ]
186
186
  },
187
187
  `${o.id}-${e.url}`
188
- ) : /* @__PURE__ */ _(
188
+ ) : /* @__PURE__ */ p(
189
189
  "div",
190
190
  {
191
191
  className: d.attachmentItem,
192
192
  "data-testid": `attachment-item-${t}`,
193
193
  children: [
194
- p.length > 1 && /* @__PURE__ */ _("p", { className: d.attachmentCounter, children: [
194
+ _.length > 1 && /* @__PURE__ */ p("p", { className: d.attachmentCounter, children: [
195
195
  t + 1,
196
196
  "/",
197
- p.length
197
+ _.length
198
198
  ] }),
199
199
  S ? /* @__PURE__ */ r(
200
200
  "img",
@@ -202,7 +202,7 @@ const pe = [
202
202
  src: c,
203
203
  alt: o.documentIdentifier,
204
204
  className: d.documentImage,
205
- onError: () => b(t)
205
+ onError: () => M(t)
206
206
  }
207
207
  ) : /* @__PURE__ */ r(
208
208
  "iframe",
@@ -210,7 +210,7 @@ const pe = [
210
210
  src: i ? `${c}#toolbar=0` : c,
211
211
  className: d.documentIframe,
212
212
  title: o.documentIdentifier,
213
- onError: () => b(t)
213
+ onError: () => M(t)
214
214
  }
215
215
  )
216
216
  ]
@@ -0,0 +1,197 @@
1
+ import { jsx as s, jsxs as J, Fragment as W } from "react/jsx-runtime";
2
+ import { a as Z, u as ee, c as re, d as ae, g as te, v as oe, w as se, f as ne, V as R, T as de, E as ie, h as q, q as me, U as ue, b as le, O as ce, i as fe } from "./index-DNRQhRAW.js";
3
+ import { useQueryClient as ye, useQuery as c } from "@tanstack/react-query";
4
+ import { useState as C, useMemo as d, useCallback as f } from "react";
5
+ const be = "_formsTableBody_81hra_1", ge = "_customAccordianItem_81hra_6", O = {
6
+ formsTableBody: be,
7
+ customAccordianItem: ge
8
+ }, he = (m) => m ? m.extension?.find(
9
+ (n) => n.url === fe
10
+ )?.valueString : void 0, Ee = ({
11
+ episodeOfCareUuids: m,
12
+ encounterUuids: n,
13
+ config: S
14
+ }) => {
15
+ const { t: o } = Z(), u = ee(), [l, A] = C(!1), [t, E] = C(null), { numberOfVisits: k, hideThumbnail: V = !1 } = S ?? {}, I = re(
16
+ m,
17
+ n
18
+ ), w = ye(), {
19
+ data: y = [],
20
+ isLoading: T,
21
+ isError: B,
22
+ error: H,
23
+ refetch: K
24
+ } = c({
25
+ queryKey: ["forms", u, m],
26
+ queryFn: () => ae(u, void 0, k),
27
+ enabled: !!u && !I
28
+ }), _ = d(() => !n || n.length === 0 ? y : y.filter(
29
+ (e) => n.includes(e.encounterUuid)
30
+ ), [y, n]), { data: v = [] } = c({
31
+ queryKey: ["observationForms"],
32
+ queryFn: () => te()
33
+ }), F = f(
34
+ (e) => v.find((r) => r.name === e)?.uuid,
35
+ [v]
36
+ ), b = d(() => {
37
+ if (t)
38
+ return F(t.formName);
39
+ }, [t, F]), {
40
+ isLoading: j,
41
+ isError: x,
42
+ error: g
43
+ } = c({
44
+ queryKey: ["formMetadata", b],
45
+ queryFn: () => oe(b),
46
+ enabled: !!b && l
47
+ }), {
48
+ data: h,
49
+ isLoading: $,
50
+ isError: Q,
51
+ error: p
52
+ } = c({
53
+ queryKey: ["formsEncounterFHIR", t?.encounterUuid],
54
+ queryFn: () => se(t.encounterUuid),
55
+ enabled: !!t?.encounterUuid && l
56
+ });
57
+ ne(
58
+ (e) => {
59
+ e.patientUUID === u && e.updatedConcepts.size > 0 && (K(), w.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
60
+ },
61
+ [u]
62
+ );
63
+ const z = d(() => !h?.entry || !t?.formName ? [] : h.entry.filter((e) => e.resource?.resourceType === "Observation").map((e) => e.resource).filter((e) => {
64
+ const r = he(e);
65
+ return !r || r.includes(t.formName);
66
+ }), [h, t?.formName]), G = d(() => {
67
+ if (g)
68
+ return R(g).message;
69
+ if (p)
70
+ return R(p).message;
71
+ }, [g, p]), L = d(
72
+ () => [
73
+ { key: "recordedOn", header: o("RECORDED_ON") },
74
+ { key: "recordedBy", header: o("RECORDED_BY") }
75
+ ],
76
+ [o]
77
+ ), P = d(
78
+ () => [
79
+ { key: "recordedOn", sortable: !0 },
80
+ { key: "recordedBy", sortable: !0 }
81
+ ],
82
+ []
83
+ ), M = d(() => {
84
+ const e = _.reduce(
85
+ (r, a) => {
86
+ const i = a.formName;
87
+ r[i] ??= [];
88
+ const N = a.providers.map((X) => X.providerName).filter(Boolean).join(", ");
89
+ return r[i].push({
90
+ id: a.encounterUuid,
91
+ formName: a.formName,
92
+ recordedOn: de(a.encounterDateTime, o, !0).formattedResult,
93
+ recordedBy: N ?? "--",
94
+ encounterDateTime: a.encounterDateTime,
95
+ encounterUuid: a.encounterUuid
96
+ }), r;
97
+ },
98
+ {}
99
+ );
100
+ return Object.entries(e).map(
101
+ ([r, a]) => ({
102
+ formName: r,
103
+ records: a.sort(
104
+ (i, N) => N.encounterDateTime - i.encounterDateTime
105
+ )
106
+ })
107
+ ).sort((r, a) => r.formName.localeCompare(a.formName));
108
+ }, [_, o]), U = f((e) => {
109
+ E(e), A(!0);
110
+ }, []), Y = f(() => {
111
+ A(!1), E(null);
112
+ }, []), D = f(
113
+ (e, r) => {
114
+ switch (r) {
115
+ case "recordedOn":
116
+ return /* @__PURE__ */ s(ie, { onClick: () => U(e), children: e.recordedOn });
117
+ case "recordedBy":
118
+ return e.recordedBy;
119
+ default:
120
+ return null;
121
+ }
122
+ },
123
+ [U]
124
+ );
125
+ return /* @__PURE__ */ J(W, { children: [
126
+ /* @__PURE__ */ s("div", { "data-testid": "forms-table", children: T || B || M.length === 0 || I ? /* @__PURE__ */ s(
127
+ q,
128
+ {
129
+ headers: L,
130
+ ariaLabel: o("FORMS_HEADING"),
131
+ rows: [],
132
+ loading: T,
133
+ errorStateMessage: B ? H?.message : void 0,
134
+ emptyStateMessage: o("FORMS_UNAVAILABLE"),
135
+ renderCell: D,
136
+ className: O.formsTableBody,
137
+ dataTestId: "forms-table"
138
+ }
139
+ ) : /* @__PURE__ */ s(me, { align: "start", children: M.map((e, r) => {
140
+ const { formName: a, records: i } = e;
141
+ return /* @__PURE__ */ s(
142
+ ue,
143
+ {
144
+ title: a,
145
+ className: O.customAccordianItem,
146
+ testId: `accordian-title-${a}`,
147
+ open: r === 0,
148
+ children: /* @__PURE__ */ s(
149
+ q,
150
+ {
151
+ headers: L,
152
+ ariaLabel: o("FORMS_HEADING"),
153
+ rows: i,
154
+ loading: !1,
155
+ errorStateMessage: "",
156
+ sortable: P,
157
+ emptyStateMessage: o("FORMS_UNAVAILABLE"),
158
+ renderCell: D,
159
+ className: O.formsTableBody,
160
+ dataTestId: `forms-table-${a}`
161
+ }
162
+ )
163
+ },
164
+ a
165
+ );
166
+ }) }) }),
167
+ l && t && /* @__PURE__ */ s(
168
+ le,
169
+ {
170
+ id: "modalIdForActionAreaLayout",
171
+ portalId: "main-display-area",
172
+ open: l,
173
+ onRequestClose: Y,
174
+ modalHeading: t.formName,
175
+ modalLabel: `${t.recordedOn} | ${t.recordedBy}`,
176
+ passiveModal: !0,
177
+ size: "md",
178
+ testId: "form-details-modal",
179
+ children: /* @__PURE__ */ s(
180
+ ce,
181
+ {
182
+ observations: z,
183
+ isLoading: j || $,
184
+ isError: x || Q,
185
+ errorMessage: G,
186
+ emptyStateMessage: o("NO_FORM_DATA_AVAILABLE"),
187
+ testIdPrefix: t.formName,
188
+ hideThumbnail: V
189
+ }
190
+ )
191
+ }
192
+ )
193
+ ] });
194
+ };
195
+ export {
196
+ Ee as default
197
+ };
@@ -1,5 +1,5 @@
1
- import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-BS85_gJw.js";
2
- import { t as d, A as f, C as e } from "./index-D9Vb4M0I.js";
1
+ import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-CflEJEC8.js";
2
+ import { r as d, s as f, t as e } from "./index-DNRQhRAW.js";
3
3
  var p = (a) => {
4
4
  const [r, t] = c({
5
5
  prefix: "TanstackQueryDevtools"
@@ -27,7 +27,7 @@ var p = (a) => {
27
27
  });
28
28
  }
29
29
  });
30
- }, P = p;
30
+ }, C = p;
31
31
  export {
32
- P as default
32
+ C as default
33
33
  };
@@ -1,9 +1,9 @@
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-BS85_gJw.js";
2
- import { t as C, A as v, C as e } from "./index-D9Vb4M0I.js";
1
+ import { c as l, T as c, P as u, a as i, b as m, C as P, Q as d } from "./YPM2AS64-CflEJEC8.js";
2
+ import { r as v, s as C, t as e } from "./index-DNRQhRAW.js";
3
3
  var h = (t) => {
4
- const [r, o] = s({
4
+ const [r, o] = l({
5
5
  prefix: "TanstackQueryDevtools"
6
- }), a = C(), l = v(() => {
6
+ }), a = v(), s = C(() => {
7
7
  const n = r.theme_preference || c;
8
8
  return n !== "system" ? n : a();
9
9
  });
@@ -16,7 +16,7 @@ var h = (t) => {
16
16
  setLocalStore: o,
17
17
  get children() {
18
18
  return e(i.Provider, {
19
- value: l,
19
+ value: s,
20
20
  get children() {
21
21
  return e(m, {
22
22
  get children() {
@@ -0,0 +1,213 @@
1
+ import { jsxs as I, jsx as u } from "react/jsx-runtime";
2
+ import { u as B, e as K, a as S, p as M, m as x, f as G, x as Q, z as j, N as w, j as z, h as H, k as P, G as A, M as Y, R as J, A as W, l as X, n as Z, o as ee } from "./index-DNRQhRAW.js";
3
+ import { useQueries as ae, useQuery as te } from "@tanstack/react-query";
4
+ import { useRef as se, useEffect as $, useMemo as R } from "react";
5
+ const U = (a, n, d, l, b, r) => {
6
+ const t = Y(a, n, b), s = t.value, o = J(s);
7
+ let i = s;
8
+ o === "Image" && (i = /* @__PURE__ */ u(
9
+ X,
10
+ {
11
+ imageSrc: s,
12
+ alt: s,
13
+ id: `${s}-img`,
14
+ hideThumbnail: r
15
+ }
16
+ )), o === "Video" && (i = /* @__PURE__ */ u(
17
+ Z,
18
+ {
19
+ id: `${s}-video`,
20
+ videoSrc: s,
21
+ hideThumbnail: r
22
+ }
23
+ )), o === "PDF" && (i = /* @__PURE__ */ u(ee, { id: `${s}-pdf`, src: s }));
24
+ const p = b("OBSERVATIONS_RECORDED_BY", {
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}`;
27
+ return /* @__PURE__ */ u(
28
+ W,
29
+ {
30
+ header: t.header,
31
+ value: i,
32
+ info: p,
33
+ id: c,
34
+ testId: c,
35
+ ariaLabel: c
36
+ },
37
+ `obs-${a.id}`
38
+ );
39
+ }, re = (a, n, d, l, b, r, t) => /* @__PURE__ */ u(
40
+ A,
41
+ {
42
+ title: a.display,
43
+ id: `grouped-obs-${a.display}-${l}`,
44
+ open: d,
45
+ children: a.members?.map(
46
+ (s, o) => U(
47
+ s,
48
+ o,
49
+ b,
50
+ r,
51
+ n,
52
+ t
53
+ )
54
+ )
55
+ },
56
+ `grouped-obs-${a.id}`
57
+ ), oe = ({
58
+ groupedData: a,
59
+ title: n = "",
60
+ hideThumbnail: d
61
+ }) => {
62
+ const { t: l } = S(), b = (r, t, s) => {
63
+ const o = P(r.encounterDetails, l);
64
+ return /* @__PURE__ */ I(
65
+ A,
66
+ {
67
+ title: o,
68
+ id: `encounter-${r.encounterId}`,
69
+ open: t,
70
+ children: [
71
+ r.observations.map(
72
+ (i, p) => U(
73
+ i,
74
+ p,
75
+ s,
76
+ n,
77
+ l,
78
+ d
79
+ )
80
+ ),
81
+ r.groupedObservations.map(
82
+ (i, p) => re(
83
+ i,
84
+ l,
85
+ t,
86
+ p,
87
+ s,
88
+ n,
89
+ d
90
+ )
91
+ )
92
+ ]
93
+ },
94
+ `encounter-${r.encounterId}`
95
+ );
96
+ };
97
+ return /* @__PURE__ */ u(
98
+ "div",
99
+ {
100
+ id: "obs-by-encounter",
101
+ "data-testid": "obs-by-encounter-test-id",
102
+ "aria-label": "obs-by-encounter-aria-label",
103
+ children: a.map(
104
+ (r, t) => b(r, t === 0, t)
105
+ )
106
+ }
107
+ );
108
+ }, ie = "_observations_kfbhq_1", ne = "_title_kfbhq_12", N = {
109
+ observations: ie,
110
+ title: ne
111
+ }, de = (a) => ["conceptUuid", a], le = (a, n) => ["observations", a, ...n], me = ({ config: a }) => {
112
+ const n = a, {
113
+ conceptNames: d = [],
114
+ conceptUuid: l = [],
115
+ hideThumbnail: b = !1
116
+ } = n, r = se(/* @__PURE__ */ new Set()), t = B(), { addNotification: s } = K(), { t: o } = S(), i = ae({
117
+ queries: d.map((e) => ({
118
+ queryKey: de(e),
119
+ queryFn: () => M(e),
120
+ enabled: !!e
121
+ }))
122
+ });
123
+ $(() => {
124
+ i.forEach((e, h) => {
125
+ if (e.isError && !r.current.has(h)) {
126
+ const k = d[h];
127
+ s({
128
+ title: o("ERROR_DEFAULT_TITLE"),
129
+ message: o("ERROR_FETCHING_CONCEPT", { conceptName: k }),
130
+ type: "error"
131
+ }), r.current.add(h);
132
+ } else e.isError || r.current.delete(h);
133
+ });
134
+ }, [i, d]);
135
+ const p = R(() => i.map((e) => e.data?.uuid).filter((e) => !!e), [i]), m = R(() => [.../* @__PURE__ */ new Set([...p, ...l])], [p, l]), v = R(() => d.length === 0 ? !0 : i.every((e) => !e.isLoading), [i, d.length]), {
136
+ data: c,
137
+ isLoading: D,
138
+ isError: f,
139
+ refetch: T
140
+ } = te({
141
+ queryKey: le(t, m),
142
+ queryFn: () => x(t, m),
143
+ enabled: !!t && m.length > 0 && v
144
+ });
145
+ G(
146
+ (e) => {
147
+ e.patientUUID === t && e.updatedConcepts.size > 0 && [...e.updatedConcepts.keys()].some(
148
+ (h) => m.includes(h)
149
+ ) && T();
150
+ },
151
+ [t, T]
152
+ ), $(() => {
153
+ f && s({
154
+ title: o("ERROR_DEFAULT_TITLE"),
155
+ message: o("ERROR_FETCHING_OBSERVATIONS"),
156
+ type: "error"
157
+ });
158
+ }, [f]);
159
+ const g = R(() => {
160
+ if (!c) return [];
161
+ const e = Q(c), h = j(e);
162
+ return w(h);
163
+ }, [c]), F = [
164
+ { key: "name", header: "name" },
165
+ { key: "value", header: "value" },
166
+ { key: "form", header: "form" }
167
+ ], O = D || !v, _ = f && v, q = (!c || c.entry?.length === 0 || m.length === 0) && v, L = _ ? o("ERROR_FETCHING_OBSERVATIONS") : null, C = q ? o("NO_OBSERVATIONS_FOUND") : void 0, V = g.length > 0 && !O && !_, E = n.titleTranslationKey, y = E ? o(E) : "";
168
+ return /* @__PURE__ */ I(
169
+ "div",
170
+ {
171
+ id: "observations",
172
+ "data-testid": E ? `observations-${y}` : "observations",
173
+ "aria-label": "observations-aria-label",
174
+ className: N.observations,
175
+ children: [
176
+ /* @__PURE__ */ u(
177
+ z,
178
+ {
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 })
184
+ }
185
+ ),
186
+ V ? /* @__PURE__ */ u(
187
+ oe,
188
+ {
189
+ groupedData: g,
190
+ title: y,
191
+ hideThumbnail: b
192
+ }
193
+ ) : /* @__PURE__ */ u(
194
+ H,
195
+ {
196
+ headers: F,
197
+ rows: [],
198
+ ariaLabel: o("OBSERVATIONS"),
199
+ loading: O,
200
+ errorStateMessage: L,
201
+ emptyStateMessage: C,
202
+ dataTestId: "observations-table"
203
+ }
204
+ )
205
+ ]
206
+ }
207
+ );
208
+ };
209
+ export {
210
+ de as conceptUuidQueryKeys,
211
+ me as default,
212
+ le as observationsQueryKeys
213
+ };
@@ -1,4 +1,4 @@
1
- import { D as we, J as z, K as xt, L as B, A as q, C as y, M as Ro, N as ye, S as R, O as _, Q as k, U as N, V as A, W as bs, X as ir, Y as $e, _ as U, $ as Hn, a0 as Vn, a1 as dt, a2 as D, a3 as xs, a4 as cn, a5 as Be, a6 as ws, a7 as qt, a8 as zt, a9 as $s, aa as Cs, ab as $n, ac as Ss, ad as Nr, ae as Bt, af as zo, ag as ks, ah as Es, ai as j, aj as Ur, ak as Ms, al as Ds, am as sr, an as As, ao as Ts, ap as zn, aq as Fs, ar as Is, as as Z, at as Ps, au as Ls } from "./index-D9Vb4M0I.js";
1
+ import { B as we, C as z, D as xt, F as B, s as q, t as y, P as Ro, H as ye, S as R, I as _, J as k, K as N, L as A, Q as bs, W as ir, X as $e, Y as U, Z as Hn, _ as Vn, $ as dt, a0 as D, a1 as xs, a2 as cn, a3 as Be, a4 as ws, a5 as qt, a6 as zt, a7 as $s, a8 as Cs, a9 as $n, aa as Ss, ab as Nr, ac as Bt, ad as zo, ae as ks, af as Es, ag as j, ah as Ur, ai as Ms, aj as Ds, ak as sr, al as As, am as Ts, an as zn, ao as Fs, ap as Is, aq as Z, ar as Ps, as as Ls } from "./index-DNRQhRAW.js";
2
2
  var Os = (e) => e != null, qs = (e) => e.filter(Os);
3
3
  function _s(e) {
4
4
  return (...t) => {