@openmrs/esm-primary-navigation-app 3.2.1-pre.927 → 3.2.1-pre.933

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/471.js CHANGED
@@ -1,2 +1,2 @@
1
- (self.webpackChunk_openmrs_esm_primary_navigation_app=self.webpackChunk_openmrs_esm_primary_navigation_app||[]).push([[471],{9549:(e,n,t)=>{"use strict";t.d(n,{O:()=>i,e:()=>r});const i="user-property-change",r="@openmrs/esm-primary-navigation-app"},5471:(e,n,t)=>{"use strict";t.r(n),t.d(n,{backendDependencies:()=>c,importTranslation:()=>p,setupOpenMRS:()=>u});var i=t(7657),r=t(9549);async function o(e,n,t){const r=(await(0,i.getSessionLocation)())?.uuid;await(0,i.openmrsFetch)(`/ws/rest/v1/user/${e}`,{method:"POST",body:{userProperties:n},headers:{"Content-Type":"application/json"},signal:t.signal}),r&&await(0,i.setSessionLocation)(r,t)}function s(e,n){return(0,i.queueSynchronizationItemFor)(e,r.O,n,{displayName:"User Language Change"})}const a={logo:{src:{_type:i.Type.String,_default:null,_description:"A path or URL to an image. Defaults to the OpenMRS SVG sprite."},alt:{_type:i.Type.String,_default:"Logo",_description:"Alt text, shown on hover"},name:{_type:i.Type.String,_default:null,_description:"The organization name displayed when image is absent"}},externalRefLinks:{enabled:{_type:i.Type.Boolean,_default:!0,_description:"Whether to show external links in the app menu"},links:{_type:i.Type.Array,_elements:{visible:{_type:i.Type.Boolean,_description:"Whether to show a link in the menu",_default:!0},title:{_type:i.Type.String,_description:"Title of the link"},redirect:{_type:i.Type.String,_description:"Link to redirect to (must be an external link)"}},_default:[{visible:!1,title:"External link",redirect:"/external-link"}],_description:"The links to be showcased in the app menu"}}};async function l(e,n){if(0===n.index){const e=await(0,i.getLoggedInUser)(),t=n.items.map((e=>{let[n,t]=e;return t})),r=Object.assign({},e.userProperties,...t);await o(e.uuid,r,n.abort),(0,i.refetchCurrentUser)()}}const p=t(3979),c={"webservices.rest":"^2.2.0"},d={featureName:"primary navigation",moduleName:r.e};function u(){return(0,i.defineConfigSchema)(r.e,a),(0,i.setupOfflineSync)(r.O,[],l),{pages:[{load:(0,i.getAsyncLifecycle)((()=>Promise.all([t.e(339),t.e(596),t.e(983),t.e(784),t.e(692)]).then(t.bind(t,2692))),d),route:e=>!e.pathname.startsWith(window.getOpenmrsSpaBase()+"login"),online:!0,offline:!0,order:0}],extensions:[{name:"default-user-panel",slot:"user-panel-slot",order:0,load:(0,i.getAsyncLifecycle)((()=>Promise.all([t.e(339),t.e(983),t.e(784),t.e(686)]).then(t.bind(t,5686))),d),online:!0,offline:!0},{name:"change-locale",slot:"user-panel-slot",order:1,load:(0,i.getAsyncLifecycle)((()=>Promise.all([t.e(983),t.e(784),t.e(878)]).then(t.bind(t,8878))),d),online:{postUserProperties:o},offline:{postUserProperties:s}}]}}},3979:(e,n,t)=>{var i={"./en.json":[3574,574]};function r(e){if(!t.o(i,e))return Promise.resolve().then((()=>{var n=new Error("Cannot find module '"+e+"'");throw n.code="MODULE_NOT_FOUND",n}));var n=i[e],r=n[0];return t.e(n[1]).then((()=>t(r)))}r.keys=()=>Object.keys(i),r.id=3979,e.exports=r}}]);
1
+ (self.webpackChunk_openmrs_esm_primary_navigation_app=self.webpackChunk_openmrs_esm_primary_navigation_app||[]).push([[471],{9549:(e,n,t)=>{"use strict";t.d(n,{O:()=>i,e:()=>r});const i="user-property-change",r="@openmrs/esm-primary-navigation-app"},5471:(e,n,t)=>{"use strict";t.r(n),t.d(n,{backendDependencies:()=>c,importTranslation:()=>l,setupOpenMRS:()=>u});var i=t(7657),r=t(9549);async function s(e,n,t){const r=(await(0,i.getSessionLocation)())?.uuid;await(0,i.openmrsFetch)(`/ws/rest/v1/user/${e}`,{method:"POST",body:{userProperties:n},headers:{"Content-Type":"application/json"},signal:t.signal}),r&&await(0,i.setSessionLocation)(r,t)}function a(e,n){return(0,i.queueSynchronizationItemFor)(e,r.O,n,{displayName:"User Language Change"})}const o={logo:{src:{_type:i.Type.String,_default:null,_description:"A path or URL to an image. Defaults to the OpenMRS SVG sprite."},alt:{_type:i.Type.String,_default:"Logo",_description:"Alt text, shown on hover"},name:{_type:i.Type.String,_default:null,_description:"The organization name displayed when image is absent"}},externalRefLinks:{_type:i.Type.Array,_elements:{title:{_type:i.Type.String,_description:"Title of the link"},redirect:{_type:i.Type.String,_description:"Link to redirect to (must be an external link)",_validators:[i.validators.isUrl]}},_default:[],_description:"The external links to be showcased in the app menu"}};async function p(e,n){if(0===n.index){const e=await(0,i.getLoggedInUser)(),t=n.items.map((e=>{let[n,t]=e;return t})),r=Object.assign({},e.userProperties,...t);await s(e.uuid,r,n.abort),(0,i.refetchCurrentUser)()}}const l=t(3979),c={"webservices.rest":"^2.2.0"},d={featureName:"primary navigation",moduleName:r.e};function u(){return(0,i.defineConfigSchema)(r.e,o),(0,i.setupOfflineSync)(r.O,[],p),{pages:[{load:(0,i.getAsyncLifecycle)((()=>Promise.all([t.e(339),t.e(596),t.e(983),t.e(784),t.e(692)]).then(t.bind(t,2692))),d),route:e=>!e.pathname.startsWith(window.getOpenmrsSpaBase()+"login"),online:!0,offline:!0,order:0}],extensions:[{name:"default-user-panel",slot:"user-panel-slot",order:0,load:(0,i.getAsyncLifecycle)((()=>Promise.all([t.e(339),t.e(983),t.e(784),t.e(686)]).then(t.bind(t,5686))),d),online:!0,offline:!0},{name:"change-locale",slot:"user-panel-slot",order:1,load:(0,i.getAsyncLifecycle)((()=>Promise.all([t.e(983),t.e(784),t.e(878)]).then(t.bind(t,8878))),d),online:{postUserProperties:s},offline:{postUserProperties:a}}]}}},3979:(e,n,t)=>{var i={"./en.json":[3574,574]};function r(e){if(!t.o(i,e))return Promise.resolve().then((()=>{var n=new Error("Cannot find module '"+e+"'");throw n.code="MODULE_NOT_FOUND",n}));var n=i[e],r=n[0];return t.e(n[1]).then((()=>t(r)))}r.keys=()=>Object.keys(i),r.id=3979,e.exports=r}}]);
2
2
  //# sourceMappingURL=471.js.map
