@bahmni/registration-app 0.0.1-dev.205 → 0.0.1-dev.206

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,14 +1,14 @@
1
- import { jsxs as I, jsx as l } from "react/jsx-runtime";
2
- import { l as B, Q, u as S, g as V, r as w, f as x, t as K, h as j, p as G, w as H, x as M, j as P, L as N, k as z, d as Y, E as J, D as W, S as X, R as Z } from "./index-Gjf6R2kN.js";
1
+ import { jsxs as T, jsx as l } from "react/jsx-runtime";
2
+ import { c as V, e as k, u as I, o as x, q as K, d as j, j as P, y as Q, r as w, t as G, x as H, v as M, B as S, E as z, s as Y, N as J, P as W, F as X, l as Z } from "./index-uOTKH4lb.js";
3
3
  import { useQueries as ee, useQuery as te } from "@tanstack/react-query";
4
- import { useRef as ae, useEffect as $, useMemo as R } from "react";
5
- const D = (t, d, i, u, r) => {
4
+ import { useRef as ae, useEffect as $, useMemo as g } from "react";
5
+ const F = (t, d, i, u, r) => {
6
6
  const a = z(t, d, r), s = a.value, o = Y(s);
7
7
  let n = s;
8
8
  o === "Image" && (n = /* @__PURE__ */ l(W, { imageSrc: s, alt: s, id: `${s}-img` })), o === "Video" && (n = /* @__PURE__ */ l(X, { id: `${s}-video`, videoSrc: s })), o === "PDF" && (n = /* @__PURE__ */ l(Z, { id: `${s}-pdf`, src: s }));
9
9
  const b = r("OBSERVATIONS_RECORDED_BY", {
10
10
  provider: a.provider
11
- }), p = t.display, v = t.observationValue?.isAbnormal ? "abnormal-obs" : "obs", c = u ? `${u}-${v}-${p}-${i}-${d}` : `${v}-${p}-${i}-${d}`;
11
+ }), p = t.display, y = t.observationValue?.isAbnormal ? "abnormal-obs" : "obs", c = u ? `${u}-${y}-${p}-${i}-${d}` : `${y}-${p}-${i}-${d}`;
12
12
  return /* @__PURE__ */ l(
13
13
  J,
14
14
  {
@@ -22,13 +22,13 @@ const D = (t, d, i, u, r) => {
22
22
  `obs-${t.id}`
23
23
  );
24
24
  }, se = (t, d, i, u, r, a) => /* @__PURE__ */ l(
25
- N,
25
+ S,
26
26
  {
27
27
  title: t.display,
28
28
  id: `grouped-obs-${t.display}-${u}`,
29
29
  open: i,
30
30
  children: t.members?.map(
31
- (s, o) => D(s, o, r, a, d)
31
+ (s, o) => F(s, o, r, a, d)
32
32
  )
33
33
  },
34
34
  `grouped-obs-${t.id}`
@@ -36,17 +36,17 @@ const D = (t, d, i, u, r) => {
36
36
  groupedData: t,
37
37
  title: d = ""
38
38
  }) => {
39
- const { t: i } = S(), u = (r, a, s) => {
40
- const o = P(r.encounterDetails, i);
41
- return /* @__PURE__ */ I(
42
- N,
39
+ const { t: i } = I(), u = (r, a, s) => {
40
+ const o = M(r.encounterDetails, i);
41
+ return /* @__PURE__ */ T(
42
+ S,
43
43
  {
44
44
  title: o,
45
45
  id: `encounter-${r.encounterId}`,
46
46
  open: a,
47
47
  children: [
48
48
  r.observations.map(
49
- (n, b) => D(n, b, s, d, i)
49
+ (n, b) => F(n, b, s, d, i)
50
50
  ),
51
51
  r.groupedObservations.map(
52
52
  (n, b) => se(
@@ -74,14 +74,14 @@ const D = (t, d, i, u, r) => {
74
74
  )
75
75
  }
76
76
  );
77
- }, oe = "_observations_kfbhq_1", ne = "_title_kfbhq_12", T = {
77
+ }, oe = "_observations_kfbhq_1", ne = "_title_kfbhq_12", N = {
78
78
  observations: oe,
79
79
  title: ne
80
80
  }, ie = (t) => ["conceptUuid", t], de = (t, d) => ["observations", t, ...d], pe = ({ config: t }) => {
81
- const d = t, { conceptNames: i = [], conceptUuid: u = [] } = d, r = ae(/* @__PURE__ */ new Set()), a = B(), { addNotification: s } = Q(), { t: o } = S(), n = ee({
81
+ const d = t, { conceptNames: i = [], conceptUuid: u = [] } = d, r = ae(/* @__PURE__ */ new Set()), a = V(), { addNotification: s } = k(), { t: o } = I(), n = ee({
82
82
  queries: i.map((e) => ({
83
83
  queryKey: ie(e),
84
- queryFn: () => V(e),
84
+ queryFn: () => x(e),
85
85
  enabled: !!e
86
86
  }))
87
87
  });
@@ -97,66 +97,66 @@ const D = (t, d, i, u, r) => {
97
97
  } else e.isError || r.current.delete(m);
98
98
  });
99
99
  }, [n, i]);
100
- const b = R(() => n.map((e) => e.data?.uuid).filter((e) => !!e), [n]), p = R(() => [.../* @__PURE__ */ new Set([...b, ...u])], [b, u]), v = R(() => i.length === 0 ? !0 : n.every((e) => !e.isLoading), [n, i.length]), {
100
+ const b = g(() => n.map((e) => e.data?.uuid).filter((e) => !!e), [n]), p = g(() => [.../* @__PURE__ */ new Set([...b, ...u])], [b, u]), y = g(() => i.length === 0 ? !0 : n.every((e) => !e.isLoading), [n, i.length]), {
101
101
  data: c,
102
- isLoading: L,
103
- isError: f,
104
- refetch: h
102
+ isLoading: q,
103
+ isError: h,
104
+ refetch: R
105
105
  } = te({
106
106
  queryKey: de(a, p),
107
- queryFn: () => w(a, p),
108
- enabled: !!a && p.length > 0 && v
107
+ queryFn: () => K(a, p),
108
+ enabled: !!a && p.length > 0 && y
109
109
  });
110
- x(
110
+ j(
111
111
  (e) => {
112
112
  e.patientUUID === a && e.updatedConcepts.size > 0 && [...e.updatedConcepts.keys()].some(
113
113
  (m) => p.includes(m)
114
- ) && h();
114
+ ) && R();
115
115
  },
116
- [a, h]
116
+ [a, R]
117
117
  ), $(() => {
118
- f && s({
118
+ h && s({
119
119
  title: o("ERROR_DEFAULT_TITLE"),
120
120
  message: o("ERROR_FETCHING_OBSERVATIONS"),
121
121
  type: "error"
122
122
  });
123
- }, [f]);
124
- const g = R(() => {
123
+ }, [h]);
124
+ const f = g(() => {
125
125
  if (!c) return [];
126
- const e = K(c), m = j(e);
127
- return G(m);
128
- }, [c]), F = [
126
+ const e = P(c), m = Q(e);
127
+ return w(m);
128
+ }, [c]), D = [
129
129
  { key: "name", header: "name" },
130
130
  { key: "value", header: "value" },
131
131
  { key: "form", header: "form" }
132
- ], O = L || !v, _ = f && v, A = (!c || c.entry?.length === 0 || p.length === 0) && v, U = _ ? o("ERROR_FETCHING_OBSERVATIONS") : null, k = A ? o("NO_OBSERVATIONS_FOUND") : void 0, q = g.length > 0 && !O && !_, E = d.titleTranslationKey, y = E ? o(E) : "";
133
- return /* @__PURE__ */ I(
132
+ ], O = q || !y, _ = h && y, A = (!c || c.entry?.length === 0 || p.length === 0) && y, B = _ ? o("ERROR_FETCHING_OBSERVATIONS") : null, L = A ? o("NO_OBSERVATIONS_FOUND") : void 0, U = f.length > 0 && !O && !_, E = d.titleTranslationKey, v = E ? o(E) : "";
133
+ return /* @__PURE__ */ T(
134
134
  "div",
135
135
  {
136
136
  id: "observations",
137
- "data-testid": E ? `observations-${y}` : "observations",
137
+ "data-testid": E ? `observations-${v}` : "observations",
138
138
  "aria-label": "observations-aria-label",
139
- className: T.observations,
139
+ className: N.observations,
140
140
  children: [
141
141
  /* @__PURE__ */ l(
142
- H,
142
+ G,
143
143
  {
144
144
  id: "observations-title",
145
- testId: E ? `observations-title-${y}` : "observations-title",
146
- title: y,
147
- className: T.title,
148
- children: /* @__PURE__ */ l("p", { children: y })
145
+ testId: E ? `observations-title-${v}` : "observations-title",
146
+ title: v,
147
+ className: N.title,
148
+ children: /* @__PURE__ */ l("p", { children: v })
149
149
  }
150
150
  ),
151
- q ? /* @__PURE__ */ l(re, { groupedData: g, title: y }) : /* @__PURE__ */ l(
152
- M,
151
+ U ? /* @__PURE__ */ l(re, { groupedData: f, title: v }) : /* @__PURE__ */ l(
152
+ H,
153
153
  {
154
- headers: F,
154
+ headers: D,
155
155
  rows: [],
156
156
  ariaLabel: o("OBSERVATIONS"),
157
157
  loading: O,
158
- errorStateMessage: U,
159
- emptyStateMessage: k,
158
+ errorStateMessage: B,
159
+ emptyStateMessage: L,
160
160
  dataTestId: "observations-table"
161
161
  }
162
162
  )