(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7208],{75922:function(e,t,i){(window.__NEXT_P=window.__NEXT_P||[]).push(["/merchant-register/emailVerify",function(){return i(4684)}])},4684:function(e,t,i){"use strict";i.r(t);var n=i(85893),r=i(41664),a=i.n(r),o=i(67294),l=i(99226),s=i(15861),c=i(90948),d=i(98456),u=i(81805),m=i(87066),g=i(11163),x=i(86501),h=i(81406);(0,c.ZP)("img")(e=>{let{theme:t}=e;return{zIndex:2,maxHeight:650,marginTop:t.spacing(12),marginBottom:t.spacing(12),[t.breakpoints.down(1540)]:{maxHeight:550},[t.breakpoints.down("lg")]:{maxHeight:500}}}),(0,c.ZP)(l.Z)(e=>{let{theme:t}=e;return{width:"100%",[t.breakpoints.up("md")]:{maxWidth:450},[t.breakpoints.up("lg")]:{maxWidth:600},[t.breakpoints.up("xl")]:{maxWidth:750}}});let MerchantEmailVerified=()=>{let e=(0,g.useRouter)(),{token:t,email:i}=e.query,r=(0,c.ZP)(a())(e=>{let{theme:t}=e;return{textDecoration:"none",color:"".concat(t.palette.primary.main," !important"),"& img":{borderRadius:"10px"}}}),[u,f]=(0,o.useState)(5),[p,v]=(0,o.useState)(!1),[j,y]=(0,o.useState)(null),[Z,b]=(0,o.useState)(!1);console.log(t,i,"ssss"),(0,o.useEffect)(()=>{let fetchVerificationData=async()=>{if(console.log("dfdfd"),t&&i){b(!0);try{let e=await m.Z.get("".concat(h.Ao,"/api/organization/complete-org-verification"),{params:{token:t,emailId:i}});console.log(e,"ress"),y(e.data),b(!1)}catch(t){var e,n;console.log(t,"err1"),b(!1),v(!0),x.ZP.error((null===(n=t.response)||void 0===n?void 0:null===(e=n.data)||void 0===e?void 0:e.message)||"An error occurred",{duration:2e3})}}};fetchVerificationData()},[]),(0,o.useEffect)(()=>{let t;return!p&&(null==j?void 0:j.verified)&&u>0&&(t=setInterval(()=>{f(i=>i<=1?(clearInterval(t),e.push({pathname:"/merchant-register",query:{verified:j.verified,organizationKeyId:j.organizationKeyId,manufactureUrl:j.manufactureUrl,email:j.email,name:null==j?void 0:j.manufactureName}}),0):i-1)},1e3)),()=>clearInterval(t)},[p,j,u,e]);let k=(5-u)/5*100;return(0,n.jsx)(l.Z,{className:"content",sx:{background:"white",height:"100vh"},children:(0,n.jsx)(l.Z,{sx:{p:[6],display:"flex",alignItems:"center",justifyContent:"center"},children:(0,n.jsx)(l.Z,{className:"content",sx:{height:"80vh",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,n.jsxs)(l.Z,{sx:{width:"100%",maxWidth:600,textAlign:"center"},children:[(0,n.jsx)("img",{width:"180",alt:"logo",src:"/images/logos/logo-chataak.jpg"}),(0,n.jsxs)(l.Z,{sx:{boxShadow:5,bgcolor:e=>"dark"===e.palette.mode?"#101010":"#fff",color:e=>"dark"===e.palette.mode?"grey.300":"grey.800",p:10,borderRadius:2,textAlign:"center",fontSize:"0.875rem",fontWeight:"700",minHeight:"200px",minWidth:"600px",marginTop:"10px"},children:[!p&&(null==j?void 0:j.verified)&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(s.Z,{sx:{color:"text.secondary",fontSize:"1rem",lineHeight:1.5,marginTop:"10px"},children:"Your account is successfully verified."}),u>0?(0,n.jsxs)(l.Z,{sx:{position:"relative",display:"inline-flex",marginTop:"10px"},children:[(0,n.jsx)(d.Z,{value:k}),(0,n.jsx)(l.Z,{sx:{top:0,left:0,bottom:0,right:0,position:"absolute",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,n.jsx)(s.Z,{children:"".concat(u,"s")})})]}):null]}),!(null==j?void 0:j.verified)&&!p&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(s.Z,{sx:{color:"text.secondary",fontSize:"1rem",marginTop:"10px"},children:null==j?void 0:j.message}),(0,n.jsx)("br",{}),(null==j?void 0:j.message)&&(0,n.jsx)(s.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"center","& svg":{mr:1}},children:(0,n.jsx)(r,{href:"/login",children:(0,n.jsx)("span",{children:"Back to login"})})})]}),p&&(0,n.jsx)(s.Z,{sx:{color:"error.main",fontSize:"1rem",marginTop:"10px"},children:"An error occurred while verifying your account."})]})]})})})})};MerchantEmailVerified.getLayout=e=>(0,n.jsx)(u.Z,{children:e}),MerchantEmailVerified.guestGuard=!0,t.default=MerchantEmailVerified}},function(e){e.O(0,[9774,2888,179],function(){return e(e.s=75922)}),_N_E=e.O()}]);