@bahmni/home-app 0.0.1-dev.281 → 0.0.1-dev.282

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,112 +1,112 @@
1
- import { jsx as r, jsxs as _, Fragment as x } from "react/jsx-runtime";
2
- import { u as G, a as W, h as Y, K as J, w as X, m as Z, c as ee, n as te } from "./index-W2Qaoflk.js";
1
+ import { jsx as r, jsxs as h, Fragment as x } from "react/jsx-runtime";
2
+ import { u as G, a as W, h as Y, K as J, w as X, m as Z, c as ee, n as te } from "./index-CGESSG2i.js";
3
3
  import { useQuery as ae } from "@tanstack/react-query";
4
- import { useState as l, useCallback as p, useEffect as O, useMemo as h } from "react";
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", ce = "DocumentsTable-module_attachmentError__RI4U2", me = "DocumentsTable-module_documentIframe__ptq5I", le = "DocumentsTable-module_documentImage__KQVgS", d = {
4
+ import { useState as l, useCallback as _, useEffect as N, useMemo as p } from "react";
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,
8
8
  documentViewerContainer: re,
9
9
  attachmentItem: de,
10
10
  attachmentCounter: se,
11
- attachmentError: ce,
12
- documentIframe: me,
11
+ attachmentError: me,
12
+ documentIframe: ce,
13
13
  documentImage: le
14
14
  }, ue = {
15
15
  documentIdentifier: "DOCUMENTS_DOCUMENT_IDENTIFIER",
16
16
  documentType: "DOCUMENTS_TYPE",
17
17
  uploadedOn: "DOCUMENTS_UPLOADED_ON",
18
18
  uploadedBy: "DOCUMENTS_UPLOADED_BY",
19
- action: "DOCUMENTS_ACTION"
19
+ attachments: "DOCUMENTS_ATTACHMENTS"
20
20
  };
21
21
  function R(a) {
22
22
  return !a || a.includes(":") ? "#" : `/openmrs/auth?requested_document=/document_images/${a}`;
23
23
  }
