@clinicemr/esm-post-registration-redirect-app 1.0.0 → 1.1.0

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/dist/173.js CHANGED
@@ -1 +1 @@
1
- (globalThis.webpackChunk_clinicemr_esm_post_registration_redirect_app=globalThis.webpackChunk_clinicemr_esm_post_registration_redirect_app||[]).push([[173],{6173(e,t,r){"use strict";r.r(t),r.d(t,{importTranslation:()=>o,myRegisteredPatients:()=>d,postRegistrationRedirect:()=>p,startupApp:()=>c});var i=r(5940),n={registrationClerkRoleName:{_type:i.Type.String,_default:"Organizational: Registration Clerk",_description:"Name of the OpenMRS role that, when held by the current user, makes the post-registration page redirect to the My Registered Patients list instead of the patient chart."},registeredPatientsListPath:{_type:i.Type.String,_default:"my-registered-patients",_description:"SPA-relative path to redirect Registration Clerks to after a successful registration."},registrationEncounterTypeUuid:{_type:i.Type.String,_default:"dd528487-82a5-4082-9c72-ed246bd49591",_description:"UUID of the encounter type recorded during patient registration. Used to look up patients registered by the current user."},pageSize:{_type:i.Type.Number,_default:25,_description:"Maximum number of recent registrations to load for the My Registered Patients list."}},s="@clinicemr/esm-post-registration-redirect-app",a={featureName:"post-registration-redirect",moduleName:s},o=r(4767);function c(){(0,i.defineConfigSchema)(s,n)}var p=(0,i.getAsyncLifecycle)((function(){return Promise.all([r.e(803),r.e(343),r.e(339),r.e(918)]).then(r.bind(r,2918))}),a),d=(0,i.getAsyncLifecycle)((function(){return Promise.all([r.e(803),r.e(686),r.e(343),r.e(339),r.e(802)]).then(r.bind(r,5802))}),a)},4767(e,t,r){var i={"./en.json":[4300,[300]]};function n(e){try{if(!r.o(i,e))return Promise.resolve().then((()=>{var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}))}catch(e){return Promise.reject(e)}var t=i[e],n=t[0];return r.e(t[1][0]).then((()=>r(n)))}n.keys=()=>Object.keys(i),n.id=4767,e.exports=n}}]);
1
+ (globalThis.webpackChunk_clinicemr_esm_post_registration_redirect_app=globalThis.webpackChunk_clinicemr_esm_post_registration_redirect_app||[]).push([[173],{6173(e,t,r){"use strict";r.r(t),r.d(t,{importTranslation:()=>a,myRegisteredPatients:()=>p,postRegistrationRedirect:()=>d,registrationClerkLockdown:()=>l,startupApp:()=>c});var i=r(5940),n={registrationClerkRoleName:{_type:i.Type.String,_default:"Organizational: Registration Clerk",_description:"Name of the OpenMRS role that, when held by the current user, makes the post-registration page redirect to the My Registered Patients list instead of the patient chart."},registeredPatientsListPath:{_type:i.Type.String,_default:"my-registered-patients",_description:"SPA-relative path to redirect Registration Clerks to after a successful registration."},registrationEncounterTypeUuid:{_type:i.Type.String,_default:"dd528487-82a5-4082-9c72-ed246bd49591",_description:"UUID of the encounter type recorded during patient registration. Used to look up patients registered by the current user."},pageSize:{_type:i.Type.Number,_default:25,_description:"Maximum number of recent registrations to load for the My Registered Patients list."}},s="@clinicemr/esm-post-registration-redirect-app",o={featureName:"post-registration-redirect",moduleName:s},a=r(4767);function c(){(0,i.defineConfigSchema)(s,n)}var d=(0,i.getAsyncLifecycle)((function(){return Promise.all([r.e(803),r.e(343),r.e(339),r.e(918)]).then(r.bind(r,2918))}),o),p=(0,i.getAsyncLifecycle)((function(){return Promise.all([r.e(803),r.e(686),r.e(343),r.e(339),r.e(802)]).then(r.bind(r,5802))}),o),l=(0,i.getAsyncLifecycle)((function(){return Promise.all([r.e(343),r.e(312)]).then(r.bind(r,3312))}),o)},4767(e,t,r){var i={"./en.json":[4300,[300]]};function n(e){try{if(!r.o(i,e))return Promise.resolve().then((()=>{var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}))}catch(e){return Promise.reject(e)}var t=i[e],n=t[0];return r.e(t[1][0]).then((()=>r(n)))}n.keys=()=>Object.keys(i),n.id=4767,e.exports=n}}]);
package/dist/312.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";(globalThis.webpackChunk_clinicemr_esm_post_registration_redirect_app=globalThis.webpackChunk_clinicemr_esm_post_registration_redirect_app||[]).push([[312],{3312(e,t,n){n.r(t),n.d(t,{default:()=>c});var o=n(1343),i=n(5940),a=["patient-registration","my-registered-patients","post-registration","login","logout"],r="registration-clerk-mode",s="registration-clerk-lockdown-style",d="\nbody.".concat(r,' [data-testid="appSearchIconButton"],\nbody.').concat(r,' [data-testid="appSearchBar"],\nbody.').concat(r,' [data-testid="appMenuButton"],\nbody.').concat(r,' [data-testid="offlineToolsMenuButton"],\nbody.').concat(r,' [data-testid="implementerToolsIcon"] {\n display: none !important;\n}\n');const c=function(){var e=(0,i.useSession)(),t=(0,i.useConfig)();return(0,o.useEffect)((function(){var n;if(null==e?void 0:e.user){if((null!==(n=e.user.roles)&&void 0!==n?n:[]).map((function(e){var t,n;return String(null!==(t=null!==(n=e.display)&&void 0!==n?n:e.name)&&void 0!==t?t:"")})).some((function(e){return e.trim().toLowerCase()===t.registrationClerkRoleName.trim().toLowerCase()}))){document.body.classList.add(r),function(){if(!document.getElementById(s)){var e=document.createElement("style");e.id=s,e.textContent=d,document.head.appendChild(e)}}();var o=function(){var e=(window.location.pathname.replace(/^\/openmrs\/spa\/?/,"").replace(/^\/+/,"").split("/")[0]||"").toLowerCase();e&&(a.includes(e)||(0,i.navigate)({to:"${openmrsSpaBase}/".concat(t.registeredPatientsListPath)}))};o();var c=function(){return o()};return window.addEventListener("single-spa:before-routing-event",c),window.addEventListener("popstate",c),function(){window.removeEventListener("single-spa:before-routing-event",c),window.removeEventListener("popstate",c)}}document.body.classList.remove(r)}}),[e,t.registrationClerkRoleName,t.registeredPatientsListPath]),null}}}]);
package/dist/main.js CHANGED
@@ -1 +1 @@
1
- (()=>{var e,r,t,n,o={6173(e,r,t){"use strict";var n=t(5940),o={featureName:"post-registration-redirect",moduleName:(n.Type.String,n.Type.String,n.Type.String,n.Type.Number,"@clinicemr/esm-post-registration-redirect-app")};t(4767),(0,n.getAsyncLifecycle)((function(){return Promise.all([t.e(803),t.e(343),t.e(339),t.e(918)]).then(t.bind(t,2918))}),o),(0,n.getAsyncLifecycle)((function(){return Promise.all([t.e(803),t.e(686),t.e(343),t.e(339),t.e(802)]).then(t.bind(t,5802))}),o)},4767(e,r,t){var n={"./en.json":[4300,[300]]};function o(e){try{if(!t.o(n,e))return Promise.resolve().then((()=>{var r=new Error("Cannot find module '"+e+"'");throw r.code="MODULE_NOT_FOUND",r}))}catch(e){return Promise.reject(e)}var r=n[e],o=r[0];return t.e(r[1][0]).then((()=>t(o)))}o.keys=()=>Object.keys(n),o.id=4767,e.exports=o}},a={};function i(e){var r=a[e];if(void 0!==r)return r.exports;var t=a[e]={id:e,exports:{}};return o[e].call(t.exports,t,t.exports,i),t.exports}i.m=o,i.c=a,i.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return i.d(r,{a:r}),r},r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,i.t=function(t,n){if(1&n&&(t=this(t)),8&n)return t;if("object"==typeof t&&t){if(4&n&&t.__esModule)return t;if(16&n&&"function"==typeof t.then)return t}var o=Object.create(null);i.r(o);var a={};e=e||[null,r({}),r([]),r(r)];for(var l=2&n&&t;("object"==typeof l||"function"==typeof l)&&!~e.indexOf(l);l=r(l))Object.getOwnPropertyNames(l).forEach((e=>a[e]=()=>t[e]));return a.default=()=>t,i.d(o,a),o},i.d=(e,r)=>{for(var t in r)i.o(r,t)&&!i.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},i.f={},i.e=e=>Promise.all(Object.keys(i.f).reduce(((r,t)=>(i.f[t](e,r),r)),[])),i.u=e=>e+".js",i.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),t={},n="@clinicemr/esm-post-registration-redirect-app:",i.l=(e,r,o,a)=>{if(t[e])t[e].push(r);else{var l,s;if(void 0!==o)for(var u=document.getElementsByTagName("script"),c=0;c<u.length;c++){var f=u[c];if(f.getAttribute("src")==e||f.getAttribute("data-webpack")==n+o){l=f;break}}l||(s=!0,(l=document.createElement("script")).charset="utf-8",i.nc&&l.setAttribute("nonce",i.nc),l.setAttribute("data-webpack",n+o),l.src=e),t[e]=[r];var p=(r,n)=>{l.onerror=l.onload=null,clearTimeout(d);var o=t[e];if(delete t[e],l.parentNode&&l.parentNode.removeChild(l),o&&o.forEach((e=>e(n))),r)return r(n)},d=setTimeout(p.bind(null,void 0,{type:"timeout",target:l}),12e4);l.onerror=p.bind(null,l.onerror),l.onload=p.bind(null,l.onload),s&&document.head.appendChild(l)}},i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{i.S={};var e={},r={};i.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];i.o(i.S,t)||(i.S[t]={});var a=i.S[t],l="@clinicemr/esm-post-registration-redirect-app",s=(e,r,t,n)=>{var o=a[e]=a[e]||{},i=o[r];(!i||!i.loaded&&(!n!=!i.eager?n:l>i.from))&&(o[r]={get:t,from:l,eager:!!n})},u=[];return"default"===t&&(s("@openmrs/esm-framework","9.0.3-pre.4643",(()=>Promise.all([i.e(803),i.e(686),i.e(777),i.e(343),i.e(339),i.e(277)]).then((()=>()=>i(1777))))),s("dayjs","1.11.13",(()=>i.e(464).then((()=>()=>i(3464))))),s("react-i18next","16.0.0",(()=>Promise.all([i.e(336),i.e(343)]).then((()=>()=>i(6336))))),s("react-router-dom","6.16.0",(()=>Promise.all([i.e(913),i.e(343)]).then((()=>()=>i(2913))))),s("react","18.3.1",(()=>i.e(41).then((()=>()=>i(4041))))),s("rxjs","6.6.7",(()=>i.e(457).then((()=>()=>i(2457)))))),e[t]=u.length?Promise.all(u).then((()=>e[t]=1)):1}}})(),(()=>{var e;globalThis.importScripts&&(e=globalThis.location+"");var r=globalThis.document;if(!e&&r&&(r.currentScript&&"SCRIPT"===r.currentScript.tagName.toUpperCase()&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName("script");if(t.length)for(var n=t.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=t[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),i.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("+s()+")":1===l?"("+s()+" || "+s()+")":2===l?i.pop()+" "+i.pop():r(l))}return s();function s(){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,s=!0;;l++,i++){var u,c,f=l<r.length?(typeof r[l])[0]:"";if(i>=n.length||"o"==(c=(typeof(u=n[i]))[0]))return!s||("u"==f?l>o&&!a:""==f!=a);if("u"==c){if(!s||"u"!=f)return!1}else if(s)if(f==c)if(l<=o){if(u!=r[l])return!1}else{if(a?u>r[l]:u<r[l])return!1;u!=r[l]&&(s=!1)}else if("s"!=f&&"n"!=f){if(a||l<=o)return!1;s=!1,l--}else{if(l<=o||c<f!=a)return!1;s=!1}else"s"!=f&&"n"!=f&&(s=!1,l--)}}var p=[],d=p.pop.bind(p);for(i=1;i<r.length;i++){var h=r[i];p.push(1==h?d()|d():2==h?d()&d():h?t(h,n):!d())}return!!d()},n=(r,t,n)=>{var o=n?(e=>Object.keys(e).reduce(((r,t)=>(e[t].eager&&(r[t]=e[t]),r)),{}))(r[t]):r[t];return Object.keys(o).reduce(((r,t)=>!r||!o[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)},o=(e,r,t)=>t?t():((e,r)=>(e=>{throw new Error(e)})("Shared module "+r+" doesn't exist in shared scope "+e))(e,r),a=(e=>function(r,t,n,o,a){var l=i.I(r);return l&&l.then&&!n?l.then(e.bind(e,r,i.S[r],t,!1,o,a)):e(r,i.S[r],t,n,o,a)})(((e,a,l,s,u,c)=>{if(!((e,r)=>e&&i.o(e,r))(a,l))return o(e,l,c);var f,p,d=n(a,l,s);return t(u,d)||(p=((e,t,n,o)=>"Unsatisfied version "+n+" from "+(n&&e[t][n].from)+" of shared singleton module "+t+" (required "+r(o)+")")(a,l,d,u),"undefined"!=typeof console&&console.warn&&console.warn(p)),(f=a[l][d]).loaded=1,f.get()})),l={},s={5940:()=>a("default","@openmrs/esm-framework",!1,[0],(()=>Promise.all([i.e(803),i.e(686),i.e(777),i.e(343),i.e(339),i.e(277)]).then((()=>()=>i(1777))))),1343:()=>a("default","react",!1,[1,18],(()=>i.e(41).then((()=>()=>i(4041))))),2339:()=>a("default","react-i18next",!1,[1,16],(()=>i.e(336).then((()=>()=>i(6336))))),4818:()=>a("default","rxjs",!1,[1,6],(()=>i.e(457).then((()=>()=>i(2457))))),6372:()=>a("default","dayjs",!1,[1,1],(()=>i.e(464).then((()=>()=>i(3464))))),8877:()=>a("default","react-router-dom",!1,[1,6],(()=>i.e(913).then((()=>()=>i(2913)))))};[5940].forEach((e=>{i.m[e]=r=>{l[e]=0,delete i.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 u={277:[4818,6372,8877],339:[2339],343:[1343],792:[5940]},c={};i.f.consumes=(e,r)=>{i.o(u,e)&&u[e].forEach((e=>{if(i.o(l,e))return r.push(l[e]);if(!c[e]){var t=r=>{l[e]=0,i.m[e]=t=>{delete i.c[e],t.exports=r()}};c[e]=!0;var n=r=>{delete l[e],i.m[e]=t=>{throw delete i.c[e],r}};try{var o=s[e]();o.then?r.push(l[e]=o.then(t).catch(n)):t(o)}catch(e){n(e)}}}))}})(),(()=>{var e={173:0,792:0};i.f.j=(r,t)=>{var n=i.o(e,r)?e[r]:void 0;if(0!==n)if(n)t.push(n[2]);else if(/^(277|339|343)$/.test(r))e[r]=0;else{var o=new Promise(((t,o)=>n=e[r]=[t,o]));t.push(n[2]=o);var a=i.p+i.u(r),l=new Error;i.l(a,(t=>{if(i.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;l.message="Loading chunk "+r+" failed.\n("+o+": "+a+")",l.name="ChunkLoadError",l.type=o,l.request=a,n[1](l)}}),"chunk-"+r,r)}};var r=(r,t)=>{var n,o,[a,l,s]=t,u=0;if(a.some((r=>0!==e[r]))){for(n in l)i.o(l,n)&&(i.m[n]=l[n]);s&&s(i)}for(r&&r(t);u<a.length;u++)o=a[u],i.o(e,o)&&e[o]&&e[o][0](),e[o]=0},t=globalThis.webpackChunk_clinicemr_esm_post_registration_redirect_app=globalThis.webpackChunk_clinicemr_esm_post_registration_redirect_app||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})(),i.nc=void 0,i(6173)})();
1
+ (()=>{var e,r,t,n,o={6173(e,r,t){"use strict";var n=t(5940),o={featureName:"post-registration-redirect",moduleName:(n.Type.String,n.Type.String,n.Type.String,n.Type.Number,"@clinicemr/esm-post-registration-redirect-app")};t(4767),(0,n.getAsyncLifecycle)((function(){return Promise.all([t.e(803),t.e(343),t.e(339),t.e(918)]).then(t.bind(t,2918))}),o),(0,n.getAsyncLifecycle)((function(){return Promise.all([t.e(803),t.e(686),t.e(343),t.e(339),t.e(802)]).then(t.bind(t,5802))}),o),(0,n.getAsyncLifecycle)((function(){return Promise.all([t.e(343),t.e(312)]).then(t.bind(t,3312))}),o)},4767(e,r,t){var n={"./en.json":[4300,[300]]};function o(e){try{if(!t.o(n,e))return Promise.resolve().then((()=>{var r=new Error("Cannot find module '"+e+"'");throw r.code="MODULE_NOT_FOUND",r}))}catch(e){return Promise.reject(e)}var r=n[e],o=r[0];return t.e(r[1][0]).then((()=>t(o)))}o.keys=()=>Object.keys(n),o.id=4767,e.exports=o}},a={};function i(e){var r=a[e];if(void 0!==r)return r.exports;var t=a[e]={id:e,exports:{}};return o[e].call(t.exports,t,t.exports,i),t.exports}i.m=o,i.c=a,i.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return i.d(r,{a:r}),r},r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,i.t=function(t,n){if(1&n&&(t=this(t)),8&n)return t;if("object"==typeof t&&t){if(4&n&&t.__esModule)return t;if(16&n&&"function"==typeof t.then)return t}var o=Object.create(null);i.r(o);var a={};e=e||[null,r({}),r([]),r(r)];for(var l=2&n&&t;("object"==typeof l||"function"==typeof l)&&!~e.indexOf(l);l=r(l))Object.getOwnPropertyNames(l).forEach((e=>a[e]=()=>t[e]));return a.default=()=>t,i.d(o,a),o},i.d=(e,r)=>{for(var t in r)i.o(r,t)&&!i.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},i.f={},i.e=e=>Promise.all(Object.keys(i.f).reduce(((r,t)=>(i.f[t](e,r),r)),[])),i.u=e=>e+".js",i.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),t={},n="@clinicemr/esm-post-registration-redirect-app:",i.l=(e,r,o,a)=>{if(t[e])t[e].push(r);else{var l,s;if(void 0!==o)for(var u=document.getElementsByTagName("script"),c=0;c<u.length;c++){var f=u[c];if(f.getAttribute("src")==e||f.getAttribute("data-webpack")==n+o){l=f;break}}l||(s=!0,(l=document.createElement("script")).charset="utf-8",i.nc&&l.setAttribute("nonce",i.nc),l.setAttribute("data-webpack",n+o),l.src=e),t[e]=[r];var p=(r,n)=>{l.onerror=l.onload=null,clearTimeout(d);var o=t[e];if(delete t[e],l.parentNode&&l.parentNode.removeChild(l),o&&o.forEach((e=>e(n))),r)return r(n)},d=setTimeout(p.bind(null,void 0,{type:"timeout",target:l}),12e4);l.onerror=p.bind(null,l.onerror),l.onload=p.bind(null,l.onload),s&&document.head.appendChild(l)}},i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{i.S={};var e={},r={};i.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];i.o(i.S,t)||(i.S[t]={});var a=i.S[t],l="@clinicemr/esm-post-registration-redirect-app",s=(e,r,t,n)=>{var o=a[e]=a[e]||{},i=o[r];(!i||!i.loaded&&(!n!=!i.eager?n:l>i.from))&&(o[r]={get:t,from:l,eager:!!n})},u=[];return"default"===t&&(s("@openmrs/esm-framework","9.0.3-pre.4643",(()=>Promise.all([i.e(803),i.e(686),i.e(777),i.e(343),i.e(339),i.e(277)]).then((()=>()=>i(1777))))),s("dayjs","1.11.13",(()=>i.e(464).then((()=>()=>i(3464))))),s("react-i18next","16.0.0",(()=>Promise.all([i.e(336),i.e(343)]).then((()=>()=>i(6336))))),s("react-router-dom","6.16.0",(()=>Promise.all([i.e(913),i.e(343)]).then((()=>()=>i(2913))))),s("react","18.3.1",(()=>i.e(41).then((()=>()=>i(4041))))),s("rxjs","6.6.7",(()=>i.e(457).then((()=>()=>i(2457)))))),e[t]=u.length?Promise.all(u).then((()=>e[t]=1)):1}}})(),(()=>{var e;globalThis.importScripts&&(e=globalThis.location+"");var r=globalThis.document;if(!e&&r&&(r.currentScript&&"SCRIPT"===r.currentScript.tagName.toUpperCase()&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName("script");if(t.length)for(var n=t.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=t[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),i.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("+s()+")":1===l?"("+s()+" || "+s()+")":2===l?i.pop()+" "+i.pop():r(l))}return s();function s(){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,s=!0;;l++,i++){var u,c,f=l<r.length?(typeof r[l])[0]:"";if(i>=n.length||"o"==(c=(typeof(u=n[i]))[0]))return!s||("u"==f?l>o&&!a:""==f!=a);if("u"==c){if(!s||"u"!=f)return!1}else if(s)if(f==c)if(l<=o){if(u!=r[l])return!1}else{if(a?u>r[l]:u<r[l])return!1;u!=r[l]&&(s=!1)}else if("s"!=f&&"n"!=f){if(a||l<=o)return!1;s=!1,l--}else{if(l<=o||c<f!=a)return!1;s=!1}else"s"!=f&&"n"!=f&&(s=!1,l--)}}var p=[],d=p.pop.bind(p);for(i=1;i<r.length;i++){var h=r[i];p.push(1==h?d()|d():2==h?d()&d():h?t(h,n):!d())}return!!d()},n=(r,t,n)=>{var o=n?(e=>Object.keys(e).reduce(((r,t)=>(e[t].eager&&(r[t]=e[t]),r)),{}))(r[t]):r[t];return Object.keys(o).reduce(((r,t)=>!r||!o[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)},o=(e,r,t)=>t?t():((e,r)=>(e=>{throw new Error(e)})("Shared module "+r+" doesn't exist in shared scope "+e))(e,r),a=(e=>function(r,t,n,o,a){var l=i.I(r);return l&&l.then&&!n?l.then(e.bind(e,r,i.S[r],t,!1,o,a)):e(r,i.S[r],t,n,o,a)})(((e,a,l,s,u,c)=>{if(!((e,r)=>e&&i.o(e,r))(a,l))return o(e,l,c);var f,p,d=n(a,l,s);return t(u,d)||(p=((e,t,n,o)=>"Unsatisfied version "+n+" from "+(n&&e[t][n].from)+" of shared singleton module "+t+" (required "+r(o)+")")(a,l,d,u),"undefined"!=typeof console&&console.warn&&console.warn(p)),(f=a[l][d]).loaded=1,f.get()})),l={},s={5940:()=>a("default","@openmrs/esm-framework",!1,[0],(()=>Promise.all([i.e(803),i.e(686),i.e(777),i.e(343),i.e(339),i.e(277)]).then((()=>()=>i(1777))))),1343:()=>a("default","react",!1,[1,18],(()=>i.e(41).then((()=>()=>i(4041))))),2339:()=>a("default","react-i18next",!1,[1,16],(()=>i.e(336).then((()=>()=>i(6336))))),4818:()=>a("default","rxjs",!1,[1,6],(()=>i.e(457).then((()=>()=>i(2457))))),6372:()=>a("default","dayjs",!1,[1,1],(()=>i.e(464).then((()=>()=>i(3464))))),8877:()=>a("default","react-router-dom",!1,[1,6],(()=>i.e(913).then((()=>()=>i(2913)))))};[5940].forEach((e=>{i.m[e]=r=>{l[e]=0,delete i.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 u={277:[4818,6372,8877],339:[2339],343:[1343],792:[5940]},c={};i.f.consumes=(e,r)=>{i.o(u,e)&&u[e].forEach((e=>{if(i.o(l,e))return r.push(l[e]);if(!c[e]){var t=r=>{l[e]=0,i.m[e]=t=>{delete i.c[e],t.exports=r()}};c[e]=!0;var n=r=>{delete l[e],i.m[e]=t=>{throw delete i.c[e],r}};try{var o=s[e]();o.then?r.push(l[e]=o.then(t).catch(n)):t(o)}catch(e){n(e)}}}))}})(),(()=>{var e={173:0,792:0};i.f.j=(r,t)=>{var n=i.o(e,r)?e[r]:void 0;if(0!==n)if(n)t.push(n[2]);else if(/^(277|339|343)$/.test(r))e[r]=0;else{var o=new Promise(((t,o)=>n=e[r]=[t,o]));t.push(n[2]=o);var a=i.p+i.u(r),l=new Error;i.l(a,(t=>{if(i.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;l.message="Loading chunk "+r+" failed.\n("+o+": "+a+")",l.name="ChunkLoadError",l.type=o,l.request=a,n[1](l)}}),"chunk-"+r,r)}};var r=(r,t)=>{var n,o,[a,l,s]=t,u=0;if(a.some((r=>0!==e[r]))){for(n in l)i.o(l,n)&&(i.m[n]=l[n]);s&&s(i)}for(r&&r(t);u<a.length;u++)o=a[u],i.o(e,o)&&e[o]&&e[o][0](),e[o]=0},t=globalThis.webpackChunk_clinicemr_esm_post_registration_redirect_app=globalThis.webpackChunk_clinicemr_esm_post_registration_redirect_app||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})(),i.nc=void 0,i(6173)})();
@@ -27,10 +27,10 @@
27
27
  "initial": false,
28
28
  "entry": false,
29
29
  "recorded": false,
30
- "size": 2016,
30
+ "size": 2161,
31
31
  "sizes": {
32
32
  "consume-shared": 42,
33
- "javascript": 1974
33
+ "javascript": 2119
34
34
  },
35
35
  "names": [],
36
36
  "idHints": [],
@@ -41,7 +41,7 @@
41
41
  "173.js"
42
42
  ],
43
43
  "auxiliaryFiles": [],
44
- "hash": "9749c56e8753e206",
44
+ "hash": "0dc70afbfaac35d6",
45
45
  "childrenByOrder": {}
46
46
  },
47
47
  {
@@ -86,6 +86,28 @@
86
86
  "hash": "c31905dc24e19f4e",
87
87
  "childrenByOrder": {}
88
88
  },
89
+ {
90
+ "rendered": true,
91
+ "initial": false,
92
+ "entry": false,
93
+ "recorded": false,
94
+ "size": 4108,
95
+ "sizes": {
96
+ "javascript": 4108
97
+ },
98
+ "names": [],
99
+ "idHints": [],
100
+ "runtime": [
101
+ "@clinicemr/esm-post-registration-redirect-app",
102
+ "main"
103
+ ],
104
+ "files": [
105
+ "312.js"
106
+ ],
107
+ "auxiliaryFiles": [],
108
+ "hash": "35b92bb1a4537de2",
109
+ "childrenByOrder": {}
110
+ },
89
111
  {
90
112
  "rendered": true,
91
113
  "initial": false,
@@ -222,7 +244,7 @@
222
244
  "openmrs-esm-post-registration-redirect-app.js"
223
245
  ],
224
246
  "auxiliaryFiles": [],
225
- "hash": "f752fd7156554001",
247
+ "hash": "1e8d532e6c9c7f32",
226
248
  "childrenByOrder": {}
227
249
  },
228
250
  {
@@ -280,10 +302,10 @@
280
302
  "initial": true,
281
303
  "entry": true,
282
304
  "recorded": false,
283
- "size": 22888,
305
+ "size": 23033,
284
306
  "sizes": {
285
307
  "consume-shared": 42,
286
- "javascript": 1974,
308
+ "javascript": 2119,
287
309
  "share-init": 252,
288
310
  "runtime": 20620
289
311
  },
@@ -298,7 +320,7 @@
298
320
  "main.js"
299
321
  ],
300
322
  "auxiliaryFiles": [],
301
- "hash": "aaf4bda84c2840f3",
323
+ "hash": "41d0d164ee92bcaa",
302
324
  "childrenByOrder": {}
303
325
  },
304
326
  {
package/dist/routes.json CHANGED
@@ -1 +1 @@
1
- {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"webservices.rest":">=2.2.0"},"pages":[{"component":"postRegistrationRedirect","route":"post-registration"},{"component":"myRegisteredPatients","route":"my-registered-patients"}],"extensions":[],"version":"1.0.0"}
1
+ {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"webservices.rest":">=2.2.0"},"pages":[{"component":"postRegistrationRedirect","route":"post-registration"},{"component":"myRegisteredPatients","route":"my-registered-patients"}],"extensions":[{"name":"registration-clerk-lockdown","component":"registrationClerkLockdown","slot":"top-nav-actions-slot"}],"version":"1.1.0"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clinicemr/esm-post-registration-redirect-app",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "license": "MPL-2.0",
5
5
  "description": "Role-aware post-registration redirect for OpenMRS SSUUBO distro",
6
6
  "browser": "dist/openmrs-esm-post-registration-redirect-app.js",
package/src/index.ts CHANGED
@@ -23,3 +23,8 @@ export const myRegisteredPatients = getAsyncLifecycle(
23
23
  () => import('./my-registered-patients.component'),
24
24
  options,
25
25
  );
26
+
27
+ export const registrationClerkLockdown = getAsyncLifecycle(
28
+ () => import('./registration-clerk-lockdown.component'),
29
+ options,
30
+ );
@@ -0,0 +1,101 @@
1
+ import React, { useEffect } from 'react';
2
+ import { navigate, useConfig, useSession } from '@openmrs/esm-framework';
3
+ import type { PostRegistrationRedirectConfig } from './config-schema';
4
+
5
+ /**
6
+ * Globally-mounted guard that restricts Registration Clerks to a small
7
+ * allow-list of pages:
8
+ * - /patient-registration (create a new patient)
9
+ * - /my-registered-patients (list of patients they've registered)
10
+ * - /post-registration/* (the redirect gateway they land on post-save)
11
+ * - /login, /logout (auth pages)
12
+ *
13
+ * If they somehow land on any other URL (typed manually, clicked a stale
14
+ * link, etc.) they are bounced back to /my-registered-patients.
15
+ *
16
+ * It also toggles a `registration-clerk-mode` class on <body> so CSS can
17
+ * hide top-nav shortcuts (search, app switcher, etc.) for this role.
18
+ */
19
+ const ALLOWED_PATH_PREFIXES = [
20
+ 'patient-registration',
21
+ 'my-registered-patients',
22
+ 'post-registration',
23
+ 'login',
24
+ 'logout',
25
+ ];
26
+
27
+ const BODY_CLASS = 'registration-clerk-mode';
28
+ const STYLE_ELEMENT_ID = 'registration-clerk-lockdown-style';
29
+
30
+ // CSS that hides nav shortcuts. Uses broad, conservative selectors so we
31
+ // don't accidentally hide the user menu (needed to log out).
32
+ const LOCKDOWN_CSS = `
33
+ body.${BODY_CLASS} [data-testid="appSearchIconButton"],
34
+ body.${BODY_CLASS} [data-testid="appSearchBar"],
35
+ body.${BODY_CLASS} [data-testid="appMenuButton"],
36
+ body.${BODY_CLASS} [data-testid="offlineToolsMenuButton"],
37
+ body.${BODY_CLASS} [data-testid="implementerToolsIcon"] {
38
+ display: none !important;
39
+ }
40
+ `;
41
+
42
+ function ensureStyleInjected() {
43
+ if (document.getElementById(STYLE_ELEMENT_ID)) return;
44
+ const style = document.createElement('style');
45
+ style.id = STYLE_ELEMENT_ID;
46
+ style.textContent = LOCKDOWN_CSS;
47
+ document.head.appendChild(style);
48
+ }
49
+
50
+ function currentFirstPathSegment(): string {
51
+ const path = window.location.pathname;
52
+ // Strip any common OpenMRS SPA prefix like /openmrs/spa/
53
+ const stripped = path.replace(/^\/openmrs\/spa\/?/, '').replace(/^\/+/, '');
54
+ return (stripped.split('/')[0] || '').toLowerCase();
55
+ }
56
+
57
+ const RegistrationClerkLockdown: React.FC = () => {
58
+ const session = useSession();
59
+ const config = useConfig<PostRegistrationRedirectConfig>();
60
+
61
+ useEffect(() => {
62
+ if (!session?.user) return;
63
+
64
+ const roles: string[] = (session.user.roles ?? []).map(
65
+ (r: { display?: string; name?: string }) => String(r.display ?? r.name ?? ''),
66
+ );
67
+ const isClerk = roles.some(
68
+ (role) => role.trim().toLowerCase() === config.registrationClerkRoleName.trim().toLowerCase(),
69
+ );
70
+
71
+ if (!isClerk) {
72
+ document.body.classList.remove(BODY_CLASS);
73
+ return;
74
+ }
75
+
76
+ document.body.classList.add(BODY_CLASS);
77
+ ensureStyleInjected();
78
+
79
+ const enforcePath = () => {
80
+ const first = currentFirstPathSegment();
81
+ if (!first) return; // landing on /openmrs/spa/ → let the home page handle it
82
+ if (ALLOWED_PATH_PREFIXES.includes(first)) return;
83
+ navigate({ to: `\${openmrsSpaBase}/${config.registeredPatientsListPath}` });
84
+ };
85
+
86
+ // Run once for the current URL and then on every single-spa route change.
87
+ enforcePath();
88
+ const handler = () => enforcePath();
89
+ window.addEventListener('single-spa:before-routing-event', handler);
90
+ window.addEventListener('popstate', handler);
91
+
92
+ return () => {
93
+ window.removeEventListener('single-spa:before-routing-event', handler);
94
+ window.removeEventListener('popstate', handler);
95
+ };
96
+ }, [session, config.registrationClerkRoleName, config.registeredPatientsListPath]);
97
+
98
+ return null;
99
+ };
100
+
101
+ export default RegistrationClerkLockdown;
package/src/routes.json CHANGED
@@ -13,5 +13,11 @@
13
13
  "route": "my-registered-patients"
14
14
  }
15
15
  ],
16
- "extensions": []
16
+ "extensions": [
17
+ {
18
+ "name": "registration-clerk-lockdown",
19
+ "component": "registrationClerkLockdown",
20
+ "slot": "top-nav-actions-slot"
21
+ }
22
+ ]
17
23
  }