1 |
- {"version":3,"sources":["../../../src/app/content/linked-accounts-page/LinkedAccountsPage.tsx"],"names":["React","withRouter","Badge","Button","DataList","DataListAction","DataListItemCells","DataListCell","DataListItemRow","Stack","StackItem","Title","TitleLevel","DataListItem","BitbucketIcon","CubeIcon","FacebookIcon","GithubIcon","GitlabIcon","GoogleIcon","InstagramIcon","LinkIcon","LinkedinIcon","MicrosoftIcon","OpenshiftIcon","PaypalIcon","StackOverflowIcon","TwitterIcon","UnlinkIcon","AccountServiceContext","Msg","ContentPage","createRedirect","LinkedAccountsPage","Component","constructor","props","context","state","linkedAccounts","unLinkedAccounts","getLinkedAccounts","doGet","then","response","console","log","data","filter","account","connected","setState","unLinkAccount","url","providerName","doDelete","linkAccount","redirectUri","location","pathname","params","providerId","window","href","accountLinkUri","render","localize","h2","makeRows","emptyRow","isLinked","isEmptyMessage","accounts","length","map","providerAlias","findIcon","displayName","badge","linkedUsername","social","backgroundColor","socialIconId","toLowerCase","includes","LinkedAccountsPagewithRouter"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,OAAO,KAAKA,KAAZ;AACA,SAAQC,UAAR;AAEA,SACIC,KADJ,EAEIC,MAFJ,EAGIC,QAHJ,EAIIC,cAJJ,EAKIC,iBALJ,EAMIC,YANJ,EAOIC,eAPJ,EAQIC,KARJ,EASIC,SATJ,EAUIC,KAVJ,EAWIC,UAXJ,EAYIC,YAZJ;AAeA,SACIC,aADJ,EAEIC,QAFJ,EAGIC,YAHJ,EAIIC,UAJJ,EAKIC,UALJ,EAMIC,UANJ,EAOIC,aAPJ,EAQIC,QARJ,EASIC,YATJ,EAUIC,aAVJ,EAWIC,aAXJ,EAYIC,UAZJ,EAaIC,iBAbJ,EAcIC,WAdJ,EAeIC,UAfJ;AAmBA,SAAQC,qBAAR;AACA,SAAQC,GAAR;AACA,SAAQC,WAAR;AACA,SAAQC,cAAR;;AAmBA;AACA;AACA;AACA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C,CAAJ,EAA8D,OAAQ,oBAAC,aAAD;AAAe,MAAA,EAAE,EAAEF,YAAnB;AAAiC,MAAA,IAAI,EAAC;AAAtC,MAAR;AAC9D,QAAIjC,OAAO,CAACK,YAAR,CAAqB6B,WAArB,GAAmCC,QAAnC,CAA4C,QAA5C,CAAJ,EAA2D,OAAQ,oBAAC,UAAD;AAAY,MAAA,EAAE,EAAEF,YAAhB;AAA8B,MAAA,IAAI,EAAC;AAAnC,MAAR;AAC3D,QAAIjC,OAAO,CAACK,YAAR,CAAqB6B,WAArB,GAAmCC,QAAnC,CAA4C,QAA5C,CAAJ,EAA2D,OAAQ,oBAAC,UAAD;AAAY,MAAA,EAAE,EAAEF,YAAhB;AAA8B,MAAA,IAAI,EAAC;AAAnC,MAAR;AAC3D,QAAIjC,OAAO,CAACK,YAAR,CAAqB6B,WAArB,GAAmCC,QAAnC,CAA4C,eAA5C,CAAJ,EAAkE,OAAQ,oBAAC,iBAAD;AAAmB,MAAA,EAAE,EAAEF,YAAvB;AAAqC,MAAA,IAAI,EAAC;AAA1C,MAAR;AAElE,WAAQ,oBAAC,QAAD;AAAU,MAAA,EAAE,EAAG,GAAEjC,OAAO,CAAC0B,aAAc,mBAAvC;AAA2D,MAAA,IAAI,EAAC;AAAhE,MAAR;AACH;;AApJ8F;;gBAA7F1C,kB,iBACmBJ,qB;;AAqJxB;AAED,MAAMwD,4BAA4B,GAAGpF,UAAU,CAACgC,kBAAD,CAA/C;AACA,SAAQoD,4BAA4B,IAAIpD,kBAAxC","sourcesContent":["/*\n * Copyright 2019 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 */\n\nimport * as React from 'react';\nimport {withRouter, RouteComponentProps} from 'react-router-dom';\n\nimport {\n Badge,\n Button,\n DataList,\n DataListAction,\n DataListItemCells,\n DataListCell,\n DataListItemRow,\n Stack,\n StackItem,\n Title,\n TitleLevel,\n DataListItem,\n} from '@patternfly/react-core';\n\nimport {\n BitbucketIcon,\n CubeIcon,\n FacebookIcon,\n GithubIcon,\n GitlabIcon,\n GoogleIcon,\n InstagramIcon,\n LinkIcon,\n LinkedinIcon,\n MicrosoftIcon,\n OpenshiftIcon,\n PaypalIcon,\n StackOverflowIcon,\n TwitterIcon,\n UnlinkIcon\n} from '@patternfly/react-icons';\n\nimport {HttpResponse} from '../../account-service/account.service';\nimport {AccountServiceContext} from '../../account-service/AccountServiceContext';\nimport {Msg} from '../../widgets/Msg';\nimport {ContentPage} from '../ContentPage';\nimport {createRedirect} from '../../util/RedirectUri';\n\ninterface LinkedAccount {\n connected: boolean;\n social: boolean;\n providerAlias: string;\n providerName: string;\n displayName: string;\n linkedUsername: string;\n}\n\ninterface LinkedAccountsPageProps extends RouteComponentProps {\n}\n\ninterface LinkedAccountsPageState {\n linkedAccounts: LinkedAccount[];\n unLinkedAccounts: LinkedAccount[];\n}\n\n/**\n * @author Stan Silvert\n */\nclass LinkedAccountsPage extends React.Component<LinkedAccountsPageProps, LinkedAccountsPageState> {\n static contextType = AccountServiceContext;\n context: React.ContextType<typeof AccountServiceContext>;\n\n public constructor(props: LinkedAccountsPageProps, context: React.ContextType<typeof AccountServiceContext>) {\n super(props);\n this.context = context;\n\n this.state = {\n linkedAccounts: [],\n unLinkedAccounts: []\n }\n\n this.getLinkedAccounts();\n }\n\n private getLinkedAccounts(): void {\n this.context!.doGet<LinkedAccount[]>(\"/linked-accounts\")\n .then((response: HttpResponse<LinkedAccount[]>) => {\n console.log({response});\n const linkedAccounts = response.data!.filter((account) => account.connected);\n const unLinkedAccounts = response.data!.filter((account) => !account.connected);\n this.setState({linkedAccounts: linkedAccounts, unLinkedAccounts: unLinkedAccounts});\n });\n }\n\n private unLinkAccount(account: LinkedAccount): void {\n const url = '/linked-accounts/' + account.providerName;\n\n this.context!.doDelete<void>(url)\n .then((response: HttpResponse<void>) => {\n console.log({response});\n this.getLinkedAccounts();\n });\n }\n\n private linkAccount(account: LinkedAccount): void {\n const url = '/linked-accounts/' + account.providerName;\n\n const redirectUri: string = createRedirect(this.props.location.pathname);\n\n this.context!.doGet<{accountLinkUri: string}>(url, { params: {providerId: account.providerName, redirectUri}})\n .then((response: HttpResponse<{accountLinkUri: string}>) => {\n console.log({response});\n window.location.href = response.data!.accountLinkUri;\n });\n }\n\n public render(): React.ReactNode {\n\n return (\n <ContentPage title={Msg.localize('linkedAccountsTitle')} introMessage={Msg.localize('linkedAccountsIntroMessage')}>\n <Stack gutter='md'>\n <StackItem isFilled>\n <Title headingLevel={TitleLevel.h2} size='2xl'>\n <Msg msgKey='linkedLoginProviders'/>\n </Title>\n <DataList id=\"linked-idps\" aria-label='foo'>\n {this.makeRows(this.state.linkedAccounts, true)}\n </DataList>\n </StackItem>\n <StackItem isFilled/>\n <StackItem isFilled>\n <Title headingLevel={TitleLevel.h2} size='2xl'>\n <Msg msgKey='unlinkedLoginProviders'/>\n </Title>\n <DataList id=\"unlinked-idps\" aria-label='foo'>\n {this.makeRows(this.state.unLinkedAccounts, false)}\n </DataList>\n </StackItem>\n </Stack>\n </ContentPage>\n );\n }\n\n private emptyRow(isLinked: boolean): React.ReactNode {\n let isEmptyMessage = '';\n if (isLinked) {\n isEmptyMessage = Msg.localize('linkedEmpty');\n } else {\n isEmptyMessage = Msg.localize('unlinkedEmpty');\n }\n\n return (\n <DataListItem key='emptyItem' aria-labelledby=\"empty-item\">\n <DataListItemRow key='emptyRow'>\n <DataListItemCells dataListCells={[\n <DataListCell key='empty'><strong>{isEmptyMessage}</strong></DataListCell>\n ]}/>\n </DataListItemRow>\n </DataListItem>\n )\n }\n\n private makeRows(accounts: LinkedAccount[], isLinked: boolean): React.ReactNode {\n if (accounts.length === 0) {\n return this.emptyRow(isLinked);\n }\n\n return (\n <> {\n\n accounts.map( (account: LinkedAccount) => (\n <DataListItem id={`${account.providerAlias}-idp`} key={account.providerName} aria-labelledby=\"simple-item1\">\n <DataListItemRow key={account.providerName}>\n <DataListItemCells\n dataListCells={[\n <DataListCell key='idp'><Stack><StackItem isFilled>{this.findIcon(account)}</StackItem><StackItem id={`${account.providerAlias}-idp-name`} isFilled><h2><strong>{account.displayName}</strong></h2></StackItem></Stack></DataListCell>,\n <DataListCell key='badge'><Stack><StackItem isFilled/><StackItem id={`${account.providerAlias}-idp-badge`} isFilled>{this.badge(account)}</StackItem></Stack></DataListCell>,\n <DataListCell key='username'><Stack><StackItem isFilled/><StackItem id={`${account.providerAlias}-idp-username`} isFilled>{account.linkedUsername}</StackItem></Stack></DataListCell>,\n ]}/>\n <DataListAction aria-labelledby='foo' aria-label='foo action' id='setPasswordAction'>\n {isLinked && <Button id={`${account.providerAlias}-idp-unlink`} variant='link' onClick={() => this.unLinkAccount(account)}><UnlinkIcon size='sm'/> <Msg msgKey='unLink'/></Button>}\n {!isLinked && <Button id={`${account.providerAlias}-idp-link`} variant='link' onClick={() => this.linkAccount(account)}><LinkIcon size='sm'/> <Msg msgKey='link'/></Button>}\n </DataListAction>\n </DataListItemRow>\n </DataListItem>\n ))\n\n } </>\n\n )\n }\n\n private badge(account: LinkedAccount): React.ReactNode {\n if (account.social) {\n return (<Badge><Msg msgKey='socialLogin'/></Badge>);\n }\n\n return (<Badge style={{backgroundColor: \"green\"}} ><Msg msgKey='systemDefined'/></Badge>);\n }\n\n private findIcon(account: LinkedAccount): React.ReactNode {\n const socialIconId = `${account.providerAlias}-idp-icon-social`;\n if (account.providerName.toLowerCase().includes('github')) return (<GithubIcon id={socialIconId} size='xl'/>);\n if (account.providerName.toLowerCase().includes('linkedin')) return (<LinkedinIcon id={socialIconId} size='xl'/>);\n if (account.providerName.toLowerCase().includes('facebook')) return (<FacebookIcon id={socialIconId} size='xl'/>);\n if (account.providerName.toLowerCase().includes('google')) return (<GoogleIcon id={socialIconId} size='xl'/>);\n if (account.providerName.toLowerCase().includes('instagram')) return (<InstagramIcon id={socialIconId} size='xl'/>);\n if (account.providerName.toLowerCase().includes('microsoft')) return (<MicrosoftIcon id={socialIconId} size='xl'/>);\n if (account.providerName.toLowerCase().includes('bitbucket')) return (<BitbucketIcon id={socialIconId} size='xl'/>);\n if (account.providerName.toLowerCase().includes('twitter')) return (<TwitterIcon id={socialIconId} size='xl'/>);\n if (account.providerName.toLowerCase().includes('openshift')) return (<OpenshiftIcon id={socialIconId} size='xl'/>);\n if (account.providerName.toLowerCase().includes('gitlab')) return (<GitlabIcon id={socialIconId} size='xl'/>);\n if (account.providerName.toLowerCase().includes('paypal')) return (<PaypalIcon id={socialIconId} size='xl'/>);\n if (account.providerName.toLowerCase().includes('stackoverflow')) return (<StackOverflowIcon id={socialIconId} size='xl'/>);\n\n return (<CubeIcon id={`${account.providerAlias}-idp-icon-default`} size='xl'/>);\n }\n\n};\n\nconst LinkedAccountsPagewithRouter = withRouter(LinkedAccountsPage);\nexport {LinkedAccountsPagewithRouter as LinkedAccountsPage};"],"file":"LinkedAccountsPage.js"}
|