"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[7429],{31058:(e,a,s)=>{s.r(a),s.d(a,{SignupInvitedPage:()=>g,default:()=>h});var i,n,r=s(76687),l=s(8650),t=s(10967),d=s(70534),o=s(36131),m=s(72e3),c=s(31271),u=s(52010);const p={main:{icon:"grafana",text:"Invite",subTitle:"Register your Grafana account",breadcrumbs:[{title:"Login",url:"login"}]},node:{text:""}},g=e=>{let{match:a}=e;const s=a.params.code,[g,h]=(0,r.useState)(),[j,x]=(0,r.useState)(),[b,v]=(0,r.useState)();(0,l.Z)((async()=>{const e=await(0,t.getBackendSrv)().get(`/api/user/invite/${s}`);h({email:e.email,name:e.name,username:e.email}),x(e.name||e.email||e.username),v(e.invitedBy)}),[s]);return g?(0,u.jsx)(o.Z,{navModel:p,children:(0,u.jsxs)(o.Z.Contents,{children:[(0,u.jsxs)("h3",{className:"page-sub-heading",children:["Hello ",j||"there","."]}),(0,u.jsxs)("div",{className:"modal-tagline p-b-2",children:[(0,u.jsx)("em",{children:b||"Someone"})," has invited you to join Grafana and the organization"," ",(0,u.jsx)("span",{className:"highlight-word",children:c.Vt.user.orgName}),i||(i=(0,u.jsx)("br",{})),"Please complete the following and choose a password to accept your invitation and continue:"]}),(0,u.jsx)(d.Form,{defaultValues:g,onSubmit:async e=>{await(0,t.getBackendSrv)().post("/api/user/invite/complete",Object.assign({},e,{inviteCode:s})),window.location.href=(0,m.iE)().appSubUrl+"/"},children:e=>{let{register:a,errors:s}=e;return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(d.Field,{invalid:!!s.email,error:s.email&&s.email.message,label:"Email",children:(0,u.jsx)(d.Input,Object.assign({placeholder:"email@example.com"},a("email",{required:"Email is required",pattern:{value:/^\S+@\S+$/,message:"Email is invalid"}})))}),(0,u.jsx)(d.Field,{invalid:!!s.name,error:s.name&&s.name.message,label:"Name",children:(0,u.jsx)(d.Input,Object.assign({placeholder:"Name (optional)"},a("name")))}),(0,u.jsx)(d.Field,{invalid:!!s.username,error:s.username&&s.username.message,label:"Username",children:(0,u.jsx)(d.Input,Object.assign({},a("username",{required:"Username is required"}),{placeholder:"Username"}))}),(0,u.jsx)(d.Field,{invalid:!!s.password,error:s.password&&s.password.message,label:"Password",children:(0,u.jsx)(d.Input,Object.assign({},a("password",{required:"Password is required"}),{type:"password",placeholder:"Password"}))}),n||(n=(0,u.jsx)(d.Button,{type:"submit",children:"Sign up"}))]})}})]})}):null},h=g}}]);
//# sourceMappingURL=SignupInvited.09ec2bd061ebad8a3a2f.js.map