@bahmni/clinical-app 0.0.1-dev.328 → 0.0.1-dev.330

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.
Files changed (29) hide show
  1. package/dist/{ConsultationPage-BLvxF8kV.js → ConsultationPage-C2Uocg1j.js} +7816 -7827
  2. package/dist/{DocumentsTable-Cd0rZQF3-CAeFGxaz.js → DocumentsTable-Il19n5sp-Dnv62E5k.js} +43 -43
  3. package/dist/FormsTable-CUvcHb6f-Bs-FhRl9.js +234 -0
  4. package/dist/{LNWAZHJI-SQd0D-eQ.js → LNWAZHJI-CGNUX_T0.js} +4 -4
  5. package/dist/{MWZ6AO7Z-P43V0sDv.js → MWZ6AO7Z-BVvg_5Wl.js} +3 -3
  6. package/dist/{Observations-3VgJK5Ks-BF9if6iv.js → Observations-CeCquAyF-DYz0-SHp.js} +58 -58
  7. package/dist/{YPM2AS64-Cqh6aPgw.js → YPM2AS64-Bf0OGz_l.js} +1 -1
  8. package/dist/components/consultationPad/__tests__/__mocks__/servicesMocks.d.ts +1 -1
  9. package/dist/components/consultationPad/__tests__/__mocks__/servicesMocks.d.ts.map +1 -1
  10. package/dist/components/consultationPad/services.d.ts.map +1 -1
  11. package/dist/components/forms/immunization/utils.d.ts.map +1 -1
  12. package/dist/components/forms/medicationRequest/utils.d.ts.map +1 -1
  13. package/dist/components/forms/observations/ObservationFormsContainer.d.ts.map +1 -1
  14. package/dist/constants/app.d.ts +0 -1
  15. package/dist/constants/app.d.ts.map +1 -1
  16. package/dist/{hook-DE7_WRwf.js → hook-C37CVFLY.js} +1 -1
  17. package/dist/{index-DSm8uWLC.js → index-ByPig1cy.js} +17 -17
  18. package/dist/{index-BHPHdADf.js → index-CQXUH749.js} +75268 -64125
  19. package/dist/{index-DEe43Szm.js → index-CgLzBjgf.js} +3 -3
  20. package/dist/index.css +1 -1
  21. package/dist/index.js +1 -1
  22. package/dist/services/encounterBundleService.d.ts +1 -2
  23. package/dist/services/encounterBundleService.d.ts.map +1 -1
  24. package/package.json +1 -1
  25. package/dist/FormsTable-CgyxKp9V-fNe7NXXc.js +0 -234
  26. package/dist/models/encounterBundle.d.ts +0 -8
  27. package/dist/models/encounterBundle.d.ts.map +0 -1
  28. package/dist/utils/fhir/encounterBundleCreator.d.ts +0 -5
  29. package/dist/utils/fhir/encounterBundleCreator.d.ts.map +0 -1
@@ -1,7 +1,7 @@
1
- import { jsx as r, jsxs as p, Fragment as Q } from "react/jsx-runtime";
2
- import { n as G, u as W, o as Y, w as J, f as X, g as Z, O as ee, p as te } from "./index-BHPHdADf.js";
1
+ import { jsx as r, jsxs as h, Fragment as x } from "react/jsx-runtime";
2
+ import { a as G, u as W, q as Y, h as J, $ as X, v as Z, R as ee, p as te } from "./index-CQXUH749.js";
3
3
  import { useQuery as ae } from "@tanstack/react-query";
