@bahmni/registration-app 0.0.1-dev.216 → 0.0.1-dev.217

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
1
  import { jsx as r, jsxs as p, Fragment as Y } from "react/jsx-runtime";
2
- import { u as K, a as Q, e as W, y as J, E as X, T as Z, h as ee, b as te } from "./index-DNRQhRAW.js";
2
+ import { u as K, a as Q, e as W, y as J, E as X, T as Z, h as ee, b as te } from "./index-CXRvNffr.js";
3
3
  import { useQuery as ae } from "@tanstack/react-query";
4
4
  import { useState as m, useCallback as h, useEffect as f, useMemo as T } from "react";
5
5
  const ne = "_documentsTableBody_1voj8_1", oe = "_viewAttachmentsLink_1voj8_11", re = "_documentViewerContainer_1voj8_15", de = "_attachmentItem_1voj8_23", se = "_attachmentCounter_1voj8_27", ce = "_attachmentError_1voj8_36", ie = "_documentIframe_1voj8_44", me = "_documentImage_1voj8_50", d = {
@@ -1,8 +1,8 @@
1
1
  import { jsx as s, jsxs as J, Fragment as W } from "react/jsx-runtime";
2
- import { a as Z, u as ee, c as re, d as ae, g as te, v as oe, w as se, f as ne, V as R, T as de, E as ie, h as q, q as me, U as ue, b as le, O as ce, i as fe } from "./index-DNRQhRAW.js";
2
+ import { a as Z, u as ee, c as re, d as ae, g as te, v as oe, w as se, f as ne, V as R, T as de, E as ie, h as q, q as me, U as ue, b as le, L as ce, i as fe } from "./index-CXRvNffr.js";
3
3
  import { useQueryClient as ye, useQuery as c } from "@tanstack/react-query";
4
4
  import { useState as C, useMemo as d, useCallback as f } from "react";
5
- const be = "_formsTableBody_81hra_1", ge = "_customAccordianItem_81hra_6", O = {
5
+ const be = "_formsTableBody_81hra_1", ge = "_customAccordianItem_81hra_6", A = {
6
6
  formsTableBody: be,
7
7
  customAccordianItem: ge
8
8
  }, he = (m) => m ? m.extension?.find(
@@ -12,31 +12,31 @@ const be = "_formsTableBody_81hra_1", ge = "_customAccordianItem_81hra_6", O = {
12
12
  encounterUuids: n,
13
13
  config: S
14
14
  }) => {
15
- const { t: o } = Z(), u = ee(), [l, A] = C(!1), [t, E] = C(null), { numberOfVisits: k, hideThumbnail: V = !1 } = S ?? {}, I = re(
15
+ const { t: o } = Z(), u = ee(), [l, O] = C(!1), [t, E] = C(null), { numberOfVisits: k, hideThumbnail: V = !1 } = S ?? {}, I = re(
16
16
  m,
17
17
  n
18
18
  ), w = ye(), {
19
19
  data: y = [],
20
20
  isLoading: T,
21
- isError: B,
21
+ isError: L,
22
22
  error: H,
23
23
  refetch: K
24
24
  } = c({
25
25
  queryKey: ["forms", u, m],
26
26
  queryFn: () => ae(u, void 0, k),
27
27
  enabled: !!u && !I
28
- }), _ = d(() => !n || n.length === 0 ? y : y.filter(
28
+ }), B = d(() => !n || n.length === 0 ? y : y.filter(
29
29
  (e) => n.includes(e.encounterUuid)
30
- ), [y, n]), { data: v = [] } = c({
30
+ ), [y, n]), { data: _ = [] } = c({
31
31
  queryKey: ["observationForms"],
32
32
  queryFn: () => te()
33
- }), F = f(
34
- (e) => v.find((r) => r.name === e)?.uuid,
35
- [v]
33
+ }), v = f(
34
+ (e) => _.find((r) => r.name === e)?.uuid,
35
+ [_]
36
36
  ), b = d(() => {
37
37
  if (t)
38
- return F(t.formName);
39
- }, [t, F]), {
38
+ return v(t.formName);
39
+ }, [t, v]), {
40
40
  isLoading: j,
41
41
  isError: x,
42
42
  error: g
@@ -68,7 +68,7 @@ const be = "_formsTableBody_81hra_1", ge = "_customAccordianItem_81hra_6", O = {
68
68
  return R(g).message;
69
69
  if (p)
70
70
  return R(p).message;
71
- }, [g, p]), L = d(
71
+ }, [g, p]), F = d(
72
72
  () => [
73
73
  { key: "recordedOn", header: o("RECORDED_ON") },
74
74
  { key: "recordedBy", header: o("RECORDED_BY") }
@@ -81,7 +81,7 @@ const be = "_formsTableBody_81hra_1", ge = "_customAccordianItem_81hra_6", O = {
81
81
  ],
82
82
  []
83
83
  ), M = d(() => {
84
- const e = _.reduce(
84
+ const e = B.reduce(
85
85
  (r, a) => {
86
86
  const i = a.formName;
87
87
  r[i] ??= [];
@@ -105,10 +105,10 @@ const be = "_formsTableBody_81hra_1", ge = "_customAccordianItem_81hra_6", O = {
105
105
  )
106
106
  })
107
107
  ).sort((r, a) => r.formName.localeCompare(a.formName));
108
- }, [_, o]), U = f((e) => {
109
- E(e), A(!0);
108
+ }, [B, o]), U = f((e) => {
109
+ E(e), O(!0);
110
110
  }, []), Y = f(() => {
111
- A(!1), E(null);
111
+ O(!1), E(null);
112
112
  }, []), D = f(
113
113
  (e, r) => {
114
114
  switch (r) {
@@ -123,17 +123,17 @@ const be = "_formsTableBody_81hra_1", ge = "_customAccordianItem_81hra_6", O = {
123
123
  [U]
124
124
  );
125
125
  return /* @__PURE__ */ J(W, { children: [
126
- /* @__PURE__ */ s("div", { "data-testid": "forms-table", children: T || B || M.length === 0 || I ? /* @__PURE__ */ s(
126
+ /* @__PURE__ */ s("div", { "data-testid": "forms-table", children: T || L || M.length === 0 || I ? /* @__PURE__ */ s(
127
127
  q,
128
128
  {
129
- headers: L,
129
+ headers: F,
130
130
  ariaLabel: o("FORMS_HEADING"),
131
131
  rows: [],
132
132
  loading: T,
133
- errorStateMessage: B ? H?.message : void 0,
133
+ errorStateMessage: L ? H?.message : void 0,
134
134
  emptyStateMessage: o("FORMS_UNAVAILABLE"),
135
135
  renderCell: D,
136
- className: O.formsTableBody,
136
+ className: A.formsTableBody,
137
137
  dataTestId: "forms-table"
138
138
  }
139
139
  ) : /* @__PURE__ */ s(me, { align: "start", children: M.map((e, r) => {
@@ -142,13 +142,13 @@ const be = "_formsTableBody_81hra_1", ge = "_customAccordianItem_81hra_6", O = {
142
142
  ue,
143
143
  {
144
144
  title: a,
145
- className: O.customAccordianItem,
145
+ className: A.customAccordianItem,
146
146
  testId: `accordian-title-${a}`,
147
147
  open: r === 0,
148
148
  children: /* @__PURE__ */ s(
149
149
  q,
150
150
  {
151
- headers: L,
151
+ headers: F,
152
152
  ariaLabel: o("FORMS_HEADING"),
153
153
  rows: i,
154
154
  loading: !1,
@@ -156,7 +156,7 @@ const be = "_formsTableBody_81hra_1", ge = "_customAccordianItem_81hra_6", O = {
156
156
  sortable: P,
157
157
  emptyStateMessage: o("FORMS_UNAVAILABLE"),
158
158
  renderCell: D,
159
- className: O.formsTableBody,
159
+ className: A.formsTableBody,
160
160
  dataTestId: `forms-table-${a}`
161
161
  }
162
162
  )
@@ -1,25 +1,25 @@
1
- import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-CflEJEC8.js";
2
- import { r as d, s as f, t as e } from "./index-DNRQhRAW.js";
1
+ import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-BOmicZD4.js";
2
+ import { o as d, r as f, s as e } from "./index-CXRvNffr.js";
3
3
  var p = (a) => {
4
- const [r, t] = c({
4
+ const [r, o] = c({
5
5
  prefix: "TanstackQueryDevtools"
6
6
  }), n = d(), s = f(() => {
7
- const o = r.theme_preference || l;
8
- return o !== "system" ? o : n();
7
+ const t = r.theme_preference || l;
8
+ return t !== "system" ? t : n();
9
9
  });
10
10
  return e(i.Provider, {
11
11
  value: a,
12
12
  get children() {
13
13
  return e(m, {
14
14
  localStore: r,
15
- setLocalStore: t,
15
+ setLocalStore: o,
16
16
  get children() {
17
17
  return e(u.Provider, {
18
18
  value: s,
19
19
  get children() {
20
20
  return e(v, {
21
21
  localStore: r,
22
- setLocalStore: t
22
+ setLocalStore: o
23
23
  });
24
24
  }
25
25
  });
@@ -1,5 +1,5 @@
1
- import { c as l, T as c, P as u, a as i, b as m, C as P, Q as d } from "./YPM2AS64-CflEJEC8.js";
2
- import { r as v, s as C, t as e } from "./index-DNRQhRAW.js";
1
+ import { c as l, T as c, P as u, a as i, b as m, C as P, Q as d } from "./YPM2AS64-BOmicZD4.js";
2
+ import { o as v, r as C, s as e } from "./index-CXRvNffr.js";
3
3
  var h = (t) => {
4
4
  const [r, o] = l({
5
5
  prefix: "TanstackQueryDevtools"
@@ -1,11 +1,11 @@
1
1
  import { jsxs as I, jsx as u } from "react/jsx-runtime";
2
- import { u as B, e as K, a as S, p as M, m as x, f as G, x as Q, z as j, N as w, j as z, h as H, k as P, G as A, M as Y, R as J, A as W, l as X, n as Z, o as ee } from "./index-DNRQhRAW.js";
2
+ import { u as B, e as K, a as S, p as M, m as x, f as G, x as Q, z as j, N as w, j as z, h as H, k as P, G as U, M as Y, $ as J, _ as W, t as X, l as Z, n as ee } from "./index-CXRvNffr.js";
3
3
  import { useQueries as ae, useQuery as te } from "@tanstack/react-query";
4
- import { useRef as se, useEffect as $, useMemo as R } from "react";
5
- const U = (a, n, d, l, b, r) => {
6
- const t = Y(a, n, b), s = t.value, o = J(s);
7
- let i = s;
8
- o === "Image" && (i = /* @__PURE__ */ u(
4
+ import { useRef as se, useEffect as O, useMemo as f } from "react";
5
+ const D = (a, n, d, l, b, r) => {
6
+ const t = Y(a, n, b), s = t.value, i = J(s);
7
+ let o = s;
8
+ i === "Image" && (o = /* @__PURE__ */ u(
9
9
  X,
10
10
  {
11
11
  imageSrc: s,
@@ -13,14 +13,14 @@ const U = (a, n, d, l, b, r) => {
13
13
  id: `${s}-img`,
14
14
  hideThumbnail: r
15
15
  }
16
- )), o === "Video" && (i = /* @__PURE__ */ u(
16
+ )), i === "Video" && (o = /* @__PURE__ */ u(
17
17
  Z,
18
18
  {
19
19
  id: `${s}-video`,
20
20
  videoSrc: s,
21
21
  hideThumbnail: r
22
22
  }
23
- )), o === "PDF" && (i = /* @__PURE__ */ u(ee, { id: `${s}-pdf`, src: s }));
23
+ )), i === "PDF" && (o = /* @__PURE__ */ u(ee, { id: `${s}-pdf`, src: s }));
24
24
  const p = b("OBSERVATIONS_RECORDED_BY", {
25
25
  provider: t.provider
26
26
  }), m = a.display, v = a.observationValue?.isAbnormal ? "abnormal-obs" : "obs", c = l ? `${l}-${v}-${m}-${d}-${n}` : `${v}-${m}-${d}-${n}`;
@@ -28,7 +28,7 @@ const U = (a, n, d, l, b, r) => {
28
28
  W,
29
29
  {
30
30
  header: t.header,
31
- value: i,
31
+ value: o,
32
32
  info: p,
33
33
  id: c,
34
34
  testId: c,
@@ -37,15 +37,15 @@ const U = (a, n, d, l, b, r) => {
37
37
  `obs-${a.id}`
38
38
  );
39
39
  }, re = (a, n, d, l, b, r, t) => /* @__PURE__ */ u(
40
- A,
40
+ U,
41
41
  {
42
42
  title: a.display,
43
43
  id: `grouped-obs-${a.display}-${l}`,
44
44
  open: d,
45
45
  children: a.members?.map(
46
- (s, o) => U(
46
+ (s, i) => D(
47
47
  s,
48
- o,
48
+ i,
49
49
  b,
50
50
  r,
51
51
  n,
@@ -54,23 +54,23 @@ const U = (a, n, d, l, b, r) => {
54
54
  )
55
55
  },
56
56
  `grouped-obs-${a.id}`
57
- ), oe = ({
57
+ ), ie = ({
58
58
  groupedData: a,
59
59
  title: n = "",
60
60
  hideThumbnail: d
61
61
  }) => {
62
62
  const { t: l } = S(), b = (r, t, s) => {
63
- const o = P(r.encounterDetails, l);
63
+ const i = P(r.encounterDetails, l);
64
64
  return /* @__PURE__ */ I(
65
- A,
65
+ U,
66
66
  {
67
- title: o,
67
+ title: i,
68
68
  id: `encounter-${r.encounterId}`,
69
69
  open: t,
70
70
  children: [
71
71
  r.observations.map(
72
- (i, p) => U(
73
- i,
72
+ (o, p) => D(
73
+ o,
74
74
  p,
75
75
  s,
76
76
  n,
@@ -79,8 +79,8 @@ const U = (a, n, d, l, b, r) => {
79
79
  )
80
80
  ),
81
81
  r.groupedObservations.map(
82
- (i, p) => re(
83
- i,
82
+ (o, p) => re(
83
+ o,
84
84
  l,
85
85
  t,
86
86
  p,
@@ -105,37 +105,37 @@ const U = (a, n, d, l, b, r) => {
105
105
  )
106
106
  }
107
107
  );
108
- }, ie = "_observations_kfbhq_1", ne = "_title_kfbhq_12", N = {
109
- observations: ie,
108
+ }, oe = "_observations_kfbhq_1", ne = "_title_kfbhq_12", N = {
109
+ observations: oe,
110
110
  title: ne
111
111
  }, de = (a) => ["conceptUuid", a], le = (a, n) => ["observations", a, ...n], me = ({ config: a }) => {
112
112
  const n = a, {
113
113
  conceptNames: d = [],
114
114
  conceptUuid: l = [],
115
115
  hideThumbnail: b = !1
116
- } = n, r = se(/* @__PURE__ */ new Set()), t = B(), { addNotification: s } = K(), { t: o } = S(), i = ae({
116
+ } = n, r = se(/* @__PURE__ */ new Set()), t = B(), { addNotification: s } = K(), { t: i } = S(), o = ae({
117
117
  queries: d.map((e) => ({
118
118
  queryKey: de(e),
119
119
  queryFn: () => M(e),
120
120
  enabled: !!e
121
121
  }))
122
122
  });
123
- $(() => {
124
- i.forEach((e, h) => {
123
+ O(() => {
124
+ o.forEach((e, h) => {
125
125
  if (e.isError && !r.current.has(h)) {
126
126
  const k = d[h];
127
127
  s({
128
- title: o("ERROR_DEFAULT_TITLE"),
129
- message: o("ERROR_FETCHING_CONCEPT", { conceptName: k }),
128
+ title: i("ERROR_DEFAULT_TITLE"),
129
+ message: i("ERROR_FETCHING_CONCEPT", { conceptName: k }),
130
130
  type: "error"
131
131
  }), r.current.add(h);
132
132
  } else e.isError || r.current.delete(h);
133
133
  });
134
- }, [i, d]);
135
- const p = R(() => i.map((e) => e.data?.uuid).filter((e) => !!e), [i]), m = R(() => [.../* @__PURE__ */ new Set([...p, ...l])], [p, l]), v = R(() => d.length === 0 ? !0 : i.every((e) => !e.isLoading), [i, d.length]), {
134
+ }, [o, d]);
135
+ const p = f(() => o.map((e) => e.data?.uuid).filter((e) => !!e), [o]), m = f(() => [.../* @__PURE__ */ new Set([...p, ...l])], [p, l]), v = f(() => d.length === 0 ? !0 : o.every((e) => !e.isLoading), [o, d.length]), {
136
136
  data: c,
137
- isLoading: D,
138
- isError: f,
137
+ isLoading: F,
138
+ isError: R,
139
139
  refetch: T
140
140
  } = te({
141
141
  queryKey: le(t, m),
@@ -149,22 +149,22 @@ const U = (a, n, d, l, b, r) => {
149
149
  ) && T();
150
150
  },
151
151
  [t, T]
152
- ), $(() => {
153
- f && s({
154
- title: o("ERROR_DEFAULT_TITLE"),
155
- message: o("ERROR_FETCHING_OBSERVATIONS"),
152
+ ), O(() => {
153
+ R && s({
154
+ title: i("ERROR_DEFAULT_TITLE"),
155
+ message: i("ERROR_FETCHING_OBSERVATIONS"),
156
156
  type: "error"
157
157
  });
158
- }, [f]);
159
- const g = R(() => {
158
+ }, [R]);
159
+ const g = f(() => {
160
160
  if (!c) return [];
161
161
  const e = Q(c), h = j(e);
162
162
  return w(h);
163
- }, [c]), F = [
163
+ }, [c]), q = [
164
164
  { key: "name", header: "name" },
165
165
  { key: "value", header: "value" },
166
166
  { key: "form", header: "form" }
167
- ], O = D || !v, _ = f && v, q = (!c || c.entry?.length === 0 || m.length === 0) && v, L = _ ? o("ERROR_FETCHING_OBSERVATIONS") : null, C = q ? o("NO_OBSERVATIONS_FOUND") : void 0, V = g.length > 0 && !O && !_, E = n.titleTranslationKey, y = E ? o(E) : "";
167
+ ], _ = F || !v, $ = R && v, A = (!c || c.entry?.length === 0 || m.length === 0) && v, L = $ ? i("ERROR_FETCHING_OBSERVATIONS") : null, C = A ? i("NO_OBSERVATIONS_FOUND") : void 0, V = g.length > 0 && !_ && !$, E = n.titleTranslationKey, y = E ? i(E) : "";
168
168
  return /* @__PURE__ */ I(
169
169
  "div",
170
170
  {
@@ -184,7 +184,7 @@ const U = (a, n, d, l, b, r) => {
184
184
  }
185
185
  ),
186
186
  V ? /* @__PURE__ */ u(
187
- oe,
187
+ ie,
188
188
  {
189
189
  groupedData: g,
190
190
  title: y,
@@ -193,10 +193,10 @@ const U = (a, n, d, l, b, r) => {
193
193
  ) : /* @__PURE__ */ u(
194
194
  H,
195
195
  {
196
- headers: F,
196
+ headers: q,
197
197
  rows: [],
198
- ariaLabel: o("OBSERVATIONS"),
199
- loading: O,
198
+ ariaLabel: i("OBSERVATIONS"),
199
+ loading: _,
200
200
  errorStateMessage: L,
201
201
  emptyStateMessage: C,
202
202
  dataTestId: "observations-table"