@photonhealth/elements 0.2.3 → 0.2.4
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/index.js +1 -1
- package/dist/index.mjs +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3905,7 +3905,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
3905
3905
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function yre(e,t){if(!!e){if(typeof e=="string")return _4(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _4(e,t)}}function _4(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function bre(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r=[],i=!0,o=!1,a,s;try{for(n=n.call(e);!(i=(a=n.next()).done)&&(r.push(a.value),!(t&&r.length===t));i=!0);}catch(c){o=!0,s=c}finally{try{!i&&n.return!=null&&n.return()}finally{if(o)throw s}}return r}}function wre(e){if(Array.isArray(e))return e}function $re(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function x4(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function _re(e,t,n){return t&&x4(e.prototype,t),n&&x4(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}var E$=function(){function e(t,n){$re(this,e),this.metadata=new Gt(n);var r=this.getCountryAndCallingCode(t),i=vre(r,2),o=i[0],a=i[1];this.defaultCountry=o,this.defaultCallingCode=a,this.reset()}return _re(e,[{key:"getCountryAndCallingCode",value:function(n){var r,i;return n&&(r2(n)==="object"?(r=n.defaultCountry,i=n.defaultCallingCode):r=n),r&&!this.metadata.hasCountry(r)&&(r=void 0),[r,i]}},{key:"input",value:function(n){var r=this.parser.input(n,this.state),i=r.digits,o=r.justLeadingPlus;if(o)this.formattedOutput="+";else if(i){this.determineTheCountryIfNeeded(),this.state.nationalSignificantNumber&&this.formatter.narrowDownMatchingFormats(this.state);var a;if(this.metadata.hasSelectedNumberingPlan()&&(a=this.formatter.format(i,this.state)),a===void 0&&this.parser.reExtractNationalSignificantNumber(this.state)){this.determineTheCountryIfNeeded();var s=this.state.getNationalDigits();s&&(a=this.formatter.format(s,this.state))}this.formattedOutput=a?this.getFullNumber(a):this.getNonFormattedNumber()}return this.formattedOutput}},{key:"reset",value:function(){var n=this;return this.state=new Ene({onCountryChange:function(i){n.country=i},onCallingCodeChange:function(i,o){n.metadata.selectNumberingPlan(o,i),n.formatter.reset(n.metadata.numberingPlan,n.state),n.parser.reset(n.metadata.numberingPlan)}}),this.formatter=new ere({state:this.state,metadata:this.metadata}),this.parser=new fre({defaultCountry:this.defaultCountry,defaultCallingCode:this.defaultCallingCode,metadata:this.metadata,state:this.state,onNationalSignificantNumberChange:function(){n.determineTheCountryIfNeeded(),n.formatter.reset(n.metadata.numberingPlan,n.state)}}),this.state.reset({country:this.defaultCountry,callingCode:this.defaultCallingCode}),this.formattedOutput="",this}},{key:"isInternational",value:function(){return this.state.international}},{key:"getCallingCode",value:function(){if(this.isInternational())return this.state.callingCode}},{key:"getCountryCallingCode",value:function(){return this.getCallingCode()}},{key:"getCountry",value:function(){var n=this.state.digits;if(n)return this._getCountry()}},{key:"_getCountry",value:function(){var n=this.state.country;return n}},{key:"determineTheCountryIfNeeded",value:function(){(!this.state.country||this.isCountryCallingCodeAmbiguous())&&this.determineTheCountry()}},{key:"getFullNumber",value:function(n){var r=this;if(this.isInternational()){var i=function(s){return r.formatter.getInternationalPrefixBeforeCountryCallingCode(r.state,{spacing:!!s})+s},o=this.state.callingCode;return i(o?n?"".concat(o," ").concat(n):o:"".concat(this.state.getDigitsWithoutInternationalPrefix()))}return n}},{key:"getNonFormattedNationalNumberWithPrefix",value:function(){var n=this.state,r=n.nationalSignificantNumber,i=n.complexPrefixBeforeNationalSignificantNumber,o=n.nationalPrefix,a=r,s=i||o;return s&&(a=s+a),a}},{key:"getNonFormattedNumber",value:function(){var n=this.state.nationalSignificantNumberMatchesInput;return this.getFullNumber(n?this.getNonFormattedNationalNumberWithPrefix():this.state.getNationalDigits())}},{key:"getNonFormattedTemplate",value:function(){var n=this.getNonFormattedNumber();if(n)return n.replace(/[\+\d]/g,Mn)}},{key:"isCountryCallingCodeAmbiguous",value:function(){var n=this.state.callingCode,r=this.metadata.getCountryCodesForCallingCode(n);return r&&r.length>1}},{key:"determineTheCountry",value:function(){this.state.setCountry(k$(this.isInternational()?this.state.callingCode:this.defaultCallingCode,this.state.nationalSignificantNumber,this.metadata))}},{key:"getNumberValue",value:function(){var n=this.state,r=n.digits,i=n.callingCode,o=n.country,a=n.nationalSignificantNumber;if(!!r){if(this.isInternational())return i?"+"+i+a:"+"+r;if(o||i){var s=o?this.metadata.countryCallingCode():i;return"+"+s+a}}}},{key:"getNumber",value:function(){var n=this.state,r=n.nationalSignificantNumber,i=n.carrierCode,o=n.callingCode,a=this._getCountry();if(!!r&&!(!a&&!o)){var s=new w$(a||o,r,this.metadata.metadata);return i&&(s.carrierCode=i),s}}},{key:"isPossible",value:function(){var n=this.getNumber();return n?n.isPossible():!1}},{key:"isValid",value:function(){var n=this.getNumber();return n?n.isValid():!1}},{key:"getNationalNumber",value:function(){return this.state.nationalSignificantNumber}},{key:"getChars",value:function(){return(this.state.international?"+":"")+this.state.digits}},{key:"getTemplate",value:function(){return this.formatter.getTemplate(this.state)||this.getNonFormattedTemplate()||""}}]),e}();function V0(){return Fee(xne,arguments)}function kd(e){return E$.call(this,e,s$)}kd.prototype=Object.create(E$.prototype,{});kd.prototype.constructor=kd;const xre=`.input::part(base){border-radius:var(--photon-border-radius, .5rem)}.invalid::part(base){--tw-border-opacity: 1;border-color:rgb(239 68 68/var(--tw-border-opacity));border-width:2px}.invalid::part(form-control-help-text){--tw-text-opacity: 1;color:rgb(239 68 68/var(--tw-text-opacity))}
|
|
3906
3906
|
`,Hl=N("<style></style>"),kre=N('<div class="md:py-2 flex flex-col font-sans"><sl-input class="input" type="tel" placeholder="( ) ___-____"><p slot="help-text" class="text-red-500 pt-1 h-[21px] font-sans"></p></sl-input></div>'),Sre=N('<div class="flex items-center pb-2"><p class="text-gray-700 text-sm"></p></div>'),Ere=N('<p class="pl-1 text-red-500">*</p>');wt("https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.4.0/dist/");Fe("photon-phone-input",{label:void 0,required:!1,value:void 0,invalid:!1,helpText:void 0,disabled:!1},e=>{let t;const n=i=>{const o=new CustomEvent("photon-phone-changed",{composed:!0,bubbles:!0,detail:{phone:i}});t?.dispatchEvent(o)};qe(()=>{e.value&&n(V0(e.value,"US").format("E.164"))});const r=Q(()=>e.value?e.value.length>2?new kd("US").input(V0(e.value,"US").formatNational()):e.value:"");return[(()=>{const i=Hl.cloneNode(!0);return S(i,ct),i})(),(()=>{const i=Hl.cloneNode(!0);return S(i,yn),i})(),(()=>{const i=Hl.cloneNode(!0);return S(i,gn),i})(),(()=>{const i=Hl.cloneNode(!0);return S(i,xre),i})(),(()=>{const i=K(()=>document.importNode(kre,!0)),o=i.firstChild,a=o.firstChild,s=t;return typeof s=="function"?ge(s,i):t=i,S(i,(()=>{const c=Q(()=>!!e.label);return()=>c()?(()=>{const l=Sre.cloneNode(!0),u=l.firstChild;return S(u,()=>e.label),S(l,(()=>{const d=Q(()=>!!e.required);return()=>d()?Ere.cloneNode(!0):null})(),null),l})():null})(),o),o.addEventListener("sl-input",c=>{try{const l=V0(c.target.value,"US").format("E.164");n(l)}catch{n(c.target?.value||"")}}),o._$owner=M(),S(a,()=>e.helpText),G(c=>{const l=!!e.invalid,u=e.disabled,d=e.invalid;return l!==c._v$&&o.classList.toggle("invalid",c._v$=l),u!==c._v$2&&(o.disabled=c._v$2=u),d!==c._v$3&&(o.invalid=c._v$3=d),c},{_v$:void 0,_v$2:void 0,_v$3:void 0}),G(()=>o.value=r()),i})()]});const Ore=`.input::part(base){border-radius:var(--photon-border-radius, .5rem)}.invalid::part(base){--tw-border-opacity: 1;border-color:rgb(239 68 68/var(--tw-border-opacity));border-width:2px}.invalid::part(form-control-help-text){--tw-text-opacity: 1;color:rgb(239 68 68/var(--tw-text-opacity))}
|
|
3907
3907
|
`,Cre=N("<div><style></style><style></style></div>"),i2=[{id:"1",name:"MALE"},{id:"2",name:"FEMALE"},{id:"3",name:"UNKNOWN"}];Fe("photon-sex-input",{label:void 0,required:!1,value:void 0,invalid:!1,helpText:void 0,disabled:!1,selected:void 0},e=>{let t;const n=r=>{const i=new CustomEvent("photon-sex-selected",{composed:!0,bubbles:!0,detail:{sex:r}});t?.dispatchEvent(i)};return(()=>{const r=Cre.cloneNode(!0),i=r.firstChild,o=i.nextSibling,a=t;return typeof a=="function"?ge(a,r):t=r,r.addEventListener("photon-data-selected",s=>{n(s.detail.data.name)}),S(i,ct),S(o,Ore),S(r,k(Yn,{data:i2,get label(){return e.label},get required(){return e.required},placeholder:"",get disabled(){return e.disabled},get invalid(){return e.invalid},isLoading:!1,hasMore:!1,displayAccessor:s=>s?.name||"",showOverflow:!0,noDataMsg:"",optional:!1,get helpText(){return e.helpText},get selectedData(){return i2.filter(s=>s.name.toUpperCase()===e.selected)?.[0]}}),null),r})()});const Tre=`.input::part(base){border-radius:var(--photon-border-radius, .5rem)}.invalid::part(base){--tw-border-opacity: 1;border-color:rgb(239 68 68/var(--tw-border-opacity));border-width:2px}.invalid::part(form-control-help-text){--tw-text-opacity: 1;color:rgb(239 68 68/var(--tw-text-opacity))}
|
|
3908
|
-
`,Pre=N("<div><style></style><style></style></div>"),U0=[{id:"1",name:"Male/Man"},{id:"2",name:"Female/Woman"},{id:"3",name:"TransMale/TransMan"},{id:"4",name:"TransFemale/TransWoman"},{id:"5",name:"Genderqueery/Gender nonconforming"},{id:"6",name:"Something else"},{id:"7",name:"Decline to answer"}];Fe("photon-gender-input",{label:void 0,required:!1,value:void 0,invalid:!1,helpText:void 0,disabled:!1,selected:void 0},e=>{const[t,n]=D("");let r;const i=s=>s.length===0?U0:U0.filter(c=>c.name.toLowerCase().includes(s.toLowerCase())),o=s=>{const c=new CustomEvent("photon-gender-selected",{composed:!0,bubbles:!0,detail:{gender:s}});r?.dispatchEvent(c)},a=()=>{const s=new CustomEvent("photon-gender-deselected",{composed:!0,bubbles:!0,detail:{}});r?.dispatchEvent(s)};return(()=>{const s=Pre.cloneNode(!0),c=s.firstChild,l=c.nextSibling,u=r;return typeof u=="function"?ge(u,s):r=s,s.addEventListener("photon-data-selected",d=>{o(d.detail.data.name)}),s.addEventListener("photon-data-unselected",()=>{a()}),S(c,ct),S(l,Tre),S(s,k(Yn,{get data(){return i(t())},get label(){return e.label},get required(){return e.required},placeholder:"",get disabled(){return e.disabled},get invalid(){return e.invalid},isLoading:!1,hasMore:!1,displayAccessor:d=>d?.name||"",showOverflow:!0,onSearchChange:async d=>{n(d)},onHide:async()=>{n("")},noDataMsg:"",get optional(){return!e.required},get helpText(){return e.helpText},get selectedData(){return U0.filter(d=>d.name===e.selected)?.[0]}}),null),s})()});const Nre=N('<div class="flex align-center justify-center h-screen"><sl-spinner class="mt-8"></sl-spinner></div>'),Are=N('<photon-card title="Personal"><div class="flex flex-col xs:flex-row xs:gap-4"><photon-text-input class="flex-grow min-w-[40%]" debounce-time="0" label="First Name"></photon-text-input><photon-text-input class="min-w-[48%]" debounce-time="0" label="Last Name"></photon-text-input></div><div class="flex flex-col xs:flex-row items-center xs:gap-4"><photon-datepicker no-initial-date="true" class="flex-grow w-full xs:min-w-[40%]" label="Date of Birth"></photon-datepicker><photon-phone-input class="w-full xs:min-w-[48%]" label="Cell Phone Number"></photon-phone-input></div><div class="flex flex-col xs:flex-row justify-between xs:gap-4"><div class="flex-grow w-full xs:min-w-[40%]"><photon-gender-input label="Gender" required="false"></photon-gender-input></div><div class="flex-grow w-full xs:min-w-[40%]"><photon-sex-input label="Sex at Birth" required="false"></photon-sex-input></div></div><photon-text-input debounce-time="0" label="Email"></photon-text-input><hr class="py-2"><p class="font-sans text-lg flex-grow">Address</p><photon-text-input debounce-time="0" label="Street 1"></photon-text-input><photon-text-input debounce-time="0" label="Street 2"></photon-text-input><photon-text-input debounce-time="0" label="City"></photon-text-input><div class="flex gap-4 pb-5 xs:pb-2"><photon-state-input class="flex-grow min-w-[40%]" label="State" required="false"></photon-state-input><photon-text-input debounce-time="0" class="flex-grow min-w-[40%]" label="Zip Code"></photon-text-input></div><hr class="py-2"><p class="font-sans text-lg flex-grow">Preferred Local Pharmacy</p><photon-pharmacy-search></photon-pharmacy-search></photon-card>'),Ire=N('<div class="w-full h-full relative"><style></style><style></style><style></style></div>');wt("https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.4.0/dist/");const Mre=(e,t)=>{const n=e.selectedPatient.data?.address;return t.address_zip?.value&&c9(t.address_zip?.value)&&t.address_zip?.value!=n?.postalCode?t.address_zip?.value:n?`${n.street1} ${n.street2??""} ${n.city}, ${n.state} ${n.postalCode}`:""};Fe("photon-patient-form",{patientId:""},e=>{let t;const n=St(),{store:r,actions:i}=af,{actions:o}=a$,{store:a,actions:s}=V8({firstName:void 0,lastName:void 0,dateOfBirth:void 0,phone:void 0,gender:void 0,sex:void 0,email:void 0,address_street1:void 0,address_street2:void 0,address_city:void 0,address_state:void 0,address_zip:void 0,preferredPharmacy:void 0});s.registerValidator({key:"firstName",validator:_t(ti(On(),1,1/0),"Please enter a first name.")}),s.registerValidator({key:"lastName",validator:_t(ti(On(),1,1/0),"Please enter a last name.")}),s.registerValidator({key:"dateOfBirth",validator:_t(C0([zZ,I0()]),"Please enter a valid date of birth.")}),s.registerValidator({key:"sex",validator:_t(eG(i2.map(l=>l.name)),"Please enter Sex at Birth.")}),s.registerValidator({key:"phone",validator:_t(ti(On(),12),"Please enter a valid phone number.")}),s.registerValidator({key:"email",validator:_t(C0([BZ(),I0()]),"Please enter a valid email.")}),s.registerValidator({key:"address_zip",validator:_t(C0([UZ(),I0()]),"Please enter a valid zip code...")}),qe(()=>{e.patientId?i.getSelectedPatient(n.getSDK(),e.patientId):i.clearSelectedPatient()});const c=l=>{const u=new CustomEvent("photon-form-updated",{composed:!0,bubbles:!0,detail:{form:l,actions:s,selected:r,reset:()=>{s.reset(),i.reset(),o.reset()}}});t?.dispatchEvent(u)};return me(()=>{r.selectedPatient.data&&(s.updateFormValue({key:"firstName",value:r.selectedPatient.data.name.first}),s.updateFormValue({key:"lastName",value:r.selectedPatient.data.name.last}),s.updateFormValue({key:"phone",value:r.selectedPatient.data.phone}),s.updateFormValue({key:"gender",value:r.selectedPatient.data.gender}),s.updateFormValue({key:"sex",value:r.selectedPatient.data.sex}),s.updateFormValue({key:"email",value:r.selectedPatient.data.email}),s.updateFormValue({key:"address_street1",value:r.selectedPatient.data.address?.street1}),s.updateFormValue({key:"address_street2",value:r.selectedPatient.data.address?.street2}),s.updateFormValue({key:"address_city",value:r.selectedPatient.data.address?.city}),s.updateFormValue({key:"address_state",value:r.selectedPatient.data.address?.state}),s.updateFormValue({key:"address_zip",value:r.selectedPatient.data.address?.postalCode}),s.updateFormValue({key:"preferredPharmacy",value:r.selectedPatient.data.preferredPharmacies?.[0]?.id}))}),me(()=>{c(a)}),aa(()=>{i.clearSelectedPatient(),s.reset()}),(()=>{const l=Ire.cloneNode(!0),u=l.firstChild,d=u.nextSibling,f=d.nextSibling,h=t;return typeof h=="function"?ge(h,l):t=l,S(u,ct),S(d,yn),S(f,gn),S(l,k(ee,{get when(){return r.selectedPatient.isLoading},get children(){const p=K(()=>document.importNode(Nre,!0)),v=p.firstChild;return v.style.setProperty("font-size","3rem"),v._$owner=M(),p}}),null),S(l,k(ee,{get when(){return!r.selectedPatient.isLoading},get children(){return k(o$,{permissions:["write:patient"],get children(){const p=K(()=>document.importNode(Are,!0)),v=p.firstChild,g=v.firstChild,y=g.nextSibling,m=v.nextSibling,b=m.firstChild,$=b.nextSibling,_=m.nextSibling,E=_.firstChild,O=E.firstChild,T=E.nextSibling,z=T.firstChild,B=_.nextSibling,X=B.nextSibling,U=X.nextSibling,L=U.nextSibling,I=L.nextSibling,R=I.nextSibling,te=R.nextSibling,Y=te.firstChild,H=Y.nextSibling,q=te.nextSibling,se=q.nextSibling,oe=se.nextSibling;return p._$owner=M(),g.addEventListener("photon-input-changed",async A=>{s.updateFormValue({key:"firstName",value:A.detail.input})}),g._$owner=M(),y.addEventListener("photon-input-changed",async A=>{s.updateFormValue({key:"lastName",value:A.detail.input})}),y._$owner=M(),b.addEventListener("photon-datepicker-selected",async A=>{s.updateFormValue({key:"dateOfBirth",value:A.detail.date})}),b._$owner=M(),$.addEventListener("photon-phone-changed",async A=>{s.updateFormValue({key:"phone",value:A.detail.phone})}),$._$owner=M(),O.addEventListener("photon-gender-selected",A=>{s.updateFormValue({key:"gender",value:A.detail.gender})}),O.addEventListener("photon-gender-deselected",()=>{s.updateFormValue({key:"gender",value:void 0})}),O._$owner=M(),z.addEventListener("photon-sex-selected",A=>{s.updateFormValue({key:"sex",value:A.detail.sex})}),z.addEventListener("photon-sex-deselected",()=>{s.updateFormValue({key:"sex",value:void 0})}),z._$owner=M(),B.addEventListener("photon-input-changed",async A=>{s.updateFormValue({key:"email",value:A.detail.input})}),B._$owner=M(),L.addEventListener("photon-input-changed",async A=>{s.updateFormValue({key:"address_street1",value:A.detail.input})}),L._$owner=M(),I.optional=!0,I.addEventListener("photon-input-changed",async A=>{s.updateFormValue({key:"address_street2",value:A.detail.input})}),I._$owner=M(),R.addEventListener("photon-input-changed",async A=>{s.updateFormValue({key:"address_city",value:A.detail.input})}),R._$owner=M(),Y.addEventListener("photon-state-selected",A=>{s.updateFormValue({key:"address_state",value:A.detail.state})}),Y._$owner=M(),H.addEventListener("photon-input-changed",async A=>{s.updateFormValue({key:"address_zip",value:A.detail.input})}),H._$owner=M(),oe.addEventListener("photon-pharmacy-selected",A=>{s.updateFormValue({key:"preferredPharmacy",value:A.detail.pharmacy.id})}),oe._$owner=M(),G(A=>{const W=a.firstName?.error,ke=a.firstName?.error,Z=a.lastName?.error,le=a.lastName?.error,Ae=a.dateOfBirth?.error,he=a.dateOfBirth?.error,ae=a.phone?.error,de=a.phone?.error,Ee=a.gender?.error,vt=a.gender?.error!==void 0,Rt=r.selectedPatient.data?.gender,Et=a.sex?.error,rn=a.sex?.error!==void 0,Ir=r.selectedPatient.data?.sex,Pa=a.email?.error,Na=a.email?.error,jm=a.address_street1?.error,zm=a.address_street1?.error,Vm=a.address_street2?.error,Um=a.address_street2?.error,Bm=a.address_city?.error,Hm=a.address_city?.error,qm=a.address_state?.error,Wm=a.address_state?.error!==void 0,Gm=a.state?.value??r.selectedPatient.data?.address?.state,Km=a.address_zip?.error,Ym=a.address_zip?.error,Qm=Mre(r,a),Xm=e.patientId,Zm=r.selectedPatient.data?.preferredPharmacies?.[0]?.id;return W!==A._v$&&(g.invalid=A._v$=W),ke!==A._v$2&&(g.helpText=A._v$2=ke),Z!==A._v$3&&(y.invalid=A._v$3=Z),le!==A._v$4&&(y.helpText=A._v$4=le),Ae!==A._v$5&&(b.invalid=A._v$5=Ae),he!==A._v$6&&(b.helpText=A._v$6=he),ae!==A._v$7&&($.invalid=A._v$7=ae),de!==A._v$8&&($.helpText=A._v$8=de),Ee!==A._v$9&&(O.helpText=A._v$9=Ee),vt!==A._v$10&&(O.invalid=A._v$10=vt),Rt!==A._v$11&&(O.selected=A._v$11=Rt),Et!==A._v$12&&(z.helpText=A._v$12=Et),rn!==A._v$13&&(z.invalid=A._v$13=rn),Ir!==A._v$14&&(z.selected=A._v$14=Ir),Pa!==A._v$15&&(B.invalid=A._v$15=Pa),Na!==A._v$16&&(B.helpText=A._v$16=Na),jm!==A._v$17&&(L.invalid=A._v$17=jm),zm!==A._v$18&&(L.helpText=A._v$18=zm),Vm!==A._v$19&&(I.invalid=A._v$19=Vm),Um!==A._v$20&&(I.helpText=A._v$20=Um),Bm!==A._v$21&&(R.invalid=A._v$21=Bm),Hm!==A._v$22&&(R.helpText=A._v$22=Hm),qm!==A._v$23&&(Y.helpText=A._v$23=qm),Wm!==A._v$24&&(Y.invalid=A._v$24=Wm),Gm!==A._v$25&&(Y.selected=A._v$25=Gm),Km!==A._v$26&&(H.invalid=A._v$26=Km),Ym!==A._v$27&&(H.helpText=A._v$27=Ym),Qm!==A._v$28&&(oe.address=A._v$28=Qm),Xm!==A._v$29&&(oe.patientId=A._v$29=Xm),Zm!==A._v$30&&(oe.selected=A._v$30=Zm),A},{_v$:void 0,_v$2:void 0,_v$3:void 0,_v$4:void 0,_v$5:void 0,_v$6:void 0,_v$7:void 0,_v$8:void 0,_v$9:void 0,_v$10:void 0,_v$11:void 0,_v$12:void 0,_v$13:void 0,_v$14:void 0,_v$15:void 0,_v$16:void 0,_v$17:void 0,_v$18:void 0,_v$19:void 0,_v$20:void 0,_v$21:void 0,_v$22:void 0,_v$23:void 0,_v$24:void 0,_v$25:void 0,_v$26:void 0,_v$27:void 0,_v$28:void 0,_v$29:void 0,_v$30:void 0}),G(()=>g.value=a.firstName?.value??r.selectedPatient.data?.name.first),G(()=>y.value=a.lastName?.value??r.selectedPatient.data?.name.last),G(()=>b.value=e.patientId?r.selectedPatient.data?.dateOfBirth:a.dateOfBirth?.value),G(()=>$.value=a.phone?.value??r.selectedPatient.data?.phone),G(()=>B.value=a.email?.value??r.selectedPatient.data?.email),G(()=>L.value=a.address_street1?.value??r.selectedPatient.data?.address?.street1),G(()=>I.value=a.address_street2?.value??r.selectedPatient.data?.address?.street2),G(()=>R.value=a.address_city?.value??r.selectedPatient.data?.address?.city),G(()=>H.value=a.address_zip?.value??r.selectedPatient.data?.address?.postalCode),p}})}}),null),l})()});const Dre=`.input::part(base){border-radius:var(--photon-border-radius, .5rem)}.invalid::part(base){--tw-border-opacity: 1;border-color:rgb(239 68 68/var(--tw-border-opacity));border-width:2px}.invalid::part(form-control-help-text){--tw-text-opacity: 1;color:rgb(239 68 68/var(--tw-text-opacity))}
|
|
3908
|
+
`,Pre=N("<div><style></style><style></style></div>"),U0=[{id:"1",name:"Male/Man"},{id:"2",name:"Female/Woman"},{id:"3",name:"TransMale/TransMan"},{id:"4",name:"TransFemale/TransWoman"},{id:"5",name:"Genderqueery/Gender nonconforming"},{id:"6",name:"Something else"},{id:"7",name:"Decline to answer"}];Fe("photon-gender-input",{label:void 0,required:!1,value:void 0,invalid:!1,helpText:void 0,disabled:!1,selected:void 0},e=>{const[t,n]=D("");let r;const i=s=>s.length===0?U0:U0.filter(c=>c.name.toLowerCase().includes(s.toLowerCase())),o=s=>{const c=new CustomEvent("photon-gender-selected",{composed:!0,bubbles:!0,detail:{gender:s}});r?.dispatchEvent(c)},a=()=>{const s=new CustomEvent("photon-gender-deselected",{composed:!0,bubbles:!0,detail:{}});r?.dispatchEvent(s)};return(()=>{const s=Pre.cloneNode(!0),c=s.firstChild,l=c.nextSibling,u=r;return typeof u=="function"?ge(u,s):r=s,s.addEventListener("photon-data-selected",d=>{o(d.detail.data.name)}),s.addEventListener("photon-data-unselected",()=>{a()}),S(c,ct),S(l,Tre),S(s,k(Yn,{get data(){return i(t())},get label(){return e.label},get required(){return e.required},placeholder:"",get disabled(){return e.disabled},get invalid(){return e.invalid},isLoading:!1,hasMore:!1,displayAccessor:d=>d?.name||"",showOverflow:!0,onSearchChange:async d=>{n(d)},onHide:async()=>{n("")},noDataMsg:"",get optional(){return!e.required},get helpText(){return e.helpText},get selectedData(){return U0.filter(d=>d.name===e.selected)?.[0]}}),null),s})()});const Nre=N('<div class="flex align-center justify-center h-screen"><sl-spinner class="mt-8"></sl-spinner></div>'),Are=N('<photon-card title="Personal"><div class="flex flex-col xs:flex-row xs:gap-4"><photon-text-input class="flex-grow min-w-[40%]" debounce-time="0" label="First Name"></photon-text-input><photon-text-input class="min-w-[48%]" debounce-time="0" label="Last Name"></photon-text-input></div><div class="flex flex-col xs:flex-row items-center xs:gap-4"><photon-datepicker no-initial-date="true" class="flex-grow w-full xs:min-w-[40%]" label="Date of Birth"></photon-datepicker><photon-phone-input class="w-full xs:min-w-[48%]" label="Mobile Number"></photon-phone-input></div><div class="flex flex-col xs:flex-row justify-between xs:gap-4"><div class="flex-grow w-full xs:min-w-[40%]"><photon-gender-input label="Gender" required="false"></photon-gender-input></div><div class="flex-grow w-full xs:min-w-[40%]"><photon-sex-input label="Sex at Birth" required="false"></photon-sex-input></div></div><photon-text-input debounce-time="0" label="Email"></photon-text-input><hr class="py-2"><p class="font-sans text-lg flex-grow">Address</p><photon-text-input debounce-time="0" label="Street 1"></photon-text-input><photon-text-input debounce-time="0" label="Street 2"></photon-text-input><photon-text-input debounce-time="0" label="City"></photon-text-input><div class="flex gap-4 pb-5 xs:pb-2"><photon-state-input class="flex-grow min-w-[40%]" label="State" required="false"></photon-state-input><photon-text-input debounce-time="0" class="flex-grow min-w-[40%]" label="Zip Code"></photon-text-input></div><hr class="py-2"><p class="font-sans text-lg flex-grow">Preferred Local Pharmacy</p><photon-pharmacy-search></photon-pharmacy-search></photon-card>'),Ire=N('<div class="w-full h-full relative"><style></style><style></style><style></style></div>');wt("https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.4.0/dist/");const Mre=(e,t)=>{const n=e.selectedPatient.data?.address;return t.address_zip?.value&&c9(t.address_zip?.value)&&t.address_zip?.value!=n?.postalCode?t.address_zip?.value:n?`${n.street1} ${n.street2??""} ${n.city}, ${n.state} ${n.postalCode}`:""};Fe("photon-patient-form",{patientId:""},e=>{let t;const n=St(),{store:r,actions:i}=af,{actions:o}=a$,{store:a,actions:s}=V8({firstName:void 0,lastName:void 0,dateOfBirth:void 0,phone:void 0,gender:void 0,sex:void 0,email:void 0,address_street1:void 0,address_street2:void 0,address_city:void 0,address_state:void 0,address_zip:void 0,preferredPharmacy:void 0});s.registerValidator({key:"firstName",validator:_t(ti(On(),1,1/0),"Please enter a first name.")}),s.registerValidator({key:"lastName",validator:_t(ti(On(),1,1/0),"Please enter a last name.")}),s.registerValidator({key:"dateOfBirth",validator:_t(C0([zZ,I0()]),"Please enter a valid date of birth.")}),s.registerValidator({key:"sex",validator:_t(eG(i2.map(l=>l.name)),"Please enter Sex at Birth.")}),s.registerValidator({key:"phone",validator:_t(ti(On(),12),"Please enter a valid mobile number.")}),s.registerValidator({key:"email",validator:_t(C0([BZ(),I0()]),"Please enter a valid email.")}),s.registerValidator({key:"address_zip",validator:_t(C0([UZ(),I0()]),"Please enter a valid zip code...")}),qe(()=>{e.patientId?i.getSelectedPatient(n.getSDK(),e.patientId):i.clearSelectedPatient()});const c=l=>{const u=new CustomEvent("photon-form-updated",{composed:!0,bubbles:!0,detail:{form:l,actions:s,selected:r,reset:()=>{s.reset(),i.reset(),o.reset()}}});t?.dispatchEvent(u)};return me(()=>{r.selectedPatient.data&&(s.updateFormValue({key:"firstName",value:r.selectedPatient.data.name.first}),s.updateFormValue({key:"lastName",value:r.selectedPatient.data.name.last}),s.updateFormValue({key:"phone",value:r.selectedPatient.data.phone}),s.updateFormValue({key:"gender",value:r.selectedPatient.data.gender}),s.updateFormValue({key:"sex",value:r.selectedPatient.data.sex}),s.updateFormValue({key:"email",value:r.selectedPatient.data.email}),s.updateFormValue({key:"address_street1",value:r.selectedPatient.data.address?.street1}),s.updateFormValue({key:"address_street2",value:r.selectedPatient.data.address?.street2}),s.updateFormValue({key:"address_city",value:r.selectedPatient.data.address?.city}),s.updateFormValue({key:"address_state",value:r.selectedPatient.data.address?.state}),s.updateFormValue({key:"address_zip",value:r.selectedPatient.data.address?.postalCode}),s.updateFormValue({key:"preferredPharmacy",value:r.selectedPatient.data.preferredPharmacies?.[0]?.id}))}),me(()=>{c(a)}),aa(()=>{i.clearSelectedPatient(),s.reset()}),(()=>{const l=Ire.cloneNode(!0),u=l.firstChild,d=u.nextSibling,f=d.nextSibling,h=t;return typeof h=="function"?ge(h,l):t=l,S(u,ct),S(d,yn),S(f,gn),S(l,k(ee,{get when(){return r.selectedPatient.isLoading},get children(){const p=K(()=>document.importNode(Nre,!0)),v=p.firstChild;return v.style.setProperty("font-size","3rem"),v._$owner=M(),p}}),null),S(l,k(ee,{get when(){return!r.selectedPatient.isLoading},get children(){return k(o$,{permissions:["write:patient"],get children(){const p=K(()=>document.importNode(Are,!0)),v=p.firstChild,g=v.firstChild,y=g.nextSibling,m=v.nextSibling,b=m.firstChild,$=b.nextSibling,_=m.nextSibling,E=_.firstChild,O=E.firstChild,T=E.nextSibling,z=T.firstChild,B=_.nextSibling,X=B.nextSibling,U=X.nextSibling,L=U.nextSibling,I=L.nextSibling,R=I.nextSibling,te=R.nextSibling,Y=te.firstChild,H=Y.nextSibling,q=te.nextSibling,se=q.nextSibling,oe=se.nextSibling;return p._$owner=M(),g.addEventListener("photon-input-changed",async A=>{s.updateFormValue({key:"firstName",value:A.detail.input})}),g._$owner=M(),y.addEventListener("photon-input-changed",async A=>{s.updateFormValue({key:"lastName",value:A.detail.input})}),y._$owner=M(),b.addEventListener("photon-datepicker-selected",async A=>{s.updateFormValue({key:"dateOfBirth",value:A.detail.date})}),b._$owner=M(),$.addEventListener("photon-phone-changed",async A=>{s.updateFormValue({key:"phone",value:A.detail.phone})}),$._$owner=M(),O.addEventListener("photon-gender-selected",A=>{s.updateFormValue({key:"gender",value:A.detail.gender})}),O.addEventListener("photon-gender-deselected",()=>{s.updateFormValue({key:"gender",value:void 0})}),O._$owner=M(),z.addEventListener("photon-sex-selected",A=>{s.updateFormValue({key:"sex",value:A.detail.sex})}),z.addEventListener("photon-sex-deselected",()=>{s.updateFormValue({key:"sex",value:void 0})}),z._$owner=M(),B.addEventListener("photon-input-changed",async A=>{s.updateFormValue({key:"email",value:A.detail.input})}),B._$owner=M(),L.addEventListener("photon-input-changed",async A=>{s.updateFormValue({key:"address_street1",value:A.detail.input})}),L._$owner=M(),I.optional=!0,I.addEventListener("photon-input-changed",async A=>{s.updateFormValue({key:"address_street2",value:A.detail.input})}),I._$owner=M(),R.addEventListener("photon-input-changed",async A=>{s.updateFormValue({key:"address_city",value:A.detail.input})}),R._$owner=M(),Y.addEventListener("photon-state-selected",A=>{s.updateFormValue({key:"address_state",value:A.detail.state})}),Y._$owner=M(),H.addEventListener("photon-input-changed",async A=>{s.updateFormValue({key:"address_zip",value:A.detail.input})}),H._$owner=M(),oe.addEventListener("photon-pharmacy-selected",A=>{s.updateFormValue({key:"preferredPharmacy",value:A.detail.pharmacy.id})}),oe._$owner=M(),G(A=>{const W=a.firstName?.error,ke=a.firstName?.error,Z=a.lastName?.error,le=a.lastName?.error,Ae=a.dateOfBirth?.error,he=a.dateOfBirth?.error,ae=a.phone?.error,de=a.phone?.error,Ee=a.gender?.error,vt=a.gender?.error!==void 0,Rt=r.selectedPatient.data?.gender,Et=a.sex?.error,rn=a.sex?.error!==void 0,Ir=r.selectedPatient.data?.sex,Pa=a.email?.error,Na=a.email?.error,jm=a.address_street1?.error,zm=a.address_street1?.error,Vm=a.address_street2?.error,Um=a.address_street2?.error,Bm=a.address_city?.error,Hm=a.address_city?.error,qm=a.address_state?.error,Wm=a.address_state?.error!==void 0,Gm=a.state?.value??r.selectedPatient.data?.address?.state,Km=a.address_zip?.error,Ym=a.address_zip?.error,Qm=Mre(r,a),Xm=e.patientId,Zm=r.selectedPatient.data?.preferredPharmacies?.[0]?.id;return W!==A._v$&&(g.invalid=A._v$=W),ke!==A._v$2&&(g.helpText=A._v$2=ke),Z!==A._v$3&&(y.invalid=A._v$3=Z),le!==A._v$4&&(y.helpText=A._v$4=le),Ae!==A._v$5&&(b.invalid=A._v$5=Ae),he!==A._v$6&&(b.helpText=A._v$6=he),ae!==A._v$7&&($.invalid=A._v$7=ae),de!==A._v$8&&($.helpText=A._v$8=de),Ee!==A._v$9&&(O.helpText=A._v$9=Ee),vt!==A._v$10&&(O.invalid=A._v$10=vt),Rt!==A._v$11&&(O.selected=A._v$11=Rt),Et!==A._v$12&&(z.helpText=A._v$12=Et),rn!==A._v$13&&(z.invalid=A._v$13=rn),Ir!==A._v$14&&(z.selected=A._v$14=Ir),Pa!==A._v$15&&(B.invalid=A._v$15=Pa),Na!==A._v$16&&(B.helpText=A._v$16=Na),jm!==A._v$17&&(L.invalid=A._v$17=jm),zm!==A._v$18&&(L.helpText=A._v$18=zm),Vm!==A._v$19&&(I.invalid=A._v$19=Vm),Um!==A._v$20&&(I.helpText=A._v$20=Um),Bm!==A._v$21&&(R.invalid=A._v$21=Bm),Hm!==A._v$22&&(R.helpText=A._v$22=Hm),qm!==A._v$23&&(Y.helpText=A._v$23=qm),Wm!==A._v$24&&(Y.invalid=A._v$24=Wm),Gm!==A._v$25&&(Y.selected=A._v$25=Gm),Km!==A._v$26&&(H.invalid=A._v$26=Km),Ym!==A._v$27&&(H.helpText=A._v$27=Ym),Qm!==A._v$28&&(oe.address=A._v$28=Qm),Xm!==A._v$29&&(oe.patientId=A._v$29=Xm),Zm!==A._v$30&&(oe.selected=A._v$30=Zm),A},{_v$:void 0,_v$2:void 0,_v$3:void 0,_v$4:void 0,_v$5:void 0,_v$6:void 0,_v$7:void 0,_v$8:void 0,_v$9:void 0,_v$10:void 0,_v$11:void 0,_v$12:void 0,_v$13:void 0,_v$14:void 0,_v$15:void 0,_v$16:void 0,_v$17:void 0,_v$18:void 0,_v$19:void 0,_v$20:void 0,_v$21:void 0,_v$22:void 0,_v$23:void 0,_v$24:void 0,_v$25:void 0,_v$26:void 0,_v$27:void 0,_v$28:void 0,_v$29:void 0,_v$30:void 0}),G(()=>g.value=a.firstName?.value??r.selectedPatient.data?.name.first),G(()=>y.value=a.lastName?.value??r.selectedPatient.data?.name.last),G(()=>b.value=e.patientId?r.selectedPatient.data?.dateOfBirth:a.dateOfBirth?.value),G(()=>$.value=a.phone?.value??r.selectedPatient.data?.phone),G(()=>B.value=a.email?.value??r.selectedPatient.data?.email),G(()=>L.value=a.address_street1?.value??r.selectedPatient.data?.address?.street1),G(()=>I.value=a.address_street2?.value??r.selectedPatient.data?.address?.street2),G(()=>R.value=a.address_city?.value??r.selectedPatient.data?.address?.city),G(()=>H.value=a.address_zip?.value??r.selectedPatient.data?.address?.postalCode),p}})}}),null),l})()});const Dre=`.input::part(base){border-radius:var(--photon-border-radius, .5rem)}.invalid::part(base){--tw-border-opacity: 1;border-color:rgb(239 68 68/var(--tw-border-opacity));border-width:2px}.invalid::part(form-control-help-text){--tw-text-opacity: 1;color:rgb(239 68 68/var(--tw-text-opacity))}
|
|
3909
3909
|
`,Lre=N("<div><style></style><style></style></div>"),B0=[{id:"1",name:"AL"},{id:"2",name:"AK"},{id:"3",name:"AZ"},{id:"4",name:"AR"},{id:"5",name:"CA"},{id:"6",name:"CO"},{id:"7",name:"CT"},{id:"8",name:"DE"},{id:"9",name:"DC"},{id:"10",name:"FL"},{id:"11",name:"GA"},{id:"12",name:"HI"},{id:"13",name:"ID"},{id:"14",name:"IL"},{id:"15",name:"IN"},{id:"16",name:"IA"},{id:"17",name:"KS"},{id:"18",name:"KY"},{id:"19",name:"LA"},{id:"20",name:"ME"},{id:"21",name:"MD"},{id:"22",name:"MA"},{id:"23",name:"MI"},{id:"24",name:"MN"},{id:"25",name:"MS"},{id:"26",name:"MO"},{id:"27",name:"MT"},{id:"28",name:"NB"},{id:"29",name:"NV"},{id:"30",name:"NH"},{id:"31",name:"NJ"},{id:"32",name:"NM"},{id:"33",name:"NY"},{id:"34",name:"NC"},{id:"35",name:"ND"},{id:"36",name:"OH"},{id:"37",name:"OK"},{id:"38",name:"OR"},{id:"39",name:"PA"},{id:"40",name:"PR"},{id:"41",name:"RI"},{id:"42",name:"SC"},{id:"43",name:"SD"},{id:"44",name:"TN"},{id:"45",name:"TX"},{id:"46",name:"UT"},{id:"47",name:"VT"},{id:"48",name:"VA"},{id:"49",name:"WA"},{id:"50",name:"WV"},{id:"51",name:"WI"},{id:"52",name:"WY"}];Fe("photon-state-input",{label:void 0,required:!1,value:void 0,invalid:!1,helpText:void 0,disabled:!1,selected:void 0},e=>{const[t,n]=D("");let r;const i=a=>{const s=new CustomEvent("photon-state-selected",{composed:!0,bubbles:!0,detail:{state:a}});r?.dispatchEvent(s)},o=a=>a.length===0?B0:B0.filter(s=>s.name.toLowerCase().includes(a.toLowerCase()));return(()=>{const a=Lre.cloneNode(!0),s=a.firstChild,c=s.nextSibling,l=r;return typeof l=="function"?ge(l,a):r=a,a.addEventListener("photon-data-selected",u=>{i(u.detail.data.name)}),S(s,ct),S(c,Dre),S(a,k(Yn,{get data(){return o(t())},get label(){return e.label},get required(){return e.required},placeholder:"",get disabled(){return e.disabled},get invalid(){return e.invalid},isLoading:!1,hasMore:!1,displayAccessor:u=>u?.name||"",showOverflow:!0,onSearchChange:async u=>{n(u)},onHide:async()=>{n("")},noDataMsg:"",optional:!1,get helpText(){return e.helpText},get selectedData(){return B0.filter(u=>u.name===e.selected)?.[0]}}),null),a})()});const Rre=N("<sl-icon></sl-icon>"),Fre=N('<div class="flex-1 flex justify-end"></div>'),jre=N('<div class="fixed top-0 left-0 w-full h-screen z-10 overflow-y-scroll"><style></style><photon-dialog confirm-text="Yes, Close" cancel-text="Keep Editing"><p class="font-sans text-lg xs:text-base"></p></photon-dialog><div class="flex items-center px-4 py-2 md:px-8 md:py-3 bg-white fixed w-full z-10 shadow-card"><div class="md:w-2/5 flex justify-start"><photon-button class="close-button" size="small" circle variant="naked"><div class="text-black text-3xl"><sl-icon name="x"></sl-icon></div></photon-button></div><div class="w-full md:w-3/5 flex flex-col md:flex-row"><div class="mb-2 md:mb-0 flex justify-center md:justify-center items-center"><p class="ml-1 font-sans text-xl font-medium"></p></div></div></div><div class="overflow-y-scroll w-full min-h-screen bg-[#f7f4f4] pt-28 xs:pt-28 lg:pt-20"><div class="px-4 pb-24 md:pt-4 md:pb-52 md:px-4 w-full h-full sm:w-[600px] xs:mx-auto"></div></div></div>'),O$=e=>{const t=ft({closeTitle:"Lose unsaved changes?",closeBody:"You will not be able to recover unsaved changes.",checkShouldWarn:()=>!1},e);let n;const[r,i]=D(!1),o=()=>{i(!1),t.onClosed()},a=()=>i(!1);return(()=>{const s=K(()=>document.importNode(jre,!0)),c=s.firstChild,l=c.nextSibling,u=l.firstChild,d=l.nextSibling,f=d.firstChild,h=f.firstChild,p=h.firstChild,v=p.firstChild,g=f.nextSibling,y=g.firstChild,m=y.firstChild,b=d.nextSibling,$=b.firstChild,_=n;return typeof _=="function"?ge(_,s):n=s,S(c,ct),l.addEventListener("photon-dialog-confirmed",o),l.addEventListener("photon-dialog-canceled",a),l.addEventListener("photon-dialog-alt",a),l._$owner=M(),S(u,()=>t.closeBody),h.addEventListener("click",()=>{t.checkShouldWarn()?i(!0):t.onClosed()}),h._$owner=M(),v.style.setProperty("display","block"),v._$owner=M(),S(y,k(ee,{get when(){return t.titleIconName},get children(){const E=K(()=>document.importNode(Rre,!0));return E._$owner=M(),G(()=>E.name=t.titleIconName),E}}),m),S(m,()=>t.title),S(g,k(ee,{get when(){return t.headerRight},get children(){const E=Fre.cloneNode(!0);return S(E,()=>t.headerRight),E}}),null),S($,()=>t.form),G(E=>{const O=t.closeTitle,T=r();return O!==E._v$&&(l.label=E._v$=O),T!==E._v$2&&(l.open=E._v$2=T),E},{_v$:void 0,_v$2:void 0}),s})()},zre=N("<div></div>"),Vre=N('<div class="flex flex-row gap-1 lg:gap-2 justify-end items-end"><photon-button size="sm" variant="outline">Save and Create Prescription</photon-button><photon-button size="sm">Save</photon-button></div>'),Ure=N('<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded relative mb-4" role="alert"><span class="block sm:inline"></span></div>'),Bre=N('<photon-patient-form slot="form"></photon-patient-form>');Fe("photon-patient-dialog",{patientId:"",open:!1},e=>{let t;const n=St(),[r,i]=D(!1),[o,a]=D(!1),[s,c]=D(void 0),[l,u]=D(void 0),[d,f]=D(void 0),[h,p]=D(void 0),v=(b,$=!1)=>{const _=new CustomEvent("photon-patient-updated",{composed:!0,bubbles:!0,detail:{patientId:b,createPrescription:$}});t?.dispatchEvent(_)},g=(b,$=!1)=>{const _=new CustomEvent("photon-patient-created",{composed:!0,bubbles:!0,detail:{patientId:b,createPrescription:$}});t?.dispatchEvent(_)},y=()=>{const b=new CustomEvent("photon-patient-closed",{composed:!0,bubbles:!0,detail:{}});t?.dispatchEvent(b)},m=async(b,$,_,E=!1)=>{p(void 0),a(E),i(!0);let O=["firstName","lastName","dateOfBirth","phone","sex","email"];if(b.address_street1?.value!==void 0||b.address_city?.value!==void 0||b.address_state?.value!==void 0||b.address_zip?.value!==void 0)$.registerValidator({key:"address_street1",validator:_t(ti(On(),1,1/0),"Please enter a valid Street 1..")}),$.registerValidator({key:"address_city",validator:_t(ti(On(),1,1/0),"Please enter a valid City..")}),$.registerValidator({key:"address_state",validator:_t(ti(On(),2,2),"Please enter a valid State..")}),O=[...O,"address_zip","address_street1","address_city","address_state"];else{const z=["address_street1","address_city","address_state"];for(const B of z)$.unRegisterValidator(B)}if($.validate(O),$.hasErrors(O))return i(!1),!0;b.preferredPharmacy.value&&_.selectedPatient.data?.preferredPharmacies&&_.selectedPatient.data?.preferredPharmacies.length!==0&&!_.selectedPatient.data?.preferredPharmacies?.map(z=>z?.id).filter(z=>z!==null).includes(b.preferredPharmacy.value)&&await n.getSDK().clinical.patient.removePatientPreferredPharmacy({})({variables:{patientId:e.patientId,pharmacyId:_.selectedPatient.data?.preferredPharmacies[0].id},awaitRefetchQueries:!1});const T={...e?.patientId?{id:e.patientId}:{},name:{first:b.firstName.value,last:b.lastName.value},gender:b.gender.value,email:b.email.value,phone:b.phone.value,dateOfBirth:b.dateOfBirth.value,sex:b.sex.value,address:b.address_street1.value!==void 0?{street1:b.address_street1.value,street2:b.address_street2.value,city:b.address_city.value,state:b.address_state.value,postalCode:b.address_zip.value,country:"US"}:void 0,preferredPharmacies:b.preferredPharmacy.value?[b.preferredPharmacy.value]:[]};try{if(e?.patientId)await n.getSDK().clinical.patient.updatePatient({})({variables:T,awaitRefetchQueries:!1}),v(e.patientId,E);else{const B=await n.getSDK().clinical.patient.createPatient({})({variables:T,awaitRefetchQueries:!1});g(B?.data?.createPatient?.id||"",E)}i(!1),$.resetStores(),e.open=!1}catch(z){i(!1),p(z?.message||"An error occurred while saving the patient.")}};return(()=>{const b=zre.cloneNode(!0),$=t;return typeof $=="function"?ge($,b):t=b,S(b,k(ee,{get when(){return e.open},get children(){return k(O$,{onClosed:()=>{y(),d().resetStores(),e.open=!1},get title(){return e?.patientId?"Update Patient":"Create Patient"},get titleIconName(){return e?.patientId?"pencil-square":"person-plus"},get headerRight(){return(()=>{const _=K(()=>document.importNode(Vre,!0)),E=_.firstChild,O=E.nextSibling;return E.$$click=()=>m(s(),d(),l(),!0),E._$owner=M(),O.$$click=()=>m(s(),d(),l(),!1),O._$owner=M(),G(T=>{const z=r(),B=r()&&o(),X=r(),U=r()&&!o();return z!==T._v$&&(E.disabled=T._v$=z),B!==T._v$2&&(E.loading=T._v$2=B),X!==T._v$3&&(O.disabled=T._v$3=X),U!==T._v$4&&(O.loading=T._v$4=U),T},{_v$:void 0,_v$2:void 0,_v$3:void 0,_v$4:void 0}),_})()},get form(){return[k(ee,{get when(){return h()},get children(){const _=Ure.cloneNode(!0),E=_.firstChild;return S(E,h),_}}),(()=>{const _=K(()=>document.importNode(Bre,!0));return _.addEventListener("photon-form-updated",E=>{c(E.detail.form),f(Object.assign({},E.detail.actions,{resetStores:E.detail.reset})),u(E.detail.selected)}),_._$owner=M(),G(()=>_.patientId=e.patientId),_})()]}})}})),b})()});la(["click"]);const Hre=N("<photon-patient-dialog></photon-patient-dialog>");Fe("photon-update-patient-dialog",{patientId:"",open:!1},e=>(console.warn("photon-update-patient-dialog will be deprecated soon. Please use photon-patient-dialog instead."),(()=>{const t=K(()=>document.importNode(Hre,!0));return t._$owner=M(),G(n=>{const r=e.patientId,i=e.open;return r!==n._v$&&(t.patientId=n._v$=r),i!==n._v$2&&(t.open=n._v$2=i),n},{_v$:void 0,_v$2:void 0}),t})()));const qre=N('<div class="w-full"></div>'),Wre=N('<p class="text-sm whitespace-normal leading-snug mb-2"></p>'),Gre=()=>{let e;const t=St(),[n,r]=D(!1),[i,o]=D(""),[a,s]=D(),[c,l]=D([]),u=d=>{const f=new CustomEvent("photon-name-selected",{composed:!0,bubbles:!0,detail:{medicationId:d}});e?.dispatchEvent(f)};return me(async()=>{i().length>0&&(r(!0),K(async()=>{const d=String(Math.random());s(d);const{data:f}=await t.getSDK().clinical.searchMedication.getConcepts({name:i()});d===a()&&l(f.medicationConcepts??[]),r(!1)}))}),(()=>{const d=qre.cloneNode(!0),f=e;return typeof f=="function"?ge(f,d):e=d,d.addEventListener("photon-data-selected",h=>{u(h.detail.data.id)}),S(d,k(Yn,{get data(){return c()},label:"Medication Name",placeholder:"Enter a medication name...",get isLoading(){return n()},hasMore:!1,displayAccessor:(h,p)=>p?(()=>{const v=Wre.cloneNode(!0);return S(v,()=>h?.name||""),v})():h?.name||"",onSearchChange:async h=>o(h),onHide:async()=>{o("")},noDataMsg:"No medications found",required:!1})),d})()},Kre=N('<div class="w-full"></div>'),Yre=e=>{const t=St(),[n,r]=D(),[i,o]=D(!1),[a,s]=D([]),c=f=>{const h=new CustomEvent("photon-strength-selected",{composed:!0,bubbles:!0,detail:{strengthId:f}});d?.dispatchEvent(h)},l=()=>{const f=new CustomEvent("photon-strength-deselected",{composed:!0,bubbles:!0,detail:{}});d?.dispatchEvent(f)};me(async()=>{u.clear(),e.medicationId.length>0&&(o(!0),K(async()=>{const f=String(Math.random());r(f);const{data:h}=await t.getSDK().clinical.searchMedication.getStrengths({id:e.medicationId});f===n()&&s(h.medicationStrengths??[]),o(!1)}))});const u={};let d;return(()=>{const f=Kre.cloneNode(!0),h=d;return typeof h=="function"?ge(h,f):d=f,f.addEventListener("photon-data-selected",p=>{c(p.detail.data.id)}),f.addEventListener("photon-data-unselected",()=>{l()}),S(f,k(Yn,{actionRef:u,get data(){return a()},label:"Strength",get disabled(){return e.disabled},placeholder:"Select a strength...",get isLoading(){return i()},hasMore:!1,displayAccessor:p=>p?.name||"",noDataMsg:"No strengths found",required:!1})),f})()},Qre=N('<div class="w-full"></div>'),Xre=e=>{const t=St(),[n,r]=D(),[i,o]=D(!1),[a,s]=D([]),c=f=>{const h=new CustomEvent("photon-route-selected",{composed:!0,bubbles:!0,detail:{routeId:f}});d?.dispatchEvent(h)},l=()=>{const f=new CustomEvent("photon-route-deselected",{composed:!0,bubbles:!0,detail:{}});d?.dispatchEvent(f)};me(async()=>{u.clear(),e.medicationId.length>0&&(o(!0),K(async()=>{const f=String(Math.random());r(f);const{data:h}=await t.getSDK().clinical.searchMedication.getRoutes({id:e.medicationId});f===n()&&s(h.medicationRoutes??[]),o(!1)}))});const u={};let d;return(()=>{const f=Qre.cloneNode(!0),h=d;return typeof h=="function"?ge(h,f):d=f,f.addEventListener("photon-data-selected",p=>{c(p.detail.data.id)}),f.addEventListener("photon-data-unselected",()=>{l()}),S(f,k(Yn,{actionRef:u,get data(){return a()},label:"Route",get disabled(){return e.disabled},placeholder:"Select a route...",get isLoading(){return i()},hasMore:!1,displayAccessor:p=>p?.name||"",noDataMsg:"No routes found",required:!1})),f})()},Zre=N('<div class="w-full"></div>'),Jre=e=>{const t=St(),[n,r]=D(!1),[i,o]=D(),[a,s]=D([]),c=f=>{const h=new CustomEvent("photon-form-selected",{composed:!0,bubbles:!0,detail:{formId:f}});d?.dispatchEvent(h)},l=()=>{const f=new CustomEvent("photon-form-deselected",{composed:!0,bubbles:!0,detail:{}});d?.dispatchEvent(f)};me(async()=>{u.clear(),e.medicationId.length>0&&(r(!0),K(async()=>{const f=String(Math.random());o(f);const{data:h}=await t.getSDK().clinical.searchMedication.getForms({id:e.medicationId});f===i()&&s(h.medicationForms??[]),r(!1)}))});const u={};let d;return(()=>{const f=Zre.cloneNode(!0),h=d;return typeof h=="function"?ge(h,f):d=f,f.addEventListener("photon-data-selected",p=>{c(p.detail.data.id)}),f.addEventListener("photon-data-unselected",()=>{l()}),S(f,k(Yn,{actionRef:u,get data(){return a()},label:"Form",get disabled(){return e.disabled},placeholder:"Select a form...",get isLoading(){return n()},hasMore:!1,displayAccessor:p=>p.form,noDataMsg:"No forms found",required:!1})),f})()},eie=N('<photon-checkbox label="Add Medication to Catalog"></photon-checkbox>'),tie=N('<div><p class="font-sans text-lg text-gray-700 pb-2">Advanced Medication Search</p><div class="flex flex-col xs:flex-row gap-4"></div><div class="flex flex-col xs:flex-row gap-4"></div><div class="flex flex-col xs:flex-row gap-4"></div><div class="flex flex-col xs:flex-row gap-4"></div><hr class="my-8"><p class="font-sans text-gray-700 pb-4">Select a medication:</p><div><photon-radio-group></photon-radio-group></div></div>'),nie=N("<photon-radio-card></photon-radio-card>");wt("https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.4.0/dist/");Fe("photon-med-search",{},()=>{let e;const t=St(),[n,r]=D(""),[i,o]=D(""),[a,s]=D(""),[c,l]=D(""),[u,d]=D([]),[f,h]=D(!1),[p,v]=D(void 0),[g,y]=D(""),m=(b,$)=>{const _=new CustomEvent("photon-form-updated",{composed:!0,bubbles:!0,detail:{medication:b,addToCatalog:$,catalogId:g()}});e?.dispatchEvent(_)};return qe(async()=>{const{data:b}=await t.getSDK().clinical.catalog.getCatalogs();b.catalogs.length>0&&y(b.catalogs[0].id)}),me(()=>{const b=c()||a()||i()||n();b.length>0&&K(async()=>{const{data:$}=await t.getSDK().clinical.searchMedication.getProducts({id:b});h(!1),v(void 0),d($.medicationProducts)})}),me(()=>{p()&&m(p(),f())}),(()=>{const b=K(()=>document.importNode(tie,!0)),$=b.firstChild,_=$.nextSibling,E=_.nextSibling,O=E.nextSibling,T=O.nextSibling,z=T.nextSibling,B=z.nextSibling,X=B.nextSibling,U=X.firstChild,L=e;return typeof L=="function"?ge(L,b):e=b,b.addEventListener("photon-name-selected",I=>{r(I.detail.medicationId)}),b.addEventListener("photon-strength-selected",I=>{o(I.detail.strengthId)}),b.addEventListener("photon-strength-deselected",()=>{o("")}),b.addEventListener("photon-route-selected",I=>{s(I.detail.routeId)}),b.addEventListener("photon-route-deselected",()=>{s("")}),b.addEventListener("photon-form-selected",I=>{l(I.detail.formId)}),b.addEventListener("photon-form-deselected",()=>{l("")}),S(_,k(Gre,{})),S(E,k(Yre,{get medicationId(){return n()},get disabled(){return n().length==0}})),S(O,k(Xre,{get medicationId(){return i()},get disabled(){return i().length==0}})),S(T,k(Jre,{get medicationId(){return a()},get disabled(){return a().length==0}})),X.addEventListener("photon-option-selected",I=>{v(I.detail.value)}),U._$owner=M(),S(U,k(mn,{get each(){return u().filter((I,R,te)=>{const Y=te.findIndex(H=>H.name===I.name);if(R===Y)return!0}).sort((I,R)=>I.name.toLowerCase()>R.name.toLowerCase()?-1:1)},children:I=>(()=>{const R=K(()=>document.importNode(nie,!0));return R.value=I,R._$owner=M(),S(R,()=>I.name),R})()})),S(b,k(ee,{get when(){return g().length>0},get children(){const I=K(()=>document.importNode(eie,!0));return I.addEventListener("photon-checkbox-toggled",R=>h(R.detail.checked)),I._$owner=M(),G(()=>I.disabled=!p()),G(()=>I.checked=f()),I}}),null),b})()});var rie=Dt`
|
|
3910
3910
|
${qt}
|
|
3911
3911
|
|
package/dist/index.mjs
CHANGED
|
@@ -38231,7 +38231,7 @@ Fe("photon-gender-input", {
|
|
|
38231
38231
|
}), null), s;
|
|
38232
38232
|
})();
|
|
38233
38233
|
});
|
|
38234
|
-
const Nre = /* @__PURE__ */ N('<div class="flex align-center justify-center h-screen"><sl-spinner class="mt-8"></sl-spinner></div>'), Are = /* @__PURE__ */ N('<photon-card title="Personal"><div class="flex flex-col xs:flex-row xs:gap-4"><photon-text-input class="flex-grow min-w-[40%]" debounce-time="0" label="First Name"></photon-text-input><photon-text-input class="min-w-[48%]" debounce-time="0" label="Last Name"></photon-text-input></div><div class="flex flex-col xs:flex-row items-center xs:gap-4"><photon-datepicker no-initial-date="true" class="flex-grow w-full xs:min-w-[40%]" label="Date of Birth"></photon-datepicker><photon-phone-input class="w-full xs:min-w-[48%]" label="
|
|
38234
|
+
const Nre = /* @__PURE__ */ N('<div class="flex align-center justify-center h-screen"><sl-spinner class="mt-8"></sl-spinner></div>'), Are = /* @__PURE__ */ N('<photon-card title="Personal"><div class="flex flex-col xs:flex-row xs:gap-4"><photon-text-input class="flex-grow min-w-[40%]" debounce-time="0" label="First Name"></photon-text-input><photon-text-input class="min-w-[48%]" debounce-time="0" label="Last Name"></photon-text-input></div><div class="flex flex-col xs:flex-row items-center xs:gap-4"><photon-datepicker no-initial-date="true" class="flex-grow w-full xs:min-w-[40%]" label="Date of Birth"></photon-datepicker><photon-phone-input class="w-full xs:min-w-[48%]" label="Mobile Number"></photon-phone-input></div><div class="flex flex-col xs:flex-row justify-between xs:gap-4"><div class="flex-grow w-full xs:min-w-[40%]"><photon-gender-input label="Gender" required="false"></photon-gender-input></div><div class="flex-grow w-full xs:min-w-[40%]"><photon-sex-input label="Sex at Birth" required="false"></photon-sex-input></div></div><photon-text-input debounce-time="0" label="Email"></photon-text-input><hr class="py-2"><p class="font-sans text-lg flex-grow">Address</p><photon-text-input debounce-time="0" label="Street 1"></photon-text-input><photon-text-input debounce-time="0" label="Street 2"></photon-text-input><photon-text-input debounce-time="0" label="City"></photon-text-input><div class="flex gap-4 pb-5 xs:pb-2"><photon-state-input class="flex-grow min-w-[40%]" label="State" required="false"></photon-state-input><photon-text-input debounce-time="0" class="flex-grow min-w-[40%]" label="Zip Code"></photon-text-input></div><hr class="py-2"><p class="font-sans text-lg flex-grow">Preferred Local Pharmacy</p><photon-pharmacy-search></photon-pharmacy-search></photon-card>'), Ire = /* @__PURE__ */ N('<div class="w-full h-full relative"><style></style><style></style><style></style></div>');
|
|
38235
38235
|
wt("https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.4.0/dist/");
|
|
38236
38236
|
const Mre = (e, t) => {
|
|
38237
38237
|
const n = e.selectedPatient.data?.address;
|
|
@@ -38278,7 +38278,7 @@ Fe("photon-patient-form", {
|
|
|
38278
38278
|
validator: _t(eG(i2.map((l) => l.name)), "Please enter Sex at Birth.")
|
|
38279
38279
|
}), s.registerValidator({
|
|
38280
38280
|
key: "phone",
|
|
38281
|
-
validator: _t(ti(On(), 12), "Please enter a valid
|
|
38281
|
+
validator: _t(ti(On(), 12), "Please enter a valid mobile number.")
|
|
38282
38282
|
}), s.registerValidator({
|
|
38283
38283
|
key: "email",
|
|
38284
38284
|
validator: _t(C0([BZ(), I0()]), "Please enter a valid email.")
|