1"use strict";(self.webpackChunkmy_public_inbox_spa=self.webpackChunkmy_public_inbox_spa||[]).push([[3329],{55954(e,n,i){i.d(n,{A:()=>t});var o=i(9950),s=i(78361),r=i(44414);class a extends o.Component{constructor(e){super(e),this.state={}}componentDidMount(){}render(){const e={width:"100%",height:"600px",playerVars:{autoplay:1,controls:0,disablekb:1,modestbranding:1,cc_load_policy:1}};return(0,r.jsx)("div",{className:"mpi-campaign",children:(0,r.jsx)(s.A,{videoId:this.props.videoId,opts:e,className:"video-iframe-container",onPause:e=>{e.target.playVideo()},onEnd:e=>{this.props.onVideoEnd()},onError:e=>{this.props.onVideoError(e)}})})}}const t=a},3329(e,n,i){i.r(n),i.d(n,{default:()=>V});var o=i(89379),s=i(9950),r=i(28429),a=i(7009),t=i(94894),l=i(38892),d=i(60899),c=i(16497),u=i(37324),m=i(16491),p=i(82053),h=i(58567),v=i(85815),x=i(8145),g=i(67818),j=i(39063),y=i(18145),b=(i(27701),i(55954)),A=i(97978),S=i(65429),f=i(81086),N=i(72058),P=i(44414),w=function(e){return e[e.Welcome=1]="Welcome",e[e.Video=2]="Video",e[e.Question=3]="Question",e[e.QuestionStep=4]="QuestionStep",e}(w||{});const C={borderRadius:"16px",padding:"16px",width:"450px",textAlign:"center"},E={width:"100%",height:"150px",backgroundColor:"#e0e0e0",borderRadius:"8px 8px 0 0"},I={width:"80%",height:"20px",backgroundColor:"#e0e0e0",margin:"10px auto"},k={width:"40%",height:"20px",borderRadius:"50px",backgroundColor:"#e0e0e0",margin:"10px auto"},V=()=>{const{slug:e}
1=(0,r.g)(),[n,i]=(0,s.useState)(w.Welcome),[V,F]=(0,s.useState)(null),[T,q]=(0,s.useState)(null),[L,M]=(0,s.useState)(!0),[_,Q]=(0,s.useState)(null),[W,D]=(0,s.useState)(!1),[B,U]=(0,s.useState)(!1),[H,R]=(0,s.useState)(""),[z,G]=(0,s.useState)(!1),[O,K]=(0,s.useState)([]),[Y,Z]=(0,s.useState)(""),[$,J]=(0,s.useState)({}),[X,ee]=(0,s.useState)({}),[ne,ie]=(0,s.useState)(""),[oe,se]=(0,s.useState)(!1),{t:re,i18n:ae}=(0,g.Bd)(),te=(0,r.Zp)(),le=()=>{if(T){const e=ae.language,n=T["description_".concat(e)]||T.description;R(n)}},de=e=>{se(e.target.checked)};(0,s.useEffect)(()=>(le(),ae.on("languageChanged",le),()=>{ae.off("languageChanged",le)}),[T,ae]),(0,s.useEffect)(()=>{i(w.Welcome);(async()=>{M(!0),await(async()=>{try{const n=await a.A.videoSurveyApi.getSurvey(String(e));n?q(n):Q(re("Survey.SurveyNotFound","Encuesta no encontrada"))}catch(n){Q(re("Survey.CantLoad","No se ha podido recuperar el estado de la encuesta."))}})(),M(!1)})()},[String(e),ae.language]);const ce=()=>{i(w.Video)},ue=()=>{i(w.Question)},me=(e,n)=>{J(i=>(0,o.A)((0,o.A)({},i),{},{[e]:n})),K(i=>i.find(n=>n.questionId===e)?i.map(i=>i.questionId===e?"number"===typeof n?(0,o.A)((0,o.A)({},i),{},{answerId:n,answerText:void 0}):(0,o.A)((0,o.A)({},i),{},{answerText:n,answerId:void 0}):i):[...i,"number"===typeof n?{questionId:e,answerId:n}:{questionId:e,answerText:n}])},pe=async()=>{if(!z){G(!0);try{var e;const l={};let d="",c=!1;for(const e of null!==(n=null===T||void 0===T?void 0:T.questions)&&void 0!==n?n:[]){var n;const i=O.find(n=>n.questionId===e.id);e.isOptionChoice?i&&void 0!==i.answerId&&null!==i.answerId||(l[e.id]=re("Survey.ErrorAllQuestions","Debes responder a todas las preguntas"),c=!0):i&&i.answerText&&""!==i.answerText.trim()?i.answerText.length>256&&(l[e.id]=re("Survey.ErrorMaxLength","La respuesta es muy larga")):l[e.id]=re("Survey.ErrorAllQuestions","Debes responder a todas las preguntas")}if(Y&&""!==Y.trim()){/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(Y)||(d=re("Survey.ErrorInvalidEmail","El correo electr\xf3nico no es v\xe1lido"))}if(ee(l),ie(d),Object.keys(l).length>0||d)return void G(!1);const u=new t.hLg;u.surveyId=null!==(e=null===T||void 0===T?void 0:T.id)&&void 0!==e?e:0,u.email=null!==Y&&void 0!==Y?Y:void 0,u.answers=O.map(e=>{const n=new t.gcn;return n.questionId=e.questionId,n.optionId=e.answerId,n.textAnswer=e.answerText,n});const m=await a.A.videoSurveyApi.saveUserAnswers(u);if(m.success){var o,s;F(null!==(o=m.status)&&void 0!==o?o:null),i(w.QuestionStep);const e=null!==(s=null===T||void 0===T?void 0:T.tempos)&&void 0!==s?s:0;A.A.updateTempos(A.A.tempos+e)}else{var r;F(null!==(r=m.status)&&void 0!==r?r:null),i(w.QuestionStep)}}catch(l){Q(re("Survey.ErrorAnsweringQuestion","\xa1Vaya! Ha ocurrido un error, vuelve a intentarlo m\xe1s tarde"))}finally{G(!1)}}};(0,s.useEffect)(()=>{},[W]);const he=()=>{D(e=>!e),U(e=>!e)};if(L)return(0,P.jsx)(P.Fragment,{children:(0,P.jsx)("div",{className:"video-poll-view",children:(0,P.jsx)("div",{className:"mpi-video-poll-container",children:(0,P.jsx)("article",{className:"container video-poll-container center",children:(0,P.jsxs)("div",{style:C,children:[(0,P.jsx)("div",{style:E}),(0,P.jsx)("div",{style:I}),(0,P.jsx)("div",{style:I}),(0,P.jsx)("div",{style:I}),(0,P.jsx)("div",{style:k})]})})})})});if(_)return(0,P.jsx)(P.Fragment,{children:(0,P.jsx)("div",{className:"video-poll-view",children:(0,P.jsx)("div",{className:"mpi-video-poll-container",children:(0,P.jsx)("article",{className:"container video-poll-container",children:(0,P.jsx)(d.Ay,{container:!0,className:"video-poll-item",justifyContent:"center",children:(0,P.jsxs)(d.Ay,{item:!0,className:"video-poll-text center col",xs:12,md:8,children:[(0,P.jsx)("div",{className:"ribbon-container",children:(0,P.jsx)("h2",{children:(0,P.jsx)("a",{href:"/",children:(0,P.jsx)(N.t,{src:N.B.mpiLogoLong,height:"40px",title:"MPI logo"})})})}),(0,P.jsx)("h3",{children:_}),(0,P.jsx)(d.Ay,{item:!0,className:"video-poll-question",xs:12,md:10,children:(0,P.jsx)(j.A,{type:"line",className:"command-button",onPress:()=>{te("/dashboard/videopoll-campaigns-active")},children:re("Common.Exit","Salir")})})]})})})})})});if(!T)return(0,P.jsx)(P.Fragment,{children:(0,P.jsx)("div",{className:"video-poll-view",children:(0,P.jsx)("div",{className:"mpi-video-poll-container",children:(0,P.jsx)("article",{className:"container video-poll-container",children:(0,P.jsx)(d.Ay,{container:!0,className:"video-poll-item",justifyContent:"center",children:(0,P.jsxs)(d.Ay,{item:!0,className:"video-poll-text center col",xs:12,md:8,children:[(0,P.jsx)("div",{className:"ribbon-container",children:(0,P.jsx)("h2",{children:(0,P.jsx)("a",{href:"/",children:(0,P.jsx)(N.t,{src:N.B.mpiLogoLong,height:"40px",title:"MPI logo"})})})}),(0,P.jsxs)("h3",{children:[" ",re("VideoPoll.CampaignNotFound","Campa\xf1a no encontrada")]}),(0,P.jsx)(d.Ay,{item:!0,className:"video-poll-question",xs:12,md:10,children:(0,P.jsx)(j.A,{type:"line",className:"command-button",onPress:()=>{te("/dashboard/videopoll-campaigns-active")},children:re("Common.Exit","Salir")})})]})})})})})});return(0,P.jsx)("div",{className:"video-poll-view",children:(0,P.jsx)("div",{className:"mpi-video-poll-container",children:(0,P.jsx)("article",{className:"container video-poll-container",children:(()=>{switch(n){case w.Welcome:return(()=>{var e;return(0,P.jsx)("div",{children:(0,P.jsx)(d.Ay,{container:!0,className:"video-poll-item",justifyContent:"center",children:(0,P.jsxs)(d.Ay,{item:!0,className:"video-poll-text center col",xs:12,md:8,children:[(0,P.jsx)("div",{className:"ribbon-container",children:(0,P.jsxs)("h2",{children:[(0,P.jsx)("a",{href:"/",children:(0,P.jsx)(N.t,{src:N.B.mpiLogoLong,height:"40px",title:"MPI logo"})}),"\xa0",re("Common.And","y"),"\xa0"," ",(0,P.jsx)("a",{href:null===T||void 0===T?void 0:T.linkWeb,target:"_blank",children:(0,P.jsx)("img",{src:null===T||void 0===T?void 0:T.urlLogo,height:"80px",alt:"logo empresa"})})]})}),(0,P.jsx)("h3",{children:re("Survey.Description","Mira atentamente el siguiente v\xeddeo, contesta una serie de preguntas y podr\xe1s ganar...")}),(0,P.jsxs)("div",{className:"promotion-button",children:[(0,P.jsx)("span",{className:"tempos-campaigns",children:null!==(e=null===T||void 0===T?void 0:T.tempos)&&void 0!==e?e:0})," ",(0,P.jsx)("img",{alt:"image",src:f.A,className:"badge-campaigns"})]}),1==(null===T||void 0===T?void 0:T.whitTempos)&&(0,P.jsx)(P.Fragment,{children:(0,P.jsx)(S.A,{severity:"info",style:{margin:12},children:(0,P.jsx)(c.A,{control:(0,P.jsx)(u.A,{size:"medium",checked:W,onChange:he,color:"primary"}),label:(0,P.jsxs)(P.Fragment,{children:[re("VideoPoll.Intro2","PPara participar y recibir los tempos, comparte tus datos ")," ",(0,P.jsx)("a",{href:null===T||void 0===T?void 0:T.linkPrivacy,target:"_blank",rel:"noopener",children:re("VideoPoll.PrivacyPolicy","pol\xedtica de privacidad.")})]})})})}),(0,P.jsx)("p",{children:H}),1==(null===T||void 0===T?void 0:T.complete)&&(0,P.jsx)(S.A,{severity:"warning",style:{marginBottom:36,margin:12,width:"100%"},children:re("Survey.SurveyAlert","Ya has reclamado estos tempos, por lo que no podr\xe1s reclamarlos otra vez")}
1),(0,P.jsx)(j.A,{type:"vanilla-primary",onPress:ce,children:(0,P.jsx)("p",{style:{paddingInline:20},children:re("VideoPoll.TextButton","Sonido activado y... \xa1estoy listo!")})})]})})})})();case w.Video:return(0,P.jsx)(P.Fragment,{children:(0,P.jsxs)("div",{className:"youtube-container",children:[(0,P.jsx)("div",{className:"ribbon-container",children:(0,P.jsxs)("h2",{children:[(0,P.jsx)("a",{href:"/",children:(0,P.jsx)(N.t,{src:N.B.mpiLogoLong,height:"40px",title:"MPI logo"})}),"\xa0",re("Common.And","y"),"\xa0"," ",(0,P.jsx)("a",{href:null===T||void 0===T?void 0:T.linkWeb,target:"_blank",children:(0,P.jsx)("img",{src:null===T||void 0===T?void 0:T.urlLogo,height:"80px",alt:"logo empresa"})})]})}),(0,P.jsx)("h3",{children:re("Survey.TitleVideo","Mira el siguiente video y contesta a unas preguntas...")}),(0,P.jsx)(b.A,{videoId:(null===T||void 0===T?void 0:T.video)||"",onVideoEnd:ue,onVideoError:()=>i(w.Welcome)})]})});case w.Question:return null!==T&&void 0!==T&&T.questions&&0!==T.questions.length?(0,P.jsx)(P.Fragment,{children:(0,P.jsxs)("div",{className:"youtube-container",children:[(0,P.jsx)("div",{className:"ribbon-container",children:(0,P.jsxs)("h2",{children:[(0,P.jsx)("a",{href:"/",children:(0,P.jsx)(N.t,{src:N.B.mpiLogoLong,height:"40px",title:"MPI logo"})}),"\xa0",re("Common.And","y"),"\xa0"," ",(0,P.jsx)("a",{href:null===T||void 0===T?void 0:T.linkWeb,target:"_blank",children:(0,P.jsx)("img",{src:null===T||void 0===T?void 0:T.urlLogo,height:"80px",alt:"logo empresa"})})]})}),(0,P.jsxs)(d.Ay,{container:!0,justifyContent:"center",spacing:2,children:[(0,P.jsx)("h3",{children:re("Survey.Instructions","Debes rellenar todas las preguntas.")}),(0,P.jsxs)(d.Ay,{item:!0,xs:12,md:8,children:[T.questions.map(e=>{var n,i,o,s;return(0,P.jsxs)(m.A,{mb:3,children:[(0,P.jsx)(p.A,{variant:"h6",color:"primary",children:e.question}),e.isOptionChoice?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(h.A,{name:"question-".concat(e.id),value:null!==(n=$[e.id])&&void 0!==n?n:"",onChange:n=>me(e.id,Number(n.target.value)),children:null===(i=e.options)||void 0===i?void 0:i.map(e=>(0,P.jsx)(c.A,{value:e.id,control:(0,P.jsx)(v.A,{}),label:e.option},e.id))}),X[e.id]&&(0,P.jsx)(p.A,{variant:"caption",color:"error",style:{display:"block",marginTop:"8px"},children:X[e.id]})]}):(0,P.jsx)(x.A,{fullWidth:!0,multiline:!0,maxRows:5,value:null!==(o=$[e.id])&&void 0!==o?o:"",placeholder:re("Survey.Answer","Escribe tu respuesta"),onChange:n=>me(e.id,n.target.value),error:!!X[e.id],helperText:null!==(s=X[e.id])&&void 0!==s?s:""})]},e.id)}),(0,P.jsx)(x.A,{fullWidth:!0,type:"email",name:"emailInput",label:re("Survey.Email","Correo electr\xf3nico (opcional)"),value:Y,onChange:e=>Z(e.target.value),error:!!ne,helperText:ne}),(0,P.jsx)(S.A,{severity:"info",style:{marginTop:12},children:(0,P.jsx)(c.A,{control:(0,P.jsx)(u.A,{size:"medium",checked:oe,onChange:de,color:"primary"}),label:(0,P.jsxs)(P.Fragment,{children:[re("Survey.SurveyPolicy","Para participar y recibir los tempos, comparte tus datos ")," ",(0,P.jsx)("a",{href:null===T||void 0===T?void 0:T.linkPrivacy,target:"_blank",rel:"noopener",children:re("Survey.SurveyPolicyEnd","pol\xedtica de privacidad.")})]})})}),(0,P.jsx)(m.A,{mt:2,textAlign:"center",children:(0,P.jsx)(j.A,{className:"question-button",onPress:pe,disabled:z||!oe,type:"line",children:re("Survey.SendAnswers","Enviar respuestas")})})]})]})]})}):(0,P.jsxs)(P.Fragment,{children:[" ",Q(re("Survey.NotQuestion","No se pudo obtener una nueva pregunta, vuelve a intentarlo m\xe1s tarde"))]});case w.QuestionStep:return(()=>{var e;return(0,P.jsx)(d.Ay,{container:!0,className:"video-poll-item",justifyContent:"center",children:(0,P.jsxs)(d.Ay,{item:!0,className:"video-poll-text center col",xs:12,md:8,children:[(0,P.jsx)("div",{className:"ribbon-container",children:(0,P.jsxs)("h2",{children:[(0,P.jsx)("a",{href:"/",children:(0,P.jsx)(N.t,{src:N.B.mpiLogoLong,height:"40px",title:"MPI logo"})}),"\xa0",re("Common.And","y"),"\xa0"," ",(0,P.jsx)("a",{href:null===T||void 0===T?void 0:T.linkWeb,target:"_blank",children:(0,P.jsx)("img",{src:null===T||void 0===T?void 0:T.urlLogo,height:"80px",alt:"logo empresa"})})]})}),V?(0,P.jsxs)(P.Fragment,{children:[V===t.i0P.SurveyAlreadyCompleted?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)("h3",{children:re("VideoPoll.CampaignAlreadyCompleted","\xa1Felicidades! Has contestado correctamente, aunque no podemos darte el premio porque ya lo ganaste anteriormente.")}),(null===T||void 0===T?void 0:T.endDescription)&&(0,P.jsx)("p",{children:(0,P.jsx)(l.BW,{content:T.endDescription,allowElements:!0})}),(0,P.jsxs)("p",{children:[re("VideoPoll.Thanks","MyPublicInbox y ")," ",null===T||void 0===T?void 0:T.name,re("VideoPoll.Thanks2"," te dan las gracias por participar.")]})]}):V===t.i0P.Success?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)("h3",{children:re("VideoPoll.Congratulations","\xa1Felicidades!")}),(0,P.jsxs)("p",{children:[re("VideoPoll.CorrectAnswerAndGain","Has contestado correctamente y has ganad
1o "),(0,P.jsx)(y.A,{color:"primary",value:null!==(e=null===T||void 0===T?void 0:T.tempos)&&void 0!==e?e:0}),re("VideoPoll.CorrectAnswerAndGain2"," que ya se han a\xf1adido a tu saldo.")]}),(null===T||void 0===T?void 0:T.endDescription)&&(0,P.jsx)("div",{children:(0,P.jsx)(l.VK,{content:T.endDescription,allowElements:!0})}),(0,P.jsxs)("p",{children:[re("VideoPoll.Thanks","MyPublicInbox y ")," ",null===T||void 0===T?void 0:T.name,re("VideoPoll.Thanks2"," te dan las gracias por participar.")]})]}):V===t.i0P.UserNotFound?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)("h3",{children:re("Survey.UserNotFound","Usuario no encontrado. Por favor, inicia sesi\xf3n nuevamente.")}),(0,P.jsx)("p",{children:re("Survey.UserNotFoundMessage","No pudimos identificar tu cuenta. Intenta recargar.")})]}):V===t.i0P.ErrorSavingAnswers?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)("h3",{children:re("Survey.SaveError","Error al guardar las respuestas")}),(0,P.jsx)("p",{children:re("Survey.SaveErrorMessage","Hubo un problema al procesar tus respuestas. Por favor, intenta nuevamente.")})]}):V===t.i0P.SurveyNotFound?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)("h3",{children:re("Survey.ServerError","Lo sentimos, ha ocurrido un error en la promoci\xf3n")}),(0,P.jsx)("p",{children:re("Survey.ServerErrorMessage","No podemos procesar tu participaci\xf3n en este momento. Por favor, intenta m\xe1s tarde.")})]}):V===t.i0P.MaxTemposDistributed?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)("h3",{children:re("Survey.NoTempos","There is no more money to distribute")}),(0,P.jsx)("p",{children:re("Survey.NoTemposMessage","Gracias por participar en la encuesta, lamentablemente no hay m\xe1s Tempos por repartir en esta promoci\xf3n.")}),(null===T||void 0===T?void 0:T.endDescription)&&(0,P.jsx)("div",{children:(0,P.jsx)(l.VK,{content:T.endDescription,allowElements:!0})})]}):(0,P.jsx)("h3",{children:re("VideoPoll.UnknownError","Ha habido un error inesperado. Por favor, int\xe9ntalo m\xe1s tarde.")}),(0,P.jsxs)(d.Ay,{item:!0,className:"video-poll-question",xs:12,md:10,children:[400===V&&(0,P.jsx)(j.A,{type:"line",className:"command-button",onPress:()=>i(w.Video),children:re("VideoPoll.RetryButtonText","Intentar de nuevo")}),(0,P.jsx)(j.A,{type:"line",className:"command-button",onPress:()=>{te("/dashboard/videopoll-campaigns-active")},children:re("Common.Exit","Salir")})]})]}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)("h3",{children:re("Survey.Processing","Procesando tu respuesta...")}),(0,P.jsx)("p",{children:re("Survey.ProcessingMessage","Estamos validando tus respuestas y calculando tu recompensa...")})]})]})})})();default:return null}})()})})})}},27701(){}}]);
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.