@bahmni/clinical-app 0.0.1-dev.425 → 0.0.1-dev.427

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,16 +1,16 @@
1
1
  import { jsx as s } from "react/jsx-runtime";
2
- import { u as g, Z as u, bM as b, bW as f, bX as x, bY as p, aK as _, bS as N } from "./index-ksRzXiTW.js";
2
+ import { u as g, Z as u, bK as b, bU as f, bV as x, bW as p, aI as _, bQ as N } from "./index-BWPh-mFX.js";
3
3
  import { lazy as h, useMemo as t, Suspense as C } from "react";
4
4
  import "@tanstack/react-query";
5
- import { u as E } from "./hook-D9PIGcVh.js";
5
+ import { u as E } from "./hook-Doke6DrV.js";
6
6
  const L = {
7
7
  "org.bahmni.clinical.v2.search": h(
8
- () => import("./index-BV7pBnna.js")
8
+ () => import("./index-1rSd5z58.js")
9
9
  )
10
- }, v = "index-module_page__16xxw", y = "index-module_loading__wNI-4", I = "index-module_message__Ib5Iw", l = {
10
+ }, v = "index-module_page__16xxw", I = "index-module_loading__wNI-4", y = "index-module_message__Ib5Iw", l = {
11
11
  page: v,
12
- loading: y,
13
- message: I
12
+ loading: I,
13
+ message: y
14
14
  }, w = () => {
15
15
  const { t: i } = g(), { clinicalConfig: o } = E(), { userPrivileges: r } = u(), m = t(
16
16
  () => [
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { cT as c } from "./index-ksRzXiTW.js";
1
+ import { cR as c } from "./index-BWPh-mFX.js";
2
2
  export {
3
3
  c as ClinicalApp
4
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bahmni/clinical-app",
3
- "version": "0.0.1-dev.425",
3
+ "version": "0.0.1-dev.427",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -1,272 +0,0 @@
1
- import { jsx as n, jsxs as K, Fragment as ge } from "react/jsx-runtime";
2
- import { u as he, g as Oe, h as Te, Z as Ne, y as be, j as Ie, e as Ee, O as Ae, a as _e, m as Fe, f as ve, $ as Me, S as Ce, b as x, w as Se, C as G, H as z, K as Be, Y as P, F as De, c as Le, p as Ue, v as Re, l as ke } from "./index-ksRzXiTW.js";
3
- import { useQueryClient as we, useQuery as T } from "@tanstack/react-query";
4
- import { useState as Q, useMemo as i, useCallback as d } from "react";
5
- const qe = "FormsTable-module_formsTableBody__SvGha", He = "FormsTable-module_modalHeading__wnTmA", Ve = "FormsTable-module_customAccordianItem__isszs", N = {
6
- formsTableBody: qe,
7
- modalHeading: He,
8
- customAccordianItem: Ve
9
- }, $e = "startConsultation", ze = ({
10
- episodeOfCareUuids: v,
11
- encounterUuids: l,
12
- config: Y,
13
- disableActions: Z = !1,
14
- activeEncounterUuid: y = null
15
- }) => {
16
- const { t } = he(), m = Oe(), [p, M] = Q(!1), [o, C] = Q(null), {
17
- numberOfVisits: X,
18
- hideThumbnail: J = !1,
19
- forms: g
20
- } = Y ?? {}, W = Te(
21
- ke.EDIT_OBSERVATIONS
22
- ), { userPrivileges: h } = Ne(), b = W && !Z && !!y, S = be(
23
- v,
24
- l
25
- ), ee = we(), {
26
- data: B = [],
27
- isLoading: D,
28
- isError: L,
29
- error: re,
30
- refetch: ae
31
- } = T({
32
- queryKey: ["forms", m, v],
33
- queryFn: () => Ie(m, void 0, X),
34
- enabled: !!m && !S
35
- }), U = i(() => {
36
- let e = B;
37
- return l && l.length > 0 && (e = e.filter(
38
- (r) => l.includes(r.encounterUuid)
39
- )), Array.isArray(g) && g.length > 0 && (e = e.filter(
40
- (r) => g.some((a) => a.toLowerCase() === r.formName.toLowerCase())
41
- )), e;
42
- }, [B, l, g]), { data: O = [] } = T({
43
- queryKey: ["observationForms"],
44
- queryFn: () => Ee()
45
- }), R = d(
46
- (e) => {
47
- const r = O.find((s) => s.name === e);
48
- if (!r?.privileges || r.privileges.length === 0) return !0;
49
- if (!h || h.length === 0) return !1;
50
- const a = new Set(h.map((s) => s.name));
51
- return r.privileges.some(
52
- (s) => a.has(s.privilegeName) && s.editable
53
- );
54
- },
55
- [O, h]
56
- ), u = d(
57
- (e) => !y || e.encounterUuid !== y ? !1 : R(e.formName),
58
- [y, R]
59
- ), k = d(
60
- (e) => O.find((r) => r.name === e)?.uuid,
61
- [O]
62
- ), I = i(() => {
63
- if (o)
64
- return k(o.formName);
65
- }, [o, k]), {
66
- data: w,
67
- isLoading: oe,
68
- isError: te,
69
- error: E
70
- } = T({
71
- queryKey: ["formMetadata", I],
72
- queryFn: () => Ae(I),
73
- enabled: !!I && p
74
- }), {
75
- data: A,
76
- isLoading: se,
77
- isError: ne,
78
- error: _
79
- } = T({
80
- queryKey: ["formsEncounterFHIR", o?.encounterUuid],
81
- queryFn: () => _e(o.encounterUuid),
82
- enabled: !!o?.encounterUuid && p
83
- });
84
- Fe(
85
- (e) => {
86
- e.patientUUID === m && (ae(), ee.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
87
- },
88
- [m]
89
- );
90
- const ie = i(() => !A?.entry || !o?.formName ? [] : A.entry.filter((e) => e.resource?.resourceType === "Observation").map((e) => e.resource).filter((e) => ve(e) ? Me(e)?.toLowerCase() === o.formName.toLowerCase() : !0), [A, o?.formName]), { controlOrder: de, sectionMap: le, conceptDatatypeMap: me } = i(
91
- () => Ce(w?.schema),
92
- [w]
93
- ), ue = i(() => {
94
- if (E)
95
- return x(E).message;
96
- if (_)
97
- return x(_).message;
98
- }, [E, _]), c = i(
99
- () => [
100
- { key: "recordedOn", header: t("RECORDED_ON") },
101
- { key: "recordedBy", header: t("RECORDED_BY") }
102
- ],
103
- [t]
104
- ), q = i(
105
- () => [...c, { key: "actions", header: t("ACTIONS") }],
106
- [c, t]
107
- ), ce = d(
108
- (e) => b && e.some((r) => u(r)) ? q : c,
109
- [b, u, q, c]
110
- ), fe = c, ye = i(
111
- () => [
112
- { key: "recordedOn", sortable: !0 },
113
- { key: "recordedBy", sortable: !0 }
114
- ],
115
- []
116
- ), H = i(() => {
117
- const e = U.reduce(
118
- (r, a) => {
119
- const s = a.formName;
120
- r[s] ??= [];
121
- const f = a.providers.map((pe) => pe.providerName).filter(Boolean).join(", ");
122
- return r[s].push({
123
- id: a.encounterUuid,
124
- formName: a.formName,
125
- recordedOn: Se(a.encounterDateTime, t, !0).formattedResult,
126
- recordedBy: f ?? "--",
127
- encounterDateTime: a.encounterDateTime,
128
- encounterUuid: a.encounterUuid
129
- }), r;
130
- },
131
- {}
132
- );
133
- return Object.entries(e).map(
134
- ([r, a]) => ({
135
- formName: r,
136
- records: a.sort(
137
- (s, f) => f.encounterDateTime - s.encounterDateTime
138
- )
139
- })
140
- ).sort((r, a) => r.formName.localeCompare(a.formName));
141
- }, [U, t]), V = d((e) => {
142
- C(e), M(!0);
143
- }, []), $ = d(() => {
144
- M(!1), C(null);
145
- }, []), F = d((e) => {
146
- globalThis.dispatchEvent(
147
- new CustomEvent($e, {
148
- detail: {
149
- editOnly: "observationForms",
150
- editTitle: "EDIT_OBSERVATION_FORM_TITLE",
151
- sourceEncounterUuid: e.encounterUuid,
152
- formName: e.formName,
153
- directFormMode: !0
154
- }
155
- })
156
- );
157
- }, []), j = d(
158
- (e, r) => {
159
- switch (r) {
160
- case "recordedOn":
161
- return /* @__PURE__ */ n(Be, { onClick: () => V(e), children: e.recordedOn });
162
- case "recordedBy":
163
- return e.recordedBy;
164
- case "actions":
165
- return u(e) ? /* @__PURE__ */ n(
166
- G,
167
- {
168
- label: t("EDIT_OBSERVATION_FORM"),
169
- kind: "ghost",
170
- size: "sm",
171
- testId: `edit-form-${e.encounterUuid}`,
172
- onClick: () => F(e),
173
- children: /* @__PURE__ */ n(z, {})
174
- }
175
- ) : null;
176
- default:
177
- return null;
178
- }
179
- },
180
- [V, F, u, t]
181
- );
182
- return /* @__PURE__ */ K(ge, { children: [
183
- /* @__PURE__ */ n("div", { id: "forms-table", "data-testid": "forms-table", children: D || L || H.length === 0 || S ? /* @__PURE__ */ n(
184
- P,
185
- {
186
- headers: fe,
187
- ariaLabel: t("FORMS_HEADING"),
188
- rows: [],
189
- loading: D,
190
- errorStateMessage: L ? re?.message : void 0,
191
- emptyStateMessage: t("FORMS_UNAVAILABLE"),
192
- renderCell: j,
193
- className: N.formsTableBody,
194
- dataTestId: "forms-table"
195
- }
196
- ) : /* @__PURE__ */ n(De, { align: "start", children: H.map((e, r) => {
197
- const { formName: a, records: s } = e, f = ce(s);
198
- return /* @__PURE__ */ n(
199
- Le,
200
- {
201
- title: a,
202
- className: N.customAccordianItem,
203
- testId: `accordian-title-${a}`,
204
- open: r === 0,
205
- children: /* @__PURE__ */ n(
206
- P,
207
- {
208
- headers: f,
209
- ariaLabel: t("FORMS_HEADING"),
210
- rows: s,
211
- loading: !1,
212
- errorStateMessage: "",
213
- sortable: ye,
214
- emptyStateMessage: t("FORMS_UNAVAILABLE"),
215
- renderCell: j,
216
- className: N.formsTableBody,
217
- dataTestId: `forms-table-${a}`
218
- }
219
- )
220
- },
221
- a
222
- );
223
- }) }) }),
224
- p && o && /* @__PURE__ */ n(
225
- Ue,
226
- {
227
- id: "modalIdForActionAreaLayout",
228
- portalId: "main-display-area",
229
- open: p,
230
- onRequestClose: $,
231
- modalHeading: /* @__PURE__ */ K("div", { className: N.modalHeading, children: [
232
- /* @__PURE__ */ n("span", { children: o.formName }),
233
- b && u(o) && /* @__PURE__ */ n(
234
- G,
235
- {
236
- label: t("EDIT_OBSERVATION_FORM"),
237
- kind: "ghost",
238
- size: "sm",
239
- testId: `edit-form-modal-${o.encounterUuid}`,
240
- onClick: () => {
241
- $(), F(o);
242
- },
243
- children: /* @__PURE__ */ n(z, {})
244
- }
245
- )
246
- ] }),
247
- modalLabel: `${o.recordedOn} | ${o.recordedBy}`,
248
- passiveModal: !0,
249
- size: "md",
250
- testId: "form-details-modal",
251
- children: /* @__PURE__ */ n(
252
- Re,
253
- {
254
- observations: ie,
255
- isLoading: oe || se,
256
- isError: te || ne,
257
- errorMessage: ue,
258
- emptyStateMessage: t("NO_FORM_DATA_AVAILABLE"),
259
- testIdPrefix: o.formName,
260
- hideThumbnail: J,
261
- controlOrder: de,
262
- sectionMap: le,
263
- conceptDatatypeMap: me
264
- }
265
- )
266
- }
267
- )
268
- ] });
269
- };
270
- export {
271
- ze as default
272
- };