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

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