1"use strict";(self.webpackChunkthe_prompt_protocol_home=self.webpackChunkthe_prompt_protocol_home||[]).push([[2406],{12406:(e,o,t)=>{t.r(o),t.d(o,{default:()=>C});var n=t(33714),a=t(32321),s=t(43869),i=t(29439),l=t(87363),r=t(81297),c=t(66711),u=t(77437);const d={page:"ContributionNew_page__PY01a",content:"ContributionNew_content__PYcE9",topBar:"ContributionNew_topBar__I9JAM",rulesBtn:"ContributionNew_rulesBtn__j3HcR",rulesIcon:"ContributionNew_rulesIcon__bUNUh",swiperWrap:"ContributionNew_swiperWrap__E--AA",questionCard:"ContributionNew_questionCard__itDit",bannerWrap:"ContributionNew_bannerWrap__uDeyK",bannerImg:"ContributionNew_bannerImg__buRyc",bannerPlaceholder:"ContributionNew_bannerPlaceholder__O7eY1",logoWrap:"ContributionNew_logoWrap__fMP6F",logoImg:"ContributionNew_logoImg__NKLRD",logoPlaceholder:"ContributionNew_logoPlaceholder__R3JrU",questionBody:"ContributionNew_questionBody__gNmfk",questionFirst:"ContributionNew_questionFirst__vmWYD",questionText:"ContributionNew_questionText__GwTpY",subQuestion:"ContributionNew_subQuestion__iGRo4",categoryTag:"ContributionNew_categoryTag__6UkpA",subQuestionContext:"ContributionNew_subQuestionContext__Qpppe",btns:"ContributionNew_btns__H7FDE",btn:"ContributionNew_btn__0IyQ3",active:"ContributionNew_active__gyfaT",btnLabel:"ContributionNew_btnLabel__U4OUK",progressText:"ContributionNew_progressText__RDnXh"};var m=t(34630);var v=t(39480),h=t(97541),p=t(88635),N=t(13487),b=t(70711),f=t(75859);const g=()=>{var e,o,t,g;const C=(0,r.$G)().t;!function(){const e=(0,l.useState)(!1),o=(0,i.Z)(e,2);o[0],o[1]}();const w=(0,l.useContext)(u.k),_=(0,c.useSearchParams)(),k=(0,i.Z)(_,1)[0],x=(0,c.useNavigate)(),A=(0,c.useLocation)(),y=(0,l.useRef)(null),S=(0,l.useRef)(null),Z=(0,l.useRef)(null),j=(0,l.useState)(0),T=(0,i.Z)(j,2),E=T[0],q=T[1],U=(0,l.useState)({}),B=(0,i.Z)(U,2),I=B[0],R=B[1],G=(0,l.useState)([]),D=(0,i.Z)(G,2),P=D[0],Q=D[1],M=(0,l.useState)(!1),W=(0,i.Z)(M,2),L=W[0],F=W[1],O=(0,l.useState)(!1),K=(0,i.Z)(O,2),Y=K[0],H=K[1],V=(0,l.useState)(0),J=(0,i.Z)(V,2),X=J[0],z=J[1],$=(0,l.useState)([]),ee=(0,i.Z)($,2),oe=ee[0],te=ee[1],ne=(0,l.useState)([]),ae=(0,i.Z)(ne,2),se=ae[0],ie=ae[1],le=(0,l.useState)(null),re=(0,i.Z)(le,2),ce=re[0],ue=re[1],de=(0,l.useRef)([]),me=(0,l.useRef)(null),ve=(0,l.useRef)(!1),he=null!==(e=null===w||void 0===w?void 0:w.userInfo)&&void 0!==e?e:{},pe=null!==(o=null===w||void 0===w?void 0:w.config)&&void 0!==o?o:{},Ne=k.get("source"),be=k.get("tid"),fe="stake"===Ne,ge=!!be,Ce=async function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];s.Z.show({maskClassName:"customNewLoading",maskClickable:!1,duration:0});try{var o;const a=await h.Z.post["/book/profileSurveys/commit"]({data:{answers:oe,source:null!==Ne&&void 0!==Ne?Ne:"",brandId:null!==(o=k.get("tid"))&&void 0!==o?o:""}}),i=null===a||void 0===a?void 0:a.data;if(a.err)s.Z.show({maskClassName:"customToast",content:C("common.networkError","Network Error"),icon:"fail",duration:2e3});else{var t,n;if(fe)!async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"stake",o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"prompt",t=arguments.length>2?arguments[2]:void 0;if(null===t||void 0===t||!t.length)return void s.Z.show({content:C("profileSurvey.stakeFailed","Stake Failed"),maskClassName:"customToast"});let n=null;const a=new Array(t.length).fill(null===pe||void 0===pe?void 0:pe.promptContract);try{var i;n="unstake"===e?await(0,b.UL)(null===he||void 0===he?void 0:he.address,a,t,o,null===pe||void 0===pe?void 0:pe.NFTStakingContract):await(0,b.XS)(null===he||void 0===he?void 0:he.address,a,t,o,null===pe||void 0===pe?void 0:pe.NFTStakingContract),console.log(n),"success"===(null===(i=n)||void 0===i?void 0:i.status)?"stake"===e&&s.Z.show({content:C("profileSurvey.stakeSuccessful","Stake Successful"),maskClassName:"customToast",afterClose:()=>{x("/data/ognodeactivation?menu=1",{replace:!0})}}):s.Z.show({content:C("profileSurvey.stakeFailed","Stake Failed"),maskClassName:"customToast",afterClose:()=>{x("/data/ognodeactivation?menu=0",{replace:!0})}})}catch(l){s.Z.show({content:C("profileSurvey.stakeError","Stake Error"),maskClassName:"customToast",afterClose:()=>{x("/data/ognodeactivation?menu=0",{replace:!0})}})}}("stake","prompt",null===(t=A.state)||void 0===t?void 0:t.command);else null===(n=Z.current)||void 0===n||n.update(),e&&F(!0),ie(i);s.Z.clear()}}catch(a){s.Z.show({maskClassName:"customToast",content:C("common.networkError","Network Error"),icon:"fail",duration:2e3})}};return(0,l.useEffect)((()=>{console.log(P),P.length-I.completed===oe.length&&Ce()}),[P.length,oe.length]),(0,l.useEffect)((()=>{var e;(async()=>{s.Z.show({maskClassName:"customNewLoading",maskClickable:!1,duration:0});try{const t=await h.Z.post["/book/profileSurveys/question"]({data:{typeId:null!==be&&void 0!==be?be:"",brand:ge,source:null!==Ne&&void 0!==Ne?Ne:""}}),n=null===t||void 0===t?void 0:t.data;if(t.err)s.Z.show({maskClassName:"customToast",content:C("common.networkError","Network Error"),icon:"fail",duration:2e3,afterClose:()=>{x(-1)}});else{var e,o;const t=new Array(null===n||void 0===n?void 0:n.completed).fill({});if(null===n||void 0===n||!n.questions||(null===n||void 0===n||null===(e=n.questions)||void 0===e?void 0:e.length)<=0)return void s.Z.show({maskClassName:"customToast",content:C("profileSurvey.noMoreQuestions","There are no more Profile Survey questions to answer at the moment. Please wait for updates."),icon:"fail",duration:4e3,afterClose:()=>{x("/ptc",{replace:!0})}});R(n),Q([...t,...null!==(o=null===n||void 0===n?void 0:n.questions)&&void 0!==o?o:[]]),z(null===n||void 0===n?void 0:n.completed),s.Z.clear()}}catch(t){s.Z.show({maskClassName:"customToast",content:C("common.networkError","Network Error"),icon:"fail",duration:2e3,afterClose:()=>{x(-1)}})}})(),de.current[0]=Date.now(),console.log(null===(e=A.state)||void 0===e?void 0:e.command)}),[]),(0,l.useEffect)((()=>
1{if(!S.current)return;const e=()=>{const e=(()=>{var e,o,t;const n=null===(e=S.current)||void 0===e?void 0:e.querySelectorAll(".adm-swiper-slide");if(!n)return null;const a=null!==(o=null===I||void 0===I?void 0:I.completed)&&void 0!==o?o:0;return null===(t=n[X-a])||void 0===t?void 0:t.querySelector('[class*="questionCard"]')})();e&&e.offsetHeight>0&&q(e.offsetHeight)},o=new ResizeObserver(e);return S.current.querySelectorAll('[class*="questionCard"]').forEach((e=>o.observe(e))),e(),()=>o.disconnect()}),[X,I]),(0,f.jsxs)("div",{className:d.page,children:[(0,f.jsx)(m.h,{variant:"light",isBack:!0,title:(0,f.jsxs)("span",{children:["surveys"===Ne||"stake"===Ne&&C("profileSurvey.title","PROFILE SURVEYS"),"label"===Ne&&C("hitlValidation.title","HITL VALIDATION"),"brand"===Ne&&C("profileSurvey.brandedTitle","BRANDED SURVEYS")]}),beforeNavBack:async()=>(H(!0),!0)}),(0,f.jsxs)("div",{className:d.content,children:[(0,f.jsxs)("div",{className:d.topBar,children:[(0,f.jsx)("div",{className:d.rulesBtn,onClick:()=>{"surveys"===Ne||"stake"===Ne?x("/game/ProfileSurveyAbout"):"label"===Ne&&x("/game/HITLValidationAbout")},children:(0,f.jsx)("img",{src:N,alt:"rules",className:d.rulesIcon})}),(0,f.jsx)(p.Z,{ref:Z})]}),(0,f.jsx)("div",{ref:S,className:d.swiperWrap,style:E>0?{height:E}:void 0,children:(0,f.jsx)(a.Z,{indicator:()=>null,ref:y,onIndexChange:()=>{},allowTouchMove:!1,children:null===I||void 0===I||null===(t=I.questions)||void 0===t?void 0:t.map(((e,o)=>{var t;return(0,f.jsx)(a.Z.Item,{children:(0,f.jsxs)("div",{className:d.questionCard,children:[(0,f.jsx)("div",{className:d.bannerWrap,children:null!==e&&void 0!==e&&e.imageUrl?(0,f.jsx)("img",{className:d.bannerImg,src:e.imageUrl,alt:"banner"}):(0,f.jsx)("div",{className:d.bannerPlaceholder})}),(0,f.jsx)("div",{className:d.logoWrap,children:null!==e&&void 0!==e&&e.brandUrl?(0,f.jsx)("img",{className:d.logoImg,src:e.brandUrl,alt:"logo"}):(0,f.jsx)("div",{className:d.logoPlaceholder})}),(0,f.jsx)("div",{className:d.questionBody,children:(0,f.jsxs)("div",{className:d.questionFirst,children:[(null===e||void 0===e?void 0:e.baseQuestion)&&(0,f.jsxs)("div",{className:d.subQuestionContext,children:[(0,f.jsxs)("span",{className:d.subContextLabel,children:[C("profileSurvey.inQuestionLabel","In question"),': "']}),(0,f.jsx)("span",{className:d.subContextValue,children:e.baseQuestion}),(0,f.jsx)("span",{className:d.subContextLabel,children:'"'})]}),(0,f.jsx)("div",{className:"".concat(d.questionText," ").concat(null!==e&&void 0!==e&&e.baseQuestion?d.subQuestion:""),children:null===e||void 0===e?void 0:e.question}),(null===e||void 0===e?void 0:e.category)&&(0,f.jsxs)("div",{className:d.categoryTag,children:["#",e.category]}),(0,f.jsx)("div",{className:d.btns,children:null===e||void 0===e||null===(t=e.answers)||void 0===t?void 0:t.map(((e,o)=>(0,f.jsxs)("div",{className:"".concat(d.btn," ").concat(ce===o?d.active:""),onClick:()=>{var e;e=o,ve.current||(ve.current=!0,ue(e),me.current=setTimeout((()=>{if(X<P.length&&oe.length<P.length){const o=de.current[X]||Date.now(),t=Date.now()-o;de.current[X+1]=Date.now(),te((o=>{var n;return[...o,{questionId:null===(n=P[X])||void 0===n?void 0:n.id,answer:e,duration:t}]}))}var o;ue(null),X<P.length-1?(z((e=>e+1)),null===(o=y.current)||void 0===o||o.swipeNext(),setTimeout((()=>{ve.current=!1}),500)):ve.current=!1,clearTimeout(me.current)}),1e3))},children:[(0,f.jsxs)("span",{className:d.btnLabel,children:[String.fromCharCode(65+o),".\xa0"]}),e]},o)))})]})})]})},o)}))})}),(0,f.jsx)("div",{className:d.progressText,children:(null!==(g=I.total)&&void 0!==g?g:0)>0?C("nodeActivation.questionProgress",{current:X+1,total:I.total}):""})]}),(0,f.jsx)(n.Z,{mask:!0,className:"".concat(v.Z.commonConfirmWrap," ").concat(v.Z.dark),maskClassName:"transparentMask",visible:L,children:(0,f.jsxs)("div",{className:v.Z.box,children:[(0,f.jsxs)("div",{className:v.Z.content,children:[(0,f.jsx)("div",{className:v.Z.tit,children:C("profileSurvey.thankYouTitle","Thank you!")}),(0,f.jsx)("p",{children:null===se||void 0===se?void 0:se.message})]}),(0,f.jsx)("div",{className:"".concat(v.Z.btns," ").concat(v.Z.center),children:(0,f.jsx)("div",{className:"".concat(v.Z.mainBtn),onClick:()=>{x("/ptc",{replace:!0,state:null!==se&&void 0!==se&&se.freeSpinJustGranted?{freeSpinJustGranted:!0,freeSpinMilestone:Boolean(se.freeSpinMilestone)}:void 0}),F(!1)},children:C("common.ok","OK")})})]})}),(0,f.jsx)(n.Z,{mask:!0,className:"".concat(v.Z.commonConfirmWrap," ").concat(v.Z.dark),maskClassName:"transparentMask",visible:Y,children:(0,f.jsxs)("div",{className:v.Z.box,children:[(0,f.jsxs)("div",{className:v.Z.content,children:[(0,f.jsx)("div",{className:v.Z.tit,children:C("profileSurvey.leaveConfirmTitle","Wait!")}),(0,f.jsx)("p",{children:C("profileSurvey.leaveConfirmBody","You have not completed all questions, are you sure you want to leave?")})]}),(0,f.jsxs)("div",{className:"".concat(v.Z.btns),children:[(0,f.jsx)("div",{className:"".concat(v.Z.subBtn),onClick:async()=>{oe.length>0&&await Ce(!1),x(-1),H(!1)},children:C("common.confirm","Confirm")}),(0,f.jsx)("div",{className:"".concat(v.Z.mainBtn),onClick:()=>{H(!1)},children:C("common.cancel","Cancel")})]})]})})]})},C=(0,l.memo)(g)},13487:e=>{e.exports="data:image/png;
1base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAMAAAC7IEhfAAAAM1BMVEUAAABwcHBoaGhnZ2doaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhpaWloaGhoaGhpaWloaGjBXq2kAAAAEHRSTlMAEGDv3yC/cK9AgJDPnzBQ7Anm4QAAATpJREFUOMu9VO1ywyAMi8F8JU2i93/aQZtNOLDbdrvNP3r1WUiyCV7+IeQopchXIJc9nuGzk89ha0Ux/B7muORbNW6uxhYbVNOMrpViErpQAHnQD1rZbgQNqjd5UeARhtOPirScmSrm/A5E00flk+kgKmcyBo2XUljy8KSoAq7DncBKsS4RD+31YjXSZaR0lnBZXySkTGxZ7ADP9ku9fP31HAHDaF9HgM3OeT37dAPCaxjWotSCGiPAMQEG9ToAywx4SkScAo8XkME2CZw2A6y3ZmQcDxXG8SyZl3R5LsyaYKaJZD0FmzpeUrRXvaTjI9Wmx1IywLz3hDUhpQ99aZPhm549hUPsU/jm48o/fq5cAOrGHaNhUMloUK6U9Nwx5GMkRY33JeUx7BjK73btrfKrRUpwKYWT/MN4A8E/EOxqA6j1AAAAAElFTkSuQmCC"}}]);
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.