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

//# sourceMappingURL=SignupInvited.254de3967450eb17b96f.js.map