@bahmni/home-app 0.0.1-dev.377 → 0.0.1-dev.379

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.
package/dist/App.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../src/App.tsx"],"names":[],"mappings":"AAoBA,wBAAgB,GAAG,4CAyClB;AAED,eAAe,GAAG,CAAC"}
1
+ {"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../src/App.tsx"],"names":[],"mappings":"AAqBA,wBAAgB,GAAG,4CA2ClB;AAED,eAAe,GAAG,CAAC"}
@@ -1,7 +1,7 @@
1
- import { jsx as r, jsxs as p, Fragment as W } from "react/jsx-runtime";
2
- import { g as x, u as G, K as Y, Q as J, w as X, a as Z, W as ee, p as te } from "./index-ay48ID7h.js";
1
+ import { jsx as r, jsxs as p, Fragment as Q } from "react/jsx-runtime";
2
+ import { g as x, u as W, I as Y, m as J, a as X, b as Z, G as ee, p as te } from "./index-BF2fsrIb.js";
3
3
  import { useQuery as ae } from "@tanstack/react-query";
4
- import { useState as l, useCallback as h, useEffect as I, useMemo as _ } from "react";
4
+ import { useState as l, useCallback as h, useEffect as D, 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,
@@ -33,12 +33,12 @@ 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 }] : [], Ne = ({ config: a, encounterUuids: g }) => {
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 }] : [], Ie = ({ config: a, encounterUuids: g }) => {
37
37
  const [s, w] = l(!1), [o, U] = l(
38
38
  null
39
39
  ), [$, O] = l(
40
40
  /* @__PURE__ */ new Set()
41
- ), E = x(), { t: n } = G(), { 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 = x(), { 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) => {
42
42
  U(e), w(!0);
43
43
  }, []), H = h(() => {
44
44
  w(!1), U(null), O(/* @__PURE__ */ new Set());
@@ -60,17 +60,17 @@ const Te = [
60
60
  f
61
61
  )
62
62
  });
63
- I(() => {
63
+ D(() => {
64
64
  i && A(i.total);
65
- }, [i]), I(() => {
65
+ }, [i]), D(() => {
66
66
  C(1), A(void 0);
67
- }, [E]), I(() => {
67
+ }, [E]), D(() => {
68
68
  y && L({
69
69
  title: n("ERROR_DEFAULT_TITLE"),
70
70
  message: b?.message ?? "",
71
71
  type: "error"
72
72
  });
73
- }, [y, b, L, n]), I(() => {
73
+ }, [y, b, L, n]), D(() => {
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 (D) {
86
- D instanceof Error && D.name !== "AbortError" && t.add(c);
85
+ } catch (N) {
86
+ N instanceof Error && N.name !== "AbortError" && t.add(c);
87
87
  }
88
88
  }
89
89
  e.signal.aborted || O(t);
90
90
  })(), () => e.abort();
91
91
  }, [s, o]);
