1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CreatePasswordFields-DsnyVmcZ.js","assets/index-sUPB-bMu.js","assets/index-CjsJg3P0.css","assets/CreatePasswordFields-oNEWVTQN.css","assets/EnterPasswordField-ShTRmpqS.js","assets/EnterPasswordField-Bn6pI3KP.css","assets/DefaultFields-CVrwATkl.js","assets/intlTelInputWithUtils-CTA2SmYZ.js","assets/intlTelInputWithUtils-BoEom5nL.css","assets/DefaultFields-IEPohvzV.css","assets/BRFields-BBLgDRdH.js","assets/BRFields-BS7S_ixt.css","assets/InPeaceAccount-DmO-bbf3.js","assets/InPeaceAccount-DyguNgk-.css","assets/RecoverPassword-Bu_AXrEL.js","assets/RecoverPassword-DEN8kE73.css","assets/ActiveYourAccount-CsqvZrJj.js","assets/ActiveYourAccount-Bhs6j0w_.css"])))=>i.map(i=>d[i]); 2import{_ as F,m as k,j as P,k as h,b as u,$ as v,c as n,o,a,g as m,d as C,e as l,t as i,w as p,a1 as g,a9 as w,a4 as M,ap as G,l as T,a7 as O,Z as R,n as U,f as V,aq as f,ar as $,p as d}from"./index-sUPB-bMu.js";const B=h(()=>d(()=>import("./CreatePasswordFields-DsnyVmcZ.js"),__vite__mapDeps([0,1,2,3]))),W=h(()=>d(()=>import("./EnterPasswordField-ShTRmpqS.js"),__vite__mapDeps([4,1,2,5]))),j=h(()=>d(()=>import("./DefaultFields-CVrwATkl.js"),__vite__mapDeps([6,1,2,7,8,9]))),x=h(()=>d(()=>import("./BRFields-BBLgDRdH.js"),__vite__mapDeps([10,1,2,7,8,11]))),q=h(()=>d(()=>import("./InPeaceAccount-DmO-bbf3.js"),__vite__mapDeps([12,1,2,13]))),H=h(()=>d(()=>import("./RecoverPassword-Bu_AXrEL.js"),__vite__mapDeps([14,1,2,15]))),Y=h(()=>d(()=>import("./ActiveYourAccount-CsqvZrJj.js"),__vite__mapDeps([16,1,2,17]))),K={name:"UserAccess",components:{BRFields:x,DefaultFields:j,EnterPasswordField:W,CreatePasswordFields:B,InPeaceAccountModal:q,RecoverPasswordModal:H,ActiveYourAccountModal:Y},props:{redirectTo:{type:String,default:null}},setup(){const{kondutoAddTagging:e,kondutoClearAllTagging:t}=$();return{kondutoAddTagging:e,kondutoClearAllTagging:t}},data(){return{user:{email:null},formFeedback:{type:null,message:null},accessData:{type:null,fieldsComponent:null,showPassword:!1,registerIsOptional:!1,showPasswordFields:!0},termsAccepted:!1,keepConnected:!1,createAccount:!1,submitting:!1,modalComponent:null}},computed:{...P(["churchData","churchVisual","checkoutType","churchLanguage"]),logoUrl(){return this.churchVisual?.logomarcaLogin?this.churchVisual.logomarcaLogin.url:null},formSubmitMethod(){return this.accessData.type?this.handleSubmit:this.validateEmail},registerIsOptional(){const e=/^[/]?(checkout)[/]?$/gm;if(this.redirectTo&&e.exec(this.redirectTo))switch(this.checkoutType){case"give":return!1;default:return!1}return!1},accessMethod(){switch(this.$route.query.method){case"login":return"LOGIN";case"register":return"REGISTER";default:return"LOGIN"}},formSubtitle(){return this.accessData.type==="LOGIN"?this.$t("LOGIN.SUBTITLE"):this.accessData.type==="NEW_ACCOUNT"?this.$t("REGISTER.SUBTITLE"):this.accessData.type==="NEW_CLIENT_ACCOUNT"&&this.accessMethod==="REGISTER"?this.$t("ACCESS.TITLE.CLIENT_REGISTER"):this.$t("ACCESS.SUBTITLE")},buttonText(){return this.accessMethod==="LOGIN"?this.$t("ACCESS.BUTTON.LOGIN"):this.$t("ACCESS.BUTTON.REGISTER")},is360(){return!!this.churchData.slugOrganizacao}},watch:{"formFeedback.type"(e){e==="error"&&window.scrollTo(0,0)},accessMethod:{immediate:!0,handler(e){if(e==="REGISTER"){this.kondutoAddTagging({name:"kdt:page",content:"account_creation"});return}this.kondutoClearAllTagging()}},modalComponent(e){if(e?.component==="RecoverPasswordModal"){this.kondutoAddTagging({name:"kdt:page",content:"password_reset"});return}this.kondutoClearAllTagging()}},created(){this.$useHead({title:this.$t("ACCESS.TITLE.PAGE")})},methods:{...k(["userGetCredentials","userGetInPeaceAccount","userGetClientAccount","userGetDocuments","userGetCards","userGetRoles","user360GetClientAccount","user360GetDocuments","user360GetRoles","userLogOut","checkoutSetUnregisteredUser","churchGetMenuItems","appSetLoadingState"]),updateLocalData(e){this.user={...this.user,...e}},mountFullData(e=!1){let t={nome:this.user.nome,sobrenome:this.user.sobrenome,email:this.user.email?.toLowerCase(),dataNascimento:this.$dayjs(this.user.dataNascimento,this.$dayjs().locale(this.churchLanguage).localeData().longDateFormat("L"),this.churchLanguage).format("YYYY-MM-DD"),telefone:this.user.telefone};switch(e?t={...t,igreja:this.churchData.id,flagEnviarConfirmacao:this.createAccount}:this.accessData.type==="NEW_ACCOUNT"?t={...t,idIgreja:this.churchData.id,senha:this.user.senha,tipo:"Visitante",flagReceberVisita:0,flagReceberProgramacaoIgreja:0}:this.accessData.type==="NEW_CLIENT_ACCOUNT"&&(t={...t,idIgreja:this.churchData.id,tipo:"Visitante",flagReceberVisita:0,flagReceberProgramacaoIgreja:0}),this.churchData.pais){case"BR":return this.user.cpf&&(t.documentos=[{tipo:1,numero:this.user.cpf}]),{...t};default:return{...t}}}
2,setErrors(e){this.$refs.accessForm.setErrors({...e})},clearMessage(){this.formFeedback={type:null,message:null}},countryFields(){switch(this.churchData.pais){case"BR":return"BRFields";default:return"DefaultFields"}},defineAccessData({type:e,showPasswordFields:t}){switch(e){case"LOGIN":this.accessData={type:e,fieldsComponent:"EnterPasswordField",showPassword:!0,showPasswordFields:!1,registerIsOptional:!1},this.$router.replace({query:{...this.$route.query,method:"login"}}).catch(()=>{});break;case"NEW_CLIENT_ACCOUNT":this.accessData={type:e,fieldsComponent:this.countryFields(),showPassword:!1,showPasswordFields:!1,registerIsOptional:!1},this.$router.replace({query:{...this.$route.query,method:"register"}}).catch(()=>{});break;case"NEW_ACCOUNT":this.accessData={type:e,fieldsComponent:this.countryFields(),showPassword:!0,showPasswordFields:t,registerIsOptional:this.registerIsOptional},this.$router.replace({query:{...this.$route.query,method:"register"}}).catch(()=>{});break;default:this.accessData={type:null,fieldsComponent:null,showPassword:!0,showPasswordFields:!0,registerIsOptional:!1};break}},async handleSubmit(){this.clearMessage();const{valid:e}=await this.$refs.accessForm.validate();if(e){if(this.$formSending(!0,this.$refs.accessForm.$el),this.accessData.type==="NEW_ACCOUNT"&&this.registerIsOptional&&(!this.createAccount||this.createAccount&&!this.accessData.showPasswordFields))await this.checkoutSetUnregisteredUser(this.mountFullData(!0)),await this.$router.replace({path:this.redirectTo}).catch(()=>{});else if(this.accessData.type==="NEW_ACCOUNT"){if(!this.termsAccepted)return;try{await this.registerUser()}catch{}}else if(this.accessData.type==="LOGIN")try{await this.logInUser(),await this.getClientAccountData(),await this.userGetCards().catch(()=>{}),await this.loadChurchMenu(),this.redirectAfterAccess()}catch{}else if(this.accessData.type==="NEW_CLIENT_ACCOUNT")try{await this.registerUser(!1),await this.getClientAccountData(),await this.loadChurchMenu(),this.redirectAfterAccess()}catch{}this.$formSending(!1,this.$refs.accessForm.$el)}},async validateEmail(){this.clearMessage();const{valid:e}=await this.$refs.emailField.validate();if(e&&!this.submitting){this.submitting=!0,this.$formSending(!0,this.$refs.accessForm.$el);try{const[t,E]=await Promise.all([f.getEmailInPeaceInfo(this.user.email?.toLowerCase()),f.getEmailClientInfo({client:this.churchData.id,email:this.user.email?.toLowerCase()})]);t.data.users.length?t.data.users[0].isActive&&!E.data.usuarios.length?(this.showInfoModal("INPEACE_ACCOUNT_ACTIVATED"),this.defineAccessData({type:"LOGIN"})):!t.data.users[0].isActive&&!E.data.usuarios.length&&this.registerIsOptional?this.defineAccessData({type:"NEW_ACCOUNT",showPasswordFields:!1}):!t.data.users[0].isActive&&!E.data.usuarios.length?(this.showInfoModal("INPEACE_ACCOUNT_UNACTIVATED"),await this.sendValidationEmail(),this.defineAccessData({type:"LOGIN"})):t.data.users[0].isActive?this.defineAccessData({type:"LOGIN"}):(this.showInfoModal("ACTIVE_ACCOUNT"),await this.sendValidationEmail()):this.defineAccessData({type:"NEW_ACCOUNT",showPasswordFields:!0})}catch{this.formFeedback={type:"error",message:this.$t("FORM.MESSAGE.ERROR.GENERIC_ERROR")}}this.$formSending(!1,this.$refs.accessForm.$el),this.submitting=!1}},async sendRecoverPassword(){this.$formSending(!0,this.$refs.accessForm.$el);try{await f.postResetPassword({idIgreja:this.churchData.id,email:this.user.email?.toLowerCase()}),this.showInfoModal("RECOVER_PASSWORD")}catch{this.formFeedback={type:"error",message:this.$t("FORM.MESSAGE.ERROR.GENERIC_ERROR")}}this.$formSending(!1,this.$refs.accessForm.$el)},async sendValidationEmail(){try{await f.postEmailValidationRequest({clientId:this.churchData.id,email:this.user.email?.toLowerCase()})}catch{this.formFeedback={type:"error",message:this.$t("ACCESS.MESSAGE.ERROR.INACTIVE_ACCOUNT")}}},async registerUser(e=!0){try{const t=await f.postRegisterUser({igreja:this.churchData.id,data:{usuario:{...this.mountFullData(),origem:"site"}}});return e&&(this.showInfoModal("ACTIVE_ACCOUNT"),this.defineAccessData({type:"LOGIN"})),Promise.resolve(t)}catch(t){return t.response?.data?.code==="IUC_001"?this.formFeedback={type:"error",message:this.$t("FEEDBACK.IUC_001.DETAIL")}:t.response.data.error.message.includes("CPF")?this.formFeedback={type:"error",message:t.response.data.error.message}:t.response&&Object.keys(t.response.data.errors).length?this.formFeedback={type:"error",message:t.response.data.errors[Object.keys(t.response.data.errors)[0]][0]}:this.formFeedback={type:"error",message:this.$t("FORM.MESSAGE.ERROR.GENERIC_ERROR")},Promise.reject(new Error("REGISTER_FAIL"))}},async logInUser(){try{return await this.userGetCredentials({username:this.user.email?.toLowerCase(),password:this.user.senha,keepConnected:this.keepConnected}),await this.userGetInPeaceAccount(),Promise.resolve(!0)}catch(e){return this.userLogOut(),e.response&&e.response.status===401?this.formFeedback={type:"error",message:e.response.data.message||e.response.data.error.message}:this.formFeedback={type:"error",message:this.$t("FORM.MESSAGE.ERROR.GENERIC_ERROR")},Promise.reject(new Error("LOGIN_FAIL"))}},async getClientAccountData(){try{return this.is360?(await this.user360GetClientAccount(),await Promise.all([this.user360GetDocuments(),this.user360GetRoles()])):(await this.userGetClientAccount(),await Promise.all([this.userGetDocuments(),this.userGetRoles()])),Promise.resolve("USER_SUCCESS")}catch(e){return"status"in e&&e.status===200&&!e.data.usuarios.length?this.defineAccessData({type:"NEW_CLIENT_ACCOUNT"}):this.formFeedback={type:"error",message:this.$t("FORM.MESSAGE.ERROR.GENERIC_ERROR")},Promise.reject(e)}},redirectAfterAccess(){this.redirectTo?this.$router.replace({path:this.redirectTo}).catch(()=>{}):this.$router.replace({name:"churchHome"}).catch(()=>{})},showInfoModal(e){switch(e){case"ACTIVE_ACCOUNT":this.modalComponent={component:"ActiveYourAccountModal",needActivation:!1};break;case"RECOVER_PASSWORD":this.modalComponent={component:"RecoverPasswordModal",needActivation:!1};break;case"INPEACE_ACCOUNT_ACTIVATED":this.modalComponent={component:"InPeaceAccountModal",needActivation:!1};break;case"INPEACE_ACCOUNT_UNACTIVATED":this.modalComponent={component:"InPeaceAccountModal",needActivation:!0};break}},async loadChurchMenu(){try{this.appSetLoadingState({context:"GLOBAL",status:!0}),await this.churchGetMenuItems()}catch{}finally{this.appSetLoadingState({context:"GLOBAL",status:!1})}}}},z={class:"access-page"},Z={class:"access-page__logo"},J=["src"],Q={key:1,class:"text"},X={class:"access-page__form__title"},ee={class:"access-page__error"},te={class:"access-page__error__message"},se={key:0,class:"access-page__form__subtitle"},ae={class:"input-item input-item__floated-label"},re=["innerHTML"],oe=["placeholder"],ie={class:"checkbox-term__label"},ce={for:"acceptance_term"},ne={href:"https://policies.inpeaceapp.com/"},le={href:"https://terms.inpeaceapp.com/"},he={key:2,class:"checkbox-term"},de={class:"checkbox-term__label"},ue={for:"keep_connected"},me={class:"btn__text"},pe={key:3,class:"access-page__recover-password-btn"},_e={class:"btn__text"};function fe(e,t,E,Ee,s,r){const y=u("SvgElement"),D=u("AlertMessage"),I=u("Field"),S=u("ErrorMessage"),L=u("CreatePasswordFields"),N=u("Form"),b=v("dompurify-html");return o(),n("div",z,[a("div",Z,[r.logoUrl?(o(),n("img",{key:0,src:r.logoUrl,class:"image"},null,8,J)):(o(),n("p",Q,i(e.churchData.nome),1))]),m(N,{ref:"accessForm",class:"access-page__form form-styled login-form container",onSubmit:t[6]||(t[6]=A=>r.formSubmitMethod())},{default:p(({meta:A})=>[a("h1",X,i(e.$t("ACCESS.TITLE.ACCESS")),1),a("div",ee,[s.formFeedback.message?(o(),C(D,{key:0,t
2ype:s.formFeedback.type},{icon:p(()=>[m(y,{name:"Alert",title:e.$t("ALERT_MESSAGE.TITLE"),width:"1.5rem",height:"100%"},null,8,["title"])]),default:p(()=>[g(a("p",te,null,512),[[b,s.formFeedback.message]])]),_:1},8,["type"])):l("",!0)]),s.formFeedback.message?l("",!0):(o(),n("h2",se,i(r.formSubtitle),1)),a("div",ae,[a("label",{for:"email",class:"input-item__label input-item__label",innerHTML:`${e.$t("FORM.LABEL.EMAIL")} ${s.accessData.type!=="NEW_ACCOUNT"?"":"*"}`},null,8,re),m(I,{ref:"emailField",key:"email-input",rules:"required|email",name:"email"},{default:p(({field:c})=>[g(a("input",w(c,{"onUpdate:modelValue":t[0]||(t[0]=_=>s.user.email=_),type:"email",inputmode:"email",class:"input-item__field input-item__field--normal input-item__field",placeholder:e.$t("FORM.PLACEHOLDER.EMAIL"),onBlur:t[1]||(t[1]=(..._)=>r.validateEmail&&r.validateEmail(..._))}),null,16,oe),[[M,s.user.email]])]),_:1},512),m(S,{name:"email",class:"input-item__feedback input-item__feedback--invalid"})]),m(G,{name:"slide-fade",tag:"span",class:"component-fields"},{default:p(()=>[s.accessData.fieldsComponent?(o(),n("div",{key:s.accessData.fieldsComponent},[(o(),C(T(s.accessData.fieldsComponent),{onFormData:r.updateLocalData,onSetErrors:r.setErrors},null,40,["onFormData","onSetErrors"]))])):l("",!0),s.accessData.type!=="LOGIN"&&s.accessData.showPassword?(o(),n("div",{key:s.accessData.type},[m(L,{"is-optional":s.accessData.registerIsOptional,"show-password-fields":s.accessData.showPasswordFields,onFormData:r.updateLocalData,onCreateAccunt:t[2]||(t[2]=c=>s.createAccount=c)},null,8,["is-optional","show-password-fields","onFormData"])])):l("",!0)]),_:1}),s.accessData.type!=="LOGIN"&&s.accessData.showPassword?(o(),C(I,{key:1,name:"acceptance_term",class:"checkbox-term",as:"div",rules:{required:{allowFalse:!1}}},{default:p(({field:c})=>[g(a("input",w(c,{"onUpdate:modelValue":t[3]||(t[3]=_=>s.termsAccepted=_),name:"acceptance_term",type:"checkbox",class:"checkbox-term__input"}),null,16),[[O,s.termsAccepted]]),a("div",ie,[a("label",ce,[R(i(e.$t("FORM.PLACEHOLDER.ACCEPTANCE_TERM_FIRST"))+" ",1),a("a",ne,i(e.$t("FORM.PLACEHOLDER.PRIVACY_POLICY")),1),R(" "+i(e.$t("FORM.PLACEHOLDER.ACCEPTANCE_TERM_SECOND"))+" ",1),a("a",le,i(e.$t("FORM.PLACEHOLDER.TERMS_OF_SERVICE")),1),t[8]||(t[8]=R(". ",-1))])])]),_:1})):l("",!0),s.accessData.type==="LOGIN"?(o(),n("div",he,[g(a("input",{id:"keep_connected","onUpdate:modelValue":t[4]||(t[4]=c=>s.keepConnected=c),name:"keep_connected",type:"checkbox",class:"checkbox-term__input"},null,512),[[O,s.keepConnected]]),a("div",de,[a("label",ue,i(e.$t("ACCESS.LABEL.KEEP_CONNECTED")),1)])])):l("",!0),a("button",{type:"submit",class:U(["btn btn--color-primary",{"btn--disabled":!A.valid}])},[a("span",me,i(r.buttonText),1)],2),s.accessData.type==="LOGIN"?(o(),n("div",pe,[a("button",{class:"btn btn--text-primary",onClick:t[5]||(t[5]=V((...c)=>r.sendRecoverPassword&&r.sendRecoverPassword(...c),["prevent"]))},[a("span",_e,i(e.$t("ACCESS.BUTTON.RECOVER_PASSWORD")),1)])])):l("",!0)]),_:1},512),s.modalComponent?(o(),C(T(s.modalComponent.component),{key:0,"need-activation":s.modalComponent.needActivation,onClosed:t[7]||(t[7]=A=>s.modalComponent=null)},null,40,["need-activation"])):l("",!0)])}const ge=F(K,[["render",fe],["__scopeId","data-v-a0bf3c81"]]);export{ge as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.