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