@techdocs/cli 1.12.0 → 1.12.1-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/commands/generate/generate.cjs.js.map +1 -1
  3. package/dist/commands/index.cjs.js.map +1 -1
  4. package/dist/commands/migrate/migrate.cjs.js.map +1 -1
  5. package/dist/commands/publish/publish.cjs.js.map +1 -1
  6. package/dist/commands/serve/mkdocs.cjs.js.map +1 -1
  7. package/dist/commands/serve/serve.cjs.js.map +1 -1
  8. package/dist/commands/serve/utils.cjs.js.map +1 -1
  9. package/dist/embedded-app/.config-schema.json +48 -47
  10. package/dist/embedded-app/index.html +1 -1
  11. package/dist/embedded-app/index.html.tmpl +1 -1
  12. package/dist/embedded-app/static/123.bc6a54ead4a3.chunk.js +2 -0
  13. package/dist/embedded-app/static/123.bc6a54ead4a3.chunk.js.map +1 -0
  14. package/dist/embedded-app/static/1659.9fe64c5d9180.chunk.js +2 -0
  15. package/dist/embedded-app/static/1659.9fe64c5d9180.chunk.js.map +1 -0
  16. package/dist/embedded-app/static/1749.99ba95728e00.chunk.js.map +1 -1
  17. package/dist/embedded-app/static/1767.511a3dc76c96.chunk.js +2 -0
  18. package/dist/embedded-app/static/1767.511a3dc76c96.chunk.js.map +1 -0
  19. package/dist/embedded-app/static/1994.7736057c2e9f.chunk.js.map +1 -1
  20. package/dist/embedded-app/static/{2063.c6396ce3e9c9.chunk.js → 2063.be81f1843585.chunk.js} +3 -3
  21. package/dist/embedded-app/static/2063.be81f1843585.chunk.js.map +1 -0
  22. package/dist/embedded-app/static/3031.f2ee3495211a.chunk.js +2 -0
  23. package/dist/embedded-app/static/{3031.cd0a0f1ddfd2.chunk.js.map → 3031.f2ee3495211a.chunk.js.map} +1 -1
  24. package/dist/embedded-app/static/3554.78dd0c182f6c.chunk.js.map +1 -1
  25. package/dist/embedded-app/static/4587.f762d58ffd52.chunk.js +2 -0
  26. package/dist/embedded-app/static/4587.f762d58ffd52.chunk.js.map +1 -0
  27. package/dist/embedded-app/static/{4609.b1c67dc7cac2.chunk.js → 4609.9d9e4473afcc.chunk.js} +6 -6
  28. package/dist/embedded-app/static/4609.9d9e4473afcc.chunk.js.map +1 -0
  29. package/dist/embedded-app/static/4648.cd5b8df48435.chunk.js.map +1 -1
  30. package/dist/embedded-app/static/4876.fa3ad2676113.chunk.js +2 -0
  31. package/dist/embedded-app/static/4876.fa3ad2676113.chunk.js.map +1 -0
  32. package/dist/embedded-app/static/5877.73f1d4863c15.chunk.js +2 -0
  33. package/dist/embedded-app/static/5877.73f1d4863c15.chunk.js.map +1 -0
  34. package/dist/embedded-app/static/6138.f15d6245c80d.chunk.js.map +1 -1
  35. package/dist/embedded-app/static/6206.3e7f13e11c59.chunk.js.map +1 -1
  36. package/dist/embedded-app/static/6949.beeb90ede97f.chunk.js.map +1 -1
  37. package/dist/embedded-app/static/7203.8b3d94b34b16.chunk.js.map +1 -1
  38. package/dist/embedded-app/static/9050.bd63e0a33f06.chunk.js.map +1 -1
  39. package/dist/embedded-app/static/9230.422824f655e0.chunk.js.map +1 -1
  40. package/dist/embedded-app/static/main.2b07c1548609.js +2 -0
  41. package/dist/embedded-app/static/main.2b07c1548609.js.map +1 -0
  42. package/dist/embedded-app/static/module-zod.da562d5b5226.js +56 -0
  43. package/dist/embedded-app/static/module-zod.da562d5b5226.js.map +1 -0
  44. package/dist/embedded-app/static/{runtime.720cb48cd7ae.js → runtime.f472dc4c479f.js} +2 -2
  45. package/dist/embedded-app/static/{runtime.720cb48cd7ae.js.map → runtime.f472dc4c479f.js.map} +1 -1
  46. package/dist/embedded-app/static/{vendor.470d3e8ecef1.js → vendor.d2c73d5e1e09.js} +2 -2
  47. package/dist/embedded-app/static/{vendor.470d3e8ecef1.js.map → vendor.d2c73d5e1e09.js.map} +1 -1
  48. package/dist/index.cjs.js.map +1 -1
  49. package/dist/lib/PublisherConfig.cjs.js.map +1 -1
  50. package/dist/lib/etag.cjs.js.map +1 -1
  51. package/dist/lib/httpServer.cjs.js.map +1 -1
  52. package/dist/lib/livereload.cjs.js.map +1 -1
  53. package/dist/lib/mkdocsServer.cjs.js.map +1 -1
  54. package/dist/lib/utility.cjs.js.map +1 -1
  55. package/dist/package.json.cjs.js +1 -1
  56. package/dist/package.json.cjs.js.map +1 -1
  57. package/package.json +7 -7
  58. package/dist/embedded-app/static/123.91ba1b809deb.chunk.js +0 -2
  59. package/dist/embedded-app/static/123.91ba1b809deb.chunk.js.map +0 -1
  60. package/dist/embedded-app/static/1659.a99e4eb674e0.chunk.js +0 -2
  61. package/dist/embedded-app/static/1659.a99e4eb674e0.chunk.js.map +0 -1
  62. package/dist/embedded-app/static/1767.5aca18e1057b.chunk.js +0 -2
  63. package/dist/embedded-app/static/1767.5aca18e1057b.chunk.js.map +0 -1
  64. package/dist/embedded-app/static/2063.c6396ce3e9c9.chunk.js.map +0 -1
  65. package/dist/embedded-app/static/3031.cd0a0f1ddfd2.chunk.js +0 -2
  66. package/dist/embedded-app/static/4587.d1220800a7d6.chunk.js +0 -2
  67. package/dist/embedded-app/static/4587.d1220800a7d6.chunk.js.map +0 -1
  68. package/dist/embedded-app/static/4609.b1c67dc7cac2.chunk.js.map +0 -1
  69. package/dist/embedded-app/static/4876.67117dbbe8d1.chunk.js +0 -2
  70. package/dist/embedded-app/static/4876.67117dbbe8d1.chunk.js.map +0 -1
  71. package/dist/embedded-app/static/5877.8ad98e3207c5.chunk.js +0 -2
  72. package/dist/embedded-app/static/5877.8ad98e3207c5.chunk.js.map +0 -1
  73. package/dist/embedded-app/static/main.9b48363c4ffa.js +0 -2
  74. package/dist/embedded-app/static/main.9b48363c4ffa.js.map +0 -1
  75. package/dist/embedded-app/static/module-zod.faf74f910029.js +0 -38
  76. package/dist/embedded-app/static/module-zod.faf74f910029.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"static/3031.cd0a0f1ddfd2.chunk.js","sources":["webpack://techdocs-cli-embedded-app/../core-components/src/components/LinkButton/LinkButton.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/components/SupportButton/SupportButton.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/layout/SignInPage/GuestUserIdentity.ts","webpack://techdocs-cli-embedded-app/../core-components/src/layout/SignInPage/LegacyUserIdentity.ts","webpack://techdocs-cli-embedded-app/../core-components/src/layout/SignInPage/UserIdentity.ts","webpack://techdocs-cli-embedded-app/../core-components/src/layout/SignInPage/styles.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/layout/SignInPage/commonProvider.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/layout/ProxiedSignInPage/types.ts","webpack://techdocs-cli-embedded-app/../core-components/src/layout/ProxiedSignInPage/ProxiedSignInIdentity.ts","webpack://techdocs-cli-embedded-app/../core-components/src/layout/SignInPage/guestProvider.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/layout/SignInPage/customProvider.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/layout/SignInPage/IdentityApiSignOutProxy.ts","webpack://techdocs-cli-embedded-app/../core-components/src/layout/SignInPage/providers.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/layout/SignInPage/SignInPage.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/layout/Breadcrumbs/Breadcrumbs.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/layout/Content/Content.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/layout/ContentHeader/ContentHeader.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/layout/Header/Header.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/layout/BottomLink/BottomLink.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/layout/ErrorBoundary/ErrorBoundary.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/layout/InfoCard/InfoCard.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/layout/Page/Page.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\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 MaterialButton, {\n ButtonProps as MaterialButtonProps,\n} from '@material-ui/core/Button';\nimport { forwardRef } from 'react';\nimport { UnstyledLink, LinkProps } from '../Link/Link';\n\n/**\n * Properties for {@link LinkButton}\n *\n * @public\n * @remarks\n *\n * See {@link https://v4.mui.com/api/button/#props | Material UI Button Props} for all properties\n */\nexport type LinkButtonProps = MaterialButtonProps &\n Omit<LinkProps, 'variant' | 'color'>;\n\n/**\n * This wrapper is here to reset the color of the Link and make typescript happy.\n */\nconst LinkWrapper = forwardRef<any, LinkProps>((props, ref) => (\n <UnstyledLink ref={ref} {...props} color=\"initial\" />\n));\n\n/**\n * Thin wrapper on top of material-ui's {@link https://v4.mui.com/components/buttons/ | Button} component\n *\n * @public\n * @remarks\n */\nexport const LinkButton = forwardRef<any, LinkButtonProps>((props, ref) => (\n <MaterialButton ref={ref} component={LinkWrapper} {...props} />\n)) as (props: LinkButtonProps) => JSX.Element;\n\n/**\n * @public\n * @deprecated use LinkButton instead\n */\nexport const Button = LinkButton;\n\n/**\n * @public\n * @deprecated use LinkButtonProps instead\n */\nexport type ButtonProps = LinkButtonProps;\n","/*\n * Copyright 2020 The Backstage Authors\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 { configApiRef, useApi, useApp } from '@backstage/core-plugin-api';\nimport Box from '@material-ui/core/Box';\nimport Button from '@material-ui/core/Button';\nimport DialogActions from '@material-ui/core/DialogActions';\nimport IconButton from '@material-ui/core/IconButton';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport MenuList from '@material-ui/core/MenuList';\nimport Popover from '@material-ui/core/Popover';\nimport { Theme, makeStyles } from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport useMediaQuery from '@material-ui/core/useMediaQuery';\nimport { ReactNode, Children, MouseEventHandler, useState } from 'react';\nimport { SupportItem, SupportItemLink, useSupportConfig } from '../../hooks';\nimport { HelpIcon } from '../../icons';\nimport { Link } from '../Link';\nimport { coreComponentsTranslationRef } from '../../translation';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\n\ntype SupportButtonProps = {\n title?: string;\n items?: SupportItem[];\n children?: ReactNode;\n};\n\nexport type SupportButtonClassKey = 'popoverList';\n\nconst useStyles = makeStyles(\n {\n popoverList: {\n minWidth: 260,\n maxWidth: 400,\n },\n menuItem: {\n whiteSpace: 'normal',\n },\n },\n { name: 'BackstageSupportButton' },\n);\n\nconst SupportIcon = ({ icon }: { icon: string | undefined }) => {\n const app = useApp();\n const Icon = icon ? app.getSystemIcon(icon) ?? HelpIcon : HelpIcon;\n return <Icon />;\n};\n\nconst SupportLink = ({ link }: { link: SupportItemLink }) => (\n <Link to={link.url}>{link.title ?? link.url}</Link>\n);\n\nconst SupportListItem = ({ item }: { item: SupportItem }) => {\n return (\n <MenuItem button={false}>\n <ListItemIcon>\n <SupportIcon icon={item.icon} />\n </ListItemIcon>\n <ListItemText\n primary={item.title}\n secondary={item.links?.reduce<React.ReactNode[]>(\n (prev, link, idx) => [\n ...prev,\n idx > 0 && <br key={idx} />,\n <SupportLink link={link} key={link.url} />,\n ],\n [],\n )}\n />\n </MenuItem>\n );\n};\n\nexport function SupportButton(props: SupportButtonProps) {\n const { t } = useTranslationRef(coreComponentsTranslationRef);\n const { title, items, children } = props;\n const { items: configItems } = useSupportConfig();\n\n const [popoverOpen, setPopoverOpen] = useState(false);\n const [anchorEl, setAnchorEl] = useState<Element | null>(null);\n const classes = useStyles();\n const supportConfig = useApi(configApiRef).getOptionalConfig('app.support');\n const isSmallScreen = useMediaQuery<Theme>(theme =>\n theme.breakpoints.down('sm'),\n );\n\n const onClickHandler: MouseEventHandler = event => {\n setAnchorEl(event.currentTarget);\n setPopoverOpen(true);\n };\n\n const popoverCloseHandler = () => {\n setPopoverOpen(false);\n };\n\n if (!supportConfig) {\n return null;\n }\n\n return (\n <>\n <Box display=\"flex\" ml={1}>\n {isSmallScreen ? (\n <IconButton\n color=\"primary\"\n size=\"small\"\n onClick={onClickHandler}\n data-testid=\"support-button\"\n aria-label=\"Support\"\n >\n <HelpIcon />\n </IconButton>\n ) : (\n <Button\n data-testid=\"support-button\"\n aria-label=\"Support\"\n color=\"primary\"\n onClick={onClickHandler}\n startIcon={<HelpIcon />}\n >\n {t('supportButton.title')}\n </Button>\n )}\n </Box>\n <Popover\n data-testid=\"support-button-popover\"\n open={popoverOpen}\n anchorEl={anchorEl}\n anchorOrigin={{\n vertical: 'bottom',\n horizontal: 'right',\n }}\n transformOrigin={{\n vertical: 'top',\n horizontal: 'right',\n }}\n onClose={popoverCloseHandler}\n >\n <MenuList\n className={classes.popoverList}\n autoFocusItem={Boolean(anchorEl)}\n >\n {title && (\n <MenuItem\n button={false}\n alignItems=\"flex-start\"\n className={classes.menuItem}\n >\n <Typography variant=\"subtitle1\">{title}</Typography>\n </MenuItem>\n )}\n {Children.map(children, (child, i) => (\n <MenuItem\n button={false}\n alignItems=\"flex-start\"\n key={`child-${i}`}\n className={classes.menuItem}\n >\n {child}\n </MenuItem>\n ))}\n {(items ?? configItems).map((item, i) => (\n <SupportListItem item={item} key={`item-${i}`} />\n ))}\n </MenuList>\n <DialogActions>\n <Button\n color=\"primary\"\n onClick={popoverCloseHandler}\n aria-label=\"Close\"\n >\n {t('supportButton.close')}\n </Button>\n </DialogActions>\n </Popover>\n </>\n );\n}\n","/*\n * Copyright 2021 The Backstage Authors\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 {\n IdentityApi,\n ProfileInfo,\n BackstageUserIdentity,\n} from '@backstage/core-plugin-api';\n\n/**\n * @deprecated Use `@backstage/plugin-auth-backend-module-guest-provider` instead.\n */\nexport class GuestUserIdentity implements IdentityApi {\n getUserId(): string {\n return 'guest';\n }\n\n async getIdToken(): Promise<string | undefined> {\n return undefined;\n }\n\n getProfile(): ProfileInfo {\n return {\n email: 'guest@example.com',\n displayName: 'Guest',\n };\n }\n\n async getProfileInfo(): Promise<ProfileInfo> {\n return {\n email: 'guest@example.com',\n displayName: 'Guest',\n };\n }\n\n async getBackstageIdentity(): Promise<BackstageUserIdentity> {\n const userEntityRef = `user:default/guest`;\n return {\n type: 'user',\n userEntityRef,\n ownershipEntityRefs: [userEntityRef],\n };\n }\n\n async getCredentials(): Promise<{ token?: string | undefined }> {\n return {};\n }\n\n async signOut(): Promise<void> {}\n}\n","/*\n * Copyright 2021 The Backstage Authors\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 {\n IdentityApi,\n ProfileInfo,\n BackstageUserIdentity,\n} from '@backstage/core-plugin-api';\n\nfunction parseJwtPayload(token: string) {\n const [_header, payload, _signature] = token.split('.');\n return JSON.parse(window.atob(payload));\n}\n\ntype LegacySignInResult = {\n userId: string;\n profile: ProfileInfo;\n getIdToken?: () => Promise<string>;\n signOut?: () => Promise<void>;\n};\n\n/** @internal */\nexport class LegacyUserIdentity implements IdentityApi {\n private constructor(private readonly result: LegacySignInResult) {}\n\n getUserId(): string {\n return this.result.userId;\n }\n\n static fromResult(result: LegacySignInResult): LegacyUserIdentity {\n return new LegacyUserIdentity(result);\n }\n\n async getIdToken(): Promise<string | undefined> {\n return this.result.getIdToken?.();\n }\n\n getProfile(): ProfileInfo {\n return this.result.profile;\n }\n\n async getProfileInfo(): Promise<ProfileInfo> {\n return this.result.profile;\n }\n\n async getBackstageIdentity(): Promise<BackstageUserIdentity> {\n const token = await this.getIdToken();\n\n if (!token) {\n const userEntityRef = `user:default/${this.getUserId()}`;\n return {\n type: 'user',\n userEntityRef,\n ownershipEntityRefs: [userEntityRef],\n };\n }\n\n const { sub, ent } = parseJwtPayload(token);\n return {\n type: 'user',\n userEntityRef: sub,\n ownershipEntityRefs: ent ?? [],\n };\n }\n\n async getCredentials(): Promise<{ token?: string | undefined }> {\n const token = await this.result.getIdToken?.();\n return { token };\n }\n\n async signOut(): Promise<void> {\n return this.result.signOut?.();\n }\n}\n","/*\n * Copyright 2021 The Backstage Authors\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 {\n IdentityApi,\n ProfileInfo,\n ProfileInfoApi,\n BackstageUserIdentity,\n BackstageIdentityApi,\n SessionApi,\n} from '@backstage/core-plugin-api';\n\nimport { GuestUserIdentity } from './GuestUserIdentity';\nimport { LegacyUserIdentity } from './LegacyUserIdentity';\n\n// TODO(Rugvip): This and the other IdentityApi implementations still implement\n// the old removed methods. This is to allow for backwards compatibility\n// with old plugins that still consume this API. We will leave these in\n// place as a hidden compatibility for a couple of months.\n// The AppIdentityProxy warns in case any of these methods are called.\n\n/**\n * An implementation of the IdentityApi that is constructed using\n * various backstage user identity representations.\n *\n * @public\n */\nexport class UserIdentity implements IdentityApi {\n private profilePromise?: Promise<ProfileInfo>;\n /**\n * Creates a new IdentityApi that acts as a Guest User.\n *\n * @public\n */\n static createGuest(): IdentityApi {\n return new GuestUserIdentity();\n }\n\n /**\n * Creates a new IdentityApi using a legacy SignInResult object.\n *\n * @public\n */\n static fromLegacy(result: {\n /**\n * User ID that will be returned by the IdentityApi\n */\n userId: string;\n\n profile: ProfileInfo;\n\n /**\n * Function used to retrieve an ID token for the signed in user.\n */\n getIdToken?: () => Promise<string>;\n\n /**\n * Sign out handler that will be called if the user requests to sign out.\n */\n signOut?: () => Promise<void>;\n }): IdentityApi {\n return LegacyUserIdentity.fromResult(result);\n }\n\n /**\n * Creates a new IdentityApi implementation using a user identity\n * and an auth API that will be used to request backstage tokens.\n *\n * @public\n */\n static create(options: {\n identity: BackstageUserIdentity;\n authApi: ProfileInfoApi & BackstageIdentityApi & SessionApi;\n /**\n * Passing a profile synchronously allows the deprecated `getProfile` method to be\n * called by consumers of the {@link @backstage/core-plugin-api#IdentityApi}. If you\n * do not have any consumers of that method then this is safe to leave out.\n *\n * @deprecated Only provide this if you have plugins that call the synchronous `getProfile` method, which is also deprecated.\n */\n profile?: ProfileInfo;\n }): IdentityApi {\n return new UserIdentity(options.identity, options.authApi, options.profile);\n }\n\n private readonly identity: BackstageUserIdentity;\n private readonly authApi: ProfileInfoApi & BackstageIdentityApi & SessionApi;\n private readonly profile?: ProfileInfo;\n\n private constructor(\n identity: BackstageUserIdentity,\n authApi: ProfileInfoApi & BackstageIdentityApi & SessionApi,\n profile?: ProfileInfo,\n ) {\n this.identity = identity;\n this.authApi = authApi;\n this.profile = profile;\n }\n\n /** {@inheritdoc @backstage/core-plugin-api#IdentityApi.getUserId} */\n getUserId(): string {\n const ref = this.identity.userEntityRef;\n const match = /^([^:/]+:)?([^:/]+\\/)?([^:/]+)$/.exec(ref);\n if (!match) {\n throw new TypeError(`Invalid user entity reference \"${ref}\"`);\n }\n\n return match[3];\n }\n\n /** {@inheritdoc @backstage/core-plugin-api#IdentityApi.getIdToken} */\n async getIdToken(): Promise<string | undefined> {\n const identity = await this.authApi.getBackstageIdentity();\n return identity!.token;\n }\n\n /** {@inheritdoc @backstage/core-plugin-api#IdentityApi.getProfile} */\n getProfile(): ProfileInfo {\n if (!this.profile) {\n throw new Error(\n 'The identity API does not implement synchronous profile fetching, use getProfileInfo() instead',\n );\n }\n return this.profile;\n }\n\n /** {@inheritdoc @backstage/core-plugin-api#IdentityApi.getProfileInfo} */\n async getProfileInfo(): Promise<ProfileInfo> {\n if (this.profilePromise) {\n return await this.profilePromise;\n }\n\n try {\n this.profilePromise = this.authApi.getProfile() as Promise<ProfileInfo>;\n return await this.profilePromise;\n } catch (ex) {\n this.profilePromise = undefined;\n throw ex;\n }\n }\n\n /** {@inheritdoc @backstage/core-plugin-api#IdentityApi.getBackstageIdentity} */\n async getBackstageIdentity(): Promise<BackstageUserIdentity> {\n return this.identity;\n }\n\n /** {@inheritdoc @backstage/core-plugin-api#IdentityApi.getCredentials} */\n async getCredentials(): Promise<{ token?: string | undefined }> {\n const identity = await this.authApi.getBackstageIdentity();\n return { token: identity!.token };\n }\n\n /** {@inheritdoc @backstage/core-plugin-api#IdentityApi.signOut} */\n async signOut(): Promise<void> {\n return this.authApi.signOut();\n }\n}\n","/*\n * Copyright 2020 The Backstage Authors\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 { makeStyles } from '@material-ui/core/styles';\nimport Grid from '@material-ui/core/Grid';\n\nexport type SignInPageClassKey = 'container' | 'item';\n\nexport const useStyles = makeStyles(\n {\n container: {\n padding: 0,\n listStyle: 'none',\n },\n item: {\n display: 'flex',\n flexDirection: 'column',\n width: '100%',\n maxWidth: '400px',\n margin: 0,\n padding: 0,\n },\n },\n { name: 'BackstageSignInPage' },\n);\n\nexport const GridItem = ({ children }: { children: JSX.Element }) => {\n const classes = useStyles();\n\n return (\n <Grid component=\"li\" item classes={classes}>\n {children}\n </Grid>\n );\n};\n","/*\n * Copyright 2020 The Backstage Authors\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 Typography from '@material-ui/core/Typography';\nimport Button from '@material-ui/core/Button';\nimport { InfoCard } from '../InfoCard/InfoCard';\nimport {\n ProviderComponent,\n ProviderLoader,\n SignInProvider,\n SignInProviderConfig,\n} from './types';\nimport { useApi, errorApiRef } from '@backstage/core-plugin-api';\nimport { GridItem } from './styles';\nimport { ForwardedError } from '@backstage/errors';\nimport { UserIdentity } from './UserIdentity';\nimport { coreComponentsTranslationRef } from '../../translation';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\n\nconst Component: ProviderComponent = ({\n config,\n onSignInStarted,\n onSignInSuccess,\n onSignInFailure,\n}) => {\n const { apiRef, title, message } = config as SignInProviderConfig;\n const authApi = useApi(apiRef);\n const errorApi = useApi(errorApiRef);\n const { t } = useTranslationRef(coreComponentsTranslationRef);\n\n const handleLogin = async () => {\n try {\n onSignInStarted();\n const identityResponse = await authApi.getBackstageIdentity({\n instantPopup: true,\n });\n if (!identityResponse) {\n onSignInFailure();\n throw new Error(\n `The ${title} provider is not configured to support sign-in`,\n );\n }\n\n const profile = await authApi.getProfile();\n\n onSignInSuccess(\n UserIdentity.create({\n identity: identityResponse.identity,\n profile,\n authApi,\n }),\n );\n } catch (error) {\n onSignInFailure();\n errorApi.post(new ForwardedError(t('signIn.loginFailed'), error));\n }\n };\n\n return (\n <GridItem>\n <InfoCard\n variant=\"fullHeight\"\n title={title}\n actions={\n <Button color=\"primary\" variant=\"outlined\" onClick={handleLogin}>\n {t('signIn.title')}\n </Button>\n }\n >\n <Typography variant=\"body1\">{message}</Typography>\n </InfoCard>\n </GridItem>\n );\n};\n\nconst loader: ProviderLoader = async (apis, apiRef) => {\n const authApi = apis.get(apiRef)!;\n\n const identityResponse = await authApi.getBackstageIdentity({\n optional: true,\n });\n\n if (!identityResponse) {\n return undefined;\n }\n\n const profile = await authApi.getProfile();\n\n return UserIdentity.create({\n identity: identityResponse.identity,\n profile,\n authApi,\n });\n};\n\nexport const commonProvider: SignInProvider = { Component, loader };\n","/*\n * Copyright 2021 The Backstage Authors\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 {\n BackstageIdentityResponse,\n ProfileInfo,\n} from '@backstage/core-plugin-api';\nimport { z } from 'zod/v3';\n\nexport const proxiedSessionSchema = z.object({\n providerInfo: z.object({}).catchall(z.unknown()).optional(),\n profile: z.object({\n email: z.string().optional(),\n displayName: z.string().optional(),\n picture: z.string().optional(),\n }),\n backstageIdentity: z.object({\n token: z.string(),\n identity: z.object({\n type: z.literal('user'),\n userEntityRef: z.string(),\n ownershipEntityRefs: z.array(z.string()),\n }),\n }),\n});\n\n/**\n * Generic session information for proxied sign-in providers, e.g. common\n * reverse authenticating proxy implementations.\n *\n * @public\n */\nexport type ProxiedSession = {\n providerInfo?: { [key: string]: unknown };\n profile: ProfileInfo;\n backstageIdentity: Omit<BackstageIdentityResponse, 'id'>;\n};\n","/*\n * Copyright 2021 The Backstage Authors\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 {\n BackstageUserIdentity,\n discoveryApiRef,\n IdentityApi,\n ProfileInfo,\n} from '@backstage/core-plugin-api';\nimport { ResponseError } from '@backstage/errors';\nimport { ProxiedSession, proxiedSessionSchema } from './types';\n\nexport const DEFAULTS = {\n // The amount of time between token refreshes, if we fail to get an actual\n // value out of the exp claim\n defaultTokenExpiryMillis: 5 * 60 * 1000,\n // The amount of time before the actual expiry of the Backstage token, that we\n // shall start trying to get a new one\n tokenExpiryMarginMillis: 5 * 60 * 1000,\n} as const;\n\n// Decodes a base64url-encoded string. JWTs encode their segments using base64url\n// (RFC 7515), which substitutes '-' and '_' for '+' and '/' and omits padding.\n// `window.atob` only accepts standard base64, so translate back to that alphabet\n// and restore the padding before decoding.\nfunction decodeBase64Url(value: string): string {\n const base64 = value.replace(/-/g, '+').replace(/_/g, '/');\n const padded = base64.padEnd(Math.ceil(base64.length / 4) * 4, '=');\n return window.atob(padded);\n}\n\n// When the token expires, with some margin\nexport function tokenToExpiry(jwtToken: string | undefined): Date {\n const fallback = new Date(Date.now() + DEFAULTS.defaultTokenExpiryMillis);\n if (!jwtToken) {\n return fallback;\n }\n\n const [_header, rawPayload, _signature] = jwtToken.split('.');\n const payload = JSON.parse(decodeBase64Url(rawPayload));\n if (typeof payload.exp !== 'number') {\n return fallback;\n }\n\n return new Date(payload.exp * 1000 - DEFAULTS.tokenExpiryMarginMillis);\n}\n\ntype ProxiedSignInIdentityOptions = {\n provider: string;\n discoveryApi: typeof discoveryApiRef.T;\n headers?: HeadersInit | (() => HeadersInit) | (() => Promise<HeadersInit>);\n};\n\ntype State =\n | {\n type: 'empty';\n }\n | {\n type: 'fetching';\n promise: Promise<ProxiedSession>;\n previous: ProxiedSession | undefined;\n }\n | {\n type: 'active';\n session: ProxiedSession;\n expiresAt: Date;\n }\n | {\n type: 'failed';\n error: Error;\n };\n\n/**\n * An identity API that gets the user auth information solely based on a\n * provider's `/refresh` endpoint.\n */\nexport class ProxiedSignInIdentity implements IdentityApi {\n private readonly options: ProxiedSignInIdentityOptions;\n private readonly abortController: AbortController;\n private state: State;\n\n constructor(options: ProxiedSignInIdentityOptions) {\n this.options = options;\n this.abortController = new AbortController();\n this.state = { type: 'empty' };\n }\n\n async start() {\n // Try to make a first fetch, bubble up any errors to the caller\n await this.getSessionAsync();\n }\n\n /** {@inheritdoc @backstage/core-plugin-api#IdentityApi.getUserId} */\n getUserId(): string {\n const { backstageIdentity } = this.getSessionSync();\n const ref = backstageIdentity.identity.userEntityRef;\n const match = /^([^:/]+:)?([^:/]+\\/)?([^:/]+)$/.exec(ref);\n if (!match) {\n throw new TypeError(`Invalid user entity reference \"${ref}\"`);\n }\n\n return match[3];\n }\n\n /** {@inheritdoc @backstage/core-plugin-api#IdentityApi.getIdToken} */\n async getIdToken(): Promise<string | undefined> {\n const session = await this.getSessionAsync();\n return session.backstageIdentity.token;\n }\n\n /** {@inheritdoc @backstage/core-plugin-api#IdentityApi.getProfile} */\n getProfile(): ProfileInfo {\n const session = this.getSessionSync();\n return session.profile;\n }\n\n /** {@inheritdoc @backstage/core-plugin-api#IdentityApi.getProfileInfo} */\n async getProfileInfo(): Promise<ProfileInfo> {\n const session = await this.getSessionAsync();\n return session.profile;\n }\n\n /** {@inheritdoc @backstage/core-plugin-api#IdentityApi.getBackstageIdentity} */\n async getBackstageIdentity(): Promise<BackstageUserIdentity> {\n const session = await this.getSessionAsync();\n return session.backstageIdentity.identity;\n }\n\n /** {@inheritdoc @backstage/core-plugin-api#IdentityApi.getCredentials} */\n async getCredentials(): Promise<{ token?: string | undefined }> {\n const session = await this.getSessionAsync();\n return {\n token: session.backstageIdentity.token,\n };\n }\n\n /** {@inheritdoc @backstage/core-plugin-api#IdentityApi.signOut} */\n async signOut(): Promise<void> {\n this.abortController.abort();\n }\n\n getSessionSync(): ProxiedSession {\n if (this.state.type === 'active') {\n return this.state.session;\n } else if (this.state.type === 'fetching' && this.state.previous) {\n return this.state.previous;\n }\n throw new Error('No session available. Try reloading your browser page.');\n }\n\n async getSessionAsync(): Promise<ProxiedSession> {\n if (this.state.type === 'fetching') {\n return this.state.promise;\n } else if (\n this.state.type === 'active' &&\n new Date() < this.state.expiresAt\n ) {\n return this.state.session;\n }\n\n const previous =\n this.state.type === 'active' ? this.state.session : undefined;\n\n const promise = this.fetchSession().then(\n session => {\n this.state = {\n type: 'active',\n session,\n expiresAt: tokenToExpiry(session.backstageIdentity.token),\n };\n return session;\n },\n error => {\n this.state = {\n type: 'failed',\n error,\n };\n throw error;\n },\n );\n\n this.state = {\n type: 'fetching',\n promise,\n previous,\n };\n\n return promise;\n }\n\n async fetchSession(): Promise<ProxiedSession> {\n const baseUrl = await this.options.discoveryApi.getBaseUrl('auth');\n\n const headers =\n typeof this.options.headers === 'function'\n ? await this.options.headers()\n : this.options.headers;\n const mergedHeaders = new Headers(headers);\n mergedHeaders.set('X-Requested-With', 'XMLHttpRequest');\n\n // Note that we do not use the fetchApi here, since this all happens before\n // sign-in completes so there can be no automatic token injection and\n // similar.\n const response = await fetch(\n `${baseUrl}/${this.options.provider}/refresh`,\n {\n signal: this.abortController.signal,\n headers: mergedHeaders,\n credentials: 'include',\n },\n );\n\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n }\n\n return proxiedSessionSchema.parse(await response.json());\n }\n}\n","/*\n * Copyright 2020 The Backstage Authors\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 Typography from '@material-ui/core/Typography';\nimport Button from '@material-ui/core/Button';\nimport { InfoCard } from '../InfoCard/InfoCard';\nimport { GridItem } from './styles';\nimport { ProviderComponent, ProviderLoader, SignInProvider } from './types';\nimport { ProxiedSignInIdentity } from '../ProxiedSignInPage/ProxiedSignInIdentity';\nimport { discoveryApiRef, useApi } from '@backstage/core-plugin-api';\nimport { GuestUserIdentity } from './GuestUserIdentity';\nimport useLocalStorage from 'react-use/esm/useLocalStorage';\nimport { ResponseError } from '@backstage/errors';\nimport { coreComponentsTranslationRef } from '../../translation';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\n\nconst getIdentity = async (identity: ProxiedSignInIdentity) => {\n try {\n const identityResponse = await identity.getBackstageIdentity();\n return identityResponse;\n } catch (error) {\n if (\n error.name === 'ResponseError' &&\n (error as ResponseError).cause.name === 'NotFoundError'\n ) {\n return undefined;\n }\n throw error;\n }\n};\n\nconst Component: ProviderComponent = ({\n onSignInStarted,\n onSignInSuccess,\n onSignInFailure,\n}) => {\n const discoveryApi = useApi(discoveryApiRef);\n const [_, setUseLegacyGuestToken] = useLocalStorage('enableLegacyGuestToken');\n const { t } = useTranslationRef(coreComponentsTranslationRef);\n\n const handle = async () => {\n onSignInStarted();\n\n const identity = new ProxiedSignInIdentity({\n provider: 'guest',\n discoveryApi,\n });\n\n const identityResponse = await getIdentity(identity).catch(error => {\n // eslint-disable-next-line no-console\n console.warn(`Failed to sign in as a guest, ${error}`);\n return undefined;\n });\n\n if (!identityResponse) {\n // eslint-disable-next-line no-alert\n const useLegacyGuestTokenResponse = confirm(\n 'Failed to sign in as a guest using the auth backend. Do you want to fallback to the legacy guest token?',\n );\n if (useLegacyGuestTokenResponse) {\n setUseLegacyGuestToken(true);\n onSignInSuccess(new GuestUserIdentity());\n return;\n }\n onSignInFailure();\n throw new Error(\n `You cannot sign in as a guest, you must either enable the legacy guest token or configure the auth backend to support guest sign in.`,\n );\n }\n\n onSignInSuccess(identity);\n };\n\n return (\n <GridItem>\n <InfoCard\n title=\"Guest\"\n variant=\"fullHeight\"\n actions={\n <Button color=\"primary\" variant=\"outlined\" onClick={handle}>\n {t('signIn.guestProvider.enter')}\n </Button>\n }\n >\n <Typography variant=\"body1\" style={{ whiteSpace: 'pre-line' }}>\n {t('signIn.guestProvider.subtitle')}\n </Typography>\n </InfoCard>\n </GridItem>\n );\n};\n\nconst loader: ProviderLoader = async apis => {\n const useLegacyGuestToken =\n localStorage.getItem('enableLegacyGuestToken') === 'true';\n\n const identity = new ProxiedSignInIdentity({\n provider: 'guest',\n discoveryApi: apis.get(discoveryApiRef)!,\n });\n const identityResponse = await getIdentity(identity).catch(error => {\n // eslint-disable-next-line no-console\n console.warn(`Failed to sign in as a guest, ${error}`);\n return undefined;\n });\n\n if (!identityResponse && !useLegacyGuestToken) {\n return undefined;\n } else if (identityResponse && useLegacyGuestToken) {\n // eslint-disable-next-line no-alert\n const switchToNewGuestToken = confirm(\n 'You are currently using the legacy guest token, but you have the new guest backend module installed. Do you want to use the new module?',\n );\n if (switchToNewGuestToken) {\n localStorage.removeItem('enableLegacyGuestToken');\n } else {\n return new GuestUserIdentity();\n }\n } else if (useLegacyGuestToken) {\n return new GuestUserIdentity();\n }\n\n return identity;\n};\n\nexport const guestProvider: SignInProvider = { Component, loader };\n","/*\n * Copyright 2020 The Backstage Authors\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 { useForm, UseFormRegisterReturn } from 'react-hook-form';\nimport { makeStyles } from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport Button from '@material-ui/core/Button';\nimport FormControl from '@material-ui/core/FormControl';\nimport TextField from '@material-ui/core/TextField';\nimport FormHelperText from '@material-ui/core/FormHelperText';\nimport isEmpty from 'lodash/isEmpty';\nimport { InfoCard } from '../InfoCard/InfoCard';\nimport { ProviderComponent, ProviderLoader, SignInProvider } from './types';\nimport { GridItem } from './styles';\nimport { UserIdentity } from './UserIdentity';\nimport { coreComponentsTranslationRef } from '../../translation';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\n\n// accept base64url format according to RFC7515 (https://tools.ietf.org/html/rfc7515#section-3)\nconst ID_TOKEN_REGEX = /^[a-z0-9_\\-]+\\.[a-z0-9_\\-]+\\.[a-z0-9_\\-]+$/i;\n\n/** @public */\nexport type CustomProviderClassKey = 'form' | 'button';\n\nconst useFormStyles = makeStyles(\n theme => ({\n form: {\n display: 'flex',\n flexFlow: 'column nowrap',\n },\n button: {\n alignSelf: 'center',\n marginTop: theme.spacing(2),\n },\n subTitle: {\n whiteSpace: 'pre-line',\n },\n }),\n { name: 'BackstageCustomProvider' },\n);\n\ntype Data = {\n userId: string;\n idToken?: string;\n};\n\nconst asInputRef = (renderResult: UseFormRegisterReturn) => {\n const { ref, ...rest } = renderResult;\n return {\n inputRef: ref,\n ...rest,\n };\n};\n\nconst Component: ProviderComponent = ({ onSignInStarted, onSignInSuccess }) => {\n const classes = useFormStyles();\n const { t } = useTranslationRef(coreComponentsTranslationRef);\n const { register, handleSubmit, formState } = useForm<Data>({\n mode: 'onChange',\n });\n\n const { errors } = formState;\n\n const handleResult = ({ userId, idToken }: Data) => {\n onSignInStarted();\n onSignInSuccess(\n UserIdentity.fromLegacy({\n userId,\n getIdToken: idToken !== undefined ? async () => idToken : undefined,\n profile: {\n email: `${userId}@example.com`,\n },\n }),\n );\n };\n\n return (\n <GridItem>\n <InfoCard title={t('signIn.customProvider.title')} variant=\"fullHeight\">\n <Typography variant=\"body1\" className={classes.subTitle}>\n {t('signIn.customProvider.subtitle')}\n </Typography>\n\n <form className={classes.form} onSubmit={handleSubmit(handleResult)}>\n <FormControl>\n <TextField\n {...asInputRef(register('userId', { required: true }))}\n label={t('signIn.customProvider.userId')}\n margin=\"normal\"\n error={Boolean(errors.userId)}\n />\n {errors.userId && (\n <FormHelperText error>{errors.userId.message}</FormHelperText>\n )}\n </FormControl>\n <FormControl>\n <TextField\n {...asInputRef(\n register('idToken', {\n required: false,\n validate: token =>\n !token ||\n ID_TOKEN_REGEX.test(token) ||\n t('signIn.customProvider.tokenInvalid'),\n }),\n )}\n label={t('signIn.customProvider.idToken')}\n margin=\"normal\"\n autoComplete=\"off\"\n error={Boolean(errors.idToken)}\n />\n {errors.idToken && (\n <FormHelperText error>{errors.idToken.message}</FormHelperText>\n )}\n </FormControl>\n <Button\n type=\"submit\"\n color=\"primary\"\n variant=\"outlined\"\n className={classes.button}\n disabled={!formState?.isDirty || !isEmpty(errors)}\n >\n {t('signIn.customProvider.continue')}\n </Button>\n </form>\n </InfoCard>\n </GridItem>\n );\n};\n\n// Custom provider doesn't store credentials\nconst loader: ProviderLoader = async () => undefined;\n\nexport const customProvider: SignInProvider = { Component, loader };\n","/*\n * Copyright 2021 The Backstage Authors\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 {\n BackstageUserIdentity,\n IdentityApi,\n ProfileInfo,\n} from '@backstage/core-plugin-api';\n\n// Similar to the AppIdentityApi we provide backwards compatibility for a limited time\ntype CompatibilityIdentityApi = IdentityApi & {\n getUserId?(): string;\n getIdToken?(): Promise<string | undefined>;\n getProfile?(): ProfileInfo;\n};\n\nexport class IdentityApiSignOutProxy implements IdentityApi {\n private constructor(\n private readonly config: {\n identityApi: CompatibilityIdentityApi;\n signOut: IdentityApi['signOut'];\n },\n ) {}\n\n static from(config: {\n identityApi: CompatibilityIdentityApi;\n signOut: IdentityApi['signOut'];\n }): IdentityApi {\n return new IdentityApiSignOutProxy(config);\n }\n\n getUserId(): string {\n if (!this.config.identityApi.getUserId) {\n throw new Error(`SignOutProxy IdentityApi.getUserId is not implemented`);\n }\n return this.config.identityApi.getUserId();\n }\n\n getIdToken(): Promise<string | undefined> {\n if (!this.config.identityApi.getIdToken) {\n throw new Error(`SignOutProxy IdentityApi.getIdToken is not implemented`);\n }\n return this.config.identityApi.getIdToken();\n }\n\n getProfile(): ProfileInfo {\n if (!this.config.identityApi.getProfile) {\n throw new Error(`SignOutProxy IdentityApi.getProfile is not implemented`);\n }\n return this.config.identityApi.getProfile();\n }\n\n getProfileInfo(): Promise<ProfileInfo> {\n return this.config.identityApi.getProfileInfo();\n }\n\n getBackstageIdentity(): Promise<BackstageUserIdentity> {\n return this.config.identityApi.getBackstageIdentity();\n }\n\n getCredentials(): Promise<{ token?: string | undefined }> {\n return this.config.identityApi.getCredentials();\n }\n\n signOut(): Promise<void> {\n return this.config.signOut();\n }\n}\n","/*\n * Copyright 2020 The Backstage Authors\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 { useLayoutEffect, useState, useMemo, useCallback } from 'react';\nimport {\n SignInPageProps,\n useApi,\n useApiHolder,\n errorApiRef,\n IdentityApi,\n useAnalytics,\n} from '@backstage/core-plugin-api';\nimport {\n IdentityProviders,\n SignInProvider,\n SignInProviderConfig,\n} from './types';\nimport { commonProvider } from './commonProvider';\nimport { guestProvider } from './guestProvider';\nimport { customProvider } from './customProvider';\nimport { IdentityApiSignOutProxy } from './IdentityApiSignOutProxy';\nimport { useSearchParams } from 'react-router-dom';\nimport { useMountEffect } from '@react-hookz/web';\nimport { ForwardedError } from '@backstage/errors';\nimport { coreComponentsTranslationRef } from '../../translation';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\n\nconst PROVIDER_STORAGE_KEY = '@backstage/core:SignInPage:provider';\n\nexport type SignInProviderType = {\n [key: string]: {\n components: SignInProvider;\n id: string;\n config?: SignInProviderConfig;\n };\n};\n\nconst signInProviders: { [key: string]: SignInProvider } = {\n guest: guestProvider,\n custom: customProvider,\n common: commonProvider,\n};\n\nfunction validateIDs(id: string, providers: SignInProviderType): void {\n if (id in providers)\n throw new Error(\n `\"${id}\" ID is duplicated. IDs of identity providers have to be unique.`,\n );\n}\n\nexport function getSignInProviders(\n identityProviders: IdentityProviders,\n): SignInProviderType {\n const providers = identityProviders.reduce(\n (acc: SignInProviderType, config) => {\n if (typeof config === 'string') {\n validateIDs(config, acc);\n acc[config] = { components: signInProviders[config], id: config };\n\n return acc;\n }\n\n const { id } = config as SignInProviderConfig;\n validateIDs(id, acc);\n\n acc[id] = { components: signInProviders.common, id, config };\n\n return acc;\n },\n {},\n );\n\n return providers;\n}\n\nexport const useSignInProviders = (\n providers: SignInProviderType,\n onSignInSuccess: SignInPageProps['onSignInSuccess'],\n) => {\n const errorApi = useApi(errorApiRef);\n const apiHolder = useApiHolder();\n const [loading, setLoading] = useState(true);\n const analytics = useAnalytics();\n\n const { t } = useTranslationRef(coreComponentsTranslationRef);\n // User was redirected back to sign in page with error from auth redirect flow\n const [searchParams, _setSearchParams] = useSearchParams();\n\n useMountEffect(() => {\n const errorParam = searchParams.get('error');\n if (errorParam) {\n errorApi.post(\n new ForwardedError(t('signIn.loginFailed'), new Error(errorParam)),\n );\n }\n });\n\n // This decorates the result with sign out logic from this hook\n const handleWrappedResult = useCallback(\n async (identityApi: IdentityApi) => {\n onSignInSuccess(\n IdentityApiSignOutProxy.from({\n identityApi,\n signOut: async () => {\n localStorage.removeItem(PROVIDER_STORAGE_KEY);\n await identityApi.signOut?.();\n analytics.captureEvent('signOut', 'success');\n },\n }),\n );\n analytics.captureEvent('signIn', 'success');\n },\n [onSignInSuccess, analytics],\n );\n\n // In this effect we check if the user has already selected an existing login\n // provider, and in that case try to load an existing session for the provider.\n useLayoutEffect(() => {\n if (!loading) {\n return undefined;\n }\n\n // We can't use storageApi here, as it might have a dependency on the IdentityApi\n const selectedProviderId = localStorage.getItem(\n PROVIDER_STORAGE_KEY,\n ) as string;\n\n // No provider selected, let the user pick one\n if (selectedProviderId === null) {\n setLoading(false);\n return undefined;\n }\n\n const provider = providers[selectedProviderId];\n if (!provider) {\n setLoading(false);\n return undefined;\n }\n\n let didCancel = false;\n\n provider.components\n .loader(apiHolder, provider.config?.apiRef!)\n .then(result => {\n if (didCancel) {\n localStorage.removeItem(PROVIDER_STORAGE_KEY);\n return;\n }\n if (result) {\n handleWrappedResult(result);\n } else {\n setLoading(false);\n }\n })\n .catch(error => {\n localStorage.removeItem(PROVIDER_STORAGE_KEY);\n if (didCancel) {\n return;\n }\n errorApi.post(error);\n setLoading(false);\n });\n\n return () => {\n didCancel = true;\n };\n }, [\n loading,\n errorApi,\n onSignInSuccess,\n apiHolder,\n providers,\n handleWrappedResult,\n ]);\n\n // This renders all available sign-in providers\n const elements = useMemo(\n () =>\n Object.keys(providers).map(key => {\n const provider = providers[key];\n\n const { Component } = provider.components;\n\n const handleSignInSuccess = (result: IdentityApi) => {\n handleWrappedResult(result);\n };\n\n const handleSignInStarted = () => {\n localStorage.setItem(\n PROVIDER_STORAGE_KEY,\n provider?.config?.id || provider.id,\n );\n };\n\n const handleSignInFailure = () => {\n localStorage.removeItem(PROVIDER_STORAGE_KEY);\n };\n\n return (\n <Component\n key={provider.id}\n config={provider.config!}\n onSignInStarted={handleSignInStarted}\n onSignInSuccess={handleSignInSuccess}\n onSignInFailure={handleSignInFailure}\n />\n );\n }),\n [providers, handleWrappedResult],\n );\n\n return [loading, elements];\n};\n","/*\n * Copyright 2020 The Backstage Authors\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 {\n BackstageIdentityResponse,\n configApiRef,\n SignInPageProps,\n useAnalytics,\n useApi,\n} from '@backstage/core-plugin-api';\nimport { UserIdentity } from './UserIdentity';\nimport Button from '@material-ui/core/Button';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport { ComponentType, ReactNode, useState } from 'react';\nimport { useMountEffect } from '@react-hookz/web';\nimport { Progress } from '../../components/Progress';\nimport { Content } from '../Content/Content';\nimport { ContentHeader } from '../ContentHeader/ContentHeader';\nimport { Header } from '../Header';\nimport { InfoCard } from '../InfoCard';\nimport { Page } from '../Page';\nimport { getSignInProviders, useSignInProviders } from './providers';\nimport { GridItem, useStyles } from './styles';\nimport { IdentityProviders, SignInProviderConfig } from './types';\nimport { coreComponentsTranslationRef } from '../../translation';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { useSearchParams } from 'react-router-dom';\n\ntype CommonSignInPageProps = SignInPageProps & {\n /**\n * Error component to be rendered instead of the default error panel in case\n * sign in fails.\n */\n ErrorComponent?: ComponentType<{ error?: Error }>;\n};\n\ntype MultiSignInPageProps = CommonSignInPageProps & {\n providers: IdentityProviders;\n title?: string;\n titleComponent?: ReactNode;\n align?: 'center' | 'left';\n};\n\ntype SingleSignInPageProps = CommonSignInPageProps & {\n provider: SignInProviderConfig;\n auto?: boolean;\n};\n\nexport type Props = MultiSignInPageProps | SingleSignInPageProps;\n\nexport const MultiSignInPage = ({\n onSignInSuccess,\n providers = [],\n title,\n titleComponent,\n align = 'left',\n}: MultiSignInPageProps) => {\n const configApi = useApi(configApiRef);\n const classes = useStyles();\n\n const signInProviders = getSignInProviders(providers);\n const [loading, providerElements] = useSignInProviders(\n signInProviders,\n onSignInSuccess,\n );\n\n if (loading) {\n return <Progress />;\n }\n\n return (\n <Page themeId=\"home\">\n <Header title={configApi.getString('app.title')} />\n <Content>\n {(title || titleComponent) && (\n <ContentHeader\n title={title}\n titleComponent={titleComponent}\n textAlign={align}\n />\n )}\n <Grid\n container\n justifyContent={align === 'center' ? align : 'flex-start'}\n spacing={2}\n component=\"ul\"\n classes={classes}\n >\n {providerElements}\n </Grid>\n </Content>\n </Page>\n );\n};\n\nexport const SingleSignInPage = ({\n provider,\n auto,\n onSignInSuccess,\n ErrorComponent,\n}: SingleSignInPageProps) => {\n const classes = useStyles();\n const authApi = useApi(provider.apiRef);\n const configApi = useApi(configApiRef);\n const { t } = useTranslationRef(coreComponentsTranslationRef);\n const analytics = useAnalytics();\n\n const [error, setError] = useState<Error>();\n\n // The SignIn component takes some time to decide whether the user is logged-in or not.\n // showLoginPage is used to prevent a glitch-like experience where the sign-in page is\n // displayed for a split second when the user is already logged-in.\n const [showLoginPage, setShowLoginPage] = useState<boolean>(false);\n\n // User was redirected back to sign in page with error from auth redirect flow\n const [searchParams, _setSearchParams] = useSearchParams();\n const errorParam = searchParams.get('error');\n\n type LoginOpts = { checkExisting?: boolean; showPopup?: boolean };\n const login = async ({ checkExisting, showPopup }: LoginOpts) => {\n try {\n let identityResponse: BackstageIdentityResponse | undefined;\n if (checkExisting) {\n // Do an initial check if any logged-in session exists\n identityResponse = await authApi.getBackstageIdentity({\n optional: true,\n });\n }\n\n // If no session exists, show the sign-in page\n if (!identityResponse && (showPopup || auto) && !errorParam) {\n // Unless auto is set to true, this step should not happen.\n // When user intentionally clicks the Sign In button, autoShowPopup is set to true\n setShowLoginPage(true);\n identityResponse = await authApi.getBackstageIdentity({\n instantPopup: true,\n });\n if (!identityResponse) {\n throw new Error(\n `The ${provider.title} provider is not configured to support sign-in`,\n );\n }\n }\n\n if (!identityResponse) {\n setShowLoginPage(true);\n return;\n }\n\n const profile = await authApi.getProfile();\n onSignInSuccess(\n UserIdentity.create({\n identity: identityResponse.identity,\n authApi,\n profile,\n }),\n );\n analytics.captureEvent('signIn', 'success');\n } catch (err: any) {\n // User closed the sign-in modal\n setError(err);\n setShowLoginPage(true);\n }\n };\n\n useMountEffect(() => {\n if (errorParam) {\n setError(new Error(errorParam));\n }\n login({ checkExisting: true });\n });\n\n return showLoginPage ? (\n <Page themeId=\"home\">\n <Header title={configApi.getString('app.title')} />\n <Content>\n <Grid\n container\n justifyContent=\"center\"\n spacing={2}\n component=\"ul\"\n classes={classes}\n >\n <GridItem>\n <InfoCard\n variant=\"fullHeight\"\n title={provider.title}\n actions={\n <Button\n color=\"primary\"\n variant=\"outlined\"\n onClick={() => {\n login({ showPopup: true });\n }}\n >\n {t('signIn.title')}\n </Button>\n }\n >\n <Typography variant=\"body1\">{provider.message}</Typography>\n {error &&\n error.name !== 'PopupRejectedError' &&\n (ErrorComponent ? (\n <ErrorComponent error={error} />\n ) : (\n <Typography variant=\"body1\" color=\"error\">\n {error.message}\n </Typography>\n ))}\n </InfoCard>\n </GridItem>\n </Grid>\n </Content>\n </Page>\n ) : (\n <Progress />\n );\n};\n\nexport function SignInPage(props: Props) {\n if ('provider' in props) {\n return <SingleSignInPage {...props} />;\n }\n\n return <MultiSignInPage {...props} />;\n}\n","/*\n * Copyright 2020 The Backstage Authors\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 Box from '@material-ui/core/Box';\nimport MaterialBreadcrumbs from '@material-ui/core/Breadcrumbs';\nimport List from '@material-ui/core/List';\nimport ListItem from '@material-ui/core/ListItem';\nimport Popover from '@material-ui/core/Popover';\nimport { withStyles } from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport {\n MouseEvent,\n useState,\n Children,\n ComponentProps,\n Fragment,\n} from 'react';\n\ntype Props = ComponentProps<typeof MaterialBreadcrumbs>;\n\n/** @public */\nexport type BreadcrumbsClickableTextClassKey = 'root';\n\nconst ClickableText = withStyles(\n {\n root: {\n textDecoration: 'underline',\n cursor: 'pointer',\n },\n },\n { name: 'BackstageBreadcrumbsClickableText' },\n)(Typography);\n\n/** @public */\nexport type BreadcrumbsStyledBoxClassKey = 'root';\n\nconst StyledBox = withStyles(\n {\n root: {\n textDecoration: 'underline',\n color: 'inherit',\n },\n },\n { name: 'BackstageBreadcrumbsStyledBox' },\n)(Box);\n\n/** @public */\nexport type BreadcrumbsCurrentPageClassKey = 'root';\n\nconst BreadcrumbsCurrentPage = withStyles(\n {\n root: {\n fontStyle: 'italic',\n },\n },\n { name: 'BreadcrumbsCurrentPage' },\n)(Box);\n\n/**\n * Breadcrumbs component to show navigation hierarchical structure\n *\n * @public\n *\n */\nexport function Breadcrumbs(props: Props) {\n const { children, ...restProps } = props;\n const [anchorEl, setAnchorEl] = useState<HTMLButtonElement | null>(null);\n\n const childrenArray = Children.toArray(children);\n\n const [firstPage, secondPage, ...expandablePages] = childrenArray;\n const currentPage = expandablePages.length\n ? expandablePages.pop()\n : childrenArray[childrenArray.length - 1];\n const hasHiddenBreadcrumbs = childrenArray.length > 3;\n\n const handleClick = (event: MouseEvent<HTMLButtonElement>) => {\n setAnchorEl(event.currentTarget);\n };\n\n const handleClose = () => {\n setAnchorEl(null);\n };\n\n const open = Boolean(anchorEl);\n return (\n <Fragment>\n <MaterialBreadcrumbs aria-label=\"breadcrumb\" {...restProps}>\n {childrenArray.length > 1 && <StyledBox clone>{firstPage}</StyledBox>}\n {childrenArray.length > 2 && <StyledBox clone>{secondPage}</StyledBox>}\n {hasHiddenBreadcrumbs && (\n <ClickableText onClick={handleClick}>...</ClickableText>\n )}\n <BreadcrumbsCurrentPage>{currentPage}</BreadcrumbsCurrentPage>\n </MaterialBreadcrumbs>\n <Popover\n open={open}\n anchorEl={anchorEl}\n onClose={handleClose}\n anchorOrigin={{\n vertical: 'bottom',\n horizontal: 'left',\n }}\n transformOrigin={{\n vertical: 'top',\n horizontal: 'left',\n }}\n >\n <List>\n {expandablePages.map((pageLink, index) => (\n <ListItem key={index} button>\n <StyledBox clone>{pageLink}</StyledBox>\n </ListItem>\n ))}\n </List>\n </Popover>\n </Fragment>\n );\n}\n","/*\n * Copyright 2020 The Backstage Authors\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 { makeStyles, Theme } from '@material-ui/core/styles';\nimport classNames from 'classnames';\nimport { PropsWithChildren } from 'react';\n\n/** @public */\nexport type BackstageContentClassKey = 'root' | 'stretch' | 'noPadding';\n\nconst useStyles = makeStyles(\n (theme: Theme) => ({\n root: {\n gridArea: 'pageContent',\n minWidth: 0,\n paddingTop: theme.spacing(3),\n paddingBottom: theme.spacing(3),\n paddingLeft: theme.spacing(2),\n paddingRight: theme.spacing(2),\n [theme.breakpoints.up('sm')]: {\n paddingLeft: theme.spacing(3),\n paddingRight: theme.spacing(3),\n },\n },\n stretch: {\n display: 'flex',\n flexDirection: 'column',\n flexGrow: 1,\n },\n noPadding: {\n padding: 0,\n },\n }),\n { name: 'BackstageContent' },\n);\n\ntype Props = {\n stretch?: boolean;\n noPadding?: boolean;\n className?: string;\n};\n\n/**\n * The main content part inside a {@link Page}.\n *\n * @public\n *\n */\n\nexport function Content(props: PropsWithChildren<Props>) {\n const { className, stretch, noPadding, children, ...restProps } = props;\n\n const classes = useStyles();\n return (\n <article\n {...restProps}\n className={classNames(classes.root, className, {\n [classes.stretch]: stretch,\n [classes.noPadding]: noPadding,\n })}\n >\n {children}\n </article>\n );\n}\n","/*\n * Copyright 2020 The Backstage Authors\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 Box from '@material-ui/core/Box';\nimport { makeStyles } from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport { PropsWithChildren, ReactNode } from 'react';\nimport { Helmet } from 'react-helmet';\n\n/**\n * TODO: favoriteable capability\n */\n\n/** @public */\nexport type ContentHeaderClassKey =\n | 'container'\n | 'leftItemsBox'\n | 'rightItemsBox'\n | 'description'\n | 'title';\n\nconst useStyles = (props: ContentHeaderProps) =>\n makeStyles(\n theme => ({\n container: {\n width: '100%',\n display: 'flex',\n flexDirection: 'row',\n flexWrap: 'wrap',\n justifyContent: 'flex-end',\n alignItems: 'center',\n marginBottom: theme.spacing(2),\n textAlign: props.textAlign,\n },\n leftItemsBox: {\n flex: '1 1 auto',\n minWidth: 0,\n overflow: 'visible',\n },\n rightItemsBox: {\n flex: '0 1 auto',\n display: 'flex',\n flexDirection: 'row',\n flexWrap: 'wrap',\n alignItems: 'center',\n marginLeft: theme.spacing(1),\n minWidth: 0,\n overflow: 'visible',\n },\n description: {},\n title: {\n display: 'inline-flex',\n marginBottom: 0,\n },\n }),\n { name: 'BackstageContentHeader' },\n );\n\ntype ContentHeaderTitleProps = {\n title?: string;\n className?: string;\n};\n\nconst ContentHeaderTitle = ({ title, className }: ContentHeaderTitleProps) => (\n <Typography\n variant=\"h4\"\n component=\"h2\"\n className={className}\n data-testid=\"header-title\"\n >\n {title}\n </Typography>\n);\n\ntype ContentHeaderDescriptionProps = {\n description?: string;\n className?: string;\n};\n\nconst ContentHeaderDescription = ({\n description,\n className,\n}: ContentHeaderDescriptionProps) =>\n description ? (\n <Typography\n variant=\"body2\"\n className={className}\n data-testid=\"header-description\"\n >\n {description}\n </Typography>\n ) : null;\n\ntype ContentHeaderProps = {\n title?: ContentHeaderTitleProps['title'];\n titleComponent?: ReactNode;\n description?: ContentHeaderDescriptionProps['description'];\n descriptionComponent?: ReactNode;\n textAlign?: 'left' | 'right' | 'center';\n};\n\n/**\n * A header at the top inside a {@link Content}.\n *\n * @public\n *\n */\n\nexport function ContentHeader(props: PropsWithChildren<ContentHeaderProps>) {\n const {\n description,\n title,\n titleComponent: TitleComponent = undefined,\n children,\n descriptionComponent: DescriptionComponent = undefined,\n textAlign = 'left',\n } = props;\n const classes = useStyles({ textAlign })();\n\n const renderedTitle = TitleComponent ? (\n TitleComponent\n ) : (\n <ContentHeaderTitle title={title} className={classes.title} />\n );\n\n const renderedDescription = DescriptionComponent ? (\n DescriptionComponent\n ) : (\n <ContentHeaderDescription\n description={description}\n className={classes.description}\n />\n );\n\n return (\n <>\n <Helmet title={title} />\n <Box className={classes.container}>\n <Box className={classes.leftItemsBox}>\n {renderedTitle}\n {renderedDescription}\n </Box>\n <Box className={classes.rightItemsBox}>{children}</Box>\n </Box>\n </>\n );\n}\n","/*\n * Copyright 2020 The Backstage Authors\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 { configApiRef, useApi } from '@backstage/core-plugin-api';\nimport Box from '@material-ui/core/Box';\nimport Grid from '@material-ui/core/Grid';\nimport { makeStyles } from '@material-ui/core/styles';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport Typography from '@material-ui/core/Typography';\nimport { CSSProperties, PropsWithChildren, ReactNode } from 'react';\nimport { Helmet } from 'react-helmet';\nimport { Link } from '../../components/Link';\nimport { Breadcrumbs } from '../Breadcrumbs';\nimport { useContent } from '../Sidebar';\n\n/** @public */\nexport type HeaderClassKey =\n | 'header'\n | 'leftItemsBox'\n | 'rightItemsBox'\n | 'title'\n | 'subtitle'\n | 'type'\n | 'breadcrumb'\n | 'breadcrumbType'\n | 'breadcrumbTitle';\n\nconst useStyles = makeStyles(\n theme => ({\n header: {\n gridArea: 'pageHeader',\n padding: theme.spacing(3),\n width: '100%',\n boxShadow: theme.shadows[4],\n position: 'relative',\n zIndex: 100,\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n backgroundImage: theme.page.backgroundImage,\n backgroundPosition: 'center',\n backgroundSize: 'cover',\n [theme.breakpoints.down('sm')]: {\n flexWrap: 'wrap',\n },\n },\n leftItemsBox: {\n maxWidth: '100%',\n flexGrow: 1,\n },\n rightItemsBox: {\n width: 'auto',\n alignItems: 'center',\n },\n title: {\n color: theme.page.fontColor,\n wordBreak: 'break-word',\n fontSize: theme.typography.h3.fontSize,\n marginBottom: 0,\n },\n subtitle: {\n color: theme.page.fontColor,\n opacity: 0.8,\n display: 'inline-block', // prevents margin collapse of adjacent siblings\n marginTop: theme.spacing(1),\n maxWidth: '75ch',\n },\n type: {\n textTransform: 'uppercase',\n fontSize: 11,\n opacity: 0.8,\n marginBottom: theme.spacing(1),\n color: theme.page.fontColor,\n },\n breadcrumb: {\n color: theme.page.fontColor,\n },\n breadcrumbType: {\n fontSize: 'inherit',\n opacity: 0.7,\n marginRight: -theme.spacing(0.3),\n marginBottom: theme.spacing(0.3),\n },\n breadcrumbTitle: {\n fontSize: 'inherit',\n marginLeft: -theme.spacing(0.3),\n marginBottom: theme.spacing(0.3),\n },\n }),\n { name: 'BackstageHeader' },\n);\n\ntype HeaderStyles = ReturnType<typeof useStyles>;\n\ntype Props = {\n component?: ReactNode;\n pageTitleOverride?: string;\n style?: CSSProperties;\n subtitle?: ReactNode;\n title: ReactNode;\n tooltip?: string;\n type?: string;\n typeLink?: string;\n};\n\ntype TypeFragmentProps = {\n classes: HeaderStyles;\n pageTitle: string | ReactNode;\n type?: Props['type'];\n typeLink?: Props['typeLink'];\n};\n\ntype TitleFragmentProps = {\n classes: HeaderStyles;\n pageTitle: string | ReactNode;\n tooltip?: Props['tooltip'];\n};\n\ntype SubtitleFragmentProps = {\n classes: HeaderStyles;\n subtitle?: Props['subtitle'];\n};\n\nconst TypeFragment = ({\n type,\n typeLink,\n classes,\n pageTitle,\n}: TypeFragmentProps) => {\n if (!type) {\n return null;\n }\n\n if (!typeLink) {\n return <Typography className={classes.type}>{type}</Typography>;\n }\n\n return (\n <Breadcrumbs className={classes.breadcrumb}>\n <Link to={typeLink}>{type}</Link>\n <Typography>{pageTitle}</Typography>\n </Breadcrumbs>\n );\n};\n\nconst TitleFragment = ({ pageTitle, classes, tooltip }: TitleFragmentProps) => {\n const { contentRef } = useContent();\n\n const FinalTitle = (\n <Typography\n ref={contentRef}\n tabIndex={-1}\n className={classes.title}\n variant=\"h1\"\n >\n {pageTitle}\n </Typography>\n );\n\n if (!tooltip) {\n return FinalTitle;\n }\n\n return (\n <Tooltip title={tooltip} placement=\"top-start\">\n {FinalTitle}\n </Tooltip>\n );\n};\n\nconst SubtitleFragment = ({ classes, subtitle }: SubtitleFragmentProps) => {\n if (!subtitle) {\n return null;\n }\n\n if (typeof subtitle !== 'string') {\n return <>{subtitle}</>;\n }\n\n return (\n <Typography\n className={classes.subtitle}\n variant=\"subtitle2\"\n component=\"span\"\n >\n {subtitle}\n </Typography>\n );\n};\n/**\n * Backstage main header with abstract color background in multiple variants\n *\n * @public\n *\n */\nexport function Header(props: PropsWithChildren<Props>) {\n const {\n children,\n pageTitleOverride,\n style,\n subtitle,\n title,\n tooltip,\n type,\n typeLink,\n } = props;\n const classes = useStyles();\n const configApi = useApi(configApiRef);\n const appTitle = configApi.getOptionalString('app.title') || 'Backstage';\n const documentTitle = pageTitleOverride || title;\n const pageTitle = title || pageTitleOverride;\n const titleTemplate = `${documentTitle} | %s | ${appTitle}`;\n const defaultTitle = `${documentTitle} | ${appTitle}`;\n\n return (\n <>\n <Helmet titleTemplate={titleTemplate} defaultTitle={defaultTitle} />\n <header\n style={style}\n className={classes.header}\n data-backstage-core-header=\"\"\n >\n <Box className={classes.leftItemsBox}>\n <TypeFragment\n classes={classes}\n type={type}\n typeLink={typeLink}\n pageTitle={pageTitle}\n />\n <TitleFragment\n classes={classes}\n pageTitle={pageTitle}\n tooltip={tooltip}\n />\n <SubtitleFragment classes={classes} subtitle={subtitle} />\n </Box>\n <Grid container className={classes.rightItemsBox} spacing={4}>\n {children}\n </Grid>\n </header>\n </>\n );\n}\n","/*\n * Copyright 2020 The Backstage Authors\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 Box from '@material-ui/core/Box';\nimport Divider from '@material-ui/core/Divider';\nimport { makeStyles } from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport ArrowIcon from '@material-ui/icons/ArrowForward';\nimport { MouseEvent } from 'react';\nimport { Link } from '../../components/Link';\n\n/** @public */\nexport type BottomLinkClassKey = 'root' | 'boxTitle' | 'arrow';\n\nconst useStyles = makeStyles(\n theme => ({\n root: {\n maxWidth: 'fit-content',\n padding: theme.spacing(2, 2, 2, 2.5),\n },\n boxTitle: {\n margin: 0,\n color: theme.palette.textSubtle,\n },\n arrow: {\n color: theme.palette.textSubtle,\n },\n }),\n { name: 'BackstageBottomLink' },\n);\n\n/** @public */\nexport type BottomLinkProps = {\n link: string;\n title: string;\n onClick?: (event: MouseEvent<HTMLAnchorElement>) => void;\n};\n\n/**\n * Footer with link used in {@link InfoCard } and {@link TabbedCard}\n *\n * @public\n *\n */\nexport function BottomLink(props: BottomLinkProps) {\n const { link, title, onClick } = props;\n const classes = useStyles();\n\n return (\n <Box>\n <Divider />\n <Link to={link} onClick={onClick} underline=\"none\">\n <Box display=\"flex\" alignItems=\"center\" className={classes.root}>\n <Box className={classes.boxTitle} fontWeight=\"fontWeightBold\" m={1}>\n <Typography>\n <strong>{title}</strong>\n </Typography>\n </Box>\n <ArrowIcon className={classes.arrow} />\n </Box>\n </Link>\n </Box>\n );\n}\n","/*\n * Copyright 2020 The Backstage Authors\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 Typography from '@material-ui/core/Typography';\nimport { PropsWithChildren, ComponentClass, Component, ErrorInfo } from 'react';\nimport { LinkButton } from '../../components/LinkButton';\nimport { ErrorPanel } from '../../components/ErrorPanel';\nimport { coreComponentsTranslationRef } from '../../translation';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\n\ntype SlackChannel = {\n name: string;\n href?: string;\n};\n\n/** @public */\nexport type ErrorBoundaryProps = PropsWithChildren<{\n slackChannel?: string | SlackChannel;\n onError?: (error: Error, errorInfo: string) => null;\n}>;\n\ntype State = {\n error?: Error;\n errorInfo?: ErrorInfo;\n};\n\nconst SlackLink = (props: { slackChannel?: string | SlackChannel }) => {\n const { slackChannel } = props;\n const { t } = useTranslationRef(coreComponentsTranslationRef);\n\n if (!slackChannel) {\n return null;\n } else if (typeof slackChannel === 'string') {\n return (\n <Typography>{t('errorBoundary.title', { slackChannel })}</Typography>\n );\n } else if (!slackChannel.href) {\n return (\n <Typography>\n {t('errorBoundary.title', {\n slackChannel: slackChannel.name,\n })}\n </Typography>\n );\n }\n\n return (\n <LinkButton to={slackChannel.href} variant=\"contained\">\n {slackChannel.name}\n </LinkButton>\n );\n};\n\n/** @public */\nexport const ErrorBoundary: ComponentClass<\n ErrorBoundaryProps,\n State\n> = class ErrorBoundary extends Component<ErrorBoundaryProps, State> {\n constructor(props: ErrorBoundaryProps) {\n super(props);\n this.state = {\n error: undefined,\n errorInfo: undefined,\n };\n }\n\n componentDidCatch(error: Error, errorInfo: ErrorInfo) {\n // eslint-disable-next-line no-console\n console.error(`ErrorBoundary, error: ${error}`, { error, errorInfo });\n this.setState({ error, errorInfo });\n }\n\n render() {\n const { slackChannel, children } = this.props;\n const { error } = this.state;\n\n if (!error) {\n return children;\n }\n\n return (\n <ErrorPanel title=\"Something Went Wrong\" error={error}>\n <SlackLink slackChannel={slackChannel} />\n </ErrorPanel>\n );\n }\n};\n","/*\n * Copyright 2020 The Backstage Authors\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 Card from '@material-ui/core/Card';\nimport CardActions from '@material-ui/core/CardActions';\nimport CardContent from '@material-ui/core/CardContent';\nimport CardHeader, { CardHeaderProps } from '@material-ui/core/CardHeader';\nimport Divider from '@material-ui/core/Divider';\nimport { makeStyles, withStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\nimport { ReactNode } from 'react';\nimport { BottomLink, BottomLinkProps } from '../BottomLink';\nimport { ErrorBoundary, ErrorBoundaryProps } from '../ErrorBoundary';\n\n/** @public */\nexport type InfoCardClassKey =\n | 'noPadding'\n | 'header'\n | 'headerTitle'\n | 'headerSubheader'\n | 'headerAvatar'\n | 'headerAction'\n | 'headerContent';\n\nconst useStyles = makeStyles(\n theme => ({\n noPadding: {\n padding: 0,\n '&:last-child': {\n paddingBottom: 0,\n },\n },\n contentAlignBottom: {\n display: 'flex',\n alignItems: 'self-end',\n },\n header: {\n padding: theme.spacing(2, 2, 2, 2.5),\n },\n headerTitle: {\n fontWeight: theme.typography.fontWeightBold,\n },\n headerSubheader: {\n paddingTop: theme.spacing(1),\n },\n headerAvatar: {},\n headerAction: {},\n headerContent: {},\n subheader: {\n display: 'flex',\n },\n }),\n { name: 'BackstageInfoCard' },\n);\n\n/** @public */\nexport type CardActionsTopRightClassKey = 'root';\n\nconst CardActionsTopRight = withStyles(\n theme => ({\n root: {\n display: 'inline-block',\n padding: theme.spacing(8, 8, 0, 0),\n float: 'right',\n },\n }),\n { name: 'BackstageInfoCardCardActionsTopRight' },\n)(CardActions);\n\nconst VARIANT_STYLES = {\n card: {\n flex: {\n display: 'flex',\n flexDirection: 'column',\n },\n fullHeight: {\n display: 'flex',\n flexDirection: 'column',\n height: '100%',\n },\n gridItem: {\n display: 'flex',\n flexDirection: 'column',\n height: 'calc(100% - 10px)', // for pages without content header\n marginBottom: '10px',\n breakInside: 'avoid-page',\n '@media print': {\n height: 'auto',\n },\n },\n },\n cardContent: {\n fullHeight: {\n flex: 1,\n },\n gridItem: {\n flex: 1,\n },\n },\n};\n\n/** @public */\nexport type InfoCardVariants = 'flex' | 'fullHeight' | 'gridItem';\n\n/**\n * InfoCard is used to display a paper-styled block on the screen, similar to a panel.\n *\n * You can custom style an InfoCard with the 'className' (outer container) and 'cardClassName' (inner container)\n * props. This is typically used with the material-ui makeStyles mechanism.\n *\n * The InfoCard serves as an error boundary. As a result, if you provide an 'errorBoundaryProps' property this\n * specifies the extra information to display in the error component that is displayed if an error occurs\n * in any descendent components.\n *\n * By default the InfoCard has no custom layout of its children, but is treated as a block element. A\n * couple common variants are provided and can be specified via the variant property:\n *\n * When the InfoCard is displayed as a grid item within a grid, you may want items to have the same height for all items.\n * Set to the 'gridItem' variant to display the InfoCard with full height suitable for Grid:\n *\n * `<InfoCard variant=\"gridItem\">...</InfoCard>`\n */\nexport type Props = {\n title?: ReactNode;\n subheader?: ReactNode;\n divider?: boolean;\n deepLink?: BottomLinkProps;\n /** @deprecated Use errorBoundaryProps instead */\n slackChannel?: string;\n errorBoundaryProps?: ErrorBoundaryProps;\n variant?: InfoCardVariants;\n alignContent?: 'normal' | 'bottom';\n children?: ReactNode;\n headerStyle?: object;\n headerProps?: CardHeaderProps;\n icon?: ReactNode;\n action?: ReactNode;\n actionsClassName?: string;\n actions?: ReactNode;\n cardClassName?: string;\n actionsTopRight?: ReactNode;\n className?: string;\n noPadding?: boolean;\n titleTypographyProps?: object;\n subheaderTypographyProps?: object;\n};\n\n/**\n * Material-ui card with header , content and actions footer\n *\n * @public\n *\n */\nexport function InfoCard(props: Props): JSX.Element {\n const {\n title,\n subheader,\n divider = true,\n deepLink,\n slackChannel,\n errorBoundaryProps,\n variant,\n alignContent = 'normal',\n children,\n headerStyle,\n headerProps,\n icon,\n action,\n actionsClassName,\n actions,\n cardClassName,\n actionsTopRight,\n className,\n noPadding,\n titleTypographyProps,\n subheaderTypographyProps,\n } = props;\n const classes = useStyles();\n /**\n * If variant is specified, we build up styles for that particular variant for both\n * the Card and the CardContent (since these need to be synced)\n */\n let calculatedStyle = {};\n let calculatedCardStyle = {};\n if (variant) {\n const variants = variant.split(/[\\s]+/g);\n variants.forEach(name => {\n calculatedStyle = {\n ...calculatedStyle,\n ...VARIANT_STYLES.card[name as keyof (typeof VARIANT_STYLES)['card']],\n };\n calculatedCardStyle = {\n ...calculatedCardStyle,\n ...VARIANT_STYLES.cardContent[\n name as keyof (typeof VARIANT_STYLES)['cardContent']\n ],\n };\n });\n }\n\n const cardSubTitle = () => {\n if (!subheader && !icon) {\n return null;\n }\n\n return (\n <div data-testid=\"info-card-subheader\">\n {subheader && <div className={classes.subheader}>{subheader}</div>}\n {icon}\n </div>\n );\n };\n\n const errProps: ErrorBoundaryProps =\n errorBoundaryProps || (slackChannel ? { slackChannel } : {});\n\n return (\n <Card style={calculatedStyle} className={className}>\n <ErrorBoundary {...errProps}>\n {title && (\n <CardHeader\n classes={{\n root: classNames(classes.header),\n title: classes.headerTitle,\n subheader: classes.headerSubheader,\n avatar: classes.headerAvatar,\n action: classes.headerAction,\n content: classes.headerContent,\n }}\n title={title}\n subheader={cardSubTitle()}\n action={action}\n style={{ ...headerStyle }}\n titleTypographyProps={titleTypographyProps}\n subheaderTypographyProps={subheaderTypographyProps}\n {...headerProps}\n />\n )}\n {actionsTopRight && (\n <CardActionsTopRight>{actionsTopRight}</CardActionsTopRight>\n )}\n {divider && <Divider />}\n <CardContent\n className={classNames(cardClassName, {\n [classes.noPadding]: noPadding,\n [classes.contentAlignBottom]: alignContent === 'bottom',\n })}\n style={calculatedCardStyle}\n >\n {children}\n </CardContent>\n {actions && (\n <CardActions className={actionsClassName}>{actions}</CardActions>\n )}\n {deepLink && <BottomLink {...deepLink} />}\n </ErrorBoundary>\n </Card>\n );\n}\n","/*\n * Copyright 2020 The Backstage Authors\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 { ReactNode } from 'react';\nimport { makeStyles, Theme, ThemeProvider } from '@material-ui/core/styles';\nimport classNames from 'classnames';\n\nexport type PageClassKey = 'root';\n\nconst useStyles = makeStyles(\n theme => ({\n root: {\n display: 'grid',\n gridTemplateAreas:\n \"'pageHeader pageHeader pageHeader' 'pageSubheader pageSubheader pageSubheader' 'pageNav pageContent pageSidebar'\",\n gridTemplateRows: 'max-content auto 1fr',\n gridTemplateColumns: 'auto 1fr auto',\n overflowY: 'auto',\n height: '100vh',\n [theme.breakpoints.down('xs')]: {\n height: '100%',\n },\n '@media print': {\n display: 'block',\n height: 'auto',\n overflowY: 'inherit',\n },\n },\n }),\n { name: 'BackstagePage' },\n);\n\ntype Props = {\n themeId: string;\n className?: string;\n children?: ReactNode;\n};\n\nexport function Page(props: Props) {\n const { themeId, className, children } = props;\n const classes = useStyles();\n return (\n <ThemeProvider\n theme={(baseTheme: Theme) => ({\n ...baseTheme,\n page: baseTheme.getPageTheme({ themeId }),\n })}\n >\n <main\n className={classNames(classes.root, className)}\n data-backstage-core-page=\"\"\n >\n {children}\n </main>\n </ThemeProvider>\n );\n}\n"],"names":["LinkWrapper","forwardRef","props","ref","UnstyledLink","LinkButton","MaterialButton","useStyles","makeStyles","SupportIcon","icon","app","useApp","Icon","HelpIcon","SupportLink","link","Link","SupportListItem","item","MenuItem","ListItemIcon","ListItemText","prev","idx","SupportButton","t","useTranslationRef","coreComponentsTranslationRef","title","items","children","configItems","useSupportConfig","popoverOpen","setPopoverOpen","useState","anchorEl","setAnchorEl","classes","supportConfig","useApi","configApiRef","isSmallScreen","useMediaQuery","theme","onClickHandler","event","popoverCloseHandler","Box","IconButton","Button","Popover","MenuList","Boolean","Typography","Children","child","i","DialogActions","GuestUserIdentity","userEntityRef","LegacyUserIdentity","result","token","sub","ent","parseJwtPayload","_header","payload","_signature","JSON","window","UserIdentity","options","identity","authApi","profile","match","TypeError","Error","ex","undefined","GridItem","Grid","loader","apis","apiRef","identityResponse","proxiedSessionSchema","z","ProxiedSignInIdentity","AbortController","backstageIdentity","session","Date","previous","promise","tokenToExpiry","jwtToken","base64","padded","fallback","rawPayload","value","Math","error","baseUrl","mergedHeaders","Headers","response","fetch","ResponseError","getIdentity","useLegacyGuestToken","localStorage","discoveryApiRef","console","confirm","ID_TOKEN_REGEX","useFormStyles","asInputRef","renderResult","rest","IdentityApiSignOutProxy","config","PROVIDER_STORAGE_KEY","signInProviders","Component","onSignInStarted","onSignInSuccess","onSignInFailure","discoveryApi","_","setUseLegacyGuestToken","useLocalStorage","handle","InfoCard","register","handleSubmit","formState","useForm","errors","userId","idToken","FormControl","TextField","FormHelperText","isEmpty","message","errorApi","errorApiRef","handleLogin","ForwardedError","validateIDs","id","providers","MultiSignInPage","titleComponent","align","configApi","loading","providerElements","useSignInProviders","apiHolder","useApiHolder","setLoading","analytics","useAnalytics","searchParams","_setSearchParams","useSearchParams","useMountEffect","errorParam","handleWrappedResult","useCallback","identityApi","useLayoutEffect","selectedProviderId","provider","didCancel","useMemo","Object","key","identityProviders","acc","Progress","Page","Header","Content","ContentHeader","SingleSignInPage","auto","ErrorComponent","setError","showLoginPage","setShowLoginPage","login","checkExisting","showPopup","err","SignInPage","ClickableText","withStyles","StyledBox","BreadcrumbsCurrentPage","Breadcrumbs","restProps","childrenArray","firstPage","secondPage","expandablePages","currentPage","hasHiddenBreadcrumbs","Fragment","MaterialBreadcrumbs","List","pageLink","index","ListItem","className","stretch","noPadding","classNames","ContentHeaderTitle","ContentHeaderDescription","description","TitleComponent","DescriptionComponent","textAlign","renderedTitle","renderedDescription","Helmet","TypeFragment","type","typeLink","pageTitle","TitleFragment","tooltip","contentRef","useContent","FinalTitle","Tooltip","SubtitleFragment","subtitle","pageTitleOverride","style","appTitle","documentTitle","titleTemplate","defaultTitle","BottomLink","onClick","Divider","ArrowIcon","SlackLink","slackChannel","ErrorBoundary","errorInfo","ErrorPanel","CardActionsTopRight","CardActions","subheader","divider","deepLink","errorBoundaryProps","variant","alignContent","headerStyle","headerProps","action","actionsClassName","actions","cardClassName","actionsTopRight","titleTypographyProps","subheaderTypographyProps","calculatedStyle","calculatedCardStyle","variants","name","VARIANT_STYLES","Card","CardHeader","CardContent","themeId","ThemeProvider","baseTheme"],"mappings":"uMAoCA,IAAMA,EAAcC,AAAAA,GAAAA,EAAAA,UAAAA,AAAAA,EAA2B,CAACC,EAAOC,IACrD,UAACC,EAAAA,EAAYA,CAAAA,CAAC,IAAKD,EAAM,GAAGD,CAAK,CAAE,MAAM,S,IAS9BG,EAAaJ,AAAAA,GAAAA,EAAAA,UAAAA,AAAAA,EAAiC,CAACC,EAAOC,IACjE,UAACG,EAAAA,CAAcA,CAAAA,CAAC,IAAKH,EAAK,UAAWH,EAAc,GAAGE,CAAK,A,uRCH7D,IAAMK,EAAYC,AAAAA,GAAAA,EAAAA,CAAAA,AAAAA,EAChB,CACE,YAAa,CACX,SAAU,IACV,SAAU,GACZ,EACA,SAAU,CACR,WAAY,QACd,CACF,EACA,CAAE,KAAM,wBAAyB,GAG7BC,EAAc,CAAC,CAAEC,KAAAA,CAAI,CAAgC,IACzD,IAAMC,EAAMC,AAAAA,GAAAA,EAAAA,CAAAA,AAAAA,IACNC,EAAOH,EAAOC,EAAI,aAAa,CAACD,IAASI,EAAAA,EAAQA,CAAGA,EAAAA,EAAQA,CAClE,M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CAC9B,OAAQ,MACV,EACA,eAAgB,CACd,QAAS,QACT,OAAQ,OACR,UAAW,SACb,CACF,CACF,GACA,CAAE,KAAM,eAAgB,GASnB,SAAS8I,EAAKzL,CAAY,EAC/B,GAAM,CAAE2R,QAAAA,CAAO,CAAEjE,UAAAA,CAAS,CAAE7L,SAAAA,CAAQ,CAAE,CAAG7B,EACnCqC,EAAUhC,IAChB,MACE,UAACuR,EAAAA,CAAaA,CAAAA,CACZ,MAAO,AAACC,GAAsB,EAC5B,GAAGA,CAAS,CACZ,KAAMA,EAAU,YAAY,CAAC,CAAEF,QAAAA,CAAQ,EACzC,G,SAEA,UAAC,QACC,UAAW9D,IAAWxL,EAAQ,IAAI,CAAEqL,GACpC,2BAAyB,G,SAExB7L,C,IAIT,C"}