4
- import { useState as l, useCallback as h, useEffect as N, useMemo as _ } from "react";
4
+ import { useState as l, useCallback as p, 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 = {
6
6
  documentsTableBody: ne,
7
7
  viewAttachmentsLink: oe,
@@ -21,10 +21,10 @@ const ne = "DocumentsTable-module_documentsTableBody__6iR3w", oe = "DocumentsTab
21
21
  function R(a) {
22
22
  return !a || a.includes(":") ? "#" : `/openmrs/auth?requested_document=/document_images/${a}`;
23
23
  }
24
- function ie(a, g) {
24
+ function ie(a, E) {
25
25
  return a.map((s) => ({
26
26
  key: s,
27
- header: g(ue[s])
27
+ header: E(ue[s])
28
28
  }));
29
29
  }
30
30
  const Te = [
@@ -33,44 +33,44 @@ const Te = [
33
33
  "attachments",
34
34
  "uploadedOn",
35
35
  "uploadedBy"
36
- ], pe = /\.(jpg|jpeg|png|gif|webp|bmp|svg)$/i, B = (a) => a.attachments.length > 0 ? a.attachments : a.documentUrl ? [{ url: a.documentUrl, contentType: a.contentType }] : [], fe = ({ config: a, encounterUuids: g }) => {
36
+ ], he = /\.(jpg|jpeg|png|gif|webp|bmp|svg)$/i, B = (a) => a.attachments.length > 0 ? a.attachments : a.documentUrl ? [{ url: a.documentUrl, contentType: a.contentType }] : [], Ne = ({ config: a, encounterUuids: E }) => {
37
37
  const [s, w] = l(!1), [o, U] = l(
38
38
  null
39
- ), [$, D] = l(
39
+ ), [$, O] = l(
40
40
  /* @__PURE__ */ new Set()
41
- ), E = G(), { t: n } = W(), { addNotification: L } = Y(), k = Number(a?.pageSize) || 5, [I, C] = l(1), [u, V] = l(k), [F, A] = l(void 0), M = h((e) => {
41
+ ), g = G(), { t: n } = W(), { addNotification: L } = Y(), k = Number(a?.pageSize) || 5, [f, C] = l(1), [u, V] = l(k), [q, A] = l(void 0), M = p((e) => {
42
42
  U(e), w(!0);
43
- }, []), H = h(() => {
44
- w(!1), U(null), D(/* @__PURE__ */ new Set());
45
- }, []), v = h((e) => {
46
- D((t) => new Set(t).add(e));
47
- }, []), { data: i, isLoading: q, isError: b, error: y } = ae({
43
+ }, []), F = p(() => {
44
+ w(!1), U(null), O(/* @__PURE__ */ new Set());
45
+ }, []), v = p((e) => {
46
+ O((t) => new Set(t).add(e));
47
+ }, []), { data: i, isLoading: H, isError: b, error: y } = ae({
48
48
  queryKey: [
49
49
  "documents",
50
- E,
51
50
  g,
52
- I,
51
+ E,
52
+ f,
53
53
  u
54
54
  ],
55
- enabled: !!E,
55
+ enabled: !!g,
56
56
  queryFn: () => J(
57
- E,
58
57
  g,
58
+ E,
59
59
  u,
60
- I
60
+ f
61
61
  )
62
62
  });
63
- N(() => {
63
+ I(() => {
64
64
  i && A(i.total);
65
- }, [i]), N(() => {
65
+ }, [i]), I(() => {
66
66
  C(1), A(void 0);
67
- }, [E]), N(() => {
67
+ }, [g]), I(() => {
68
68
  b && L({
69
69
  title: n("ERROR_DEFAULT_TITLE"),
70
70
  message: y?.message ?? "",
71
71
  type: "error"
72
72
  });
73
- }, [b, y, L, n]), N(() => {
73
+ }, [b, y, L, n]), I(() => {
74
74
  const e = new AbortController();
75
75
  return (async () => {
76
76
  if (!s || !o) return;
@@ -82,31 +82,31 @@ const Te = [
82
82
  method: "HEAD",
83
83
  signal: e.signal
84
84
  })).ok || t.add(c);
85
- } catch (O) {
86
- O instanceof Error && O.name !== "AbortError" && t.add(c);
85
+ } catch (D) {
86
+ D instanceof Error && D.name !== "AbortError" && t.add(c);
87
87
  }
88
88
  }
89
- e.signal.aborted || D(t);
89
+ e.signal.aborted || O(t);
90
90
  })(), () => e.abort();
91
91
  }, [s, o]);
92
- const j = h(
92
+ const j = p(
93
93
  (e, t) => {
94
94
  t !== u ? (V(t), C(1), A(void 0)) : C(e);
95
95
  },
96
96
  [u]
97
- ), f = _(
97
+ ), N = _(
98
98
  () => a?.fields ?? Te,
99
99
  [a?.fields]
100
- ), P = _(() => [...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]), x = _(() => ie(f, n), [f, n]), z = _(
101
- () => f.map((e) => ({
100
+ ), P = _(() => [...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]), Q = _(() => ie(N, n), [N, n]), z = _(
101
+ () => N.map((e) => ({
102
102
  key: e,
103
103
  sortable: e !== "attachments"
104
104
  })),
105
- [f]
105
+ [N]
106
106
  ), T = _(
107
107
  () => o ? B(o) : [],
108
108
  [o]
109
- ), K = h(
109
+ ), K = p(
110
110
  (e, t) => {
111
111
  switch (t) {
112
112
  case "documentIdentifier":
@@ -137,14 +137,14 @@ const Te = [
137
137
  },
138
138
  [M, n]
139
139
  );
140
- return /* @__PURE__ */ p(Q, { children: [
140
+ return /* @__PURE__ */ h(x, { children: [
141
141
  /* @__PURE__ */ r("div", { "data-testid": "documents-table", children: /* @__PURE__ */ r(
142
142
  ee,
143
143
  {
144
- headers: x,
144
+ headers: Q,
145
145
  ariaLabel: n("DOCUMENTS_TABLE_HEADING"),
146
146
  rows: P,
147
- loading: q,
147
+ loading: H,
148
148
  errorStateMessage: b ? y?.message : null,
149
149
  sortable: z,
150
150
  emptyStateMessage: n("DOCUMENTS_NO_RECORDS"),
@@ -152,8 +152,8 @@ const Te = [
152
152
  className: d.documentsTableBody,
153
153
  dataTestId: "documents-table",
154
154
  pageSize: u,
155
- totalItems: F,
156
- page: I,
155
+ totalItems: q,
156
+ page: f,
157
157
  onPageChange: j
158
158
  }
159
159
  ) }),
@@ -163,20 +163,20 @@ const Te = [
163
163
  id: "modalIdForActionAreaLayout",
164
164
  portalId: "main-display-area",
165
165
  open: s,
166
- onRequestClose: H,
166
+ onRequestClose: F,
167
167
  modalHeading: o.documentIdentifier,
168
168
  passiveModal: !0,
169
169
  size: "lg",
170
170
  testId: "document-view-modal",
171
171
  children: /* @__PURE__ */ r("div", { className: d.documentViewerContainer, children: T.map((e, t) => {
172
- const m = R(e.url), c = e.contentType?.toLowerCase().includes("pdf"), S = (e.contentType?.toLowerCase().includes("image") ?? !1) || pe.test(e.url ?? ""), O = $.has(t);
173
- return m === "#" || O ? /* @__PURE__ */ p(
172
+ const m = R(e.url), c = e.contentType?.toLowerCase().includes("pdf"), S = (e.contentType?.toLowerCase().includes("image") ?? !1) || he.test(e.url ?? ""), D = $.has(t);
173
+ return m === "#" || D ? /* @__PURE__ */ h(
174
174
  "div",
175
175
  {
176
176
  className: d.attachmentError,
177
177
  "data-testid": `attachment-error-${t}`,
178
178
  children: [
179
- T.length > 1 && /* @__PURE__ */ p("p", { className: d.attachmentCounter, children: [
179
+ T.length > 1 && /* @__PURE__ */ h("p", { className: d.attachmentCounter, children: [
180
180
  t + 1,
181
181
  "/",
182
182
  T.length
@@ -185,13 +185,13 @@ const Te = [
185
185
  ]
186
186
  },
187
187
  `${o.id}-${e.url}`
188
- ) : /* @__PURE__ */ p(
188
+ ) : /* @__PURE__ */ h(
189
189
  "div",
190
190
  {
191
191
  className: d.attachmentItem,
192
192
  "data-testid": `attachment-item-${t}`,
193
193
  children: [
194
- T.length > 1 && /* @__PURE__ */ p("p", { className: d.attachmentCounter, children: [
194
+ T.length > 1 && /* @__PURE__ */ h("p", { className: d.attachmentCounter, children: [
195
195
  t + 1,
196
196
  "/",
197
197
  T.length
@@ -223,5 +223,5 @@ const Te = [
223
223
  ] });
224
224
  };
225
225
  export {
226
- fe as default
226
+ Ne as default
227
227
  };
@@ -0,0 +1,234 @@
1
+ import { jsx as i, jsxs as re, Fragment as oe } from "react/jsx-runtime";
2
+ import { u as ae, a as se, b as te, c as ne, s as de, d as ie, e as le, U as ue, f as q, v as me, $ as ce, R as Q, _ as fe, A as ye, p as pe, g as be, i as he } from "./index-CQXUH749.js";
3
+ import { useQueryClient as ge, useQuery as p } from "@tanstack/react-query";
4
+ import { useState as $, useMemo as d, useCallback as b } from "react";
5
+ const Ne = "FormsTable-module_formsTableBody__SvGha", Ae = "FormsTable-module_customAccordianItem__isszs", v = {
6
+ formsTableBody: Ne,
7
+ customAccordianItem: Ae
8
+ }, Oe = (m) => m ? m.extension?.find(
9
+ (l) => l.url === he
10
+ )?.valueString : void 0, Be = ({
11
+ episodeOfCareUuids: m,
12
+ encounterUuids: l,
13
+ config: k
14
+ }) => {
15
+ const { t: n } = ae(), c = se(), [f, I] = $(!1), [s, T] = $(null), {
16
+ numberOfVisits: w,
17
+ hideThumbnail: H = !1,
18
+ forms: y
19
+ } = k ?? {}, _ = te(
20
+ m,
21
+ l
22
+ ), K = ge(), {
23
+ data: B = [],
24
+ isLoading: E,
25
+ isError: F,
26
+ error: j,
27
+ refetch: x
28
+ } = p({
29
+ queryKey: ["forms", c, m],
30
+ queryFn: () => ne(c, void 0, w),
31
+ enabled: !!c && !_
32
+ }), L = d(() => {
33
+ let e = B;
34
+ return l && l.length > 0 && (e = e.filter(
35
+ (r) => l.includes(r.encounterUuid)
36
+ )), Array.isArray(y) && y.length > 0 && (e = e.filter(
37
+ (r) => y.some((o) => o.toLowerCase() === r.formName.toLowerCase())
38
+ )), e;
39
+ }, [B, l, y]), { data: R = [] } = p({
40
+ queryKey: ["observationForms"],
41
+ queryFn: () => de()
42
+ }), M = b(
43
+ (e) => R.find((r) => r.name === e)?.uuid,
44
+ [R]
45
+ ), h = d(() => {
46
+ if (s)
47
+ return M(s.formName);
48
+ }, [s, M]), {
49
+ data: u,
50
+ isLoading: V,
51
+ isError: z,
52
+ error: g
53
+ } = p({
54
+ queryKey: ["formMetadata", h],
55
+ queryFn: () => ie(h),
56
+ enabled: !!h && f
57
+ }), {
58
+ data: N,
59
+ isLoading: G,
60
+ isError: P,
61
+ error: A
62
+ } = p({
63
+ queryKey: ["formsEncounterFHIR", s?.encounterUuid],
64
+ queryFn: () => le(s.encounterUuid),
65
+ enabled: !!s?.encounterUuid && f
66
+ });
67
+ ue(
68
+ (e) => {
69
+ e.patientUUID === c && e.updatedConcepts.size > 0 && (x(), K.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
70
+ },
71
+ [c]
72
+ );
73
+ const Y = d(() => !N?.entry || !s?.formName ? [] : N.entry.filter((e) => e.resource?.resourceType === "Observation").map((e) => e.resource).filter((e) => {
74
+ const r = Oe(e);
75
+ return !r || r.includes(s.formName);
76
+ }), [N, s?.formName]), J = d(() => {
77
+ if (!u?.schema) return;
78
+ const e = [], r = (o) => {
79
+ (o ?? []).forEach((t) => {
80
+ const a = t;
81
+ a.id != null && e.push(String(a.id)), a.controls && r(a.controls);
82
+ });
83
+ };
84
+ return r(
85
+ u.schema.controls ?? []
86
+ ), e.length > 0 ? e : void 0;
87
+ }, [u]), W = d(() => {
88
+ if (!u?.schema) return;
89
+ const e = {}, r = (o, t) => {
90
+ for (const a of o)
91
+ if (a.type === "section") {
92
+ const O = a.label?.value ?? "Section";
93
+ r(a.controls ?? [], O);
94
+ } else
95
+ a.id != null && t && (e[String(a.id)] = t), a.controls && r(a.controls, t);
96
+ };
97
+ return r(
98
+ u.schema.controls ?? [],
99
+ null
100
+ ), Object.keys(e).length > 0 ? e : void 0;
101
+ }, [u]), X = d(() => {
102
+ if (g)
103
+ return q(g).message;
104
+ if (A)
105
+ return q(A).message;
106
+ }, [g, A]), S = d(
107
+ () => [
108
+ { key: "recordedOn", header: n("RECORDED_ON") },
109
+ { key: "recordedBy", header: n("RECORDED_BY") }
110
+ ],
111
+ [n]
112
+ ), Z = d(
113
+ () => [
114
+ { key: "recordedOn", sortable: !0 },
115
+ { key: "recordedBy", sortable: !0 }
116
+ ],
117
+ []
118
+ ), U = d(() => {
119
+ const e = L.reduce(
120
+ (r, o) => {
121
+ const t = o.formName;
122
+ r[t] ??= [];
123
+ const a = o.providers.map((O) => O.providerName).filter(Boolean).join(", ");
124
+ return r[t].push({
125
+ id: o.encounterUuid,
126
+ formName: o.formName,
127
+ recordedOn: me(o.encounterDateTime, n, !0).formattedResult,
128
+ recordedBy: a ?? "--",
129
+ encounterDateTime: o.encounterDateTime,
130
+ encounterUuid: o.encounterUuid
131
+ }), r;
132
+ },
133
+ {}
134
+ );
135
+ return Object.entries(e).map(
136
+ ([r, o]) => ({
137
+ formName: r,
138
+ records: o.sort(
139
+ (t, a) => a.encounterDateTime - t.encounterDateTime
140
+ )
141
+ })
142
+ ).sort((r, o) => r.formName.localeCompare(o.formName));
143
+ }, [L, n]), C = b((e) => {
144
+ T(e), I(!0);
145
+ }, []), ee = b(() => {
146
+ I(!1), T(null);
147
+ }, []), D = b(
148
+ (e, r) => {
149
+ switch (r) {
150
+ case "recordedOn":
151
+ return /* @__PURE__ */ i(ce, { onClick: () => C(e), children: e.recordedOn });
152
+ case "recordedBy":
153
+ return e.recordedBy;
154
+ default:
155
+ return null;
156
+ }
157
+ },
158
+ [C]
159
+ );
160
+ return /* @__PURE__ */ re(oe, { children: [
161
+ /* @__PURE__ */ i("div", { id: "forms-table", "data-testid": "forms-table", children: E || F || U.length === 0 || _ ? /* @__PURE__ */ i(
162
+ Q,
163
+ {
164
+ headers: S,
165
+ ariaLabel: n("FORMS_HEADING"),
166
+ rows: [],
167
+ loading: E,
168
+ errorStateMessage: F ? j?.message : void 0,
169
+ emptyStateMessage: n("FORMS_UNAVAILABLE"),
170
+ renderCell: D,
171
+ className: v.formsTableBody,
172
+ dataTestId: "forms-table"
173
+ }
174
+ ) : /* @__PURE__ */ i(fe, { align: "start", children: U.map((e, r) => {
175
+ const { formName: o, records: t } = e;
176
+ return /* @__PURE__ */ i(
177
+ ye,
178
+ {
179
+ title: o,
180
+ className: v.customAccordianItem,
181
+ testId: `accordian-title-${o}`,
182
+ open: r === 0,
183
+ children: /* @__PURE__ */ i(
184
+ Q,
185
+ {
186
+ headers: S,
187
+ ariaLabel: n("FORMS_HEADING"),
188
+ rows: t,
189
+ loading: !1,
190
+ errorStateMessage: "",
191
+ sortable: Z,
192
+ emptyStateMessage: n("FORMS_UNAVAILABLE"),
193
+ renderCell: D,
194
+ className: v.formsTableBody,
195
+ dataTestId: `forms-table-${o}`
196
+ }
197
+ )
198
+ },
199
+ o
200
+ );
201
+ }) }) }),
202
+ f && s && /* @__PURE__ */ i(
203
+ pe,
204
+ {
205
+ id: "modalIdForActionAreaLayout",
206
+ portalId: "main-display-area",
207
+ open: f,
208
+ onRequestClose: ee,
209
+ modalHeading: s.formName,
210
+ modalLabel: `${s.recordedOn} | ${s.recordedBy}`,
211
+ passiveModal: !0,
212
+ size: "md",
213
+ testId: "form-details-modal",
214
+ children: /* @__PURE__ */ i(
215
+ be,
216
+ {
217
+ observations: Y,
218
+ isLoading: V || G,
219
+ isError: z || P,
220
+ errorMessage: X,
221
+ emptyStateMessage: n("NO_FORM_DATA_AVAILABLE"),
222
+ testIdPrefix: s.formName,
223
+ hideThumbnail: H,
224
+ controlOrder: J,
225
+ sectionMap: W
226
+ }
227
+ )
228
+ }
229
+ )
230
+ ] });
231
+ };
232
+ export {
233
+ Be as default
234
+ };
@@ -1,5 +1,5 @@
1
- import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-Cqh6aPgw.js";
2
- import { bC as d, bD as f, bE as e } from "./index-BHPHdADf.js";
1
+ import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-Bf0OGz_l.js";
2
+ import { bF as d, bG as f, bH as e } from "./index-CQXUH749.js";
3
3
  var p = (a) => {
4
4
  const [r, t] = c({
5
5
  prefix: "TanstackQueryDevtools"
@@ -27,7 +27,7 @@ var p = (a) => {
27
27
  });
28
28
  }
29
29
  });
30
- }, P = p;
30
+ }, C = p;
31
31
  export {
32
- P as default
32
+ C as default
33
33
  };
@@ -1,9 +1,9 @@
1
- import { c as s, T as c, P as u, a as i, b as m, C as P, Q as d } from "./YPM2AS64-Cqh6aPgw.js";
2
- import { bC as C, bD as v, bE as e } from "./index-BHPHdADf.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-Bf0OGz_l.js";
2
+ import { bF as v, bG as C, bH as e } from "./index-CQXUH749.js";
3
3
  var h = (t) => {
4
4
  const [r, o] = s({
5
5
  prefix: "TanstackQueryDevtools"
6
- }), a = C(), l = v(() => {
6
+ }), a = v(), l = C(() => {
7
7
  const n = r.theme_preference || c;
8
8
  return n !== "system" ? n : a();
9
9
  });