24
- function ie(a, E) {
24
+ function ie(a, g) {
25
25
  return a.map((s) => ({
26
26
  key: s,
27
- header: E(ue[s])
27
+ header: g(ue[s])
28
28
  }));
29
29
  }
30
30
  const Te = [
31
31
  "documentIdentifier",
32
32
  "documentType",
33
+ "attachments",
33
34
  "uploadedOn",
34
- "uploadedBy",
35
- "action"
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 }] : [], Ie = ({ config: a, encounterUuids: E }) => {
37
- const [s, S] = l(!1), [o, U] = l(
35
+ "uploadedBy"
36
+ ], he = /\.(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, w] = l(!1), [o, U] = l(
38
38
  null
39
39
  ), [$, D] = l(
40
40
  /* @__PURE__ */ new Set()
41
- ), g = G(), { 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 = p((e) => {
42
- U(e), S(!0);
43
- }, []), H = p(() => {
44
- S(!1), U(null), D(/* @__PURE__ */ new Set());
45
- }, []), v = p((e) => {
41
+ ), E = G(), { t: n } = W(), { addNotification: L } = Y(), k = Number(a?.pageSize) || 5, [O, C] = l(1), [u, V] = l(k), [F, A] = l(void 0), M = _((e) => {
42
+ U(e), w(!0);
43
+ }, []), H = _(() => {
44
+ w(!1), U(null), D(/* @__PURE__ */ new Set());
45
+ }, []), v = _((e) => {
46
46
  D((t) => new Set(t).add(e));
47
47
  }, []), { data: i, isLoading: q, isError: b, error: y } = ae({
48
48
  queryKey: [
49
49
  "documents",
50
- g,
51
50
  E,
52
- f,
51
+ g,
52
+ O,
53
53
  u
54
54
  ],
55
- enabled: !!g,
55
+ enabled: !!E,
56
56
  queryFn: () => J(
57
- g,
58
57
  E,
58
+ g,
59
59
  u,
60
- f
60
+ O
61
61
  )
62
62
  });
63
- O(() => {
63
+ N(() => {
64
64
  i && A(i.total);
65
- }, [i]), O(() => {
65
+ }, [i]), N(() => {
66
66
  C(1), A(void 0);
67
- }, [g]), O(() => {
67
+ }, [E]), N(() => {
68
68
  b && L({
69
69
  title: n("ERROR_DEFAULT_TITLE"),
70
70
  message: y?.message ?? "",
71
71
  type: "error"
72
72
  });
73
- }, [b, y, L, n]), O(() => {
73
+ }, [b, y, L, n]), N(() => {
74
74
  const e = new AbortController();
75
75
  return (async () => {
76
76
  if (!s || !o) return;
77
- const t = /* @__PURE__ */ new Set(), c = B(o);
78
- for (let m = 0; m < c.length; m++) {
79
- const w = R(c[m].url);
77
+ const t = /* @__PURE__ */ new Set(), m = B(o);
78
+ for (let c = 0; c < m.length; c++) {
79
+ const S = R(m[c].url);
80
80
  try {
81
- (await fetch(w, {
81
+ (await fetch(S, {
82
82
  method: "HEAD",
83
83
  signal: e.signal
84
- })).ok || t.add(m);
85
- } catch (N) {
86
- N instanceof Error && N.name !== "AbortError" && t.add(m);
84
+ })).ok || t.add(c);
85
+ } catch (I) {
86
+ I instanceof Error && I.name !== "AbortError" && t.add(c);
87
87
  }
88
88
  }
89
89
  e.signal.aborted || D(t);
90
90
  })(), () => e.abort();
91
91
  }, [s, o]);
92
- const K = p(
92
+ const K = _(
93
93
  (e, t) => {
94
94
  t !== u ? (V(t), C(1), A(void 0)) : C(e);
95
95
  },
96
96
  [u]
97
- ), I = h(
97
+ ), f = p(
98
98
  () => a?.fields ?? Te,
99
99
  [a?.fields]
100
- ), j = h(() => [...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 = h(() => ie(I, n), [I, n]), z = h(
101
- () => I.map((e) => ({
100
+ ), j = p(() => [...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 = p(() => ie(f, n), [f, n]), z = p(
101
+ () => f.map((e) => ({
102
102
  key: e,
103
- sortable: e !== "action"
103
+ sortable: e !== "attachments"
104
104
  })),
105
- [I]
106
- ), T = h(
105
+ [f]
106
+ ), T = p(
107
107
  () => o ? B(o) : [],
108
108
  [o]
109
- ), Q = p(
109
+ ), Q = _(
110
110
  (e, t) => {
111
111
  switch (t) {
112
112
  case "documentIdentifier":
@@ -121,7 +121,7 @@ const Te = [
121
121
  ).formattedResult || n("DOCUMENTS_NOT_AVAILABLE");
122
122
  case "uploadedBy":
123
123
  return e.uploadedBy ?? n("DOCUMENTS_NOT_AVAILABLE");
124
- case "action":
124
+ case "attachments":
125
125
  return e.attachments.length > 0 || e.documentUrl ? /* @__PURE__ */ r(
126
126
  X,
127
127
  {
@@ -137,7 +137,7 @@ const Te = [
137
137
  },
138
138
  [M, n]
139
139
  );
140
- return /* @__PURE__ */ _(x, { children: [
140
+ return /* @__PURE__ */ h(x, { children: [
141
141
  /* @__PURE__ */ r("div", { "data-testid": "documents-table", children: /* @__PURE__ */ r(
142
142
  ee,
143
143
  {
@@ -153,7 +153,7 @@ const Te = [
153
153
  dataTestId: "documents-table",
154
154
  pageSize: u,
155
155
  totalItems: F,
156
- page: f,
156
+ page: O,
157
157
  onPageChange: K
158
158
  }
159
159
  ) }),
@@ -169,14 +169,14 @@ 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 c = R(e.url), m = e.contentType?.toLowerCase().includes("pdf"), w = (e.contentType?.toLowerCase().includes("image") ?? !1) || _e.test(e.url ?? ""), N = $.has(t);
173
- return c === "#" || N ? /* @__PURE__ */ _(
172
+ const m = R(e.url), c = e.contentType?.toLowerCase().includes("pdf"), S = (e.contentType?.toLowerCase().includes("image") ?? !1) || he.test(e.url ?? ""), I = $.has(t);
173
+ return m === "#" || I ? /* @__PURE__ */ h(
174
174
  "div",
175
175
  {
176
176
  className: d.attachmentError,
177
177
  "data-testid": `attachment-error-${t}`,
178
178
  children: [
179
- T.length > 1 && /* @__PURE__ */ _("p", { className: d.attachmentCounter, children: [
179
+ T.length > 1 && /* @__PURE__ */ h("p", { className: d.attachmentCounter, children: [
180
180
  t + 1,
181
181
  "/",
182
182
  T.length
@@ -185,21 +185,21 @@ const Te = [
185
185
  ]
186
186
  },
187
187
  `${o.id}-${e.url}`
188
- ) : /* @__PURE__ */ _(
188
+ ) : /* @__PURE__ */ h(
189
189
  "div",
190
190
  {
191
191
  className: d.attachmentItem,
192
192
  "data-testid": `attachment-item-${t}`,
193
193
  children: [
194
- T.length > 1 && /* @__PURE__ */ _("p", { className: d.attachmentCounter, children: [
194
+ T.length > 1 && /* @__PURE__ */ h("p", { className: d.attachmentCounter, children: [
195
195
  t + 1,
196
196
  "/",
197
197
  T.length
198
198
  ] }),
199
- w ? /* @__PURE__ */ r(
199
+ S ? /* @__PURE__ */ r(
200
200
  "img",
201
201
  {
202
- src: c,
202
+ src: m,
203
203
  alt: o.documentIdentifier,
204
204
  className: d.documentImage,
205
205
  onError: () => v(t)
@@ -207,7 +207,7 @@ const Te = [
207
207
  ) : /* @__PURE__ */ r(
208
208
  "iframe",
209
209
  {
210
- src: m ? `${c}#toolbar=0` : c,
210
+ src: c ? `${m}#toolbar=0` : m,
211
211
  className: d.documentIframe,
212
212
  title: o.documentIdentifier,
213
213
  onError: () => v(t)
@@ -223,5 +223,5 @@ const Te = [
223
223
  ] });
224
224
  };
225
225
  export {
226
- Ie as default
226
+ fe as default
227
227
  };
@@ -1,5 +1,5 @@
1
1
  import { jsx as s, jsxs as X, Fragment as Z } from "react/jsx-runtime";
2
- import { a as ee, u as re, E as ae, q as oe, U as te, W as se, j as ne, t as de, _ as R, m as ie, w as me, c as q, O as ue, L as le, n as ce, Y as fe, P as ye } from "./index-W2Qaoflk.js";
2
+ import { a as ee, u as re, E as ae, q as oe, U as te, W as se, j as ne, t as de, _ as R, m as ie, w as me, c as q, O as ue, L as le, n as ce, Y as fe, P as ye } from "./index-CGESSG2i.js";
3
3
  import { useQueryClient as be, useQuery as f } from "@tanstack/react-query";
4
4
  import { useState as S, useMemo as d, useCallback as y } from "react";
5
5
  const pe = "FormsTable-module_formsTableBody__SvGha", ge = "FormsTable-module_customAccordianItem__isszs", A = {
@@ -1,5 +1,5 @@
1
- import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-B-wf-VLE.js";
2
- import { R as d, S as f, T as e } from "./index-W2Qaoflk.js";
1
+ import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-BwI9XfCO.js";
2
+ import { R as d, S as f, T as e } from "./index-CGESSG2i.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-B-wf-VLE.js";
2
- import { R as v, S as C, T as e } from "./index-W2Qaoflk.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-BwI9XfCO.js";
2
+ import { R as v, S as C, T as e } from "./index-CGESSG2i.js";
3
3
  var h = (t) => {
4
4
  const [r, o] = s({
5
5
  prefix: "TanstackQueryDevtools"
@@ -1,5 +1,5 @@
1
1
  import { jsxs as N, jsx as u } from "react/jsx-runtime";
2
- import { u as U, h as K, a as S, B as Q, F as q, t as k, e as w, b as z, r as x, z as G, c as J, X as j, M as F, Q as P, V as X, J as Y, N as W, I as Z, C as ee } from "./index-W2Qaoflk.js";
2
+ import { u as U, h as K, a as S, B as Q, F as q, t as k, e as w, b as z, r as x, z as G, c as J, X as j, M as F, Q as P, V as X, J as Y, N as W, I as Z, C as ee } from "./index-CGESSG2i.js";
3
3
  import { useQueries as te, useQuery as ae } from "@tanstack/react-query";
4
4
  import { useRef as se, useEffect as $, useMemo as R } from "react";
5
5
  const C = (t, n, d, l, b, r) => {
@@ -1,4 +1,4 @@
1
- import { Z as we, $ as z, a0 as xt, a1 as B, S as q, T as y, a2 as Ro, a3 as ye, a4 as R, a5 as _, a6 as k, a7 as N, a8 as A, a9 as bs, aa as ir, ab as $e, ac as G, ad as Hn, ae as Vn, af as dt, ag as D, ah as xs, ai as cn, aj as Be, ak as ws, al as qt, am as zt, an as $s, ao as Cs, ap as $n, aq as Ss, ar as Nr, as as Bt, at as zo, au as ks, av as Es, aw as j, ax as Gr, ay as Ms, az as Ds, aA as sr, aB as As, aC as Ts, aD as zn, aE as Fs, aF as Is, aG as Z, aH as Ps, aI as Ls } from "./index-W2Qaoflk.js";
1
+ import { Z as we, $ as z, a0 as xt, a1 as B, S as q, T as y, a2 as Ro, a3 as ye, a4 as R, a5 as _, a6 as k, a7 as N, a8 as A, a9 as bs, aa as ir, ab as $e, ac as G, ad as Hn, ae as Vn, af as dt, ag as D, ah as xs, ai as cn, aj as Be, ak as ws, al as qt, am as zt, an as $s, ao as Cs, ap as $n, aq as Ss, ar as Nr, as as Bt, at as zo, au as ks, av as Es, aw as j, ax as Gr, ay as Ms, az as Ds, aA as sr, aB as As, aC as Ts, aD as zn, aE as Fs, aF as Is, aG as Z, aH as Ps, aI as Ls } from "./index-CGESSG2i.js";
2
2
  var Os = (e) => e != null, qs = (e) => e.filter(Os);
3
3
  function _s(e) {
4
4
  return (...t) => {
@@ -169376,7 +169376,7 @@ const wY0 = () => {
169376
169376
  );
169377
169377
  return t;
169378
169378
  };
169379
- B0(() => Promise.resolve().then(() => Hj0)), B0(() => Promise.resolve().then(() => Yj0)), B0(() => Promise.resolve().then(() => LF0)), B0(() => Promise.resolve().then(() => DF0)), B0(() => import("./DocumentsTable-DBTAKAkE-DMZCKz6f.js")), B0(() => Promise.resolve().then(() => LW0)), B0(() => import("./FormsTable-3k4qn6RT-CJewfopP.js")), B0(() => Promise.resolve().then(() => sW0)), B0(() => import("./Observations-BQ_tgOPv-C0NcpPcE.js")), B0(
169379
+ B0(() => Promise.resolve().then(() => Hj0)), B0(() => Promise.resolve().then(() => Yj0)), B0(() => Promise.resolve().then(() => LF0)), B0(() => Promise.resolve().then(() => DF0)), B0(() => import("./DocumentsTable-BFpvq1kQ-lgy-lCMA.js")), B0(() => Promise.resolve().then(() => LW0)), B0(() => import("./FormsTable-BmlIPu2T-5-nQdIcf.js")), B0(() => Promise.resolve().then(() => sW0)), B0(() => import("./Observations-CsCQ1ADc-DvVG_5P2.js")), B0(
169380
169380
  () => Promise.resolve().then(() => ZW0)
169381
169381
  ), B0(
169382
169382
  () => Promise.resolve().then(() => _U0)
@@ -171312,7 +171312,7 @@ var IY0 = (t, e = !1) => {
171312
171312
  const e = KFe(() => {
171313
171313
  const r = this, [o] = this.#n, [a] = this.#o, [c] = this.#a, [l] = this.#c, [i] = this.#p, [s] = this.#t;
171314
171314
  let d;
171315
- return this.#l ? d = this.#l : (d = UFe(() => import("./LNWAZHJI-BQmm70CH.js")), this.#l = d), pqe(this.#u, this.#r), FFe(d, qFe({
171315
+ return this.#l ? d = this.#l : (d = UFe(() => import("./LNWAZHJI-CO2Oubi0.js")), this.#l = d), pqe(this.#u, this.#r), FFe(d, qFe({
171316
171316
  get queryFlavor() {
171317
171317
  return r.#d;
171318
171318
  },
@@ -171410,7 +171410,7 @@ var IY0 = (t, e = !1) => {
171410
171410
  const e = KFe(() => {
171411
171411
  const r = this, [o] = this.#n, [a] = this.#o, [c] = this.#a, [l] = this.#c, [i] = this.#p, [s] = this.#t, [d] = this.#l;
171412
171412
  let h;
171413
- return this.#i ? h = this.#i : (h = UFe(() => import("./MWZ6AO7Z-A8EH0yQn.js")), this.#i = h), pqe(this.#u, this.#r), FFe(h, qFe({
171413
+ return this.#i ? h = this.#i : (h = UFe(() => import("./MWZ6AO7Z-Ble7slKn.js")), this.#i = h), pqe(this.#u, this.#r), FFe(h, qFe({
171414
171414
  get queryFlavor() {
171415
171415
  return r.#d;
171416
171416
  },
@@ -171540,7 +171540,7 @@ const qG0 = {
171540
171540
  }
171541
171541
  }
171542
171542
  }, UG0 = "home", UY0 = "/bahmni/home/index.html#/login", WY0 = "/bahmni/home/index.html#/changePassword", KY0 = 6, WG0 = B0(
171543
- () => import("./index-BkPxNQ3m.js").then((t) => ({
171543
+ () => import("./index-KjCVcQL5.js").then((t) => ({
171544
171544
  default: t.HomePage
171545
171545
  }))
171546
171546
  ), KG0 = [
@@ -1,5 +1,5 @@
1
1
  import { jsxs as Ne, jsx as ne, Fragment as Xi } from "react/jsx-runtime";
2
- import { a as ot, d as Qi, f as Ji, g as ec, i as tc, o as rc, v as nc, H as oc, k as hi, l as ac, p as lc, h as ic, s as cc, x as sc, y as fc, A as pc, D as hc, G as uc } from "./index-W2Qaoflk.js";
2
+ import { a as ot, d as Qi, f as Ji, g as ec, i as tc, o as rc, v as nc, H as oc, k as hi, l as ac, p as lc, h as ic, s as cc, x as sc, y as fc, A as pc, D as hc, G as uc } from "./index-CGESSG2i.js";
3
3
  import * as X from "react";
4
4
  import r, { createContext as at, useContext as $e, Children as q1, useState as pe, useLayoutEffect as V1, useEffect as ie, useMemo as lt, useCallback as Me, useRef as oe, forwardRef as y1, useReducer as dc, cloneElement as G1, isValidElement as wc } from "react";
5
5
  import { useQuery as mc } from "@tanstack/react-query";
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { aJ as a } from "./index-W2Qaoflk.js";
1
+ import { aJ as a } from "./index-CGESSG2i.js";
2
2
  export {
3
3
  a as HomeApp
4
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bahmni/home-app",
3
- "version": "0.0.1-dev.281",
3
+ "version": "0.0.1-dev.282",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",