@bahmni/appointments-app 0.0.1-dev.185 → 0.0.1-dev.187

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.
Files changed (42) hide show
  1. package/dist/App.d.ts.map +1 -1
  2. package/dist/{DocumentsTable-8I-Vd16r-D7OejRTq.js → DocumentsTable-DoINW90B-D2G4cySo.js} +2189 -2078
  3. package/dist/{FormsTable-BolXVuK_-BgiYYu8o.js → FormsTable-BFC5-_VV-CWTW1cuR.js} +89 -89
  4. package/dist/{LNWAZHJI-DtGAaLKa.js → LNWAZHJI-Bqw-U-zN.js} +2 -2
  5. package/dist/{MWZ6AO7Z-CKJz0pD6.js → MWZ6AO7Z-Dy00P9Ky.js} +2 -2
  6. package/dist/Observations-7ryo-dcA-C1usSYDg.js +170 -0
  7. package/dist/{YPM2AS64-CNFAfFEV.js → YPM2AS64-BjKcrUp9.js} +138 -138
  8. package/dist/constants/app.d.ts +1 -0
  9. package/dist/constants/app.d.ts.map +1 -1
  10. package/dist/{index-Dxc52lRE.js → index-BcyBWCkX.js} +49953 -63464
  11. package/dist/index-C8plxqhB.js +94 -0
  12. package/dist/index.css +1 -0
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +1 -1
  15. package/dist/locales/locale_en.json +17 -1
  16. package/dist/locales/locale_es.json +17 -1
  17. package/dist/pages/admin/allServices/__mocks__/mocks.d.ts +3 -0
  18. package/dist/pages/admin/allServices/__mocks__/mocks.d.ts.map +1 -0
  19. package/dist/pages/admin/allServices/constants.d.ts +2 -0
  20. package/dist/pages/admin/allServices/constants.d.ts.map +1 -0
  21. package/dist/pages/admin/allServices/index.d.ts +4 -0
  22. package/dist/pages/admin/allServices/index.d.ts.map +1 -0
  23. package/dist/pages/admin/allServices/model.d.ts +10 -0
  24. package/dist/pages/admin/allServices/model.d.ts.map +1 -0
  25. package/dist/pages/admin/allServices/utils.d.ts +9 -0
  26. package/dist/pages/admin/allServices/utils.d.ts.map +1 -0
  27. package/dist/providers/appointmentsConfig/constants.d.ts +2 -0
  28. package/dist/providers/appointmentsConfig/constants.d.ts.map +1 -0
  29. package/dist/providers/appointmentsConfig/context.d.ts +3 -0
  30. package/dist/providers/appointmentsConfig/context.d.ts.map +1 -0
  31. package/dist/providers/appointmentsConfig/hook.d.ts +3 -0
  32. package/dist/providers/appointmentsConfig/hook.d.ts.map +1 -0
  33. package/dist/providers/appointmentsConfig/index.d.ts +5 -0
  34. package/dist/providers/appointmentsConfig/index.d.ts.map +1 -0
  35. package/dist/providers/appointmentsConfig/models.d.ts +9 -0
  36. package/dist/providers/appointmentsConfig/models.d.ts.map +1 -0
  37. package/dist/providers/appointmentsConfig/provider.d.ts +4 -0
  38. package/dist/providers/appointmentsConfig/provider.d.ts.map +1 -0
  39. package/dist/providers/appointmentsConfig/schema.json.d.ts +19 -0
  40. package/dist/routes/index.d.ts.map +1 -1
  41. package/package.json +1 -1
  42. package/dist/Observations-D6R8bXEi-DqXuo3Nk.js +0 -369
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AAEvB,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,OAAO,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,wBAAwB,CAAC;AAChC,OAAO,eAAe,CAAC;AAEvB,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,OAAO,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { aN as t } from "./index-Dxc52lRE.js";
1
+ import { aH as t } from "./index-BcyBWCkX.js";
2
2
  export {
3
3
  t as AppointmentsApp
4
4
  };
