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

//# sourceMappingURL=SignupInvited.61f50f9655960336e796.js.map