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

//# sourceMappingURL=SignupInvited-react19.3cc057b5a272bd719016.js.map