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,MAAOH,EAAOjB,OAASiB,EAAOjB,MAAMqB,QAASC,MAAM,QAAnF,UACE,SAAC,EAAAC,MAAD,eACEC,YAAY,qBACRR,EAAS,QAAS,CACpBS,SAAU,oBACVC,QAAS,CACPC,MAAO,YACPN,QAAS,2BAKjB,SAAC,EAAAH,MAAD,CAAOC,UAAWF,EAAOhB,KAAMmB,MAAOH,EAAOhB,MAAQgB,EAAOhB,KAAKoB,QAASC,MAAM,OAAhF,UACE,SAAC,EAAAC,MAAD,eAAOC,YAAY,mBAAsBR,EAAS,aAEpD,SAAC,EAAAE,MAAD,CAAOC,UAAWF,EAAOf,SAAUkB,MAAOH,EAAOf,UAAYe,EAAOf,SAASmB,QAASC,MAAM,WAA5F,UACE,SAAC,EAAAC,MAAD,iBAAWP,EAAS,WAAY,CAAES,SAAU,yBAA5C,CAAuED,YAAY,iBAErF,SAAC,EAAAN,MAAD,CAAOC,UAAWF,EAAOW,SAAUR,MAAOH,EAAOW,UAAYX,EAAOW,SAASP,QAASC,MAAM,WAA5F,UACE,SAAC,EAAAC,MAAD,iBACMP,EAAS,WAAY,CAAES,SAAU,yBADvC,CAEEI,KAAK,WACLL,YAAY,gBAvBlB,OA2BE,SAAC,EAAAM,OAAD,CAAQD,KAAK,SAAb,iCA3CH,MAoDX","sources":["webpack://grafana/./public/app/features/invites/SignupInvited.tsx"],"sourcesContent":["import React, { FC, useState } from 'react';\nimport { useAsync } from 'react-use';\n\nimport { getBackendSrv } from '@grafana/runtime';\nimport { Button, Field, Form, Input } from '@grafana/ui';\nimport Page from 'app/core/components/Page/Page';\nimport { getConfig } from 'app/core/config';\nimport { contextSrv } from 'app/core/core';\nimport { GrafanaRouteComponentProps } from 'app/core/navigation/types';\n\ninterface FormModel {\n email: string;\n name?: string;\n username: string;\n password?: string;\n}\n\nconst navModel = {\n main: {\n icon: 'grafana',\n text: 'Invite',\n subTitle: 'Register your Grafana account',\n breadcrumbs: [{ title: 'Login', url: 'login' }],\n },\n node: {\n text: '',\n },\n};\n\nexport interface Props extends GrafanaRouteComponentProps<{ code: string }> {}\n\nexport const SignupInvitedPage: FC<Props> = ({ match }) => {\n const code = match.params.code;\n const [initFormModel, setInitFormModel] = useState<FormModel>();\n const [greeting, setGreeting] = useState<string>();\n const [invitedBy, setInvitedBy] = useState<string>();\n\n useAsync(async () => {\n const invite = await getBackendSrv().get(`/api/user/invite/${code}`);\n\n setInitFormModel({\n email: invite.email,\n name: invite.name,\n username: invite.email,\n });\n\n setGreeting(invite.name || invite.email || invite.username);\n setInvitedBy(invite.invitedBy);\n }, [code]);\n\n const onSubmit = async (formData: FormModel) => {\n await getBackendSrv().post('/api/user/invite/complete', { ...formData, inviteCode: code });\n window.location.href = getConfig().appSubUrl + '/';\n };\n\n if (!initFormModel) {\n return null;\n }\n\n return (\n <Page navModel={navModel}>\n <Page.Contents>\n <h3 className=\"page-sub-heading\">Hello {greeting || 'there'}.</h3>\n\n <div className=\"modal-tagline p-b-2\">\n <em>{invitedBy || 'Someone'}</em> has invited you to join Grafana and the organization{' '}\n <span className=\"highlight-word\">{contextSrv.user.orgName}</span>\n <br />\n Please complete the following and choose a password to accept your invitation and continue:\n </div>\n <Form defaultValues={initFormModel} onSubmit={onSubmit}>\n {({ register, errors }) => (\n <>\n <Field invalid={!!errors.email} error={errors.email && errors.email.message} label=\"Email\">\n <Input\n placeholder=\"email@example.com\"\n {...register('email', {\n required: 'Email is required',\n pattern: {\n value: /^\\S+@\\S+$/,\n message: 'Email is invalid',\n },\n })}\n />\n </Field>\n <Field invalid={!!errors.name} error={errors.name && errors.name.message} label=\"Name\">\n <Input placeholder=\"Name (optional)\" {...register('name')} />\n </Field>\n <Field invalid={!!errors.username} error={errors.username && errors.username.message} label=\"Username\">\n <Input {...register('username', { required: 'Username is required' })} placeholder=\"Username\" />\n </Field>\n <Field invalid={!!errors.password} error={errors.password && errors.password.message} label=\"Password\">\n <Input\n {...register('password', { required: 'Password is required' })}\n type=\"password\"\n placeholder=\"Password\"\n />\n </Field>\n\n <Button type=\"submit\">Sign up</Button>\n </>\n )}\n </Form>\n </Page.Contents>\n </Page>\n );\n};\n\nexport default SignupInvitedPage;\n"],"names":["navModel","main","icon","text","subTitle","breadcrumbs","title","url","node","SignupInvitedPage","match","code","params","initFormModel","setInitFormModel","useState","greeting","setGreeting","invitedBy","setInvitedBy","useAsync","async","invite","getBackendSrv","get","email","name","username","className","contextSrv","Form","defaultValues","onSubmit","post","formData","inviteCode","window","location","href","getConfig","appSubUrl","register","errors","Field","invalid","error","message","label","Input","placeholder","required","pattern","value","password","type","Button"],"sourceRoot":""}