1
+ {"version":3,"file":"static/3031.f2ee3495211a.chunk.js","sources":["webpack://techdocs-cli-embedded-app/../core-components/src/components/LinkButton/LinkButton.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/components/SupportButton/SupportButton.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/layout/SignInPage/GuestUserIdentity.ts","webpack://techdocs-cli-embedded-app/../core-components/src/layout/SignInPage/LegacyUserIdentity.ts","webpack://techdocs-cli-embedded-app/../core-components/src/layout/SignInPage/UserIdentity.ts","webpack://techdocs-cli-embedded-app/../core-components/src/layout/SignInPage/styles.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/layout/SignInPage/commonProvider.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/layout/ProxiedSignInPage/types.ts","webpack://techdocs-cli-embedded-app/../core-components/src/layout/ProxiedSignInPage/ProxiedSignInIdentity.ts","webpack://techdocs-cli-embedded-app/../core-components/src/layout/SignInPage/guestProvider.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/layout/SignInPage/customProvider.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/layout/SignInPage/IdentityApiSignOutProxy.ts","webpack://techdocs-cli-embedded-app/../core-components/src/layout/SignInPage/providers.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/layout/SignInPage/SignInPage.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/layout/Breadcrumbs/Breadcrumbs.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/layout/Content/Content.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/layout/ContentHeader/ContentHeader.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/layout/Header/Header.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/layout/BottomLink/BottomLink.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/layout/ErrorBoundary/ErrorBoundary.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/layout/InfoCard/InfoCard.tsx","webpack://techdocs-cli-embedded-app/../core-components/src/layout/Page/Page.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\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 MaterialButton, {\n ButtonProps as MaterialButtonProps,\n} from '@material-ui/core/Button';\nimport { forwardRef } from 'react';\nimport { UnstyledLink, LinkProps } from '../Link/Link';\n\n/**\n * Properties for {@link LinkButton}\n *\n * @public\n * @remarks\n *\n * See {@link https://v4.mui.com/api/button/#props | Material UI Button Props} for all properties\n */\nexport type LinkButtonProps = MaterialButtonProps &\n Omit<LinkProps, 'variant' | 'color'>;\n\n/**\n * This wrapper is here to reset the color of the Link and make typescript happy.\n */\nconst LinkWrapper = forwardRef<any, LinkProps>((props, ref) => (\n <UnstyledLink ref={ref} {...props} color=\"initial\" />\n));\n\n/**\n * Thin wrapper on top of material-ui's {@link https://v4.mui.com/components/buttons/ | Button} component\n *\n * @public\n * @remarks\n */\nexport const LinkButton = forwardRef<any, LinkButtonProps>((props, ref) => (\n <MaterialButton ref={ref} component={LinkWrapper} {...props} />\n)) as (props: LinkButtonProps) => JSX.Element;\n\n/**\n * @public\n * @deprecated use LinkButton instead\n */\nexport const Button = LinkButton;\n\n/**\n * @public\n * @deprecated use LinkButtonProps instead\n */\nexport type ButtonProps = LinkButtonProps;\n","/*\n * Copyright 2020 The Backstage Authors\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 { configApiRef, useApi, useApp } from '@backstage/core-plugin-api';\nimport Box from '@material-ui/core/Box';\nimport Button from '@material-ui/core/Button';\nimport DialogActions from '@material-ui/core/DialogActions';\nimport IconButton from '@material-ui/core/IconButton';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport MenuList from '@material-ui/core/MenuList';\nimport Popover from '@material-ui/core/Popover';\nimport { Theme, makeStyles } from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport useMediaQuery from '@material-ui/core/useMediaQuery';\nimport { ReactNode, Children, MouseEventHandler, useState } from 'react';\nimport { SupportItem, SupportItemLink, useSupportConfig } from '../../hooks';\nimport { HelpIcon } from '../../icons';\nimport { Link } from '../Link';\nimport { coreComponentsTranslationRef } from '../../translation';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\n\ntype SupportButtonProps = {\n title?: string;\n items?: SupportItem[];\n children?: ReactNode;\n};\n\nexport type SupportButtonClassKey = 'popoverList';\n\nconst useStyles = makeStyles(\n {\n popoverList: {\n minWidth: 260,\n maxWidth: 400,\n },\n menuItem: {\n whiteSpace: 'normal',\n },\n },\n { name: 'BackstageSupportButton' },\n);\n\nconst SupportIcon = ({ icon }: { icon: string | undefined }) => {\n const app = useApp();\n const Icon = icon ? app.getSystemIcon(icon) ?? HelpIcon : HelpIcon;\n return <Icon />;\n};\n\nconst SupportLink = ({ link }: { link: SupportItemLink }) => (\n <Link to={link.url}>{link.title ?? link.url}</Link>\n);\n\nconst SupportListItem = ({ item }: { item: SupportItem }) => {\n return (\n <MenuItem button={false}>\n <ListItemIcon>\n <SupportIcon icon={item.icon} />\n </ListItemIcon>\n <ListItemText\n primary={item.title}\n secondary={item.links?.reduce<React.ReactNode[]>(\n (prev, link, idx) => [\n ...prev,\n idx > 0 && <br key={idx} />,\n <SupportLink link={link} key={link.url} />,\n ],\n [],\n )}\n />\n </MenuItem>\n );\n};\n\nexport function SupportButton(props: SupportButtonProps) {\n const { t } = useTranslationRef(coreComponentsTranslationRef);\n const { title, items, children } = props;\n const { items: configItems } = useSupportConfig();\n\n const [popoverOpen, setPopoverOpen] = useState(false);\n const [anchorEl, setAnchorEl] = useState<Element | null>(null);\n const classes = useStyles();\n const supportConfig = useApi(configApiRef).getOptionalConfig('app.support');\n const isSmallScreen = useMediaQuery<Theme>(theme =>\n theme.breakpoints.down('sm'),\n );\n\n const onClickHandler: MouseEventHandler = event => {\n setAnchorEl(event.currentTarget);\n setPopoverOpen(true);\n };\n\n const popoverCloseHandler = () => {\n setPopoverOpen(false);\n };\n\n if (!supportConfig) {\n return null;\n }\n\n return (\n <>\n <Box display=\"flex\" ml={1}>\n {isSmallScreen ? (\n <IconButton\n color=\"primary\"\n size=\"small\"\n onClick={onClickHandler}\n data-testid=\"support-button\"\n aria-label=\"Support\"\n >\n <HelpIcon />\n </IconButton>\n ) : (\n <Button\n data-testid=\"support-button\"\n aria-label=\"Support\"\n color=\"primary\"\n onClick={onClickHandler}\n startIcon={<HelpIcon />}\n >\n {t('supportButton.title')}\n </Button>\n )}\n </Box>\n <Popover\n data-testid=\"support-button-popover\"\n open={popoverOpen}\n anchorEl={anchorEl}\n anchorOrigin={{\n vertical: 'bottom',\n horizontal: 'right',\n }}\n transformOrigin={{\n vertical: 'top',\n horizontal: 'right',\n }}\n onClose={popoverCloseHandler}\n >\n <MenuList\n className={classes.popoverList}\n autoFocusItem={Boolean(anchorEl)}\n >\n {title && (\n <MenuItem\n button={false}\n alignItems=\"flex-start\"\n className={classes.menuItem}\n >\n <Typography variant=\"subtitle1\">{title}</Typography>\n </MenuItem>\n )}\n {Children.map(children, (child, i) => (\n <MenuItem\n button={false}\n alignItems=\"flex-start\"\n key={`child-${i}`}\n className={classes.menuItem}\n >\n {child}\n </MenuItem>\n ))}\n {(items ?? configItems).map((item, i) => (\n <SupportListItem item={item} key={`item-${i}`} />\n ))}\n </MenuList>\n <DialogActions>\n <Button\n color=\"primary\"\n onClick={popoverCloseHandler}\n aria-label=\"Close\"\n >\n {t('supportButton.close')}\n </Button>\n </DialogActions>\n </Popover>\n </>\n );\n}\n","/*\n * Copyright 2021 The Backstage Authors\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 {\n IdentityApi,\n ProfileInfo,\n BackstageUserIdentity,\n} from '@backstage/core-plugin-api';\n\n/**\n * @deprecated Use `@backstage/plugin-auth-backend-module-guest-provider` instead.\n */\nexport class GuestUserIdentity implements IdentityApi {\n getUserId(): string {\n return 'guest';\n }\n\n async getIdToken(): Promise<string | undefined> {\n return undefined;\n }\n\n getProfile(): ProfileInfo {\n return {\n email: 'guest@example.com',\n displayName: 'Guest',\n };\n }\n\n async getProfileInfo(): Promise<ProfileInfo> {\n return {\n email: 'guest@example.com',\n displayName: 'Guest',\n };\n }\n\n async getBackstageIdentity(): Promise<BackstageUserIdentity> {\n const userEntityRef = `user:default/guest`;\n return {\n type: 'user',\n userEntityRef,\n ownershipEntityRefs: [userEntityRef],\n };\n }\n\n async getCredentials(): Promise<{ token?: string | undefined }> {\n return {};\n }\n\n async signOut(): Promise<void> {}\n}\n","/*\n * Copyright 2021 The Backstage Authors\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 {\n IdentityApi,\n ProfileInfo,\n BackstageUserIdentity,\n} from '@backstage/core-plugin-api';\n\nfunction parseJwtPayload(token: string) {\n const [_header, payload, _signature] = token.split('.');\n return JSON.parse(window.atob(payload));\n}\n\ntype LegacySignInResult = {\n userId: string;\n profile: ProfileInfo;\n getIdToken?: () => Promise<string>;\n signOut?: () => Promise<void>;\n};\n\n/** @internal */\nexport class LegacyUserIdentity implements IdentityApi {\n private constructor(private readonly result: LegacySignInResult) {}\n\n getUserId(): string {\n return this.result.userId;\n }\n\n static fromResult(result: LegacySignInResult): LegacyUserIdentity {\n return new LegacyUserIdentity(result);\n }\n\n async getIdToken(): Promise<string | undefined> {\n return this.result.getIdToken?.();\n }\n\n getProfile(): ProfileInfo {\n return this.result.profile;\n }\n\n async getProfileInfo(): Promise<ProfileInfo> {\n return this.result.profile;\n }\n\n async getBackstageIdentity(): Promise<BackstageUserIdentity> {\n const token = await this.getIdToken();\n\n if (!token) {\n const userEntityRef = `user:default/${this.getUserId()}`;\n return {\n type: 'user',\n userEntityRef,\n ownershipEntityRefs: [userEntityRef],\n };\n }\n\n const { sub, ent } = parseJwtPayload(token);\n return {\n type: 'user',\n userEntityRef: sub,\n ownershipEntityRefs: ent ?? [],\n };\n }\n\n async getCredentials(): Promise<{ token?: string | undefined }> {\n const token = await this.result.getIdToken?.();\n return { token };\n }\n\n async signOut(): Promise<void> {\n return this.result.signOut?.();\n }\n}\n","/*\n * Copyright 2021 The Backstage Authors\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 {\n IdentityApi,\n ProfileInfo,\n ProfileInfoApi,\n BackstageUserIdentity,\n BackstageIdentityApi,\n SessionApi,\n} from '@backstage/core-plugin-api';\n\nimport { GuestUserIdentity } from './GuestUserIdentity';\nimport { LegacyUserIdentity } from './LegacyUserIdentity';\n\n// TODO(Rugvip): This and the other IdentityApi implementations still implement\n// the old removed methods. This is to allow for backwards compatibility\n// with old plugins that still consume this API. We will leave these in\n// place as a hidden compatibility for a couple of months.\n// The AppIdentityProxy warns in case any of these methods are called.\n\n/**\n * An implementation of the IdentityApi that is constructed using\n * various backstage user identity representations.\n *\n * @public\n */\nexport class UserIdentity implements IdentityApi {\n private profilePromise?: Promise<ProfileInfo>;\n /**\n * Creates a new IdentityApi that acts as a Guest User.\n *\n * @public\n */\n static createGuest(): IdentityApi {\n return new GuestUserIdentity();\n }\n\n /**\n * Creates a new IdentityApi using a legacy SignInResult object.\n *\n * @public\n */\n static fromLegacy(result: {\n /**\n * User ID that will be returned by the IdentityApi\n */\n userId: string;\n\n profile: ProfileInfo;\n\n /**\n * Function used to retrieve an ID token for the signed in user.\n */\n getIdToken?: () => Promise<string>;\n\n /**\n * Sign out handler that will be called if the user requests to sign out.\n */\n signOut?: () => Promise<void>;\n }): IdentityApi {\n return LegacyUserIdentity.fromResult(result);\n }\n\n /**\n * Creates a new IdentityApi implementation using a user identity\n * and an auth API that will be used to request backstage tokens.\n *\n * @public\n */\n static create(options: {\n identity: BackstageUserIdentity;\n authApi: ProfileInfoApi & BackstageIdentityApi & SessionApi;\n /**\n * Passing a profile synchronously allows the deprecated `getProfile` method to be\n * called by consumers of the {@link @backstage/core-plugin-api#IdentityApi}. If you\n * do not have any consumers of that method then this is safe to leave out.\n *\n * @deprecated Only provide this if you have plugins that call the synchronous `getProfile` method, which is also deprecated.\n */\n profile?: ProfileInfo;\n }): IdentityApi {\n return new UserIdentity(options.identity, options.authApi, options.profile);\n }\n\n private readonly identity: BackstageUserIdentity;\n private readonly authApi: ProfileInfoApi & BackstageIdentityApi & SessionApi;\n private readonly profile?: ProfileInfo;\n\n private constructor(\n identity: BackstageUserIdentity,\n authApi: ProfileInfoApi & BackstageIdentityApi & SessionApi,\n profile?: ProfileInfo,\n ) {\n this.identity = identity;\n this.authApi = authApi;\n this.profile = profile;\n }\n\n /** {@inheritdoc @backstage/core-plugin-api#IdentityApi.getUserId} */\n getUserId(): string {\n const ref = this.identity.userEntityRef;\n const match = /^([^:/]+:)?([^:/]+\\/)?([^:/]+)$/.exec(ref);\n if (!match) {\n throw new TypeError(`Invalid user entity reference \"${ref}\"`);\n }\n\n return match[3];\n }\n\n /** {@inheritdoc @backstage/core-plugin-api#IdentityApi.getIdToken} */\n async getIdToken(): Promise<string | undefined> {\n const identity = await this.authApi.getBackstageIdentity();\n return identity!.token;\n }\n\n /** {@inheritdoc @backstage/core-plugin-api#IdentityApi.getProfile} */\n getProfile(): ProfileInfo {\n if (!this.profile) {\n throw new Error(\n 'The identity API does not implement synchronous profile fetching, use getProfileInfo() instead',\n );\n }\n return this.profile;\n }\n\n /** {@inheritdoc @backstage/core-plugin-api#IdentityApi.getProfileInfo} */\n async getProfileInfo(): Promise<ProfileInfo> {\n if (this.profilePromise) {\n return await this.profilePromise;\n }\n\n try {\n this.profilePromise = this.authApi.getProfile() as Promise<ProfileInfo>;\n return await this.profilePromise;\n } catch (ex) {\n this.profilePromise = undefined;\n throw ex;\n }\n }\n\n /** {@inheritdoc @backstage/core-plugin-api#IdentityApi.getBackstageIdentity} */\n async getBackstageIdentity(): Promise<BackstageUserIdentity> {\n return this.identity;\n }\n\n /** {@inheritdoc @backstage/core-plugin-api#IdentityApi.getCredentials} */\n async getCredentials(): Promise<{ token?: string | undefined }> {\n const identity = await this.authApi.getBackstageIdentity();\n return { token: identity!.token };\n }\n\n /** {@inheritdoc @backstage/core-plugin-api#IdentityApi.signOut} */\n async signOut(): Promise<void> {\n return this.authApi.signOut();\n }\n}\n","/*\n * Copyright 2020 The Backstage Authors\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 { makeStyles } from '@material-ui/core/styles';\nimport Grid from '@material-ui/core/Grid';\n\nexport type SignInPageClassKey = 'container' | 'item';\n\nexport const useStyles = makeStyles(\n {\n container: {\n padding: 0,\n listStyle: 'none',\n },\n item: {\n display: 'flex',\n flexDirection: 'column',\n width: '100%',\n maxWidth: '400px',\n margin: 0,\n padding: 0,\n },\n },\n { name: 'BackstageSignInPage' },\n);\n\nexport const GridItem = ({ children }: { children: JSX.Element }) => {\n const classes = useStyles();\n\n return (\n <Grid component=\"li\" item classes={classes}>\n {children}\n </Grid>\n );\n};\n","/*\n * Copyright 2020 The Backstage Authors\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 Typography from '@material-ui/core/Typography';\nimport Button from '@material-ui/core/Button';\nimport { InfoCard } from '../InfoCard/InfoCard';\nimport {\n ProviderComponent,\n ProviderLoader,\n SignInProvider,\n SignInProviderConfig,\n} from './types';\nimport { useApi, errorApiRef } from '@backstage/core-plugin-api';\nimport { GridItem } from './styles';\nimport { ForwardedError } from '@backstage/errors';\nimport { UserIdentity } from './UserIdentity';\nimport { coreComponentsTranslationRef } from '../../translation';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\n\nconst Component: ProviderComponent = ({\n config,\n onSignInStarted,\n onSignInSuccess,\n onSignInFailure,\n}) => {\n const { apiRef, title, message } = config as SignInProviderConfig;\n const authApi = useApi(apiRef);\n const errorApi = useApi(errorApiRef);\n const { t } = useTranslationRef(coreComponentsTranslationRef);\n\n const handleLogin = async () => {\n try {\n onSignInStarted();\n const identityResponse = await authApi.getBackstageIdentity({\n instantPopup: true,\n });\n if (!identityResponse) {\n onSignInFailure();\n throw new Error(\n `The ${title} provider is not configured to support sign-in`,\n );\n }\n\n const profile = await authApi.getProfile();\n\n onSignInSuccess(\n UserIdentity.create({\n identity: identityResponse.identity,\n profile,\n authApi,\n }),\n );\n } catch (error) {\n onSignInFailure();\n errorApi.post(new ForwardedError(t('signIn.loginFailed'), error));\n }\n };\n\n return (\n <GridItem>\n <InfoCard\n variant=\"fullHeight\"\n title={title}\n actions={\n <Button color=\"primary\" variant=\"outlined\" onClick={handleLogin}>\n {t('signIn.title')}\n </Button>\n }\n >\n <Typography variant=\"body1\">{message}</Typography>\n </InfoCard>\n </GridItem>\n );\n};\n\nconst loader: ProviderLoader = async (apis, apiRef) => {\n const authApi = apis.get(apiRef)!;\n\n const identityResponse = await authApi.getBackstageIdentity({\n optional: true,\n });\n\n if (!identityResponse) {\n return undefined;\n }\n\n const profile = await authApi.getProfile();\n\n return UserIdentity.create({\n identity: identityResponse.identity,\n profile,\n authApi,\n });\n};\n\nexport const commonProvider: SignInProvider = { Component, loader };\n","/*\n * Copyright 2021 The Backstage Authors\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 {\n BackstageIdentityResponse,\n ProfileInfo,\n} from '@backstage/core-plugin-api';\nimport { z } from 'zod/v3';\n\nexport const proxiedSessionSchema = z.object({\n providerInfo: z.object({}).catchall(z.unknown()).optional(),\n profile: z.object({\n email: z.string().optional(),\n displayName: z.string().optional(),\n picture: z.string().optional(),\n }),\n backstageIdentity: z.object({\n token: z.string(),\n identity: z.object({\n type: z.literal('user'),\n userEntityRef: z.string(),\n ownershipEntityRefs: z.array(z.string()),\n }),\n }),\n});\n\n/**\n * Generic session information for proxied sign-in providers, e.g. common\n * reverse authenticating proxy implementations.\n *\n * @public\n */\nexport type ProxiedSession = {\n providerInfo?: { [key: string]: unknown };\n profile: ProfileInfo;\n backstageIdentity: Omit<BackstageIdentityResponse, 'id'>;\n};\n","/*\n * Copyright 2021 The Backstage Authors\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 {\n BackstageUserIdentity,\n discoveryApiRef,\n IdentityApi,\n ProfileInfo,\n} from '@backstage/core-plugin-api';\nimport { ResponseError } from '@backstage/errors';\nimport { ProxiedSession, proxiedSessionSchema } from './types';\n\nexport const DEFAULTS = {\n // The amount of time between token refreshes, if we fail to get an actual\n // value out of the exp claim\n defaultTokenExpiryMillis: 5 * 60 * 1000,\n // The amount of time before the actual expiry of the Backstage token, that we\n // shall start trying to get a new one\n tokenExpiryMarginMillis: 5 * 60 * 1000,\n} as const;\n\n// Decodes a base64url-encoded string. JWTs encode their segments using base64url\n// (RFC 7515), which substitutes '-' and '_' for '+' and '/' and omits padding.\n// `window.atob` only accepts standard base64, so translate back to that alphabet\n// and restore the padding before decoding.\nfunction decodeBase64Url(value: string): string {\n const base64 = value.replace(/-/g, '+').replace(/_/g, '/');\n const padded = base64.padEnd(Math.ceil(base64.length / 4) * 4, '=');\n return window.atob(padded);\n}\n\n// When the token expires, with some margin\nexport function tokenToExpiry(jwtToken: string | undefined): Date {\n const fallback = new Date(Date.now() + DEFAULTS.defaultTokenExpiryMillis);\n if (!jwtToken) {\n return fallback;\n }\n\n const [_header, rawPayload, _signature] = jwtToken.split('.');\n const payload = JSON.parse(decodeBase64Url(rawPayload));\n if (typeof payload.exp !== 'number') {\n return fallback;\n }\n\n return new Date(payload.exp * 1000 - DEFAULTS.tokenExpiryMarginMillis);\n}\n\ntype ProxiedSignInIdentityOptions = {\n provider: string;\n discoveryApi: typeof discoveryApiRef.T;\n headers?: HeadersInit | (() => HeadersInit) | (() => Promise<HeadersInit>);\n};\n\ntype State =\n | {\n type: 'empty';\n }\n | {\n type: 'fetching';\n promise: Promise<ProxiedSession>;\n previous: ProxiedSession | undefined;\n }\n | {\n type: 'active';\n session: ProxiedSession;\n expiresAt: Date;\n }\n | {\n type: 'failed';\n error: Error;\n };\n\n/**\n * An identity API that gets the user auth information solely based on a\n * provider's `/refresh` endpoint.\n */\nexport class ProxiedSignInIdentity implements IdentityApi {\n private readonly options: ProxiedSignInIdentityOptions;\n private readonly abortController: AbortController;\n private state: State;\n\n constructor(options: ProxiedSignInIdentityOptions) {\n this.options = options;\n this.abortController = new AbortController();\n this.state = { type: 'empty' };\n }\n\n async start() {\n // Try to make a first fetch, bubble up any errors to the caller\n await this.getSessionAsync();\n }\n\n /** {@inheritdoc @backstage/core-plugin-api#IdentityApi.getUserId} */\n getUserId(): string {\n const { backstageIdentity } = this.getSessionSync();\n const ref = backstageIdentity.identity.userEntityRef;\n const match = /^([^:/]+:)?([^:/]+\\/)?([^:/]+)$/.exec(ref);\n if (!match) {\n throw new TypeError(`Invalid user entity reference \"${ref}\"`);\n }\n\n return match[3];\n }\n\n /** {@inheritdoc @backstage/core-plugin-api#IdentityApi.getIdToken} */\n async getIdToken(): Promise<string | undefined> {\n const session = await this.getSessionAsync();\n return session.backstageIdentity.token;\n }\n\n /** {@inheritdoc @backstage/core-plugin-api#IdentityApi.getProfile} */\n getProfile(): ProfileInfo {\n const session = this.getSessionSync();\n return session.profile;\n }\n\n /** {@inheritdoc @backstage/core-plugin-api#IdentityApi.getProfileInfo} */\n async getProfileInfo(): Promise<ProfileInfo> {\n const session = await this.getSessionAsync();\n return session.profile;\n }\n\n /** {@inheritdoc @backstage/core-plugin-api#IdentityApi.getBackstageIdentity} */\n async getBackstageIdentity(): Promise<BackstageUserIdentity> {\n const session = await this.getSessionAsync();\n return session.backstageIdentity.identity;\n }\n\n /** {@inheritdoc @backstage/core-plugin-api#IdentityApi.getCredentials} */\n async getCredentials(): Promise<{ token?: string | undefined }> {\n const session = await this.getSessionAsync();\n return {\n token: session.backstageIdentity.token,\n };\n }\n\n /** {@inheritdoc @backstage/core-plugin-api#IdentityApi.signOut} */\n async signOut(): Promise<void> {\n this.abortController.abort();\n }\n\n getSessionSync(): ProxiedSession {\n if (this.state.type === 'active') {\n return this.state.session;\n } else if (this.state.type === 'fetching' && this.state.previous) {\n return this.state.previous;\n }\n throw new Error('No session available. Try reloading your browser page.');\n }\n\n async getSessionAsync(): Promise<ProxiedSession> {\n if (this.state.type === 'fetching') {\n return this.state.promise;\n } else if (\n this.state.type === 'active' &&\n new Date() < this.state.expiresAt\n ) {\n return this.state.session;\n }\n\n const previous =\n this.state.type === 'active' ? this.state.session : undefined;\n\n const promise = this.fetchSession().then(\n session => {\n this.state = {\n type: 'active',\n session,\n expiresAt: tokenToExpiry(session.backstageIdentity.token),\n };\n return session;\n },\n error => {\n this.state = {\n type: 'failed',\n error,\n };\n throw error;\n },\n );\n\n this.state = {\n type: 'fetching',\n promise,\n previous,\n };\n\n return promise;\n }\n\n async fetchSession(): Promise<ProxiedSession> {\n const baseUrl = await this.options.discoveryApi.getBaseUrl('auth');\n\n const headers =\n typeof this.options.headers === 'function'\n ? await this.options.headers()\n : this.options.headers;\n const mergedHeaders = new Headers(headers);\n mergedHeaders.set('X-Requested-With', 'XMLHttpRequest');\n\n // Note that we do not use the fetchApi here, since this all happens before\n // sign-in completes so there can be no automatic token injection and\n // similar.\n const response = await fetch(\n `${baseUrl}/${this.options.provider}/refresh`,\n {\n signal: this.abortController.signal,\n headers: mergedHeaders,\n credentials: 'include',\n },\n );\n\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n }\n\n return proxiedSessionSchema.parse(await response.json());\n }\n}\n","/*\n * Copyright 2020 The Backstage Authors\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 Typography from '@material-ui/core/Typography';\nimport Button from '@material-ui/core/Button';\nimport { InfoCard } from '../InfoCard/InfoCard';\nimport { GridItem } from './styles';\nimport { ProviderComponent, ProviderLoader, SignInProvider } from './types';\nimport { ProxiedSignInIdentity } from '../ProxiedSignInPage/ProxiedSignInIdentity';\nimport { discoveryApiRef, useApi } from '@backstage/core-plugin-api';\nimport { GuestUserIdentity } from './GuestUserIdentity';\nimport useLocalStorage from 'react-use/esm/useLocalStorage';\nimport { ResponseError } from '@backstage/errors';\nimport { coreComponentsTranslationRef } from '../../translation';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\n\nconst getIdentity = async (identity: ProxiedSignInIdentity) => {\n try {\n const identityResponse = await identity.getBackstageIdentity();\n return identityResponse;\n } catch (error) {\n if (\n error.name === 'ResponseError' &&\n (error as ResponseError).cause.name === 'NotFoundError'\n ) {\n return undefined;\n }\n throw error;\n }\n};\n\nconst Component: ProviderComponent = ({\n onSignInStarted,\n onSignInSuccess,\n onSignInFailure,\n}) => {\n const discoveryApi = useApi(discoveryApiRef);\n const [_, setUseLegacyGuestToken] = useLocalStorage('enableLegacyGuestToken');\n const { t } = useTranslationRef(coreComponentsTranslationRef);\n\n const handle = async () => {\n onSignInStarted();\n\n const identity = new ProxiedSignInIdentity({\n provider: 'guest',\n discoveryApi,\n });\n\n const identityResponse = await getIdentity(identity).catch(error => {\n // eslint-disable-next-line no-console\n console.warn(`Failed to sign in as a guest, ${error}`);\n return undefined;\n });\n\n if (!identityResponse) {\n // eslint-disable-next-line no-alert\n const useLegacyGuestTokenResponse = confirm(\n 'Failed to sign in as a guest using the auth backend. Do you want to fallback to the legacy guest token?',\n );\n if (useLegacyGuestTokenResponse) {\n setUseLegacyGuestToken(true);\n onSignInSuccess(new GuestUserIdentity());\n return;\n }\n onSignInFailure();\n throw new Error(\n `You cannot sign in as a guest, you must either enable the legacy guest token or configure the auth backend to support guest sign in.`,\n );\n }\n\n onSignInSuccess(identity);\n };\n\n return (\n <GridItem>\n <InfoCard\n title=\"Guest\"\n variant=\"fullHeight\"\n actions={\n <Button color=\"primary\" variant=\"outlined\" onClick={handle}>\n {t('signIn.guestProvider.enter')}\n </Button>\n }\n >\n <Typography variant=\"body1\" style={{ whiteSpace: 'pre-line' }}>\n {t('signIn.guestProvider.subtitle')}\n </Typography>\n </InfoCard>\n </GridItem>\n );\n};\n\nconst loader: ProviderLoader = async apis => {\n const useLegacyGuestToken =\n localStorage.getItem('enableLegacyGuestToken') === 'true';\n\n const identity = new ProxiedSignInIdentity({\n provider: 'guest',\n discoveryApi: apis.get(discoveryApiRef)!,\n });\n const identityResponse = await getIdentity(identity).catch(error => {\n // eslint-disable-next-line no-console\n console.warn(`Failed to sign in as a guest, ${error}`);\n return undefined;\n });\n\n if (!identityResponse && !useLegacyGuestToken) {\n return undefined;\n } else if (identityResponse && useLegacyGuestToken) {\n // eslint-disable-next-line no-alert\n const switchToNewGuestToken = confirm(\n 'You are currently using the legacy guest token, but you have the new guest backend module installed. Do you want to use the new module?',\n );\n if (switchToNewGuestToken) {\n localStorage.removeItem('enableLegacyGuestToken');\n } else {\n return new GuestUserIdentity();\n }\n } else if (useLegacyGuestToken) {\n return new GuestUserIdentity();\n }\n\n return identity;\n};\n\nexport const guestProvider: SignInProvider = { Component, loader };\n","/*\n * Copyright 2020 The Backstage Authors\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 { useForm, UseFormRegisterReturn } from 'react-hook-form';\nimport { makeStyles } from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport Button from '@material-ui/core/Button';\nimport FormControl from '@material-ui/core/FormControl';\nimport TextField from '@material-ui/core/TextField';\nimport FormHelperText from '@material-ui/core/FormHelperText';\nimport isEmpty from 'lodash/isEmpty';\nimport { InfoCard } from '../InfoCard/InfoCard';\nimport { ProviderComponent, ProviderLoader, SignInProvider } from './types';\nimport { GridItem } from './styles';\nimport { UserIdentity } from './UserIdentity';\nimport { coreComponentsTranslationRef } from '../../translation';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\n\n// accept base64url format according to RFC7515 (https://tools.ietf.org/html/rfc7515#section-3)\nconst ID_TOKEN_REGEX = /^[a-z0-9_\\-]+\\.[a-z0-9_\\-]+\\.[a-z0-9_\\-]+$/i;\n\n/** @public */\nexport type CustomProviderClassKey = 'form' | 'button';\n\nconst useFormStyles = makeStyles(\n theme => ({\n form: {\n display: 'flex',\n flexFlow: 'column nowrap',\n },\n button: {\n alignSelf: 'center',\n marginTop: theme.spacing(2),\n },\n subTitle: {\n whiteSpace: 'pre-line',\n },\n }),\n { name: 'BackstageCustomProvider' },\n);\n\ntype Data = {\n userId: string;\n idToken?: string;\n};\n\nconst asInputRef = (renderResult: UseFormRegisterReturn) => {\n const { ref, ...rest } = renderResult;\n return {\n inputRef: ref,\n ...rest,\n };\n};\n\nconst Component: ProviderComponent = ({ onSignInStarted, onSignInSuccess }) => {\n const classes = useFormStyles();\n const { t } = useTranslationRef(coreComponentsTranslationRef);\n const { register, handleSubmit, formState } = useForm<Data>({\n mode: 'onChange',\n });\n\n const { errors } = formState;\n\n const handleResult = ({ userId, idToken }: Data) => {\n onSignInStarted();\n onSignInSuccess(\n UserIdentity.fromLegacy({\n userId,\n getIdToken: idToken !== undefined ? async () => idToken : undefined,\n profile: {\n email: `${userId}@example.com`,\n },\n }),\n );\n };\n\n return (\n <GridItem>\n <InfoCard title={t('signIn.customProvider.title')} variant=\"fullHeight\">\n <Typography variant=\"body1\" className={classes.subTitle}>\n {t('signIn.customProvider.subtitle')}\n </Typography>\n\n <form className={classes.form} onSubmit={handleSubmit(handleResult)}>\n <FormControl>\n <TextField\n {...asInputRef(register('userId', { required: true }))}\n label={t('signIn.customProvider.userId')}\n margin=\"normal\"\n error={Boolean(errors.userId)}\n />\n {errors.userId && (\n <FormHelperText error>{errors.userId.message}</FormHelperText>\n )}\n </FormControl>\n <FormControl>\n <TextField\n {...asInputRef(\n register('idToken', {\n required: false,\n validate: token =>\n !token ||\n ID_TOKEN_REGEX.test(token) ||\n t('signIn.customProvider.tokenInvalid'),\n }),\n )}\n label={t('signIn.customProvider.idToken')}\n margin=\"normal\"\n autoComplete=\"off\"\n error={Boolean(errors.idToken)}\n />\n {errors.idToken && (\n <FormHelperText error>{errors.idToken.message}</FormHelperText>\n )}\n </FormControl>\n <Button\n type=\"submit\"\n color=\"primary\"\n variant=\"outlined\"\n className={classes.button}\n disabled={!formState?.isDirty || !isEmpty(errors)}\n >\n {t('signIn.customProvider.continue')}\n </Button>\n </form>\n </InfoCard>\n </GridItem>\n );\n};\n\n// Custom provider doesn't store credentials\nconst loader: ProviderLoader = async () => undefined;\n\nexport const customProvider: SignInProvider = { Component, loader };\n","/*\n * Copyright 2021 The Backstage Authors\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 {\n BackstageUserIdentity,\n IdentityApi,\n ProfileInfo,\n} from '@backstage/core-plugin-api';\n\n// Similar to the AppIdentityApi we provide backwards compatibility for a limited time\ntype CompatibilityIdentityApi = IdentityApi & {\n getUserId?(): string;\n getIdToken?(): Promise<string | undefined>;\n getProfile?(): ProfileInfo;\n};\n\nexport class IdentityApiSignOutProxy implements IdentityApi {\n private constructor(\n private readonly config: {\n identityApi: CompatibilityIdentityApi;\n signOut: IdentityApi['signOut'];\n },\n ) {}\n\n static from(config: {\n identityApi: CompatibilityIdentityApi;\n signOut: IdentityApi['signOut'];\n }): IdentityApi {\n return new IdentityApiSignOutProxy(config);\n }\n\n getUserId(): string {\n if (!this.config.identityApi.getUserId) {\n throw new Error(`SignOutProxy IdentityApi.getUserId is not implemented`);\n }\n return this.config.identityApi.getUserId();\n }\n\n getIdToken(): Promise<string | undefined> {\n if (!this.config.identityApi.getIdToken) {\n throw new Error(`SignOutProxy IdentityApi.getIdToken is not implemented`);\n }\n return this.config.identityApi.getIdToken();\n }\n\n getProfile(): ProfileInfo {\n if (!this.config.identityApi.getProfile) {\n throw new Error(`SignOutProxy IdentityApi.getProfile is not implemented`);\n }\n return this.config.identityApi.getProfile();\n }\n\n getProfileInfo(): Promise<ProfileInfo> {\n return this.config.identityApi.getProfileInfo();\n }\n\n getBackstageIdentity(): Promise<BackstageUserIdentity> {\n return this.config.identityApi.getBackstageIdentity();\n }\n\n getCredentials(): Promise<{ token?: string | undefined }> {\n return this.config.identityApi.getCredentials();\n }\n\n signOut(): Promise<void> {\n return this.config.signOut();\n }\n}\n","/*\n * Copyright 2020 The Backstage Authors\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 { useLayoutEffect, useState, useMemo, useCallback } from 'react';\nimport {\n SignInPageProps,\n useApi,\n useApiHolder,\n errorApiRef,\n IdentityApi,\n useAnalytics,\n} from '@backstage/core-plugin-api';\nimport {\n IdentityProviders,\n SignInProvider,\n SignInProviderConfig,\n} from './types';\nimport { commonProvider } from './commonProvider';\nimport { guestProvider } from './guestProvider';\nimport { customProvider } from './customProvider';\nimport { IdentityApiSignOutProxy } from './IdentityApiSignOutProxy';\nimport { useSearchParams } from 'react-router-dom';\nimport { useMountEffect } from '@react-hookz/web';\nimport { ForwardedError } from '@backstage/errors';\nimport { coreComponentsTranslationRef } from '../../translation';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\n\nconst PROVIDER_STORAGE_KEY = '@backstage/core:SignInPage:provider';\n\nexport type SignInProviderType = {\n [key: string]: {\n components: SignInProvider;\n id: string;\n config?: SignInProviderConfig;\n };\n};\n\nconst signInProviders: { [key: string]: SignInProvider } = {\n guest: guestProvider,\n custom: customProvider,\n common: commonProvider,\n};\n\nfunction validateIDs(id: string, providers: SignInProviderType): void {\n if (id in providers)\n throw new Error(\n `\"${id}\" ID is duplicated. IDs of identity providers have to be unique.`,\n );\n}\n\nexport function getSignInProviders(\n identityProviders: IdentityProviders,\n): SignInProviderType {\n const providers = identityProviders.reduce(\n (acc: SignInProviderType, config) => {\n if (typeof config === 'string') {\n validateIDs(config, acc);\n acc[config] = { components: signInProviders[config], id: config };\n\n return acc;\n }\n\n const { id } = config as SignInProviderConfig;\n validateIDs(id, acc);\n\n acc[id] = { components: signInProviders.common, id, config };\n\n return acc;\n },\n {},\n );\n\n return providers;\n}\n\nexport const useSignInProviders = (\n providers: SignInProviderType,\n onSignInSuccess: SignInPageProps['onSignInSuccess'],\n) => {\n const errorApi = useApi(errorApiRef);\n const apiHolder = useApiHolder();\n const [loading, setLoading] = useState(true);\n const analytics = useAnalytics();\n\n const { t } = useTranslationRef(coreComponentsTranslationRef);\n // User was redirected back to sign in page with error from auth redirect flow\n const [searchParams, _setSearchParams] = useSearchParams();\n\n useMountEffect(() => {\n const errorParam = searchParams.get('error');\n if (errorParam) {\n errorApi.post(\n new ForwardedError(t('signIn.loginFailed'), new Error(errorParam)),\n );\n }\n });\n\n // This decorates the result with sign out logic from this hook\n const handleWrappedResult = useCallback(\n async (identityApi: IdentityApi) => {\n onSignInSuccess(\n IdentityApiSignOutProxy.from({\n identityApi,\n signOut: async () => {\n localStorage.removeItem(PROVIDER_STORAGE_KEY);\n await identityApi.signOut?.();\n analytics.captureEvent('signOut', 'success');\n },\n }),\n );\n analytics.captureEvent('signIn', 'success');\n },\n [onSignInSuccess, analytics],\n );\n\n // In this effect we check if the user has already selected an existing login\n // provider, and in that case try to load an existing session for the provider.\n useLayoutEffect(() => {\n if (!loading) {\n return undefined;\n }\n\n // We can't use storageApi here, as it might have a dependency on the IdentityApi\n const selectedProviderId = localStorage.getItem(\n PROVIDER_STORAGE_KEY,\n ) as string;\n\n // No provider selected, let the user pick one\n if (selectedProviderId === null) {\n setLoading(false);\n return undefined;\n }\n\n const provider = providers[selectedProviderId];\n if (!provider) {\n setLoading(false);\n return undefined;\n }\n\n let didCancel = false;\n\n provider.components\n .loader(apiHolder, provider.config?.apiRef!)\n .then(result => {\n if (didCancel) {\n localStorage.removeItem(PROVIDER_STORAGE_KEY);\n return;\n }\n if (result) {\n handleWrappedResult(result);\n } else {\n setLoading(false);\n }\n })\n .catch(error => {\n localStorage.removeItem(PROVIDER_STORAGE_KEY);\n if (didCancel) {\n return;\n }\n errorApi.post(error);\n setLoading(false);\n });\n\n return () => {\n didCancel = true;\n };\n }, [\n loading,\n errorApi,\n onSignInSuccess,\n apiHolder,\n providers,\n handleWrappedResult,\n ]);\n\n // This renders all available sign-in providers\n const elements = useMemo(\n () =>\n Object.keys(providers).map(key => {\n const provider = providers[key];\n\n const { Component } = provider.components;\n\n const handleSignInSuccess = (result: IdentityApi) => {\n handleWrappedResult(result);\n };\n\n const handleSignInStarted = () => {\n localStorage.setItem(\n PROVIDER_STORAGE_KEY,\n provider?.config?.id || provider.id,\n );\n };\n\n const handleSignInFailure = () => {\n localStorage.removeItem(PROVIDER_STORAGE_KEY);\n };\n\n return (\n <Component\n key={provider.id}\n config={provider.config!}\n onSignInStarted={handleSignInStarted}\n onSignInSuccess={handleSignInSuccess}\n onSignInFailure={handleSignInFailure}\n />\n );\n }),\n [providers, handleWrappedResult],\n );\n\n return [loading, elements];\n};\n","/*\n * Copyright 2020 The Backstage Authors\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 {\n BackstageIdentityResponse,\n configApiRef,\n SignInPageProps,\n useAnalytics,\n useApi,\n} from '@backstage/core-plugin-api';\nimport { UserIdentity } from './UserIdentity';\nimport Button from '@material-ui/core/Button';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport { ComponentType, ReactNode, useState } from 'react';\nimport { useMountEffect } from '@react-hookz/web';\nimport { Progress } from '../../components/Progress';\nimport { Content } from '../Content/Content';\nimport { ContentHeader } from '../ContentHeader/ContentHeader';\nimport { Header } from '../Header';\nimport { InfoCard } from '../InfoCard';\nimport { Page } from '../Page';\nimport { getSignInProviders, useSignInProviders } from './providers';\nimport { GridItem, useStyles } from './styles';\nimport { IdentityProviders, SignInProviderConfig } from './types';\nimport { coreComponentsTranslationRef } from '../../translation';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { useSearchParams } from 'react-router-dom';\n\ntype CommonSignInPageProps = SignInPageProps & {\n /**\n * Error component to be rendered instead of the default error panel in case\n * sign in fails.\n */\n ErrorComponent?: ComponentType<{ error?: Error }>;\n};\n\ntype MultiSignInPageProps = CommonSignInPageProps & {\n providers: IdentityProviders;\n title?: string;\n titleComponent?: ReactNode;\n align?: 'center' | 'left';\n};\n\ntype SingleSignInPageProps = CommonSignInPageProps & {\n provider: SignInProviderConfig;\n auto?: boolean;\n};\n\nexport type Props = MultiSignInPageProps | SingleSignInPageProps;\n\nexport const MultiSignInPage = ({\n onSignInSuccess,\n providers = [],\n title,\n titleComponent,\n align = 'left',\n}: MultiSignInPageProps) => {\n const configApi = useApi(configApiRef);\n const classes = useStyles();\n\n const signInProviders = getSignInProviders(providers);\n const [loading, providerElements] = useSignInProviders(\n signInProviders,\n onSignInSuccess,\n );\n\n if (loading) {\n return <Progress />;\n }\n\n return (\n <Page themeId=\"home\">\n <Header title={configApi.getString('app.title')} />\n <Content>\n {(title || titleComponent) && (\n <ContentHeader\n title={title}\n titleComponent={titleComponent}\n textAlign={align}\n />\n )}\n <Grid\n container\n justifyContent={align === 'center' ? align : 'flex-start'}\n spacing={2}\n component=\"ul\"\n classes={classes}\n >\n {providerElements}\n </Grid>\n </Content>\n </Page>\n );\n};\n\nexport const SingleSignInPage = ({\n provider,\n auto,\n onSignInSuccess,\n ErrorComponent,\n}: SingleSignInPageProps) => {\n const classes = useStyles();\n const authApi = useApi(provider.apiRef);\n const configApi = useApi(configApiRef);\n const { t } = useTranslationRef(coreComponentsTranslationRef);\n const analytics = useAnalytics();\n\n const [error, setError] = useState<Error>();\n\n // The SignIn component takes some time to decide whether the user is logged-in or not.\n // showLoginPage is used to prevent a glitch-like experience where the sign-in page is\n // displayed for a split second when the user is already logged-in.\n const [showLoginPage, setShowLoginPage] = useState<boolean>(false);\n\n // User was redirected back to sign in page with error from auth redirect flow\n const [searchParams, _setSearchParams] = useSearchParams();\n const errorParam = searchParams.get('error');\n\n type LoginOpts = { checkExisting?: boolean; showPopup?: boolean };\n const login = async ({ checkExisting, showPopup }: LoginOpts) => {\n try {\n let identityResponse: BackstageIdentityResponse | undefined;\n if (checkExisting) {\n // Do an initial check if any logged-in session exists\n identityResponse = await authApi.getBackstageIdentity({\n optional: true,\n });\n }\n\n // If no session exists, show the sign-in page\n if (!identityResponse && (showPopup || auto) && !errorParam) {\n // Unless auto is set to true, this step should not happen.\n // When user intentionally clicks the Sign In button, autoShowPopup is set to true\n setShowLoginPage(true);\n identityResponse = await authApi.getBackstageIdentity({\n instantPopup: true,\n });\n if (!identityResponse) {\n throw new Error(\n `The ${provider.title} provider is not configured to support sign-in`,\n );\n }\n }\n\n if (!identityResponse) {\n setShowLoginPage(true);\n return;\n }\n\n const profile = await authApi.getProfile();\n onSignInSuccess(\n UserIdentity.create({\n identity: identityResponse.identity,\n authApi,\n profile,\n }),\n );\n analytics.captureEvent('signIn', 'success');\n } catch (err: any) {\n // User closed the sign-in modal\n setError(err);\n setShowLoginPage(true);\n }\n };\n\n useMountEffect(() => {\n if (errorParam) {\n setError(new Error(errorParam));\n }\n login({ checkExisting: true });\n });\n\n return showLoginPage ? (\n <Page themeId=\"home\">\n <Header title={configApi.getString('app.title')} />\n <Content>\n <Grid\n container\n justifyContent=\"center\"\n spacing={2}\n component=\"ul\"\n classes={classes}\n >\n <GridItem>\n <InfoCard\n variant=\"fullHeight\"\n title={provider.title}\n actions={\n <Button\n color=\"primary\"\n variant=\"outlined\"\n onClick={() => {\n login({ showPopup: true });\n }}\n >\n {t('signIn.title')}\n </Button>\n }\n >\n <Typography variant=\"body1\">{provider.message}</Typography>\n {error &&\n error.name !== 'PopupRejectedError' &&\n (ErrorComponent ? (\n <ErrorComponent error={error} />\n ) : (\n <Typography variant=\"body1\" color=\"error\">\n {error.message}\n </Typography>\n ))}\n </InfoCard>\n </GridItem>\n </Grid>\n </Content>\n </Page>\n ) : (\n <Progress />\n );\n};\n\nexport function SignInPage(props: Props) {\n if ('provider' in props) {\n return <SingleSignInPage {...props} />;\n }\n\n return <MultiSignInPage {...props} />;\n}\n","/*\n * Copyright 2020 The Backstage Authors\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 Box from '@material-ui/core/Box';\nimport MaterialBreadcrumbs from '@material-ui/core/Breadcrumbs';\nimport List from '@material-ui/core/List';\nimport ListItem from '@material-ui/core/ListItem';\nimport Popover from '@material-ui/core/Popover';\nimport { withStyles } from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport {\n MouseEvent,\n useState,\n Children,\n ComponentProps,\n Fragment,\n} from 'react';\n\ntype Props = ComponentProps<typeof MaterialBreadcrumbs>;\n\n/** @public */\nexport type BreadcrumbsClickableTextClassKey = 'root';\n\nconst ClickableText = withStyles(\n {\n root: {\n textDecoration: 'underline',\n cursor: 'pointer',\n },\n },\n { name: 'BackstageBreadcrumbsClickableText' },\n)(Typography);\n\n/** @public */\nexport type BreadcrumbsStyledBoxClassKey = 'root';\n\nconst StyledBox = withStyles(\n {\n root: {\n textDecoration: 'underline',\n color: 'inherit',\n },\n },\n { name: 'BackstageBreadcrumbsStyledBox' },\n)(Box);\n\n/** @public */\nexport type BreadcrumbsCurrentPageClassKey = 'root';\n\nconst BreadcrumbsCurrentPage = withStyles(\n {\n root: {\n fontStyle: 'italic',\n },\n },\n { name: 'BreadcrumbsCurrentPage' },\n)(Box);\n\n/**\n * Breadcrumbs component to show navigation hierarchical structure\n *\n * @public\n *\n */\nexport function Breadcrumbs(props: Props) {\n const { children, ...restProps } = props;\n const [anchorEl, setAnchorEl] = useState<HTMLButtonElement | null>(null);\n\n const childrenArray = Children.toArray(children);\n\n const [firstPage, secondPage, ...expandablePages] = childrenArray;\n const currentPage = expandablePages.length\n ? expandablePages.pop()\n : childrenArray[childrenArray.length - 1];\n const hasHiddenBreadcrumbs = childrenArray.length > 3;\n\n const handleClick = (event: MouseEvent<HTMLButtonElement>) => {\n setAnchorEl(event.currentTarget);\n };\n\n const handleClose = () => {\n setAnchorEl(null);\n };\n\n const open = Boolean(anchorEl);\n return (\n <Fragment>\n <MaterialBreadcrumbs aria-label=\"breadcrumb\" {...restProps}>\n {childrenArray.length > 1 && <StyledBox clone>{firstPage}</StyledBox>}\n {childrenArray.length > 2 && <StyledBox clone>{secondPage}</StyledBox>}\n {hasHiddenBreadcrumbs && (\n <ClickableText onClick={handleClick}>...</ClickableText>\n )}\n <BreadcrumbsCurrentPage>{currentPage}</BreadcrumbsCurrentPage>\n </MaterialBreadcrumbs>\n <Popover\n open={open}\n anchorEl={anchorEl}\n onClose={handleClose}\n anchorOrigin={{\n vertical: 'bottom',\n horizontal: 'left',\n }}\n transformOrigin={{\n vertical: 'top',\n horizontal: 'left',\n }}\n >\n <List>\n {expandablePages.map((pageLink, index) => (\n <ListItem key={index} button>\n <StyledBox clone>{pageLink}</StyledBox>\n </ListItem>\n ))}\n </List>\n </Popover>\n </Fragment>\n );\n}\n","/*\n * Copyright 2020 The Backstage Authors\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 { makeStyles, Theme } from '@material-ui/core/styles';\nimport classNames from 'classnames';\nimport { PropsWithChildren } from 'react';\n\n/** @public */\nexport type BackstageContentClassKey = 'root' | 'stretch' | 'noPadding';\n\nconst useStyles = makeStyles(\n (theme: Theme) => ({\n root: {\n gridArea: 'pageContent',\n minWidth: 0,\n paddingTop: theme.spacing(3),\n paddingBottom: theme.spacing(3),\n paddingLeft: theme.spacing(2),\n paddingRight: theme.spacing(2),\n [theme.breakpoints.up('sm')]: {\n paddingLeft: theme.spacing(3),\n paddingRight: theme.spacing(3),\n },\n },\n stretch: {\n display: 'flex',\n flexDirection: 'column',\n flexGrow: 1,\n },\n noPadding: {\n padding: 0,\n },\n }),\n { name: 'BackstageContent' },\n);\n\ntype Props = {\n stretch?: boolean;\n noPadding?: boolean;\n className?: string;\n};\n\n/**\n * The main content part inside a {@link Page}.\n *\n * @public\n *\n */\n\nexport function Content(props: PropsWithChildren<Props>) {\n const { className, stretch, noPadding, children, ...restProps } = props;\n\n const classes = useStyles();\n return (\n <article\n {...restProps}\n className={classNames(classes.root, className, {\n [classes.stretch]: stretch,\n [classes.noPadding]: noPadding,\n })}\n >\n {children}\n </article>\n );\n}\n","/*\n * Copyright 2020 The Backstage Authors\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 Box from '@material-ui/core/Box';\nimport { makeStyles } from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport { PropsWithChildren, ReactNode } from 'react';\nimport { Helmet } from 'react-helmet';\n\n/**\n * TODO: favoriteable capability\n */\n\n/** @public */\nexport type ContentHeaderClassKey =\n | 'container'\n | 'leftItemsBox'\n | 'rightItemsBox'\n | 'description'\n | 'title';\n\nconst useStyles = (props: ContentHeaderProps) =>\n makeStyles(\n theme => ({\n container: {\n width: '100%',\n display: 'flex',\n flexDirection: 'row',\n flexWrap: 'wrap',\n justifyContent: 'flex-end',\n alignItems: 'center',\n marginBottom: theme.spacing(2),\n textAlign: props.textAlign,\n },\n leftItemsBox: {\n flex: '1 1 auto',\n minWidth: 0,\n overflow: 'visible',\n },\n rightItemsBox: {\n flex: '0 1 auto',\n display: 'flex',\n flexDirection: 'row',\n flexWrap: 'wrap',\n alignItems: 'center',\n marginLeft: theme.spacing(1),\n minWidth: 0,\n overflow: 'visible',\n },\n description: {},\n title: {\n display: 'inline-flex',\n marginBottom: 0,\n },\n }),\n { name: 'BackstageContentHeader' },\n );\n\ntype ContentHeaderTitleProps = {\n title?: string;\n className?: string;\n};\n\nconst ContentHeaderTitle = ({ title, className }: ContentHeaderTitleProps) => (\n <Typography\n variant=\"h4\"\n component=\"h2\"\n className={className}\n data-testid=\"header-title\"\n >\n {title}\n </Typography>\n);\n\ntype ContentHeaderDescriptionProps = {\n description?: string;\n className?: string;\n};\n\nconst ContentHeaderDescription = ({\n description,\n className,\n}: ContentHeaderDescriptionProps) =>\n description ? (\n <Typography\n variant=\"body2\"\n className={className}\n data-testid=\"header-description\"\n >\n {description}\n </Typography>\n ) : null;\n\ntype ContentHeaderProps = {\n title?: ContentHeaderTitleProps['title'];\n titleComponent?: ReactNode;\n description?: ContentHeaderDescriptionProps['description'];\n descriptionComponent?: ReactNode;\n textAlign?: 'left' | 'right' | 'center';\n};\n\n/**\n * A header at the top inside a {@link Content}.\n *\n * @public\n *\n */\n\nexport function ContentHeader(props: PropsWithChildren<ContentHeaderProps>) {\n const {\n description,\n title,\n titleComponent: TitleComponent = undefined,\n children,\n descriptionComponent: DescriptionComponent = undefined,\n textAlign = 'left',\n } = props;\n const classes = useStyles({ textAlign })();\n\n const renderedTitle = TitleComponent ? (\n TitleComponent\n ) : (\n <ContentHeaderTitle title={title} className={classes.title} />\n );\n\n const renderedDescription = DescriptionComponent ? (\n DescriptionComponent\n ) : (\n <ContentHeaderDescription\n description={description}\n className={classes.description}\n />\n );\n\n return (\n <>\n <Helmet title={title} />\n <Box className={classes.container}>\n <Box className={classes.leftItemsBox}>\n {renderedTitle}\n {renderedDescription}\n </Box>\n <Box className={classes.rightItemsBox}>{children}</Box>\n </Box>\n </>\n );\n}\n","/*\n * Copyright 2020 The Backstage Authors\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 { configApiRef, useApi } from '@backstage/core-plugin-api';\nimport Box from '@material-ui/core/Box';\nimport Grid from '@material-ui/core/Grid';\nimport { makeStyles } from '@material-ui/core/styles';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport Typography from '@material-ui/core/Typography';\nimport { CSSProperties, PropsWithChildren, ReactNode } from 'react';\nimport { Helmet } from 'react-helmet';\nimport { Link } from '../../components/Link';\nimport { Breadcrumbs } from '../Breadcrumbs';\nimport { useContent } from '../Sidebar';\n\n/** @public */\nexport type HeaderClassKey =\n | 'header'\n | 'leftItemsBox'\n | 'rightItemsBox'\n | 'title'\n | 'subtitle'\n | 'type'\n | 'breadcrumb'\n | 'breadcrumbType'\n | 'breadcrumbTitle';\n\nconst useStyles = makeStyles(\n theme => ({\n header: {\n gridArea: 'pageHeader',\n padding: theme.spacing(3),\n width: '100%',\n boxShadow: theme.shadows[4],\n position: 'relative',\n zIndex: 100,\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n backgroundImage: theme.page.backgroundImage,\n backgroundPosition: 'center',\n backgroundSize: 'cover',\n [theme.breakpoints.down('sm')]: {\n flexWrap: 'wrap',\n },\n },\n leftItemsBox: {\n maxWidth: '100%',\n flexGrow: 1,\n },\n rightItemsBox: {\n width: 'auto',\n alignItems: 'center',\n },\n title: {\n color: theme.page.fontColor,\n wordBreak: 'break-word',\n fontSize: theme.typography.h3.fontSize,\n marginBottom: 0,\n },\n subtitle: {\n color: theme.page.fontColor,\n opacity: 0.8,\n display: 'inline-block', // prevents margin collapse of adjacent siblings\n marginTop: theme.spacing(1),\n maxWidth: '75ch',\n },\n type: {\n textTransform: 'uppercase',\n fontSize: 11,\n opacity: 0.8,\n marginBottom: theme.spacing(1),\n color: theme.page.fontColor,\n },\n breadcrumb: {\n color: theme.page.fontColor,\n },\n breadcrumbType: {\n fontSize: 'inherit',\n opacity: 0.7,\n marginRight: -theme.spacing(0.3),\n marginBottom: theme.spacing(0.3),\n },\n breadcrumbTitle: {\n fontSize: 'inherit',\n marginLeft: -theme.spacing(0.3),\n marginBottom: theme.spacing(0.3),\n },\n }),\n { name: 'BackstageHeader' },\n);\n\ntype HeaderStyles = ReturnType<typeof useStyles>;\n\ntype Props = {\n component?: ReactNode;\n pageTitleOverride?: string;\n style?: CSSProperties;\n subtitle?: ReactNode;\n title: ReactNode;\n tooltip?: string;\n type?: string;\n typeLink?: string;\n};\n\ntype TypeFragmentProps = {\n classes: HeaderStyles;\n pageTitle: string | ReactNode;\n type?: Props['type'];\n typeLink?: Props['typeLink'];\n};\n\ntype TitleFragmentProps = {\n classes: HeaderStyles;\n pageTitle: string | ReactNode;\n tooltip?: Props['tooltip'];\n};\n\ntype SubtitleFragmentProps = {\n classes: HeaderStyles;\n subtitle?: Props['subtitle'];\n};\n\nconst TypeFragment = ({\n type,\n typeLink,\n classes,\n pageTitle,\n}: TypeFragmentProps) => {\n if (!type) {\n return null;\n }\n\n if (!typeLink) {\n return <Typography className={classes.type}>{type}</Typography>;\n }\n\n return (\n <Breadcrumbs className={classes.breadcrumb}>\n <Link to={typeLink}>{type}</Link>\n <Typography>{pageTitle}</Typography>\n </Breadcrumbs>\n );\n};\n\nconst TitleFragment = ({ pageTitle, classes, tooltip }: TitleFragmentProps) => {\n const { contentRef } = useContent();\n\n const FinalTitle = (\n <Typography\n ref={contentRef}\n tabIndex={-1}\n className={classes.title}\n variant=\"h1\"\n >\n {pageTitle}\n </Typography>\n );\n\n if (!tooltip) {\n return FinalTitle;\n }\n\n return (\n <Tooltip title={tooltip} placement=\"top-start\">\n {FinalTitle}\n </Tooltip>\n );\n};\n\nconst SubtitleFragment = ({ classes, subtitle }: SubtitleFragmentProps) => {\n if (!subtitle) {\n return null;\n }\n\n if (typeof subtitle !== 'string') {\n return <>{subtitle}</>;\n }\n\n return (\n <Typography\n className={classes.subtitle}\n variant=\"subtitle2\"\n component=\"span\"\n >\n {subtitle}\n </Typography>\n );\n};\n/**\n * Backstage main header with abstract color background in multiple variants\n *\n * @public\n *\n */\nexport function Header(props: PropsWithChildren<Props>) {\n const {\n children,\n pageTitleOverride,\n style,\n subtitle,\n title,\n tooltip,\n type,\n typeLink,\n } = props;\n const classes = useStyles();\n const configApi = useApi(configApiRef);\n const appTitle = configApi.getOptionalString('app.title') || 'Backstage';\n const documentTitle = pageTitleOverride || title;\n const pageTitle = title || pageTitleOverride;\n const titleTemplate = `${documentTitle} | %s | ${appTitle}`;\n const defaultTitle = `${documentTitle} | ${appTitle}`;\n\n return (\n <>\n <Helmet titleTemplate={titleTemplate} defaultTitle={defaultTitle} />\n <header\n style={style}\n className={classes.header}\n data-backstage-core-header=\"\"\n >\n <Box className={classes.leftItemsBox}>\n <TypeFragment\n classes={classes}\n type={type}\n typeLink={typeLink}\n pageTitle={pageTitle}\n />\n <TitleFragment\n classes={classes}\n pageTitle={pageTitle}\n tooltip={tooltip}\n />\n <SubtitleFragment classes={classes} subtitle={subtitle} />\n </Box>\n <Grid container className={classes.rightItemsBox} spacing={4}>\n {children}\n </Grid>\n </header>\n </>\n );\n}\n","/*\n * Copyright 2020 The Backstage Authors\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 Box from '@material-ui/core/Box';\nimport Divider from '@material-ui/core/Divider';\nimport { makeStyles } from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport ArrowIcon from '@material-ui/icons/ArrowForward';\nimport { MouseEvent } from 'react';\nimport { Link } from '../../components/Link';\n\n/** @public */\nexport type BottomLinkClassKey = 'root' | 'boxTitle' | 'arrow';\n\nconst useStyles = makeStyles(\n theme => ({\n root: {\n maxWidth: 'fit-content',\n padding: theme.spacing(2, 2, 2, 2.5),\n },\n boxTitle: {\n margin: 0,\n color: theme.palette.textSubtle,\n },\n arrow: {\n color: theme.palette.textSubtle,\n },\n }),\n { name: 'BackstageBottomLink' },\n);\n\n/** @public */\nexport type BottomLinkProps = {\n link: string;\n title: string;\n onClick?: (event: MouseEvent<HTMLAnchorElement>) => void;\n};\n\n/**\n * Footer with link used in {@link InfoCard } and {@link TabbedCard}\n *\n * @public\n *\n */\nexport function BottomLink(props: BottomLinkProps) {\n const { link, title, onClick } = props;\n const classes = useStyles();\n\n return (\n <Box>\n <Divider />\n <Link to={link} onClick={onClick} underline=\"none\">\n <Box display=\"flex\" alignItems=\"center\" className={classes.root}>\n <Box className={classes.boxTitle} fontWeight=\"fontWeightBold\" m={1}>\n <Typography>\n <strong>{title}</strong>\n </Typography>\n </Box>\n <ArrowIcon className={classes.arrow} />\n </Box>\n </Link>\n </Box>\n );\n}\n","/*\n * Copyright 2020 The Backstage Authors\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 Typography from '@material-ui/core/Typography';\nimport { PropsWithChildren, ComponentClass, Component, ErrorInfo } from 'react';\nimport { LinkButton } from '../../components/LinkButton';\nimport { ErrorPanel } from '../../components/ErrorPanel';\nimport { coreComponentsTranslationRef } from '../../translation';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\n\ntype SlackChannel = {\n name: string;\n href?: string;\n};\n\n/** @public */\nexport type ErrorBoundaryProps = PropsWithChildren<{\n slackChannel?: string | SlackChannel;\n onError?: (error: Error, errorInfo: string) => null;\n}>;\n\ntype State = {\n error?: Error;\n errorInfo?: ErrorInfo;\n};\n\nconst SlackLink = (props: { slackChannel?: string | SlackChannel }) => {\n const { slackChannel } = props;\n const { t } = useTranslationRef(coreComponentsTranslationRef);\n\n if (!slackChannel) {\n return null;\n } else if (typeof slackChannel === 'string') {\n return (\n <Typography>{t('errorBoundary.title', { slackChannel })}</Typography>\n );\n } else if (!slackChannel.href) {\n return (\n <Typography>\n {t('errorBoundary.title', {\n slackChannel: slackChannel.name,\n })}\n </Typography>\n );\n }\n\n return (\n <LinkButton to={slackChannel.href} variant=\"contained\">\n {slackChannel.name}\n </LinkButton>\n );\n};\n\n/** @public */\nexport const ErrorBoundary: ComponentClass<\n ErrorBoundaryProps,\n State\n> = class ErrorBoundary extends Component<ErrorBoundaryProps, State> {\n constructor(props: ErrorBoundaryProps) {\n super(props);\n this.state = {\n error: undefined,\n errorInfo: undefined,\n };\n }\n\n componentDidCatch(error: Error, errorInfo: ErrorInfo) {\n // eslint-disable-next-line no-console\n console.error(`ErrorBoundary, error: ${error}`, { error, errorInfo });\n this.setState({ error, errorInfo });\n }\n\n render() {\n const { slackChannel, children } = this.props;\n const { error } = this.state;\n\n if (!error) {\n return children;\n }\n\n return (\n <ErrorPanel title=\"Something Went Wrong\" error={error}>\n <SlackLink slackChannel={slackChannel} />\n </ErrorPanel>\n );\n }\n};\n","/*\n * Copyright 2020 The Backstage Authors\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 Card from '@material-ui/core/Card';\nimport CardActions from '@material-ui/core/CardActions';\nimport CardContent from '@material-ui/core/CardContent';\nimport CardHeader, { CardHeaderProps } from '@material-ui/core/CardHeader';\nimport Divider from '@material-ui/core/Divider';\nimport { makeStyles, withStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\nimport { ReactNode } from 'react';\nimport { BottomLink, BottomLinkProps } from '../BottomLink';\nimport { ErrorBoundary, ErrorBoundaryProps } from '../ErrorBoundary';\n\n/** @public */\nexport type InfoCardClassKey =\n | 'noPadding'\n | 'header'\n | 'headerTitle'\n | 'headerSubheader'\n | 'headerAvatar'\n | 'headerAction'\n | 'headerContent';\n\nconst useStyles = makeStyles(\n theme => ({\n noPadding: {\n padding: 0,\n '&:last-child': {\n paddingBottom: 0,\n },\n },\n contentAlignBottom: {\n display: 'flex',\n alignItems: 'self-end',\n },\n header: {\n padding: theme.spacing(2, 2, 2, 2.5),\n },\n headerTitle: {\n fontWeight: theme.typography.fontWeightBold,\n },\n headerSubheader: {\n paddingTop: theme.spacing(1),\n },\n headerAvatar: {},\n headerAction: {},\n headerContent: {},\n subheader: {\n display: 'flex',\n },\n }),\n { name: 'BackstageInfoCard' },\n);\n\n/** @public */\nexport type CardActionsTopRightClassKey = 'root';\n\nconst CardActionsTopRight = withStyles(\n theme => ({\n root: {\n display: 'inline-block',\n padding: theme.spacing(8, 8, 0, 0),\n float: 'right',\n },\n }),\n { name: 'BackstageInfoCardCardActionsTopRight' },\n)(CardActions);\n\nconst VARIANT_STYLES = {\n card: {\n flex: {\n display: 'flex',\n flexDirection: 'column',\n },\n fullHeight: {\n display: 'flex',\n flexDirection: 'column',\n height: '100%',\n },\n gridItem: {\n display: 'flex',\n flexDirection: 'column',\n height: 'calc(100% - 10px)', // for pages without content header\n marginBottom: '10px',\n breakInside: 'avoid-page',\n '@media print': {\n height: 'auto',\n },\n },\n },\n cardContent: {\n fullHeight: {\n flex: 1,\n },\n gridItem: {\n flex: 1,\n },\n },\n};\n\n/** @public */\nexport type InfoCardVariants = 'flex' | 'fullHeight' | 'gridItem';\n\n/**\n * InfoCard is used to display a paper-styled block on the screen, similar to a panel.\n *\n * You can custom style an InfoCard with the 'className' (outer container) and 'cardClassName' (inner container)\n * props. This is typically used with the material-ui makeStyles mechanism.\n *\n * The InfoCard serves as an error boundary. As a result, if you provide an 'errorBoundaryProps' property this\n * specifies the extra information to display in the error component that is displayed if an error occurs\n * in any descendent components.\n *\n * By default the InfoCard has no custom layout of its children, but is treated as a block element. A\n * couple common variants are provided and can be specified via the variant property:\n *\n * When the InfoCard is displayed as a grid item within a grid, you may want items to have the same height for all items.\n * Set to the 'gridItem' variant to display the InfoCard with full height suitable for Grid:\n *\n * `<InfoCard variant=\"gridItem\">...</InfoCard>`\n */\nexport type Props = {\n title?: ReactNode;\n subheader?: ReactNode;\n divider?: boolean;\n deepLink?: BottomLinkProps;\n /** @deprecated Use errorBoundaryProps instead */\n slackChannel?: string;\n errorBoundaryProps?: ErrorBoundaryProps;\n variant?: InfoCardVariants;\n alignContent?: 'normal' | 'bottom';\n children?: ReactNode;\n headerStyle?: object;\n headerProps?: CardHeaderProps;\n icon?: ReactNode;\n action?: ReactNode;\n actionsClassName?: string;\n actions?: ReactNode;\n cardClassName?: string;\n actionsTopRight?: ReactNode;\n className?: string;\n noPadding?: boolean;\n titleTypographyProps?: object;\n subheaderTypographyProps?: object;\n};\n\n/**\n * Material-ui card with header , content and actions footer\n *\n * @public\n *\n */\nexport function InfoCard(props: Props): JSX.Element {\n const {\n title,\n subheader,\n divider = true,\n deepLink,\n slackChannel,\n errorBoundaryProps,\n variant,\n alignContent = 'normal',\n children,\n headerStyle,\n headerProps,\n icon,\n action,\n actionsClassName,\n actions,\n cardClassName,\n actionsTopRight,\n className,\n noPadding,\n titleTypographyProps,\n subheaderTypographyProps,\n } = props;\n const classes = useStyles();\n /**\n * If variant is specified, we build up styles for that particular variant for both\n * the Card and the CardContent (since these need to be synced)\n */\n let calculatedStyle = {};\n let calculatedCardStyle = {};\n if (variant) {\n const variants = variant.split(/[\\s]+/g);\n variants.forEach(name => {\n calculatedStyle = {\n ...calculatedStyle,\n ...VARIANT_STYLES.card[name as keyof (typeof VARIANT_STYLES)['card']],\n };\n calculatedCardStyle = {\n ...calculatedCardStyle,\n ...VARIANT_STYLES.cardContent[\n name as keyof (typeof VARIANT_STYLES)['cardContent']\n ],\n };\n });\n }\n\n const cardSubTitle = () => {\n if (!subheader && !icon) {\n return null;\n }\n\n return (\n <div data-testid=\"info-card-subheader\">\n {subheader && <div className={classes.subheader}>{subheader}</div>}\n {icon}\n </div>\n );\n };\n\n const errProps: ErrorBoundaryProps =\n errorBoundaryProps || (slackChannel ? { slackChannel } : {});\n\n return (\n <Card style={calculatedStyle} className={className}>\n <ErrorBoundary {...errProps}>\n {title && (\n <CardHeader\n classes={{\n root: classNames(classes.header),\n title: classes.headerTitle,\n subheader: classes.headerSubheader,\n avatar: classes.headerAvatar,\n action: classes.headerAction,\n content: classes.headerContent,\n }}\n title={title}\n subheader={cardSubTitle()}\n action={action}\n style={{ ...headerStyle }}\n titleTypographyProps={titleTypographyProps}\n subheaderTypographyProps={subheaderTypographyProps}\n {...headerProps}\n />\n )}\n {actionsTopRight && (\n <CardActionsTopRight>{actionsTopRight}</CardActionsTopRight>\n )}\n {divider && <Divider />}\n <CardContent\n className={classNames(cardClassName, {\n [classes.noPadding]: noPadding,\n [classes.contentAlignBottom]: alignContent === 'bottom',\n })}\n style={calculatedCardStyle}\n >\n {children}\n </CardContent>\n {actions && (\n <CardActions className={actionsClassName}>{actions}</CardActions>\n )}\n {deepLink && <BottomLink {...deepLink} />}\n </ErrorBoundary>\n </Card>\n );\n}\n","/*\n * Copyright 2020 The Backstage Authors\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 { ReactNode } from 'react';\nimport { makeStyles, Theme, ThemeProvider } from '@material-ui/core/styles';\nimport classNames from 'classnames';\n\nexport type PageClassKey = 'root';\n\nconst useStyles = makeStyles(\n theme => ({\n root: {\n display: 'grid',\n gridTemplateAreas:\n \"'pageHeader pageHeader pageHeader' 'pageSubheader pageSubheader pageSubheader' 'pageNav pageContent pageSidebar'\",\n gridTemplateRows: 'max-content auto 1fr',\n gridTemplateColumns: 'auto 1fr auto',\n overflowY: 'auto',\n height: '100vh',\n [theme.breakpoints.down('xs')]: {\n height: '100%',\n },\n '@media print': {\n display: 'block',\n height: 'auto',\n overflowY: 'inherit',\n },\n },\n }),\n { name: 'BackstagePage' },\n);\n\ntype Props = {\n themeId: string;\n className?: string;\n children?: ReactNode;\n};\n\nexport function Page(props: Props) {\n const { themeId, className, children } = props;\n const classes = useStyles();\n return (\n <ThemeProvider\n theme={(baseTheme: Theme) => ({\n ...baseTheme,\n page: baseTheme.getPageTheme({ themeId }),\n })}\n >\n <main\n className={classNames(classes.root, className)}\n data-backstage-core-page=\"\"\n >\n {children}\n </main>\n </ThemeProvider>\n );\n}\n"],"names":["LinkWrapper","forwardRef","props","ref","UnstyledLink","LinkButton","MaterialButton","useStyles","makeStyles","SupportIcon","icon","app","useApp","Icon","HelpIcon","SupportLink","link","Link","SupportListItem","item","MenuItem","ListItemIcon","ListItemText","prev","idx","SupportButton","t","useTranslationRef","coreComponentsTranslationRef","title","items","children","configItems","useSupportConfig","popoverOpen","setPopoverOpen","useState","anchorEl","setAnchorEl","classes","supportConfig","useApi","configApiRef","isSmallScreen","useMediaQuery","theme","onClickHandler","event","popoverCloseHandler","Box","IconButton","Button","Popover","MenuList","Boolean","Typography","Children","child","i","DialogActions","GuestUserIdentity","userEntityRef","LegacyUserIdentity","result","token","sub","ent","parseJwtPayload","_header","payload","_signature","JSON","window","UserIdentity","options","identity","authApi","profile","match","TypeError","Error","ex","undefined","GridItem","Grid","loader","apis","apiRef","identityResponse","proxiedSessionSchema","z","ProxiedSignInIdentity","AbortController","backstageIdentity","session","Date","previous","promise","tokenToExpiry","jwtToken","base64","padded","fallback","rawPayload","value","Math","error","baseUrl","mergedHeaders","Headers","response","fetch","ResponseError","getIdentity","useLegacyGuestToken","localStorage","discoveryApiRef","console","confirm","ID_TOKEN_REGEX","useFormStyles","asInputRef","renderResult","rest","IdentityApiSignOutProxy","config","PROVIDER_STORAGE_KEY","signInProviders","Component","onSignInStarted","onSignInSuccess","onSignInFailure","discoveryApi","_","setUseLegacyGuestToken","useLocalStorage","handle","InfoCard","register","handleSubmit","formState","useForm","errors","userId","idToken","FormControl","TextField","FormHelperText","isEmpty","message","errorApi","errorApiRef","handleLogin","ForwardedError","validateIDs","id","providers","MultiSignInPage","titleComponent","align","configApi","loading","providerElements","useSignInProviders","apiHolder","useApiHolder","setLoading","analytics","useAnalytics","searchParams","_setSearchParams","useSearchParams","useMountEffect","errorParam","handleWrappedResult","useCallback","identityApi","useLayoutEffect","selectedProviderId","provider","didCancel","useMemo","Object","key","identityProviders","acc","Progress","Page","Header","Content","ContentHeader","SingleSignInPage","auto","ErrorComponent","setError","showLoginPage","setShowLoginPage","login","checkExisting","showPopup","err","SignInPage","ClickableText","withStyles","StyledBox","BreadcrumbsCurrentPage","Breadcrumbs","restProps","childrenArray","firstPage","secondPage","expandablePages","currentPage","hasHiddenBreadcrumbs","Fragment","MaterialBreadcrumbs","List","pageLink","index","ListItem","className","stretch","noPadding","classNames","ContentHeaderTitle","ContentHeaderDescription","description","TitleComponent","DescriptionComponent","textAlign","renderedTitle","renderedDescription","Helmet","TypeFragment","type","typeLink","pageTitle","TitleFragment","tooltip","contentRef","useContent","FinalTitle","Tooltip","SubtitleFragment","subtitle","pageTitleOverride","style","appTitle","documentTitle","titleTemplate","defaultTitle","BottomLink","onClick","Divider","ArrowIcon","SlackLink","slackChannel","ErrorBoundary","errorInfo","ErrorPanel","CardActionsTopRight","CardActions","subheader","divider","deepLink","errorBoundaryProps","variant","alignContent","headerStyle","headerProps","action","actionsClassName","actions","cardClassName","actionsTopRight","titleTypographyProps","subheaderTypographyProps","calculatedStyle","calculatedCardStyle","variants","name","VARIANT_STYLES","Card","CardHeader","CardContent","themeId","ThemeProvider","baseTheme"],"mappings":"uMAoCA,IAAMA,EAAcC,AAAAA,GAAAA,EAAAA,UAAAA,AAAAA,EAA2B,CAACC,EAAOC,IACrD,UAACC,EAAAA,EAAYA,CAAAA,CAAC,IAAKD,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