@pih/esm-commons-app 2.1.1-pre.93 → 2.1.1-pre.96

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.
@@ -16,9 +16,9 @@ orphan modules 10.9 MiB [orphan] 3468 modules
16
16
  runtime modules 38.8 KiB 28 modules
17
17
  built modules 6.92 MiB (javascript) 126 bytes (share-init) 126 bytes (consume-shared) [built]
18
18
  modules by path ../../node_modules/ 6.87 MiB 486 modules
19
- modules by path ./ 52.6 KiB
20
- modules by path ./src/ 51.6 KiB 13 modules
21
- modules by path ./translations/ 932 bytes 4 modules
19
+ modules by path ./ 54.8 KiB
20
+ modules by path ./src/ 53.8 KiB 13 modules
21
+ modules by path ./translations/ 1.03 KiB 4 modules
22
22
  provide-module modules 126 bytes
23
23
  provide shared module (default) @openmrs/esm-framework@8.0.1-pre.3473 = ../../no...(truncated) 42 bytes [built] [code generated]
24
24
  + 2 modules
@@ -33,4 +33,4 @@ This can impact web performance.
33
33
  Assets:
34
34
  737.js (2.23 MiB)
35
35
 
36
- webpack 5.102.1 compiled with 1 warning in 104501 ms
36
+ webpack 5.102.1 compiled with 1 warning in 106874 ms
package/dist/300.js CHANGED
@@ -1 +1 @@
1
- "use strict";(globalThis.webpackChunk_pih_esm_commons_app=globalThis.webpackChunk_pih_esm_commons_app||[]).push([[300],{34300:a=>{a.exports=JSON.parse('{"back":"Back","delete":"Delete","edit":"Edit","errorLoadingPatientForm":"Error loading patient form","fullInfantDashboard":"Full Infant Dashboard","fullPatientChart":"Full patient chart","fullPregnancyDashboard":"Full Pregnancy Dashboard","maternalTriageForm":"Maternal triage form","patientHasNoActiveVisit":"Patient has no active visit","removePatient":"Remove patient","transition":"Transition","triage":"Triage","triageFormSubmitted":"Triage form successfully submitted for {{patient}}.","undoTransition":"Undo transition","visitSummary":"Visit summary","vitalSigns":"Vital signs"}')}}]);
1
+ "use strict";(globalThis.webpackChunk_pih_esm_commons_app=globalThis.webpackChunk_pih_esm_commons_app||[]).push([[300],{34300:a=>{a.exports=JSON.parse('{"back":"Back","delete":"Delete","edit":"Edit","errorLoadingPatientForm":"Error loading patient form","fullInfantDashboard":"Full Infant Dashboard","fullPatientChart":"Full patient chart","fullPregnancyDashboard":"Full Pregnancy Dashboard","maternalTriageForm":"Maternal triage form","patientDischarged":"Patient discharged","patientDischargedMessage":"{{patientName}} has been discharged from the ward.","patientHasNoActiveVisit":"Patient has no active visit","removePatient":"Remove patient","transition":"Transition","triage":"Triage","triageFormSubmitted":"Triage form successfully submitted for {{patient}}.","undoTransition":"Undo transition","visitSummary":"Visit summary","vitalSigns":"Vital signs"}')}}]);
package/dist/481.js CHANGED
@@ -1 +1 @@
1
- "use strict";(globalThis.webpackChunk_pih_esm_commons_app=globalThis.webpackChunk_pih_esm_commons_app||[]).push([[481],{21429:(e,n,t)=>{t.d(n,{A:()=>s});var a=t(30977),r=t.n(a),o=t(95924),i=t.n(o)()(r());i.push([e.id,'div[data-extension-id="o2-pregnancy-infant-dashboard"]{flex:1}.-esm-commons__o2-iframe__iframeWrapper___FM34u{height:100%;width:100%;display:flex;flex-direction:column}.-esm-commons__o2-iframe__o2Iframe___1ClRV{height:100%;width:100%}.-esm-commons__o2-iframe__navigation___AidJo{display:flex;flex:1}',"",{version:3,sources:["webpack://./src/ward-app/o2-iframe.scss"],names:[],mappings:"AAAA,uDACE,MAAA,CAGF,gDACE,WAAA,CACA,UAAA,CACA,YAAA,CACA,qBAAA,CAGF,2CACE,WAAA,CACA,UAAA,CAGF,6CACE,YAAA,CACA,MAAA",sourcesContent:[":global(div[data-extension-id='o2-pregnancy-infant-dashboard']) {\n flex: 1;\n}\n\n.iframeWrapper {\n height: 100%;\n width: 100%;\n display: flex;\n flex-direction: column;\n}\n\n.o2Iframe {\n height: 100%;\n width: 100%;\n}\n\n.navigation {\n display: flex;\n flex: 1;\n}\n"],sourceRoot:""}]),i.locals={iframeWrapper:"-esm-commons__o2-iframe__iframeWrapper___FM34u",o2Iframe:"-esm-commons__o2-iframe__o2Iframe___1ClRV",navigation:"-esm-commons__o2-iframe__navigation___AidJo"};const s=i},44085:(e,n,t)=>{t.d(n,{A:()=>x});var a=t(85848),r=t(43047),o=t(1343),i=t.n(o),s=t(72339),l=t(72591),c=t.n(l),u=t(1740),m=t.n(u),d=t(88128),p=t.n(d),A=t(30855),f=t.n(A),v=t(93051),_=t.n(v),h=t(73656),y=t.n(h),b=t(21429),C={};C.styleTagTransform=y(),C.setAttributes=f(),C.insert=p().bind(null,"head"),C.domAPI=m(),C.insertStyleElement=_(),c()(b.A,C);const g=b.A&&b.A.locals?b.A.locals:void 0;function w(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,a=new Array(n);t<n;t++)a[t]=e[t];return a}function E(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var a,r,o=[],i=!0,s=!1;try{for(t=t.call(e);!(i=(a=t.next()).done)&&(o.push(a.value),!n||o.length!==n);i=!0);}catch(e){s=!0,r=e}finally{try{i||null==t.return||t.return()}finally{if(s)throw r}}return o}}(e,n)||function(e,n){if(e){if("string"==typeof e)return w(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(t):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?w(e,n):void 0}}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const x=function(e){var n=e.src,t=e.elementsToHide,l=e.elementsToDisable,c=e.customJavaScript,u=void 0===c?"":c,m=(0,o.useRef)(),d=E((0,o.useState)(!0),2),p=d[0],A=d[1],f=E((0,o.useState)(!1),2),v=f[0],_=f[1],h=E((0,o.useState)(0),2),y=h[0],b=h[1],C=(0,s.useTranslation)().t,w=(0,o.useMemo)(function(){var e,n,a,r,o=null!==(a=null==t||null===(e=t.map(function(e){return"".concat(e," {display: none !important;}")}))||void 0===e?void 0:e.join("\n"))&&void 0!==a?a:"",i=null!==(r=null==l||null===(n=l.map(function(e){return"".concat(e," {pointer-events: none; cursor: not-allowed;}")}))||void 0===n?void 0:n.join("\n"))&&void 0!==r?r:"";return"@media screen {\n ".concat(o,"\n ").concat(i," \n }")},[t,l]);return i().createElement("div",{className:g.iframeWrapper},i().createElement("div",{className:g.navigation},i().createElement(r.K0,{align:"top-start",label:C("back","Back"),onClick:function(){m.current.contentWindow.history.back(),b(y-1),A(!0),_(!0)},disabled:p||y<=1},i().createElement(a.nk,null)),p&&i().createElement(r.OuH,null)),i().createElement("iframe",{ref:m,src:n,onLoad:function(){A(!1),v||b(y+1),_(!1),m.current.contentWindow.addEventListener("beforeunload",function(){return A(!0)});var e=m.current.contentDocument,n=e.createElement("style");n.innerHTML=w,e.head.appendChild(n);var t=e.createElement("script");t.innerHTML=u,e.body.appendChild(t)},className:g.o2Iframe}))}},73481:(e,n,t)=>{t.r(n),t.d(n,{default:()=>l});var a=t(1083),r=t(1343),o=t.n(r),i=t(72339),s=t(44085);const l=function(e){var n=e.groupProps.wardPatient,t=null!=n?n:{},r=t.patient,l=t.visit,c=(0,i.useTranslation)().t,u=r&&l?"".concat(window.openmrsBase,"/pihcore/visit/visit.page?patient=").concat(r.uuid,"&visit=").concat(l.uuid):null;return o().createElement(a.Workspace2,{title:c("visitSummary","Visit summary"),hasUnsavedChanges:!1},o().createElement(a.ExtensionSlot,{name:"ward-workspace-patient-banner-slot",state:{wardPatient:n}}),u?o().createElement(s.A,{src:u,elementsToHide:["header",".patient-header","#breadcrumbs",".visit-actions","#choose-another-visit"],customJavaScript:"\n jQuery('#formBreadcrumb').show();\n jQuery('.simple-form-ui form section').width(400);\n jQuery('#nav-buttons').hide();\n "}):o().createElement("div",null,c("patientHasNoActiveVisit","Patient has no active visit")))}}}]);
1
+ "use strict";(globalThis.webpackChunk_pih_esm_commons_app=globalThis.webpackChunk_pih_esm_commons_app||[]).push([[481],{21429:(e,n,t)=>{t.d(n,{A:()=>s});var a=t(30977),r=t.n(a),i=t(95924),o=t.n(i)()(r());o.push([e.id,'div[data-extension-id="o2-pregnancy-infant-dashboard"]{flex:1}.-esm-commons__o2-iframe__iframeWrapper___FM34u{height:100%;width:100%;display:flex;flex-direction:column}.-esm-commons__o2-iframe__o2Iframe___1ClRV{height:100%;width:100%}.-esm-commons__o2-iframe__navigation___AidJo{display:flex;flex:1}',"",{version:3,sources:["webpack://./src/ward-app/o2-iframe.scss"],names:[],mappings:"AAAA,uDACE,MAAA,CAGF,gDACE,WAAA,CACA,UAAA,CACA,YAAA,CACA,qBAAA,CAGF,2CACE,WAAA,CACA,UAAA,CAGF,6CACE,YAAA,CACA,MAAA",sourcesContent:[":global(div[data-extension-id='o2-pregnancy-infant-dashboard']) {\n flex: 1;\n}\n\n.iframeWrapper {\n height: 100%;\n width: 100%;\n display: flex;\n flex-direction: column;\n}\n\n.o2Iframe {\n height: 100%;\n width: 100%;\n}\n\n.navigation {\n display: flex;\n flex: 1;\n}\n"],sourceRoot:""}]),o.locals={iframeWrapper:"-esm-commons__o2-iframe__iframeWrapper___FM34u",o2Iframe:"-esm-commons__o2-iframe__o2Iframe___1ClRV",navigation:"-esm-commons__o2-iframe__navigation___AidJo"};const s=o},44085:(e,n,t)=>{t.d(n,{A:()=>k});var a=t(85848),r=t(43047),i=t(1343),o=t.n(i),s=t(72339),c=t(72591),l=t.n(c),u=t(1740),m=t.n(u),d=t(88128),p=t.n(d),f=t(30855),A=t.n(f),v=t(93051),h=t.n(v),_=t(73656),g=t.n(_),y=t(21429),b={};b.styleTagTransform=g(),b.setAttributes=A(),b.insert=p().bind(null,"head"),b.domAPI=m(),b.insertStyleElement=h(),l()(y.A,b);const w=y.A&&y.A.locals?y.A.locals:void 0;function C(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,a=new Array(n);t<n;t++)a[t]=e[t];return a}function E(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var a,r,i=[],o=!0,s=!1;try{for(t=t.call(e);!(o=(a=t.next()).done)&&(i.push(a.value),!n||i.length!==n);o=!0);}catch(e){s=!0,r=e}finally{try{o||null==t.return||t.return()}finally{if(s)throw r}}return i}}(e,n)||function(e,n){if(e){if("string"==typeof e)return C(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(t):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?C(e,n):void 0}}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const k=function(e){var n=e.src,t=e.elementsToHide,c=e.elementsToDisable,l=e.customJavaScript,u=void 0===l?"":l,m=(0,i.useRef)(),d=E((0,i.useState)(!0),2),p=d[0],f=d[1],A=E((0,i.useState)(!1),2),v=A[0],h=A[1],_=E((0,i.useState)(0),2),g=_[0],y=_[1],b=(0,s.useTranslation)().t,C=(0,i.useMemo)(function(){var e,n,a,r,i=null!==(a=null==t||null===(e=t.map(function(e){return"".concat(e," {display: none !important;}")}))||void 0===e?void 0:e.join("\n"))&&void 0!==a?a:"",o=null!==(r=null==c||null===(n=c.map(function(e){return"".concat(e," {pointer-events: none; cursor: not-allowed;}")}))||void 0===n?void 0:n.join("\n"))&&void 0!==r?r:"";return"@media screen {\n ".concat(i,"\n ").concat(o," \n }")},[t,c]);return o().createElement("div",{className:w.iframeWrapper},o().createElement("div",{className:w.navigation},o().createElement(r.K0,{align:"top-start",label:b("back","Back"),onClick:function(){m.current.contentWindow.history.back(),y(g-1),f(!0),h(!0)},disabled:p||g<=1},o().createElement(a.nk,null)),p&&o().createElement(r.OuH,null)),o().createElement("iframe",{ref:m,src:n,onLoad:function(){f(!1),v||y(g+1),h(!1),m.current.contentWindow.addEventListener("beforeunload",function(){return f(!0)});var e=m.current.contentDocument,n=e.createElement("style");n.innerHTML=C,e.head.appendChild(n);var t=e.createElement("script");t.innerHTML=u,e.body.appendChild(t)},className:w.o2Iframe}))}},73481:(e,n,t)=>{t.r(n),t.d(n,{default:()=>c});var a=t(1083),r=t(1343),i=t.n(r),o=t(72339),s=t(44085);const c=function(e){var n=e.groupProps.wardPatient,t=null!=n?n:{},c=t.patient,l=t.visit,u=t.inpatientAdmission,m=(0,o.useTranslation)().t;(0,r.useEffect)(function(){var e=function(e){var n,t;"o2IframeFormSubmit"===(null===(n=e.data)||void 0===n?void 0:n.type)&&(0,a.openmrsFetch)("".concat(a.restBaseUrl,"/emrapi/inpatient/admission?patients=").concat(null==c?void 0:c.uuid,"&currentInpatientLocation=").concat(null==u||null===(t=u.currentInpatientLocation)||void 0===t?void 0:t.uuid)).then(function(e){e.ok&&0===e.data.results.length&&((0,a.closeWorkspaceGroup2)(),(0,a.showSnackbar)({title:m("patientDischarged","Patient discharged"),subtitle:m("patientDischargedMessage","{{patientName}} has been discharged from the ward.",{patientName:c.person.display}),kind:"success"}))}).catch(function(e){console.error("Error checking inpatient admission status:",e)})};return window.addEventListener("message",e),function(){return window.removeEventListener("message",e)}},[]);var d=c&&l?"".concat(window.openmrsBase,"/pihcore/visit/visit.page?patient=").concat(c.uuid,"&visit=").concat(l.uuid):null;return i().createElement(a.Workspace2,{title:m("visitSummary","Visit summary"),hasUnsavedChanges:!1},i().createElement(a.ExtensionSlot,{name:"ward-workspace-patient-banner-slot",state:{wardPatient:n}}),d?i().createElement(s.A,{src:d,elementsToHide:["header",".patient-header","#breadcrumbs",".visit-actions","#choose-another-visit"],customJavaScript:"\n jQuery('#formBreadcrumb').show();\n jQuery('.simple-form-ui form section').width(400);\n jQuery('#nav-buttons').hide();\n\n jQuery(document).ajaxComplete(function(event, xhr, settings) {\n if (settings.type && settings.type.toUpperCase() === 'POST') {\n window.parent.postMessage({ type: 'o2IframeFormSubmit' }, '*');\n }\n });\n "}):i().createElement("div",null,m("patientHasNoActiveVisit","Patient has no active visit")))}}}]);
package/dist/481.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"481.js","mappings":"4LAGIA,E,MAA0B,GAA4B,KAE1DA,EAAwBC,KAAK,CAACC,EAAOC,GAAI,8SAAiT,GAAG,CAAC,QAAU,EAAE,QAAU,CAAC,2CAA2C,MAAQ,GAAG,SAAW,qHAAqH,eAAiB,CAAC,gSAAgS,WAAa,MAE12BH,EAAwBI,OAAS,CAChC,cAAiB,iDACjB,SAAY,4CACZ,WAAc,+CAEf,S,6NCDIC,EAAU,CAAC,EAEfA,EAAQC,kBAAoB,IAC5BD,EAAQE,cAAgB,IAElBF,EAAQG,OAAS,SAAc,KAAM,QAE3CH,EAAQI,OAAS,IACjBJ,EAAQK,mBAAqB,IAEhB,IAAI,IAASL,GAKnB,QAAe,KAAW,IAAQD,OAAS,IAAQA,YAASO,E,+7BC2DnE,QA5DqC,Y,IAAGC,EAAAA,EAAAA,IAAKC,EAAAA,EAAAA,eAAgBC,EAAAA,EAAAA,kBAAmB,EAAnBA,EAAmBC,iBAAAA,OAAAA,IAAmB,OAC3FC,GAAYC,EAAAA,EAAAA,UAC4BC,EAAAA,GAAAA,EAAAA,EAAAA,WAAS,MAAhDC,EAAuCD,EAAAA,GAAtBE,EAAsBF,EAAAA,GACRA,EAAAA,GAAAA,EAAAA,EAAAA,WAAS,MAAxCG,EAA+BH,EAAAA,GAAlBI,EAAkBJ,EAAAA,GACcA,EAAAA,GAAAA,EAAAA,EAAAA,UAAS,MAAtDK,EAA6CL,EAAAA,GAAzBM,EAAyBN,EAAAA,GAC9C,GAAQO,EAAAA,EAAAA,kBAANC,EAEFC,GAAYC,EAAAA,EAAAA,SAAQ,W,IACTf,EAEbC,EAFaD,EAEbC,EAFIe,EAA8E,QAArEhB,EAAAA,S,QAAAA,EAAAA,EAAgBiB,IAAI,SAACC,G,MAAM,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A,EAAAA,QAAAA,EAAe,CAAC,EAAnCC,EAAmBD,EAAnBC,QAASC,EAAUF,EAAVE,MAEX,GAAQzC,EAAAA,EAAAA,kBAANC,EASFyC,EACJF,GAAWC,EACP,GAA0DD,OAAvDG,OAAOC,YAAY,sCAA0DH,OAAtBD,EAAQK,KAAK,WAAoB,OAAXJ,EAAMI,MACtF,KAEN,OACE,kBAACC,EAAAA,WAAUA,CAACC,MAAO9C,EAAE,eAAgB,iBAAkB+C,mBAAmB,GACxE,kBAACC,EAAAA,cAAaA,CAACC,KAAK,qCAAqCC,MAAO,CAAEZ,YAAAA,KACjEG,EACC,kBAACU,EAAAA,EAAQA,CAACjE,IAAKuD,EAAWtD,eAhBT,CAAC,SAAU,kBAAmB,eAAgB,iBAAkB,yBAgBvBE,iBAfvC,4IAiBnB,kBAACmB,MAAAA,KAAKR,EAAE,0BAA2B,gCAI3C,C","sources":["webpack://@pih/esm-commons-app/./src/ward-app/o2-iframe.scss","webpack://@pih/esm-commons-app/./src/ward-app/o2-iframe.scss?323a","webpack://@pih/esm-commons-app/./src/ward-app/o2-iframe.component.tsx","webpack://@pih/esm-commons-app/./src/ward-app/o2-visit-summary-workspace.component.tsx"],"names":["___CSS_LOADER_EXPORT___","push","module","id","locals","options","styleTagTransform","setAttributes","insert","domAPI","insertStyleElement","undefined","src","elementsToHide","elementsToDisable","customJavaScript","iframeRef","useRef","useState","isIframeLoading","setIsIframeLoading","isGoingBack","setIsGoingBack","iframeHistoryCount","setIframeHistoryCount","useTranslation","t","customCss","useMemo","toHide","map","e","join","toDisable","div","className","styles","iframeWrapper","navigation","IconButton","align","label","onClick","current","contentWindow","history","back","disabled","ArrowLeft","InlineLoading","iframe","ref","onLoad","addEventListener","contentDocument","styleTag","createElement","innerHTML","head","appendChild","scriptTag","body","o2Iframe","groupProps","wardPatient","patient","visit","iframeSrc","window","openmrsBase","uuid","Workspace2","title","hasUnsavedChanges","ExtensionSlot","name","state","O2IFrame"],"sourceRoot":""}
1
+ {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m-commons-app/./src/ward-app/o2-iframe.scss?323a","webpack://@pih/esm-commons-app/./src/ward-app/o2-iframe.component.tsx","webpack://@pih/esm-commons-app/./src/ward-app/o2-visit-summary-workspace.component.tsx"],"names":["___CSS_LOADER_EXPORT___","push","module","id","locals","options","styleTagTransform","setAttributes","insert","domAPI","insertStyleElement","undefined","src","elementsToHide","elementsToDisable","customJavaScript","iframeRef","useRef","useState","isIframeLoading","setIsIframeLoading","isGoingBack","setIsGoingBack","iframeHistoryCount","setIframeHistoryCount","useTranslation","t","customCss","useMemo","toHide","map","e","join","toDisable","div","className","styles","iframeWrapper","navigation","IconButton","align","label","onClick","current","contentWindow","history","back","disabled","ArrowLeft","InlineLoading","iframe","ref","onLoad","addEventListener","contentDocument","styleTag","createElement","innerHTML","head","appendChild","scriptTag","body","o2Iframe","groupProps","wardPatient","patient","visit","inpatientAdmission","useEffect","handleMessage","event","data","type","openmrsFetch","restBaseUrl","uuid","currentInpatientLocation","then","response","ok","results","length","closeWorkspaceGroup2","showSnackbar","title","subtitle","patientName","person","display","kind","catch","error","console","window","removeEventListener","iframeSrc","openmrsBase","Workspace2","hasUnsavedChanges","ExtensionSlot","name","state","O2IFrame"],"sourceRoot":""}
@@ -229,9 +229,9 @@
229
229
  "initial": false,
230
230
  "entry": false,
231
231
  "recorded": false,
232
- "size": 596,
232
+ "size": 717,
233
233
  "sizes": {
234
- "javascript": 596
234
+ "javascript": 717
235
235
  },
236
236
  "names": [],
237
237
  "idHints": [],
@@ -243,7 +243,7 @@
243
243
  "300.js"
244
244
  ],
