@bahmni/widgets 0.0.1-dev.270 → 0.0.1-dev.272

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,17 +1,17 @@
1
- import { jsx as s, jsxs as _, Fragment as Q } from "react/jsx-runtime";
2
- import { u as W, a as X, p as J, f as Z, T as x, m as ee, y as te } from "./index-xrLM2RJL.js";
1
+ import { jsx as r, jsxs as T, Fragment as Y } from "react/jsx-runtime";
2
+ import { u as W, a as X, p as J, b as Z, T as x, m as ee, y as te } from "./index-Deay0cXM.js";
3
3
  import { useQuery as ne } from "@tanstack/react-query";
4
- import { useState as l, useCallback as p, useEffect as N, useMemo as f } from "react";
4
+ import { useState as m, useCallback as p, useEffect as I, useMemo as _ } from "react";
5
5
  import { useTranslation as ae } from "react-i18next";
6
- const oe = "_documentsTableBody_1voj8_1", re = "_viewAttachmentsLink_1voj8_11", se = "_documentViewerContainer_1voj8_15", ce = "_attachmentItem_1voj8_23", de = "_attachmentCounter_1voj8_27", ie = "_attachmentError_1voj8_36", le = "_documentIframe_1voj8_44", me = "_documentImage_1voj8_50", c = {
6
+ const oe = "DocumentsTable-module_documentsTableBody__6iR3w", se = "DocumentsTable-module_viewAttachmentsLink__aQ1on", re = "DocumentsTable-module_documentViewerContainer__F5m8D", ce = "DocumentsTable-module_attachmentItem__17KA7", de = "DocumentsTable-module_attachmentCounter__WFiI3", le = "DocumentsTable-module_attachmentError__RI4U2", me = "DocumentsTable-module_documentIframe__ptq5I", ie = "DocumentsTable-module_documentImage__KQVgS", c = {
7
7
  documentsTableBody: oe,
8
- viewAttachmentsLink: re,
9
- documentViewerContainer: se,
8
+ viewAttachmentsLink: se,
9
+ documentViewerContainer: re,
10
10
  attachmentItem: ce,
11
11
  attachmentCounter: de,
12
- attachmentError: ie,
13
- documentIframe: le,
14
- documentImage: me
12
+ attachmentError: le,
13
+ documentIframe: me,
14
+ documentImage: ie
15
15
  }, ue = {
16
16
  documentIdentifier: "DOCUMENTS_DOCUMENT_IDENTIFIER",
17
17
  documentType: "DOCUMENTS_TYPE",
@@ -19,99 +19,99 @@ const oe = "_documentsTableBody_1voj8_1", re = "_viewAttachmentsLink_1voj8_11",
19
19
  uploadedBy: "DOCUMENTS_UPLOADED_BY",
20
20
  action: "DOCUMENTS_ACTION"
21
21
  };
22
- function j(n) {
22
+ function B(n) {
23
23
  return !n || n.includes(":") ? "#" : `/openmrs/auth?requested_document=/document_images/${n}`;
24
24
  }
25
- function he(n, E) {
25
+ function he(n, f) {
26
26
  return n.map((d) => ({
27
27
  key: d,
28
- header: E(ue[d])
28
+ header: f(ue[d])
29
29
  }));
30
30
  }
31
- const _e = [
31
+ const Te = [
32
32
  "documentIdentifier",
33
33
  "documentType",
34
34
  "uploadedOn",
35
35
  "uploadedBy",
36
36
  "action"
37
- ], pe = /\.(jpg|jpeg|png|gif|webp|bmp|svg)$/i, R = (n) => n.attachments.length > 0 ? n.attachments : n.documentUrl ? [{ url: n.documentUrl, contentType: n.contentType }] : [], Ne = ({ config: n, encounterUuids: E }) => {
38
- const [d, M] = l(!1), [r, U] = l(
37
+ ], pe = /\.(jpg|jpeg|png|gif|webp|bmp|svg)$/i, F = (n) => n.attachments.length > 0 ? n.attachments : n.documentUrl ? [{ url: n.documentUrl, contentType: n.contentType }] : [], Ie = ({ config: n, encounterUuids: f }) => {
38
+ const [d, M] = m(!1), [s, U] = m(
39
39
  null
40
- ), [P, A] = l(
40
+ ), [P, A] = m(
41
41
  /* @__PURE__ */ new Set()
42
- ), T = W(), { t: o } = ae(), { addNotification: w } = X(), F = Number(n?.pageSize) || 5, [D, O] = l(1), [m, $] = l(F), [k, C] = l(void 0), b = p((e) => {
42
+ ), E = W(), { t: o } = ae(), { addNotification: w } = X(), V = Number(n?.pageSize) || 5, [N, O] = m(1), [i, $] = m(V), [k, C] = m(void 0), v = p((e) => {
43
43
  U(e), M(!0);
44
- }, []), V = p(() => {
44
+ }, []), z = p(() => {
45
45
  M(!1), U(null), A(/* @__PURE__ */ new Set());
46
- }, []), B = p((e) => {
46
+ }, []), R = p((e) => {
47
47
  A((t) => new Set(t).add(e));
48
- }, []), { data: u, isLoading: z, isError: S, error: y } = ne({
48
+ }, []), { data: u, isLoading: H, isError: S, error: y } = ne({
49
49
  queryKey: [
50
50
  "documents",
51
- T,
52
51
  E,
53
- D,
54
- m
52
+ f,
53
+ N,
54
+ i
55
55
  ],
56
- enabled: !!T,
56
+ enabled: !!E,
57
57
  queryFn: () => J(
58
- T,
59
58
  E,
60
- m,
61
- D
59
+ f,
60
+ i,
61
+ N
62
62
  )
63
63
  });
64
- N(() => {
64
+ I(() => {
65
65
  u && C(u.total);
66
- }, [u]), N(() => {
66
+ }, [u]), I(() => {
67
67
  O(1), C(void 0);
68
- }, [T]), N(() => {
68
+ }, [E]), I(() => {
69
69
  S && w({
70
70
  title: o("ERROR_DEFAULT_TITLE"),
71
71
  message: y?.message ?? "",
72
72
  type: "error"
73
73
  });
74
- }, [S, y, w, o]), N(() => {
74
+ }, [S, y, w, o]), I(() => {
75
75
  const e = new AbortController();
76
76
  return (async () => {
77
- if (!d || !r) return;
78
- const a = /* @__PURE__ */ new Set(), I = R(r);
79
- for (let i = 0; i < I.length; i++) {
80
- const v = j(I[i].url);
77
+ if (!d || !s) return;
78
+ const a = /* @__PURE__ */ new Set(), g = F(s);
79
+ for (let l = 0; l < g.length; l++) {
80
+ const b = B(g[l].url);
81
81
  try {
82
- (await fetch(v, {
82
+ (await fetch(b, {
83
83
  method: "HEAD",
84
84
  signal: e.signal
85
- })).ok || a.add(i);
85
+ })).ok || a.add(l);
86
86
  } catch (L) {
87
- L instanceof Error && L.name !== "AbortError" && a.add(i);
87
+ L instanceof Error && L.name !== "AbortError" && a.add(l);
88
88
  }
89
89
  }
90
90
  e.signal.aborted || A(a);
91
91
  })(), () => e.abort();
92
- }, [d, r]);
93
- const H = p(
92
+ }, [d, s]);
93
+ const q = p(
94
94
  (e, t) => {
95
- t !== m ? ($(t), O(1), C(void 0)) : O(e);
95
+ t !== i ? ($(t), O(1), C(void 0)) : O(e);
96
96
  },
97
- [m]
98
- ), g = f(
99
- () => n?.fields ?? _e,
97
+ [i]
98
+ ), D = _(
99
+ () => n?.fields ?? Te,
100
100
  [n?.fields]
101
- ), q = f(() => [...u?.documents ?? []].sort((t, a) => !t.uploadedOn && !a.uploadedOn ? 0 : t.uploadedOn ? a.uploadedOn ? new Date(a.uploadedOn).getTime() - new Date(t.uploadedOn).getTime() : -1 : 1), [u]), G = f(() => he(g, o), [g, o]), Y = f(
102
- () => g.map((e) => ({
101
+ ), j = _(() => [...u?.documents ?? []].sort((t, a) => !t.uploadedOn && !a.uploadedOn ? 0 : t.uploadedOn ? a.uploadedOn ? new Date(a.uploadedOn).getTime() - new Date(t.uploadedOn).getTime() : -1 : 1), [u]), K = _(() => he(D, o), [D, o]), G = _(
102
+ () => D.map((e) => ({
103
103
  key: e,
104
104
  sortable: e !== "action"
105
105
  })),
106
- [g]
107
- ), h = f(
108
- () => r ? R(r) : [],
109
- [r]
110
- ), K = p(
106
+ [D]
107
+ ), h = _(
108
+ () => s ? F(s) : [],
109
+ [s]
110
+ ), Q = p(
111
111
  (e, t) => {
112
112
  switch (t) {
113
113
  case "documentIdentifier":
114
- return /* @__PURE__ */ s("span", { children: e.documentIdentifier });
114
+ return /* @__PURE__ */ r("span", { children: e.documentIdentifier });
115
115
  case "documentType":
116
116
  return e.documentType ?? o("DOCUMENTS_NOT_AVAILABLE");
117
117
  case "uploadedOn":
@@ -123,10 +123,10 @@ const _e = [
123
123
  case "uploadedBy":
124
124
  return e.uploadedBy ?? o("DOCUMENTS_NOT_AVAILABLE");
125
125
  case "action":
126
- return e.attachments.length > 0 || !!e.documentUrl ? /* @__PURE__ */ s(
126
+ return e.attachments.length > 0 || !!e.documentUrl ? /* @__PURE__ */ r(
127
127
  Z,
128
128
  {
129
- onClick: () => b(e),
129
+ onClick: () => v(e),
130
130
  className: c.viewAttachmentsLink,
131
131
  "data-testid": `view-attachments-${e.id}`,
132
132
  children: o("DOCUMENTS_VIEW_ATTACHMENTS")
@@ -136,87 +136,87 @@ const _e = [
136
136
  return null;
137
137
  }
138
138
  },
139
- [b, o]
139
+ [v, o]
140
140
  );
141
- return /* @__PURE__ */ _(Q, { children: [
142
- /* @__PURE__ */ s("div", { "data-testid": "documents-table", children: /* @__PURE__ */ s(
141
+ return /* @__PURE__ */ T(Y, { children: [
142
+ /* @__PURE__ */ r("div", { "data-testid": "documents-table", children: /* @__PURE__ */ r(
143
143
  ee,
144
144
  {
145
- headers: G,
145
+ headers: K,
146
146
  ariaLabel: o("DOCUMENTS_TABLE_HEADING"),
147
- rows: q,
148
- loading: z,
147
+ rows: j,
148
+ loading: H,
149
149
  errorStateMessage: S ? y?.message : null,
150
- sortable: Y,
150
+ sortable: G,
151
151
  emptyStateMessage: o("DOCUMENTS_NO_RECORDS"),
152
- renderCell: K,
152
+ renderCell: Q,
153
153
  className: c.documentsTableBody,
154
154
  dataTestId: "documents-table",
155
- pageSize: m,
155
+ pageSize: i,
156
156
  totalItems: k,
157
- page: D,
158
- onPageChange: H
157
+ page: N,
158
+ onPageChange: q
159
159
  }
160
160
  ) }),
161
- d && r && /* @__PURE__ */ s(
161
+ d && s && /* @__PURE__ */ r(
162
162
  te,
163
163
  {
164
164
  id: "modalIdForActionAreaLayout",
165
165
  portalId: "main-display-area",
166
166
  open: d,
167
- onRequestClose: V,
168
- modalHeading: r.documentIdentifier,
167
+ onRequestClose: z,
168
+ modalHeading: s.documentIdentifier,
169
169
  passiveModal: !0,
170
170
  size: "lg",
171
171
  testId: "document-view-modal",
172
- children: /* @__PURE__ */ s("div", { className: c.documentViewerContainer, children: h.map((e, t) => {
173
- const a = j(e.url), I = e.contentType?.toLowerCase().includes("pdf"), i = (e.contentType?.toLowerCase().includes("image") ?? !1) || pe.test(e.url ?? ""), v = P.has(t);
174
- return a === "#" || v ? /* @__PURE__ */ _(
172
+ children: /* @__PURE__ */ r("div", { className: c.documentViewerContainer, children: h.map((e, t) => {
173
+ const a = B(e.url), g = e.contentType?.toLowerCase().includes("pdf"), l = (e.contentType?.toLowerCase().includes("image") ?? !1) || pe.test(e.url ?? ""), b = P.has(t);
174
+ return a === "#" || b ? /* @__PURE__ */ T(
175
175
  "div",
176
176
  {
177
177
  className: c.attachmentError,
178
178
  "data-testid": `attachment-error-${t}`,
179
179
  children: [
180
- h.length > 1 && /* @__PURE__ */ _("p", { className: c.attachmentCounter, children: [
180
+ h.length > 1 && /* @__PURE__ */ T("p", { className: c.attachmentCounter, children: [
181
181
  t + 1,
182
182
  "/",
183
183
  h.length
184
184
  ] }),
185
- /* @__PURE__ */ s("p", { children: o("DOCUMENTS_ERROR_LOADING_ATTACHMENT") })
185
+ /* @__PURE__ */ r("p", { children: o("DOCUMENTS_ERROR_LOADING_ATTACHMENT") })
186
186
  ]
187
187
  },
188
- `${r.id}-${e.url}`
189
- ) : /* @__PURE__ */ _(
188
+ `${s.id}-${e.url}`
189
+ ) : /* @__PURE__ */ T(
190
190
  "div",
191
191
  {
192
192
  className: c.attachmentItem,
193
193
  "data-testid": `attachment-item-${t}`,
194
194
  children: [
195
- h.length > 1 && /* @__PURE__ */ _("p", { className: c.attachmentCounter, children: [
195
+ h.length > 1 && /* @__PURE__ */ T("p", { className: c.attachmentCounter, children: [
196
196
  t + 1,
197
197
  "/",
198
198
  h.length
199
199
  ] }),
200
- i ? /* @__PURE__ */ s(
200
+ l ? /* @__PURE__ */ r(
201
201
  "img",
202
202
  {
203
203
  src: a,
204
- alt: r.documentIdentifier,
204
+ alt: s.documentIdentifier,
205
205
  className: c.documentImage,
206
- onError: () => B(t)
206
+ onError: () => R(t)
207
207
  }
208
- ) : /* @__PURE__ */ s(
208
+ ) : /* @__PURE__ */ r(
209
209
  "iframe",
210
210
  {
211
- src: I ? `${a}#toolbar=0` : a,
211
+ src: g ? `${a}#toolbar=0` : a,
212
212
  className: c.documentIframe,
213
- title: r.documentIdentifier,
214
- onError: () => B(t)
213
+ title: s.documentIdentifier,
214
+ onError: () => R(t)
215
215
  }
216
216
  )
217
217
  ]
218
218
  },
219
- `${r.id}-${e.url}`
219
+ `${s.id}-${e.url}`
220
220
  );
221
221
  }) })
222
222
  }
@@ -224,5 +224,5 @@ const _e = [
224
224
  ] });
225
225
  };
226
226
  export {
227
- Ne as default
227
+ Ie as default
228
228
  };
@@ -1,11 +1,11 @@
1
1
  import { jsx as n, jsxs as Z, Fragment as ee } from "react/jsx-runtime";
2
- import { z as re, u as te, D as oe, K as ae, Y as se, G as ne, I as de, c as ie, M as U, T as me, f as ce, m as x, e as le, t as ue, y as fe, O as ye } from "./index-xrLM2RJL.js";
2
+ import { z as re, u as te, D as oe, K as ae, Y as se, G as ne, I as de, c as ie, M as U, T as me, b as le, m as x, e as ce, t as ue, y as fe, O as ye } from "./index-Deay0cXM.js";
3
3
  import { useQueryClient as be, useQuery as y } from "@tanstack/react-query";
4
4
  import { useState as k, useMemo as d, useCallback as b } from "react";
5
5
  import { useTranslation as pe } from "react-i18next";
6
- const ge = "_formsTableBody_ourq9_5", Ne = "_customAccordianItem_ourq9_10", O = {
6
+ const ge = "FormsTable-module_formsTableBody__SvGha", Fe = "FormsTable-module_customAccordianItem__isszs", O = {
7
7
  formsTableBody: ge,
8
- customAccordianItem: Ne
8
+ customAccordianItem: Fe
9
9
  }, he = (m) => m ? m.extension?.find(
10
10
  (p) => p.url === re
11
11
  )?.valueString : void 0, Me = ({
@@ -13,7 +13,7 @@ const ge = "_formsTableBody_ourq9_5", Ne = "_customAccordianItem_ourq9_10", O =
13
13
  encounterUuids: i,
14
14
  config: p
15
15
  }) => {
16
- const { t: s } = pe(), c = te(), [l, D] = k(!1), [o, I] = k(null), {
16
+ const { t: s } = pe(), l = te(), [c, D] = k(!1), [o, I] = k(null), {
17
17
  numberOfVisits: K,
18
18
  hideThumbnail: P = !1,
19
19
  forms: u
@@ -22,15 +22,15 @@ const ge = "_formsTableBody_ourq9_5", Ne = "_customAccordianItem_ourq9_10", O =
22
22
  i
23
23
  ), w = be(), {
24
24
  data: A = [],
25
- isLoading: v,
26
- isError: B,
27
- error: H,
28
- refetch: j
25
+ isLoading: T,
26
+ isError: v,
27
+ error: z,
28
+ refetch: G
29
29
  } = y({
30
- queryKey: ["forms", c, m],
31
- queryFn: () => ae(c, void 0, K),
32
- enabled: !!c && !M
33
- }), T = d(() => {
30
+ queryKey: ["forms", l, m],
31
+ queryFn: () => ae(l, void 0, K),
32
+ enabled: !!l && !M
33
+ }), B = d(() => {
34
34
  let e = A;
35
35
  return i && i.length > 0 && (e = e.filter(
36
36
  (t) => i.includes(t.encounterUuid)
@@ -47,38 +47,38 @@ const ge = "_formsTableBody_ourq9_5", Ne = "_customAccordianItem_ourq9_10", O =
47
47
  if (o)
48
48
  return R(o.formName);
49
49
  }, [o, R]), {
50
- isLoading: z,
51
- isError: G,
52
- error: N
50
+ isLoading: H,
51
+ isError: j,
52
+ error: F
53
53
  } = y({
54
54
  queryKey: ["formMetadata", g],
55
55
  queryFn: () => ne(g),
56
- enabled: !!g && l
56
+ enabled: !!g && c
57
57
  }), {
58
58
  data: h,
59
59
  isLoading: V,
60
60
  isError: $,
61
- error: E
61
+ error: N
62
62
  } = y({
63
63
  queryKey: ["formsEncounterFHIR", o?.encounterUuid],
64
64
  queryFn: () => de(o.encounterUuid),
65
- enabled: !!o?.encounterUuid && l
65
+ enabled: !!o?.encounterUuid && c
66
66
  });
67
67
  ie(
68
68
  (e) => {
69
- e.patientUUID === c && e.updatedConcepts.size > 0 && (j(), w.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
69
+ e.patientUUID === l && e.updatedConcepts.size > 0 && (G(), w.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
70
70
  },
71
- [c]
71
+ [l]
72
72
  );
73
73
  const Q = d(() => !h?.entry || !o?.formName ? [] : h.entry.filter((t) => t.resource?.resourceType === "Observation").map((t) => t.resource).filter((t) => {
74
74
  const r = he(t);
75
75
  return !r || r.includes(o.formName);
76
76
  }), [h, o?.formName]), Y = d(() => {
77
+ if (F)
78
+ return U(F).message;
77
79
  if (N)
78
80
  return U(N).message;
79
- if (E)
80
- return U(E).message;
81
- }, [N, E]), _ = d(
81
+ }, [F, N]), _ = d(
82
82
  () => [
83
83
  { key: "recordedOn", header: s("RECORDED_ON") },
84
84
  { key: "recordedBy", header: s("RECORDED_BY") }
@@ -90,17 +90,17 @@ const ge = "_formsTableBody_ourq9_5", Ne = "_customAccordianItem_ourq9_10", O =
90
90
  { key: "recordedBy", sortable: !0 }
91
91
  ],
92
92
  []
93
- ), q = d(() => {
94
- const e = T.reduce(
93
+ ), C = d(() => {
94
+ const e = B.reduce(
95
95
  (r, a) => {
96
96
  const f = a.formName;
97
97
  r[f] ??= [];
98
- const F = a.providers.map((X) => X.providerName).filter(Boolean).join(", ");
98
+ const E = a.providers.map((X) => X.providerName).filter(Boolean).join(", ");
99
99
  return r[f].push({
100
100
  id: a.encounterUuid,
101
101
  formName: a.formName,
102
102
  recordedOn: me(a.encounterDateTime, s, !0).formattedResult,
103
- recordedBy: F ?? "--",
103
+ recordedBy: E ?? "--",
104
104
  encounterDateTime: a.encounterDateTime,
105
105
  encounterUuid: a.encounterUuid
106
106
  }), r;
@@ -111,42 +111,42 @@ const ge = "_formsTableBody_ourq9_5", Ne = "_customAccordianItem_ourq9_10", O =
111
111
  ([r, a]) => ({
112
112
  formName: r,
113
113
  records: a.sort(
114
- (f, F) => F.encounterDateTime - f.encounterDateTime
114
+ (f, E) => E.encounterDateTime - f.encounterDateTime
115
115
  )
116
116
  })
117
117
  ).sort((r, a) => r.formName.localeCompare(a.formName));
118
- }, [T, s]), C = b((e) => {
118
+ }, [B, s]), S = b((e) => {
119
119
  I(e), D(!0);
120
120
  }, []), W = b(() => {
121
121
  D(!1), I(null);
122
- }, []), S = b(
122
+ }, []), q = b(
123
123
  (e, t) => {
124
124
  switch (t) {
125
125
  case "recordedOn":
126
- return /* @__PURE__ */ n(ce, { onClick: () => C(e), children: e.recordedOn });
126
+ return /* @__PURE__ */ n(le, { onClick: () => S(e), children: e.recordedOn });
127
127
  case "recordedBy":
128
128
  return e.recordedBy;
129
129
  default:
130
130
  return null;
131
131
  }
132
132
  },
133
- [C]
133
+ [S]
134
134
  );
135
135
  return /* @__PURE__ */ Z(ee, { children: [
136
- /* @__PURE__ */ n("div", { id: "forms-table", "data-testid": "forms-table", children: v || B || q.length === 0 || M ? /* @__PURE__ */ n(
136
+ /* @__PURE__ */ n("div", { id: "forms-table", "data-testid": "forms-table", children: T || v || C.length === 0 || M ? /* @__PURE__ */ n(
137
137
  x,
138
138
  {
139
139
  headers: _,
140
140
  ariaLabel: s("FORMS_HEADING"),
141
141
  rows: [],
142
- loading: v,
143
- errorStateMessage: B ? H?.message : void 0,
142
+ loading: T,
143
+ errorStateMessage: v ? z?.message : void 0,
144
144
  emptyStateMessage: s("FORMS_UNAVAILABLE"),
145
- renderCell: S,
145
+ renderCell: q,
146
146
  className: O.formsTableBody,
147
147
  dataTestId: "forms-table"
148
148
  }
149
- ) : /* @__PURE__ */ n(le, { align: "start", children: q.map((e, t) => {
149
+ ) : /* @__PURE__ */ n(ce, { align: "start", children: C.map((e, t) => {
150
150
  const { formName: r, records: a } = e;
151
151
  return /* @__PURE__ */ n(
152
152
  ue,
@@ -165,7 +165,7 @@ const ge = "_formsTableBody_ourq9_5", Ne = "_customAccordianItem_ourq9_10", O =
165
165
  errorStateMessage: "",
166
166
  sortable: J,
167
167
  emptyStateMessage: s("FORMS_UNAVAILABLE"),
168
- renderCell: S,
168
+ renderCell: q,
169
169
  className: O.formsTableBody,
170
170
  dataTestId: `forms-table-${r}`
171
171
  }
@@ -174,12 +174,12 @@ const ge = "_formsTableBody_ourq9_5", Ne = "_customAccordianItem_ourq9_10", O =
174
174
  r
175
175
  );
176
176
  }) }) }),
177
- l && o && /* @__PURE__ */ n(
177
+ c && o && /* @__PURE__ */ n(
178
178
  fe,
179
179
  {
180
180
  id: "modalIdForActionAreaLayout",
181
181
  portalId: "main-display-area",
182
- open: l,
182
+ open: c,
183
183
  onRequestClose: W,
184
184
  modalHeading: o.formName,
185
185
  modalLabel: `${o.recordedOn} | ${o.recordedBy}`,
@@ -190,8 +190,8 @@ const ge = "_formsTableBody_ourq9_5", Ne = "_customAccordianItem_ourq9_10", O =
190
190
  ye,
191
191
  {
192
192
  observations: Q,
193
- isLoading: z || V,
194
- isError: G || $,
193
+ isLoading: H || V,
194
+ isError: j || $,
195
195
  errorMessage: Y,
196
196
  emptyStateMessage: s("NO_FORM_DATA_AVAILABLE"),
197
197
  testIdPrefix: o.formName,
@@ -1,10 +1,10 @@
1
- import { jsx as l, jsxs as S } from "react/jsx-runtime";
2
- import { b as V, C as D, d as k, g as K, i as Q, x as q, h as G, j as P, u as j, a as H, k as x, l as z, c as Y, n as J, o as W, s as X, $ as Z, m as ee } from "./index-xrLM2RJL.js";
1
+ import { jsx as l, jsxs as C } from "react/jsx-runtime";
2
+ import { f as V, x as D, d as k, g as w, i as Q, h as q, j as G, k as P, u as j, a as z, l as H, n as J, c as Y, o as x, q as W, s as X, r as Z, m as ee } from "./index-Deay0cXM.js";
3
3
  import { useQueries as te, useQuery as se } from "@tanstack/react-query";
4
- import { useRef as oe, useEffect as C, useMemo as h } from "react";
4
+ import { useRef as oe, useEffect as S, useMemo as h } from "react";
5
5
  import { useTranslation as U } from "react-i18next";
6
6
  const B = (t, i, c, d, u, r) => {
7
- const s = k(t, i, u), o = s.value, a = K(o);
7
+ const s = k(t, i, u), o = s.value, a = w(o);
8
8
  let n = o;
9
9
  a === "Image" && (n = /* @__PURE__ */ l(
10
10
  q,
@@ -24,7 +24,7 @@ const B = (t, i, c, d, u, r) => {
24
24
  )), a === "PDF" && (n = /* @__PURE__ */ l(P, { id: `${o}-pdf`, src: o }));
25
25
  const b = u("OBSERVATIONS_RECORDED_BY", {
26
26
  provider: s.provider
27
- }), p = t.display, m = t.observationValue?.isAbnormal ? "abnormal-obs" : "obs", y = d ? `${d}-${m}-${p}-${c}-${i}` : `${m}-${p}-${c}-${i}`;
27
+ }), m = t.display, p = t.observationValue?.isAbnormal ? "abnormal-obs" : "obs", y = d ? `${d}-${p}-${m}-${c}-${i}` : `${p}-${m}-${c}-${i}`;
28
28
  return /* @__PURE__ */ l(
29
29
  Q,
30
30
  {
@@ -62,7 +62,7 @@ const B = (t, i, c, d, u, r) => {
62
62
  }) => {
63
63
  const { t: d } = U(), u = (r, s, o) => {
64
64
  const a = V(r.encounterDetails, d);
65
- return /* @__PURE__ */ S(
65
+ return /* @__PURE__ */ C(
66
66
  D,
67
67
  {
68
68
  title: a,
@@ -106,7 +106,7 @@ const B = (t, i, c, d, u, r) => {
106
106
  )
107
107
  }
108
108
  );
109
- }, ne = "_observations_w45xp_1", ie = "_title_w45xp_18", N = {
109
+ }, ne = "Observations-module_observations__RKSyo", ie = "Observations-module_title__TJL3z", N = {
110
110
  observations: ne,
111
111
  title: ie
112
112
  }, ce = (t) => ["conceptUuid", t], de = (t, i) => ["observations", t, ...i], ve = ({ config: t }) => {
@@ -114,59 +114,59 @@ const B = (t, i, c, d, u, r) => {
114
114
  conceptNames: c = [],
115
115
  conceptUuid: d = [],
116
116
  hideThumbnail: u = !1
117
- } = i, r = oe(/* @__PURE__ */ new Set()), s = j(), { addNotification: o } = H(), { t: a } = U(), n = te({
117
+ } = i, r = oe(/* @__PURE__ */ new Set()), s = j(), { addNotification: o } = z(), { t: a } = U(), n = te({
118
118
  queries: c.map((e) => ({
119
119
  queryKey: ce(e),
120
- queryFn: () => x(e),
120
+ queryFn: () => H(e),
121
121
  enabled: !!e
122
122
  }))
123
123
  });
124
- C(() => {
124
+ S(() => {
125
125
  n.forEach((e, v) => {
126
126
  if (e.isError && !r.current.has(v)) {
127
- const R = c[v];
127
+ const T = c[v];
128
128
  o({
129
129
  title: a("ERROR_DEFAULT_TITLE"),
130
- message: a("ERROR_FETCHING_CONCEPT", { conceptName: R }),
130
+ message: a("ERROR_FETCHING_CONCEPT", { conceptName: T }),
131
131
  type: "error"
132
132
  }), r.current.add(v);
133
133
  } else e.isError || r.current.delete(v);
134
134
  });
135
135
  }, [n, c]);
136
- const b = h(() => n.map((e) => e.data?.uuid).filter((e) => !!e), [n]), p = h(() => [.../* @__PURE__ */ new Set([...b, ...d])], [b, d]), f = h(() => c.length === 0 ? !0 : n.every((e) => !e.isLoading), [n, c.length]), {
137
- data: m,
136
+ const b = h(() => n.map((e) => e.data?.uuid).filter((e) => !!e), [n]), m = h(() => [.../* @__PURE__ */ new Set([...b, ...d])], [b, d]), f = h(() => c.length === 0 ? !0 : n.every((e) => !e.isLoading), [n, c.length]), {
137
+ data: p,
138
138
  isLoading: y,
139
139
  isError: g,
140
- refetch: T
140
+ refetch: R
141
141
  } = se({
142
- queryKey: de(s, p),
143
- queryFn: () => z(s, p),
144
- enabled: !!s && p.length > 0 && f
142
+ queryKey: de(s, m),
143
+ queryFn: () => J(s, m),
144
+ enabled: !!s && m.length > 0 && f
145
145
  });
146
146
  Y(
147
147
  (e) => {
148
148
  e.patientUUID === s && e.updatedConcepts.size > 0 && [...e.updatedConcepts.keys()].some(
149
- (R) => p.includes(R)
150
- ) && T();
149
+ (T) => m.includes(T)
150
+ ) && R();
151
151
  },
152
- [s, T]
153
- ), C(() => {
152
+ [s, R]
153
+ ), S(() => {
154
154
  g && o({
155
155
  title: a("ERROR_DEFAULT_TITLE"),
156
156
  message: a("ERROR_FETCHING_OBSERVATIONS"),
157
157
  type: "error"
158
158
  });
159
159
  }, [g]);
160
- const $ = h(() => {
161
- if (!m) return [];
162
- const e = J(m), v = W(e);
160
+ const _ = h(() => {
161
+ if (!p) return [];
162
+ const e = x(p), v = W(e);
163
163
  return X(v);
164
- }, [m]), A = [
164
+ }, [p]), A = [
165
165
  { key: "name", header: "name" },
166
166
  { key: "value", header: "value" },
167
167
  { key: "form", header: "form" }
168
- ], _ = y || !f, I = g && f, F = (!m || m.entry?.length === 0 || p.length === 0) && f, L = I ? a("ERROR_FETCHING_OBSERVATIONS") : null, w = F ? a("NO_OBSERVATIONS_FOUND") : void 0, M = $.length > 0 && !_ && !I, O = i.titleTranslationKey, E = O ? a(O) : "";
169
- return /* @__PURE__ */ S(
168
+ ], I = y || !f, $ = g && f, F = (!p || p.entry?.length === 0 || m.length === 0) && f, L = $ ? a("ERROR_FETCHING_OBSERVATIONS") : null, K = F ? a("NO_OBSERVATIONS_FOUND") : void 0, M = _.length > 0 && !I && !$, O = i.titleTranslationKey, E = O ? a(O) : "";
169
+ return /* @__PURE__ */ C(
170
170
  "div",
171
171
  {
172
172
  id: "observations",
@@ -187,7 +187,7 @@ const B = (t, i, c, d, u, r) => {
187
187
  M ? /* @__PURE__ */ l(
188
188
  ae,
189
189
  {
190
- groupedData: $,
190
+ groupedData: _,
191
191
  title: E,
192
192
  hideThumbnail: u
193
193
  }
@@ -197,9 +197,9 @@ const B = (t, i, c, d, u, r) => {
197
197
  headers: A,
198
198
  rows: [],
199
199
  ariaLabel: a("OBSERVATIONS"),
200
- loading: _,
200
+ loading: I,
201
201
  errorStateMessage: L,
202
- emptyStateMessage: w,
202
+ emptyStateMessage: K,
203
203
  dataTestId: "observations-table"
204
204
  }
205
205
  )