@bahmni/home-app 0.0.1-dev.373 → 0.0.1-dev.375

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 p, Fragment as K } from "react/jsx-runtime";
2
- import { g as Q, u as W, G as Y, x as J, a as X, b as Z, W as ee, p as te } from "./index-CptkFVlT.js";
1
+ import { jsx as r, jsxs as p, Fragment as Q } from "react/jsx-runtime";
2
+ import { g as W, u as x, G as Y, T as J, a as X, b as Z, W as ee, p as te } from "./index-Inkiyj0j.js";
3
3
  import { useQuery as ae } from "@tanstack/react-query";
4
4
  import { useState as l, useCallback as h, useEffect as I, useMemo as _ } from "react";
5
5
  const ne = "DocumentsTable-module_documentsTableBody__6iR3w", oe = "DocumentsTable-module_viewAttachmentsLink__aQ1on", re = "DocumentsTable-module_documentViewerContainer__F5m8D", de = "DocumentsTable-module_attachmentItem__17KA7", se = "DocumentsTable-module_attachmentCounter__WFiI3", me = "DocumentsTable-module_attachmentError__RI4U2", ce = "DocumentsTable-module_documentIframe__ptq5I", le = "DocumentsTable-module_documentImage__KQVgS", d = {
@@ -38,13 +38,13 @@ const Te = [
38
38
  null
39
39
  ), [$, O] = l(
40
40
  /* @__PURE__ */ new Set()
41
- ), E = Q(), { t: n } = W(), { addNotification: L } = Y(), k = Number(a?.pageSize) || 5, [f, C] = l(1), [u, V] = l(k), [F, A] = l(void 0), M = h((e) => {
41
+ ), E = W(), { t: n } = x(), { addNotification: L } = Y(), k = Number(a?.pageSize) || 5, [f, C] = l(1), [u, V] = l(k), [F, A] = l(void 0), M = h((e) => {
42
42
  U(e), w(!0);
43
43
  }, []), H = h(() => {
44
44
  w(!1), U(null), O(/* @__PURE__ */ new Set());
45
45
  }, []), v = h((e) => {
46
46
  O((t) => new Set(t).add(e));
47
- }, []), { data: i, isLoading: q, isError: y, error: b } = ae({
47
+ }, []), { data: i, isLoading: q, isError: b, error: y } = ae({
48
48
  queryKey: [
49
49
  "documents",
50
50
  E,
@@ -65,12 +65,12 @@ const Te = [
65
65
  }, [i]), I(() => {
66
66
  C(1), A(void 0);
67
67
  }, [E]), I(() => {
68
- y && L({
68
+ b && L({
69
69
  title: n("ERROR_DEFAULT_TITLE"),
70
- message: b?.message ?? "",
70
+ message: y?.message ?? "",
71
71
  type: "error"
72
72
  });
73
- }, [y, b, L, n]), I(() => {
73
+ }, [b, y, L, n]), I(() => {
74
74
  const e = new AbortController();
75
75
  return (async () => {
76
76
  if (!s || !o) return;
@@ -97,7 +97,7 @@ const Te = [
97
97
  ), N = _(
98
98
  () => a?.fields ?? Te,
99
99
  [a?.fields]
100
- ), x = _(() => [...i?.documents ?? []].sort((e, t) => !e.uploadedOn && !t.uploadedOn ? 0 : e.uploadedOn ? t.uploadedOn ? new Date(t.uploadedOn).getTime() - new Date(e.uploadedOn).getTime() : -1 : 1), [i]), G = _(() => ie(N, n), [N, n]), P = _(
100
+ ), G = _(() => [...i?.documents ?? []].sort((e, t) => !e.uploadedOn && !t.uploadedOn ? 0 : e.uploadedOn ? t.uploadedOn ? new Date(t.uploadedOn).getTime() - new Date(e.uploadedOn).getTime() : -1 : 1), [i]), P = _(() => ie(N, n), [N, n]), z = _(
101
101
  () => N.map((e) => ({
102
102
  key: e,
103
103
  sortable: e !== "attachments"
@@ -106,7 +106,7 @@ const Te = [
106
106
  ), T = _(
107
107
  () => o ? B(o) : [],
108
108
  [o]
109
- ), z = h(
109
+ ), K = h(
110
110
  (e, t) => {
111
111
  switch (t) {
112
112
  case "documentIdentifier":
@@ -137,18 +137,18 @@ const Te = [
137
137
  },
138
138
  [M, n]
139
139
  );
140
- return /* @__PURE__ */ p(K, { children: [
140
+ return /* @__PURE__ */ p(Q, { children: [
141
141
  /* @__PURE__ */ r("div", { "data-testid": "documents-table", children: /* @__PURE__ */ r(
142
142
  ee,
143
143
  {
144
- headers: G,
144
+ headers: P,
145
145
  ariaLabel: n("DOCUMENTS_TABLE_HEADING"),
146
- rows: x,
146
+ rows: G,
147
147
  loading: q,
148
- errorStateMessage: y ? b?.message : null,
149
- sortable: P,
148
+ errorStateMessage: b ? y?.message : null,
149
+ sortable: z,
150
150
  emptyStateMessage: n("DOCUMENTS_NO_RECORDS"),
151
- renderCell: z,
151
+ renderCell: K,
152
152
  className: d.documentsTableBody,
153
153
  dataTestId: "documents-table",
154
154
  pageSize: u,
@@ -1,94 +1,94 @@
1
- import { jsx as i, jsxs as j, Fragment as he } from "react/jsx-runtime";
2
- import { u as be, g as ye, H as pe, Q as Ne, f as Oe, c as Te, d as Ie, M as Ee, t as Ae, m as _e, S as ve, T as Se, s as z, b as Fe, e as K, n as Q, a as Ce, W as Y, I as Re, k as Be, p as Le, J as Me, P as Ue } from "./index-CptkFVlT.js";
3
- import { useQueryClient as De, useQuery as O } from "@tanstack/react-query";
4
- import { useState as G, useMemo as d, useCallback as l } from "react";
5
- const ke = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_modalHeading__wnTmA", He = "FormsTable-module_customAccordianItem__isszs", T = {
6
- formsTableBody: ke,
1
+ import { jsx as i, jsxs as j, Fragment as ge } from "react/jsx-runtime";
2
+ import { u as ye, g as be, H as Oe, Q as Ne, f as Te, z as Ie, w as Ee, C as Ae, o as _e, m as ve, S as Se, $ as Fe, s as z, b as Ce, x as Q, n as Y, a as Me, W as P, k as Re, Z as Be, p as Le, J as Ue, K as ke } from "./index-Inkiyj0j.js";
3
+ import { useQueryClient as De, useQuery as N } from "@tanstack/react-query";
4
+ import { useState as G, useMemo as d, useCallback as c } from "react";
5
+ const we = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_modalHeading__wnTmA", He = "FormsTable-module_customAccordianItem__isszs", T = {
6
+ formsTableBody: we,
7
7
  modalHeading: qe,
8
8
  customAccordianItem: He
9
- }, we = "startConsultation", je = ({
9
+ }, Ve = "startConsultation", ze = ({
10
10
  episodeOfCareUuids: C,
11
- encounterUuids: u,
12
- config: J,
13
- disableActions: W = !1,
14
- activeEncounterUuid: h = null
11
+ encounterUuids: m,
12
+ config: Z,
13
+ disableActions: J = !1,
14
+ activeEncounterUuid: p = null
15
15
  }) => {
16
- const { t: n } = be(), c = ye(), [b, R] = G(!1), [s, B] = G(null), {
17
- numberOfVisits: X,
18
- hideThumbnail: Z = !1,
16
+ const { t: n } = ye(), u = be(), [g, M] = G(!1), [s, R] = G(null), {
17
+ numberOfVisits: W,
18
+ hideThumbnail: X = !1,
19
19
  forms: y
20
- } = J ?? {}, ee = pe(
21
- Ue.EDIT_OBSERVATIONS
22
- ), { userPrivileges: p } = Ne(), I = ee && !W && !!h, L = Oe(
20
+ } = Z ?? {}, ee = Oe(
21
+ ke.EDIT_OBSERVATIONS
22
+ ), { userPrivileges: b } = Ne(), I = ee && !J && !!p, B = Te(
23
23
  C,
24
- u
24
+ m
25
25
  ), re = De(), {
26
- data: M = [],
26
+ data: L = [],
27
27
  isLoading: U,
28
- isError: D,
28
+ isError: k,
29
29
  error: oe,
30
- refetch: ae
31
- } = O({
32
- queryKey: ["forms", c, C],
33
- queryFn: () => Te(c, void 0, X),
34
- enabled: !!c && !L
35
- }), k = d(() => {
36
- let e = M;
37
- return u && u.length > 0 && (e = e.filter(
38
- (r) => u.includes(r.encounterUuid)
30
+ refetch: te
31
+ } = N({
32
+ queryKey: ["forms", u, C],
33
+ queryFn: () => Ie(u, void 0, W),
34
+ enabled: !!u && !B
35
+ }), D = d(() => {
36
+ let e = L;
37
+ return m && m.length > 0 && (e = e.filter(
38
+ (r) => m.includes(r.encounterUuid)
39
39
  )), Array.isArray(y) && y.length > 0 && (e = e.filter(
40
40
  (r) => y.some((o) => o.toLowerCase() === r.formName.toLowerCase())
41
41
  )), e;
42
- }, [M, u, y]), { data: N = [] } = O({
42
+ }, [L, m, y]), { data: O = [] } = N({
43
43
  queryKey: ["observationForms"],
44
- queryFn: () => Ie()
45
- }), q = l(
44
+ queryFn: () => Ee()
45
+ }), w = c(
46
46
  (e) => {
47
- const r = N.find((a) => a.name === e);
47
+ const r = O.find((a) => a.name === e);
48
48
  if (!r?.privileges || r.privileges.length === 0) return !0;
49
- if (!p || p.length === 0) return !1;
50
- const o = new Set(p.map((a) => a.name));
49
+ if (!b || b.length === 0) return !1;
50
+ const o = new Set(b.map((a) => a.name));
51
51
  return r.privileges.some(
52
52
  (a) => o.has(a.privilegeName) && a.editable
53
53
  );
54
54
  },
55
- [N, p]
56
- ), f = l(
57
- (e) => !h || e.encounterUuid !== h ? !1 : q(e.formName),
58
- [h, q]
59
- ), H = l(
60
- (e) => N.find((r) => r.name === e)?.uuid,
61
- [N]
55
+ [O, b]
56
+ ), f = c(
57
+ (e) => !p || e.encounterUuid !== p ? !1 : w(e.formName),
58
+ [p, w]
59
+ ), q = c(
60
+ (e) => O.find((r) => r.name === e)?.uuid,
61
+ [O]
62
62
  ), E = d(() => {
63
63
  if (s)
64
- return H(s.formName);
65
- }, [s, H]), {
66
- data: m,
67
- isLoading: te,
64
+ return q(s.formName);
65
+ }, [s, q]), {
66
+ data: l,
67
+ isLoading: ae,
68
68
  isError: se,
69
69
  error: A
70
- } = O({
70
+ } = N({
71
71
  queryKey: ["formMetadata", E],
72
- queryFn: () => Ee(E),
73
- enabled: !!E && b
72
+ queryFn: () => Ae(E),
73
+ enabled: !!E && g
74
74
  }), {
75
75
  data: _,
76
76
  isLoading: ne,
77
77
  isError: ie,
78
78
  error: v
79
- } = O({
79
+ } = N({
80
80
  queryKey: ["formsEncounterFHIR", s?.encounterUuid],
81
- queryFn: () => Ae(s.encounterUuid),
82
- enabled: !!s?.encounterUuid && b
81
+ queryFn: () => _e(s.encounterUuid),
82
+ enabled: !!s?.encounterUuid && g
83
83
  });
84
- _e(
84
+ ve(
85
85
  (e) => {
86
- e.patientUUID === c && e.updatedConcepts.size > 0 && (ae(), re.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
86
+ e.patientUUID === u && (te(), re.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
87
87
  },
88
- [c]
88
+ [u]
89
89
  );
90
- const de = d(() => !_?.entry || !s?.formName ? [] : _.entry.filter((e) => e.resource?.resourceType === "Observation").map((e) => e.resource).filter((e) => ve(e) ? Se(e)?.toLowerCase() === s.formName.toLowerCase() : !0), [_, s?.formName]), le = d(() => {
91
- if (!m?.schema) return;
90
+ const de = d(() => !_?.entry || !s?.formName ? [] : _.entry.filter((e) => e.resource?.resourceType === "Observation").map((e) => e.resource).filter((e) => Se(e) ? Fe(e)?.toLowerCase() === s.formName.toLowerCase() : !0), [_, s?.formName]), le = d(() => {
91
+ if (!l?.schema) return;
92
92
  const e = [], r = (o) => {
93
93
  (o ?? []).forEach((a) => {
94
94
  const t = a;
@@ -96,10 +96,10 @@ const ke = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
96
96
  });
97
97
  };
98
98
  return r(
99
- m.schema.controls ?? []
99
+ l.schema.controls ?? []
100
100
  ), e.length > 0 ? e : void 0;
101
- }, [m]), me = d(() => {
102
- if (!m?.schema) return;
101
+ }, [l]), ce = d(() => {
102
+ if (!l?.schema) return;
103
103
  const e = {}, r = (o, a) => {
104
104
  for (const t of o)
105
105
  if (t.type === "section") {
@@ -109,34 +109,45 @@ const ke = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
109
109
  t.id != null && a && (e[String(t.id)] = a), t.controls && r(t.controls, a);
110
110
  };
111
111
  return r(
112
- m.schema.controls ?? [],
112
+ l.schema.controls ?? [],
113
113
  null
114
114
  ), Object.keys(e).length > 0 ? e : void 0;
115
- }, [m]), ue = d(() => {
115
+ }, [l]), me = d(() => {
116
+ if (!l?.schema) return;
117
+ const e = {}, r = (o) => {
118
+ (o ?? []).forEach((a) => {
119
+ const t = a;
120
+ t.concept?.uuid && t.concept?.datatype && (e[t.concept.uuid] = t.concept.datatype), t.controls && r(t.controls);
121
+ });
122
+ };
123
+ return r(
124
+ l.schema.controls ?? []
125
+ ), Object.keys(e).length > 0 ? e : void 0;
126
+ }, [l]), ue = d(() => {
116
127
  if (A)
117
128
  return z(A).message;
118
129
  if (v)
119
130
  return z(v).message;
120
- }, [A, v]), g = d(
131
+ }, [A, v]), h = d(
121
132
  () => [
122
133
  { key: "recordedOn", header: n("RECORDED_ON") },
123
134
  { key: "recordedBy", header: n("RECORDED_BY") }
124
135
  ],
125
136
  [n]
126
- ), w = d(
127
- () => [...g, { key: "actions", header: n("ACTIONS") }],
128
- [g, n]
129
- ), ce = l(
130
- (e) => I && e.some((r) => f(r)) ? w : g,
131
- [I, f, w, g]
132
- ), fe = g, ge = d(
137
+ ), H = d(
138
+ () => [...h, { key: "actions", header: n("ACTIONS") }],
139
+ [h, n]
140
+ ), fe = c(
141
+ (e) => I && e.some((r) => f(r)) ? H : h,
142
+ [I, f, H, h]
143
+ ), he = h, pe = d(
133
144
  () => [
134
145
  { key: "recordedOn", sortable: !0 },
135
146
  { key: "recordedBy", sortable: !0 }
136
147
  ],
137
148
  []
138
149
  ), V = d(() => {
139
- const e = k.reduce(
150
+ const e = D.reduce(
140
151
  (r, o) => {
141
152
  const a = o.formName;
142
153
  r[a] ??= [];
@@ -144,7 +155,7 @@ const ke = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
144
155
  return r[a].push({
145
156
  id: o.encounterUuid,
146
157
  formName: o.formName,
147
- recordedOn: Fe(o.encounterDateTime, n, !0).formattedResult,
158
+ recordedOn: Ce(o.encounterDateTime, n, !0).formattedResult,
148
159
  recordedBy: t ?? "--",
149
160
  encounterDateTime: o.encounterDateTime,
150
161
  encounterUuid: o.encounterUuid
@@ -160,13 +171,13 @@ const ke = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
160
171
  )
161
172
  })
162
173
  ).sort((r, o) => r.formName.localeCompare(o.formName));
163
- }, [k, n]), $ = l((e) => {
164
- B(e), R(!0);
165
- }, []), x = l(() => {
166
- R(!1), B(null);
167
- }, []), S = l((e) => {
174
+ }, [D, n]), $ = c((e) => {
175
+ R(e), M(!0);
176
+ }, []), K = c(() => {
177
+ M(!1), R(null);
178
+ }, []), S = c((e) => {
168
179
  globalThis.dispatchEvent(
169
- new CustomEvent(we, {
180
+ new CustomEvent(Ve, {
170
181
  detail: {
171
182
  editOnly: "observationForms",
172
183
  editTitle: "EDIT_OBSERVATION_FORM_TITLE",
@@ -176,23 +187,23 @@ const ke = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
176
187
  }
177
188
  })
178
189
  );
179
- }, []), P = l(
190
+ }, []), x = c(
180
191
  (e, r) => {
181
192
  switch (r) {
182
193
  case "recordedOn":
183
- return /* @__PURE__ */ i(Ce, { onClick: () => $(e), children: e.recordedOn });
194
+ return /* @__PURE__ */ i(Me, { onClick: () => $(e), children: e.recordedOn });
184
195
  case "recordedBy":
185
196
  return e.recordedBy;
186
197
  case "actions":
187
198
  return f(e) ? /* @__PURE__ */ i(
188
- K,
199
+ Q,
189
200
  {
190
201
  label: n("EDIT_OBSERVATION_FORM"),
191
202
  kind: "ghost",
192
203
  size: "sm",
193
204
  testId: `edit-form-${e.encounterUuid}`,
194
205
  onClick: () => S(e),
195
- children: /* @__PURE__ */ i(Q, {})
206
+ children: /* @__PURE__ */ i(Y, {})
196
207
  }
197
208
  ) : null;
198
209
  default:
@@ -201,22 +212,22 @@ const ke = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
201
212
  },
202
213
  [$, S, f, n]
203
214
  );
204
- return /* @__PURE__ */ j(he, { children: [
205
- /* @__PURE__ */ i("div", { id: "forms-table", "data-testid": "forms-table", children: U || D || V.length === 0 || L ? /* @__PURE__ */ i(
206
- Y,
215
+ return /* @__PURE__ */ j(ge, { children: [
216
+ /* @__PURE__ */ i("div", { id: "forms-table", "data-testid": "forms-table", children: U || k || V.length === 0 || B ? /* @__PURE__ */ i(
217
+ P,
207
218
  {
208
- headers: fe,
219
+ headers: he,
209
220
  ariaLabel: n("FORMS_HEADING"),
210
221
  rows: [],
211
222
  loading: U,
212
- errorStateMessage: D ? oe?.message : void 0,
223
+ errorStateMessage: k ? oe?.message : void 0,
213
224
  emptyStateMessage: n("FORMS_UNAVAILABLE"),
214
- renderCell: P,
225
+ renderCell: x,
215
226
  className: T.formsTableBody,
216
227
  dataTestId: "forms-table"
217
228
  }
218
229
  ) : /* @__PURE__ */ i(Re, { align: "start", children: V.map((e, r) => {
219
- const { formName: o, records: a } = e, t = ce(a);
230
+ const { formName: o, records: a } = e, t = fe(a);
220
231
  return /* @__PURE__ */ i(
221
232
  Be,
222
233
  {
@@ -225,16 +236,16 @@ const ke = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
225
236
  testId: `accordian-title-${o}`,
226
237
  open: r === 0,
227
238
  children: /* @__PURE__ */ i(
228
- Y,
239
+ P,
229
240
  {
230
241
  headers: t,
231
242
  ariaLabel: n("FORMS_HEADING"),
232
243
  rows: a,
233
244
  loading: !1,
234
245
  errorStateMessage: "",
235
- sortable: ge,
246
+ sortable: pe,
236
247
  emptyStateMessage: n("FORMS_UNAVAILABLE"),
237
- renderCell: P,
248
+ renderCell: x,
238
249
  className: T.formsTableBody,
239
250
  dataTestId: `forms-table-${o}`
240
251
  }
@@ -243,26 +254,26 @@ const ke = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
243
254
  o
244
255
  );
245
256
  }) }) }),
246
- b && s && /* @__PURE__ */ i(
257
+ g && s && /* @__PURE__ */ i(
247
258
  Le,
248
259
  {
249
260
  id: "modalIdForActionAreaLayout",
250
261
  portalId: "main-display-area",
251
- open: b,
252
- onRequestClose: x,
262
+ open: g,
263
+ onRequestClose: K,
253
264
  modalHeading: /* @__PURE__ */ j("div", { className: T.modalHeading, children: [
254
265
  /* @__PURE__ */ i("span", { children: s.formName }),
255
266
  I && f(s) && /* @__PURE__ */ i(
256
- K,
267
+ Q,
257
268
  {
258
269
  label: n("EDIT_OBSERVATION_FORM"),
259
270
  kind: "ghost",
260
271
  size: "sm",
261
272
  testId: `edit-form-modal-${s.encounterUuid}`,
262
273
  onClick: () => {
263
- x(), S(s);
274
+ K(), S(s);
264
275
  },
265
- children: /* @__PURE__ */ i(Q, {})
276
+ children: /* @__PURE__ */ i(Y, {})
266
277
  }
267
278
  )
268
279
  ] }),
@@ -271,17 +282,18 @@ const ke = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
271
282
  size: "md",
272
283
  testId: "form-details-modal",
273
284
  children: /* @__PURE__ */ i(
274
- Me,
285
+ Ue,
275
286
  {
276
287
  observations: de,
277
- isLoading: te || ne,
288
+ isLoading: ae || ne,
278
289
  isError: se || ie,
279
290
  errorMessage: ue,
280
291
  emptyStateMessage: n("NO_FORM_DATA_AVAILABLE"),
281
292
  testIdPrefix: s.formName,
282
- hideThumbnail: Z,
293
+ hideThumbnail: X,
283
294
  controlOrder: le,
284
- sectionMap: me
295
+ sectionMap: ce,
296
+ conceptDatatypeMap: me
285
297
  }
286
298
  )
287
299
  }
@@ -289,5 +301,5 @@ const ke = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
289
301
  ] });
290
302
  };
291
303
  export {
292
- je as default
304
+ ze as default
293
305
  };
@@ -1,5 +1,5 @@
1
- import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-DNGYQwaN.js";
2
- import { a0 as d, a1 as f, a2 as e } from "./index-CptkFVlT.js";
1
+ import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-05ufxKjJ.js";
2
+ import { a0 as d, a1 as f, a2 as e } from "./index-Inkiyj0j.js";
3
3
  var p = (a) => {
4
4
  const [r, t] = c({
5
5
  prefix: "TanstackQueryDevtools"
@@ -1,5 +1,5 @@
1
- import { c as s, T as c, P as u, a as i, b as m, C as P, Q as d } from "./YPM2AS64-DNGYQwaN.js";
2
- import { a0 as v, a1 as C, a2 as e } from "./index-CptkFVlT.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-05ufxKjJ.js";
2
+ import { a0 as v, a1 as C, a2 as e } from "./index-Inkiyj0j.js";
3
3
  var h = (t) => {
4
4
  const [r, o] = s({
5
5
  prefix: "TanstackQueryDevtools"
@@ -1,9 +1,9 @@
1
- import { jsxs as I, jsx as u } from "react/jsx-runtime";
2
- import { g as K, G as q, u as N, V as G, h as k, m as H, R as M, D as Q, i as j, j as w, W as x, O as z, r as D, L as P, E as W, Z, l as J, o as X, q as ee } from "./index-CptkFVlT.js";
1
+ import { jsxs as N, jsx as u } from "react/jsx-runtime";
2
+ import { g as q, G as K, u as S, _ as k, N as G, m as w, c as M, B as P, P as Q, i as j, W as x, I as H, l as D, d as z, E as W, e as Z, h as J, j as X, q as ee } from "./index-Inkiyj0j.js";
3
3
  import { useQueries as ae, useQuery as te } from "@tanstack/react-query";
4
- import { useRef as se, useEffect as $, useMemo as E } from "react";
5
- const L = (a, n, d, l, b, r) => {
6
- const t = P(a, n, b), s = t.value, i = W(s);
4
+ import { useRef as se, useEffect as $, useMemo as R } from "react";
5
+ const F = (a, n, d, l, b, r) => {
6
+ const t = z(a, n, b), s = t.value, i = W(s);
7
7
  let o = s;
8
8
  i === "Image" && (o = /* @__PURE__ */ u(
9
9
  J,
@@ -43,7 +43,7 @@ const L = (a, n, d, l, b, r) => {
43
43
  id: `grouped-obs-${a.display}-${l}`,
44
44
  open: d,
45
45
  children: a.members?.map(
46
- (s, i) => L(
46
+ (s, i) => F(
47
47
  s,
48
48
  i,
49
49
  b,
@@ -59,9 +59,9 @@ const L = (a, n, d, l, b, r) => {
59
59
  title: n = "",
60
60
  hideThumbnail: d
61
61
  }) => {
62
- const { t: l } = N(), b = (r, t, s) => {
63
- const i = z(r.encounterDetails, l);
64
- return /* @__PURE__ */ I(
62
+ const { t: l } = S(), b = (r, t, s) => {
63
+ const i = H(r.encounterDetails, l);
64
+ return /* @__PURE__ */ N(
65
65
  D,
66
66
  {
67
67
  title: i,
@@ -69,7 +69,7 @@ const L = (a, n, d, l, b, r) => {
69
69
  open: t,
70
70
  children: [
71
71
  r.observations.map(
72
- (o, m) => L(
72
+ (o, m) => F(
73
73
  o,
74
74
  m,
75
75
  s,
@@ -105,7 +105,7 @@ const L = (a, n, d, l, b, r) => {
105
105
  )
106
106
  }
107
107
  );
108
- }, oe = "Observations-module_observations__RKSyo", ne = "Observations-module_title__TJL3z", S = {
108
+ }, oe = "Observations-module_observations__RKSyo", ne = "Observations-module_title__TJL3z", I = {
109
109
  observations: oe,
110
110
  title: ne
111
111
  }, de = (a) => ["conceptUuid", a], le = (a, n) => ["observations", a, ...n], pe = ({ config: a }) => {
@@ -113,81 +113,81 @@ const L = (a, n, d, l, b, r) => {
113
113
  conceptNames: d = [],
114
114
  conceptUuid: l = [],
115
115
  hideThumbnail: b = !1
116
- } = n, r = se(/* @__PURE__ */ new Set()), t = K(), { addNotification: s } = q(), { t: i } = N(), o = ae({
116
+ } = n, r = se(/* @__PURE__ */ new Set()), t = q(), { addNotification: s } = K(), { t: i } = S(), o = ae({
117
117
  queries: d.map((e) => ({
118
118
  queryKey: de(e),
119
- queryFn: () => G(e),
119
+ queryFn: () => k(e),
120
120
  enabled: !!e
121
121
  }))
122
122
  });
123
123
  $(() => {
124
124
  o.forEach((e, h) => {
125
125
  if (e.isError && !r.current.has(h)) {
126
- const B = d[h];
126
+ const V = d[h];
127
127
  s({
128
128
  title: i("ERROR_DEFAULT_TITLE"),
129
- message: i("ERROR_FETCHING_CONCEPT", { conceptName: B }),
129
+ message: i("ERROR_FETCHING_CONCEPT", { conceptName: V }),
130
130
  type: "error"
131
131
  }), r.current.add(h);
132
132
  } else e.isError || r.current.delete(h);
133
133
  });
134
134
  }, [o, d]);
135
- const m = E(() => o.map((e) => e.data?.uuid).filter((e) => !!e), [o]), p = E(() => [.../* @__PURE__ */ new Set([...m, ...l])], [m, l]), y = E(() => d.length === 0 ? !0 : o.every((e) => !e.isLoading), [o, d.length]), {
135
+ const m = R(() => o.map((e) => e.data?.uuid).filter((e) => !!e), [o]), p = R(() => [.../* @__PURE__ */ new Set([...m, ...l])], [m, l]), y = R(() => d.length === 0 ? !0 : o.every((e) => !e.isLoading), [o, d.length]), {
136
136
  data: c,
137
- isLoading: F,
138
- isError: O,
139
- refetch: T
137
+ isLoading: L,
138
+ isError: T,
139
+ refetch: g
140
140
  } = te({
141
141
  queryKey: le(t, p),
142
- queryFn: () => k(t, p),
142
+ queryFn: () => G(t, p),
143
143
  enabled: !!t && p.length > 0 && y
144
144
  });
145
- H(
145
+ w(
146
146
  (e) => {
147
147
  e.patientUUID === t && e.updatedConcepts.size > 0 && [...e.updatedConcepts.keys()].some(
148
148
  (h) => p.includes(h)
149
- ) && T();
149
+ ) && g();
150
150
  },
151
- [t, T]
151
+ [t, g]
152
152
  ), $(() => {
153
- O && s({
153
+ T && s({
154
154
  title: i("ERROR_DEFAULT_TITLE"),
155
155
  message: i("ERROR_FETCHING_OBSERVATIONS"),
156
156
  type: "error"
157
157
  });
158
- }, [O]);
159
- const g = E(() => {
158
+ }, [T]);
159
+ const O = R(() => {
160
160
  if (!c) return [];
161
- const e = M(c), h = Q(e);
162
- return j(h);
161
+ const e = M(c), h = P(e);
162
+ return Q(h);
163
163
  }, [c]), A = [
164
164
  { key: "name", header: "name" },
165
165
  { key: "value", header: "value" },
166
166
  { key: "form", header: "form" }
167
- ], f = F || !y, _ = O && y, V = (!c || c.entry?.length === 0 || p.length === 0) && y, Y = _ ? i("ERROR_FETCHING_OBSERVATIONS") : null, C = V ? i("NO_OBSERVATIONS_FOUND") : void 0, U = g.length > 0 && !f && !_, v = n.titleTranslationKey, R = v ? i(v) : "";
168
- return /* @__PURE__ */ I(
167
+ ], _ = L || !y, f = T && y, B = (!c || c.entry?.length === 0 || p.length === 0) && y, Y = f ? i("ERROR_FETCHING_OBSERVATIONS") : null, C = B ? i("NO_OBSERVATIONS_FOUND") : void 0, U = O.length > 0 && !_ && !f, E = n.titleTranslationKey, v = E ? i(E) : "";
168
+ return /* @__PURE__ */ N(
169
169
  "div",
170
170
  {
171
171
  id: "observations",
172
- "data-testid": v ? `observations-${R}` : "observations",
172
+ "data-testid": E ? `observations-${v}` : "observations",
173
173
  "aria-label": "observations-aria-label",
174
- className: S.observations,
174
+ className: I.observations,
175
175
  children: [
176
176
  /* @__PURE__ */ u(
177
- w,
177
+ j,
178
178
  {
179
179
  id: "observations-title",
180
- testId: v ? `observations-title-${R}` : "observations-title",
181
- title: R,
182
- className: S.title,
183
- children: /* @__PURE__ */ u("p", { children: R })
180
+ testId: E ? `observations-title-${v}` : "observations-title",
181
+ title: v,
182
+ className: I.title,
183
+ children: /* @__PURE__ */ u("p", { children: v })
184
184
  }
185
185
  ),
186
186
  U ? /* @__PURE__ */ u(
187
187
  ie,
188
188
  {
189
- groupedData: g,
190
- title: R,
189
+ groupedData: O,
190
+ title: v,
191
191
  hideThumbnail: b
192
192
  }
193
193
  ) : /* @__PURE__ */ u(
@@ -196,7 +196,7 @@ const L = (a, n, d, l, b, r) => {
196
196
  headers: A,
197
197
  rows: [],
198
198
  ariaLabel: i("OBSERVATIONS"),
199
- loading: f,
199
+ loading: _,
200
200
  errorStateMessage: Y,
201
201
  emptyStateMessage: C,
202
202
  dataTestId: "observations-table"