@kenyaemr/esm-patient-flags-app 3.1.1-pre.16
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.
- package/.turbo/turbo-build.log +36 -0
- package/LICENSE.md +401 -0
- package/dist/150.js +1 -0
- package/dist/236.js +1 -0
- package/dist/455.js +1 -0
- package/dist/574.js +1 -0
- package/dist/654.js +2 -0
- package/dist/654.js.LICENSE.txt +20 -0
- package/dist/709.js +1 -0
- package/dist/784.js +2 -0
- package/dist/784.js.LICENSE.txt +9 -0
- package/dist/858.js +2 -0
- package/dist/858.js.LICENSE.txt +1 -0
- package/dist/kenyaemr-esm-core-app.js +1 -0
- package/dist/kenyaemr-esm-core-app.js.buildmanifest.json +262 -0
- package/dist/kenyaemr-esm-core-app.old +1 -0
- package/dist/main.js +1 -0
- package/package.json +48 -0
- package/src/config-schema.ts +1 -0
- package/src/declarations.d.ts +2 -0
- package/src/hooks/usePatientFlags.tsx +21 -0
- package/src/index.ts +34 -0
- package/src/patient-flags/patient-flags.component.tsx +30 -0
- package/src/patient-flags/patient-flags.scss +6 -0
- package/src/patient-flags/patient-flags.test.tsx +24 -0
- package/src/root.component.tsx +8 -0
- package/src/types/index.ts +0 -0
- package/translations/en.json +4 -0
- package/translations/sw.json +1 -0
- package/tsconfig.json +5 -0
- package/webpack.config.js +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! For license information please see openmrs-esm-react-utils.js.LICENSE.txt */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var _kenyaemr_esm_patient_flags_app;(()=>{function b(a){var c=h[a];if(void 0!==c)return c.exports;var d=h[a]={id:a,loaded:!1,exports:{}};return G[a](d,d.exports,b),d.loaded=!0,d.exports}var j,k,q,v,w,x,y,z,A,B,C,D,E,F,G={275:(b,c,d)=>{var f={"./start":()=>d.e(150).then(()=>()=>d(150))},e=(a,b)=>(d.R=b,b=d.o(f,a)?f[a]():Promise.resolve().then(()=>{throw new Error("Module \""+a+"\" does not exist in container.")}),d.R=void 0,b),a=(b,c)=>{if(d.S){var e=d.S["default"];if(e&&e!==b)throw new Error("Container initialization failed as it has already been initialized with a different share scope");return d.S["default"]=b,d.I("default",c)}};d.d(c,{get:()=>e,init:()=>a})}},h={};b.m=G,b.c=h,b.n=a=>{var c=a&&a.__esModule?()=>a.default:()=>a;return b.d(c,{a:c}),c},b.d=(a,c)=>{for(var d in c)b.o(c,d)&&!b.o(a,d)&&Object.defineProperty(a,d,{enumerable:!0,get:c[d]})},b.f={},b.e=a=>Promise.all(Object.keys(b.f).reduce((c,d)=>(b.f[d](a,c),c),[])),b.u=a=>a+".js",b.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(a){if("object"==typeof window)return window}}(),b.o=(a,b)=>Object.prototype.hasOwnProperty.call(a,b),j={},k="@kenyaemr/esm-patient-flags-app:",b.l=(c,e,g)=>{if(j[c])j[c].push(e);else{var h,a;if(void 0!==g)for(var m,n=document.getElementsByTagName("script"),o=0;o<n.length;o++)if(m=n[o],m.getAttribute("src")==c||m.getAttribute("data-webpack")==k+g){h=m;break}h||(a=!0,(h=document.createElement("script")).charset="utf-8",h.timeout=120,b.nc&&h.setAttribute("nonce",b.nc),h.setAttribute("data-webpack",k+g),h.src=c),j[c]=[e];var q=(b,d)=>{h.onerror=h.onload=null,clearTimeout(p);var e=j[c];if(delete j[c],h.parentNode&&h.parentNode.removeChild(h),e&&e.forEach(a=>a(d)),b)return b(d)},p=setTimeout(q.bind(null,void 0,{type:"timeout",target:h}),12e4);h.onerror=q.bind(null,h.onerror),h.onload=q.bind(null,h.onload),a&&document.head.appendChild(h)}},b.r=a=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(a,"__esModule",{value:!0})},b.nmd=a=>(a.paths=[],a.children||(a.children=[]),a),(()=>{b.S={};var c={},d={};b.I=(e,f)=>{f||(f=[]);var g=d[e];if(g||(g=d[e]={}),!(0<=f.indexOf(g))){if(f.push(g),c[e])return c[e];b.o(b.S,e)||(b.S[e]={});var h=b.S[e],i=(b,c,d,e)=>{var f=h[b]=h[b]||{},a=f[c];a&&(a.loaded||(!e==!a.eager?!("@kenyaemr/esm-patient-flags-app">a.from):!e))||(f[c]={get:d,from:"@kenyaemr/esm-patient-flags-app",eager:!!e})},j=[];return"default"===e&&(i("@openmrs/esm-framework","4.0.2-pre.275",()=>Promise.all([b.e(858),b.e(206)]).then(()=>()=>b(858))),i("react-i18next","11.18.6",()=>Promise.all([b.e(709),b.e(206)]).then(()=>()=>b(709))),i("react","18.2.0",()=>b.e(784).then(()=>()=>b(784)))),c[e]=j.length?Promise.all(j).then(()=>c[e]=1):1}}})(),(()=>{var a;b.g.importScripts&&(a=b.g.location+"");var c=b.g.document;if(!a&&c&&(c.currentScript&&(a=c.currentScript.src),!a)){var d=c.getElementsByTagName("script");d.length&&(a=d[d.length-1].src)}if(!a)throw new Error("Automatic publicPath is not supported in this browser");a=a.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),b.p=a})(),q=a=>{var b=a=>a.split(".").map(a=>+a==a?+a:a),c=/^([^-+]+)?(?:-([^+]+))?(?:\+(.+))?$/.exec(a),d=c[1]?b(c[1]):[];return c[2]&&(d.length++,d.push.apply(d,b(c[2]))),c[3]&&(d.push([]),d.push.apply(d,b(c[3]))),d},v=(b,c)=>{b=q(b),c=q(c);for(var d=0;;){if(d>=b.length)return d<c.length&&"u"!=(typeof c[d])[0];var f=b[d],a=(typeof f)[0];if(d>=c.length)return"u"==a;var g=c[d],h=(typeof g)[0];if(a!=h)return"o"==a&&"n"==h||"s"==h||"u"==a;if("o"!=a&&"u"!=a&&f!=g)return f<g;d++}},w=a=>{function b(){return g.pop().replace(/^\((.+)\)$/,"$1")}var c=a[0],d="";if(1===a.length)return"*";if(c+.5){d+=0==c?">=":-1==c?"<":1==c?"^":2==c?"~":0<c?"=":"!=";for(var e=1,f=1;f<a.length;f++)e--,d+="u"==(typeof(h=a[f]))[0]?"-":(0<e?".":"")+(e=2,h);return d}var g=[];for(f=1;f<a.length;f++){var h=a[f];g.push(0===h?"not("+b()+")":1===h?"("+b()+" || "+b()+")":2===h?g.pop()+" "+g.pop():w(h))}return b()},x=(b,e)=>{if(0 in b){e=q(e);var g=b[0],j=0>g;j&&(g=-g-1);for(var a=0,k=1,m=!0;;k++,a++){var o,t,v=k<b.length?(typeof b[k])[0]:"";if(a>=e.length||"o"==(t=(typeof(o=e[a]))[0]))return!m||("u"==v?k>g&&!j:""==v!=j);if("u"==t){if(!m||"u"!=v)return!1;}else if(!m)"s"!=v&&"n"!=v&&(m=!1,k--);else if(v==t){if(!(k<=g)){if(j?o>b[k]:o<b[k])return!1;o!=b[k]&&(m=!1)}else if(o!=b[k])return!1;}else if("s"!=v&&"n"!=v){if(j||k<=g)return!1;m=!1,k--}else{if(k<=g||t<v!=j)return!1;m=!1}}}var p=[],d=p.pop.bind(p);for(a=1;a<b.length;a++){var c=b[a];p.push(1==c?d()|d():2==c?d()&d():c?x(c,e):!d())}return!!d()},y=(a,b)=>{var c=a[b];return Object.keys(c).reduce((a,b)=>a&&(c[a].loaded||!v(a,b))?a:b,0)},z=(a,b,c,d)=>"Unsatisfied version "+c+" from "+(c&&a[b][c].from)+" of shared singleton module "+b+" (required "+w(d)+")",A=(b,c,d,e)=>{var f=y(b,d);return x(e,f)||"undefined"!=typeof console&&console.warn&&console.warn(z(b,d,f,e)),B(b[d][f])},B=a=>(a.loaded=1,a.get()),C=(c=>function(d,e,f,g){var a=b.I(d);return a&&a.then?a.then(c.bind(c,d,b.S[d],e,f,g)):c(0,b.S[d],e,f,g)})((c,d,e,f,g)=>d&&b.o(d,e)?A(d,0,e,f):g()),D={},E={206:()=>C("default","react",[1,18,1,0],()=>b.e(784).then(()=>()=>b(784))),906:()=>C("default","@openmrs/esm-framework",[1,4],()=>Promise.all([b.e(858),b.e(206)]).then(()=>()=>b(858))),924:()=>C("default","react-i18next",[1,11],()=>b.e(709).then(()=>()=>b(709)))},F={150:[906],206:[206],455:[924]},b.f.consumes=(a,c)=>{b.o(F,a)&&F[a].forEach(d=>{if(b.o(D,d))return c.push(D[d]);var e=a=>{D[d]=0,b.m[d]=c=>{delete b.c[d],c.exports=a()}},f=a=>{delete D[d],b.m[d]=()=>{throw delete b.c[d],a}};try{var g=E[d]();g.then?c.push(D[d]=g.then(e).catch(f)):e(g)}catch(a){f(a)}})},(()=>{var c={158:0};b.f.j=(d,e)=>{var f=b.o(c,d)?c[d]:void 0;if(0!==f)if(f)e.push(f[2]);else if(206!=d){var g=new Promise((b,e)=>f=c[d]=[b,e]);e.push(f[2]=g);var a=b.p+b.u(d),h=new Error;b.l(a,e=>{if(b.o(c,d)&&(0!==(f=c[d])&&(c[d]=void 0),f)){var g=e&&("load"===e.type?"missing":e.type),a=e&&e.target&&e.target.src;h.message="Loading chunk "+d+" failed.\n("+g+": "+a+")",h.name="ChunkLoadError",h.type=g,h.request=a,f[1](h)}},"chunk-"+d,d)}else c[d]=0};var a=(d,e)=>{var f,g,[h,j,i]=e,k=0;if(h.some(a=>0!==c[a])){for(f in j)b.o(j,f)&&(b.m[f]=j[f]);i&&i(b)}for(d&&d(e);k<h.length;k++)g=h[k],b.o(c,g)&&c[g]&&c[g][0](),c[g]=0},d=self.webpackChunk_kenyaemr_esm_patient_flags_app=self.webpackChunk_kenyaemr_esm_patient_flags_app||[];d.forEach(a.bind(null,0)),d.push=a.bind(null,d.push.bind(d))})(),b.nc=void 0;var m=b(275);_kenyaemr_esm_patient_flags_app=m})();
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
{
|
|
2
|
+
"chunks": [
|
|
3
|
+
{
|
|
4
|
+
"rendered": true,
|
|
5
|
+
"initial": false,
|
|
6
|
+
"entry": false,
|
|
7
|
+
"recorded": false,
|
|
8
|
+
"size": 1215,
|
|
9
|
+
"sizes": {
|
|
10
|
+
"consume-shared": 42,
|
|
11
|
+
"javascript": 1173
|
|
12
|
+
},
|
|
13
|
+
"names": [],
|
|
14
|
+
"idHints": [],
|
|
15
|
+
"runtime": [
|
|
16
|
+
"@kenyaemr/esm-patient-flags-app"
|
|
17
|
+
],
|
|
18
|
+
"files": [
|
|
19
|
+
"150.js"
|
|
20
|
+
],
|
|
21
|
+
"auxiliaryFiles": [],
|
|
22
|
+
"hash": "84a96b914ad27c86a6de",
|
|
23
|
+
"childrenByOrder": {}
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"rendered": true,
|
|
27
|
+
"initial": true,
|
|
28
|
+
"entry": true,
|
|
29
|
+
"recorded": false,
|
|
30
|
+
"size": 19072,
|
|
31
|
+
"sizes": {
|
|
32
|
+
"javascript": 42,
|
|
33
|
+
"share-init": 126,
|
|
34
|
+
"runtime": 18904
|
|
35
|
+
},
|
|
36
|
+
"names": [
|
|
37
|
+
"@kenyaemr/esm-patient-flags-app"
|
|
38
|
+
],
|
|
39
|
+
"idHints": [],
|
|
40
|
+
"runtime": [
|
|
41
|
+
"@kenyaemr/esm-patient-flags-app"
|
|
42
|
+
],
|
|
43
|
+
"files": [
|
|
44
|
+
"kenyaemr-esm-core-app.js"
|
|
45
|
+
],
|
|
46
|
+
"auxiliaryFiles": [],
|
|
47
|
+
"hash": "ed4400f23aed4a7b001f",
|
|
48
|
+
"childrenByOrder": {}
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"rendered": true,
|
|
52
|
+
"initial": true,
|
|
53
|
+
"entry": true,
|
|
54
|
+
"recorded": false,
|
|
55
|
+
"size": 20612,
|
|
56
|
+
"sizes": {
|
|
57
|
+
"consume-shared": 42,
|
|
58
|
+
"javascript": 1173,
|
|
59
|
+
"share-init": 126,
|
|
60
|
+
"runtime": 19271
|
|
61
|
+
},
|
|
62
|
+
"names": [
|
|
63
|
+
"main"
|
|
64
|
+
],
|
|
65
|
+
"idHints": [],
|
|
66
|
+
"runtime": [
|
|
67
|
+
"main"
|
|
68
|
+
],
|
|
69
|
+
"files": [
|
|
70
|
+
"main.js"
|
|
71
|
+
],
|
|
72
|
+
"auxiliaryFiles": [],
|
|
73
|
+
"hash": "ac23196e2d7afa673f4b",
|
|
74
|
+
"childrenByOrder": {}
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"rendered": false,
|
|
78
|
+
"initial": false,
|
|
79
|
+
"entry": false,
|
|
80
|
+
"recorded": false,
|
|
81
|
+
"reason": "reused as split chunk (cache group: default)",
|
|
82
|
+
"size": 42,
|
|
83
|
+
"sizes": {
|
|
84
|
+
"consume-shared": 42
|
|
85
|
+
},
|
|
86
|
+
"names": [],
|
|
87
|
+
"idHints": [],
|
|
88
|
+
"runtime": [
|
|
89
|
+
"@kenyaemr/esm-patient-flags-app",
|
|
90
|
+
"main"
|
|
91
|
+
],
|
|
92
|
+
"files": [],
|
|
93
|
+
"auxiliaryFiles": [],
|
|
94
|
+
"hash": "1ddc1754a03479c184f1",
|
|
95
|
+
"childrenByOrder": {}
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"rendered": true,
|
|
99
|
+
"initial": false,
|
|
100
|
+
"entry": false,
|
|
101
|
+
"recorded": false,
|
|
102
|
+
"size": 12,
|
|
103
|
+
"sizes": {
|
|
104
|
+
"javascript": 12
|
|
105
|
+
},
|
|
106
|
+
"names": [],
|
|
107
|
+
"idHints": [],
|
|
108
|
+
"runtime": [
|
|
109
|
+
"@kenyaemr/esm-patient-flags-app",
|
|
110
|
+
"main"
|
|
111
|
+
],
|
|
112
|
+
"files": [
|
|
113
|
+
"236.js"
|
|
114
|
+
],
|
|
115
|
+
"auxiliaryFiles": [],
|
|
116
|
+
"hash": "8aa85e74e9666f7488b6",
|
|
117
|
+
"childrenByOrder": {}
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"rendered": true,
|
|
121
|
+
"initial": false,
|
|
122
|
+
"entry": false,
|
|
123
|
+
"recorded": false,
|
|
124
|
+
"size": 3963,
|
|
125
|
+
"sizes": {
|
|
126
|
+
"javascript": 3921,
|
|
127
|
+
"consume-shared": 42
|
|
128
|
+
},
|
|
129
|
+
"names": [],
|
|
130
|
+
"idHints": [],
|
|
131
|
+
"runtime": [
|
|
132
|
+
"@kenyaemr/esm-patient-flags-app",
|
|
133
|
+
"main"
|
|
134
|
+
],
|
|
135
|
+
"files": [
|
|
136
|
+
"455.js"
|
|
137
|
+
],
|
|
138
|
+
"auxiliaryFiles": [],
|
|
139
|
+
"hash": "6681ef8de0f50f1025ae",
|
|
140
|
+
"childrenByOrder": {}
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"rendered": true,
|
|
144
|
+
"initial": false,
|
|
145
|
+
"entry": false,
|
|
146
|
+
"recorded": false,
|
|
147
|
+
"size": 76,
|
|
148
|
+
"sizes": {
|
|
149
|
+
"javascript": 76
|
|
150
|
+
},
|
|
151
|
+
"names": [],
|
|
152
|
+
"idHints": [],
|
|
153
|
+
"runtime": [
|
|
154
|
+
"@kenyaemr/esm-patient-flags-app",
|
|
155
|
+
"main"
|
|
156
|
+
],
|
|
157
|
+
"files": [
|
|
158
|
+
"574.js"
|
|
159
|
+
],
|
|
160
|
+
"auxiliaryFiles": [],
|
|
161
|
+
"hash": "727d6f8da169733dc20f",
|
|
162
|
+
"childrenByOrder": {}
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"rendered": true,
|
|
166
|
+
"initial": false,
|
|
167
|
+
"entry": false,
|
|
168
|
+
"recorded": false,
|
|
169
|
+
"reason": "split chunk (cache group: defaultVendors)",
|
|
170
|
+
"size": 259478,
|
|
171
|
+
"sizes": {
|
|
172
|
+
"javascript": 259478
|
|
173
|
+
},
|
|
174
|
+
"names": [],
|
|
175
|
+
"idHints": [
|
|
176
|
+
"vendors"
|
|
177
|
+
],
|
|
178
|
+
"runtime": [
|
|
179
|
+
"@kenyaemr/esm-patient-flags-app",
|
|
180
|
+
"main"
|
|
181
|
+
],
|
|
182
|
+
"files": [
|
|
183
|
+
"654.js"
|
|
184
|
+
],
|
|
185
|
+
"auxiliaryFiles": [],
|
|
186
|
+
"hash": "aedd6dfa085f562efa94",
|
|
187
|
+
"childrenByOrder": {}
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"rendered": true,
|
|
191
|
+
"initial": false,
|
|
192
|
+
"entry": false,
|
|
193
|
+
"recorded": false,
|
|
194
|
+
"reason": "reused as split chunk (cache group: defaultVendors)",
|
|
195
|
+
"size": 39290,
|
|
196
|
+
"sizes": {
|
|
197
|
+
"javascript": 39290
|
|
198
|
+
},
|
|
199
|
+
"names": [],
|
|
200
|
+
"idHints": [
|
|
201
|
+
"vendors"
|
|
202
|
+
],
|
|
203
|
+
"runtime": [
|
|
204
|
+
"@kenyaemr/esm-patient-flags-app",
|
|
205
|
+
"main"
|
|
206
|
+
],
|
|
207
|
+
"files": [
|
|
208
|
+
"709.js"
|
|
209
|
+
],
|
|
210
|
+
"auxiliaryFiles": [],
|
|
211
|
+
"hash": "0da1e2b3da09a88280b6",
|
|
212
|
+
"childrenByOrder": {}
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
"rendered": true,
|
|
216
|
+
"initial": false,
|
|
217
|
+
"entry": false,
|
|
218
|
+
"recorded": false,
|
|
219
|
+
"size": 7103,
|
|
220
|
+
"sizes": {
|
|
221
|
+
"javascript": 7103
|
|
222
|
+
},
|
|
223
|
+
"names": [],
|
|
224
|
+
"idHints": [],
|
|
225
|
+
"runtime": [
|
|
226
|
+
"@kenyaemr/esm-patient-flags-app",
|
|
227
|
+
"main"
|
|
228
|
+
],
|
|
229
|
+
"files": [
|
|
230
|
+
"784.js"
|
|
231
|
+
],
|
|
232
|
+
"auxiliaryFiles": [],
|
|
233
|
+
"hash": "5eeadfe9ab4139835222",
|
|
234
|
+
"childrenByOrder": {}
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
"rendered": true,
|
|
238
|
+
"initial": false,
|
|
239
|
+
"entry": false,
|
|
240
|
+
"recorded": false,
|
|
241
|
+
"reason": "split chunk (cache group: defaultVendors)",
|
|
242
|
+
"size": 417361,
|
|
243
|
+
"sizes": {
|
|
244
|
+
"javascript": 417361
|
|
245
|
+
},
|
|
246
|
+
"names": [],
|
|
247
|
+
"idHints": [
|
|
248
|
+
"vendors"
|
|
249
|
+
],
|
|
250
|
+
"runtime": [
|
|
251
|
+
"@kenyaemr/esm-patient-flags-app",
|
|
252
|
+
"main"
|
|
253
|
+
],
|
|
254
|
+
"files": [
|
|
255
|
+
"858.js"
|
|
256
|
+
],
|
|
257
|
+
"auxiliaryFiles": [],
|
|
258
|
+
"hash": "a2e4ffbf8182693ae74a",
|
|
259
|
+
"childrenByOrder": {}
|
|
260
|
+
}
|
|
261
|
+
]
|
|
262
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var _kenyaemr_esm_patient_flags_app;(()=>{"use strict";var e,r,t,n,a,o,i,l,s,u,f,p,d,c,h={275:(e,r,t)=>{var n={"./start":()=>t.e(150).then((()=>()=>t(150)))},a=(e,r)=>(t.R=r,r=t.o(n,e)?n[e]():Promise.resolve().then((()=>{throw new Error('Module "'+e+'" does not exist in container.')})),t.R=void 0,r),o=(e,r)=>{if(t.S){var n="default",a=t.S[n];if(a&&a!==e)throw new Error("Container initialization failed as it has already been initialized with a different share scope");return t.S[n]=e,t.I(n,r)}};t.d(r,{get:()=>a,init:()=>o})}},m={};function v(e){var r=m[e];if(void 0!==r)return r.exports;var t=m[e]={id:e,loaded:!1,exports:{}};return h[e](t,t.exports,v),t.loaded=!0,t.exports}v.m=h,v.c=m,v.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return v.d(r,{a:r}),r},v.d=(e,r)=>{for(var t in r)v.o(r,t)&&!v.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},v.f={},v.e=e=>Promise.all(Object.keys(v.f).reduce(((r,t)=>(v.f[t](e,r),r)),[])),v.u=e=>e+".js",v.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),v.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),e={},r="@kenyaemr/esm-patient-flags-app:",v.l=(t,n,a,o)=>{if(e[t])e[t].push(n);else{var i,l;if(void 0!==a)for(var s=document.getElementsByTagName("script"),u=0;u<s.length;u++){var f=s[u];if(f.getAttribute("src")==t||f.getAttribute("data-webpack")==r+a){i=f;break}}i||(l=!0,(i=document.createElement("script")).charset="utf-8",i.timeout=120,v.nc&&i.setAttribute("nonce",v.nc),i.setAttribute("data-webpack",r+a),i.src=t),e[t]=[n];var p=(r,n)=>{i.onerror=i.onload=null,clearTimeout(d);var a=e[t];if(delete e[t],i.parentNode&&i.parentNode.removeChild(i),a&&a.forEach((e=>e(n))),r)return r(n)},d=setTimeout(p.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=p.bind(null,i.onerror),i.onload=p.bind(null,i.onload),l&&document.head.appendChild(i)}},v.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},v.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{v.S={};var e={},r={};v.I=(t,n)=>{n||(n=[]);var a=r[t];if(a||(a=r[t]={}),!(n.indexOf(a)>=0)){if(n.push(a),e[t])return e[t];v.o(v.S,t)||(v.S[t]={});var o=v.S[t],i="@kenyaemr/esm-patient-flags-app",l=(e,r,t,n)=>{var a=o[e]=o[e]||{},l=a[r];(!l||!l.loaded&&(!n!=!l.eager?n:i>l.from))&&(a[r]={get:t,from:i,eager:!!n})},s=[];return"default"===t&&(l("@openmrs/esm-framework","4.0.2-pre.275",(()=>Promise.all([v.e(858),v.e(206)]).then((()=>()=>v(858))))),l("react-i18next","11.18.6",(()=>Promise.all([v.e(709),v.e(206)]).then((()=>()=>v(709))))),l("react","18.2.0",(()=>v.e(784).then((()=>()=>v(784)))))),e[t]=s.length?Promise.all(s).then((()=>e[t]=1)):1}}})(),(()=>{var e;v.g.importScripts&&(e=v.g.location+"");var r=v.g.document;if(!e&&r&&(r.currentScript&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName("script");t.length&&(e=t[t.length-1].src)}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),v.p=e})(),t=e=>{var r=e=>e.split(".").map((e=>+e==e?+e:e)),t=/^([^-+]+)?(?:-([^+]+))?(?:\+(.+))?$/.exec(e),n=t[1]?r(t[1]):[];return t[2]&&(n.length++,n.push.apply(n,r(t[2]))),t[3]&&(n.push([]),n.push.apply(n,r(t[3]))),n},n=(e,r)=>{e=t(e),r=t(r);for(var n=0;;){if(n>=e.length)return n<r.length&&"u"!=(typeof r[n])[0];var a=e[n],o=(typeof a)[0];if(n>=r.length)return"u"==o;var i=r[n],l=(typeof i)[0];if(o!=l)return"o"==o&&"n"==l||"s"==l||"u"==o;if("o"!=o&&"u"!=o&&a!=i)return a<i;n++}},a=e=>{var r=e[0],t="";if(1===e.length)return"*";if(r+.5){t+=0==r?">=":-1==r?"<":1==r?"^":2==r?"~":r>0?"=":"!=";for(var n=1,o=1;o<e.length;o++)n--,t+="u"==(typeof(l=e[o]))[0]?"-":(n>0?".":"")+(n=2,l);return t}var i=[];for(o=1;o<e.length;o++){var l=e[o];i.push(0===l?"not("+s()+")":1===l?"("+s()+" || "+s()+")":2===l?i.pop()+" "+i.pop():a(l))}return s();function s(){return i.pop().replace(/^\((.+)\)$/,"$1")}},o=(e,r)=>{if(0 in e){r=t(r);var n=e[0],a=n<0;a&&(n=-n-1);for(var i=0,l=1,s=!0;;l++,i++){var u,f,p=l<e.length?(typeof e[l])[0]:"";if(i>=r.length||"o"==(f=(typeof(u=r[i]))[0]))return!s||("u"==p?l>n&&!a:""==p!=a);if("u"==f){if(!s||"u"!=p)return!1}else if(s)if(p==f)if(l<=n){if(u!=e[l])return!1}else{if(a?u>e[l]:u<e[l])return!1;u!=e[l]&&(s=!1)}else if("s"!=p&&"n"!=p){if(a||l<=n)return!1;s=!1,l--}else{if(l<=n||f<p!=a)return!1;s=!1}else"s"!=p&&"n"!=p&&(s=!1,l--)}}var d=[],c=d.pop.bind(d);for(i=1;i<e.length;i++){var h=e[i];d.push(1==h?c()|c():2==h?c()&c():h?o(h,r):!c())}return!!c()},i=(e,r)=>{var t=e[r];return Object.keys(t).reduce(((e,r)=>!e||!t[e].loaded&&n(e,r)?r:e),0)},l=(e,r,t,n)=>"Unsatisfied version "+t+" from "+(t&&e[r][t].from)+" of shared singleton module "+r+" (required "+a(n)+")",s=(e,r,t,n)=>{var a=i(e,t);return o(n,a)||"undefined"!=typeof console&&console.warn&&console.warn(l(e,t,a,n)),u(e[t][a])},u=e=>(e.loaded=1,e.get()),f=(e=>function(r,t,n,a){var o=v.I(r);return o&&o.then?o.then(e.bind(e,r,v.S[r],t,n,a)):e(0,v.S[r],t,n,a)})(((e,r,t,n,a)=>r&&v.o(r,t)?s(r,0,t,n):a())),p={},d={206:()=>f("default","react",[1,18,1,0],(()=>v.e(784).then((()=>()=>v(784))))),906:()=>f("default","@openmrs/esm-framework",[1,4],(()=>Promise.all([v.e(858),v.e(206)]).then((()=>()=>v(858))))),924:()=>f("default","react-i18next",[1,11],(()=>v.e(709).then((()=>()=>v(709)))))},c={150:[906],206:[206],455:[924]},v.f.consumes=(e,r)=>{v.o(c,e)&&c[e].forEach((e=>{if(v.o(p,e))return r.push(p[e]);var t=r=>{p[e]=0,v.m[e]=t=>{delete v.c[e],t.exports=r()}},n=r=>{delete p[e],v.m[e]=t=>{throw delete v.c[e],r}};try{var a=d[e]();a.then?r.push(p[e]=a.then(t).catch(n)):t(a)}catch(e){n(e)}}))},(()=>{var e={158:0};v.f.j=(r,t)=>{var n=v.o(e,r)?e[r]:void 0;if(0!==n)if(n)t.push(n[2]);else if(206!=r){var a=new Promise(((t,a)=>n=e[r]=[t,a]));t.push(n[2]=a);var o=v.p+v.u(r),i=new Error;v.l(o,(t=>{if(v.o(e,r)&&(0!==(n=e[r])&&(e[r]=void 0),n)){var a=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+r+" failed.\n("+a+": "+o+")",i.name="ChunkLoadError",i.type=a,i.request=o,n[1](i)}}),"chunk-"+r,r)}else e[r]=0};var r=(r,t)=>{var n,a,[o,i,l]=t,s=0;if(o.some((r=>0!==e[r]))){for(n in i)v.o(i,n)&&(v.m[n]=i[n]);l&&l(v)}for(r&&r(t);s<o.length;s++)a=o[s],v.o(e,a)&&e[a]&&e[a][0](),e[a]=0},t=self.webpackChunk_kenyaemr_esm_patient_flags_app=self.webpackChunk_kenyaemr_esm_patient_flags_app||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})(),v.nc=void 0;var g=v(275);_kenyaemr_esm_patient_flags_app=g})();
|
package/dist/main.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(()=>{var e,r,t={150:(e,r,t)=>{"use strict";t(906),t(979)},979:(e,r,t)=>{var n={"./en.json":[574,574],"./sw.json":[236,236]};function o(e){if(!t.o(n,e))return Promise.resolve().then((()=>{var r=new Error("Cannot find module '"+e+"'");throw r.code="MODULE_NOT_FOUND",r}));var r=n[e],o=r[0];return t.e(r[1]).then((()=>t(o)))}o.keys=()=>Object.keys(n),o.id=979,e.exports=o}},n={};function o(e){var r=n[e];if(void 0!==r)return r.exports;var a=n[e]={id:e,loaded:!1,exports:{}};return t[e](a,a.exports,o),a.loaded=!0,a.exports}o.m=t,o.c=n,o.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return o.d(r,{a:r}),r},o.d=(e,r)=>{for(var t in r)o.o(r,t)&&!o.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce(((r,t)=>(o.f[t](e,r),r)),[])),o.u=e=>e+".js",o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),e={},r="@kenyaemr/esm-patient-flags-app:",o.l=(t,n,a,i)=>{if(e[t])e[t].push(n);else{var l,u;if(void 0!==a)for(var s=document.getElementsByTagName("script"),f=0;f<s.length;f++){var p=s[f];if(p.getAttribute("src")==t||p.getAttribute("data-webpack")==r+a){l=p;break}}l||(u=!0,(l=document.createElement("script")).charset="utf-8",l.timeout=120,o.nc&&l.setAttribute("nonce",o.nc),l.setAttribute("data-webpack",r+a),l.src=t),e[t]=[n];var d=(r,n)=>{l.onerror=l.onload=null,clearTimeout(c);var o=e[t];if(delete e[t],l.parentNode&&l.parentNode.removeChild(l),o&&o.forEach((e=>e(n))),r)return r(n)},c=setTimeout(d.bind(null,void 0,{type:"timeout",target:l}),12e4);l.onerror=d.bind(null,l.onerror),l.onload=d.bind(null,l.onload),u&&document.head.appendChild(l)}},o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{o.S={};var e={},r={};o.I=(t,n)=>{n||(n=[]);var a=r[t];if(a||(a=r[t]={}),!(n.indexOf(a)>=0)){if(n.push(a),e[t])return e[t];o.o(o.S,t)||(o.S[t]={});var i=o.S[t],l="@kenyaemr/esm-patient-flags-app",u=(e,r,t,n)=>{var o=i[e]=i[e]||{},a=o[r];(!a||!a.loaded&&(!n!=!a.eager?n:l>a.from))&&(o[r]={get:t,from:l,eager:!!n})},s=[];return"default"===t&&(u("@openmrs/esm-framework","4.0.2-pre.275",(()=>Promise.all([o.e(858),o.e(206)]).then((()=>()=>o(858))))),u("react-i18next","11.18.6",(()=>Promise.all([o.e(709),o.e(206)]).then((()=>()=>o(709))))),u("react","18.2.0",(()=>o.e(784).then((()=>()=>o(784)))))),e[t]=s.length?Promise.all(s).then((()=>e[t]=1)):1}}})(),(()=>{var e;o.g.importScripts&&(e=o.g.location+"");var r=o.g.document;if(!e&&r&&(r.currentScript&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName("script");t.length&&(e=t[t.length-1].src)}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=e})(),(()=>{var e=e=>{var r=e=>e.split(".").map((e=>+e==e?+e:e)),t=/^([^-+]+)?(?:-([^+]+))?(?:\+(.+))?$/.exec(e),n=t[1]?r(t[1]):[];return t[2]&&(n.length++,n.push.apply(n,r(t[2]))),t[3]&&(n.push([]),n.push.apply(n,r(t[3]))),n},r=e=>{var t=e[0],n="";if(1===e.length)return"*";if(t+.5){n+=0==t?">=":-1==t?"<":1==t?"^":2==t?"~":t>0?"=":"!=";for(var o=1,a=1;a<e.length;a++)o--,n+="u"==(typeof(l=e[a]))[0]?"-":(o>0?".":"")+(o=2,l);return n}var i=[];for(a=1;a<e.length;a++){var l=e[a];i.push(0===l?"not("+u()+")":1===l?"("+u()+" || "+u()+")":2===l?i.pop()+" "+i.pop():r(l))}return u();function u(){return i.pop().replace(/^\((.+)\)$/,"$1")}},t=(r,n)=>{if(0 in r){n=e(n);var o=r[0],a=o<0;a&&(o=-o-1);for(var i=0,l=1,u=!0;;l++,i++){var s,f,p=l<r.length?(typeof r[l])[0]:"";if(i>=n.length||"o"==(f=(typeof(s=n[i]))[0]))return!u||("u"==p?l>o&&!a:""==p!=a);if("u"==f){if(!u||"u"!=p)return!1}else if(u)if(p==f)if(l<=o){if(s!=r[l])return!1}else{if(a?s>r[l]:s<r[l])return!1;s!=r[l]&&(u=!1)}else if("s"!=p&&"n"!=p){if(a||l<=o)return!1;u=!1,l--}else{if(l<=o||f<p!=a)return!1;u=!1}else"s"!=p&&"n"!=p&&(u=!1,l--)}}var d=[],c=d.pop.bind(d);for(i=1;i<r.length;i++){var h=r[i];d.push(1==h?c()|c():2==h?c()&c():h?t(h,n):!c())}return!!c()},n=(r,t)=>{var n=r[t];return Object.keys(n).reduce(((r,t)=>!r||!n[r].loaded&&((r,t)=>{r=e(r),t=e(t);for(var n=0;;){if(n>=r.length)return n<t.length&&"u"!=(typeof t[n])[0];var o=r[n],a=(typeof o)[0];if(n>=t.length)return"u"==a;var i=t[n],l=(typeof i)[0];if(a!=l)return"o"==a&&"n"==l||"s"==l||"u"==a;if("o"!=a&&"u"!=a&&o!=i)return o<i;n++}})(r,t)?t:r),0)},a=(e,o,a,l)=>{var u=n(e,a);return t(l,u)||"undefined"!=typeof console&&console.warn&&console.warn(((e,t,n,o)=>"Unsatisfied version "+n+" from "+(n&&e[t][n].from)+" of shared singleton module "+t+" (required "+r(o)+")")(e,a,u,l)),i(e[a][u])},i=e=>(e.loaded=1,e.get()),l=(e=>function(r,t,n,a){var i=o.I(r);return i&&i.then?i.then(e.bind(e,r,o.S[r],t,n,a)):e(r,o.S[r],t,n,a)})(((e,r,t,n,i)=>r&&o.o(r,t)?a(r,0,t,n):i())),u={},s={206:()=>l("default","react",[1,18,1,0],(()=>o.e(784).then((()=>()=>o(784))))),924:()=>l("default","react-i18next",[1,11],(()=>o.e(709).then((()=>()=>o(709))))),906:()=>l("default","@openmrs/esm-framework",[1,4],(()=>Promise.all([o.e(858),o.e(206)]).then((()=>()=>o(858)))))};[906].forEach((e=>{o.m[e]=r=>{u[e]=0,delete o.c[e];var t=s[e]();if("function"!=typeof t)throw new Error("Shared module is not available for eager consumption: "+e);r.exports=t()}}));var f={206:[206],455:[924]};o.f.consumes=(e,r)=>{o.o(f,e)&&f[e].forEach((e=>{if(o.o(u,e))return r.push(u[e]);var t=r=>{u[e]=0,o.m[e]=t=>{delete o.c[e],t.exports=r()}},n=r=>{delete u[e],o.m[e]=t=>{throw delete o.c[e],r}};try{var a=s[e]();a.then?r.push(u[e]=a.then(t).catch(n)):t(a)}catch(e){n(e)}}))}})(),(()=>{var e={179:0,150:0};o.f.j=(r,t)=>{var n=o.o(e,r)?e[r]:void 0;if(0!==n)if(n)t.push(n[2]);else if(206!=r){var a=new Promise(((t,o)=>n=e[r]=[t,o]));t.push(n[2]=a);var i=o.p+o.u(r),l=new Error;o.l(i,(t=>{if(o.o(e,r)&&(0!==(n=e[r])&&(e[r]=void 0),n)){var a=t&&("load"===t.type?"missing":t.type),i=t&&t.target&&t.target.src;l.message="Loading chunk "+r+" failed.\n("+a+": "+i+")",l.name="ChunkLoadError",l.type=a,l.request=i,n[1](l)}}),"chunk-"+r,r)}else e[r]=0};var r=(r,t)=>{var n,a,[i,l,u]=t,s=0;if(i.some((r=>0!==e[r]))){for(n in l)o.o(l,n)&&(o.m[n]=l[n]);u&&u(o)}for(r&&r(t);s<i.length;s++)a=i[s],o.o(e,a)&&e[a]&&e[a][0](),e[a]=0},t=self.webpackChunk_kenyaemr_esm_patient_flags_app=self.webpackChunk_kenyaemr_esm_patient_flags_app||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})(),o.nc=void 0,o(150)})();
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kenyaemr/esm-patient-flags-app",
|
|
3
|
+
"version": "3.1.1-pre.16",
|
|
4
|
+
"description": "Patient search microfrontend for the OpenMRS SPA",
|
|
5
|
+
"browser": "dist/kenyaemr-esm-core-app.js",
|
|
6
|
+
"main": "src/index.ts",
|
|
7
|
+
"source": true,
|
|
8
|
+
"license": "MPL-2.0",
|
|
9
|
+
"homepage": "https://github.com/palladiumkenya/kenyaemr-esm-core#readme",
|
|
10
|
+
"scripts": {
|
|
11
|
+
"start": "openmrs develop",
|
|
12
|
+
"serve": "webpack serve --mode=development",
|
|
13
|
+
"debug": "npm run serve",
|
|
14
|
+
"build": "webpack --mode production",
|
|
15
|
+
"analyze": "webpack --mode=production --env.analyze=true",
|
|
16
|
+
"lint": "eslint src --ext ts,tsx",
|
|
17
|
+
"typescript": "tsc",
|
|
18
|
+
"extract-translations": "i18next 'src/**/*.component.tsx'"
|
|
19
|
+
},
|
|
20
|
+
"browserslist": [
|
|
21
|
+
"extends browserslist-config-openmrs"
|
|
22
|
+
],
|
|
23
|
+
"keywords": [
|
|
24
|
+
"openmrs"
|
|
25
|
+
],
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public"
|
|
28
|
+
},
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "git+https://github.com/palladiumkenya/kenyaemr-esm-core.git"
|
|
32
|
+
},
|
|
33
|
+
"bugs": {
|
|
34
|
+
"url": "https://github.com/palladiumkenya/kenyaemr-esm-core/issues"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@carbon/colors": "^11.2.0",
|
|
38
|
+
"@carbon/react": "^1.8.0",
|
|
39
|
+
"lodash-es": "^4.17.15"
|
|
40
|
+
},
|
|
41
|
+
"peerDependencies": {
|
|
42
|
+
"@openmrs/esm-framework": "4.x",
|
|
43
|
+
"react": "^18.1.0",
|
|
44
|
+
"react-i18next": "11.x",
|
|
45
|
+
"react-router-dom": "6.x"
|
|
46
|
+
},
|
|
47
|
+
"gitHead": "e85ab5d459f752c71792e08ee07c7d2946dea011"
|
|
48
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const configSchema = {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { openmrsFetch } from '@openmrs/esm-framework';
|
|
2
|
+
import useSWR from 'swr';
|
|
3
|
+
|
|
4
|
+
interface PatientFlagsReturnType {
|
|
5
|
+
patientFlags: Array<string>;
|
|
6
|
+
isLoading: boolean;
|
|
7
|
+
error: Error;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* React hook that takes in a patient uuid and returns
|
|
12
|
+
* patient flags for that patient together with helper objects
|
|
13
|
+
* @param patientUuid Unique patient idenfier
|
|
14
|
+
* @returns An array of patient identifiers
|
|
15
|
+
*/
|
|
16
|
+
export const usePatientFlags = (patientUuid: string): PatientFlagsReturnType => {
|
|
17
|
+
const patientFlagsUrl = `/ws/rest/v1/kenyaemr/flags?patientUuid=${patientUuid}`;
|
|
18
|
+
const { data, mutate, error } = useSWR<{ data: { results: Array<string> } }>(patientFlagsUrl, openmrsFetch);
|
|
19
|
+
const patientFlags = typeof data?.data === 'string' ? [] : data?.data?.results ?? [];
|
|
20
|
+
return { patientFlags, isLoading: !data && !error, error };
|
|
21
|
+
};
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { defineConfigSchema, getAsyncLifecycle } from '@openmrs/esm-framework';
|
|
2
|
+
import { configSchema } from './config-schema';
|
|
3
|
+
|
|
4
|
+
const importTranslation = require.context('../translations', false, /.json$/, 'lazy');
|
|
5
|
+
|
|
6
|
+
const backendDependencies = {
|
|
7
|
+
kenyaemr: '^18.2.0',
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
function setupOpenMRS() {
|
|
11
|
+
const moduleName = '@kenyaemr/esm-patient-flags-app';
|
|
12
|
+
|
|
13
|
+
const options = {
|
|
14
|
+
featureName: 'patient-flags',
|
|
15
|
+
moduleName,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
defineConfigSchema(moduleName, configSchema);
|
|
19
|
+
|
|
20
|
+
return {
|
|
21
|
+
pages: [],
|
|
22
|
+
extensions: [
|
|
23
|
+
{
|
|
24
|
+
name: 'patient-flag',
|
|
25
|
+
slot: 'top-of-all-patient-dashboards-slot',
|
|
26
|
+
load: getAsyncLifecycle(() => import('./patient-flags/patient-flags.component'), options),
|
|
27
|
+
online: true,
|
|
28
|
+
offline: false,
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { backendDependencies, importTranslation, setupOpenMRS };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Tag } from '@carbon/react';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import { usePatientFlags } from '../hooks/usePatientFlags';
|
|
5
|
+
import styles from './patient-flags.scss';
|
|
6
|
+
|
|
7
|
+
interface PatientFlagsProps {
|
|
8
|
+
patientUuid: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const PatientFlags: React.FC<PatientFlagsProps> = ({ patientUuid }) => {
|
|
12
|
+
const { t } = useTranslation();
|
|
13
|
+
const { patientFlags, error } = usePatientFlags(patientUuid);
|
|
14
|
+
|
|
15
|
+
if (error) {
|
|
16
|
+
return <span>{t('errorPatientFlags', 'Error loading patient flags')}</span>;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<div className={styles.flagContainer}>
|
|
21
|
+
{patientFlags.map((patientFlag) => (
|
|
22
|
+
<Tag key={patientFlag} type="magenta">
|
|
23
|
+
{patientFlag}
|
|
24
|
+
</Tag>
|
|
25
|
+
))}
|
|
26
|
+
</div>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export default PatientFlags;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { screen, render } from '@testing-library/react';
|
|
3
|
+
import PatientFlags from './patient-flags.component';
|
|
4
|
+
import { usePatientFlags } from '../hooks/usePatientFlags';
|
|
5
|
+
|
|
6
|
+
const mockUsePatientFlags = usePatientFlags as jest.Mock;
|
|
7
|
+
|
|
8
|
+
jest.mock('../hooks/usePatientFlags', () => {
|
|
9
|
+
const originalModule = jest.requireActual('../hooks/usePatientFlags');
|
|
10
|
+
return { ...originalModule, usePatientFlags: jest.fn() };
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
describe('<PatientFlags/>', () => {
|
|
14
|
+
afterEach(() => {
|
|
15
|
+
jest.resetAllMocks();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
test('should display patient flags', () => {
|
|
19
|
+
mockUsePatientFlags.mockReturnValue({ isLoading: false, patientFlags: ['hiv', 'cancer'], error: null });
|
|
20
|
+
render(<PatientFlags patientUuid="some-patient-uuid" />);
|
|
21
|
+
expect(screen.getByText(/^hiv$/i)).toBeInTheDocument();
|
|
22
|
+
expect(screen.getByText(/^cancer$/i)).toBeInTheDocument();
|
|
23
|
+
});
|
|
24
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BrowserRouter } from 'react-router-dom';
|
|
3
|
+
|
|
4
|
+
const PatientSearchRootComponent: React.FC = () => {
|
|
5
|
+
return <BrowserRouter basename={`${window['getOpenmrsSpaBase']()}`}></BrowserRouter>;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export default PatientSearchRootComponent;
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('openmrs/default-webpack-config');
|