"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[8576],{47761(f,d,a){a.d(d,{l:()=>u});var e=a(74848),E=a(22803),l=a(96540),g=a(49785);function u({defaultValues:c,onSubmit:D,validateOnMount:P=!1,validateFieldsOnMount:t,children:i,validateOn:v="onSubmit",maxWidth:o=600,...M}){const{handleSubmit:O,trigger:m,formState:_,...h}=(0,g.mN)({mode:v,defaultValues:c});return(0,l.useEffect)(()=>{P&&m(t)},[m,t,P]),(0,e.jsx)("form",{className:(0,E.css)({maxWidth:o!=="none"?o+"px":o,width:"100%"}),onSubmit:O(D),...M,children:i({errors:_.errors,formState:_,trigger:m,...h})})}},97813(f,d,a){a.r(d),a.d(d,{SignupInvitedPage:()=>_,default:()=>I});var e=a(74848),E=a(22803),l=a(96540),g=a(54148),u=a(16817),c=a(28082),D=a(54594),P=a(29675),t=a(86489),i=a(34128),v=a(47761),o=a(54122),M=a(88023),O=a(4148);const m={main:{icon:"grafana",text:"Invite",subTitle:"Register your Grafana account",breadcrumbs:[{title:"Login",url:"login"}]},node:{text:""}},_=()=>{const{code:r}=(0,g.g)(),[p,x]=(0,l.useState)(),[j,A]=(0,l.useState)(),[B,C]=(0,l.useState)(),U=(0,P.of)(h);(0,u.A)(async()=>{const n=await(0,c.AI)().get(`/api/user/invite/${r}`);x({email:n.email,name:n.name,username:n.email,orgName:n.orgName}),A(n.name||n.email||n.username),C(n.invitedBy)},[r]);const L=async n=>{await(0,c.AI)().post("/api/user/invite/complete",{...n,inviteCode:r}),window.location.href=(0,M.zj)().appSubUrl+"/"};return p?(0,e.jsx)(o.Y,{navModel:m,children:(0,e.jsxs)(o.Y.Contents,{children:[(0,e.jsxs)("h3",{className:"page-sub-heading",children:["Hello ",j||"there","."]}),(0,e.jsxs)("div",{className:(0,E.cx)("modal-tagline",U.tagline),children:[(0,e.jsx)("em",{children:B||"Someone"})," has invited you to join Grafana and the organization"," ",(0,e.jsx)("span",{className:"highlight-word",children:p.orgName}),(0,e.jsx)("br",{}),"Please complete the following and choose a password to accept your invitation and continue:"]}),(0,e.jsx)(v.l,{defaultValues:p,onSubmit:L,children:({register:n,errors:s})=>(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(t.D,{invalid:!!s.email,error:s.email&&s.email.message,label:"Email",children:(0,e.jsx)(i.p,{placeholder:"email@example.com",...n("email",{required:"Email is required",pattern:{value:O.pL,message:"Email is invalid"}})})}),(0,e.jsx)(t.D,{invalid:!!s.name,error:s.name&&s.name.message,label:"Name",children:(0,e.jsx)(i.p,{placeholder:"Name (optional)",...n("name")})}),(0,e.jsx)(t.D,{invalid:!!s.username,error:s.username&&s.username.message,label:"Username",children:(0,e.jsx)(i.p,{...n("username",{required:"Username is required"}),placeholder:"Username"})}),(0,e.jsx)(t.D,{invalid:!!s.password,error:s.password&&s.password.message,label:"Password",children:(0,e.jsx)(i.p,{...n("password",{required:"Password is required"}),type:"password",placeholder:"Password"})}),(0,e.jsx)(D.$n,{type:"submit",children:"Sign up"})]})})]})}):null},h=r=>({tagline:(0,E.css)({paddingBottom:r.spacing(3)})}),I=_}}]);

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