package/d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zC,GAC9C6B,EAAoBW,GAAK,KACzBE,EAAOC,QAAUd","sources":["webpack://@openmrs/esm-primary-navigation-app/./src/constants.ts","webpack://@openmrs/esm-primary-navigation-app/./src/components/choose-locale/change-locale.resource.tsx","webpack://@openmrs/esm-primary-navigation-app/./src/config-schema.ts","webpack://@openmrs/esm-primary-navigation-app/./src/offline.ts","webpack://@openmrs/esm-primary-navigation-app/./src/index.ts","webpack://@openmrs/esm-primary-navigation-app//home/runner/work/openmrs-esm-core/openmrs-esm-core/packages/apps/esm-primary-navigation-app/translations|lazy|nonrecursive|/.json$/"],"sourcesContent":["export const userPropertyChange = \"user-property-change\";\nexport const moduleName = \"@openmrs/esm-primary-navigation-app\";\n","import {\n openmrsFetch,\n queueSynchronizationItemFor,\n getSessionLocation,\n setSessionLocation,\n} from \"@openmrs/esm-framework\";\nimport { userPropertyChange } from \"../../constants\";\n\nexport type PostUserProperties = (\n userUuid: string,\n userProperties: any,\n abortController?: AbortController\n) => Promise<any>;\n\nexport async function postUserPropertiesOnline(\n userUuid: string,\n userProperties: any,\n abortController: AbortController\n): Promise<any> {\n const sessionLocation = await getSessionLocation();\n const locationUuid = sessionLocation?.uuid;\n\n await openmrsFetch(`/ws/rest/v1/user/${userUuid}`, {\n method: \"POST\",\n body: { userProperties },\n headers: { \"Content-Type\": \"application/json\" },\n signal: abortController.signal,\n });\n\n if (locationUuid) {\n await setSessionLocation(locationUuid, abortController);\n }\n}\n\nexport function postUserPropertiesOffline(\n userUuid: string,\n userProperties: any\n): Promise<any> {\n return queueSynchronizationItemFor(\n userUuid,\n userPropertyChange,\n userProperties,\n {\n displayName: \"User Language Change\",\n }\n );\n}\n","import { Type } from \"@openmrs/esm-framework\";\n\nexport const configSchema = {\n logo: {\n src: {\n _type: Type.String,\n _default: null,\n _description:\n \"A path or URL to an image. Defaults to the OpenMRS SVG sprite.\",\n },\n alt: {\n _type: Type.String,\n _default: \"Logo\",\n _description: \"Alt text, shown on hover\",\n },\n name: {\n _type: Type.String,\n _default: null,\n _description: \"The organization name displayed when image is absent\",\n },\n },\n externalRefLinks: {\n enabled: {\n _type: Type.Boolean,\n _default: true,\n _description: \"Whether to show external links in the app menu\",\n },\n links: {\n _type: Type.Array,\n _elements: {\n visible: {\n _type: Type.Boolean,\n _description: \"Whether to show a link in the menu\",\n _default: true,\n },\n title: {\n _type: Type.String,\n _description: \"Title of the link\",\n },\n redirect: {\n _type: Type.String,\n _description: \"Link to redirect to (must be an external link)\",\n },\n },\n _default: [\n {\n visible: false,\n title: \"External link\",\n redirect: \"/external-link\",\n },\n ],\n _description: \"The links to be showcased in the app menu\",\n },\n },\n};\n","import {\n refetchCurrentUser,\n getLoggedInUser,\n SyncProcessOptions,\n} from \"@openmrs/esm-framework\";\nimport { postUserPropertiesOnline } from \"./components/choose-locale/change-locale.resource\";\n\nexport async function syncUserLanguagePreference(\n _: any,\n options: SyncProcessOptions<any>\n) {\n if (options.index === 0) {\n const loggedInUser = await getLoggedInUser();\n const allChanges = options.items.map(([_, change]) => change);\n const newUserProperties = Object.assign(\n {},\n loggedInUser.userProperties,\n ...allChanges\n );\n\n await postUserPropertiesOnline(\n loggedInUser.uuid,\n newUserProperties,\n options.abort\n );\n\n refetchCurrentUser();\n }\n}\n","import {\n defineConfigSchema,\n getAsyncLifecycle,\n setupOfflineSync,\n} from \"@openmrs/esm-framework\";\nimport {\n postUserPropertiesOnline,\n postUserPropertiesOffline,\n} from \"./components/choose-locale/change-locale.resource\";\nimport { configSchema } from \"./config-schema\";\nimport { moduleName, userPropertyChange } from \"./constants\";\nimport { syncUserLanguagePreference } from \"./offline\";\n\nconst importTranslation = require.context(\n \"../translations\",\n false,\n /.json$/,\n \"lazy\"\n);\n\nconst backendDependencies = {\n \"webservices.rest\": \"^2.2.0\",\n};\n\nconst options = {\n featureName: \"primary navigation\",\n moduleName,\n};\n\nfunction setupOpenMRS() {\n defineConfigSchema(moduleName, configSchema);\n\n setupOfflineSync(userPropertyChange, [], syncUserLanguagePreference);\n\n return {\n pages: [\n {\n load: getAsyncLifecycle(() => import(\"./root.component\"), options),\n route: (location: Location) =>\n !location.pathname.startsWith(window.getOpenmrsSpaBase() + \"login\"),\n online: true,\n offline: true,\n order: 0,\n },\n ],\n extensions: [\n {\n name: \"default-user-panel\",\n slot: \"user-panel-slot\",\n order: 0, // should be first DOM element\n load: getAsyncLifecycle(\n () =>\n import(\n \"./components/user-panel-switcher-item/user-panel-switcher.component\"\n ),\n options\n ),\n online: true,\n offline: true,\n },\n {\n name: \"change-locale\",\n slot: \"user-panel-slot\",\n order: 1,\n load: getAsyncLifecycle(\n () => import(\"./components/choose-locale/change-locale.component\"),\n options\n ),\n online: {\n postUserProperties: postUserPropertiesOnline,\n },\n offline: {\n postUserProperties: postUserPropertiesOffline,\n },\n },\n ],\n };\n}\n\nexport { setupOpenMRS, importTranslation, backendDependencies };\n","var map = {\n\t\"./en.json\": [\n\t\t3574,\n\t\t574\n\t]\n};\nfunction webpackAsyncContext(req) {\n\tif(!__webpack_require__.o(map, req)) {\n\t\treturn Promise.resolve().then(() => {\n\t\t\tvar e = new Error(\"Cannot find module '\" + req + \"'\");\n\t\t\te.code = 'MODULE_NOT_FOUND';\n\t\t\tthrow e;\n\t\t});\n\t}\n\n\tvar ids = map[req], id = ids[0];\n\treturn __webpack_require__.e(ids[1]).then(() => {\n\t\treturn __webpack_require__(id);\n\t});\n}\nwebpackAsyncContext.keys = () => (Object.keys(map));\nwebpackAsyncContext.id = 3979;\nmodule.exports = webpackAsyncContext;"],"names":["userPropertyChange","moduleName","async","postUserPropertiesOnline","userUuid","userProperties","abortController","locationUuid","getSessionLocation","uuid","openmrsFetch","method","body","headers","signal","setSessionLocation","postUserPropertiesOffline","queueSynchronizationItemFor","displayName","configSchema","logo","src","_type","Type","_default","_description","alt","name","externalRefLinks","enabled","links","_elements","visible","title","redirect","syncUserLanguagePreference","_","options","index","loggedInUser","getLoggedInUser","allChanges","items","map","change","newUserProperties","Object","assign","abort","refetchCurrentUser","importTranslation","require","backendDependencies","featureName","setupOpenMRS","defineConfigSchema","setupOfflineSync","pages","load","getAsyncLifecycle","route","location","pathname","startsWith","window","getOpenmrsSpaBase","online","offline","order","extensions","slot","postUserProperties","webpackAsyncContext","req","__webpack_require__","o","Promise","resolve","then","e","Error","code","ids","id","keys","module","exports"],"sourceRoot":""}
1
+ {"version":3,"file":"471.js","mappings":"kLAAO,MAAMA,EAAqB,uBACrBC,EAAa,uC,yICanBC,eAAeC,EACpBC,EACAC,EACAC,GAEA,MACMC,SADwBC,EAAAA,EAAAA,wBACQC,WAEhCC,EAAAA,EAAAA,cAAc,oBAAmBN,IAAY,CACjDO,OAAQ,OACRC,KAAM,CAAEP,eAAAA,GACRQ,QAAS,CAAE,eAAgB,oBAC3BC,OAAQR,EAAgBQ,SAGtBP,SACIQ,EAAAA,EAAAA,oBAAmBR,EAAcD,GAIpC,SAASU,EACdZ,EACAC,GAEA,OAAOY,EAAAA,EAAAA,6BACLb,EACAJ,EAAAA,EACAK,EACA,CACEa,YAAa,yBCzCZ,MAAMC,EAAe,CAC1BC,KAAM,CACJC,IAAK,CACHC,MAAOC,EAAAA,KAAAA,OACPC,SAAU,KACVC,aACE,kEAEJC,IAAK,CACHJ,MAAOC,EAAAA,KAAAA,OACPC,SAAU,OACVC,aAAc,4BAEhBE,KAAM,CACJL,MAAOC,EAAAA,KAAAA,OACPC,SAAU,KACVC,aAAc,yDAGlBG,iBAAkB,CAChBN,MAAOC,EAAAA,KAAAA,MACPM,UAAW,CACTC,MAAO,CACLR,MAAOC,EAAAA,KAAAA,OACPE,aAAc,qBAEhBM,SAAU,CACRT,MAAOC,EAAAA,KAAAA,OACPE,aAAc,iDACdO,YAAa,CAACC,EAAAA,WAAAA,SAGlBT,SAAU,GACVC,aAAc,uDC5BXvB,eAAegC,EACpBC,EACAC,GAEA,GAAsB,IAAlBA,EAAQC,MAAa,CACvB,MAAMC,QAAqBC,EAAAA,EAAAA,mBACrBC,EAAaJ,EAAQK,MAAMC,KAAI,QAAEP,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AOsC,KAAKzC,GAC9C6B,EAAoBW,GAAK,KACzBE,EAAOC,QAAUd","sources":["webpack://@openmrs/esm-primary-navigation-app/./src/constants.ts","webpack://@openmrs/esm-primary-navigation-app/./src/components/choose-locale/change-locale.resource.tsx","webpack://@openmrs/esm-primary-navigation-app/./src/config-schema.ts","webpack://@openmrs/esm-primary-navigation-app/./src/offline.ts","webpack://@openmrs/esm-primary-navigation-app/./src/index.ts","webpack://@openmrs/esm-primary-navigation-app//home/runner/work/openmrs-esm-core/openmrs-esm-core/packages/apps/esm-primary-navigation-app/translations|lazy|nonrecursive|/.json$/"],"sourcesContent":["export const userPropertyChange = \"user-property-change\";\nexport const moduleName = \"@openmrs/esm-primary-navigation-app\";\n","import {\n openmrsFetch,\n queueSynchronizationItemFor,\n getSessionLocation,\n setSessionLocation,\n} from \"@openmrs/esm-framework\";\nimport { userPropertyChange } from \"../../constants\";\n\nexport type PostUserProperties = (\n userUuid: string,\n userProperties: any,\n abortController?: AbortController\n) => Promise<any>;\n\nexport async function postUserPropertiesOnline(\n userUuid: string,\n userProperties: any,\n abortController: AbortController\n): Promise<any> {\n const sessionLocation = await getSessionLocation();\n const locationUuid = sessionLocation?.uuid;\n\n await openmrsFetch(`/ws/rest/v1/user/${userUuid}`, {\n method: \"POST\",\n body: { userProperties },\n headers: { \"Content-Type\": \"application/json\" },\n signal: abortController.signal,\n });\n\n if (locationUuid) {\n await setSessionLocation(locationUuid, abortController);\n }\n}\n\nexport function postUserPropertiesOffline(\n userUuid: string,\n userProperties: any\n): Promise<any> {\n return queueSynchronizationItemFor(\n userUuid,\n userPropertyChange,\n userProperties,\n {\n displayName: \"User Language Change\",\n }\n );\n}\n","import { Type, validators } from \"@openmrs/esm-framework\";\n\nexport const configSchema = {\n logo: {\n src: {\n _type: Type.String,\n _default: null,\n _description:\n \"A path or URL to an image. Defaults to the OpenMRS SVG sprite.\",\n },\n alt: {\n _type: Type.String,\n _default: \"Logo\",\n _description: \"Alt text, shown on hover\",\n },\n name: {\n _type: Type.String,\n _default: null,\n _description: \"The organization name displayed when image is absent\",\n },\n },\n externalRefLinks: {\n _type: Type.Array,\n _elements: {\n title: {\n _type: Type.String,\n _description: \"Title of the link\",\n },\n redirect: {\n _type: Type.String,\n _description: \"Link to redirect to (must be an external link)\",\n _validators: [validators.isUrl],\n },\n },\n _default: [],\n _description: \"The external links to be showcased in the app menu\",\n },\n};\n","import {\n refetchCurrentUser,\n getLoggedInUser,\n SyncProcessOptions,\n} from \"@openmrs/esm-framework\";\nimport { postUserPropertiesOnline } from \"./components/choose-locale/change-locale.resource\";\n\nexport async function syncUserLanguagePreference(\n _: any,\n options: SyncProcessOptions<any>\n) {\n if (options.index === 0) {\n const loggedInUser = await getLoggedInUser();\n const allChanges = options.items.map(([_, change]) => change);\n const newUserProperties = Object.assign(\n {},\n loggedInUser.userProperties,\n ...allChanges\n );\n\n await postUserPropertiesOnline(\n loggedInUser.uuid,\n newUserProperties,\n options.abort\n );\n\n refetchCurrentUser();\n }\n}\n","import {\n defineConfigSchema,\n getAsyncLifecycle,\n setupOfflineSync,\n} from \"@openmrs/esm-framework\";\nimport {\n postUserPropertiesOnline,\n postUserPropertiesOffline,\n} from \"./components/choose-locale/change-locale.resource\";\nimport { configSchema } from \"./config-schema\";\nimport { moduleName, userPropertyChange } from \"./constants\";\nimport { syncUserLanguagePreference } from \"./offline\";\n\nconst importTranslation = require.context(\n \"../translations\",\n false,\n /.json$/,\n \"lazy\"\n);\n\nconst backendDependencies = {\n \"webservices.rest\": \"^2.2.0\",\n};\n\nconst options = {\n featureName: \"primary navigation\",\n moduleName,\n};\n\nfunction setupOpenMRS() {\n defineConfigSchema(moduleName, configSchema);\n\n setupOfflineSync(userPropertyChange, [], syncUserLanguagePreference);\n\n return {\n pages: [\n {\n load: getAsyncLifecycle(() => import(\"./root.component\"), options),\n route: (location: Location) =>\n !location.pathname.startsWith(window.getOpenmrsSpaBase() + \"login\"),\n online: true,\n offline: true,\n order: 0,\n },\n ],\n extensions: [\n {\n name: \"default-user-panel\",\n slot: \"user-panel-slot\",\n order: 0, // should be first DOM element\n load: getAsyncLifecycle(\n () =>\n import(\n \"./components/user-panel-switcher-item/user-panel-switcher.component\"\n ),\n options\n ),\n online: true,\n offline: true,\n },\n {\n name: \"change-locale\",\n slot: \"user-panel-slot\",\n order: 1,\n load: getAsyncLifecycle(\n () => import(\"./components/choose-locale/change-locale.component\"),\n options\n ),\n online: {\n postUserProperties: postUserPropertiesOnline,\n },\n offline: {\n postUserProperties: postUserPropertiesOffline,\n },\n },\n ],\n };\n}\n\nexport { setupOpenMRS, importTranslation, backendDependencies };\n","var map = {\n\t\"./en.json\": [\n\t\t3574,\n\t\t574\n\t]\n};\nfunction webpackAsyncContext(req) {\n\tif(!__webpack_require__.o(map, req)) {\n\t\treturn Promise.resolve().then(() => {\n\t\t\tvar e = new Error(\"Cannot find module '\" + req + \"'\");\n\t\t\te.code = 'MODULE_NOT_FOUND';\n\t\t\tthrow e;\n\t\t});\n\t}\n\n\tvar ids = map[req], id = ids[0];\n\treturn __webpack_require__.e(ids[1]).then(() => {\n\t\treturn __webpack_require__(id);\n\t});\n}\nwebpackAsyncContext.keys = () => (Object.keys(map));\nwebpackAsyncContext.id = 3979;\nmodule.exports = webpackAsyncContext;"],"names":["userPropertyChange","moduleName","async","postUserPropertiesOnline","userUuid","userProperties","abortController","locationUuid","getSessionLocation","uuid","openmrsFetch","method","body","headers","signal","setSessionLocation","postUserPropertiesOffline","queueSynchronizationItemFor","displayName","configSchema","logo","src","_type","Type","_default","_description","alt","name","externalRefLinks","_elements","title","redirect","_validators","validators","syncUserLanguagePreference","_","options","index","loggedInUser","getLoggedInUser","allChanges","items","map","change","newUserProperties","Object","assign","abort","refetchCurrentUser","importTranslation","require","backendDependencies","featureName","setupOpenMRS","defineConfigSchema","setupOfflineSync","pages","load","getAsyncLifecycle","route","location","pathname","startsWith","window","getOpenmrsSpaBase","online","offline","order","extensions","slot","postUserProperties","webpackAsyncContext","req","__webpack_require__","o","Promise","resolve","then","e","Error","code","ids","id","keys","module","exports"],"sourceRoot":""}