245
245
  "auxiliaryFiles": [],
246
- "hash": "ac067d09b8a695d6",
246
+ "hash": "ce937225c049790e",
247
247
  "childrenByOrder": {}
248
248
  },
249
249
  {
@@ -368,9 +368,9 @@
368
368
  "initial": false,
369
369
  "entry": false,
370
370
  "recorded": false,
371
- "size": 10265,
371
+ "size": 12463,
372
372
  "sizes": {
373
- "javascript": 10265
373
+ "javascript": 12463
374
374
  },
375
375
  "names": [],
376
376
  "idHints": [],
@@ -384,7 +384,7 @@
384
384
  "auxiliaryFiles": [
385
385
  "481.js.map"
386
386
  ],
387
- "hash": "282cbba7871474b8",
387
+ "hash": "3287f6a4386c7bde",
388
388
  "childrenByOrder": {}
389
389
  },
390
390
  {
@@ -455,7 +455,7 @@
455
455
  "auxiliaryFiles": [
456
456
  "685.js.map"
457
457
  ],
458
- "hash": "a4775f75e584599c",
458
+ "hash": "1d5818ac27a9fefb",
459
459
  "childrenByOrder": {}
460
460
  },
461
461
  {
@@ -558,7 +558,7 @@
558
558
  "auxiliaryFiles": [
559
559
  "main.js.map"
560
560
  ],
561
- "hash": "4d5715d059487eaa",
561
+ "hash": "c74fda2746eefd15",
562
562
  "childrenByOrder": {}
563
563
  },
