(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["2d0b2c70"],{"260f":function(t,e,i){"use strict";i.r(e);var n=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"q-pa-md q-my-lg q-mx-lg q-mx-md-auto",staticStyle:{clear:"both","max-width":"500px","border-radius":"5px","box-shadow":"0 0 4px 2px #aaa"}},[i("div",{staticClass:"text-center"},[t._v("\n    "+t._s(t.$t("text.whitelistSales.enterCodeLabel."+t.type))+"\n  ")]),i("whitelist-input",{attrs:{"event-id":t.eventId,type:t.type},on:{"on-validate":function(e){t.validated()}},model:{value:t.code,callback:function(e){t.code=e},expression:"code"}})],1)},a=[];n._withStripped=!0;i("a481"),i("c5f6");var r=i("05fe"),d=i("57d5"),l=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("q-field",{attrs:{"data-test":t.CypressTarget("WhitelistCode"),helper:t.inputHelper}},[i("q-input",{attrs:{"data-test":t.CypressTarget("Input"),"float-label":t.$t("text.whitelistSales.codeFieldTitle"),disabled:t.code_validating,loading:t.code_validating,type:t.inputType,after:[{icon:"check",handler:t.validateCode}],clearable:""},on:{input:function(e){t.codeInput()}},nativeOn:{keypress:[function(e){return"button"in e||!t._k(e.keyCode,"space",32,e.key," ")?(e.stopPropagation(),function(){return!1}()):null},function(e){return"button"in e||!t._k(e.keyCode,"enter",13,e.key,"Enter")?t.validateCode(e):null}]},model:{value:t.code,callback:function(e){t.code="string"===typeof e?e.trim():e},expression:"code"}})],1)},o=[];l._withStripped=!0;var s=i("9523"),c=i.n(s),u=i("3156"),p=i.n(u),h=(i("6762"),i("2fdb"),i("2f62")),v={EMAIL:"email",CODE:"code",BIN:"bin",EXTERNAL_CPF:"external_cpf"},f=20,y=2e3,_={props:{value:{type:String,required:!0},type:{type:String,required:!0},eventId:{type:Number,default:null,required:!1},eventDateId:{type:Number,default:null,required:!1},priceSpecialId:{type:Number,default:null,required:!1}},data:function(){return{code:"",code_validating:!1,current_try:0}},computed:{inputType:function(){return[v.BIN,v.EXTERNAL_CPF].includes(this.type)?"tel":"email"},inputHelper:function(){if(!this.code_validating)return this.$t("label.required");var t=4,e=2,i=Math.floor(this.current_try/e%t);return this.$t("text.whitelistSales.validating_".concat(i))}},watch:{value:function(t){"".concat(t)!=="".concat(this.code)&&(this.code=t)}},methods:p()({},Object(h["b"])("whitelist",["validateWhitelistCode"]),{codeInput:function(){[v.EMAIL,v.CODE].includes(this.type)?this.code="".concat(this.code).replace(/\s/g,""):[v.BIN,v.EXTERNAL_CPF].includes(this.type)&&(this.code="".concat(this.code).replace(/\D/g,"")),this.$emit("input",this.code)},validateCode:function(){var t,e=this,i=(t={},c()(t,v.EMAIL,/^(([^<>()[\].,;:\s@"]+(\.[^<>()[\].,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/),c()(t,v.BIN,/^((\d{6}))$/),c()(t,v.EXTERNAL_CPF,/^\d{11}$/),c()(t,v.CODE,/^\S+$/),t);i[this.type].test(this.code)?(this.code_validating=!0,this.validateWhitelistCode({eventId:this.eventId,eventDateId:this.eventDateId,priceSpecialId:this.priceSpecialId,type:this.type,code:this.code}).then(function(t){e.$emit("on-validate",t),e.current_try=0,e.code_validating=!1}).catch(function(t){503===t.response.status?e.current_try<f?(e.current_try+=1,setTimeout(e.validateCode,y)):(e.current_try=0,e.toastError(e.$t("text.whitelistSales.failedExternalValidation")),e.code_validating=!1):(e.current_try=0,e.toastError(e.$t(t.response.data.status_code)),e.code_validating=!1)})):this.toastError(this.$t("text.whitelistSales.invalidCodeMessage.".concat(this.type)))}})},m=_,b=i("2877"),C=Object(b["a"])(m,l,o,!1,null,null,null);C.options.__file="WhitelistInput.vue";var I=C.exports,g={components:{whitelistInput:I},mixins:[r["a"]],props:{eventId:{type:Number,required:!1,default:null},type:{type:String,required:!0}},data:function(){return{code:""}},methods:{validated:function(){this.isWhiteListEntity?this.$router.replace("/"):this.$router.replace({name:d["C"]})}}},E=g,x=Object(b["a"])(E,n,a,!1,null,null,null);x.options.__file="WhitelistSale.vue";e["default"]=x.exports}}]);
//# sourceMappingURL=2d0b2c70.25c0187f.2024-10-22T18:36:13.257Z.js.map