@bahmni/registration-app 0.0.1-dev.180 → 0.0.1-dev.182

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
1
  import { jsxs as N, jsx as w, Fragment as St } from "react/jsx-runtime";
2
- import { f as kt, u as jt, o as Wt, K as Pt, a as Ut, A as $t, G as Kt, p as Ft, b as h } from "./index-BZal8-uJ.js";
2
+ import { p as kt, u as jt, o as Wt, g as Pt, a as Ut, A as $t, $ as Kt, m as Ft, K as h } from "./index-LxwpWbTb.js";
3
3
  import { useQuery as Yt } from "@tanstack/react-query";
4
4
  import e, { useState as A, useCallback as g, useEffect as qt, useMemo as z } from "react";
5
5
  function Gt(t, r, n) {
@@ -1,29 +1,29 @@
1
- import { jsx as s, jsxs as p, Fragment as P } from "react/jsx-runtime";
2
- import { u as ee, f as re, E as ae, U as te, q as oe, W as ne, F as se, H as de, a as me, D as ie, A as U, c as le, Y as ce, G as ue, y as be, Z as q, P as pe, p as fe, T as F, d as _e, e as $e, g as ge, h as ve } from "./index-BZal8-uJ.js";
3
- import { useQueryClient as he, useQuery as A } from "@tanstack/react-query";
4
- import { useState as H, useMemo as h, useCallback as R } from "react";
5
- const ye = "_formsTableBody_1pd36_1", Ne = "_customAccordianItem_1pd36_6", Ae = "_formContent_1pd36_18", Re = "_formDetailsContainer_1pd36_25", Fe = "_observation_1pd36_30", Le = "_groupContainer_1pd36_39", Ce = "_rowContainer_1pd36_43", Oe = "_groupLabel_1pd36_48", Ie = "_rowLabel_1pd36_58", Te = "_rowValue_1pd36_67", Me = "_groupMembers_1pd36_75", Ve = "_memberRow_1pd36_81", Se = "_memberLabel_1pd36_86", De = "_memberValue_1pd36_94", Ee = "_abnormalValue_1pd36_102", we = "_commentSection_1pd36_110", xe = "_commentText_1pd36_116", Be = "_nestedGroup_1pd36_125", Ge = "_nestedGroupLabel_1pd36_132", Ue = "_nestedGroupMembers_1pd36_141", o = {
6
- formsTableBody: ye,
7
- customAccordianItem: Ne,
8
- formContent: Ae,
1
+ import { jsx as s, jsxs as p, Fragment as H } from "react/jsx-runtime";
2
+ import { u as ee, p as re, y as ae, w as te, f as oe, b as ne, c as se, d as de, a as me, e as ie, A as q, Y as le, G as ce, $ as ue, P as be, Z as U, h as pe, m as fe, T as R, i as _e, F as $e, q as ve, W as he, j as ge } from "./index-LxwpWbTb.js";
3
+ import { useQueryClient as ye, useQuery as A } from "@tanstack/react-query";
4
+ import { useState as P, useMemo as g, useCallback as F } from "react";
5
+ const Ne = "_formsTableBody_1pd36_1", Ae = "_customAccordianItem_1pd36_6", Fe = "_formContent_1pd36_18", Re = "_formDetailsContainer_1pd36_25", Le = "_observation_1pd36_30", Ce = "_groupContainer_1pd36_39", Oe = "_rowContainer_1pd36_43", Ie = "_groupLabel_1pd36_48", Te = "_rowLabel_1pd36_58", Me = "_rowValue_1pd36_67", Ve = "_groupMembers_1pd36_75", Se = "_memberRow_1pd36_81", we = "_memberLabel_1pd36_86", De = "_memberValue_1pd36_94", xe = "_abnormalValue_1pd36_102", Ee = "_commentSection_1pd36_110", Be = "_commentText_1pd36_116", Ge = "_nestedGroup_1pd36_125", qe = "_nestedGroupLabel_1pd36_132", Ue = "_nestedGroupMembers_1pd36_141", o = {
6
+ formsTableBody: Ne,
7
+ customAccordianItem: Ae,
8
+ formContent: Fe,
9
9
  formDetailsContainer: Re,
10
- observation: Fe,
11
- groupContainer: Le,
12
- rowContainer: Ce,
13
- groupLabel: Oe,
14
- rowLabel: Ie,
15
- rowValue: Te,
16
- groupMembers: Me,
17
- memberRow: Ve,
18
- memberLabel: Se,
10
+ observation: Le,
11
+ groupContainer: Ce,
12
+ rowContainer: Oe,
13
+ groupLabel: Ie,
14
+ rowLabel: Te,
15
+ rowValue: Me,
16
+ groupMembers: Ve,
17
+ memberRow: Se,
18
+ memberLabel: we,
19
19
  memberValue: De,
20
- abnormalValue: Ee,
21
- commentSection: we,
22
- commentText: xe,
23
- nestedGroup: Be,
24
- nestedGroupLabel: Ge,
20
+ abnormalValue: xe,
21
+ commentSection: Ee,
22
+ commentText: Be,
23
+ nestedGroup: Ge,
24
+ nestedGroupLabel: qe,
25
25
  nestedGroupMembers: Ue
26
- }, K = (e) => {
26
+ }, j = (e) => {
27
27
  const r = _e(e);
28
28
  return r === "Image" ? /* @__PURE__ */ s(
29
29
  $e,
@@ -32,11 +32,11 @@ const ye = "_formsTableBody_1pd36_1", Ne = "_customAccordianItem_1pd36_6", Ae =
32
32
  alt: e,
33
33
  id: `${e}-img`
34
34
  }
35
- ) : r === "Video" ? /* @__PURE__ */ s(ge, { id: `${e}-video`, videoSrc: e }) : e;
35
+ ) : r === "Video" ? /* @__PURE__ */ s(ve, { id: `${e}-video`, videoSrc: e }) : r === "PDF" ? /* @__PURE__ */ s(he, { id: `${e}-pdf`, src: e }) : e;
36
36
  }, k = (e) => {
37
37
  const r = e.observationValue?.unit, n = e.observationValue?.referenceRange?.low?.value, a = e.observationValue?.referenceRange?.high?.value, d = n != null, c = a != null, m = d && c ? ` (${n} - ${a})` : d ? ` (>${n})` : c ? ` (<${a})` : "", t = e.observationValue?.isAbnormal === !0;
38
38
  return { units: r, rangeString: m, isAbnormal: t };
39
- }, j = ({
39
+ }, K = ({
40
40
  member: e,
41
41
  depth: r = 0,
42
42
  memberIndex: n = 0,
@@ -66,7 +66,7 @@ const ye = "_formsTableBody_1pd36_1", Ne = "_customAccordianItem_1pd36_6", Ae =
66
66
  className: o.nestedGroupMembers,
67
67
  "data-testid": `${t}obs-nested-group-members-${m}-${n}`,
68
68
  children: e.members?.map((y, N) => /* @__PURE__ */ s(
69
- j,
69
+ K,
70
70
  {
71
71
  member: y,
72
72
  depth: r + 1,
@@ -80,8 +80,8 @@ const ye = "_formsTableBody_1pd36_1", Ne = "_customAccordianItem_1pd36_6", Ae =
80
80
  ]
81
81
  }
82
82
  );
83
- const { units: b, rangeString: g, isAbnormal: f } = k(e), _ = e.observationValue?.value?.toString(), $ = _ ? K(_) : null;
84
- return /* @__PURE__ */ p(P, { children: [
83
+ const { units: b, rangeString: v, isAbnormal: f } = k(e), _ = e.observationValue?.value?.toString(), $ = _ ? j(_) : null;
84
+ return /* @__PURE__ */ p(H, { children: [
85
85
  /* @__PURE__ */ p(
86
86
  "div",
87
87
  {
@@ -92,21 +92,21 @@ const ye = "_formsTableBody_1pd36_1", Ne = "_customAccordianItem_1pd36_6", Ae =
92
92
  /* @__PURE__ */ p(
93
93
  "p",
94
94
  {
95
- className: F(
95
+ className: R(
96
96
  o.memberLabel,
97
97
  f ? o.abnormalValue : ""
98
98
  ),
99
99
  "data-testid": `${t}obs-member-label-${m}-${n}`,
100
100
  children: [
101
101
  m,
102
- g
102
+ v
103
103
  ]
104
104
  }
105
105
  ),
106
106
  /* @__PURE__ */ p(
107
107
  "div",
108
108
  {
109
- className: F(
109
+ className: R(
110
110
  o.memberValue,
111
111
  f ? o.abnormalValue : ""
112
112
  ),
@@ -133,13 +133,13 @@ const ye = "_formsTableBody_1pd36_1", Ne = "_customAccordianItem_1pd36_6", Ae =
133
133
  }
134
134
  )
135
135
  ] });
136
- }, qe = ({
136
+ }, Pe = ({
137
137
  observation: e,
138
138
  index: r,
139
139
  formName: n = "",
140
140
  comment: a
141
141
  }) => {
142
- const d = e.members && e.members.length > 0, { units: c, rangeString: m, isAbnormal: t } = k(e), b = n ? `${n}-` : "", g = e.observationValue?.value?.toString(), f = g ? K(g) : null;
142
+ const d = e.members && e.members.length > 0, { units: c, rangeString: m, isAbnormal: t } = k(e), b = n ? `${n}-` : "", v = e.observationValue?.value?.toString(), f = v ? j(v) : null;
143
143
  return /* @__PURE__ */ p(
144
144
  "div",
145
145
  {
@@ -155,7 +155,7 @@ const ye = "_formsTableBody_1pd36_1", Ne = "_customAccordianItem_1pd36_6", Ae =
155
155
  /* @__PURE__ */ p(
156
156
  "p",
157
157
  {
158
- className: F(
158
+ className: R(
159
159
  d ? o.groupLabel : o.rowLabel,
160
160
  !d && t ? o.abnormalValue : ""
161
161
  ),
@@ -172,7 +172,7 @@ const ye = "_formsTableBody_1pd36_1", Ne = "_customAccordianItem_1pd36_6", Ae =
172
172
  className: o.groupMembers,
173
173
  "data-testid": `${b}observation-group-members-${e.display}-${r}`,
174
174
  children: e.members?.map((_, $) => /* @__PURE__ */ s(
175
- j,
175
+ K,
176
176
  {
177
177
  member: _,
178
178
  depth: 0,
@@ -185,7 +185,7 @@ const ye = "_formsTableBody_1pd36_1", Ne = "_customAccordianItem_1pd36_6", Ae =
185
185
  ) : /* @__PURE__ */ p(
186
186
  "div",
187
187
  {
188
- className: F(
188
+ className: R(
189
189
  o.rowValue,
190
190
  t ? o.abnormalValue : ""
191
191
  ),
@@ -215,17 +215,17 @@ const ye = "_formsTableBody_1pd36_1", Ne = "_customAccordianItem_1pd36_6", Ae =
215
215
  `${e.id}-${r}`
216
216
  );
217
217
  }, He = (e) => e ? e.extension?.find(
218
- (r) => r.url === ve
219
- )?.valueString : void 0, Pe = (e) => {
218
+ (r) => r.url === ge
219
+ )?.valueString : void 0, je = (e) => {
220
220
  if (e)
221
221
  return e.note?.[0]?.text;
222
- }, Ke = (e, r) => e.entry?.find((n) => n.resource?.id === r)?.resource, I = (e, r) => {
223
- const n = Ke(e, r);
222
+ }, ke = (e, r) => e.entry?.find((n) => n.resource?.id === r)?.resource, I = (e, r) => {
223
+ const n = ke(e, r);
224
224
  return n ? {
225
225
  formFieldPath: He(n),
226
- comment: Pe(n)
226
+ comment: je(n)
227
227
  } : {};
228
- }, ke = (e, r) => {
228
+ }, Ke = (e, r) => {
229
229
  if (!e?.entry || !r)
230
230
  return [];
231
231
  const n = pe(e);
@@ -247,15 +247,15 @@ const ye = "_formsTableBody_1pd36_1", Ne = "_customAccordianItem_1pd36_6", Ae =
247
247
  ].filter(
248
248
  ({ formFieldPath: a }) => !a || a.includes(r)
249
249
  );
250
- }, ze = ({
250
+ }, We = ({
251
251
  episodeOfCareUuids: e,
252
252
  encounterUuids: r,
253
253
  config: n
254
254
  }) => {
255
- const { t: a } = ee(), d = re(), [c, m] = H(!1), [t, b] = H(null), g = n?.numberOfVisits, f = ae(
255
+ const { t: a } = ee(), d = re(), [c, m] = P(!1), [t, b] = P(null), v = n?.numberOfVisits, f = ae(
256
256
  e,
257
257
  r
258
- ), _ = he(), {
258
+ ), _ = ye(), {
259
259
  data: $ = [],
260
260
  isLoading: y,
261
261
  isError: N,
@@ -263,17 +263,17 @@ const ye = "_formsTableBody_1pd36_1", Ne = "_customAccordianItem_1pd36_6", Ae =
263
263
  refetch: Y
264
264
  } = A({
265
265
  queryKey: ["forms", d, e],
266
- queryFn: () => te(d, void 0, g),
266
+ queryFn: () => te(d, void 0, v),
267
267
  enabled: !!d && !f
268
- }), T = h(() => !r || r.length === 0 ? $ : $.filter(
268
+ }), T = g(() => !r || r.length === 0 ? $ : $.filter(
269
269
  (i) => r.includes(i.encounterUuid)
270
270
  ), [$, r]), { data: M = [] } = A({
271
271
  queryKey: ["observationForms"],
272
272
  queryFn: () => oe()
273
- }), V = R(
273
+ }), V = F(
274
274
  (i) => M.find((u) => u.name === i)?.uuid,
275
275
  [M]
276
- ), L = h(() => {
276
+ ), L = g(() => {
277
277
  if (t)
278
278
  return V(t.formName);
279
279
  }, [t, V]), { isLoading: Z, error: S } = A({
@@ -283,7 +283,7 @@ const ye = "_formsTableBody_1pd36_1", Ne = "_customAccordianItem_1pd36_6", Ae =
283
283
  }), {
284
284
  data: C,
285
285
  isLoading: z,
286
- error: D
286
+ error: w
287
287
  } = A({
288
288
  queryKey: ["formsEncounterFHIR", t?.encounterUuid],
289
289
  queryFn: () => se(t.encounterUuid),
@@ -295,28 +295,28 @@ const ye = "_formsTableBody_1pd36_1", Ne = "_customAccordianItem_1pd36_6", Ae =
295
295
  },
296
296
  [d]
297
297
  );
298
- const E = h(() => !C || !t?.formName ? [] : ke(
298
+ const D = g(() => !C || !t?.formName ? [] : Ke(
299
299
  C,
300
300
  t.formName
301
- ), [C, t?.formName]), w = h(
301
+ ), [C, t?.formName]), x = g(
302
302
  () => [
303
303
  { key: "recordedOn", header: a("FORM_RECORDED_ON") },
304
304
  { key: "recordedBy", header: a("FORM_RECORDED_BY") }
305
305
  ],
306
306
  [a]
307
- ), W = h(
307
+ ), W = g(
308
308
  () => [
309
309
  { key: "recordedOn", sortable: !0 },
310
310
  { key: "recordedBy", sortable: !0 }
311
311
  ],
312
312
  []
313
- ), x = h(() => {
313
+ ), E = g(() => {
314
314
  const i = T.reduce(
315
315
  (u, l) => {
316
- const v = l.formName;
317
- u[v] ??= [];
318
- const O = l.providers.map((J) => J.providerName).filter(Boolean).join(", ");
319
- return u[v].push({
316
+ const h = l.formName;
317
+ u[h] ??= [];
318
+ const O = l.providers.map((X) => X.providerName).filter(Boolean).join(", ");
319
+ return u[h].push({
320
320
  id: l.encounterUuid,
321
321
  formName: l.formName,
322
322
  recordedOn: me(l.encounterDateTime, a, fe).formattedResult,
@@ -331,15 +331,15 @@ const ye = "_formsTableBody_1pd36_1", Ne = "_customAccordianItem_1pd36_6", Ae =
331
331
  ([u, l]) => ({
332
332
  formName: u,
333
333
  records: l.sort(
334
- (v, O) => O.encounterDateTime - v.encounterDateTime
334
+ (h, O) => O.encounterDateTime - h.encounterDateTime
335
335
  )
336
336
  })
337
337
  ).sort((u, l) => u.formName.localeCompare(l.formName));
338
- }, [T, a]), B = R((i) => {
338
+ }, [T, a]), B = F((i) => {
339
339
  b(i), m(!0);
340
- }, []), X = R(() => {
340
+ }, []), J = F(() => {
341
341
  m(!1), b(null);
342
- }, []), G = R(
342
+ }, []), G = F(
343
343
  (i, u) => {
344
344
  switch (u) {
345
345
  case "recordedOn":
@@ -352,11 +352,11 @@ const ye = "_formsTableBody_1pd36_1", Ne = "_customAccordianItem_1pd36_6", Ae =
352
352
  },
353
353
  [B]
354
354
  );
355
- return /* @__PURE__ */ p(P, { children: [
356
- /* @__PURE__ */ s("div", { "data-testid": "forms-table", children: y || N || x.length === 0 || f ? /* @__PURE__ */ s(
357
- U,
355
+ return /* @__PURE__ */ p(H, { children: [
356
+ /* @__PURE__ */ s("div", { "data-testid": "forms-table", children: y || N || E.length === 0 || f ? /* @__PURE__ */ s(
357
+ q,
358
358
  {
359
- headers: w,
359
+ headers: x,
360
360
  ariaLabel: a("FORMS_HEADING"),
361
361
  rows: [],
362
362
  loading: y,
@@ -366,8 +366,8 @@ const ye = "_formsTableBody_1pd36_1", Ne = "_customAccordianItem_1pd36_6", Ae =
366
366
  className: o.formsTableBody,
367
367
  dataTestId: "forms-table"
368
368
  }
369
- ) : /* @__PURE__ */ s(le, { align: "start", children: x.map((i, u) => {
370
- const { formName: l, records: v } = i;
369
+ ) : /* @__PURE__ */ s(le, { align: "start", children: E.map((i, u) => {
370
+ const { formName: l, records: h } = i;
371
371
  return /* @__PURE__ */ s(
372
372
  ce,
373
373
  {
@@ -376,11 +376,11 @@ const ye = "_formsTableBody_1pd36_1", Ne = "_customAccordianItem_1pd36_6", Ae =
376
376
  testId: `accordian-title-${l}`,
377
377
  open: u === 0,
378
378
  children: /* @__PURE__ */ s(
379
- U,
379
+ q,
380
380
  {
381
- headers: w,
381
+ headers: x,
382
382
  ariaLabel: a("FORMS_HEADING"),
383
- rows: v,
383
+ rows: h,
384
384
  loading: !1,
385
385
  errorStateMessage: "",
386
386
  sortable: W,
@@ -400,14 +400,14 @@ const ye = "_formsTableBody_1pd36_1", Ne = "_customAccordianItem_1pd36_6", Ae =
400
400
  id: "modalIdForActionAreaLayout",
401
401
  portalId: "main-display-area",
402
402
  open: c,
403
- onRequestClose: X,
403
+ onRequestClose: J,
404
404
  modalHeading: t.formName,
405
405
  modalLabel: `${t.recordedOn} | ${t.recordedBy}`,
406
406
  passiveModal: !0,
407
407
  size: "md",
408
408
  testId: "form-details-modal",
409
- children: /* @__PURE__ */ s("div", { className: o.formContent, children: Z || z ? /* @__PURE__ */ s(be, { width: "100%", lineCount: 3 }) : S ? /* @__PURE__ */ s("div", { children: q(S).message ?? a("ERROR_FETCHING_FORM_METADATA") }) : D ? /* @__PURE__ */ s("div", { children: q(D).message ?? a("ERROR_FETCHING_FORM_DATA") }) : E.length > 0 ? /* @__PURE__ */ s("div", { className: o.formDetailsContainer, children: E.map(({ obs: i, comment: u }, l) => /* @__PURE__ */ s(
410
- qe,
409
+ children: /* @__PURE__ */ s("div", { className: o.formContent, children: Z || z ? /* @__PURE__ */ s(be, { width: "100%", lineCount: 3 }) : S ? /* @__PURE__ */ s("div", { children: U(S).message ?? a("ERROR_FETCHING_FORM_METADATA") }) : w ? /* @__PURE__ */ s("div", { children: U(w).message ?? a("ERROR_FETCHING_FORM_DATA") }) : D.length > 0 ? /* @__PURE__ */ s("div", { className: o.formDetailsContainer, children: D.map(({ obs: i, comment: u }, l) => /* @__PURE__ */ s(
410
+ Pe,
411
411
  {
412
412
  observation: i,
413
413
  index: l,
@@ -421,5 +421,5 @@ const ye = "_formsTableBody_1pd36_1", Ne = "_customAccordianItem_1pd36_6", Ae =
421
421
  ] });
422
422
  };
423
423
  export {
424
- ze as default
424
+ We as default
425
425
  };
@@ -1,5 +1,5 @@
1
- import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-BZkKJAUY.js";
2
- import { l as d, m as f, n as e } from "./index-BZal8-uJ.js";
1
+ import { c, T as l, P as m, a as v, D as u, Q as i } from "./YPM2AS64-DQ0RJ1gM.js";
2
+ import { t as d, v as f, x as e } from "./index-LxwpWbTb.js";
3
3
  var p = (a) => {
4
4
  const [r, t] = c({
5
5
  prefix: "TanstackQueryDevtools"
@@ -14,10 +14,10 @@ var p = (a) => {
14
14
  localStore: r,
15
15
  setLocalStore: t,
16
16
  get children() {
17
- return e(u.Provider, {
17
+ return e(v.Provider, {
18
18
  value: s,
19
19
  get children() {
20
- return e(v, {
20
+ return e(u, {
21
21
  localStore: r,
22
22
  setLocalStore: t
23
23
  });
@@ -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-BZkKJAUY.js";
2
- import { l as v, m as C, n as e } from "./index-BZal8-uJ.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-DQ0RJ1gM.js";
2
+ import { t as v, v as C, x as e } from "./index-LxwpWbTb.js";
3
3
  var h = (t) => {
4
4
  const [r, o] = s({
5
5
  prefix: "TanstackQueryDevtools"
@@ -0,0 +1,171 @@
1
+ import { jsxs as I, jsx as l } from "react/jsx-runtime";
2
+ import { p as k, o as B, u as N, k as K, l as Q, d as H, h as j, H as w, n as x, L as G, A as M, r as W, s as S, V as P, i as z, Q as Y, F as J, q as X, W as Z } from "./index-LxwpWbTb.js";
3
+ import { useQueries as ee, useQuery as te } from "@tanstack/react-query";
4
+ import { useRef as ae, useEffect as $, useMemo as E } from "react";
5
+ const F = (t, d, n, u, o) => {
6
+ const a = P(t, d), r = a.value, s = z(r);
7
+ let i = r;
8
+ s === "Image" && (i = /* @__PURE__ */ l(J, { imageSrc: r, alt: r, id: `${r}-img` })), s === "Video" && (i = /* @__PURE__ */ l(X, { id: `${r}-video`, videoSrc: r })), s === "PDF" && (i = /* @__PURE__ */ l(Z, { id: `${r}-pdf`, src: r }));
9
+ const b = o("OBSERVATIONS_RECORDED_BY", {
10
+ provider: a.provider
11
+ }), p = t.display, v = t.observationValue?.isAbnormal ? "abnormal-obs" : "obs", c = u ? `${u}-${v}-${p}-${n}-${d}` : `${v}-${p}-${n}-${d}`;
12
+ return /* @__PURE__ */ l(
13
+ Y,
14
+ {
15
+ header: a.header,
16
+ value: i,
17
+ info: b,
18
+ id: c,
19
+ testId: c,
20
+ ariaLabel: c
21
+ },
22
+ `obs-${t.id}`
23
+ );
24
+ }, re = (t, d, n, u, o, a) => /* @__PURE__ */ l(
25
+ S,
26
+ {
27
+ title: t.display,
28
+ id: `grouped-obs-${t.display}-${u}`,
29
+ open: n,
30
+ children: t.members?.map(
31
+ (r, s) => F(r, s, o, a, d)
32
+ )
33
+ },
34
+ `grouped-obs-${t.id}`
35
+ ), se = ({
36
+ groupedData: t,
37
+ title: d = ""
38
+ }) => {
39
+ const { t: n } = N(), u = (o, a, r) => {
40
+ const s = W(o.encounterDetails, n);
41
+ return /* @__PURE__ */ I(
42
+ S,
43
+ {
44
+ title: s,
45
+ id: `encounter-${o.encounterId}`,
46
+ open: a,
47
+ children: [
48
+ o.observations.map(
49
+ (i, b) => F(i, b, r, d, n)
50
+ ),
51
+ o.groupedObservations.map(
52
+ (i, b) => re(
53
+ i,
54
+ n,
55
+ a,
56
+ b,
57
+ r,
58
+ d
59
+ )
60
+ )
61
+ ]
62
+ },
63
+ `encounter-${o.encounterId}`
64
+ );
65
+ };
66
+ return /* @__PURE__ */ l(
67
+ "div",
68
+ {
69
+ id: "obs-by-encounter",
70
+ "data-testid": "obs-by-encounter-test-id",
71
+ "aria-label": "obs-by-encounter-aria-label",
72
+ children: t.map(
73
+ (o, a) => u(o, a === 0, a)
74
+ )
75
+ }
76
+ );
77
+ }, oe = "_observations_kfbhq_1", ie = "_title_kfbhq_12", T = {
78
+ observations: oe,
79
+ title: ie
80
+ }, ne = (t) => ["conceptUuid", t], de = (t, d) => ["observations", t, ...d], pe = ({ config: t }) => {
81
+ const d = t, { conceptNames: n = [], conceptUuid: u = [] } = d, o = ae(/* @__PURE__ */ new Set()), a = k(), { addNotification: r } = B(), { t: s } = N(), i = ee({
82
+ queries: n.map((e) => ({
83
+ queryKey: ne(e),
84
+ queryFn: () => K(e),
85
+ enabled: !!e
86
+ }))
87
+ });
88
+ $(() => {
89
+ i.forEach((e, m) => {
90
+ if (e.isError && !o.current.has(m)) {
91
+ const C = n[m];
92
+ r({
93
+ title: s("ERROR_DEFAULT_TITLE"),
94
+ message: s("ERROR_FETCHING_CONCEPT", { conceptName: C }),
95
+ type: "error"
96
+ }), o.current.add(m);
97
+ } else e.isError || o.current.delete(m);
98
+ });
99
+ }, [i, n]);
100
+ const b = E(() => i.map((e) => e.data?.uuid).filter((e) => !!e), [i]), p = E(() => [.../* @__PURE__ */ new Set([...b, ...u])], [b, u]), v = E(() => n.length === 0 ? !0 : i.every((e) => !e.isLoading), [i, n.length]), {
101
+ data: c,
102
+ isLoading: A,
103
+ isError: R,
104
+ refetch: g
105
+ } = te({
106
+ queryKey: de(a, p),
107
+ queryFn: () => Q(a, p),
108
+ enabled: !!a && p.length > 0 && v
109
+ });
110
+ H(
111
+ (e) => {
112
+ e.patientUUID === a && e.updatedConcepts.size > 0 && [...e.updatedConcepts.keys()].some(
113
+ (m) => p.includes(m)
114
+ ) && g();
115
+ },
116
+ [a, g]
117
+ ), $(() => {
118
+ R && r({
119
+ title: s("ERROR_DEFAULT_TITLE"),
120
+ message: s("ERROR_FETCHING_OBSERVATIONS"),
121
+ type: "error"
122
+ });
123
+ }, [R]);
124
+ const f = E(() => {
125
+ if (!c) return [];
126
+ const e = j(c), m = w(e);
127
+ return x(m);
128
+ }, [c]), L = [
129
+ { key: "name", header: "name" },
130
+ { key: "value", header: "value" },
131
+ { key: "form", header: "form" }
132
+ ], O = A || !v, _ = R && v, D = (!c || c.entry?.length === 0 || p.length === 0) && v, q = _ ? s("ERROR_FETCHING_OBSERVATIONS") : null, U = D ? s("NO_OBSERVATIONS_FOUND") : void 0, V = f.length > 0 && !O && !_, h = d.titleTranslationKey, y = h ? s(h) : "";
133
+ return /* @__PURE__ */ I(
134
+ "div",
135
+ {
136
+ id: "observations",
137
+ "data-testid": h ? `observations-${y}` : "observations",
138
+ "aria-label": "observations-aria-label",
139
+ className: T.observations,
140
+ children: [
141
+ /* @__PURE__ */ l(
142
+ G,
143
+ {
144
+ id: "observations-title",
145
+ testId: h ? `observations-title-${y}` : "observations-title",
146
+ title: y,
147
+ className: T.title,
148
+ children: /* @__PURE__ */ l("p", { children: y })
149
+ }
150
+ ),
151
+ V ? /* @__PURE__ */ l(se, { groupedData: f, title: y }) : /* @__PURE__ */ l(
152
+ M,
153
+ {
154
+ headers: L,
155
+ rows: [],
156
+ ariaLabel: s("OBSERVATIONS"),
157
+ loading: O,
158
+ errorStateMessage: q,
159
+ emptyStateMessage: U,
160
+ dataTestId: "observations-table"
161
+ }
162
+ )
163
+ ]
164
+ }
165
+ );
166
+ };
167
+ export {
168
+ ne as conceptUuidQueryKeys,
169
+ pe as default,
170
+ de as observationsQueryKeys
171
+ };