564
564
  {
package/dist/routes.json CHANGED
@@ -1 +1 @@
1
- {"$schema":"https://json.openmrs.org/routes.schema.json","pages":[{"component":"root","route":"appointments"},{"component":"root","route":"service-queues"},{"component":"root","route":"dispensing2"},{"component":"root","route":"ward"}],"extensions":[{"name":"o2-pregnancy-infant-dashboard","component":"o2PregnancyInfantDashboard","slot":"ward-patient-workspace-content-slot"},{"name":"triage-waiting-queue-actions","component":"triageWaitingQueueActions","slot":"queue-table-triage-waiting-queue-actions-slot"}],"workspaces2":[{"name":"o2-visit-summary-workspace","component":"o2VisitSummaryWorkspace","window":"o2-visit-summary-window"},{"name":"o2-vital-signs-workspace","component":"o2VitalSignsWorkspace","window":"o2-vital-signs-window"},{"name":"maternal-triage-form-workspace","component":"maternalTriageFormWorkspace","window":"maternal-triage-form-window"}],"workspaceWindows2":[{"name":"o2-visit-summary-window","icon":"o2VisitSummaryWorkspaceSideRailIcon","group":"ward-patient","width":"extra-wide","canMaximize":true},{"name":"o2-vital-signs-window","icon":"o2VitalSignsWorkspaceSideRailIcon","group":"ward-patient","width":"extra-wide","canMaximize":true},{"name":"maternal-triage-form-window","group":"service-queues","width":"extra-wide","canMaximize":true}],"version":"2.1.1-pre.93"}
1
+ {"$schema":"https://json.openmrs.org/routes.schema.json","pages":[{"component":"root","route":"appointments"},{"component":"root","route":"service-queues"},{"component":"root","route":"dispensing2"},{"component":"root","route":"ward"}],"extensions":[{"name":"o2-pregnancy-infant-dashboard","component":"o2PregnancyInfantDashboard","slot":"ward-patient-workspace-content-slot"},{"name":"triage-waiting-queue-actions","component":"triageWaitingQueueActions","slot":"queue-table-triage-waiting-queue-actions-slot"}],"workspaces2":[{"name":"o2-visit-summary-workspace","component":"o2VisitSummaryWorkspace","window":"o2-visit-summary-window"},{"name":"o2-vital-signs-workspace","component":"o2VitalSignsWorkspace","window":"o2-vital-signs-window"},{"name":"maternal-triage-form-workspace","component":"maternalTriageFormWorkspace","window":"maternal-triage-form-window"}],"workspaceWindows2":[{"name":"o2-visit-summary-window","icon":"o2VisitSummaryWorkspaceSideRailIcon","group":"ward-patient","width":"extra-wide","canMaximize":true},{"name":"o2-vital-signs-window","icon":"o2VitalSignsWorkspaceSideRailIcon","group":"ward-patient","width":"extra-wide","canMaximize":true},{"name":"maternal-triage-form-window","group":"service-queues","width":"extra-wide","canMaximize":true}],"version":"2.1.1-pre.96"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pih/esm-commons-app",
3
- "version": "2.1.1-pre.93",
3
+ "version": "2.1.1-pre.96",
4
4
  "description": "An app to define extensions to be slotted into other apps that are not PIH specific.",
5
5
  "browser": "dist/pih-esm-commons-app.js",
6
6
  "main": "src/index.ts",
@@ -1,11 +1,18 @@
1
- import { ExtensionSlot, Workspace2 } from '@openmrs/esm-framework';
2
- import React from 'react';
1
+ import {
2
+ closeWorkspaceGroup2,
3
+ ExtensionSlot,
4
+ openmrsFetch,
5
+ restBaseUrl,
6
+ showSnackbar,
7
+ Workspace2,
8
+ } from '@openmrs/esm-framework';
9
+ import React, { useEffect } from 'react';
3
10
  import { useTranslation } from 'react-i18next';
4
11
  import O2IFrame from './o2-iframe.component';
5
12
  import type { WardPatientWorkspaceDefinition } from './types';
6
13
 
7
14
  const O2VisitSummaryWorkspace: React.FC<WardPatientWorkspaceDefinition> = ({ groupProps: { wardPatient } }) => {
8
- const { patient, visit } = wardPatient ?? {};
15
+ const { patient, visit, inpatientAdmission } = wardPatient ?? {};
9
16
 
10
17
  const { t } = useTranslation();
11
18
 
@@ -14,8 +21,42 @@ const O2VisitSummaryWorkspace: React.FC<WardPatientWorkspaceDefinition> = ({ gro
14
21
  jQuery('#formBreadcrumb').show();
15
22
  jQuery('.simple-form-ui form section').width(400);
16
23
  jQuery('#nav-buttons').hide();
24
+
25
+ jQuery(document).ajaxComplete(function(event, xhr, settings) {
26
+ if (settings.type && settings.type.toUpperCase() === 'POST') {
27
+ window.parent.postMessage({ type: 'o2IframeFormSubmit' }, '*');
28
+ }
29
+ });
17
30
  `;
18
31
 
32
+ useEffect(() => {
33
+ const handleMessage = (event: MessageEvent) => {
34
+ if (event.data?.type === 'o2IframeFormSubmit') {
35
+ // check whether patient is still admitted. If not, close the workspace group
36
+ openmrsFetch(
37
+ `${restBaseUrl}/emrapi/inpatient/admission?patients=${patient?.uuid}&currentInpatientLocation=${inpatientAdmission?.currentInpatientLocation?.uuid}`,
38
+ )
39
+ .then((response) => {
40
+ if (response.ok && response.data.results.length === 0) {
41
+ closeWorkspaceGroup2();
42
+ showSnackbar({
43
+ title: t('patientDischarged', 'Patient discharged'),
44
+ subtitle: t('patientDischargedMessage', '{{patientName}} has been discharged from the ward.', {
45
+ patientName: patient.person.display,
46
+ }),
47
+ kind: 'success',
48
+ });
49
+ }
50
+ })
51
+ .catch((error) => {
52
+ console.error('Error checking inpatient admission status:', error);
53
+ });
54
+ }
55
+ };
56
+ window.addEventListener('message', handleMessage);
57
+ return () => window.removeEventListener('message', handleMessage);
58
+ }, []);
59
+
19
60
  const iframeSrc =
20
61
  patient && visit
21
62
  ? `${window.openmrsBase}/pihcore/visit/visit.page?patient=${patient.uuid}&visit=${visit.uuid}`
@@ -1,10 +1,11 @@
1
- import type { Patient, Visit, Workspace2DefinitionProps } from '@openmrs/esm-framework';
1
+ import type { Patient, Visit, Location, Workspace2DefinitionProps } from '@openmrs/esm-framework';
2
2
 
3
3
  // stripped down versions of the same types defined in esm-ward-app
4
4
 
5
5
  export type WardPatient = {
6
6
  patient: Patient;
7
7
  visit: Visit;
8
+ inpatientAdmission: InpatientAdmission;
8
9
  // other fields not typed
9
10
  };
10
11
 
@@ -24,3 +25,7 @@ export interface MotherChildRelationships {
24
25
  export interface MaternalWardViewContext {
25
26
  motherChildRelationships: MotherChildRelationships;
26
27
  }
28
+ export interface InpatientAdmission {
29
+ currentInpatientLocation: Location;
30
+ // other fields not typed
31
+ }
@@ -7,6 +7,8 @@
7
7
  "fullPatientChart": "Full patient chart",
8
8
  "fullPregnancyDashboard": "Full Pregnancy Dashboard",
9
9
  "maternalTriageForm": "Maternal triage form",
10
+ "patientDischarged": "Patient discharged",
11
+ "patientDischargedMessage": "{{patientName}} has been discharged from the ward.",
10
12
  "patientHasNoActiveVisit": "Patient has no active visit",
11
13
  "removePatient": "Remove patient",
12
14
  "transition": "Transition",