92
- const K = h(
92
+ const j = h(
93
93
  (e, t) => {
94
94
  t !== u ? (V(t), C(1), A(void 0)) : C(e);
95
95
  },
96
96
  [u]
97
- ), N = _(
97
+ ), I = _(
98
98
  () => a?.fields ?? Te,
99
99
  [a?.fields]
100
- ), Q = _(() => [...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]), j = _(() => ie(N, n), [N, n]), P = _(
101
- () => N.map((e) => ({
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(I, n), [I, n]), z = _(
101
+ () => I.map((e) => ({
102
102
  key: e,
103
103
  sortable: e !== "attachments"
104
104
  })),
105
- [N]
105
+ [I]
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,24 +137,24 @@ const Te = [
137
137
  },
138
138
  [M, n]
139
139
  );
140
- return /* @__PURE__ */ p(W, { 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: j,
144
+ headers: P,
145
145
  ariaLabel: n("DOCUMENTS_TABLE_HEADING"),
146
- rows: Q,
146
+ rows: G,
147
147
  loading: q,
148
148
  errorStateMessage: y ? b?.message : null,
149
- sortable: P,
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,
155
155
  totalItems: F,
156
156
  page: f,
157
- onPageChange: K
157
+ onPageChange: j
158
158
  }
159
159
  ) }),
160
160
  s && o && /* @__PURE__ */ r(
@@ -169,8 +169,8 @@ const Te = [
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 ?? ""), D = $.has(t);
173
- return m === "#" || D ? /* @__PURE__ */ p(
172
+ const m = R(e.url), c = e.contentType?.toLowerCase().includes("pdf"), S = (e.contentType?.toLowerCase().includes("image") ?? !1) || pe.test(e.url ?? ""), N = $.has(t);
173
+ return m === "#" || N ? /* @__PURE__ */ p(
174
174
  "div",
175
175
  {
176
176
  className: d.attachmentError,
@@ -223,5 +223,5 @@ const Te = [
223
223
  ] });
224
224
  };
225
225
  export {
226
- Ne as default
226
+ Ie as default
227
227
  };
@@ -1,50 +1,50 @@
1
- import { jsx as i, jsxs as x, Fragment as ye } from "react/jsx-runtime";
2
- import { u as ge, g as be, H as Ne, X as Oe, f as Te, b as Ie, Z as Ee, J as Ae, N as _e, c as ve, B as Fe, d as Be, s as K, a as Se, I as J, n as P, w as Me, W as Q, e as Re, k as Ce, p as Le, h as Ue, i as ke } from "./index-ay48ID7h.js";
3
- import { useQueryClient as De, useQuery as O } 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
- modalHeading: qe,
8
- customAccordianItem: He
9
- }, Ve = "startConsultation", Ke = ({
10
- episodeOfCareUuids: S,
1
+ import { jsx as i, jsxs as G, Fragment as ye } from "react/jsx-runtime";
2
+ import { u as ge, g as be, c as Oe, J as Ne, d as Te, f as Ie, W as Ee, e as Ae, L as _e, h as ve, i as Fe, V as Be, s as $, b as Le, x as K, j as P, a as Se, G as Q, k as Me, B as Re, p as Ce, l as Ue, O as ke } from "./index-BF2fsrIb.js";
3
+ import { useQueryClient as De, useQuery as N } from "@tanstack/react-query";
4
+ import { useState as J, useMemo as d, useCallback as c } from "react";
5
+ const qe = "FormsTable-module_formsTableBody__SvGha", Ve = "FormsTable-module_modalHeading__wnTmA", we = "FormsTable-module_customAccordianItem__isszs", T = {
6
+ formsTableBody: qe,
7
+ modalHeading: Ve,
8
+ customAccordianItem: we
9
+ }, He = "startConsultation", $e = ({
10
+ episodeOfCareUuids: L,
11
11
  encounterUuids: m,
12
12
  config: W,
13
- disableActions: X = !1,
14
- activeEncounterUuid: p = null
13
+ disableActions: Y = !1,
14
+ activeEncounterUuid: h = null
15
15
  }) => {
16
- const { t: n } = ge(), u = be(), [y, M] = G(!1), [s, R] = G(null), {
16
+ const { t: n } = ge(), u = be(), [y, S] = J(!1), [s, M] = J(null), {
17
17
  numberOfVisits: Z,
18
- hideThumbnail: Y = !1,
18
+ hideThumbnail: X = !1,
19
19
  forms: g
20
- } = W ?? {}, ee = Ne(
20
+ } = W ?? {}, ee = Oe(
21
21
  ke.EDIT_OBSERVATIONS
22
- ), { userPrivileges: b } = Oe(), I = ee && !X && !!p, C = Te(
23
- S,
22
+ ), { userPrivileges: b } = Ne(), I = ee && !Y && !!h, R = Te(
23
+ L,
24
24
  m
25
25
  ), re = De(), {
26
- data: L = [],
26
+ data: C = [],
27
27
  isLoading: U,
28
28
  isError: k,
29
29
  error: oe,
30
30
  refetch: ae
31
- } = O({
32
- queryKey: ["forms", u, S],
31
+ } = N({
32
+ queryKey: ["forms", u, L],
33
33
  queryFn: () => Ie(u, void 0, Z),
34
- enabled: !!u && !C
34
+ enabled: !!u && !R
35
35
  }), D = d(() => {
36
- let e = L;
36
+ let e = C;
37
37
  return m && m.length > 0 && (e = e.filter(
38
38
  (r) => m.includes(r.encounterUuid)
39
39
  )), Array.isArray(g) && g.length > 0 && (e = e.filter(
40
40
  (r) => g.some((o) => o.toLowerCase() === r.formName.toLowerCase())
41
41
  )), e;
42
- }, [L, m, g]), { data: N = [] } = O({
42
+ }, [C, m, g]), { data: O = [] } = N({
43
43
  queryKey: ["observationForms"],
44
44
  queryFn: () => Ee()
45
- }), w = c(
45
+ }), q = c(
46
46
  (e) => {
47
- const r = N.find((t) => t.name === e);
47
+ const r = O.find((t) => t.name === e);
48
48
  if (!r?.privileges || r.privileges.length === 0) return !0;
49
49
  if (!b || b.length === 0) return !1;
50
50
  const o = new Set(b.map((t) => t.name));
@@ -52,22 +52,22 @@ const we = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
52
52
  (t) => o.has(t.privilegeName) && t.editable
53
53
  );
54
54
  },
55
- [N, b]
55
+ [O, b]
56
56
  ), f = c(
57
- (e) => !p || e.encounterUuid !== p ? !1 : w(e.formName),
58
- [p, w]
59
- ), q = c(
60
- (e) => N.find((r) => r.name === e)?.uuid,
61
- [N]
57
+ (e) => !h || e.encounterUuid !== h ? !1 : q(e.formName),
58
+ [h, q]
59
+ ), V = c(
60
+ (e) => O.find((r) => r.name === e)?.uuid,
61
+ [O]
62
62
  ), E = d(() => {
63
63
  if (s)
64
- return q(s.formName);
65
- }, [s, q]), {
64
+ return V(s.formName);
65
+ }, [s, V]), {
66
66
  data: l,
67
67
  isLoading: te,
68
68
  isError: se,
69
69
  error: A
70
- } = O({
70
+ } = N({
71
71
  queryKey: ["formMetadata", E],
72
72
  queryFn: () => Ae(E),
73
73
  enabled: !!E && y
@@ -76,7 +76,7 @@ const we = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
76
76
  isLoading: ne,
77
77
  isError: ie,
78
78
  error: v
79
- } = O({
79
+ } = N({
80
80
  queryKey: ["formsEncounterFHIR", s?.encounterUuid],
81
81
  queryFn: () => _e(s.encounterUuid),
82
82
  enabled: !!s?.encounterUuid && y
@@ -125,28 +125,28 @@ const we = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
125
125
  ), Object.keys(e).length > 0 ? e : void 0;
126
126
  }, [l]), ue = d(() => {
127
127
  if (A)
128
- return K(A).message;
128
+ return $(A).message;
129
129
  if (v)
130
- return K(v).message;
131
- }, [A, v]), h = d(
130
+ return $(v).message;
131
+ }, [A, v]), p = d(
132
132
  () => [
133
133
  { key: "recordedOn", header: n("RECORDED_ON") },
134
134
  { key: "recordedBy", header: n("RECORDED_BY") }
135
135
  ],
136
136
  [n]
137
- ), H = d(
138
- () => [...h, { key: "actions", header: n("ACTIONS") }],
139
- [h, n]
137
+ ), w = d(
138
+ () => [...p, { key: "actions", header: n("ACTIONS") }],
139
+ [p, n]
140
140
  ), fe = c(
141
- (e) => I && e.some((r) => f(r)) ? H : h,
142
- [I, f, H, h]
143
- ), he = h, pe = d(
141
+ (e) => I && e.some((r) => f(r)) ? w : p,
142
+ [I, f, w, p]
143
+ ), pe = p, he = d(
144
144
  () => [
145
145
  { key: "recordedOn", sortable: !0 },
146
146
  { key: "recordedBy", sortable: !0 }
147
147
  ],
148
148
  []
149
- ), V = d(() => {
149
+ ), H = d(() => {
150
150
  const e = D.reduce(
151
151
  (r, o) => {
152
152
  const t = o.formName;
@@ -155,7 +155,7 @@ const we = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
155
155
  return r[t].push({
156
156
  id: o.encounterUuid,
157
157
  formName: o.formName,
158
- recordedOn: Se(o.encounterDateTime, n, !0).formattedResult,
158
+ recordedOn: Le(o.encounterDateTime, n, !0).formattedResult,
159
159
  recordedBy: a ?? "--",
160
160
  encounterDateTime: o.encounterDateTime,
161
161
  encounterUuid: o.encounterUuid
@@ -172,12 +172,12 @@ const we = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
172
172
  })
173
173
  ).sort((r, o) => r.formName.localeCompare(o.formName));
174
174
  }, [D, n]), j = c((e) => {
175
- R(e), M(!0);
176
- }, []), z = c(() => {
177
- M(!1), R(null);
175
+ M(e), S(!0);
176
+ }, []), x = c(() => {
177
+ S(!1), M(null);
178
178
  }, []), F = c((e) => {
179
179
  globalThis.dispatchEvent(
180
- new CustomEvent(Ve, {
180
+ new CustomEvent(He, {
181
181
  detail: {
182
182
  editOnly: "observationForms",
183
183
  editTitle: "EDIT_OBSERVATION_FORM_TITLE",
@@ -187,16 +187,16 @@ const we = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
187
187
  }
188
188
  })
189
189
  );
190
- }, []), $ = c(
190
+ }, []), z = c(
191
191
  (e, r) => {
192
192
  switch (r) {
193
193
  case "recordedOn":
194
- return /* @__PURE__ */ i(Me, { onClick: () => j(e), children: e.recordedOn });
194
+ return /* @__PURE__ */ i(Se, { onClick: () => j(e), children: e.recordedOn });
195
195
  case "recordedBy":
196
196
  return e.recordedBy;
197
197
  case "actions":
198
198
  return f(e) ? /* @__PURE__ */ i(
199
- J,
199
+ K,
200
200
  {
201
201
  label: n("EDIT_OBSERVATION_FORM"),
202
202
  kind: "ghost",
@@ -212,24 +212,24 @@ const we = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
212
212
  },
213
213
  [j, F, f, n]
214
214
  );
215
- return /* @__PURE__ */ x(ye, { children: [
216
- /* @__PURE__ */ i("div", { id: "forms-table", "data-testid": "forms-table", children: U || k || V.length === 0 || C ? /* @__PURE__ */ i(
215
+ return /* @__PURE__ */ G(ye, { children: [
216
+ /* @__PURE__ */ i("div", { id: "forms-table", "data-testid": "forms-table", children: U || k || H.length === 0 || R ? /* @__PURE__ */ i(
217
217
  Q,
218
218
  {
219
- headers: he,
219
+ headers: pe,
220
220
  ariaLabel: n("FORMS_HEADING"),
221
221
  rows: [],
222
222
  loading: U,
223
223
  errorStateMessage: k ? oe?.message : void 0,
224
224
  emptyStateMessage: n("FORMS_UNAVAILABLE"),
225
- renderCell: $,
225
+ renderCell: z,
226
226
  className: T.formsTableBody,
227
227
  dataTestId: "forms-table"
228
228
  }
229
- ) : /* @__PURE__ */ i(Re, { align: "start", children: V.map((e, r) => {
229
+ ) : /* @__PURE__ */ i(Me, { align: "start", children: H.map((e, r) => {
230
230
  const { formName: o, records: t } = e, a = fe(t);
231
231
  return /* @__PURE__ */ i(
232
- Ce,
232
+ Re,
233
233
  {
234
234
  title: o,
235
235
  className: T.customAccordianItem,
@@ -243,9 +243,9 @@ const we = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
243
243
  rows: t,
244
244
  loading: !1,
245
245
  errorStateMessage: "",
246
- sortable: pe,
246
+ sortable: he,
247
247
  emptyStateMessage: n("FORMS_UNAVAILABLE"),
248
- renderCell: $,
248
+ renderCell: z,
249
249
  className: T.formsTableBody,
250
250
  dataTestId: `forms-table-${o}`
251
251
  }
@@ -255,23 +255,23 @@ const we = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
255
255
  );
256
256
  }) }) }),
257
257
  y && s && /* @__PURE__ */ i(
258
- Le,
258
+ Ce,
259
259
  {
260
260
  id: "modalIdForActionAreaLayout",
261
261
  portalId: "main-display-area",
262
262
  open: y,
263
- onRequestClose: z,
264
- modalHeading: /* @__PURE__ */ x("div", { className: T.modalHeading, children: [
263
+ onRequestClose: x,
264
+ modalHeading: /* @__PURE__ */ G("div", { className: T.modalHeading, children: [
265
265
  /* @__PURE__ */ i("span", { children: s.formName }),
266
266
  I && f(s) && /* @__PURE__ */ i(
267
- J,
267
+ K,
268
268
  {
269
269
  label: n("EDIT_OBSERVATION_FORM"),
270
270
  kind: "ghost",
271
271
  size: "sm",
272
272
  testId: `edit-form-modal-${s.encounterUuid}`,
273
273
  onClick: () => {
274
- z(), F(s);
274
+ x(), F(s);
275
275
  },
276
276
  children: /* @__PURE__ */ i(P, {})
277
277
  }
@@ -290,7 +290,7 @@ const we = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
290
290
  errorMessage: ue,
291
291
  emptyStateMessage: n("NO_FORM_DATA_AVAILABLE"),
292
292
  testIdPrefix: s.formName,
293
- hideThumbnail: Y,
293
+ hideThumbnail: X,
294
294
  controlOrder: le,
295
295
  sectionMap: ce,
296
296
  conceptDatatypeMap: me
@@ -301,5 +301,5 @@ const we = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
301
301
  ] });
302
302
  };
303
303
  export {
304
- Ke as default
304
+ $e as default
305
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-BEs-Amg5.js";
2
- import { a0 as d, a1 as f, a2 as e } from "./index-ay48ID7h.js";
1
+ import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-DwzV9bTY.js";
2
+ import { U as d, X as f, Y as e } from "./index-BF2fsrIb.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-BEs-Amg5.js";
2
- import { a0 as v, a1 as C, a2 as e } from "./index-ay48ID7h.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-DwzV9bTY.js";
2
+ import { U as v, X as C, Y as e } from "./index-BF2fsrIb.js";
3
3
  var h = (t) => {
4
4
  const [r, o] = s({
5
5
  prefix: "TanstackQueryDevtools"