@kenyaemr/esm-patient-flags-app 3.1.1-pre.2

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.
@@ -0,0 +1,3 @@
1
+ /*! For license information please see openmrs-esm-react-utils.js.LICENSE.txt */
2
+
3
+ /*! For license information please see openmrs-esm-styleguide.js.LICENSE.txt */
package/dist/865.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_kenyaemr_esm_patient_flags_app=self.webpackChunk_kenyaemr_esm_patient_flags_app||[]).push([[865],{3924:(a,n,e)=>{e.d(n,{Z:()=>l});var t=e(2609),r=e.n(t)()((function(a){return a[1]}));r.push([a.id,":root{--brand-01: #005d5d;--brand-02: #004144;--brand-03: #007d79}.-esm-patient-flags__patient-flags__flagContainer___W3Mx5{margin:1rem}",""]),r.locals={flagContainer:"-esm-patient-flags__patient-flags__flagContainer___W3Mx5"};const l=r},2455:(a,n,e)=>{e.r(n),e.d(n,{default:()=>E});var t=e(9902),r=e.n(t),l=e(8093),s=e(4924),i=e(3066),o=e(9857),d=e(6062),u=e.n(d),p=e(4036),_=e.n(p),f=e(6793),g=e.n(f),m=e(7892),c=e.n(m),v=e(1173),k=e.n(v),y=e(2464),b=e.n(y),Z=e(3924),h={};h.styleTagTransform=b(),h.setAttributes=c(),h.insert=g().bind(null,"head"),h.domAPI=_(),h.insertStyleElement=k(),u()(Z.Z,h);const C=Z.Z&&Z.Z.locals?Z.Z.locals:void 0,E=function(a){var n=a.patientUuid,e=(0,s.useTranslation)().t,t=function(a){var n,e,t="/ws/rest/v1/kenyaemr/flags?patientUuid=".concat(a),r=(0,o.ZP)(t,i.openmrsFetch),l=r.data,s=(r.mutate,r.error);return{patientFlags:"string"==typeof(null==l?void 0:l.data)?[]:null!==(e=null==l||null===(n=l.data)||void 0===n?void 0:n.results)&&void 0!==e?e:[],isLoading:!l&&!s,error:s}}(n),d=t.patientFlags;return t.error?r().createElement("span",null,e("errorPatientFlags","Error loading patient flags")):r().createElement("div",{className:C.flagContainer},d.map((function(a){return r().createElement(l.Z,{key:a,type:"magenta"},a)})))}}}]);
package/dist/871.js ADDED
@@ -0,0 +1,2 @@
1
+ /*! For license information please see 871.js.LICENSE.txt */
2
+ (self.webpackChunk_kenyaemr_esm_patient_flags_app=self.webpackChunk_kenyaemr_esm_patient_flags_app||[]).push([[871],{8093:(e,t,r)=>{"use strict";function n(){return n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},n.apply(this,arguments)}function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}r.d(t,{Z:()=>V});var a=r(3980),o=r.n(a),c=r(9902),u=r.n(c),s=r(2779),l=r.n(s);function f(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function d(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?f(Object(r),!0).forEach((function(t){p(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):f(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function p(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function v(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var b=["width","height","viewBox"],y=["tabindex"],g={focusable:"false",preserveAspectRatio:"xMidYMid meet"};function h(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function m(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?h(Object(r),!0).forEach((function(t){O(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):h(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function O(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function w(){return w=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},w.apply(this,arguments)}function x(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var j,E=["className","children","tabIndex"],P=["tabindex"],C=u().forwardRef((function(e,t){var r=e.className,n=e.children,i=e.tabIndex,a=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.width,r=e.height,n=e.viewBox,i=void 0===n?"0 0 ".concat(t," ").concat(r):n,a=v(e,b),o=a.tabindex,c=v(a,y),u=d(d(d({},g),c),{},{width:t,height:r,viewBox:i});return u["aria-label"]||u["aria-labelledby"]||u.title?(u.role="img",null!=o&&(u.focusable="true",u.tabindex=o)):u["aria-hidden"]=!0,u}(m(m({},x(e,E)),{},{tabindex:i})),o=a.tabindex,c=x(a,P);return r&&(c.className=r),null!=o&&(c.tabIndex=o),t&&(c.ref=t),u().createElement("svg",c,n)}));C.displayName="Icon",C.propTypes={"aria-hidden":o().string,"aria-label":o().string,"aria-labelledby":o().string,children:o().node,className:o().string,height:o().oneOfType([o().number,o().string]),preserveAspectRatio:o().string,tabIndex:o().string,viewBox:o().string,width:o().oneOfType([o().number,o().string]),xmlns:o().string},C.defaultProps={xmlns:"http://www.w3.org/2000/svg",preserveAspectRatio:"xMidYMid meet"};var k,S=["children"],T=u().forwardRef((function(e,t){var r=e.children,n=x(e,S);return u().createElement(C,w({width:16,height:16,viewBox:"0 0 32 32",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",ref:t},n),j||(j=u().createElement("path",{d:"M24 9.4L22.6 8 16 14.6 9.4 8 8 9.4 14.6 16 8 22.6 9.4 24 16 17.4 22.6 24 24 22.6 17.4 16 24 9.4z"})),r)})),R=r(8479),I=u().createContext(R.settings.prefix),_=["children","className","id","type","filter","renderIcon","title","disabled","onClose","size"],D=(k=0,function(){return++k}),N={red:"Red",magenta:"Magenta",purple:"Purple",blue:"Blue",cyan:"Cyan",teal:"Teal",green:"Green",gray:"Gray","cool-gray":"Cool-Gray","warm-gray":"Warm-Gray","high-contrast":"High-Contrast",outline:"Outline"},M=function(e){var t,r=e.children,a=e.className,o=e.id,c=e.type,s=e.filter,f=e.renderIcon,d=e.title,p=e.disabled,v=e.onClose,b=e.size,y=function(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}(e,_),g=u().useContext(I),h=o||"tag-".concat(D()),m=l()("".concat(g,"--tag"),a,(i(t={},"".concat(g,"--tag--disabled"),p),i(t,"".concat(g,"--tag--filter"),s),i(t,"".concat(g,"--tag--").concat(b),b),i(t,"".concat(g,"--tag--").concat(c),c),i(t,"".concat(g,"--tag--interactive"),y.onClick&&!s),t));if(s)return u().createElement("div",n({className:m,"aria-label":void 0!==d?"".concat(d," ").concat(r):"Clear filter ".concat(r),id:h},y),u().createElement("span",{className:"".concat(g,"--tag__label"),title:"string"==typeof r?r:null},null!=r?r:N[c]),u().createElement("button",{type:"button",className:"".concat(g,"--tag__close-icon"),onClick:function(e){v&&(e.stopPropagation(),v(e))},disabled:p,"aria-labelledby":h,title:d},u().createElement(T,null)));var O=y.onClick?"button":"div";return u().createElement(O,n({disabled:"button"===O?p:null,className:m,id:h},y),f?u().createElement("div",{className:"".concat(g,"--tag__custom-icon")},u().createElement(f,null)):"",u().createElement("span",{title:"string"==typeof r?r:null},null!=r?r:N[c]))};M.propTypes={children:o().node,className:o().string,disabled:o().bool,filter:o().bool,id:o().string,onClose:o().func,renderIcon:o().oneOfType([o().func,o().object]),size:o().oneOf(["sm","md"]),title:o().string,type:o().oneOf(Object.keys(N))},Object.keys(N);const V=M},2779:(e,t)=>{var r;!function(){"use strict";var n={}.hasOwnProperty;function i(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var a=typeof r;if("string"===a||"number"===a)e.push(r);else if(Array.isArray(r)){if(r.length){var o=i.apply(null,r);o&&e.push(o)}}else if("object"===a)if(r.toString===Object.prototype.toString)for(var c in r)n.call(r,c)&&r[c]&&e.push(c);else e.push(r.toString())}}return e.join(" ")}e.exports?(i.default=i,e.exports=i):void 0===(r=function(){return i}.apply(t,[]))||(e.exports=r)}()},2609:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var r=e(t);return t[2]?"@media ".concat(t[2]," {").concat(r,"}"):r})).join("")},t.i=function(e,r,n){"string"==typeof e&&(e=[[null,e,""]]);var i={};if(n)for(var a=0;a<this.length;a++){var o=this[a][0];null!=o&&(i[o]=!0)}for(var c=0;c<e.length;c++){var u=[].concat(e[c]);n&&i[u[0]]||(r&&(u[2]?u[2]="".concat(r," and ").concat(u[2]):u[2]=r),t.push(u))}},t}},8262:(e,t,r)=>{"use strict";var n=r(3586);function i(){}function a(){}a.resetWarningCache=i,e.exports=function(){function e(e,t,r,i,a,o){if(o!==n){var c=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw c.name="Invariant Violation",c}}function t(){return e}e.isRequired=e;var r={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:a,resetWarningCache:i};return r.PropTypes=r,r}},3980:(e,t,r)=>{e.exports=r(8262)()},3586:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},6062:e=>{"use strict";var t=[];function r(e){for(var r=-1,n=0;n<t.length;n++)if(t[n].identifier===e){r=n;break}return r}function n(e,n){for(var a={},o=[],c=0;c<e.length;c++){var u=e[c],s=n.base?u[0]+n.base:u[0],l=a[s]||0,f="".concat(s," ").concat(l);a[s]=l+1;var d=r(f),p={css:u[1],media:u[2],sourceMap:u[3],supports:u[4],layer:u[5]};if(-1!==d)t[d].references++,t[d].updater(p);else{var v=i(p,n);n.byIndex=c,t.splice(c,0,{identifier:f,updater:v,references:1})}o.push(f)}return o}function i(e,t){var r=t.domAPI(t);return r.update(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;r.update(e=t)}else r.remove()}}e.exports=function(e,i){var a=n(e=e||[],i=i||{});return function(e){e=e||[];for(var o=0;o<a.length;o++){var c=r(a[o]);t[c].references--}for(var u=n(e,i),s=0;s<a.length;s++){var l=r(a[s]);0===t[l].references&&(t[l].updater(),t.splice(l,1))}a=u}}},6793:e=>{"use strict";var t={};e.exports=function(e,r){var n=function(e){if(void 0===t[e]){var r=document.querySelector(e);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(e){r=null}t[e]=r}return t[e]}(e);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");n.appendChild(r)}},1173:e=>{"use strict";e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},7892:(e,t,r)=>{"use strict";e.exports=function(e){var t=r.nc;t&&e.setAttribute("nonce",t)}},4036:e=>{"use strict";e.exports=function(e){var t=e.insertStyleElement(e);return{update:function(r){!function(e,t,r){var n="";r.supports&&(n+="@supports (".concat(r.supports,") {")),r.media&&(n+="@media ".concat(r.media," {"));var i=void 0!==r.layer;i&&(n+="@layer".concat(r.layer.length>0?" ".concat(r.layer):""," {")),n+=r.css,i&&(n+="}"),r.media&&(n+="}"),r.supports&&(n+="}");var a=r.sourceMap;a&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(a))))," */")),t.styleTagTransform(n,e,t.options)}(t,e,r)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},2464:e=>{"use strict";e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},9857:(e,t,r)=>{"use strict";r.d(t,{ZP:()=>Z});var n=r(9902);function i(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{u(n.next(e))}catch(e){a(e)}}function c(e){try{u(n.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,c)}u((n=n.apply(e,t||[])).next())}))}function a(e,t){var r,n,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(a){return function(c){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,n=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}var o,c=function(){},u=c(),s=Object,l=function(e){return e===u},f=function(e){return"function"==typeof e},d=function(e,t){return s.assign({},e,t)},p="undefined",v=function(){return typeof window!=p},b=new WeakMap,y=0,g=function(e){var t,r,n=typeof e,i=e&&e.constructor,a=i==Date;if(s(e)!==e||a||i==RegExp)t=a?e.toJSON():"symbol"==n?e.toString():"string"==n?JSON.stringify(e):""+e;else{if(t=b.get(e))return t;if(t=++y+"~",b.set(e,t),i==Array){for(t="@",r=0;r<e.length;r++)t+=g(e[r])+",";b.set(e,t)}if(i==s){t="#";for(var o=s.keys(e).sort();!l(r=o.pop());)l(e[r])||(t+=r+":"+g(e[r])+",");b.set(e,t)}}return t},h=!0,m=v(),O=typeof document!=p,w=m&&window.addEventListener?window.addEventListener.bind(window):c,x=O?document.addEventListener.bind(document):c,j=m&&window.removeEventListener?window.removeEventListener.bind(window):c,E=O?document.removeEventListener.bind(document):c,P={isOnline:function(){return h},isVisible:function(){var e=O&&document.visibilityState;return l(e)||"hidden"!==e}},C={initFocus:function(e){return x("visibilitychange",e),w("focus",e),function(){E("visibilitychange",e),j("focus",e)}},initReconnect:function(e){var t=function(){h=!0,e()},r=function(){h=!1};return w("online",t),w("offline",r),function(){j("online",t),j("offline",r)}}},k=!v()||"Deno"in window,S=k?n.useEffect:n.useLayoutEffect,T="undefined"!=typeof navigator&&navigator.connection,R=!k&&T&&(["slow-2g","2g"].includes(T.effectiveType)||T.saveData),I=function(e){if(f(e))try{e=e()}catch(t){e=""}var t=[].concat(e);return[e="string"==typeof e?e:(Array.isArray(e)?e.length:e)?g(e):"",t,e?"$swr$"+e:""]},_=new WeakMap,D=function(e,t,r,n,i,a,o){void 0===o&&(o=!0);var c=_.get(e),u=c[0],s=c[1],l=c[3],f=u[t],d=s[t];if(o&&d)for(var p=0;p<d.length;++p)d[p](r,n,i);return a&&(delete l[t],f&&f[0])?f[0](2).then((function(){return e.get(t)})):e.get(t)},N=0,M=function(){return++N},V=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return i(void 0,void 0,void 0,(function(){var t,r,n,i,o,c,s,p,v,b,y,g,h,m,O,w,x,j,E,P,C;return a(this,(function(a){switch(a.label){case 0:if(t=e[0],r=e[1],n=e[2],i=e[3],c=!!l((o="boolean"==typeof i?{revalidate:i}:i||{}).populateCache)||o.populateCache,s=!1!==o.revalidate,p=!1!==o.rollbackOnError,v=o.optimisticData,b=I(r),y=b[0],g=b[2],!y)return[2];if(h=_.get(t),m=h[2],e.length<3)return[2,D(t,y,t.get(y),u,u,s,!0)];if(O=n,x=M(),m[y]=[x,0],j=!l(v),E=t.get(y),j&&(P=f(v)?v(E):v,t.set(y,P),D(t,y,P)),f(O))try{O=O(t.get(y))}catch(e){w=e}return O&&f(O.then)?[4,O.catch((function(e){w=e}))]:[3,2];case 1:if(O=a.sent(),x!==m[y][0]){if(w)throw w;return[2,O]}w&&j&&p&&(c=!0,O=E,t.set(y,E)),a.label=2;case 2:return c&&(w||(f(c)&&(O=c(O,E)),t.set(y,O)),t.set(g,d(t.get(g),{error:w}))),m[y][1]=M(),[4,D(t,y,O,w,u,s,!!c)];case 3:if(C=a.sent(),w)throw w;return[2,c?C:O]}}))}))},L=function(e,t){for(var r in e)e[r][0]&&e[r][0](t)},A=function(e,t){if(!_.has(e)){var r=d(C,t),n={},i=V.bind(u,e),a=c;if(_.set(e,[n,{},{},{},i]),!k){var o=r.initFocus(setTimeout.bind(u,L.bind(u,n,0))),s=r.initReconnect(setTimeout.bind(u,L.bind(u,n,1)));a=function(){o&&o(),s&&s(),_.delete(e)}}return[e,i,a]}return[e,_.get(e)[4]]},F=A(new Map),W=F[0],B=F[1],G=d({onLoadingSlow:c,onSuccess:c,onError:c,onErrorRetry:function(e,t,r,n,i){var a=r.errorRetryCount,o=i.retryCount,c=~~((Math.random()+.5)*(1<<(o<8?o:8)))*r.errorRetryInterval;!l(a)&&o>a||setTimeout(n,c,i)},onDiscarded:c,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:R?1e4:5e3,focusThrottleInterval:5e3,dedupingInterval:2e3,loadingTimeout:R?5e3:3e3,compare:function(e,t){return g(e)==g(t)},isPaused:function(){return!1},cache:W,mutate:B,fallback:{}},P),H=function(e,t){var r=d(e,t);if(t){var n=e.use,i=e.fallback,a=t.use,o=t.fallback;n&&a&&(r.use=n.concat(a)),i&&o&&(r.fallback=d(i,o))}return r},q=(0,n.createContext)({}),z=function(e){return f(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(null===e[1]?e[2]:e[1])||{}]},U=function(){return d(G,(0,n.useContext)(q))},J=function(e,t,r){var n=t[e]||(t[e]=[]);return n.push(r),function(){var e=n.indexOf(r);e>=0&&(n[e]=n[n.length-1],n.pop())}},Y={dedupe:!0},Z=(s.defineProperty((function(e){var t=e.value,r=H((0,n.useContext)(q),t),i=t&&t.provider,a=(0,n.useState)((function(){return i?A(i(r.cache||W),t):u}))[0];return a&&(r.cache=a[0],r.mutate=a[1]),S((function(){return a?a[2]:u}),[]),(0,n.createElement)(q.Provider,d(e,{value:r}))}),"default",{value:G}),o=function(e,t,r){var o=r.cache,c=r.compare,s=r.fallbackData,b=r.suspense,y=r.revalidateOnMount,g=r.refreshInterval,h=r.refreshWhenHidden,m=r.refreshWhenOffline,O=_.get(o),w=O[0],x=O[1],j=O[2],E=O[3],P=I(e),C=P[0],T=P[1],R=P[2],N=(0,n.useRef)(!1),L=(0,n.useRef)(!1),A=(0,n.useRef)(C),F=(0,n.useRef)(t),W=(0,n.useRef)(r),B=function(){return W.current},G=function(){return B().isVisible()&&B().isOnline()},H=function(e){return o.set(R,d(o.get(R),e))},q=o.get(C),z=l(s)?r.fallback[C]:s,U=l(q)?z:q,Z=o.get(R)||{},$=Z.error,K=!N.current,Q=function(){return K&&!l(y)?y:!B().isPaused()&&(b?!l(U)&&r.revalidateIfStale:l(U)||r.revalidateIfStale)},X=!(!C||!t)&&(!!Z.isValidating||K&&Q()),ee=function(e,t){var r=(0,n.useState)({})[1],i=(0,n.useRef)(e),a=(0,n.useRef)({data:!1,error:!1,isValidating:!1}),o=(0,n.useCallback)((function(e){var n=!1,o=i.current;for(var c in e){var u=c;o[u]!==e[u]&&(o[u]=e[u],a.current[u]&&(n=!0))}n&&!t.current&&r({})}),[]);return S((function(){i.current=e})),[i,a.current,o]}({data:U,error:$,isValidating:X},L),te=ee[0],re=ee[1],ne=ee[2],ie=(0,n.useCallback)((function(e){return i(void 0,void 0,void 0,(function(){var t,n,i,s,d,p,v,b,y,g,h,m,O;return a(this,(function(a){switch(a.label){case 0:if(t=F.current,!C||!t||L.current||B().isPaused())return[2,!1];s=!0,d=e||{},p=!E[C]||!d.dedupe,v=function(){return!L.current&&C===A.current&&N.current},b=function(){var e=E[C];e&&e[1]===i&&delete E[C]},y={isValidating:!1},g=function(){H({isValidating:!1}),v()&&ne(y)},H({isValidating:!0}),ne({isValidating:!0}),a.label=1;case 1:return a.trys.push([1,3,,4]),p&&(D(o,C,te.current.data,te.current.error,!0),r.loadingTimeout&&!o.get(C)&&setTimeout((function(){s&&v()&&B().onLoadingSlow(C,r)}),r.loadingTimeout),E[C]=[t.apply(void 0,T),M()]),O=E[C],n=O[0],i=O[1],[4,n];case 2:return n=a.sent(),p&&setTimeout(b,r.dedupingInterval),E[C]&&E[C][1]===i?(H({error:u}),y.error=u,h=j[C],!l(h)&&(i<=h[0]||i<=h[1]||0===h[1])?(g(),p&&v()&&B().onDiscarded(C),[2,!1]):(c(te.current.data,n)?y.data=te.current.data:y.data=n,c(o.get(C),n)||o.set(C,n),p&&v()&&B().onSuccess(n,C,r),[3,4])):(p&&v()&&B().onDiscarded(C),[2,!1]);case 3:return m=a.sent(),b(),B().isPaused()||(H({error:m}),y.error=m,p&&v()&&(B().onError(m,C,r),("boolean"==typeof r.shouldRetryOnError&&r.shouldRetryOnError||f(r.shouldRetryOnError)&&r.shouldRetryOnError(m))&&G()&&B().onErrorRetry(m,C,r,ie,{retryCount:(d.retryCount||0)+1,dedupe:!0}))),[3,4];case 4:return s=!1,g(),v()&&p&&D(o,C,y.data,y.error,!1),[2,!0]}}))}))}),[C]),ae=(0,n.useCallback)(V.bind(u,o,(function(){return A.current})),[]);if(S((function(){F.current=t,W.current=r})),S((function(){if(C){var e=C!==A.current,t=ie.bind(u,Y),r=0,n=J(C,x,(function(e,t,r){ne(d({error:t,isValidating:r},c(te.current.data,e)?u:{data:e}))})),i=J(C,w,(function(e){if(0==e){var n=Date.now();B().revalidateOnFocus&&n>r&&G()&&(r=n+B().focusThrottleInterval,t())}else if(1==e)B().revalidateOnReconnect&&G()&&t();else if(2==e)return ie()}));return L.current=!1,A.current=C,N.current=!0,e&&ne({data:U,error:$,isValidating:X}),Q()&&(l(U)||k?t():(a=t,v()&&typeof window.requestAnimationFrame!=p?window.requestAnimationFrame(a):setTimeout(a,1))),function(){L.current=!0,n(),i()}}var a}),[C,ie]),S((function(){var e;function t(){var t=f(g)?g(U):g;t&&-1!==e&&(e=setTimeout(r,t))}function r(){te.current.error||!h&&!B().isVisible()||!m&&!B().isOnline()?t():ie(Y).then(t)}return t(),function(){e&&(clearTimeout(e),e=-1)}}),[g,h,m,ie]),(0,n.useDebugValue)(U),b&&l(U)&&C)throw F.current=t,W.current=r,L.current=!1,l($)?ie(Y):$;return{mutate:ae,get data(){return re.data=!0,U},get error(){return re.error=!0,$},get isValidating(){return re.isValidating=!0,X}}},function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=U(),n=z(e),i=n[0],a=n[1],c=n[2],u=H(r,c),s=o,l=u.use;if(l)for(var f=l.length;f-- >0;)s=l[f](s);return s(i,a||u.fetcher,u)})}}]);
@@ -0,0 +1,20 @@
1
+ /*!
2
+ Copyright (c) 2018 Jed Watson.
3
+ Licensed under the MIT License (MIT), see
4
+ http://jedwatson.github.io/classnames
5
+ */
6
+
7
+ /*! *****************************************************************************
8
+ Copyright (c) Microsoft Corporation.
9
+
10
+ Permission to use, copy, modify, and/or distribute this software for any
11
+ purpose with or without fee is hereby granted.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
14
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
15
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
16
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
17
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
18
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19
+ PERFORMANCE OF THIS SOFTWARE.
20
+ ***************************************************************************** */
@@ -0,0 +1 @@
1
+ System.register("@kenyaemr/esm-patient-flags-app",[],function(a,b){var c=void 0;return{execute:function(){a((()=>{function j(a){var b=m[a];if(void 0!==b)return b.exports;var c=m[a]={id:a,loaded:!1,exports:{}};return G[a].call(c.exports,c,c.exports,j),c.loaded=!0,c.exports}var g,k,q,w,x,y,z,A,B,C,r,D,E,F,G={3959:(a,b,c)=>{(0,c(6907).s)(1)},6907:(a,b,c)=>{const d=c(3541).R;b.s=function(a){if(a||(a=1),!c.y.meta||!c.y.meta.url)throw console.error("__system_context__",c.y),Error("systemjs-webpack-interop was provided an unknown SystemJS context. Expected context.meta.url, but none was provided");c.p=d(c.y.meta.url,a)}},5384:(a,b,c)=>{c(3959)},3541:(a,b)=>{b.R=function(b,c){var d=document.createElement("a");d.href=b;for(var e="/"===d.pathname[0]?d.pathname:"/"+d.pathname,f=0,g=e.length;f!==c&&0<=g;)"/"===e[--g]&&f++;if(f!==c)throw Error("systemjs-webpack-interop: rootDirectoryLevel ("+c+") is greater than the number of directories ("+f+") in the URL path "+b);var h=e.slice(0,g+1);return d.protocol+"//"+d.host+h},Number.isInteger},1761:(b,d,f)=>{var g={app:()=>(c||((self.webpackChunk_kenyaemr_esm_patient_flags_app=self.webpackChunk_kenyaemr_esm_patient_flags_app||[]).push([[150],{150:(b,c,d)=>{function a(){return(0,e.defineConfigSchema)("@kenyaemr/esm-patient-flags-app",f),{pages:[],extensions:[{name:"patient-flag",slot:"top-of-all-patient-dashboards-slot",load:(0,e.getAsyncLifecycle)(function(){return Promise.all([d.e(871),d.e(902),d.e(865)]).then(d.bind(d,2455))},{featureName:"patient-flags",moduleName:"@kenyaemr/esm-patient-flags-app"}),online:!0,offline:!1}]}}d.r(c),d.d(c,{backendDependencies:()=>h,importTranslation:()=>g,setupOpenMRS:()=>a,assets:()=>["kenyaemr-esm-core-app.js","236.js","248.js","402.js","574.js","635.js","784.js","858.js","865.js","871.js"]});var e=d(3066),f={},g=d(3979),h={kenyaemr:"^18.2.0"}},3979:(b,c,d)=>{function a(a){if(!d.o(f,a))return Promise.resolve().then(()=>{var b=new Error("Cannot find module '"+a+"'");throw b.code="MODULE_NOT_FOUND",b});var b=f[a],c=b[0];return d.e(b[1]).then(()=>d(c))}var f={"./en.json":[3574,574],"./sw.json":[236,236]};a.keys=()=>Object.keys(f),a.id=3979,b.exports=a}}]),c=f.e(150).then(()=>()=>f(150))),c)},e=(a,b)=>(f.R=b,b=f.o(g,a)?g[a]():Promise.resolve().then(()=>{throw new Error("Module \""+a+"\" does not exist in container.")}),f.R=void 0,b),h=(a,b)=>{if(f.S){var c=f.S["default"];if(c&&c!==a)throw new Error("Container initialization failed as it has already been initialized with a different share scope");return f.S["default"]=a,f.I("default",b)}};f.d(d,{get:()=>e,init:()=>h})}},m={};return j.m=G,j.c=m,j.y=b,j.n=a=>{var b=a&&a.__esModule?()=>a.default:()=>a;return j.d(b,{a:b}),b},j.d=(a,b)=>{for(var c in b)j.o(b,c)&&!j.o(a,c)&&Object.defineProperty(a,c,{enumerable:!0,get:b[c]})},j.f={},j.e=a=>Promise.all(Object.keys(j.f).reduce((b,c)=>(j.f[c](a,b),b),[])),j.u=a=>a+".js",j.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(a){if("object"==typeof window)return window}}(),j.o=(a,b)=>Object.prototype.hasOwnProperty.call(a,b),g={},k="@kenyaemr/esm-patient-flags-app:",j.l=(a,b,c)=>{if(g[a])g[a].push(b);else{var e,h;if(void 0!==c)for(var m,n=document.getElementsByTagName("script"),l=0;l<n.length;l++)if(m=n[l],m.getAttribute("src")==a||m.getAttribute("data-webpack")==k+c){e=m;break}e||(h=!0,(e=document.createElement("script")).charset="utf-8",e.timeout=120,j.nc&&e.setAttribute("nonce",j.nc),e.setAttribute("data-webpack",k+c),e.src=a),g[a]=[b];var o=(b,c)=>{e.onerror=e.onload=null,clearTimeout(p);var d=g[a];if(delete g[a],e.parentNode&&e.parentNode.removeChild(e),d&&d.forEach(a=>a(c)),b)return b(c)},p=setTimeout(o.bind(null,void 0,{type:"timeout",target:e}),12e4);e.onerror=o.bind(null,e.onerror),e.onload=o.bind(null,e.onload),h&&document.head.appendChild(e)}},j.r=a=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(a,"__esModule",{value:!0})},j.nmd=a=>(a.paths=[],a.children||(a.children=[]),a),(()=>{j.S={};var b={},c={};j.I=(d,e)=>{e||(e=[]);var f=c[d];if(f||(f=c[d]={}),!(0<=e.indexOf(f))){if(e.push(f),b[d])return b[d];j.o(j.S,d)||(j.S[d]={});var g=j.S[d],a=(a,b,c,d)=>{var e=g[a]=g[a]||{},f=e[b];f&&(f.loaded||(!d==!f.eager?!("@kenyaemr/esm-patient-flags-app">f.from):!d))||(e[b]={get:c,from:"@kenyaemr/esm-patient-flags-app",eager:!!d})},h=[];return"default"===d&&(a("@openmrs/esm-framework","3.4.1-pre.139",()=>Promise.all([j.e(858),j.e(902)]).then(()=>()=>j(6858))),a("carbon-components","10.31.0",()=>j.e(635).then(()=>()=>j(9635))),a("carbon-icons","7.0.7",()=>j.e(402).then(()=>()=>j(5402))),a("react-i18next","11.17.2",()=>Promise.all([j.e(248),j.e(902)]).then(()=>()=>j(3248))),a("react","16.14.0",()=>j.e(784).then(()=>()=>j(2784)))),b[d]=h.length?Promise.all(h).then(()=>b[d]=1):1}}})(),j.p="",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},w=(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],g=(typeof f)[0];if(d>=c.length)return"u"==g;var a=c[d],h=(typeof a)[0];if(g!=h)return"o"==g&&"n"==h||"s"==h||"u"==g;if("o"!=g&&"u"!=g&&f!=a)return f<a;d++}},x=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():x(h))}return b()},y=(b,e)=>{if(0 in b){e=q(e);var g=b[0],i=0>g;i&&(g=-g-1);for(var j=0,k=1,m=!0;;k++,j++){var n,o,v=k<b.length?(typeof b[k])[0]:"";if(j>=e.length||"o"==(o=(typeof(n=e[j]))[0]))return!m||("u"==v?k>g&&!i:""==v!=i);if("u"==o){if(!m||"u"!=v)return!1;}else if(!m)"s"!=v&&"n"!=v&&(m=!1,k--);else if(v==o){if(!(k<=g)){if(i?n>b[k]:n<b[k])return!1;n!=b[k]&&(m=!1)}else if(n!=b[k])return!1;}else if("s"!=v&&"n"!=v){if(i||k<=g)return!1;m=!1,k--}else{if(k<=g||o<v!=i)return!1;m=!1}}}var p=[],d=p.pop.bind(p);for(j=1;j<b.length;j++){var c=b[j];p.push(1==c?d()|d():2==c?d()&d():c?y(c,e):!d())}return!!d()},z=(a,b)=>{var c=a[b];return Object.keys(c).reduce((a,b)=>a&&(c[a].loaded||!w(a,b))?a:b,0)},A=(a,b,c,d)=>"Unsatisfied version "+c+" from "+(c&&a[b][c].from)+" of shared singleton module "+b+" (required "+x(d)+")",B=(a,b,c,d)=>{var e=z(a,c);return y(d,e)||"undefined"!=typeof console&&console.warn&&console.warn(A(a,c,e,d)),C(a[c][e])},C=a=>(a.loaded=1,a.get()),r=(b=>function(c,d,e,f){var g=j.I(c);return g&&g.then?g.then(b.bind(b,c,j.S[c],d,e,f)):b(0,j.S[c],d,e,f)})((a,b,c,d,e)=>b&&j.o(b,c)?B(b,0,c,d):e()),D={},E={3066:()=>r("default","@openmrs/esm-framework",[1,3],()=>Promise.all([j.e(858),j.e(902)]).then(()=>()=>j(6858))),9902:()=>r("default","react",[1,16],()=>j.e(784).then(()=>()=>j(2784))),4924:()=>r("default","react-i18next",[1,11],()=>j.e(248).then(()=>()=>j(3248))),8479:()=>r("default","carbon-components",[1,10],()=>j.e(635).then(()=>()=>j(9635)))},F={150:[3066],865:[4924,8479],902:[9902]},j.f.consumes=(a,b)=>{j.o(F,a)&&F[a].forEach(a=>{if(j.o(D,a))return b.push(D[a]);var c=b=>{D[a]=0,j.m[a]=c=>{delete j.c[a],c.exports=b()}},d=b=>{delete D[a],j.m[a]=()=>{throw delete j.c[a],b}};try{var e=E[a]();e.then?b.push(D[a]=e.then(c).catch(d)):c(e)}catch(a){d(a)}})},(()=>{var b={158:0};j.f.j=(c,d)=>{var e=j.o(b,c)?b[c]:void 0;if(0!==e)if(e)d.push(e[2]);else if(902!=c){var f=new Promise((a,d)=>e=b[c]=[a,d]);d.push(e[2]=f);var g=j.p+j.u(c),h=new Error;j.l(g,d=>{if(j.o(b,c)&&(0!==(e=b[c])&&(b[c]=void 0),e)){var f=d&&("load"===d.type?"missing":d.type),g=d&&d.target&&d.target.src;h.message="Loading chunk "+c+" failed.\n("+f+": "+g+")",h.name="ChunkLoadError",h.type=f,h.request=g,e[1](h)}},"chunk-"+c,c)}else b[c]=0};var a=(c,d)=>{var e,f,[g,a,h]=d,i=0;if(g.some(a=>0!==b[a])){for(e in a)j.o(a,e)&&(j.m[e]=a[e]);h&&h(j)}for(c&&c(d);i<g.length;i++)f=g[i],j.o(b,f)&&b[f]&&b[f][0](),b[f]=0},c=self.webpackChunk_kenyaemr_esm_patient_flags_app=self.webpackChunk_kenyaemr_esm_patient_flags_app||[];c.forEach(a.bind(null,0)),c.push=a.bind(null,c.push.bind(c))})(),j.nc=void 0,j(5384),j(1761)})())}}});
@@ -0,0 +1,276 @@
1
+ {
2
+ "chunks": [
3
+ {
4
+ "rendered": true,
5
+ "initial": false,
6
+ "entry": false,
7
+ "recorded": false,
8
+ "size": 1215,
9
+ "sizes": {
10
+ "javascript": 1173,
11
+ "consume-shared": 42
12
+ },
13
+ "names": [],
14
+ "idHints": [],
15
+ "runtime": [
16
+ "@kenyaemr/esm-patient-flags-app"
17
+ ],
18
+ "files": [
19
+ "150.js"
20
+ ],
21
+ "auxiliaryFiles": [],
22
+ "hash": "fb38572e274c408fdcdf",
23
+ "childrenByOrder": {}
24
+ },
25
+ {
26
+ "rendered": true,
27
+ "initial": true,
28
+ "entry": true,
29
+ "recorded": false,
30
+ "size": 22168,
31
+ "sizes": {
32
+ "javascript": 3409,
33
+ "share-init": 210,
34
+ "runtime": 18549
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": "331093bfabadaab404ec",
48
+ "childrenByOrder": {}
49
+ },
50
+ {
51
+ "rendered": true,
52
+ "initial": false,
53
+ "entry": false,
54
+ "recorded": false,
55
+ "size": 12,
56
+ "sizes": {
57
+ "javascript": 12
58
+ },
59
+ "names": [],
60
+ "idHints": [],
61
+ "runtime": [
62
+ "@kenyaemr/esm-patient-flags-app"
63
+ ],
64
+ "files": [
65
+ "236.js"
66
+ ],
67
+ "auxiliaryFiles": [],
68
+ "hash": "c8b53376a09a055a1ea8",
69
+ "childrenByOrder": {}
70
+ },
71
+ {
72
+ "rendered": true,
73
+ "initial": false,
74
+ "entry": false,
75
+ "recorded": false,
76
+ "reason": "reused as split chunk (cache group: defaultVendors)",
77
+ "size": 40327,
78
+ "sizes": {
79
+ "javascript": 40327
80
+ },
81
+ "names": [],
82
+ "idHints": [
83
+ "vendors"
84
+ ],
85
+ "runtime": [
86
+ "@kenyaemr/esm-patient-flags-app"
87
+ ],
88
+ "files": [
89
+ "248.js"
90
+ ],
91
+ "auxiliaryFiles": [],
92
+ "hash": "872d5b6f19f0d92bdd17",
93
+ "childrenByOrder": {}
94
+ },
95
+ {
96
+ "rendered": true,
97
+ "initial": false,
98
+ "entry": false,
99
+ "recorded": false,
100
+ "reason": "reused as split chunk (cache group: defaultVendors)",
101
+ "size": 109242,
102
+ "sizes": {
103
+ "javascript": 109242
104
+ },
105
+ "names": [],
106
+ "idHints": [
107
+ "vendors"
108
+ ],
109
+ "runtime": [
110
+ "@kenyaemr/esm-patient-flags-app"
111
+ ],
112
+ "files": [
113
+ "402.js"
114
+ ],
115
+ "auxiliaryFiles": [],
116
+ "hash": "3488b98e60810b32cf9c",
117
+ "childrenByOrder": {}
118
+ },
119
+ {
120
+ "rendered": true,
121
+ "initial": false,
122
+ "entry": false,
123
+ "recorded": false,
124
+ "size": 76,
125
+ "sizes": {
126
+ "javascript": 76
127
+ },
128
+ "names": [],
129
+ "idHints": [],
130
+ "runtime": [
131
+ "@kenyaemr/esm-patient-flags-app"
132
+ ],
133
+ "files": [
134
+ "574.js"
135
+ ],
136
+ "auxiliaryFiles": [],
137
+ "hash": "cd5d44d8b2d86d900a75",
138
+ "childrenByOrder": {}
139
+ },
140
+ {
141
+ "rendered": true,
142
+ "initial": false,
143
+ "entry": false,
144
+ "recorded": false,
145
+ "reason": "reused as split chunk (cache group: defaultVendors)",
146
+ "size": 586941,
147
+ "sizes": {
148
+ "javascript": 586941
149
+ },
150
+ "names": [],
151
+ "idHints": [
152
+ "vendors"
153
+ ],
154
+ "runtime": [
155
+ "@kenyaemr/esm-patient-flags-app"
156
+ ],
157
+ "files": [
158
+ "635.js"
159
+ ],
160
+ "auxiliaryFiles": [],
161
+ "hash": "d7733fcc05316d26ee65",
162
+ "childrenByOrder": {}
163
+ },
164
+ {
165
+ "rendered": true,
166
+ "initial": false,
167
+ "entry": false,
168
+ "recorded": false,
169
+ "size": 8973,
170
+ "sizes": {
171
+ "javascript": 8973
172
+ },
173
+ "names": [],
174
+ "idHints": [],
175
+ "runtime": [
176
+ "@kenyaemr/esm-patient-flags-app"
177
+ ],
178
+ "files": [
179
+ "784.js"
180
+ ],
181
+ "auxiliaryFiles": [],
182
+ "hash": "1f4fb51289465bbf6532",
183
+ "childrenByOrder": {}
184
+ },
185
+ {
186
+ "rendered": true,
187
+ "initial": false,
188
+ "entry": false,
189
+ "recorded": false,
190
+ "reason": "split chunk (cache group: defaultVendors)",
191
+ "size": 761616,
192
+ "sizes": {
193
+ "javascript": 761616
194
+ },
195
+ "names": [],
196
+ "idHints": [
197
+ "vendors"
198
+ ],
199
+ "runtime": [
200
+ "@kenyaemr/esm-patient-flags-app"
201
+ ],
202
+ "files": [
203
+ "858.js"
204
+ ],
205
+ "auxiliaryFiles": [],
206
+ "hash": "232e606a53a503d4ada5",
207
+ "childrenByOrder": {}
208
+ },
209
+ {
210
+ "rendered": true,
211
+ "initial": false,
212
+ "entry": false,
213
+ "recorded": false,
214
+ "size": 4015,
215
+ "sizes": {
216
+ "javascript": 3931,
217
+ "consume-shared": 84
218
+ },
219
+ "names": [],
220
+ "idHints": [],
221
+ "runtime": [
222
+ "@kenyaemr/esm-patient-flags-app"
223
+ ],
224
+ "files": [
225
+ "865.js"
226
+ ],
227
+ "auxiliaryFiles": [],
228
+ "hash": "eaba1470fa5efd73746e",
229
+ "childrenByOrder": {}
230
+ },
231
+ {
232
+ "rendered": true,
233
+ "initial": false,
234
+ "entry": false,
235
+ "recorded": false,
236
+ "reason": "split chunk (cache group: defaultVendors)",
237
+ "size": 301804,
238
+ "sizes": {
239
+ "javascript": 301804
240
+ },
241
+ "names": [],
242
+ "idHints": [
243
+ "vendors"
244
+ ],
245
+ "runtime": [
246
+ "@kenyaemr/esm-patient-flags-app"
247
+ ],
248
+ "files": [
249
+ "871.js"
250
+ ],
251
+ "auxiliaryFiles": [],
252
+ "hash": "30f37314815768d4b7d8",
253
+ "childrenByOrder": {}
254
+ },
255
+ {
256
+ "rendered": false,
257
+ "initial": false,
258
+ "entry": false,
259
+ "recorded": false,
260
+ "reason": "reused as split chunk (cache group: default)",
261
+ "size": 42,
262
+ "sizes": {
263
+ "consume-shared": 42
264
+ },
265
+ "names": [],
266
+ "idHints": [],
267
+ "runtime": [
268
+ "@kenyaemr/esm-patient-flags-app"
269
+ ],
270
+ "files": [],
271
+ "auxiliaryFiles": [],
272
+ "hash": "19146b7fff0209dbb87b",
273
+ "childrenByOrder": {}
274
+ }
275
+ ]
276
+ }
@@ -0,0 +1 @@
1
+ System.register("@kenyaemr/esm-patient-flags-app",[],(function(e,r){return{execute:function(){e((()=>{var e,t,n,o,a,i,s,l,u,f,p,d,c,h,m={3959:(e,r,t)=>{(0,t(6907).s)(1)},6907:(e,r,t)=>{const n=t(3541).R;r.s=function(e){if(e||(e=1),!t.y.meta||!t.y.meta.url)throw console.error("__system_context__",t.y),Error("systemjs-webpack-interop was provided an unknown SystemJS context. Expected context.meta.url, but none was provided");t.p=n(t.y.meta.url,e)}},5384:(e,r,t)=>{t(3959)},3541:(e,r,t)=>{r.R=function(e,r){var t=document.createElement("a");t.href=e;for(var n="/"===t.pathname[0]?t.pathname:"/"+t.pathname,o=0,a=n.length;o!==r&&a>=0;)"/"===n[--a]&&o++;if(o!==r)throw Error("systemjs-webpack-interop: rootDirectoryLevel ("+r+") is greater than the number of directories ("+o+") in the URL path "+e);var i=n.slice(0,a+1);return t.protocol+"//"+t.host+i};Number.isInteger},1761:(e,r,t)=>{"use strict";var n={app:()=>t.e(150).then((()=>()=>t(150)))},o=(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),a=(e,r)=>{if(t.S){var n="default",o=t.S[n];if(o&&o!==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:()=>o,init:()=>a})}},v={};function g(e){var r=v[e];if(void 0!==r)return r.exports;var t=v[e]={id:e,loaded:!1,exports:{}};return m[e].call(t.exports,t,t.exports,g),t.loaded=!0,t.exports}return g.m=m,g.c=v,g.y=r,g.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return g.d(r,{a:r}),r},g.d=(e,r)=>{for(var t in r)g.o(r,t)&&!g.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},g.f={},g.e=e=>Promise.all(Object.keys(g.f).reduce(((r,t)=>(g.f[t](e,r),r)),[])),g.u=e=>e+".js",g.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),g.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),e={},t="@kenyaemr/esm-patient-flags-app:",g.l=(r,n,o,a)=>{if(e[r])e[r].push(n);else{var i,s;if(void 0!==o)for(var l=document.getElementsByTagName("script"),u=0;u<l.length;u++){var f=l[u];if(f.getAttribute("src")==r||f.getAttribute("data-webpack")==t+o){i=f;break}}i||(s=!0,(i=document.createElement("script")).charset="utf-8",i.timeout=120,g.nc&&i.setAttribute("nonce",g.nc),i.setAttribute("data-webpack",t+o),i.src=r),e[r]=[n];var p=(t,n)=>{i.onerror=i.onload=null,clearTimeout(d);var o=e[r];if(delete e[r],i.parentNode&&i.parentNode.removeChild(i),o&&o.forEach((e=>e(n))),t)return t(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),s&&document.head.appendChild(i)}},g.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},g.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{g.S={};var e={},r={};g.I=(t,n)=>{n||(n=[]);var o=r[t];if(o||(o=r[t]={}),!(n.indexOf(o)>=0)){if(n.push(o),e[t])return e[t];g.o(g.S,t)||(g.S[t]={});var a=g.S[t],i="@kenyaemr/esm-patient-flags-app",s=(e,r,t,n)=>{var o=a[e]=a[e]||{},s=o[r];(!s||!s.loaded&&(!n!=!s.eager?n:i>s.from))&&(o[r]={get:t,from:i,eager:!!n})},l=[];return"default"===t&&(s("@openmrs/esm-framework","3.4.1-pre.139",(()=>Promise.all([g.e(858),g.e(902)]).then((()=>()=>g(6858))))),s("carbon-components","10.31.0",(()=>g.e(635).then((()=>()=>g(9635))))),s("carbon-icons","7.0.7",(()=>g.e(402).then((()=>()=>g(5402))))),s("react-i18next","11.17.2",(()=>Promise.all([g.e(248),g.e(902)]).then((()=>()=>g(3248))))),s("react","16.14.0",(()=>g.e(784).then((()=>()=>g(2784)))))),e[t]=l.length?Promise.all(l).then((()=>e[t]=1)):1}}})(),g.p="",n=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},o=(e,r)=>{e=n(e),r=n(r);for(var t=0;;){if(t>=e.length)return t<r.length&&"u"!=(typeof r[t])[0];var o=e[t],a=(typeof o)[0];if(t>=r.length)return"u"==a;var i=r[t],s=(typeof i)[0];if(a!=s)return"o"==a&&"n"==s||"s"==s||"u"==a;if("o"!=a&&"u"!=a&&o!=i)return o<i;t++}},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(s=e[o]))[0]?"-":(n>0?".":"")+(n=2,s);return t}var i=[];for(o=1;o<e.length;o++){var s=e[o];i.push(0===s?"not("+l()+")":1===s?"("+l()+" || "+l()+")":2===s?i.pop()+" "+i.pop():a(s))}return l();function l(){return i.pop().replace(/^\((.+)\)$/,"$1")}},i=(e,r)=>{if(0 in e){r=n(r);var t=e[0],o=t<0;o&&(t=-t-1);for(var a=0,s=1,l=!0;;s++,a++){var u,f,p=s<e.length?(typeof e[s])[0]:"";if(a>=r.length||"o"==(f=(typeof(u=r[a]))[0]))return!l||("u"==p?s>t&&!o:""==p!=o);if("u"==f){if(!l||"u"!=p)return!1}else if(l)if(p==f)if(s<=t){if(u!=e[s])return!1}else{if(o?u>e[s]:u<e[s])return!1;u!=e[s]&&(l=!1)}else if("s"!=p&&"n"!=p){if(o||s<=t)return!1;l=!1,s--}else{if(s<=t||f<p!=o)return!1;l=!1}else"s"!=p&&"n"!=p&&(l=!1,s--)}}var d=[],c=d.pop.bind(d);for(a=1;a<e.length;a++){var h=e[a];d.push(1==h?c()|c():2==h?c()&c():h?i(h,r):!c())}return!!c()},s=(e,r)=>{var t=e[r];return Object.keys(t).reduce(((e,r)=>!e||!t[e].loaded&&o(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)+")",u=(e,r,t,n)=>{var o=s(e,t);return i(n,o)||"undefined"!=typeof console&&console.warn&&console.warn(l(e,t,o,n)),f(e[t][o])},f=e=>(e.loaded=1,e.get()),p=(e=>function(r,t,n,o){var a=g.I(r);return a&&a.then?a.then(e.bind(e,r,g.S[r],t,n,o)):e(0,g.S[r],t,n,o)})(((e,r,t,n,o)=>r&&g.o(r,t)?u(r,0,t,n):o())),d={},c={3066:()=>p("default","@openmrs/esm-framework",[1,3],(()=>Promise.all([g.e(858),g.e(902)]).then((()=>()=>g(6858))))),9902:()=>p("default","react",[1,16],(()=>g.e(784).then((()=>()=>g(2784))))),4924:()=>p("default","react-i18next",[1,11],(()=>g.e(248).then((()=>()=>g(3248))))),8479:()=>p("default","carbon-components",[1,10],(()=>g.e(635).then((()=>()=>g(9635)))))},h={150:[3066],865:[4924,8479],902:[9902]},g.f.consumes=(e,r)=>{g.o(h,e)&&h[e].forEach((e=>{if(g.o(d,e))return r.push(d[e]);var t=r=>{d[e]=0,g.m[e]=t=>{delete g.c[e],t.exports=r()}},n=r=>{delete d[e],g.m[e]=t=>{throw delete g.c[e],r}};try{var o=c[e]();o.then?r.push(d[e]=o.then(t).catch(n)):t(o)}catch(e){n(e)}}))},(()=>{var e={158:0};g.f.j=(r,t)=>{var n=g.o(e,r)?e[r]:void 0;if(0!==n)if(n)t.push(n[2]);else if(902!=r){var o=new Promise(((t,o)=>n=e[r]=[t,o]));t.push(n[2]=o);var a=g.p+g.u(r),i=new Error;g.l(a,(t=>{if(g.o(e,r)&&(0!==(n=e[r])&&(e[r]=void 0),n)){var o=t&&("load"===t.type?"missing":t.type),a=t&&t.target&&t.target.src;i.message="Loading chunk "+r+" failed.\n("+o+": "+a+")",i.name="ChunkLoadError",i.type=o,i.request=a,n[1](i)}}),"chunk-"+r,r)}else e[r]=0};var r=(r,t)=>{var n,o,[a,i,s]=t,l=0;if(a.some((r=>0!==e[r]))){for(n in i)g.o(i,n)&&(g.m[n]=i[n]);s&&s(g)}for(r&&r(t);l<a.length;l++)o=a[l],g.o(e,o)&&e[o]&&e[o][0](),e[o]=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))})(),g.nc=void 0,g(5384),g(1761)})())}}}));
package/package.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "@kenyaemr/esm-patient-flags-app",
3
+ "version": "3.1.1-pre.2",
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/charts-react": "^0.41.14",
38
+ "@carbon/icons-react": "^10.18.0",
39
+ "carbon-components-react": "^7.25.0",
40
+ "d3": "^5.16.0",
41
+ "lodash-es": "^4.17.15"
42
+ },
43
+ "peerDependencies": {
44
+ "@openmrs/esm-framework": "3.x",
45
+ "carbon-components": "10.x",
46
+ "carbon-icons": "7.x",
47
+ "react": "16.x",
48
+ "react-i18next": "11.x",
49
+ "react-router-dom": "5.x",
50
+ "rxjs": "6.x"
51
+ },
52
+ "gitHead": "6c8838d629779d308f1115660428228a79e740a8"
53
+ }
@@ -0,0 +1 @@
1
+ export const configSchema = {};
@@ -0,0 +1,2 @@
1
+ declare module '*.css';
2
+ declare module '*.scss';
@@ -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-components-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,6 @@
1
+ @import '~@openmrs/esm-styleguide/src/vars';
2
+ @import '~carbon-components/src/globals/scss/vars';
3
+
4
+ .flagContainer {
5
+ margin: $spacing-05;
6
+ }
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import { screen, render } from '@testing-library/react';
3
+ import PatientFlags from './patient-flags.component';
4
+ import * as mockUsePatientFlags from '../hooks/usePatientFlags';
5
+
6
+ describe('<PatientFlags/>', () => {
7
+ afterEach(() => {
8
+ jest.resetAllMocks();
9
+ });
10
+
11
+ test('should display patient flags', () => {
12
+ spyOn(mockUsePatientFlags, 'usePatientFlags').and.returnValue({
13
+ isLoading: false,
14
+ patientFlags: ['hiv', 'cancer'],
15
+ error: null,
16
+ });
17
+
18
+ render(<PatientFlags patientUuid="some-patient-uuid" />);
19
+ expect(screen.getByText(/^hiv$/i)).toBeInTheDocument();
20
+ expect(screen.getByText(/^cancer$/i)).toBeInTheDocument();
21
+ });
22
+ });
@@ -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;
package/src/root.scss ADDED
File without changes
File without changes
@@ -0,0 +1,4 @@
1
+ {
2
+ "errorPatientFlags": "Patient flags error",
3
+ "loading": "Loading..."
4
+ }
@@ -0,0 +1 @@
1
+ {}
package/tsconfig.json ADDED
@@ -0,0 +1,5 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "include": ["src/**/*"],
4
+ "exclude": ["src/**/*.test.tsx", "src/**/*.outdated.tsx"]
5
+ }
@@ -0,0 +1 @@
1
+ module.exports = require('openmrs/default-webpack-config');