@bahmni/registration-app 0.0.1-dev.256 → 0.0.1-dev.260

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