1{"version":3,"sources":["../../../src/app/content/account-page/AccountPage.tsx"],"names":["React","ActionGroup","Button","Form","FormGroup","TextInput","Grid","GridItem","Expandable","AccountServiceContext","Msg","ContentPage","ContentAlert","LocaleSelector","KeycloakContext","AIACommand","AccountPage","Component","constructor","props","context","features","isRegistrationEmailAsUsername","isEditUserNameAllowed","deleteAccountAllowed","errors","username","firstName","lastName","email","formFields","attributes","DEFAULT_STATE","fetchPersonalInfo","value","event","target","currentTarget","name","setState","state","validationMessage","preventDefault","form","isValid","checkValidity","reqData","doPost","then","success","locale","window","location","reload","formData","FormData","validationMessages","Array","from","keys","reduce","acc","key","elements","keycloak","execute","handleChange","doGet","response","data","render","fields","handleSubmit","localize","isInternationalizationEnabled","Object","values","filter","e","length","handleCancel","isDeleteAccountAllowed","marginTop","handleDelete"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,KAAKA,KAAZ;AACA,SAASC,WAAT,EAAsBC,MAAtB,EAA8BC,IAA9B,EAAoCC,SAApC,EAA+CC,SAA/C,EAA0DC,IAA1D,EAAgEC,QAAhE,EAA0EC,UAA1E;AAGA,SAASC,qBAAT;AAEA,SAASC,GAAT;AACA,SAASC,WAAT;AACA,SAASC,YAAT;AACA,SAASC,cAAT;AACA,SAASC,eAAT;AAEA,SAASC,UAAT;;AAqBA;AACA;AACA;AACA,OAAO,MAAMC,WAAN,SAA0BhB,KAAK,CAACiB,SAAhC,CAA8E;AAwB1EC,EAAAA,WAAW,CAACC,KAAD,EAA0BC,OAA1B,EAAoF;AAClG,UAAMD,KAAN;;AADkG;;AAAA,2DArBrDE,QAAQ,CAACC,6BAqB4C;;AAAA,mDApB7DD,QAAQ,CAACE,qBAoBoD;;AAAA,oDAnB5DF,QAAQ,CAACG,oBAmBmD;;AAAA,2CAlBnD;AAC/CC,MAAAA,MAAM,EAAE;AACJC,QAAAA,QAAQ,EAAE,EADN;AAEJC,QAAAA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L,CADP,EAMO,oBAAC,QAAD;AAAU,MAAA,IAAI,EAAE;AAAhB,OACI,oBAAC,eAAD,CAAiB,QAAjB,QACOlB,QAAD,IACM,oBAAC,MAAD;AAAQ,MAAA,EAAE,EAAC,oBAAX;AAAgC,MAAA,OAAO,EAAC,QAAxC;AAAiD,MAAA,OAAO,EAAE,MAAM,KAAKmB,YAAL,CAAkBnB,QAAlB,CAAhE;AAA6F,MAAA,SAAS,EAAC;AAAvG,OAAuH,oBAAC,GAAD;AAAK,MAAA,MAAM,EAAC;AAAZ,MAAvH,CAFZ,CADJ,CANP,EAaO,oBAAC,QAAD;AAAU,MAAA,IAAI,EAAE;AAAhB,MAbP,CADJ,CADD,CAzGA,CADJ;AAiIH;;AA/NgF;;gBAAxEhD,W,iBACYP,qB;;AAwPxB","sourcesContent":["/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport * as React from 'react';\nimport { ActionGroup, Button, Form, FormGroup, TextInput, Grid, GridItem, Expandable} from '@patternfly/react-core';\n\nimport { HttpResponse } from '../../account-service/account.service';\nimport { AccountServiceContext } from '../../account-service/AccountServiceContext';\nimport { Features } from '../../widgets/features';\nimport { Msg } from '../../widgets/Msg';\nimport { ContentPage } from '../ContentPage';\nimport { ContentAlert } from '../ContentAlert';\nimport { LocaleSelector } from '../../widgets/LocaleSelectors';\nimport { KeycloakContext } from '../../keycloak-service/KeycloakContext';\nimport { KeycloakService } from '../../keycloak-service/keycloak.service';\nimport { AIACommand } from '../../util/AIACommand';\n\ndeclare const features: Features;\ndeclare const locale: string;\n\ninterface AccountPageProps {\n}\n\ninterface FormFields {\n readonly username?: string;\n readonly firstName?: string;\n readonly lastName?: string;\n readonly email?: string;\n attributes?: { locale?: [string] };\n}\n\ninterface AccountPageState {\n readonly errors: FormFields;\n readonly formFields: FormFields;\n}\n\n/**\n * @author Stan Silvert ssilvert@redhat.com (C) 2018 Red Hat Inc.\n */\nexport class AccountPage extends React.Component<AccountPageProps, AccountPageState> {\n static contextType = AccountServiceContext;\n context: React.ContextType<typeof AccountServiceContext>;\n private isRegistrationEmailAsUsername: boolean = features.isRegistrationEmailAsUsername;\n private isEditUserNameAllowed: boolean = features.isEditUserNameAllowed;\n private isDeleteAccountAllowed: boolean = features.deleteAccountAllowed;\n private readonly DEFAULT_STATE: AccountPageState = {\n errors: {\n username: '',\n firstName: '',\n lastName: '',\n email: ''\n },\n formFields: {\n username: '',\n firstName: '',\n lastName: '',\n email: '',\n attributes: {}\n }\n };\n\n public state: AccountPageState = this.DEFAULT_STATE;\n\n public constructor(props: AccountPageProps, context: React.ContextType<typeof AccountServiceContext>) {\n super(props);\n this.context = context;\n\n this.fetchPersonalInfo();\n }\n\n private fetchPersonalInfo(): void {\n this.context!.doGet<FormFields>(\"/\")\n .then((response: HttpResponse<FormFields>) => {\n this.setState(this.DEFAULT_STATE);\n const formFields = response.data;\n if (!formFields!.attributes) {\n formFields!.attributes = { locale: [locale] };\n }\n else if (!formFields!.attributes.locale) {\n formFields!.attributes.locale = [locale];\n }\n\n this.setState({...{ formFields: formFields as FormFields }});\n });\n }\n\n private handleCancel = (): void => {\n this.fetchPersonalInfo();\n }\n\n private handleChange = (value: string, event: React.FormEvent<HTMLInputElement>) => {\n const target = event.currentTarget;\n const name = target.name;\n\n this.setState({\n errors: { ...this.state.errors, [name]: target.validationMessage },\n formFields: { ...this.state.formFields, [name]: value }\n });\n }\n\n private handleSubmit = (event: React.FormEvent<HTMLFormElement>): void => {\n event.preventDefault();\n const form = event.target as HTMLFormElement;\n const isValid = form.checkValidity();\n if (isValid) {\n const reqData: FormFields = { ...this.state.formFields };\n this.context!.doPost<void>(\"/\", reqData)\n .then(() => {\n ContentAlert.success('accountUpdatedMessage');\n if (locale !== this.state.formFields.attributes!.locale![0]) {\n window.location.reload();\n }\n });\n } else {\n const formData = new FormData(form);\n const validationMessages = Array.from(formData.keys()).reduce((acc, key) => {\n acc[key] = form.elements[key].validationMessage\n return acc\n }, {});\n this.setState({\n errors: { ...validationMessages },\n formFields: this.state.formFields\n });\n }\n\n }\n\n private handleDelete = (keycloak: KeycloakService): void => {\n new AIACommand(keycloak, \"delete_account\").execute();\n }\n\n public render(): React.ReactNode {\n const fields: FormFields = this.state.formFields;\n return (\n <ContentPage title=\"personalInfoHtmlTitle\"\n introMessage=\"personalSubMessage\">\n <Form isHorizontal onSubmit={event => this.handleSubmit(event)}>\n {!this.isRegistrationEmailAsUsername &&\n <FormGroup\n label={Msg.localize('username')}\n isRequired\n fieldId=\"user-name\"\n helperTextInvalid={this.state.errors.username}\n isValid={this.state.errors.username === ''}\n >\n {this.isEditUserNameAllowed && <this.UsernameInput />}\n {!this.isEditUserNameAllowed && <this.RestrictedUsernameInput />}\n </FormGroup>\n }\n <FormGroup\n label={Msg.localize('email')}\n isRequired\n fieldId=\"email-address\"\n helperTextInvalid={this.state.errors.email}\n isValid={this.state.errors.email === ''}\n >\n <TextInput\n isRequired\n type=\"email\"\n id=\"email-address\"\n name=\"email\"\n maxLength={254}\n value={fields.email}\n onChange={this.handleChange}\n isValid={this.state.errors.email === ''}\n >\n </TextInput>\n </FormGroup>\n <FormGroup\n label={Msg.localize('firstName')}\n isRequired\n fieldId=\"first-name\"\n helperTextInvalid={this.state.errors.firstName}\n isValid={this.state.errors.firstName === ''}\n >\n <TextInput\n isRequired\n type=\"text\"\n id=\"first-name\"\n name=\"firstName\"\n maxLength={254}\n value={fields.firstName}\n onChange={this.handleChange}\n isValid={this.state.errors.firstName === ''}\n >\n </TextInput>\n </FormGroup>\n <FormGroup\n label={Msg.localize('lastName')}\n isRequired\n fieldId=\"last-name\"\n helperTextInvalid={this.state.errors.lastName}\n isValid={this.state.errors.lastName === ''}\n >\n <TextInput\n isRequired\n type=\"text\"\n id=\"last-name\"\n name=\"lastName\"\n maxLength={254}\n value={fields.lastName}\n onChange={this.handleChange}\n isValid={this.state.errors.lastName === ''}\n >\n </TextInput>\n </FormGroup>\n {features.isInternationalizationEnabled && <FormGroup\n label={Msg.localize('selectLocale')}\n isRequired\n fieldId=\"locale\"\n >\n <LocaleSelector id=\"locale-selector\"\n value={fields.attributes!.locale || ''}\n onChange={value => this.setState({\n errors: this.state.errors,\n formFields: { ...this.state.formFields, attributes: { ...this.state.formFields.attributes, locale: [value] }}\n })}\n />\n </FormGroup>}\n <ActionGroup>\n <Button\n type=\"submit\"\n id=\"save-btn\"\n variant=\"primary\"\n isDisabled={Object.values(this.state.errors).filter(e => e !== '').length !== 0}\n >\n <Msg msgKey=\"doSave\" />\n </Button>\n <Button\n id=\"cancel-btn\"\n variant=\"secondary\"\n onClick={this.handleCancel}\n >\n <Msg msgKey=\"doCancel\" />\n </Button>\n </ActionGroup>\n </Form>\n\n { this.isDeleteAccountAllowed && \n <div id=\"delete-account\" style={{marginTop:\"30px\"}}>\n <Expandable toggleText=\"Delete Account\">\n <Grid gutter={\"sm\"}>\n <GridItem span={6}>\n <p>\n <Msg msgKey=\"deleteAccountWarning\" />\n </p>\n </GridItem>\n <GridItem span={4}>\n <KeycloakContext.Consumer>\n { (keycloak: KeycloakService) => (\n <Button id=\"delete-account-btn\" variant=\"danger\" onClick={() => this.handleDelete(keycloak)} className=\"delete-button\"><Msg msgKey=\"doDelete\" /></Button>\n )}\n </KeycloakContext.Consumer>\n </GridItem>\n <GridItem span={2}>\n </GridItem>\n </Grid>\n \n </Expandable> \n </div>}\n </ContentPage>\n );\n }\n\n private UsernameInput = () => (\n <TextInput\n isRequired\n type=\"text\"\n id=\"user-name\"\n name=\"username\"\n maxLength={254}\n value={this.state.formFields.username}\n onChange={this.handleChange}\n isValid={this.state.errors.username === ''}\n >\n </TextInput>\n );\n\n private RestrictedUsernameInput = () => (\n <TextInput\n isDisabled\n type=\"text\"\n id=\"user-name\"\n name=\"username\"\n value={this.state.formFields.username}\n >\n </TextInput>\n );\n};"],"file":"AccountPage.js"}