"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[7429],{7258:(U,s,n)=>{n.r(s),n.d(s,{SignupInvitedPage:()=>r,default:()=>M});var e=n(65237),c=n(15804),o=n(55041),u=n(46181),l=n(5263),i=n(96682),_=n(48389),E=n(38992),g=n(18819),P=n(63969),v=n(71175);const p={main:{icon:"grafana",text:"Invite",subTitle:"Register your Grafana account",breadcrumbs:[{title:"Login",url:"login"}]},node:{text:""}},r=({match:D})=>{const m=D.params.code,[d,O]=(0,e.useState)(),[I,f]=(0,e.useState)(),[h,C]=(0,e.useState)();(0,c.Z)(async()=>{const a=await(0,o.i)().get(`/api/user/invite/${m}`);O({email:a.email,name:a.name,username:a.email}),f(a.name||a.email||a.username),C(a.invitedBy)},[m]);const T=async a=>{await(0,o.i)().post("/api/user/invite/complete",{...a,inviteCode:m}),window.location.href=(0,g.iE)().appSubUrl+"/"};return d?e.createElement(E.T,{navModel:p},e.createElement(E.T.Contents,null,e.createElement("h3",{className:"page-sub-heading"},"Hello ",I||"there","."),e.createElement("div",{className:"modal-tagline p-b-2"},e.createElement("em",null,h||"Someone")," has invited you to join Grafana and the organization"," ",e.createElement("span",{className:"highlight-word"},P.Vt.user.orgName),e.createElement("br",null),"Please complete the following and choose a password to accept your invitation and continue:"),e.createElement(u.l,{defaultValues:d,onSubmit:T},({register:a,errors:t})=>e.createElement(e.Fragment,null,e.createElement(l.g,{invalid:!!t.email,error:t.email&&t.email.message,label:"Email"},e.createElement(i.I,{placeholder:"email@example.com",...a("email",{required:"Email is required",pattern:{value:v.Yb,message:"Email is invalid"}})})),e.createElement(l.g,{invalid:!!t.name,error:t.name&&t.name.message,label:"Name"},e.createElement(i.I,{placeholder:"Name (optional)",...a("name")})),e.createElement(l.g,{invalid:!!t.username,error:t.username&&t.username.message,label:"Username"},e.createElement(i.I,{...a("username",{required:"Username is required"}),placeholder:"Username"})),e.createElement(l.g,{invalid:!!t.password,error:t.password&&t.password.message,label:"Password"},e.createElement(i.I,{...a("password",{required:"Password is required"}),type:"password",placeholder:"Password"})),e.createElement(_.zx,{type:"submit"},"Sign up"))))):null},M=r}}]);

//# sourceMappingURL=SignupInvited.b8d7d23544506372c57a.js.map