"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[7429],{47637:(U,s,n)=>{n.r(s),n.d(s,{SignupInvitedPage:()=>r,default:()=>M});var e=n(27702),c=n(25111),o=n(73289),u=n(23839),l=n(22209),i=n(1128),_=n(66670),E=n(44644),g=n(12308),P=n(66574),v=n(41715);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.f9082a69b3aa273f9d7a.js.map