"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[8576],{9098(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})})}},56760(f,o,a){a.d(o,{p:()=>d,z:()=>g});var e=a(64702);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},21137(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(52358),v=a(29318),E=a(45270),l=a(49669),m=a(16244),M=a(49439),_=a(9098),p=a(5246),O=a(63075),u=a(56760);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.p,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.28a916b2a99f296439e9.js.map