@@ -1 +1,17 @@
1
- {}
1
+ {
2
+ "ADMIN_ALL_SERVICES_COLUMN_ACTIONS": "Actions",
3
+ "ADMIN_ALL_SERVICES_COLUMN_DESCRIPTION": "Description",
4
+ "ADMIN_ALL_SERVICES_COLUMN_DURATION_MINS": "Duration (mins)",
5
+ "ADMIN_ALL_SERVICES_COLUMN_LOCATION": "Location",
6
+ "ADMIN_ALL_SERVICES_COLUMN_NAME": "Service Name",
7
+ "ADMIN_ALL_SERVICES_COLUMN_SPECIALITY": "Speciality",
8
+ "ADMIN_ALL_SERVICES_EMPTY_MESSAGE": "No services found.",
9
+ "ADMIN_ALL_SERVICES_ERROR_MESSAGE": "Failed to load services. Please try again.",
10
+ "ADMIN_ALL_SERVICES_TITLE": "Services",
11
+ "BREADCRUMB_ADMIN": "Admin",
12
+ "BREADCRUMB_HOME": "Home",
13
+ "CONFIG_ERROR_SCHEMA_VALIDATION_FAILED": "Configuration does not match required schema",
14
+ "CONFIG_ERROR_VALIDATION_FAILED": "Configuration validation failed",
15
+ "ERROR_CONFIG_GENERIC_MESSAGE": "Unable to load {{config}}. Please try refreshing the page.",
16
+ "ERROR_CONFIG_TITLE": "{{config}} Error"
17
+ }
@@ -1 +1,17 @@
1
- {}
1
+ {
2
+ "ADMIN_ALL_SERVICES_COLUMN_ACTIONS": "Acciones",
3
+ "ADMIN_ALL_SERVICES_COLUMN_DESCRIPTION": "Descripción",
4
+ "ADMIN_ALL_SERVICES_COLUMN_DURATION_MINS": "Duración (mins)",
5
+ "ADMIN_ALL_SERVICES_COLUMN_LOCATION": "Ubicación",
6
+ "ADMIN_ALL_SERVICES_COLUMN_NAME": "Nombre del servicio",
7
+ "ADMIN_ALL_SERVICES_COLUMN_SPECIALITY": "Especialidad",
8
+ "ADMIN_ALL_SERVICES_EMPTY_MESSAGE": "No se encontraron servicios.",
9
+ "ADMIN_ALL_SERVICES_ERROR_MESSAGE": "Error al cargar los servicios. Por favor, inténtelo de nuevo.",
10
+ "ADMIN_ALL_SERVICES_TITLE": "Servicios",
11
+ "BREADCRUMB_ADMIN": "Admin",
12
+ "BREADCRUMB_HOME": "Inicio",
13
+ "CONFIG_ERROR_SCHEMA_VALIDATION_FAILED": "La configuración no coincide con el esquema requerido",
14
+ "CONFIG_ERROR_VALIDATION_FAILED": "Error de validación de configuración",
15
+ "ERROR_CONFIG_GENERIC_MESSAGE": "No se puede cargar {{config}}. Por favor, intente actualizar la página.",
16
+ "ERROR_CONFIG_TITLE": "Error de {{config}}"
17
+ }
@@ -0,0 +1,3 @@
1
+ import { AppointmentService } from '@bahmni/services';
2
+ export declare const mockAppointmentServices: AppointmentService[];
3
+ //# sourceMappingURL=mocks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mocks.d.ts","sourceRoot":"","sources":["../../../../../src/pages/admin/allServices/__mocks__/mocks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD,eAAO,MAAM,uBAAuB,EAAE,kBAAkB,EAyDvD,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const KNOWN_FIELDS: string[];
2
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/pages/admin/allServices/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,EAAE,MAAM,EAMhC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { default as React } from 'react';
2
+ declare const AllServicesPage: React.FC;
3
+ export default AllServicesPage;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/pages/admin/allServices/index.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAWvC,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAiE5B,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -0,0 +1,10 @@
1
+ export interface AppointmentServiceViewModel {
2
+ id: string;
3
+ name: string;
4
+ location: string | null;
5
+ speciality: string | null;
6
+ durationMins: number | null | undefined;
7
+ description: string | null;
8
+ attributes: Record<string, string | null>;
9
+ }
10
+ //# sourceMappingURL=model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../../src/pages/admin/allServices/model.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,2BAA2B;IAC1C,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,YAAY,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACxC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC;CAC3C"}
@@ -0,0 +1,9 @@
1
+ import { AppointmentService } from '@bahmni/services';
2
+ import { AppointmentServiceViewModel } from './model';
3
+ export declare function extractServiceAttributeNames(fields: string[]): string[];
4
+ export declare function createServiceHeaders(fields: string[], t: (key: string) => string): Array<{
5
+ key: string;
6
+ header: string;
7
+ }>;
8
+ export declare function createAppointmentServiceViewModels(services: AppointmentService[], attributeNames: string[]): AppointmentServiceViewModel[];
9
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/pages/admin/allServices/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAEnB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAEtD,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAEvE;AAED,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,EAAE,EAChB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,GACzB,KAAK,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAaxC;AAED,wBAAgB,kCAAkC,CAChD,QAAQ,EAAE,kBAAkB,EAAE,EAC9B,cAAc,EAAE,MAAM,EAAE,GACvB,2BAA2B,EAAE,CAgB/B"}
@@ -0,0 +1,2 @@
1
+ export declare const APPOINTMENTS_CONFIG_URL: string;
2
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/providers/appointmentsConfig/constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,uBAAuB,QACW,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { AppointmentsConfigContextType } from './models';
2
+ export declare const AppointmentsConfigContext: import('react').Context<AppointmentsConfigContextType | undefined>;
3
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/providers/appointmentsConfig/context.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,6BAA6B,EAAE,MAAM,UAAU,CAAC;AAEzD,eAAO,MAAM,yBAAyB,oEAE1B,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { AppointmentsConfigContextType } from './models';
2
+ export declare const useAppointmentsConfig: () => AppointmentsConfigContextType;
3
+ //# sourceMappingURL=hook.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hook.d.ts","sourceRoot":"","sources":["../../../src/providers/appointmentsConfig/hook.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,6BAA6B,EAAE,MAAM,UAAU,CAAC;AAEzD,eAAO,MAAM,qBAAqB,qCAK/B,CAAC"}
@@ -0,0 +1,5 @@
1
+ export { AppointmentsConfigProvider } from './provider';
2
+ export { type AppointmentsConfigContextType } from './models';
3
+ export { AppointmentsConfigContext } from './context';
4
+ export { useAppointmentsConfig } from './hook';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/appointmentsConfig/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,KAAK,6BAA6B,EAAE,MAAM,UAAU,CAAC;AAC9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAC"}
@@ -0,0 +1,9 @@
1
+ export interface AppointmentsConfig {
2
+ serviceTableFields: string[];
3
+ }
4
+ export interface AppointmentsConfigContextType {
5
+ appointmentsConfig: AppointmentsConfig | null | undefined;
6
+ isLoading: boolean;
7
+ error: Error | null;
8
+ }
9
+ //# sourceMappingURL=models.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../src/providers/appointmentsConfig/models.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,kBAAkB;IACjC,kBAAkB,EAAE,MAAM,EAAE,CAAC;CAC9B;AAED,MAAM,WAAW,6BAA6B;IAC5C,kBAAkB,EAAE,kBAAkB,GAAG,IAAI,GAAG,SAAS,CAAC;IAC1D,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACrB"}
@@ -0,0 +1,4 @@
1
+ export declare const AppointmentsConfigProvider: import('react').FC<{
2
+ children: import('react').ReactNode;
3
+ }>;
4
+ //# sourceMappingURL=provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../src/providers/appointmentsConfig/provider.tsx"],"names":[],"mappings":"AAOA,eAAO,MAAM,0BAA0B;;EAmBrC,CAAC"}
@@ -0,0 +1,19 @@
1
+ declare const _default: {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "title": "Appointments App Configuration Schema",
4
+ "description": "Schema for global appointments app configuration",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "properties": {
8
+ "serviceTableFields": {
9
+ "type": "array",
10
+ "description": "List of fields to display in the service table",
11
+ "items": {
12
+ "type": "string"
13
+ }
14
+ }
15
+ }
16
+ }
17
+ ;
18
+
19
+ export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/routes/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAe,MAAM,SAAS,CAAC;AAM9C,eAAO,MAAM,MAAM,EAAE,MAMpB,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,cAAc,MAAM,8CAOhD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/routes/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAe,MAAM,SAAS,CAAC;AAY9C,eAAO,MAAM,MAAM,EAAE,MAWpB,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,cAAc,MAAM,8CAOhD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bahmni/appointments-app",
3
- "version": "0.0.1-dev.185",
3
+ "version": "0.0.1-dev.187",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -1,369 +0,0 @@
1
- import { jsxs as D, jsx as v } from "react/jsx-runtime";
2
- import { o as U, r as _, s as P, Q as L, c as V, t as K, v as G, w as j, x as W, z as J, A as X, B as T, D as N, E as Y, H as Z, M as ee, p as se, u as M, I as te, a as re, S as ie, e as ne, J as oe, L as ae, R as ue, b as ce, N as le, W as k, X as he, h as de, Z as pe, y as be, k as fe, l as ye, _ as ve } from "./index-Dxc52lRE.js";
3
- import * as E from "react";
4
- import { useRef as me, useEffect as I, useMemo as C } from "react";
5
- function $(e, s) {
6
- const t = new Set(s);
7
- return e.filter((i) => !t.has(i));
8
- }
9
- function Re(e, s, t) {
10
- const i = e.slice(0);
11
- return i[s] = t, i;
12
- }
13
- var Oe = class extends U {
14
- #r;
15
- #e;
16
- #i;
17
- #n;
18
- #s;
19
- #t;
20
- #o;
21
- #a;
22
- #u = [];
23
- constructor(e, s, t) {
24
- super(), this.#r = e, this.#n = t, this.#i = [], this.#s = [], this.#e = [], this.setQueries(s);
25
- }
26
- onSubscribe() {
27
- this.listeners.size === 1 && this.#s.forEach((e) => {
28
- e.subscribe((s) => {
29
- this.#d(e, s);
30
- });
31
- });
32
- }
33
- onUnsubscribe() {
34
- this.listeners.size || this.destroy();
35
- }
36
- destroy() {
37
- this.listeners = /* @__PURE__ */ new Set(), this.#s.forEach((e) => {
38
- e.destroy();
39
- });
40
- }
41
- setQueries(e, s) {
42
- if (this.#i = e, this.#n = s, process.env.NODE_ENV !== "production") {
43
- const t = e.map(
44
- (i) => this.#r.defaultQueryOptions(i).queryHash
45
- );
46
- new Set(t).size !== t.length && console.warn(
47
- "[QueriesObserver]: Duplicate Queries found. This might result in unexpected behavior."
48
- );
49
- }
50
- _.batch(() => {
51
- const t = this.#s, i = this.#h(this.#i);
52
- this.#u = i, i.forEach(
53
- (n) => n.observer.setOptions(n.defaultedQueryOptions)
54
- );
55
- const r = i.map((n) => n.observer), o = r.map(
56
- (n) => n.getCurrentResult()
57
- ), a = r.some(
58
- (n, u) => n !== t[u]
59
- );
60
- t.length === r.length && !a || (this.#s = r, this.#e = o, this.hasListeners() && ($(t, r).forEach((n) => {
61
- n.destroy();
62
- }), $(r, t).forEach((n) => {
63
- n.subscribe((u) => {
64
- this.#d(n, u);
65
- });
66
- }), this.#p()));
67
- });
68
- }
69
- getCurrentResult() {
70
- return this.#e;
71
- }
72
- getQueries() {
73
- return this.#s.map((e) => e.getCurrentQuery());
74
- }
75
- getObservers() {
76
- return this.#s;
77
- }
78
- getOptimisticResult(e, s) {
79
- const t = this.#h(e), i = t.map(
80
- (r) => r.observer.getOptimisticResult(r.defaultedQueryOptions)
81
- );
82
- return [
83
- i,
84
- (r) => this.#l(r ?? i, s),
85
- () => this.#c(i, t)
86
- ];
87
- }
88
- #c(e, s) {
89
- return s.map((t, i) => {
90
- const r = e[i];
91
- return t.defaultedQueryOptions.notifyOnChangeProps ? r : t.observer.trackResult(r, (o) => {
92
- s.forEach((a) => {
93
- a.observer.trackProp(o);
94
- });
95
- });
96
- });
97
- }
98
- #l(e, s) {
99
- return s ? ((!this.#t || this.#e !== this.#a || s !== this.#o) && (this.#o = s, this.#a = this.#e, this.#t = P(
100
- this.#t,
101
- s(e)
102
- )), this.#t) : e;
103
- }
104
- #h(e) {
105
- const s = new Map(
106
- this.#s.map((i) => [i.options.queryHash, i])
107
- ), t = [];
108
- return e.forEach((i) => {
109
- const r = this.#r.defaultQueryOptions(i), o = s.get(r.queryHash);
110
- o ? t.push({
111
- defaultedQueryOptions: r,
112
- observer: o
113
- }) : t.push({
114
- defaultedQueryOptions: r,
115
- observer: new L(this.#r, r)
116
- });
117
- }), t;
118
- }
119
- #d(e, s) {
120
- const t = this.#s.indexOf(e);
121
- t !== -1 && (this.#e = Re(this.#e, t, s), this.#p());
122
- }
123
- #p() {
124
- if (this.hasListeners()) {
125
- const e = this.#t, s = this.#c(this.#e, this.#u), t = this.#l(s, this.#n?.combine);
126
- e !== t && _.batch(() => {
127
- this.listeners.forEach((i) => {
128
- i(this.#e);
129
- });
130
- });
131
- }
132
- }
133
- };
134
- function ge({
135
- queries: e,
136
- ...s
137
- }, t) {
138
- const i = V(t), r = K(), o = G(), a = E.useMemo(
139
- () => e.map((l) => {
140
- const d = i.defaultQueryOptions(
141
- l
142
- );
143
- return d._optimisticResults = r ? "isRestoring" : "optimistic", d;
144
- }),
145
- [e, i, r]
146
- );
147
- a.forEach((l) => {
148
- j(l), W(l, o);
149
- }), J(o);
150
- const [n] = E.useState(
151
- () => new Oe(
152
- i,
153
- a,
154
- s
155
- )
156
- ), [u, p, b] = n.getOptimisticResult(
157
- a,
158
- s.combine
159
- ), f = !r && s.subscribed !== !1;
160
- E.useSyncExternalStore(
161
- E.useCallback(
162
- (l) => f ? n.subscribe(_.batchCalls(l)) : X,
163
- [n, f]
164
- ),
165
- () => n.getCurrentResult(),
166
- () => n.getCurrentResult()
167
- ), E.useEffect(() => {
168
- n.setQueries(
169
- a,
170
- s
171
- );
172
- }, [a, s, n]);
173
- const S = u.some(
174
- (l, d) => T(a[d], l)
175
- ) ? u.flatMap((l, d) => {
176
- const h = a[d];
177
- if (h) {
178
- const O = new L(i, h);
179
- if (T(h, l))
180
- return N(h, O, o);
181
- Y(l, r) && N(h, O, o);
182
- }
183
- return [];
184
- }) : [];
185
- if (S.length > 0)
186
- throw Promise.all(S);
187
- const R = u.find(
188
- (l, d) => {
189
- const h = a[d];
190
- return h && Z({
191
- result: l,
192
- errorResetBoundary: o,
193
- throwOnError: h.throwOnError,
194
- query: i.getQueryCache().get(h.queryHash),
195
- suspense: h.suspense
196
- });
197
- }
198
- );
199
- if (R?.error)
200
- throw R.error;
201
- return p(b());
202
- }
203
- const z = (e, s, t, i, r) => {
204
- const o = he(e, s), a = o.value, n = de(a);
205
- let u = a;
206
- n === "Image" && (u = /* @__PURE__ */ v(be, { imageSrc: a, alt: a, id: `${a}-img` })), n === "Video" && (u = /* @__PURE__ */ v(fe, { id: `${a}-video`, videoSrc: a })), n === "PDF" && (u = /* @__PURE__ */ v(ye, { id: `${a}-pdf`, src: a }));
207
- const p = r("OBSERVATIONS_RECORDED_BY", {
208
- provider: o.provider
209
- }), b = e.display, f = e.observationValue?.isAbnormal ? "abnormal-obs" : "obs", y = i ? `${i}-${f}-${b}-${t}-${s}` : `${f}-${b}-${t}-${s}`;
210
- return /* @__PURE__ */ v(
211
- pe,
212
- {
213
- header: o.header,
214
- value: u,
215
- info: p,
216
- id: y,
217
- testId: y,
218
- ariaLabel: y
219
- },
220
- `obs-${e.id}`
221
- );
222
- }, Ee = (e, s, t, i, r, o) => /* @__PURE__ */ v(
223
- k,
224
- {
225
- title: e.display,
226
- id: `grouped-obs-${e.display}-${i}`,
227
- open: t,
228
- children: e.members?.map(
229
- (a, n) => z(a, n, r, o, s)
230
- )
231
- },
232
- `grouped-obs-${e.id}`
233
- ), Se = ({
234
- groupedData: e,
235
- title: s = ""
236
- }) => {
237
- const { t } = M(), i = (r, o, a) => {
238
- const n = le(r.encounterDetails, t);
239
- return /* @__PURE__ */ D(
240
- k,
241
- {
242
- title: n,
243
- id: `encounter-${r.encounterId}`,
244
- open: o,
245
- children: [
246
- r.observations.map(
247
- (u, p) => z(u, p, a, s, t)
248
- ),
249
- r.groupedObservations.map(
250
- (u, p) => Ee(
251
- u,
252
- t,
253
- o,
254
- p,
255
- a,
256
- s
257
- )
258
- )
259
- ]
260
- },
261
- `encounter-${r.encounterId}`
262
- );
263
- };
264
- return /* @__PURE__ */ v(
265
- "div",
266
- {
267
- id: "obs-by-encounter",
268
- "data-testid": "obs-by-encounter-test-id",
269
- "aria-label": "obs-by-encounter-aria-label",
270
- children: e.map(
271
- (r, o) => i(r, o === 0, o)
272
- )
273
- }
274
- );
275
- }, Qe = "_observations_kfbhq_1", Ce = "_title_kfbhq_12", q = {
276
- observations: Qe,
277
- title: Ce
278
- }, _e = (e) => ["conceptUuid", e], we = (e, s) => ["observations", e, ...s], $e = ({ config: e }) => {
279
- const s = e, { conceptNames: t = [], conceptUuid: i = [] } = s, r = me(/* @__PURE__ */ new Set()), o = ee(), { addNotification: a } = se(), { t: n } = M(), u = ge({
280
- queries: t.map((c) => ({
281
- queryKey: _e(c),
282
- queryFn: () => te(c),
283
- enabled: !!c
284
- }))
285
- });
286
- I(() => {
287
- u.forEach((c, m) => {
288
- if (c.isError && !r.current.has(m)) {
289
- const H = t[m];
290
- a({
291
- title: n("ERROR_DEFAULT_TITLE"),
292
- message: n("ERROR_FETCHING_CONCEPT", { conceptName: H }),
293
- type: "error"
294
- }), r.current.add(m);
295
- } else c.isError || r.current.delete(m);
296
- });
297
- }, [u, t]);
298
- const p = C(() => u.map((c) => c.data?.uuid).filter((c) => !!c), [u]), b = C(() => [.../* @__PURE__ */ new Set([...p, ...i])], [p, i]), f = C(() => t.length === 0 ? !0 : u.every((c) => !c.isLoading), [u, t.length]), {
299
- data: y,
300
- isLoading: S,
301
- isError: R,
302
- refetch: l
303
- } = re({
304
- queryKey: we(o, b),
305
- queryFn: () => ve(o, b),
306
- enabled: !!o && b.length > 0 && f
307
- });
308
- ie(
309
- (c) => {
310
- c.patientUUID === o && c.updatedConcepts.size > 0 && [...c.updatedConcepts.keys()].some(
311
- (m) => b.includes(m)
312
- ) && l();
313
- },
314
- [o, l]
315
- ), I(() => {
316
- R && a({
317
- title: n("ERROR_DEFAULT_TITLE"),
318
- message: n("ERROR_FETCHING_OBSERVATIONS"),
319
- type: "error"
320
- });
321
- }, [R]);
322
- const d = C(() => {
323
- if (!y) return [];
324
- const c = ne(y), m = oe(c);
325
- return ae(m);
326
- }, [y]), h = [
327
- { key: "name", header: "name" },
328
- { key: "value", header: "value" },
329
- { key: "form", header: "form" }
330
- ], O = S || !f, w = R && f, A = (!y || y.entry?.length === 0 || b.length === 0) && f, B = w ? n("ERROR_FETCHING_OBSERVATIONS") : null, x = A ? n("NO_OBSERVATIONS_FOUND") : void 0, F = d.length > 0 && !O && !w, Q = s.titleTranslationKey, g = Q ? n(Q) : "";
331
- return /* @__PURE__ */ D(
332
- "div",
333
- {
334
- id: "observations",
335
- "data-testid": Q ? `observations-${g}` : "observations",
336
- "aria-label": "observations-aria-label",
337
- className: q.observations,
338
- children: [
339
- /* @__PURE__ */ v(
340
- ue,
341
- {
342
- id: "observations-title",
343
- testId: Q ? `observations-title-${g}` : "observations-title",
344
- title: g,
345
- className: q.title,
346
- children: /* @__PURE__ */ v("p", { children: g })
347
- }
348
- ),
349
- F ? /* @__PURE__ */ v(Se, { groupedData: d, title: g }) : /* @__PURE__ */ v(
350
- ce,
351
- {
352
- headers: h,
353
- rows: [],
354
- ariaLabel: n("OBSERVATIONS"),
355
- loading: O,
356
- errorStateMessage: B,
357
- emptyStateMessage: x,
358
- dataTestId: "observations-table"
359
- }
360
- )
361
- ]
362
- }
363
- );
364
- };
365
- export {
366
- _e as conceptUuidQueryKeys,
367
- $e as default,
368
- we as observationsQueryKeys
369
- };