@bahmni/registration-app 0.0.1-dev.229 → 0.0.1-dev.231

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
- import { jsx as r, jsxs as p, Fragment as Y } from "react/jsx-runtime";
2
- import { t as K, u as Q, r as W, s as J, M as X, N as Z, o as ee, a as te } from "./index-UAAQaH3g.js";
1
+ import { jsx as r, jsxs as _, Fragment as Y } from "react/jsx-runtime";
2
+ import { t as K, u as Q, r as W, p as J, x as X, V as Z, o as ee, s as te } from "./index-BnIEcatH.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 = {
@@ -21,41 +21,41 @@ const ne = "_documentsTableBody_1voj8_1", oe = "_viewAttachmentsLink_1voj8_11",
21
21
  function j(a) {
22
22
  return !a || a.includes(":") ? "#" : `/openmrs/auth?requested_document=/document_images/${a}`;
23
23
  }
24
- function ue(a, g) {
24
+ function ue(a, E) {
25
25
  return a.map((s) => ({
26
26
  key: s,
27
- header: g(le[s])
27
+ header: E(le[s])
28
28
  }));
29
29
  }
30
- const _e = [
30
+ const pe = [
31
31
  "documentIdentifier",
32
32
  "documentType",
33
33
  "uploadedOn",
34
34
  "uploadedBy",
35
35
  "action"
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 }) => {
37
- const [s, w] = m(!1), [o, M] = m(
36
+ ], _e = /\.(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
+ const [s, w] = m(!1), [o, L] = m(
38
38
  null
39
39
  ), [R, I] = m(
40
40
  /* @__PURE__ */ new Set()
41
- ), E = K(), { t: n } = Q(), { addNotification: L } = W(), $ = Number(a?.pageSize) || 5, [C, A] = m(1), [l, k] = m($), [V, y] = m(void 0), U = h((e) => {
42
- M(e), w(!0);
41
+ ), g = K(), { t: n } = Q(), { addNotification: U } = W(), $ = Number(a?.pageSize) || 5, [C, A] = m(1), [l, V] = m($), [k, y] = m(void 0), M = h((e) => {
42
+ L(e), w(!0);
43
43
  }, []), F = h(() => {
44
- w(!1), M(null), I(/* @__PURE__ */ new Set());
44
+ w(!1), L(null), I(/* @__PURE__ */ new Set());
45
45
  }, []), b = h((e) => {
46
46
  I((t) => new Set(t).add(e));
47
47
  }, []), { data: u, isLoading: H, isError: D, error: v } = ae({
48
48
  queryKey: [
49
49
  "documents",
50
- E,
51
50
  g,
51
+ E,
52
52
  C,
53
53
  l
54
54
  ],
55
- enabled: !!E,
55
+ enabled: !!g,
56
56
  queryFn: () => J(
57
- E,
58
57
  g,
58
+ E,
59
59
  l,
60
60
  C
61
61
  )
@@ -64,13 +64,13 @@ const _e = [
64
64
  u && y(u.total);
65
65
  }, [u]), f(() => {
66
66
  A(1), y(void 0);
67
- }, [E]), f(() => {
68
- D && L({
67
+ }, [g]), f(() => {
68
+ D && U({
69
69
  title: n("ERROR_DEFAULT_TITLE"),
70
70
  message: v?.message ?? "",
71
71
  type: "error"
72
72
  });
73
- }, [D, v, L, n]), f(() => {
73
+ }, [D, v, U, n]), f(() => {
74
74
  const e = new AbortController();
75
75
  return (async () => {
76
76
  if (!s || !o) return;
@@ -91,19 +91,19 @@ const _e = [
91
91
  }, [s, o]);
92
92
  const q = h(
93
93
  (e, t) => {
94
- t !== l ? (k(t), A(1), y(void 0)) : A(e);
94
+ t !== l ? (V(t), A(1), y(void 0)) : A(e);
95
95
  },
96
96
  [l]
97
97
  ), N = T(
98
- () => a?.fields ?? _e,
98
+ () => a?.fields ?? pe,
99
99
  [a?.fields]
100
- ), P = T(() => [...u?.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), [u]), z = T(() => ue(N, n), [N, n]), x = T(
100
+ ), x = T(() => [...u?.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), [u]), P = T(() => ue(N, n), [N, n]), z = T(
101
101
  () => N.map((e) => ({
102
102
  key: e,
103
103
  sortable: e !== "action"
104
104
  })),
105
105
  [N]
106
- ), _ = T(
106
+ ), p = T(
107
107
  () => o ? B(o) : [],
108
108
  [o]
109
109
  ), G = h(
@@ -125,7 +125,7 @@ const _e = [
125
125
  return e.attachments.length > 0 || e.documentUrl ? /* @__PURE__ */ r(
126
126
  X,
127
127
  {
128
- onClick: () => U(e),
128
+ onClick: () => M(e),
129
129
  className: d.viewAttachmentsLink,
130
130
  "data-testid": `view-attachments-${e.id}`,
131
131
  children: n("DOCUMENTS_VIEW_ATTACHMENTS")
@@ -135,24 +135,24 @@ const _e = [
135
135
  return null;
136
136
  }
137
137
  },
138
- [U, n]
138
+ [M, n]
139
139
  );
140
- return /* @__PURE__ */ p(Y, { children: [
140
+ return /* @__PURE__ */ _(Y, { children: [
141
141
  /* @__PURE__ */ r("div", { "data-testid": "documents-table", children: /* @__PURE__ */ r(
142
142
  ee,
143
143
  {
144
- headers: z,
144
+ headers: P,
145
145
  ariaLabel: n("DOCUMENTS_TABLE_HEADING"),
146
- rows: P,
146
+ rows: x,
147
147
  loading: H,
148
148
  errorStateMessage: D ? v?.message : null,
149
- sortable: x,
149
+ sortable: z,
150
150
  emptyStateMessage: n("DOCUMENTS_NO_RECORDS"),
151
151
  renderCell: G,
152
152
  className: d.documentsTableBody,
153
153
  dataTestId: "documents-table",
154
154
  pageSize: l,
155
- totalItems: V,
155
+ totalItems: k,
156
156
  page: C,
157
157
  onPageChange: q
158
158
  }
@@ -168,33 +168,33 @@ const _e = [
168
168
  passiveModal: !0,
169
169
  size: "lg",
170
170
  testId: "document-view-modal",
171
- children: /* @__PURE__ */ r("div", { className: d.documentViewerContainer, children: _.map((e, t) => {
172
- const c = j(e.url), i = e.contentType?.toLowerCase().includes("pdf"), S = (e.contentType?.toLowerCase().includes("image") ?? !1) || pe.test(e.url ?? ""), O = R.has(t);
173
- return c === "#" || O ? /* @__PURE__ */ p(
171
+ children: /* @__PURE__ */ r("div", { className: d.documentViewerContainer, children: p.map((e, t) => {
172
+ const c = j(e.url), i = e.contentType?.toLowerCase().includes("pdf"), S = (e.contentType?.toLowerCase().includes("image") ?? !1) || _e.test(e.url ?? ""), O = R.has(t);
173
+ return c === "#" || O ? /* @__PURE__ */ _(
174
174
  "div",
175
175
  {
176
176
  className: d.attachmentError,
177
177
  "data-testid": `attachment-error-${t}`,
178
178
  children: [
179
- _.length > 1 && /* @__PURE__ */ p("p", { className: d.attachmentCounter, children: [
179
+ p.length > 1 && /* @__PURE__ */ _("p", { className: d.attachmentCounter, children: [
180
180
  t + 1,
181
181
  "/",
182
- _.length
182
+ p.length
183
183
  ] }),
184
184
  /* @__PURE__ */ r("p", { children: n("DOCUMENTS_ERROR_LOADING_ATTACHMENT") })
185
185
  ]
186
186
  },
187
187
  `${o.id}-${e.url}`
188
- ) : /* @__PURE__ */ p(
188
+ ) : /* @__PURE__ */ _(
189
189
  "div",
190
190
  {
191
191
  className: d.attachmentItem,
192
192
  "data-testid": `attachment-item-${t}`,
193
193
  children: [
194
- _.length > 1 && /* @__PURE__ */ p("p", { className: d.attachmentCounter, children: [
194
+ p.length > 1 && /* @__PURE__ */ _("p", { className: d.attachmentCounter, children: [
195
195
  t + 1,
196
196
  "/",
197
- _.length
197
+ p.length
198
198
  ] }),
199
199
  S ? /* @__PURE__ */ r(
200
200
  "img",
@@ -1,54 +1,54 @@
1
1
  import { jsx as s, jsxs as W, Fragment as X } from "react/jsx-runtime";
2
- import { u as Z, t as ee, m as re, i as ae, b as te, c as oe, n as se, k as ne, V as U, N as de, M as ie, o as S, G as me, J as ue, a as le, P as ce, d as fe } from "./index-UAAQaH3g.js";
2
+ import { u as Z, t as ee, g as re, h as ae, d as te, a as oe, c as se, k as ne, b as v, V as de, x as ie, o as q, J as ue, Q as me, s as le, e as ce, f as fe } from "./index-BnIEcatH.js";
3
3
  import { useQueryClient as ye, useQuery as c } from "@tanstack/react-query";
4
- import { useState as q, useMemo as d, useCallback as f } from "react";
5
- const be = "_formsTableBody_81hra_1", pe = "_customAccordianItem_81hra_6", O = {
4
+ import { useState as C, useMemo as d, useCallback as f } from "react";
5
+ const be = "_formsTableBody_81hra_1", ge = "_customAccordianItem_81hra_6", I = {
6
6
  formsTableBody: be,
7
- customAccordianItem: pe
8
- }, Ne = (m) => m ? m.extension?.find(
7
+ customAccordianItem: ge
8
+ }, pe = (u) => u ? u.extension?.find(
9
9
  (n) => n.url === fe
10
- )?.valueString : void 0, Ie = ({
11
- episodeOfCareUuids: m,
10
+ )?.valueString : void 0, Ae = ({
11
+ episodeOfCareUuids: u,
12
12
  encounterUuids: n,
13
- config: C
13
+ config: S
14
14
  }) => {
15
- const { t: o } = Z(), u = ee(), [l, A] = q(!1), [t, I] = q(null), { numberOfVisits: k, hideThumbnail: V = !1 } = C ?? {}, M = re(
16
- m,
15
+ const { t: o } = Z(), m = ee(), [l, O] = C(!1), [t, A] = C(null), { numberOfVisits: k, hideThumbnail: V = !1 } = S ?? {}, T = re(
16
+ u,
17
17
  n
18
- ), H = ye(), {
18
+ ), x = ye(), {
19
19
  data: y = [],
20
- isLoading: T,
21
- isError: B,
22
- error: K,
23
- refetch: j
20
+ isLoading: B,
21
+ isError: E,
22
+ error: H,
23
+ refetch: K
24
24
  } = c({
25
- queryKey: ["forms", u, m],
26
- queryFn: () => ae(u, void 0, k),
27
- enabled: !!u && !M
28
- }), E = d(() => !n || n.length === 0 ? y : y.filter(
25
+ queryKey: ["forms", m, u],
26
+ queryFn: () => ae(m, void 0, k),
27
+ enabled: !!m && !T
28
+ }), _ = d(() => !n || n.length === 0 ? y : y.filter(
29
29
  (e) => n.includes(e.encounterUuid)
30
- ), [y, n]), { data: _ = [] } = c({
30
+ ), [y, n]), { data: F = [] } = c({
31
31
  queryKey: ["observationForms"],
32
32
  queryFn: () => te()
33
- }), D = f(
34
- (e) => _.find((r) => r.name === e)?.uuid,
35
- [_]
33
+ }), L = f(
34
+ (e) => F.find((r) => r.name === e)?.uuid,
35
+ [F]
36
36
  ), b = d(() => {
37
37
  if (t)
38
- return D(t.formName);
39
- }, [t, D]), {
40
- isLoading: x,
41
- isError: G,
42
- error: p
38
+ return L(t.formName);
39
+ }, [t, L]), {
40
+ isLoading: Q,
41
+ isError: j,
42
+ error: g
43
43
  } = c({
44
44
  queryKey: ["formMetadata", b],
45
45
  queryFn: () => oe(b),
46
46
  enabled: !!b && l
47
47
  }), {
48
- data: N,
48
+ data: p,
49
49
  isLoading: $,
50
50
  isError: w,
51
- error: g
51
+ error: h
52
52
  } = c({
53
53
  queryKey: ["formsEncounterFHIR", t?.encounterUuid],
54
54
  queryFn: () => se(t.encounterUuid),
@@ -56,41 +56,41 @@ const be = "_formsTableBody_81hra_1", pe = "_customAccordianItem_81hra_6", O = {
56
56
  });
57
57
  ne(
58
58
  (e) => {
59
- e.patientUUID === u && e.updatedConcepts.size > 0 && (j(), H.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
59
+ e.patientUUID === m && e.updatedConcepts.size > 0 && (K(), x.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
60
60
  },
61
- [u]
61
+ [m]
62
62
  );
63
- const P = d(() => !N?.entry || !t?.formName ? [] : N.entry.filter((e) => e.resource?.resourceType === "Observation").map((e) => e.resource).filter((e) => {
64
- const r = Ne(e);
63
+ const z = d(() => !p?.entry || !t?.formName ? [] : p.entry.filter((e) => e.resource?.resourceType === "Observation").map((e) => e.resource).filter((e) => {
64
+ const r = pe(e);
65
65
  return !r || r.includes(t.formName);
66
- }), [N, t?.formName]), Q = d(() => {
67
- if (p)
68
- return U(p).message;
66
+ }), [p, t?.formName]), G = d(() => {
69
67
  if (g)
70
- return U(g).message;
71
- }, [p, g]), F = d(
68
+ return v(g).message;
69
+ if (h)
70
+ return v(h).message;
71
+ }, [g, h]), M = d(
72
72
  () => [
73
73
  { key: "recordedOn", header: o("RECORDED_ON") },
74
74
  { key: "recordedBy", header: o("RECORDED_BY") }
75
75
  ],
76
76
  [o]
77
- ), z = d(
77
+ ), J = d(
78
78
  () => [
79
79
  { key: "recordedOn", sortable: !0 },
80
80
  { key: "recordedBy", sortable: !0 }
81
81
  ],
82
82
  []
83
- ), L = d(() => {
84
- const e = E.reduce(
83
+ ), D = d(() => {
84
+ const e = _.reduce(
85
85
  (r, a) => {
86
86
  const i = a.formName;
87
87
  r[i] ??= [];
88
- const h = a.providers.map((Y) => Y.providerName).filter(Boolean).join(", ");
88
+ const N = a.providers.map((Y) => Y.providerName).filter(Boolean).join(", ");
89
89
  return r[i].push({
90
90
  id: a.encounterUuid,
91
91
  formName: a.formName,
92
92
  recordedOn: de(a.encounterDateTime, o, !0).formattedResult,
93
- recordedBy: h ?? "--",
93
+ recordedBy: N ?? "--",
94
94
  encounterDateTime: a.encounterDateTime,
95
95
  encounterUuid: a.encounterUuid
96
96
  }), r;
@@ -101,15 +101,15 @@ const be = "_formsTableBody_81hra_1", pe = "_customAccordianItem_81hra_6", O = {
101
101
  ([r, a]) => ({
102
102
  formName: r,
103
103
  records: a.sort(
104
- (i, h) => h.encounterDateTime - i.encounterDateTime
104
+ (i, N) => N.encounterDateTime - i.encounterDateTime
105
105
  )
106
106
  })
107
107
  ).sort((r, a) => r.formName.localeCompare(a.formName));
108
- }, [E, o]), R = f((e) => {
109
- I(e), A(!0);
110
- }, []), J = f(() => {
111
- A(!1), I(null);
112
- }, []), v = f(
108
+ }, [_, o]), R = f((e) => {
109
+ A(e), O(!0);
110
+ }, []), P = f(() => {
111
+ O(!1), A(null);
112
+ }, []), U = f(
113
113
  (e, r) => {
114
114
  switch (r) {
115
115
  case "recordedOn":
@@ -123,40 +123,40 @@ const be = "_formsTableBody_81hra_1", pe = "_customAccordianItem_81hra_6", O = {
123
123
  [R]
124
124
  );
125
125
  return /* @__PURE__ */ W(X, { children: [
126
- /* @__PURE__ */ s("div", { "data-testid": "forms-table", children: T || B || L.length === 0 || M ? /* @__PURE__ */ s(
127
- S,
126
+ /* @__PURE__ */ s("div", { "data-testid": "forms-table", children: B || E || D.length === 0 || T ? /* @__PURE__ */ s(
127
+ q,
128
128
  {
129
- headers: F,
129
+ headers: M,
130
130
  ariaLabel: o("FORMS_HEADING"),
131
131
  rows: [],
132
- loading: T,
133
- errorStateMessage: B ? K?.message : void 0,
132
+ loading: B,
133
+ errorStateMessage: E ? H?.message : void 0,
134
134
  emptyStateMessage: o("FORMS_UNAVAILABLE"),
135
- renderCell: v,
136
- className: O.formsTableBody,
135
+ renderCell: U,
136
+ className: I.formsTableBody,
137
137
  dataTestId: "forms-table"
138
138
  }
139
- ) : /* @__PURE__ */ s(me, { align: "start", children: L.map((e, r) => {
139
+ ) : /* @__PURE__ */ s(ue, { align: "start", children: D.map((e, r) => {
140
140
  const { formName: a, records: i } = e;
141
141
  return /* @__PURE__ */ s(
142
- ue,
142
+ me,
143
143
  {
144
144
  title: a,
145
- className: O.customAccordianItem,
145
+ className: I.customAccordianItem,
146
146
  testId: `accordian-title-${a}`,
147
147
  open: r === 0,
148
148
  children: /* @__PURE__ */ s(
149
- S,
149
+ q,
150
150
  {
151
- headers: F,
151
+ headers: M,
152
152
  ariaLabel: o("FORMS_HEADING"),
153
153
  rows: i,
154
154
  loading: !1,
155
155
  errorStateMessage: "",
156
- sortable: z,
156
+ sortable: J,
157
157
  emptyStateMessage: o("FORMS_UNAVAILABLE"),
158
- renderCell: v,
159
- className: O.formsTableBody,
158
+ renderCell: U,
159
+ className: I.formsTableBody,
160
160
  dataTestId: `forms-table-${a}`
161
161
  }
162
162
  )
@@ -170,7 +170,7 @@ const be = "_formsTableBody_81hra_1", pe = "_customAccordianItem_81hra_6", O = {
170
170
  id: "modalIdForActionAreaLayout",
171
171
  portalId: "main-display-area",
172
172
  open: l,
173
- onRequestClose: J,
173
+ onRequestClose: P,
174
174
  modalHeading: t.formName,
175
175
  modalLabel: `${t.recordedOn} | ${t.recordedBy}`,
176
176
  passiveModal: !0,
@@ -179,10 +179,10 @@ const be = "_formsTableBody_81hra_1", pe = "_customAccordianItem_81hra_6", O = {
179
179
  children: /* @__PURE__ */ s(
180
180
  ce,
181
181
  {
182
- observations: P,
183
- isLoading: x || $,
184
- isError: G || w,
185
- errorMessage: Q,
182
+ observations: z,
183
+ isLoading: Q || $,
184
+ isError: j || w,
185
+ errorMessage: G,
186
186
  emptyStateMessage: o("NO_FORM_DATA_AVAILABLE"),
187
187
  testIdPrefix: t.formName,
188
188
  hideThumbnail: V
@@ -193,5 +193,5 @@ const be = "_formsTableBody_81hra_1", pe = "_customAccordianItem_81hra_6", O = {
193
193
  ] });
194
194
  };
195
195
  export {
196
- Ie as default
196
+ Ae as default
197
197
  };
@@ -1,5 +1,5 @@
1
- import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-M1wy1Zyd.js";
2
- import { y as d, z as f, A as e } from "./index-UAAQaH3g.js";
1
+ import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-CeszjWCR.js";
2
+ import { A as d, C as f, D as e } from "./index-BnIEcatH.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
- }, C = p;
30
+ }, P = p;
31
31
  export {
32
- C as default
32
+ P 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-M1wy1Zyd.js";
2
- import { y as v, z as C, A as e } from "./index-UAAQaH3g.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-CeszjWCR.js";
2
+ import { A as C, C as v, D as e } from "./index-BnIEcatH.js";
3
3
  var h = (t) => {
4
4
  const [r, o] = s({
5
5
  prefix: "TanstackQueryDevtools"
6
- }), a = v(), l = C(() => {
6
+ }), a = C(), l = v(() => {
7
7
  const n = r.theme_preference || c;
8
8
  return n !== "system" ? n : a();
9
9
  });