"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[7429],{"./public/app/features/users/SignupInvited.tsx":(e,a,s)=>{s.r(a),s.d(a,{SignupInvitedPage:()=>g,default:()=>h});var n,r,i=s("../../opt/drone/yarncache/react-npm-17.0.2-99ba37d931-b254cc17ce.zip/node_modules/react/index.js"),t=s("./packages/grafana-runtime/src/index.ts"),l=s("./packages/grafana-ui/src/index.ts"),c=s("./.yarn/__virtual__/react-use-virtual-00326e70ba/3/opt/drone/yarncache/react-use-npm-17.3.2-a032cbeb01-7379460f51.zip/node_modules/react-use/esm/useAsync.js"),o=s("./public/app/core/components/Page/Page.tsx"),d=s("./public/app/core/core.ts"),u=s("./public/app/core/config.ts"),m=s("../../opt/drone/yarncache/react-npm-17.0.2-99ba37d931-b254cc17ce.zip/node_modules/react/jsx-runtime.js");const p={main:{icon:"grafana",text:"Invite",subTitle:"Register your Grafana account",breadcrumbs:[{title:"Login",url:"login"}]},node:{text:""}},g=e=>{let{match:a}=e;const s=a.params.code,[g,h]=(0,i.useState)(),[b,j]=(0,i.useState)(),[x,v]=(0,i.useState)();(0,c.Z)((async()=>{const e=await(0,t.getBackendSrv)().get(`/api/user/invite/${s}`);h({email:e.email,name:e.name,username:e.email}),j(e.name||e.email||e.username),v(e.invitedBy)}),[s]);return g?(0,m.jsx)(o.Z,{navModel:p,children:(0,m.jsxs)(o.Z.Contents,{children:[(0,m.jsxs)("h3",{className:"page-sub-heading",children:["Hello ",b||"there","."]}),(0,m.jsxs)("div",{className:"modal-tagline p-b-2",children:[(0,m.jsx)("em",{children:x||"Someone"})," has invited you to join Grafana and the organization"," ",(0,m.jsx)("span",{className:"highlight-word",children:d.Vt.user.orgName}),n||(n=(0,m.jsx)("br",{})),"Please complete the following and choose a password to accept your invitation and continue:"]}),(0,m.jsx)(l.Form,{defaultValues:g,onSubmit:async e=>{await(0,t.getBackendSrv)().post("/api/user/invite/complete",Object.assign({},e,{inviteCode:s})),window.location.href=(0,u.iE)().appSubUrl+"/"},children:e=>{let{register:a,errors:s}=e;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(l.Field,{invalid:!!s.email,error:s.email&&s.email.message,label:"Email",children:(0,m.jsx)(l.Input,Object.assign({placeholder:"email@example.com"},a("email",{required:"Email is required",pattern:{value:/^\S+@\S+$/,message:"Email is invalid"}})))}),(0,m.jsx)(l.Field,{invalid:!!s.name,error:s.name&&s.name.message,label:"Name",children:(0,m.jsx)(l.Input,Object.assign({placeholder:"Name (optional)"},a("name")))}),(0,m.jsx)(l.Field,{invalid:!!s.username,error:s.username&&s.username.message,label:"Username",children:(0,m.jsx)(l.Input,Object.assign({},a("username",{required:"Username is required"}),{placeholder:"Username"}))}),(0,m.jsx)(l.Field,{invalid:!!s.password,error:s.password&&s.password.message,label:"Password",children:(0,m.jsx)(l.Input,Object.assign({},a("password",{required:"Password is required"}),{type:"password",placeholder:"Password"}))}),r||(r=(0,m.jsx)(l.Button,{type:"submit",children:"Sign up"}))]})}})]})}):null},h=g}}]);
//# sourceMappingURL=SignupInvited.cd4ada1146b53ad3284f.js.map