@openmrs/esm-patient-registration-app 4.3.1-pre.1421 → 4.3.1-pre.1435
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.turbo/turbo-build.log
CHANGED
package/dist/68.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(globalThis.webpackChunk_openmrs_esm_patient_registration_app=globalThis.webpackChunk_openmrs_esm_patient_registration_app||[]).push([[68],{225:(e,t,n)=>{"use strict";n.d(t,{X8:()=>s,bT:()=>u,bs:()=>o});var i=n(906);function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function a(e){return function(e){if(Array.isArray(e))return r(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var o=[{id:"demographics",name:"Basic Info",fields:["name","gender","dob","id"]},{id:"contact",name:"Contact Details",fields:["address","phone"]},{id:"death",name:"Death Info",fields:[]},{id:"relationships",name:"Relationships",fields:[]}],s=["name","gender","dob","address","id","phone & email"],u={sections:{_type:i.Type.Array,_default:["demographics","contact","relationships"],_description:"An array of strings which are the keys from 'sectionDefinitions' or any of the following built-in sections: '".concat(o.map((function(e){return e.id})).join("', '"),"'."),_elements:{_type:i.Type.String}},sectionDefinitions:{_type:i.Type.Array,_elements:{id:{_type:i.Type.String,_description:"How this section will be referred to in the `sections` configuration. To override a built-in section, use that section's id. The built in section ids are '".concat(o.map((function(e){return e.id})).join("', '"),"'.")},name:{_type:i.Type.String,_description:"The title to display at the top of the section."},fields:{_type:i.Type.Array,_default:[],_description:"The parts to include in the section. Can be any of the following built-in fields: ".concat(s.join(", "),". Can also be an id from an object in the `fieldDefinitions` array, which you can use to define custom fields."),_elements:{_type:i.Type.String}}},_default:[]},fieldDefinitions:{_type:i.Type.Array,_elements:{id:{_type:i.Type.String,_description:"How this field will be referred to in the `fields` element of the `sectionDefinitions` configuration."},type:{_type:i.Type.String,_description:"How this field's data will be stored—a person attribute or an obs."},uuid:{_type:i.Type.UUID,_description:"Person attribute type UUID that this field's data should be saved to."},showHeading:{_type:i.Type.Boolean,_description:"Whether to show a heading above the person attribute field.",_default:!1},label:{_type:i.Type.String,_default:null,_description:"The label of the input. By default, uses the metadata `display` attribute."},placeholder:{_type:i.Type.String,_default:"",_description:"Placeholder that will appear in the input."},validation:{required:{_type:i.Type.Boolean,_default:!1},matches:{_type:i.Type.String,_default:null,_description:"Optional RegEx for testing the validity of the input."}},answerConceptSetUuid:{_type:i.Type.ConceptUuid,_default:null,_description:"For coded questions only. A concept which has the possible responses either as answers or as set members."},customConceptAnswers:{_type:i.Type.Array,_elements:{uuid:{_type:i.Type.UUID,_description:"Answer concept UUID"},label:{_type:i.Type.String,_default:null,_description:"The custom label for the answer concept."}},_default:[],_description:"For coded questions only. Provide ability to add custom concept answers."}},_default:[{id:"phone",type:"person attribute",uuid:"14d4f066-15f5-102d-96e4-000c29c2a5d7",showHeading:!1,validation:{matches:""}}],_description:"Definitions for custom fields that can be used in sectionDefinitions. Can also be used to override built-in fields."},fieldConfigurations:{name:{displayMiddleName:{_type:i.Type.Boolean,_default:!0},unidentifiedPatient:{_type:i.Type.Boolean,_default:!0,_description:"Whether to allow patients to be registered without names."},defaultUnknownGivenName:{_type:i.Type.String,_default:"UNKNOWN",_description:"The given/first name to record for unidentified patients."},defaultUnknownFamilyName:{_type:i.Type.String,_default:"UNKNOWN",_description:"The family/last name to record for unidentified patients."},displayCapturePhoto:{_type:i.Type.Boolean,_default:!0,_description:"Whether to display capture patient photo slot on name field"}},gender:{_type:i.Type.Array,_elements:{value:{_type:i.Type.String,_description:"The value for sex option"},label:{_type:i.Type.String,_default:null,_description:"The label displayed for sex option."},id:{_type:i.Type.String,_default:null,_description:"The id for sex option."}},_default:[{id:"male",value:"Male",label:"Male"},{id:"female",value:"Female",label:"Female"},{id:"other",value:"Other",label:"Other"},{id:"unknown",value:"Unknown",label:"Unknown"}],_description:"Provide ability to configure sex options."},address:{useAddressHierarchy:{enabled:{_type:i.Type.Boolean,_description:"Whether to use the Address hierarchy in the registration form or not",_default:!0},useQuickSearch:{_type:i.Type.Boolean,_description:"Whether to use the quick searching through the address saved in the database pre-fill the form.",_default:!0},searchAddressByLevel:{_type:i.Type.Boolean,_description:"Whether to fill the addresses by levels, i.e. County => subCounty, the current field is dependent on it's previous field.",_default:!1},useAddressHierarchyLabel:{_type:i.Type.Object,_description:"Whether to use custom labels for address hierarchy",_default:{}}}},dateOfBirth:{useEstimatedDateOfBirth:{enabled:{_type:i.Type.Boolean,_description:"Whether to use custom day and month for estimated date of birth",_default:!1},dayOfMonth:{_type:i.Type.Number,_description:"The custom day of the month use on the estimated date of birth",_default:0},month:{_type:i.Type.Number,_description:"The custom month to use on the estimated date of birth i.e 0 = Jan 11 = Dec",_default:0}}}},links:{submitButton:{_type:i.Type.String,_default:"${openmrsSpaBase}/patient/${patientUuid}/chart",_validators:[i.validators.isUrlWithTemplateParameters(["patientUuid"])]}},concepts:{patientPhotoUuid:{_type:i.Type.ConceptUuid,_default:"736e8771-e501-4615-bfa7-570c03f4bef5"}},defaultPatientIdentifierTypes:{_type:i.Type.Array,_elements:{_type:i.Type.PatientIdentifierTypeUuid},_default:[]},registrationObs:{encounterTypeUuid:{_type:i.Type.UUID,_default:null,_description:"Obs created during registration will be associated with an encounter of this type. This must be set in order to use fields of type `obs`."},encounterProviderRoleUuid:{_type:i.Type.UUID,_default:"a0b03050-c99b-11e0-9572-0800200c9a66",_description:"The provider role to use for the registration encounter. Default is 'Unkown'."},registrationFormUuid:{_type:i.Type.UUID,_default:null,_description:"The form UUID to associate with the registration encounter. By default no form will be associated."}},_validators:[(0,i.validator)((function(e){return!e.fieldDefinitions.some((function(e){return"obs"==e.type}))||null!=e.registrationObs.encounterTypeUuid}),"If fieldDefinitions contains any fields of type 'obs', `registrationObs.encounterTypeUuid` must be specified."),(0,i.validator)((function(e){return e.sections.every((function(t){return a(o).concat(a(e.sectionDefinitions)).map((function(e){return e.id})).includes(t)}))}),(function(e){var t=a(o).concat(a(e.sectionDefinitions)).map((function(e){return e.id})),n=e.sections.find((function(e){return!t.includes(e)}));return"'".concat(n,"' is not a valid section ID. Valid section IDs include the built-in sections ").concat(l(o))+(e.sectionDefinitions.length?"; and the defined sections ".concat(l(e.sectionDefinitions),"."):".")})),(0,i.validator)((function(e){return e.sectionDefinitions.every((function(t){return t.fields.every((function(t){return a(s).concat(a(e.fieldDefinitions.map((function(e){return e.id})))).includes(t)}))}))}),(function(e){var t=a(s).concat(a(e.fieldDefinitions.map((function(e){return e.id})))),n=e.sectionDefinitions.find((function(e){return e.fields.some((function(e){return!t.includes(e)}))})),i=n.fields.find((function(e){return!t.includes(e)}));return"The section definition '".concat(n.id,"' contains an invalid field '").concat(i,"'. 'fields' can only contain the built-in fields '").concat(s.join("', '"),"'")+(e.fieldDefinitions.length?"; or the defined fields ".concat(l(e.fieldDefinitions),"."):".")}))]};function l(e){return"'".concat(e.map((function(e){return e.id})).join("', '"),"'")}},8179:(e,t,n)=>{"use strict";n.d(t,{Kt:()=>l,QT:()=>c,UO:()=>s,e1:()=>u});var i,r,a,o=n(906),s="custom:(display,uuid,personA:(age,display,birthdate,uuid),personB:(age,display,birthdate,uuid),relationshipType:(uuid,display,description,aIsToB,bIsToA))",u="@openmrs/esm-patient-registration-app",l="patient-registration",c=(i={},a="network-first",(r=o.omrsOfflineCachingStrategyHttpHeaderName)in i?Object.defineProperty(i,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):i[r]=a,i)},7068:(e,t,n)=>{"use strict";n.r(t),n.d(t,{backendDependencies:()=>v,importTranslation:()=>b,setupOpenMRS:()=>g,version:()=>m});var i=n(906),r=n(3076),a=n(225),o=n(8179),s=n(6279);function u(e,t,n,i,r,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(i,r)}function l(e){return function(){var t=this,n=arguments;return new Promise((function(i,r){var a=e.apply(t,n);function o(e){u(a,i,r,o,s,"next",e)}function s(e){u(a,i,r,o,s,"throw",e)}o(void 0)}))}}var c=function(e,t){var n,i,r,a,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&a[0]?i.return:a[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;switch(i=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,i=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){o.label=a[1];break}if(6===a[0]&&o.label<r[1]){o.label=r[1],r=a;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(a);break}r[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],i=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}};function d(e){return["/ws/fhir2/R4/Patient/".concat(e),"/ws/rest/v1/relationship?v=".concat(o.UO,"&person=").concat(e),"/ws/rest/v1/person/".concat(e,"/attribute"),"/ws/rest/v1/patient/".concat(e,"/identifier?v=custom:(uuid,identifier,identifierType:(uuid,required,name),preferred)")].map((function(e){return window.origin+(0,i.makeUrl)(e)}))}function f(){return p.apply(this,arguments)}function p(){return(p=l((function(){return c(this,(function(e){switch(e.label){case 0:return[4,Promise.all([(0,s.X1)(),(0,s.Te)(),(0,s.mt)(),(0,s.St)()])];case 1:return e.sent(),[2]}}))}))).apply(this,arguments)}function h(e,t){return y.apply(this,arguments)}function y(){return(y=l((function(e,t){return c(this,(function(n){switch(n.label){case 0:return[4,r.y.savePatientFormOnline(e._patientRegistrationData.isNewPatient,e._patientRegistrationData.formValues,e._patientRegistrationData.patientUuidMap,e._patientRegistrationData.initialAddressFieldValues,e._patientRegistrationData.capturePhotoProps,e._patientRegistrationData.currentLocation,e._patientRegistrationData.initialIdentifierValues,e._patientRegistrationData.currentUser,e._patientRegistrationData.config,e._patientRegistrationData.savePatientTransactionManager,t.abort)];case 1:return n.sent(),[2]}}))}))).apply(this,arguments)}var m="4.3.1-pre.1421",b=n(3979),v={"webservices.rest":"^2.24.0"};function g(){var e={featureName:"Patient Registration",moduleName:o.e1};return(0,i.defineConfigSchema)(o.e1,a.bT),(0,i.registerBreadcrumbs)([{path:"".concat(window.spaBase,"/").concat(o.Kt),title:"Patient Registration",parent:"".concat(window.spaBase,"/home")},{path:"".concat(window.spaBase,"/patient/:patientUuid/edit"),title:"Edit patient details",parent:"".concat(window.spaBase,"/patient/:patientUuid/chart")}]),(0,i.setupOfflineSync)(o.Kt,[],h,{onBeginEditSyncItem:function(e){(0,i.navigate)({to:"${openmrsSpaBase}/patient/".concat(e.content.fhirPatient.id,"/edit")})}}),(0,i.subscribePrecacheStaticDependencies)(f),(0,i.setupDynamicOfflineDataHandler)({id:"esm-patient-registration-app:patient",type:"patient",displayName:"Patient registration",isSynced:function(e){return l((function(){var t,n;return c(this,(function(i){switch(i.label){case 0:return t=d(e),[4,caches.open("omrs-spa-cache-v1")];case 1:return[4,i.sent().keys()];case 2:return n=i.sent().map((function(e){return e.url})),[2,t.every((function(e){return n.includes(e)}))]}}))}))()},sync:function(e){return l((function(){var t;return c(this,(function(n){switch(n.label){case 0:return t=d(e),[4,Promise.allSettled(t.map((r=l((function(e){return c(this,(function(t){switch(t.label){case 0:return[4,(0,i.messageOmrsServiceWorker)({type:"registerDynamicRoute",url:e})];case 1:return t.sent(),[4,fetch(e)];case 2:return t.sent(),[2]}}))})),function(e){return r.apply(this,arguments)})))];case 1:return n.sent(),[2]}var r}))}))()}}),{pages:[{load:(0,i.getAsyncLifecycle)((function(){return Promise.all([n.e(417),n.e(805),n.e(947),n.e(924),n.e(698)]).then(n.bind(n,9698))}),e),route:"patient-registration",online:{savePatientForm:r.y.savePatientFormOnline,isOffline:!1},offline:{savePatientForm:r.y.savePatientFormOffline,isOffline:!0}},{load:(0,i.getAsyncLifecycle)((function(){return Promise.all([n.e(417),n.e(805),n.e(947),n.e(924),n.e(698)]).then(n.bind(n,9698))}),{featureName:"edit-patient-details-form",moduleName:o.e1}),route:/patient\/([a-zA-Z0-9\-]+)\/edit/,online:{savePatientForm:r.y.savePatientFormOnline},offline:{savePatientForm:r.y.savePatientFormOffline}}],extensions:[{id:"add-patient-action",slot:"top-nav-actions-slot",load:(0,i.getAsyncLifecycle)((function(){return Promise.all([n.e(417),n.e(805),n.e(887)]).then(n.bind(n,8887))}),e),online:!0,offline:!0},{id:"cancel-patient-edit-modal",load:(0,i.getAsyncLifecycle)((function(){return Promise.all([n.e(417),n.e(924),n.e(735)]).then(n.bind(n,5735))}),e),online:!0,offline:!0},{id:"patient-photo-widget",slot:"patient-photo-slot",load:(0,i.getAsyncLifecycle)((function(){return Promise.all([n.e(317),n.e(975)]).then(n.bind(n,9975))}),e),online:!0,offline:!0},{id:"edit-patient-details-button",slot:"patient-actions-slot",load:(0,i.getAsyncLifecycle)((function(){return Promise.all([n.e(924),n.e(635)]).then(n.bind(n,2635))}),e),online:!0,offline:!0},{id:"edit-patient-details-button",slot:"patient-search-actions-slot",load:(0,i.getAsyncLifecycle)((function(){return Promise.all([n.e(924),n.e(635)]).then(n.bind(n,2635))}),e),online:!0,offline:!0},{id:"delete-identifier-confirmation-modal",load:(0,i.getAsyncLifecycle)((function(){return Promise.all([n.e(417),n.e(924),n.e(207)]).then(n.bind(n,7319))}),e),online:!0,offline:!0}]}}},6279:(e,t,n)=>{"use strict";n.d(t,{Cg:()=>T,St:()=>C,Te:()=>D,X1:()=>P,mt:()=>O});var r=n(268),a=n.n(r),o=n(286),s=n(2777),u=n(8407),l=n(906),c=n(8179);function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function f(e){if(Array.isArray(e))return e}function p(e,t,n,i,r,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(i,r)}function h(e){return function(){var t=this,n=arguments;return new Promise((function(i,r){var a=e.apply(t,n);function o(e){p(a,i,r,o,s,"next",e)}function s(e){p(a,i,r,o,s,"throw",e)}o(void 0)}))}}function y(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function m(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function b(e,t){return f(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(i=n.next()).done)&&(a.push(i.value),!t||a.length!==t);o=!0);}catch(e){s=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw r}}return a}}(e,t)||w(e,t)||m()}function v(e){return f(e)||y(e)||w(e,i)||m()}function g(e){return function(e){if(Array.isArray(e))return d(e)}(e)||y(e)||w(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function w(e,t){if(e){if("string"==typeof e)return d(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(e,t):void 0}}var _=function(e,t){var n,i,r,a,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&a[0]?i.return:a[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;switch(i=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,i=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){o.label=a[1];break}if(6===a[0]&&o.label<r[1]){o.label=r[1],r=a;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(a);break}r[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],i=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}},T=a().createContext(null);function P(){return S.apply(this,arguments)}function S(){return(S=h((function(){return _(this,(function(e){switch(e.label){case 0:return[4,x("/ws/rest/v1/session")];case 1:return[2,e.sent().data]}}))}))).apply(this,arguments)}function D(){return U.apply(this,arguments)}function U(){return(U=h((function(){return _(this,(function(e){switch(e.label){case 0:return[4,x("/ws/rest/v1/systemsetting?q=layout.address.format&v=custom:(value)")];case 1:return[2,e.sent().data]}}))}))).apply(this,arguments)}function O(){return A.apply(this,arguments)}function A(){return(A=h((function(){return _(this,(function(e){switch(e.label){case 0:return[4,x("/ws/rest/v1/relationshiptype?v=default")];case 1:return[2,e.sent().data]}}))}))).apply(this,arguments)}function C(){return k.apply(this,arguments)}function k(){return(k=h((function(){var e,t,n,i,r,a;return _(this,(function(s){switch(s.label){case 0:return[4,N()];case 1:return e=s.sent(),t=e.filter(Boolean),[4,Promise.all([B()].concat(g(t.map((function(e){return j(e.uuid)})))))];case 2:for(n=v.apply(void 0,[s.sent()]),i=n[0],r=n.slice(1),a=0;a<(null==t?void 0:t.length);a++)t[a].identifierSources=r[a].data.results.map((function(e){var t=(0,o.Z)(i.data.results,{source:{uuid:e.uuid}});return e.autoGenerationOption=t,e}));return[2,t]}}))}))).apply(this,arguments)}function N(){return I.apply(this,arguments)}function I(){return(I=h((function(){var e,t,n,i,r,a,o,s,u,l;return _(this,(function(c){switch(c.label){case 0:return[4,Promise.all([x("/ws/rest/v1/patientidentifiertype?v=custom:(display,uuid,name,format,required,uniquenessBehavior)"),x("/ws/rest/v1/metadatamapping/termmapping?v=full&code=emr.primaryIdentifierType")])];case 1:return e=b.apply(void 0,[c.sent(),2]),t=e[0],n=e[1],t.ok?(s=null==t||null===(i=t.data)||void 0===i?void 0:i.results,u=null==n||null===(r=n.data)||void 0===r||null===(a=r.results)||void 0===a||null===(o=a[0])||void 0===o?void 0:o.metadataUuid,l=(null==n?void 0:n.ok)?[R(null==s?void 0:s.find((function(e){return e.uuid===u})),!0)]:[],s.forEach((function(e){e.uuid!==u&&l.push(R(e,!1))})),[2,l]):[2,[]]}}))}))).apply(this,arguments)}function j(e){return F.apply(this,arguments)}function F(){return(F=h((function(e){return _(this,(function(t){switch(t.label){case 0:return[4,x("/ws/rest/v1/idgen/identifiersource?v=default&identifierType=".concat(e))];case 1:return[2,t.sent()]}}))}))).apply(this,arguments)}function B(e){return E.apply(this,arguments)}function E(){return(E=h((function(e){return _(this,(function(e){switch(e.label){case 0:return[4,x("/ws/rest/v1/idgen/autogenerationoption?v=full")];case 1:return[2,e.sent()]}}))}))).apply(this,arguments)}function x(e){return L.apply(this,arguments)}function L(){return(L=h((function(e){var t;return _(this,(function(n){switch(n.label){case 0:return t=new AbortController,[4,(0,l.messageOmrsServiceWorker)({type:"registerDynamicRoute",pattern:(0,u.Z)(e)})];case 1:return n.sent(),[4,(0,l.openmrsFetch)(e,{headers:c.QT,signal:null==t?void 0:t.signal})];case 2:return[2,n.sent()]}}))}))).apply(this,arguments)}function R(e,t){return{name:e.display,fieldName:(0,s.Z)(e.name),required:e.required,uuid:e.uuid,format:e.format,isPrimary:t,uniquenessBehavior:e.uniquenessBehavior}}},3076:(e,t,n)=>{"use strict";n.d(t,{I:()=>m,y:()=>y});var i=n(906),r=n(8179),a=n(7117);function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function s(e,t,n,i,r,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(i,r)}function u(e){return function(){var t=this,n=arguments;return new Promise((function(i,r){var a=e.apply(t,n);function o(e){s(a,i,r,o,u,"next",e)}function u(e){s(a,i,r,o,u,"throw",e)}o(void 0)}))}}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),i.forEach((function(t){c(e,t,n[t])}))}return e}function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(i=n.next()).done)&&(a.push(i.value),!t||a.length!==t);o=!0);}catch(e){s=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return o(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var p,h=function(e,t){var n,i,r,a,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&a[0]?i.return:a[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;switch(i=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,i=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){o.label=a[1];break}if(6===a[0]&&o.label<r[1]){o.label=r[1],r=a;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(a);break}r[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],i=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}},y=function(){function e(){l(this,e)}return e.saveRelationships=function(e,t){return u((function(){return h(this,(function(n){return[2,Promise.all(e.filter((function(e){return e.relationshipType})).filter((function(e){return!!e.action})).map((function(e){var n=e.relatedPersonUuid,i=e.relationshipType,r=e.uuid,o=e.action,s=f(i.split("/"),2),u=s[0],l=s[1],c=t.data.uuid,d="aIsToB"===l,p={personA:d?n:c,personB:d?c:n,relationshipType:u};switch(o){case"ADD":return(0,a.bL)(p);case"UPDATE":return(0,a.r6)(r,p);case"DELETE":return(0,a.kE)(r)}})))]}))}))()},e.saveObservations=function(e,t,n,i,r){return u((function(){var o;return h(this,(function(s){if(e&&Object.keys(e).length>0){if(r.registrationObs.encounterTypeUuid)return o={encounterDatetime:new Date,patient:t.data.uuid,encounterType:r.registrationObs.encounterTypeUuid,location:n,encounterProviders:[{provider:i.currentProvider.uuid,encounterRole:r.registrationObs.encounterProviderRoleUuid}],form:r.registrationObs.registrationFormUuid,obs:Object.keys(e).map((function(t){return{concept:t,value:e[t]}}))},[2,(0,a.M1)(o)];console.error("The registration form has been configured to have obs fields, but no registration encounter type has been configured. Obs field values will not be saved.")}return[2]}))}))()},e.savePatientIdentifiers=function(e,t,n,i,r){return u((function(){var o;return h(this,(function(s){var l;return o=Object.values(n).filter((function(e){var t=e.identifierValue,n=e.autoGeneration,i=e.selectedSource;return t||n&&i})).map((l=u((function(n){var i,o,s,u,l,c,d,f,p,y;return h(this,(function(h){switch(h.label){case 0:return i=n.identifierTypeUuid,o=n.identifierValue,s=n.identifierUuid,u=n.selectedSource,l=n.preferred,c=n.autoGeneration,d=n.initialValue,c?[3,1]:(p=o,[3,4]);case 1:return[4,(0,a.fX)(u.uuid)];case 2:return[4,h.sent().data.identifier];case 3:p=h.sent(),h.label=4;case 4:return y={uuid:s,identifier:f=p,identifierType:i,location:r,preferred:l},e?[3,8]:d?[3,6]:[4,(0,a.eb)(t,y)];case 5:return h.sent(),[3,8];case 6:return d===f?[3,8]:[4,(0,a.nI)(t,s,y.identifier)];case 7:h.sent(),h.label=8;case 8:return[2,y]}}))})),function(e){return l.apply(this,arguments)})),t&&Object.keys(i).filter((function(e){return!n[e]})).forEach(function(){var e=u((function(e){return h(this,(function(n){switch(n.label){case 0:return[4,(0,a.ZB)(t,i[e].identifierUuid)];case 1:return n.sent(),[2]}}))}));return function(t){return e.apply(this,arguments)}}()),[2,Promise.all(o)]}))}))()},e.getDeletedNames=function(e,t){return(null==t?void 0:t.additionalNameUuid)?[{nameUuid:t.additionalNameUuid,personUuid:e}]:[]},e.getPatientToCreate=function(t,n,i,r){var a,o,s;return o=t.birthdate,a=(null!=(s=Date)&&"undefined"!=typeof Symbol&&s[Symbol.hasInstance]?s[Symbol.hasInstance](o):o instanceof s)?[t.birthdate.getFullYear(),t.birthdate.getMonth()+1,t.birthdate.getDate()].join("-"):t.birthdate,{uuid:t.patientUuid,person:d({uuid:t.patientUuid,names:e.getNames(t,n),gender:t.gender.charAt(0),birthdate:a,birthdateEstimated:t.birthdateEstimated,attributes:e.getPatientAttributes(t),addresses:[t.address]},e.getPatientDeathInfo(t)),identifiers:r}},e.getNames=function(e,t){var n=[{uuid:t.preferredNameUuid,preferred:!0,givenName:e.givenName,middleName:e.middleName,familyName:e.familyName}];return e.addNameInLocalLanguage&&n.push({uuid:t.additionalNameUuid,preferred:!1,givenName:e.additionalGivenName,middleName:e.additionalMiddleName,familyName:e.additionalFamilyName}),n},e.getPatientAttributes=function(e){var t=[];if(e.attributes){var n=!0,i=!1,r=void 0;try{for(var a,o=Object.entries(e.attributes)[Symbol.iterator]();!(n=(a=o.next()).done);n=!0){var s=f(a.value,2),u=s[0],l=s[1];t.push({attributeType:u,value:l})}}catch(e){i=!0,r=e}finally{try{n||null==o.return||o.return()}finally{if(i)throw r}}}return e.unidentifiedPatient&&t.push({attributeType:"8b56eac7-5c76-4b9c-8c6f-1deab8d3fc47",value:"true"}),t},e.getPatientDeathInfo=function(e){var t=e.isDead,n=e.deathDate,i=e.deathCause;return{dead:t,deathDate:t?n:void 0,causeOfDeath:t?i:void 0}},e.mapPatientToFhirPatient=function(e){var t,n,i,r,a,o;return{id:e.uuid,gender:{M:"male",F:"female",O:"other",U:"unknown"}[null===(t=e.person)||void 0===t?void 0:t.gender],birthDate:null===(n=e.person)||void 0===n?void 0:n.birthdate,deceasedBoolean:e.person.dead,deceasedDateTime:e.person.deathDate,name:null===(i=e.person)||void 0===i||null===(r=i.names)||void 0===r?void 0:r.map((function(e){return{given:[e.givenName,e.middleName].filter(Boolean),family:e.familyName}})),address:null===(a=e.person)||void 0===a?void 0:a.addresses.map((function(e){return{city:e.cityVillage,country:e.country,postalCode:e.postalCode,state:e.stateProvince,use:"home"}})),telecom:null===(o=e.person.attributes)||void 0===o?void 0:o.filter((function(e){return"Telephone Number"===e.attributeType}))}},e}();y.savePatientFormOffline=(p=u((function(e,t,n,a,o,s,u,l,c){var d;return h(this,(function(f){switch(f.label){case 0:return d={fhirPatient:y.mapPatientToFhirPatient(y.getPatientToCreate(t,n,a,[])),_patientRegistrationData:{isNewPatient:e,formValues:t,patientUuidMap:n,initialAddressFieldValues:a,capturePhotoProps:o,currentLocation:s,initialIdentifierValues:u,currentUser:l,config:c,savePatientTransactionManager:new m}},[4,(0,i.queueSynchronizationItem)(r.Kt,d,{id:t.patientUuid,displayName:"Patient registration",patientUuid:d.fhirPatient.id,dependencies:[]})];case 1:return f.sent(),[2,null]}}))})),function(e,t,n,i,r,a,o,s,u){return p.apply(this,arguments)}),y.savePatientFormOnline=function(){var e=u((function(e,t,n,i,r,o,s,l,c,d,f){var p,m,b;return h(this,(function(f){switch(f.label){case 0:return[4,y.savePatientIdentifiers(e,t.patientUuid,t.identifiers,s,o)];case 1:return p=f.sent(),m=y.getPatientToCreate(t,n,i,p),y.getDeletedNames(t.patientUuid,n).forEach(function(){var e=u((function(e){return h(this,(function(t){switch(t.label){case 0:return[4,(0,a.uO)(e.nameUuid,e.personUuid)];case 1:return t.sent(),[2]}}))}));return function(t){return e.apply(this,arguments)}}()),[4,(0,a.co)(m,e&&!d.patientSaved?void 0:t.patientUuid)];case 2:return(b=f.sent()).ok?(d.patientSaved=!0,[4,y.saveRelationships(t.relationships,b)]):[3,6];case 3:return f.sent(),[4,y.saveObservations(t.obs,b,o,l,c)];case 4:return f.sent(),c.concepts.patientPhotoUuid&&(null==r?void 0:r.imageData)?[4,(0,a.oV)(b.data.uuid,r.imageData,"/ws/rest/v1/obs",r.dateTime||(new Date).toISOString(),c.concepts.patientPhotoUuid)]:[3,6];case 5:f.sent(),f.label=6;case 6:return[2,b.data.uuid]}}))}));return function(t,n,i,r,a,o,s,u,l,c,d){return e.apply(this,arguments)}}();var m=function e(){l(this,e),this.patientSaved=!1}},7117:(e,t,n)=>{"use strict";n.d(t,{M1:()=>f,M8:()=>_,Uu:()=>w,ZB:()=>O,bL:()=>y,co:()=>d,eb:()=>P,f$:()=>C,fX:()=>p,kE:()=>b,nI:()=>D,oV:()=>v,r6:()=>m,uO:()=>h});var i=n(268),r=n(3255),a=n(2303),o=n(906);function s(e,t,n,i,r,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(i,r)}function u(e){return function(){var t=this,n=arguments;return new Promise((function(i,r){var a=e.apply(t,n);function o(e){s(a,i,r,o,u,"next",e)}function u(e){s(a,i,r,o,u,"throw",e)}o(void 0)}))}}var l=function(e,t){var n,i,r,a,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&a[0]?i.return:a[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;switch(i=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,i=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){o.label=a[1];break}if(6===a[0]&&o.label<r[1]){o.label=r[1],r=a;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(a);break}r[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],i=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}};function c(e){for(var t=atob(e.split(",")[1]),n=e.split(",")[0].split(":")[1].split(";")[0],i=new Uint8Array(t.length),r=0;r<t.length;r++)i[r]=t.charCodeAt(r);var a=new Blob([i],{type:n});return new File([a],"patient-photo.png")}function d(e,t){var n=new AbortController;return(0,o.openmrsFetch)("/ws/rest/v1/patient/".concat(t||""),{headers:{"Content-Type":"application/json"},method:"POST",body:e,signal:n.signal})}function f(e){var t=new AbortController;return(0,o.openmrsFetch)("/ws/rest/v1/encounter",{headers:{"Content-Type":"application/json"},method:"POST",body:e,signal:t.signal})}function p(e){var t=new AbortController;return(0,o.openmrsFetch)("/ws/rest/v1/idgen/identifiersource/".concat(e,"/identifier"),{headers:{"Content-Type":"application/json"},method:"POST",body:{},signal:t.signal})}function h(e,t){var n=new AbortController;return(0,o.openmrsFetch)("/ws/rest/v1/person/".concat(t,"/name/").concat(e),{method:"DELETE",signal:n.signal})}function y(e){var t=new AbortController;return(0,o.openmrsFetch)("/ws/rest/v1/relationship",{headers:{"Content-Type":"application/json"},method:"POST",body:e,signal:t.signal})}function m(e,t){var n=new AbortController;return(0,o.openmrsFetch)("/ws/rest/v1/relationship/".concat(e),{headers:{"Content-Type":"application/json"},method:"POST",body:{relationshipType:t.relationshipType},signal:n.signal})}function b(e){var t=new AbortController;return(0,o.openmrsFetch)("/ws/rest/v1/relationship/".concat(e),{headers:{"Content-Type":"application/json"},method:"DELETE",signal:t.signal})}function v(e,t,n,i,r){return g.apply(this,arguments)}function g(){return(g=u((function(e,t,n,i,r){var a,s;return l(this,(function(u){return a=new AbortController,(s=new FormData).append("patient",e),s.append("file",c(t)),s.append("json",JSON.stringify({person:e,concept:r,groupMembers:[],obsDatetime:i})),[2,(0,o.openmrsFetch)(n,{method:"POST",signal:a.signal,body:s})]}))}))).apply(this,arguments)}function w(e){var t,n,i,a=(0,o.useConfig)().concepts.patientPhotoUuid,s="/ws/rest/v1/obs?patient=".concat(e,"&concept=").concat(a,"&v=full"),u=(0,r.ZP)(e?s:null,o.openmrsFetch),l=u.data,c=u.error,d=u.isLoading,f=null==l||null===(t=l.data)||void 0===t?void 0:t.results[0];return{data:f?{dateTime:null==f?void 0:f.obsDatetime,imageSrc:null==f||null===(n=f.value)||void 0===n||null===(i=n.links)||void 0===i?void 0:i.uri}:null,isError:c,isLoading:d}}function _(e){return T.apply(this,arguments)}function T(){return(T=u((function(e){var t;return l(this,(function(n){return t=new AbortController,[2,(0,o.openmrsFetch)("/ws/rest/v1/person?q=".concat(e),{signal:t.signal})]}))}))).apply(this,arguments)}function P(e,t){return S.apply(this,arguments)}function S(){return(S=u((function(e,t){var n;return l(this,(function(i){return n=new AbortController,[2,(0,o.openmrsFetch)("/ws/rest/v1/patient/".concat(e,"/identifier/"),{method:"POST",headers:{"Content-Type":"application/json"},signal:n.signal,body:t})]}))}))).apply(this,arguments)}function D(e,t,n){return U.apply(this,arguments)}function U(){return(U=u((function(e,t,n){var i;return l(this,(function(r){return i=new AbortController,[2,(0,o.openmrsFetch)("/ws/rest/v1/patient/".concat(e,"/identifier/").concat(t),{method:"POST",headers:{"Content-Type":"application/json"},signal:i.signal,body:{identifier:n}})]}))}))).apply(this,arguments)}function O(e,t){return A.apply(this,arguments)}function A(){return(A=u((function(e,t){var n;return l(this,(function(i){return n=new AbortController,[2,(0,o.openmrsFetch)("/ws/rest/v1/patient/".concat(e,"/identifier/").concat(t,"?purge"),{method:"DELETE",headers:{"Content-Type":"application/json"},signal:n.signal})]}))}))).apply(this,arguments)}function C(e,t){var n,r=(0,a.Z)(e?"/module/addresshierarchy/ajax/getPossibleFullAddresses.form?separator=".concat(t,"&searchString=").concat(e):null,o.openmrsFetch),s=r.data,u=r.error,l=r.isLoading,c=(0,i.useMemo)((function(){var e;return{addresses:null!==(n=null==s||null===(e=s.data)||void 0===e?void 0:e.map((function(e){return e.address})))&&void 0!==n?n:[],error:u,isLoading:l}}),[null==s?void 0:s.data,u,l]);return c}},3979:(e,t,n)=>{var i={"./en.json":[3574,574],"./fr.json":[2757,757],"./km.json":[7807,807]};function r(e){if(!n.o(i,e))return Promise.resolve().then((()=>{var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}));var t=i[e],r=t[0];return n.e(t[1]).then((()=>n(r)))}r.keys=()=>Object.keys(i),r.id=3979,e.exports=r}}]);
|
|
1
|
+
(globalThis.webpackChunk_openmrs_esm_patient_registration_app=globalThis.webpackChunk_openmrs_esm_patient_registration_app||[]).push([[68],{225:(e,t,n)=>{"use strict";n.d(t,{X8:()=>s,bT:()=>u,bs:()=>o});var i=n(906);function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function a(e){return function(e){if(Array.isArray(e))return r(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var o=[{id:"demographics",name:"Basic Info",fields:["name","gender","dob","id"]},{id:"contact",name:"Contact Details",fields:["address","phone"]},{id:"death",name:"Death Info",fields:[]},{id:"relationships",name:"Relationships",fields:[]}],s=["name","gender","dob","address","id","phone & email"],u={sections:{_type:i.Type.Array,_default:["demographics","contact","relationships"],_description:"An array of strings which are the keys from 'sectionDefinitions' or any of the following built-in sections: '".concat(o.map((function(e){return e.id})).join("', '"),"'."),_elements:{_type:i.Type.String}},sectionDefinitions:{_type:i.Type.Array,_elements:{id:{_type:i.Type.String,_description:"How this section will be referred to in the `sections` configuration. To override a built-in section, use that section's id. The built in section ids are '".concat(o.map((function(e){return e.id})).join("', '"),"'.")},name:{_type:i.Type.String,_description:"The title to display at the top of the section."},fields:{_type:i.Type.Array,_default:[],_description:"The parts to include in the section. Can be any of the following built-in fields: ".concat(s.join(", "),". Can also be an id from an object in the `fieldDefinitions` array, which you can use to define custom fields."),_elements:{_type:i.Type.String}}},_default:[]},fieldDefinitions:{_type:i.Type.Array,_elements:{id:{_type:i.Type.String,_description:"How this field will be referred to in the `fields` element of the `sectionDefinitions` configuration."},type:{_type:i.Type.String,_description:"How this field's data will be stored—a person attribute or an obs."},uuid:{_type:i.Type.UUID,_description:"Person attribute type UUID that this field's data should be saved to."},showHeading:{_type:i.Type.Boolean,_description:"Whether to show a heading above the person attribute field.",_default:!1},label:{_type:i.Type.String,_default:null,_description:"The label of the input. By default, uses the metadata `display` attribute."},placeholder:{_type:i.Type.String,_default:"",_description:"Placeholder that will appear in the input."},validation:{required:{_type:i.Type.Boolean,_default:!1},matches:{_type:i.Type.String,_default:null,_description:"Optional RegEx for testing the validity of the input."}},answerConceptSetUuid:{_type:i.Type.ConceptUuid,_default:null,_description:"For coded questions only. A concept which has the possible responses either as answers or as set members."},customConceptAnswers:{_type:i.Type.Array,_elements:{uuid:{_type:i.Type.UUID,_description:"Answer concept UUID"},label:{_type:i.Type.String,_default:null,_description:"The custom label for the answer concept."}},_default:[],_description:"For coded questions only. Provide ability to add custom concept answers."}},_default:[{id:"phone",type:"person attribute",uuid:"14d4f066-15f5-102d-96e4-000c29c2a5d7",showHeading:!1,validation:{matches:""}}],_description:"Definitions for custom fields that can be used in sectionDefinitions. Can also be used to override built-in fields."},fieldConfigurations:{name:{displayMiddleName:{_type:i.Type.Boolean,_default:!0},unidentifiedPatient:{_type:i.Type.Boolean,_default:!0,_description:"Whether to allow patients to be registered without names."},defaultUnknownGivenName:{_type:i.Type.String,_default:"UNKNOWN",_description:"The given/first name to record for unidentified patients."},defaultUnknownFamilyName:{_type:i.Type.String,_default:"UNKNOWN",_description:"The family/last name to record for unidentified patients."},displayCapturePhoto:{_type:i.Type.Boolean,_default:!0,_description:"Whether to display capture patient photo slot on name field"}},gender:{_type:i.Type.Array,_elements:{value:{_type:i.Type.String,_description:"The value for sex option"},label:{_type:i.Type.String,_default:null,_description:"The label displayed for sex option."},id:{_type:i.Type.String,_default:null,_description:"The id for sex option."}},_default:[{id:"male",value:"Male",label:"Male"},{id:"female",value:"Female",label:"Female"},{id:"other",value:"Other",label:"Other"},{id:"unknown",value:"Unknown",label:"Unknown"}],_description:"Provide ability to configure sex options."},address:{useAddressHierarchy:{enabled:{_type:i.Type.Boolean,_description:"Whether to use the Address hierarchy in the registration form or not",_default:!0},useQuickSearch:{_type:i.Type.Boolean,_description:"Whether to use the quick searching through the address saved in the database pre-fill the form.",_default:!0},searchAddressByLevel:{_type:i.Type.Boolean,_description:"Whether to fill the addresses by levels, i.e. County => subCounty, the current field is dependent on it's previous field.",_default:!1},useAddressHierarchyLabel:{_type:i.Type.Object,_description:"Whether to use custom labels for address hierarchy",_default:{}}}},dateOfBirth:{useEstimatedDateOfBirth:{enabled:{_type:i.Type.Boolean,_description:"Whether to use custom day and month for estimated date of birth",_default:!1},dayOfMonth:{_type:i.Type.Number,_description:"The custom day of the month use on the estimated date of birth",_default:0},month:{_type:i.Type.Number,_description:"The custom month to use on the estimated date of birth i.e 0 = Jan 11 = Dec",_default:0}}}},links:{submitButton:{_type:i.Type.String,_default:"${openmrsSpaBase}/patient/${patientUuid}/chart",_validators:[i.validators.isUrlWithTemplateParameters(["patientUuid"])]}},concepts:{patientPhotoUuid:{_type:i.Type.ConceptUuid,_default:"736e8771-e501-4615-bfa7-570c03f4bef5"}},defaultPatientIdentifierTypes:{_type:i.Type.Array,_elements:{_type:i.Type.PatientIdentifierTypeUuid},_default:[]},registrationObs:{encounterTypeUuid:{_type:i.Type.UUID,_default:null,_description:"Obs created during registration will be associated with an encounter of this type. This must be set in order to use fields of type `obs`."},encounterProviderRoleUuid:{_type:i.Type.UUID,_default:"a0b03050-c99b-11e0-9572-0800200c9a66",_description:"The provider role to use for the registration encounter. Default is 'Unkown'."},registrationFormUuid:{_type:i.Type.UUID,_default:null,_description:"The form UUID to associate with the registration encounter. By default no form will be associated."}},_validators:[(0,i.validator)((function(e){return!e.fieldDefinitions.some((function(e){return"obs"==e.type}))||null!=e.registrationObs.encounterTypeUuid}),"If fieldDefinitions contains any fields of type 'obs', `registrationObs.encounterTypeUuid` must be specified."),(0,i.validator)((function(e){return e.sections.every((function(t){return a(o).concat(a(e.sectionDefinitions)).map((function(e){return e.id})).includes(t)}))}),(function(e){var t=a(o).concat(a(e.sectionDefinitions)).map((function(e){return e.id})),n=e.sections.find((function(e){return!t.includes(e)}));return"'".concat(n,"' is not a valid section ID. Valid section IDs include the built-in sections ").concat(l(o))+(e.sectionDefinitions.length?"; and the defined sections ".concat(l(e.sectionDefinitions),"."):".")})),(0,i.validator)((function(e){return e.sectionDefinitions.every((function(t){return t.fields.every((function(t){return a(s).concat(a(e.fieldDefinitions.map((function(e){return e.id})))).includes(t)}))}))}),(function(e){var t=a(s).concat(a(e.fieldDefinitions.map((function(e){return e.id})))),n=e.sectionDefinitions.find((function(e){return e.fields.some((function(e){return!t.includes(e)}))})),i=n.fields.find((function(e){return!t.includes(e)}));return"The section definition '".concat(n.id,"' contains an invalid field '").concat(i,"'. 'fields' can only contain the built-in fields '").concat(s.join("', '"),"'")+(e.fieldDefinitions.length?"; or the defined fields ".concat(l(e.fieldDefinitions),"."):".")}))]};function l(e){return"'".concat(e.map((function(e){return e.id})).join("', '"),"'")}},8179:(e,t,n)=>{"use strict";n.d(t,{Kt:()=>l,QT:()=>c,UO:()=>s,e1:()=>u});var i,r,a,o=n(906),s="custom:(display,uuid,personA:(age,display,birthdate,uuid),personB:(age,display,birthdate,uuid),relationshipType:(uuid,display,description,aIsToB,bIsToA))",u="@openmrs/esm-patient-registration-app",l="patient-registration",c=(i={},a="network-first",(r=o.omrsOfflineCachingStrategyHttpHeaderName)in i?Object.defineProperty(i,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):i[r]=a,i)},7068:(e,t,n)=>{"use strict";n.r(t),n.d(t,{backendDependencies:()=>v,importTranslation:()=>b,setupOpenMRS:()=>g,version:()=>m});var i=n(906),r=n(3076),a=n(225),o=n(8179),s=n(6279);function u(e,t,n,i,r,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(i,r)}function l(e){return function(){var t=this,n=arguments;return new Promise((function(i,r){var a=e.apply(t,n);function o(e){u(a,i,r,o,s,"next",e)}function s(e){u(a,i,r,o,s,"throw",e)}o(void 0)}))}}var c=function(e,t){var n,i,r,a,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&a[0]?i.return:a[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;switch(i=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,i=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){o.label=a[1];break}if(6===a[0]&&o.label<r[1]){o.label=r[1],r=a;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(a);break}r[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],i=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}};function d(e){return["/ws/fhir2/R4/Patient/".concat(e),"/ws/rest/v1/relationship?v=".concat(o.UO,"&person=").concat(e),"/ws/rest/v1/person/".concat(e,"/attribute"),"/ws/rest/v1/patient/".concat(e,"/identifier?v=custom:(uuid,identifier,identifierType:(uuid,required,name),preferred)")].map((function(e){return window.origin+(0,i.makeUrl)(e)}))}function f(){return p.apply(this,arguments)}function p(){return(p=l((function(){return c(this,(function(e){switch(e.label){case 0:return[4,Promise.all([(0,s.X1)(),(0,s.Te)(),(0,s.mt)(),(0,s.St)()])];case 1:return e.sent(),[2]}}))}))).apply(this,arguments)}function h(e,t){return y.apply(this,arguments)}function y(){return(y=l((function(e,t){return c(this,(function(n){switch(n.label){case 0:return[4,r.y.savePatientFormOnline(e._patientRegistrationData.isNewPatient,e._patientRegistrationData.formValues,e._patientRegistrationData.patientUuidMap,e._patientRegistrationData.initialAddressFieldValues,e._patientRegistrationData.capturePhotoProps,e._patientRegistrationData.currentLocation,e._patientRegistrationData.initialIdentifierValues,e._patientRegistrationData.currentUser,e._patientRegistrationData.config,e._patientRegistrationData.savePatientTransactionManager,t.abort)];case 1:return n.sent(),[2]}}))}))).apply(this,arguments)}var m="4.3.1-pre.1435",b=n(3979),v={"webservices.rest":"^2.24.0"};function g(){var e={featureName:"Patient Registration",moduleName:o.e1};return(0,i.defineConfigSchema)(o.e1,a.bT),(0,i.registerBreadcrumbs)([{path:"".concat(window.spaBase,"/").concat(o.Kt),title:"Patient Registration",parent:"".concat(window.spaBase,"/home")},{path:"".concat(window.spaBase,"/patient/:patientUuid/edit"),title:"Edit patient details",parent:"".concat(window.spaBase,"/patient/:patientUuid/chart")}]),(0,i.setupOfflineSync)(o.Kt,[],h,{onBeginEditSyncItem:function(e){(0,i.navigate)({to:"${openmrsSpaBase}/patient/".concat(e.content.fhirPatient.id,"/edit")})}}),(0,i.subscribePrecacheStaticDependencies)(f),(0,i.setupDynamicOfflineDataHandler)({id:"esm-patient-registration-app:patient",type:"patient",displayName:"Patient registration",isSynced:function(e){return l((function(){var t,n;return c(this,(function(i){switch(i.label){case 0:return t=d(e),[4,caches.open("omrs-spa-cache-v1")];case 1:return[4,i.sent().keys()];case 2:return n=i.sent().map((function(e){return e.url})),[2,t.every((function(e){return n.includes(e)}))]}}))}))()},sync:function(e){return l((function(){var t;return c(this,(function(n){switch(n.label){case 0:return t=d(e),[4,Promise.allSettled(t.map((r=l((function(e){return c(this,(function(t){switch(t.label){case 0:return[4,(0,i.messageOmrsServiceWorker)({type:"registerDynamicRoute",url:e})];case 1:return t.sent(),[4,fetch(e)];case 2:return t.sent(),[2]}}))})),function(e){return r.apply(this,arguments)})))];case 1:return n.sent(),[2]}var r}))}))()}}),{pages:[{load:(0,i.getAsyncLifecycle)((function(){return Promise.all([n.e(417),n.e(805),n.e(947),n.e(924),n.e(698)]).then(n.bind(n,9698))}),e),route:"patient-registration",online:{savePatientForm:r.y.savePatientFormOnline,isOffline:!1},offline:{savePatientForm:r.y.savePatientFormOffline,isOffline:!0}},{load:(0,i.getAsyncLifecycle)((function(){return Promise.all([n.e(417),n.e(805),n.e(947),n.e(924),n.e(698)]).then(n.bind(n,9698))}),{featureName:"edit-patient-details-form",moduleName:o.e1}),route:/patient\/([a-zA-Z0-9\-]+)\/edit/,online:{savePatientForm:r.y.savePatientFormOnline},offline:{savePatientForm:r.y.savePatientFormOffline}}],extensions:[{id:"add-patient-action",slot:"top-nav-actions-slot",load:(0,i.getAsyncLifecycle)((function(){return Promise.all([n.e(417),n.e(805),n.e(887)]).then(n.bind(n,8887))}),e),online:!0,offline:!0},{id:"cancel-patient-edit-modal",load:(0,i.getAsyncLifecycle)((function(){return Promise.all([n.e(417),n.e(924),n.e(735)]).then(n.bind(n,5735))}),e),online:!0,offline:!0},{id:"patient-photo-widget",slot:"patient-photo-slot",load:(0,i.getAsyncLifecycle)((function(){return Promise.all([n.e(317),n.e(975)]).then(n.bind(n,9975))}),e),online:!0,offline:!0},{id:"edit-patient-details-button",slot:"patient-actions-slot",load:(0,i.getAsyncLifecycle)((function(){return Promise.all([n.e(924),n.e(635)]).then(n.bind(n,2635))}),e),online:!0,offline:!0},{id:"edit-patient-details-button",slot:"patient-search-actions-slot",load:(0,i.getAsyncLifecycle)((function(){return Promise.all([n.e(924),n.e(635)]).then(n.bind(n,2635))}),e),online:!0,offline:!0},{id:"delete-identifier-confirmation-modal",load:(0,i.getAsyncLifecycle)((function(){return Promise.all([n.e(417),n.e(924),n.e(207)]).then(n.bind(n,7319))}),e),online:!0,offline:!0}]}}},6279:(e,t,n)=>{"use strict";n.d(t,{Cg:()=>T,St:()=>C,Te:()=>D,X1:()=>P,mt:()=>O});var r=n(268),a=n.n(r),o=n(286),s=n(2777),u=n(8407),l=n(906),c=n(8179);function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function f(e){if(Array.isArray(e))return e}function p(e,t,n,i,r,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(i,r)}function h(e){return function(){var t=this,n=arguments;return new Promise((function(i,r){var a=e.apply(t,n);function o(e){p(a,i,r,o,s,"next",e)}function s(e){p(a,i,r,o,s,"throw",e)}o(void 0)}))}}function y(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function m(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function b(e,t){return f(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(i=n.next()).done)&&(a.push(i.value),!t||a.length!==t);o=!0);}catch(e){s=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw r}}return a}}(e,t)||w(e,t)||m()}function v(e){return f(e)||y(e)||w(e,i)||m()}function g(e){return function(e){if(Array.isArray(e))return d(e)}(e)||y(e)||w(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function w(e,t){if(e){if("string"==typeof e)return d(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(e,t):void 0}}var _=function(e,t){var n,i,r,a,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&a[0]?i.return:a[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;switch(i=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,i=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){o.label=a[1];break}if(6===a[0]&&o.label<r[1]){o.label=r[1],r=a;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(a);break}r[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],i=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}},T=a().createContext(null);function P(){return S.apply(this,arguments)}function S(){return(S=h((function(){return _(this,(function(e){switch(e.label){case 0:return[4,x("/ws/rest/v1/session")];case 1:return[2,e.sent().data]}}))}))).apply(this,arguments)}function D(){return U.apply(this,arguments)}function U(){return(U=h((function(){return _(this,(function(e){switch(e.label){case 0:return[4,x("/ws/rest/v1/systemsetting?q=layout.address.format&v=custom:(value)")];case 1:return[2,e.sent().data]}}))}))).apply(this,arguments)}function O(){return A.apply(this,arguments)}function A(){return(A=h((function(){return _(this,(function(e){switch(e.label){case 0:return[4,x("/ws/rest/v1/relationshiptype?v=default")];case 1:return[2,e.sent().data]}}))}))).apply(this,arguments)}function C(){return k.apply(this,arguments)}function k(){return(k=h((function(){var e,t,n,i,r,a;return _(this,(function(s){switch(s.label){case 0:return[4,N()];case 1:return e=s.sent(),t=e.filter(Boolean),[4,Promise.all([B()].concat(g(t.map((function(e){return j(e.uuid)})))))];case 2:for(n=v.apply(void 0,[s.sent()]),i=n[0],r=n.slice(1),a=0;a<(null==t?void 0:t.length);a++)t[a].identifierSources=r[a].data.results.map((function(e){var t=(0,o.Z)(i.data.results,{source:{uuid:e.uuid}});return e.autoGenerationOption=t,e}));return[2,t]}}))}))).apply(this,arguments)}function N(){return I.apply(this,arguments)}function I(){return(I=h((function(){var e,t,n,i,r,a,o,s,u,l;return _(this,(function(c){switch(c.label){case 0:return[4,Promise.all([x("/ws/rest/v1/patientidentifiertype?v=custom:(display,uuid,name,format,required,uniquenessBehavior)"),x("/ws/rest/v1/metadatamapping/termmapping?v=full&code=emr.primaryIdentifierType")])];case 1:return e=b.apply(void 0,[c.sent(),2]),t=e[0],n=e[1],t.ok?(s=null==t||null===(i=t.data)||void 0===i?void 0:i.results,u=null==n||null===(r=n.data)||void 0===r||null===(a=r.results)||void 0===a||null===(o=a[0])||void 0===o?void 0:o.metadataUuid,l=(null==n?void 0:n.ok)?[R(null==s?void 0:s.find((function(e){return e.uuid===u})),!0)]:[],s.forEach((function(e){e.uuid!==u&&l.push(R(e,!1))})),[2,l]):[2,[]]}}))}))).apply(this,arguments)}function j(e){return F.apply(this,arguments)}function F(){return(F=h((function(e){return _(this,(function(t){switch(t.label){case 0:return[4,x("/ws/rest/v1/idgen/identifiersource?v=default&identifierType=".concat(e))];case 1:return[2,t.sent()]}}))}))).apply(this,arguments)}function B(e){return E.apply(this,arguments)}function E(){return(E=h((function(e){return _(this,(function(e){switch(e.label){case 0:return[4,x("/ws/rest/v1/idgen/autogenerationoption?v=full")];case 1:return[2,e.sent()]}}))}))).apply(this,arguments)}function x(e){return L.apply(this,arguments)}function L(){return(L=h((function(e){var t;return _(this,(function(n){switch(n.label){case 0:return t=new AbortController,[4,(0,l.messageOmrsServiceWorker)({type:"registerDynamicRoute",pattern:(0,u.Z)(e)})];case 1:return n.sent(),[4,(0,l.openmrsFetch)(e,{headers:c.QT,signal:null==t?void 0:t.signal})];case 2:return[2,n.sent()]}}))}))).apply(this,arguments)}function R(e,t){return{name:e.display,fieldName:(0,s.Z)(e.name),required:e.required,uuid:e.uuid,format:e.format,isPrimary:t,uniquenessBehavior:e.uniquenessBehavior}}},3076:(e,t,n)=>{"use strict";n.d(t,{I:()=>m,y:()=>y});var i=n(906),r=n(8179),a=n(7117);function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function s(e,t,n,i,r,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(i,r)}function u(e){return function(){var t=this,n=arguments;return new Promise((function(i,r){var a=e.apply(t,n);function o(e){s(a,i,r,o,u,"next",e)}function u(e){s(a,i,r,o,u,"throw",e)}o(void 0)}))}}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),i.forEach((function(t){c(e,t,n[t])}))}return e}function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(i=n.next()).done)&&(a.push(i.value),!t||a.length!==t);o=!0);}catch(e){s=!0,r=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return o(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var p,h=function(e,t){var n,i,r,a,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&a[0]?i.return:a[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;switch(i=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,i=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){o.label=a[1];break}if(6===a[0]&&o.label<r[1]){o.label=r[1],r=a;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(a);break}r[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],i=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}},y=function(){function e(){l(this,e)}return e.saveRelationships=function(e,t){return u((function(){return h(this,(function(n){return[2,Promise.all(e.filter((function(e){return e.relationshipType})).filter((function(e){return!!e.action})).map((function(e){var n=e.relatedPersonUuid,i=e.relationshipType,r=e.uuid,o=e.action,s=f(i.split("/"),2),u=s[0],l=s[1],c=t.data.uuid,d="aIsToB"===l,p={personA:d?n:c,personB:d?c:n,relationshipType:u};switch(o){case"ADD":return(0,a.bL)(p);case"UPDATE":return(0,a.r6)(r,p);case"DELETE":return(0,a.kE)(r)}})))]}))}))()},e.saveObservations=function(e,t,n,i,r){return u((function(){var o;return h(this,(function(s){if(e&&Object.keys(e).length>0){if(r.registrationObs.encounterTypeUuid)return o={encounterDatetime:new Date,patient:t.data.uuid,encounterType:r.registrationObs.encounterTypeUuid,location:n,encounterProviders:[{provider:i.currentProvider.uuid,encounterRole:r.registrationObs.encounterProviderRoleUuid}],form:r.registrationObs.registrationFormUuid,obs:Object.keys(e).map((function(t){return{concept:t,value:e[t]}}))},[2,(0,a.M1)(o)];console.error("The registration form has been configured to have obs fields, but no registration encounter type has been configured. Obs field values will not be saved.")}return[2]}))}))()},e.savePatientIdentifiers=function(e,t,n,i,r){return u((function(){var o;return h(this,(function(s){var l;return o=Object.values(n).filter((function(e){var t=e.identifierValue,n=e.autoGeneration,i=e.selectedSource;return t||n&&i})).map((l=u((function(n){var i,o,s,u,l,c,d,f,p,y;return h(this,(function(h){switch(h.label){case 0:return i=n.identifierTypeUuid,o=n.identifierValue,s=n.identifierUuid,u=n.selectedSource,l=n.preferred,c=n.autoGeneration,d=n.initialValue,c?[3,1]:(p=o,[3,4]);case 1:return[4,(0,a.fX)(u.uuid)];case 2:return[4,h.sent().data.identifier];case 3:p=h.sent(),h.label=4;case 4:return y={uuid:s,identifier:f=p,identifierType:i,location:r,preferred:l},e?[3,8]:d?[3,6]:[4,(0,a.eb)(t,y)];case 5:return h.sent(),[3,8];case 6:return d===f?[3,8]:[4,(0,a.nI)(t,s,y.identifier)];case 7:h.sent(),h.label=8;case 8:return[2,y]}}))})),function(e){return l.apply(this,arguments)})),t&&Object.keys(i).filter((function(e){return!n[e]})).forEach(function(){var e=u((function(e){return h(this,(function(n){switch(n.label){case 0:return[4,(0,a.ZB)(t,i[e].identifierUuid)];case 1:return n.sent(),[2]}}))}));return function(t){return e.apply(this,arguments)}}()),[2,Promise.all(o)]}))}))()},e.getDeletedNames=function(e,t){return(null==t?void 0:t.additionalNameUuid)?[{nameUuid:t.additionalNameUuid,personUuid:e}]:[]},e.getPatientToCreate=function(t,n,i,r){var a,o,s;return o=t.birthdate,a=(null!=(s=Date)&&"undefined"!=typeof Symbol&&s[Symbol.hasInstance]?s[Symbol.hasInstance](o):o instanceof s)?[t.birthdate.getFullYear(),t.birthdate.getMonth()+1,t.birthdate.getDate()].join("-"):t.birthdate,{uuid:t.patientUuid,person:d({uuid:t.patientUuid,names:e.getNames(t,n),gender:t.gender.charAt(0),birthdate:a,birthdateEstimated:t.birthdateEstimated,attributes:e.getPatientAttributes(t),addresses:[t.address]},e.getPatientDeathInfo(t)),identifiers:r}},e.getNames=function(e,t){var n=[{uuid:t.preferredNameUuid,preferred:!0,givenName:e.givenName,middleName:e.middleName,familyName:e.familyName}];return e.addNameInLocalLanguage&&n.push({uuid:t.additionalNameUuid,preferred:!1,givenName:e.additionalGivenName,middleName:e.additionalMiddleName,familyName:e.additionalFamilyName}),n},e.getPatientAttributes=function(e){var t=[];if(e.attributes){var n=!0,i=!1,r=void 0;try{for(var a,o=Object.entries(e.attributes)[Symbol.iterator]();!(n=(a=o.next()).done);n=!0){var s=f(a.value,2),u=s[0],l=s[1];t.push({attributeType:u,value:l})}}catch(e){i=!0,r=e}finally{try{n||null==o.return||o.return()}finally{if(i)throw r}}}return e.unidentifiedPatient&&t.push({attributeType:"8b56eac7-5c76-4b9c-8c6f-1deab8d3fc47",value:"true"}),t},e.getPatientDeathInfo=function(e){var t=e.isDead,n=e.deathDate,i=e.deathCause;return{dead:t,deathDate:t?n:void 0,causeOfDeath:t?i:void 0}},e.mapPatientToFhirPatient=function(e){var t,n,i,r,a,o;return{id:e.uuid,gender:{M:"male",F:"female",O:"other",U:"unknown"}[null===(t=e.person)||void 0===t?void 0:t.gender],birthDate:null===(n=e.person)||void 0===n?void 0:n.birthdate,deceasedBoolean:e.person.dead,deceasedDateTime:e.person.deathDate,name:null===(i=e.person)||void 0===i||null===(r=i.names)||void 0===r?void 0:r.map((function(e){return{given:[e.givenName,e.middleName].filter(Boolean),family:e.familyName}})),address:null===(a=e.person)||void 0===a?void 0:a.addresses.map((function(e){return{city:e.cityVillage,country:e.country,postalCode:e.postalCode,state:e.stateProvince,use:"home"}})),telecom:null===(o=e.person.attributes)||void 0===o?void 0:o.filter((function(e){return"Telephone Number"===e.attributeType}))}},e}();y.savePatientFormOffline=(p=u((function(e,t,n,a,o,s,u,l,c){var d;return h(this,(function(f){switch(f.label){case 0:return d={fhirPatient:y.mapPatientToFhirPatient(y.getPatientToCreate(t,n,a,[])),_patientRegistrationData:{isNewPatient:e,formValues:t,patientUuidMap:n,initialAddressFieldValues:a,capturePhotoProps:o,currentLocation:s,initialIdentifierValues:u,currentUser:l,config:c,savePatientTransactionManager:new m}},[4,(0,i.queueSynchronizationItem)(r.Kt,d,{id:t.patientUuid,displayName:"Patient registration",patientUuid:d.fhirPatient.id,dependencies:[]})];case 1:return f.sent(),[2,null]}}))})),function(e,t,n,i,r,a,o,s,u){return p.apply(this,arguments)}),y.savePatientFormOnline=function(){var e=u((function(e,t,n,i,r,o,s,l,c,d,f){var p,m,b;return h(this,(function(f){switch(f.label){case 0:return[4,y.savePatientIdentifiers(e,t.patientUuid,t.identifiers,s,o)];case 1:return p=f.sent(),m=y.getPatientToCreate(t,n,i,p),y.getDeletedNames(t.patientUuid,n).forEach(function(){var e=u((function(e){return h(this,(function(t){switch(t.label){case 0:return[4,(0,a.uO)(e.nameUuid,e.personUuid)];case 1:return t.sent(),[2]}}))}));return function(t){return e.apply(this,arguments)}}()),[4,(0,a.co)(m,e&&!d.patientSaved?void 0:t.patientUuid)];case 2:return(b=f.sent()).ok?(d.patientSaved=!0,[4,y.saveRelationships(t.relationships,b)]):[3,6];case 3:return f.sent(),[4,y.saveObservations(t.obs,b,o,l,c)];case 4:return f.sent(),c.concepts.patientPhotoUuid&&(null==r?void 0:r.imageData)?[4,(0,a.oV)(b.data.uuid,r.imageData,"/ws/rest/v1/obs",r.dateTime||(new Date).toISOString(),c.concepts.patientPhotoUuid)]:[3,6];case 5:f.sent(),f.label=6;case 6:return[2,b.data.uuid]}}))}));return function(t,n,i,r,a,o,s,u,l,c,d){return e.apply(this,arguments)}}();var m=function e(){l(this,e),this.patientSaved=!1}},7117:(e,t,n)=>{"use strict";n.d(t,{M1:()=>f,M8:()=>_,Uu:()=>w,ZB:()=>O,bL:()=>y,co:()=>d,eb:()=>P,f$:()=>C,fX:()=>p,kE:()=>b,nI:()=>D,oV:()=>v,r6:()=>m,uO:()=>h});var i=n(268),r=n(3255),a=n(2303),o=n(906);function s(e,t,n,i,r,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(i,r)}function u(e){return function(){var t=this,n=arguments;return new Promise((function(i,r){var a=e.apply(t,n);function o(e){s(a,i,r,o,u,"next",e)}function u(e){s(a,i,r,o,u,"throw",e)}o(void 0)}))}}var l=function(e,t){var n,i,r,a,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&a[0]?i.return:a[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;switch(i=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,i=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){o.label=a[1];break}if(6===a[0]&&o.label<r[1]){o.label=r[1],r=a;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(a);break}r[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],i=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}};function c(e){for(var t=atob(e.split(",")[1]),n=e.split(",")[0].split(":")[1].split(";")[0],i=new Uint8Array(t.length),r=0;r<t.length;r++)i[r]=t.charCodeAt(r);var a=new Blob([i],{type:n});return new File([a],"patient-photo.png")}function d(e,t){var n=new AbortController;return(0,o.openmrsFetch)("/ws/rest/v1/patient/".concat(t||""),{headers:{"Content-Type":"application/json"},method:"POST",body:e,signal:n.signal})}function f(e){var t=new AbortController;return(0,o.openmrsFetch)("/ws/rest/v1/encounter",{headers:{"Content-Type":"application/json"},method:"POST",body:e,signal:t.signal})}function p(e){var t=new AbortController;return(0,o.openmrsFetch)("/ws/rest/v1/idgen/identifiersource/".concat(e,"/identifier"),{headers:{"Content-Type":"application/json"},method:"POST",body:{},signal:t.signal})}function h(e,t){var n=new AbortController;return(0,o.openmrsFetch)("/ws/rest/v1/person/".concat(t,"/name/").concat(e),{method:"DELETE",signal:n.signal})}function y(e){var t=new AbortController;return(0,o.openmrsFetch)("/ws/rest/v1/relationship",{headers:{"Content-Type":"application/json"},method:"POST",body:e,signal:t.signal})}function m(e,t){var n=new AbortController;return(0,o.openmrsFetch)("/ws/rest/v1/relationship/".concat(e),{headers:{"Content-Type":"application/json"},method:"POST",body:{relationshipType:t.relationshipType},signal:n.signal})}function b(e){var t=new AbortController;return(0,o.openmrsFetch)("/ws/rest/v1/relationship/".concat(e),{headers:{"Content-Type":"application/json"},method:"DELETE",signal:t.signal})}function v(e,t,n,i,r){return g.apply(this,arguments)}function g(){return(g=u((function(e,t,n,i,r){var a,s;return l(this,(function(u){return a=new AbortController,(s=new FormData).append("patient",e),s.append("file",c(t)),s.append("json",JSON.stringify({person:e,concept:r,groupMembers:[],obsDatetime:i})),[2,(0,o.openmrsFetch)(n,{method:"POST",signal:a.signal,body:s})]}))}))).apply(this,arguments)}function w(e){var t,n,i,a=(0,o.useConfig)().concepts.patientPhotoUuid,s="/ws/rest/v1/obs?patient=".concat(e,"&concept=").concat(a,"&v=full"),u=(0,r.ZP)(e?s:null,o.openmrsFetch),l=u.data,c=u.error,d=u.isLoading,f=null==l||null===(t=l.data)||void 0===t?void 0:t.results[0];return{data:f?{dateTime:null==f?void 0:f.obsDatetime,imageSrc:null==f||null===(n=f.value)||void 0===n||null===(i=n.links)||void 0===i?void 0:i.uri}:null,isError:c,isLoading:d}}function _(e){return T.apply(this,arguments)}function T(){return(T=u((function(e){var t;return l(this,(function(n){return t=new AbortController,[2,(0,o.openmrsFetch)("/ws/rest/v1/person?q=".concat(e),{signal:t.signal})]}))}))).apply(this,arguments)}function P(e,t){return S.apply(this,arguments)}function S(){return(S=u((function(e,t){var n;return l(this,(function(i){return n=new AbortController,[2,(0,o.openmrsFetch)("/ws/rest/v1/patient/".concat(e,"/identifier/"),{method:"POST",headers:{"Content-Type":"application/json"},signal:n.signal,body:t})]}))}))).apply(this,arguments)}function D(e,t,n){return U.apply(this,arguments)}function U(){return(U=u((function(e,t,n){var i;return l(this,(function(r){return i=new AbortController,[2,(0,o.openmrsFetch)("/ws/rest/v1/patient/".concat(e,"/identifier/").concat(t),{method:"POST",headers:{"Content-Type":"application/json"},signal:i.signal,body:{identifier:n}})]}))}))).apply(this,arguments)}function O(e,t){return A.apply(this,arguments)}function A(){return(A=u((function(e,t){var n;return l(this,(function(i){return n=new AbortController,[2,(0,o.openmrsFetch)("/ws/rest/v1/patient/".concat(e,"/identifier/").concat(t,"?purge"),{method:"DELETE",headers:{"Content-Type":"application/json"},signal:n.signal})]}))}))).apply(this,arguments)}function C(e,t){var n,r=(0,a.Z)(e?"/module/addresshierarchy/ajax/getPossibleFullAddresses.form?separator=".concat(t,"&searchString=").concat(e):null,o.openmrsFetch),s=r.data,u=r.error,l=r.isLoading,c=(0,i.useMemo)((function(){var e;return{addresses:null!==(n=null==s||null===(e=s.data)||void 0===e?void 0:e.map((function(e){return e.address})))&&void 0!==n?n:[],error:u,isLoading:l}}),[null==s?void 0:s.data,u,l]);return c}},3979:(e,t,n)=>{var i={"./en.json":[3574,574],"./fr.json":[2757,757],"./km.json":[7807,807]};function r(e){if(!n.o(i,e))return Promise.resolve().then((()=>{var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}));var t=i[e],r=t[0];return n.e(t[1]).then((()=>n(r)))}r.keys=()=>Object.keys(i),r.id=3979,e.exports=r}}]);
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"auxiliaryFiles": [
|
|
75
75
|
"68.js.map"
|
|
76
76
|
],
|
|
77
|
-
"hash": "
|
|
77
|
+
"hash": "d00d2cb944f2b82d",
|
|
78
78
|
"childrenByOrder": {}
|
|
79
79
|
},
|
|
80
80
|
{
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
"auxiliaryFiles": [
|
|
103
103
|
"main.js.map"
|
|
104
104
|
],
|
|
105
|
-
"hash": "
|
|
105
|
+
"hash": "6a0a75dfb7f54991",
|
|
106
106
|
"childrenByOrder": {}
|
|
107
107
|
},
|
|
108
108
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openmrs/esm-patient-registration-app",
|
|
3
|
-
"version": "4.3.1-pre.
|
|
3
|
+
"version": "4.3.1-pre.1435",
|
|
4
4
|
"description": "Patient registration microfrontend for the OpenMRS SPA",
|
|
5
5
|
"browser": "dist/openmrs-esm-patient-registration-app.js",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"webpack": "^5.74.0"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "b6bca54f01b3ac03e87afd9a600f82a2fa90fc24"
|
|
56
56
|
}
|