@backstage/plugin-user-settings 0.8.5-next.1 → 0.8.6-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 (67) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/alpha/package.json +1 -1
  3. package/dist/alpha.esm.js +3 -5
  4. package/dist/alpha.esm.js.map +1 -1
  5. package/dist/apis/StorageApi/UserSettingsStorage.esm.js +154 -0
  6. package/dist/apis/StorageApi/UserSettingsStorage.esm.js.map +1 -0
  7. package/dist/components/AuthProviders/DefaultProviderSettings.esm.js +84 -0
  8. package/dist/components/AuthProviders/DefaultProviderSettings.esm.js.map +1 -0
  9. package/dist/components/AuthProviders/EmptyProviders.esm.js +41 -0
  10. package/dist/components/AuthProviders/EmptyProviders.esm.js.map +1 -0
  11. package/dist/components/AuthProviders/ProviderSettingsAvatar.esm.js +21 -0
  12. package/dist/components/AuthProviders/ProviderSettingsAvatar.esm.js.map +1 -0
  13. package/dist/components/AuthProviders/ProviderSettingsItem.esm.js +83 -0
  14. package/dist/components/AuthProviders/ProviderSettingsItem.esm.js.map +1 -0
  15. package/dist/components/AuthProviders/UserSettingsAuthProviders.esm.js +21 -0
  16. package/dist/components/AuthProviders/UserSettingsAuthProviders.esm.js.map +1 -0
  17. package/dist/components/DefaultSettingsPage/DefaultSettingsPage.esm.js +44 -0
  18. package/dist/components/DefaultSettingsPage/DefaultSettingsPage.esm.js.map +1 -0
  19. package/dist/components/FeatureFlags/EmptyFlags.esm.js +41 -0
  20. package/dist/components/FeatureFlags/EmptyFlags.esm.js.map +1 -0
  21. package/dist/components/FeatureFlags/FeatureFlagsItem.esm.js +17 -0
  22. package/dist/components/FeatureFlags/FeatureFlagsItem.esm.js.map +1 -0
  23. package/dist/components/FeatureFlags/UserSettingsFeatureFlags.esm.js +96 -0
  24. package/dist/components/FeatureFlags/UserSettingsFeatureFlags.esm.js.map +1 -0
  25. package/dist/components/General/UserSettingsAppearanceCard.esm.js +14 -0
  26. package/dist/components/General/UserSettingsAppearanceCard.esm.js.map +1 -0
  27. package/dist/components/General/UserSettingsGeneral.esm.js +12 -0
  28. package/dist/components/General/UserSettingsGeneral.esm.js.map +1 -0
  29. package/dist/components/General/UserSettingsIdentityCard.esm.js +18 -0
  30. package/dist/components/General/UserSettingsIdentityCard.esm.js.map +1 -0
  31. package/dist/components/General/UserSettingsLanguageToggle.esm.js +100 -0
  32. package/dist/components/General/UserSettingsLanguageToggle.esm.js.map +1 -0
  33. package/dist/components/General/UserSettingsMenu.esm.js +45 -0
  34. package/dist/components/General/UserSettingsMenu.esm.js.map +1 -0
  35. package/dist/components/General/UserSettingsPinToggle.esm.js +38 -0
  36. package/dist/components/General/UserSettingsPinToggle.esm.js.map +1 -0
  37. package/dist/components/General/UserSettingsProfileCard.esm.js +15 -0
  38. package/dist/components/General/UserSettingsProfileCard.esm.js.map +1 -0
  39. package/dist/components/General/UserSettingsSignInAvatar.esm.js +31 -0
  40. package/dist/components/General/UserSettingsSignInAvatar.esm.js.map +1 -0
  41. package/dist/components/General/UserSettingsThemeToggle.esm.js +126 -0
  42. package/dist/components/General/UserSettingsThemeToggle.esm.js.map +1 -0
  43. package/dist/components/Settings.esm.js +14 -0
  44. package/dist/components/Settings.esm.js.map +1 -0
  45. package/dist/components/SettingsLayout/SettingsLayout.esm.js +26 -0
  46. package/dist/components/SettingsLayout/SettingsLayout.esm.js.map +1 -0
  47. package/dist/components/SettingsPage/SettingsPage.esm.js +26 -0
  48. package/dist/components/SettingsPage/SettingsPage.esm.js.map +1 -0
  49. package/dist/components/SettingsPage/index.esm.js +2 -0
  50. package/dist/components/SettingsPage/index.esm.js.map +1 -0
  51. package/dist/components/UserSettingsTab/UserSettingsTab.esm.js +10 -0
  52. package/dist/components/UserSettingsTab/UserSettingsTab.esm.js.map +1 -0
  53. package/dist/components/useUserProfileInfo.esm.js +39 -0
  54. package/dist/components/useUserProfileInfo.esm.js.map +1 -0
  55. package/dist/index.esm.js +20 -199
  56. package/dist/index.esm.js.map +1 -1
  57. package/dist/plugin.esm.js +21 -0
  58. package/dist/plugin.esm.js.map +1 -0
  59. package/dist/translation.esm.js +26 -0
  60. package/dist/translation.esm.js.map +1 -0
  61. package/package.json +14 -14
  62. package/dist/esm/SettingsPage-CeSuiezj.esm.js +0 -753
  63. package/dist/esm/SettingsPage-CeSuiezj.esm.js.map +0 -1
  64. package/dist/esm/index-Cq4DqL_j.esm.js +0 -34
  65. package/dist/esm/index-Cq4DqL_j.esm.js.map +0 -1
  66. package/dist/esm/translation-CSRNIDi0.esm.js +0 -44
  67. package/dist/esm/translation-CSRNIDi0.esm.js.map +0 -1
@@ -0,0 +1,126 @@
1
+ import React, { cloneElement } from 'react';
2
+ import useObservable from 'react-use/esm/useObservable';
3
+ import AutoIcon from '@material-ui/icons/BrightnessAuto';
4
+ import ToggleButton from '@material-ui/lab/ToggleButton';
5
+ import ToggleButtonGroup from '@material-ui/lab/ToggleButtonGroup';
6
+ import ListItem from '@material-ui/core/ListItem';
7
+ import ListItemText from '@material-ui/core/ListItemText';
8
+ import ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction';
9
+ import Tooltip from '@material-ui/core/Tooltip';
10
+ import { makeStyles } from '@material-ui/core/styles';
11
+ import { useApi, appThemeApiRef } from '@backstage/core-plugin-api';
12
+ import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
13
+ import { userSettingsTranslationRef } from '../../translation.esm.js';
14
+
15
+ const ThemeIcon = ({ id, activeId, icon }) => icon ? cloneElement(icon, {
16
+ color: activeId === id ? "primary" : void 0
17
+ }) : /* @__PURE__ */ React.createElement(AutoIcon, { color: activeId === id ? "primary" : void 0 });
18
+ const useStyles = makeStyles((theme) => ({
19
+ container: {
20
+ display: "flex",
21
+ flexWrap: "wrap",
22
+ width: "100%",
23
+ justifyContent: "space-between",
24
+ alignItems: "center",
25
+ paddingBottom: 8,
26
+ paddingRight: 16
27
+ },
28
+ list: {
29
+ width: "initial",
30
+ [theme.breakpoints.down("xs")]: {
31
+ width: "100%",
32
+ padding: `0 0 12px`
33
+ }
34
+ },
35
+ listItemText: {
36
+ paddingRight: 0,
37
+ paddingLeft: 0
38
+ },
39
+ listItemSecondaryAction: {
40
+ position: "relative",
41
+ transform: "unset",
42
+ top: "auto",
43
+ right: "auto",
44
+ paddingLeft: 16,
45
+ [theme.breakpoints.down("xs")]: {
46
+ paddingLeft: 0
47
+ }
48
+ }
49
+ }));
50
+ const TooltipToggleButton = ({
51
+ children,
52
+ title,
53
+ value,
54
+ ...props
55
+ }) => /* @__PURE__ */ React.createElement(Tooltip, { placement: "top", arrow: true, title }, /* @__PURE__ */ React.createElement(ToggleButton, { value, ...props }, children));
56
+ const UserSettingsThemeToggle = () => {
57
+ const classes = useStyles();
58
+ const appThemeApi = useApi(appThemeApiRef);
59
+ const activeThemeId = useObservable(
60
+ appThemeApi.activeThemeId$(),
61
+ appThemeApi.getActiveThemeId()
62
+ );
63
+ const themeIds = appThemeApi.getInstalledThemes();
64
+ const { t } = useTranslationRef(userSettingsTranslationRef);
65
+ const handleSetTheme = (_event, newThemeId) => {
66
+ if (themeIds.some((it) => it.id === newThemeId)) {
67
+ appThemeApi.setActiveThemeId(newThemeId);
68
+ } else {
69
+ appThemeApi.setActiveThemeId(void 0);
70
+ }
71
+ };
72
+ return /* @__PURE__ */ React.createElement(
73
+ ListItem,
74
+ {
75
+ className: classes.list,
76
+ classes: { container: classes.container }
77
+ },
78
+ /* @__PURE__ */ React.createElement(
79
+ ListItemText,
80
+ {
81
+ className: classes.listItemText,
82
+ primary: t("themeToggle.title"),
83
+ secondary: t("themeToggle.description")
84
+ }
85
+ ),
86
+ /* @__PURE__ */ React.createElement(ListItemSecondaryAction, { className: classes.listItemSecondaryAction }, /* @__PURE__ */ React.createElement(
87
+ ToggleButtonGroup,
88
+ {
89
+ exclusive: true,
90
+ size: "small",
91
+ value: activeThemeId != null ? activeThemeId : "auto",
92
+ onChange: handleSetTheme
93
+ },
94
+ themeIds.map((theme) => {
95
+ const themeId = theme.id;
96
+ const themeIcon = theme.icon;
97
+ const themeTitle = theme.title || (themeId === "light" || themeId === "dark" ? t(`themeToggle.names.${themeId}`) : themeId);
98
+ return /* @__PURE__ */ React.createElement(
99
+ TooltipToggleButton,
100
+ {
101
+ key: themeId,
102
+ title: t("themeToggle.select", { theme: themeTitle }),
103
+ value: themeId
104
+ },
105
+ /* @__PURE__ */ React.createElement(React.Fragment, null, themeTitle, "\xA0", /* @__PURE__ */ React.createElement(
106
+ ThemeIcon,
107
+ {
108
+ id: themeId,
109
+ icon: themeIcon,
110
+ activeId: activeThemeId
111
+ }
112
+ ))
113
+ );
114
+ }),
115
+ /* @__PURE__ */ React.createElement(Tooltip, { placement: "top", arrow: true, title: t("themeToggle.selectAuto") }, /* @__PURE__ */ React.createElement(ToggleButton, { value: "auto", selected: activeThemeId === void 0 }, t("themeToggle.names.auto"), "\xA0", /* @__PURE__ */ React.createElement(
116
+ AutoIcon,
117
+ {
118
+ color: activeThemeId === void 0 ? "primary" : void 0
119
+ }
120
+ )))
121
+ ))
122
+ );
123
+ };
124
+
125
+ export { UserSettingsThemeToggle };
126
+ //# sourceMappingURL=UserSettingsThemeToggle.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UserSettingsThemeToggle.esm.js","sources":["../../../src/components/General/UserSettingsThemeToggle.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 React, { cloneElement } from 'react';\nimport useObservable from 'react-use/esm/useObservable';\nimport AutoIcon from '@material-ui/icons/BrightnessAuto';\nimport ToggleButton from '@material-ui/lab/ToggleButton';\nimport ToggleButtonGroup from '@material-ui/lab/ToggleButtonGroup';\nimport ListItem from '@material-ui/core/ListItem';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { appThemeApiRef, useApi } from '@backstage/core-plugin-api';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { userSettingsTranslationRef } from '../../translation';\n\ntype ThemeIconProps = {\n id: string;\n activeId: string | undefined;\n icon: JSX.Element | undefined;\n};\n\nconst ThemeIcon = ({ id, activeId, icon }: ThemeIconProps) =>\n icon ? (\n cloneElement(icon, {\n color: activeId === id ? 'primary' : undefined,\n })\n ) : (\n <AutoIcon color={activeId === id ? 'primary' : undefined} />\n );\n\ntype TooltipToggleButtonProps = {\n children: JSX.Element;\n title: string;\n value: string;\n};\n\nconst useStyles = makeStyles(theme => ({\n container: {\n display: 'flex',\n flexWrap: 'wrap',\n width: '100%',\n justifyContent: 'space-between',\n alignItems: 'center',\n paddingBottom: 8,\n paddingRight: 16,\n },\n list: {\n width: 'initial',\n [theme.breakpoints.down('xs')]: {\n width: '100%',\n padding: `0 0 12px`,\n },\n },\n listItemText: {\n paddingRight: 0,\n paddingLeft: 0,\n },\n listItemSecondaryAction: {\n position: 'relative',\n transform: 'unset',\n top: 'auto',\n right: 'auto',\n paddingLeft: 16,\n [theme.breakpoints.down('xs')]: {\n paddingLeft: 0,\n },\n },\n}));\n\n// ToggleButtonGroup uses React.children.map instead of context\n// so wrapping with Tooltip breaks ToggleButton functionality.\nconst TooltipToggleButton = ({\n children,\n title,\n value,\n ...props\n}: TooltipToggleButtonProps) => (\n <Tooltip placement=\"top\" arrow title={title}>\n <ToggleButton value={value} {...props}>\n {children}\n </ToggleButton>\n </Tooltip>\n);\n\n/** @public */\nexport const UserSettingsThemeToggle = () => {\n const classes = useStyles();\n const appThemeApi = useApi(appThemeApiRef);\n const activeThemeId = useObservable(\n appThemeApi.activeThemeId$(),\n appThemeApi.getActiveThemeId(),\n );\n\n const themeIds = appThemeApi.getInstalledThemes();\n\n const { t } = useTranslationRef(userSettingsTranslationRef);\n\n const handleSetTheme = (\n _event: React.MouseEvent<HTMLElement>,\n newThemeId: string | undefined,\n ) => {\n if (themeIds.some(it => it.id === newThemeId)) {\n appThemeApi.setActiveThemeId(newThemeId);\n } else {\n appThemeApi.setActiveThemeId(undefined);\n }\n };\n\n return (\n <ListItem\n className={classes.list}\n classes={{ container: classes.container }}\n >\n <ListItemText\n className={classes.listItemText}\n primary={t('themeToggle.title')}\n secondary={t('themeToggle.description')}\n />\n <ListItemSecondaryAction className={classes.listItemSecondaryAction}>\n <ToggleButtonGroup\n exclusive\n size=\"small\"\n value={activeThemeId ?? 'auto'}\n onChange={handleSetTheme}\n >\n {themeIds.map(theme => {\n const themeId = theme.id;\n const themeIcon = theme.icon;\n const themeTitle =\n theme.title ||\n (themeId === 'light' || themeId === 'dark'\n ? t(`themeToggle.names.${themeId}`)\n : themeId);\n return (\n <TooltipToggleButton\n key={themeId}\n title={t('themeToggle.select', { theme: themeTitle })}\n value={themeId}\n >\n <>\n {themeTitle}&nbsp;\n <ThemeIcon\n id={themeId}\n icon={themeIcon}\n activeId={activeThemeId}\n />\n </>\n </TooltipToggleButton>\n );\n })}\n <Tooltip placement=\"top\" arrow title={t('themeToggle.selectAuto')}>\n <ToggleButton value=\"auto\" selected={activeThemeId === undefined}>\n {t('themeToggle.names.auto')}&nbsp;\n <AutoIcon\n color={activeThemeId === undefined ? 'primary' : undefined}\n />\n </ToggleButton>\n </Tooltip>\n </ToggleButtonGroup>\n </ListItemSecondaryAction>\n </ListItem>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAoCA,MAAM,SAAA,GAAY,CAAC,EAAE,EAAA,EAAI,UAAU,IAAK,EAAA,KACtC,IACE,GAAA,YAAA,CAAa,IAAM,EAAA;A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,CAAA,aAAA,CAAC,WAAQ,SAAU,EAAA,KAAA,EAAM,OAAK,IAAC,EAAA,KAAA,EAAO,EAAE,wBAAwB,CAAA,EAAA,sCAC7D,YAAa,EAAA,EAAA,KAAA,EAAM,QAAO,QAAU,EAAA,aAAA,KAAkB,UACpD,CAAE,CAAA,wBAAwB,GAAE,MAC7B,kBAAA,KAAA,CAAA,aAAA;AAAA,QAAC,QAAA;AAAA,QAAA;AAAA,UACC,KAAA,EAAO,aAAkB,KAAA,KAAA,CAAA,GAAY,SAAY,GAAA,KAAA,CAAA;AAAA,SAAA;AAAA,OAErD,CACF,CAAA;AAAA,KAEJ,CAAA;AAAA,GACF,CAAA;AAEJ;;;;"}
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import SettingsIcon from '@material-ui/icons/Settings';
3
+ import { settingsRouteRef } from '../plugin.esm.js';
4
+ import { SidebarItem } from '@backstage/core-components';
5
+ import { useRouteRef } from '@backstage/core-plugin-api';
6
+
7
+ const Settings = (props) => {
8
+ const routePath = useRouteRef(settingsRouteRef);
9
+ const Icon = props.icon ? props.icon : SettingsIcon;
10
+ return /* @__PURE__ */ React.createElement(SidebarItem, { text: "Settings", to: routePath(), icon: Icon });
11
+ };
12
+
13
+ export { Settings };
14
+ //# sourceMappingURL=Settings.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Settings.esm.js","sources":["../../src/components/Settings.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 React from 'react';\nimport SettingsIcon from '@material-ui/icons/Settings';\nimport { settingsRouteRef } from '../plugin';\nimport { SidebarItem } from '@backstage/core-components';\nimport { useRouteRef, IconComponent } from '@backstage/core-plugin-api';\n\n/** @public */\nexport const Settings = (props: { icon?: IconComponent }) => {\n const routePath = useRouteRef(settingsRouteRef);\n const Icon = props.icon ? props.icon : SettingsIcon;\n return <SidebarItem text=\"Settings\" to={routePath()} icon={Icon} />;\n};\n"],"names":[],"mappings":";;;;;;AAuBa,MAAA,QAAA,GAAW,CAAC,KAAoC,KAAA;AAC3D,EAAM,MAAA,SAAA,GAAY,YAAY,gBAAgB,CAAA,CAAA;AAC9C,EAAA,MAAM,IAAO,GAAA,KAAA,CAAM,IAAO,GAAA,KAAA,CAAM,IAAO,GAAA,YAAA,CAAA;AACvC,EAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,eAAY,IAAK,EAAA,UAAA,EAAW,IAAI,SAAU,EAAA,EAAG,MAAM,IAAM,EAAA,CAAA,CAAA;AACnE;;;;"}
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ import { useSidebarPinState, Page, Header, RoutedTabs } from '@backstage/core-components';
3
+ import { attachComponentData, useElementFilter } from '@backstage/core-plugin-api';
4
+
5
+ const LAYOUT_DATA_KEY = "plugin.user-settings.settingsLayout";
6
+ const LAYOUT_ROUTE_DATA_KEY = "plugin.user-settings.settingsLayoutRoute";
7
+ const Route = () => null;
8
+ attachComponentData(Route, LAYOUT_ROUTE_DATA_KEY, true);
9
+ attachComponentData(Route, "core.gatherMountPoints", true);
10
+ const SettingsLayout = (props) => {
11
+ const { title, children } = props;
12
+ const { isMobile } = useSidebarPinState();
13
+ const routes = useElementFilter(
14
+ children,
15
+ (elements) => elements.selectByComponentData({
16
+ key: LAYOUT_ROUTE_DATA_KEY,
17
+ withStrictError: "Child of SettingsLayout must be an SettingsLayout.Route"
18
+ }).getElements().map((child) => child.props)
19
+ );
20
+ return /* @__PURE__ */ React.createElement(Page, { themeId: "home" }, !isMobile && /* @__PURE__ */ React.createElement(Header, { title: title != null ? title : "Settings" }), /* @__PURE__ */ React.createElement(RoutedTabs, { routes }));
21
+ };
22
+ attachComponentData(SettingsLayout, LAYOUT_DATA_KEY, true);
23
+ SettingsLayout.Route = Route;
24
+
25
+ export { LAYOUT_DATA_KEY, LAYOUT_ROUTE_DATA_KEY, SettingsLayout };
26
+ //# sourceMappingURL=SettingsLayout.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SettingsLayout.esm.js","sources":["../../../src/components/SettingsLayout/SettingsLayout.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 React from 'react';\nimport { TabProps } from '@material-ui/core/Tab';\nimport {\n Header,\n Page,\n RoutedTabs,\n useSidebarPinState,\n} from '@backstage/core-components';\nimport {\n attachComponentData,\n useElementFilter,\n} from '@backstage/core-plugin-api';\n\n/** @public */\nexport type SettingsLayoutRouteProps = {\n path: string;\n title: string;\n children: JSX.Element;\n tabProps?: TabProps<React.ElementType, { component?: React.ElementType }>;\n};\n\nexport const LAYOUT_DATA_KEY = 'plugin.user-settings.settingsLayout';\nexport const LAYOUT_ROUTE_DATA_KEY = 'plugin.user-settings.settingsLayoutRoute';\n\nconst Route: (props: SettingsLayoutRouteProps) => null = () => null;\nattachComponentData(Route, LAYOUT_ROUTE_DATA_KEY, true);\n\n// This causes all mount points that are discovered within this route to use the path of the route itself\nattachComponentData(Route, 'core.gatherMountPoints', true);\n\n/** @public */\nexport type SettingsLayoutProps = {\n title?: string;\n subtitle?: string;\n children?: React.ReactNode;\n};\n\n/**\n * @public\n */\nexport const SettingsLayout = (props: SettingsLayoutProps) => {\n const { title, children } = props;\n const { isMobile } = useSidebarPinState();\n\n const routes = useElementFilter(children, elements =>\n elements\n .selectByComponentData({\n key: LAYOUT_ROUTE_DATA_KEY,\n withStrictError:\n 'Child of SettingsLayout must be an SettingsLayout.Route',\n })\n .getElements<SettingsLayoutRouteProps>()\n .map(child => child.props),\n );\n\n return (\n <Page themeId=\"home\">\n {!isMobile && <Header title={title ?? 'Settings'} />}\n <RoutedTabs routes={routes} />\n </Page>\n );\n};\n\nattachComponentData(SettingsLayout, LAYOUT_DATA_KEY, true);\n\nSettingsLayout.Route = Route;\n"],"names":[],"mappings":";;;;AAqCO,MAAM,eAAkB,GAAA,sCAAA;AACxB,MAAM,qBAAwB,GAAA,2CAAA;AAErC,MAAM,QAAmD,MAAM,IAAA,CAAA;AAC/D,mBAAoB,CAAA,KAAA,EAAO,uBAAuB,IAAI,CAAA,CAAA;AAGtD,mBAAoB,CAAA,KAAA,EAAO,0BAA0B,IAAI,CAAA,CAAA;AAY5C,MAAA,cAAA,GAAiB,CAAC,KAA+B,KAAA;AAC5D,EAAM,MAAA,EAAE,KAAO,EAAA,QAAA,EAAa,GAAA,KAAA,CAAA;AAC5B,EAAM,MAAA,EAAE,QAAS,EAAA,GAAI,kBAAmB,EAAA,CAAA;AAExC,EAAA,MAAM,MAAS,GAAA,gBAAA;AAAA,IAAiB,QAAA;AAAA,IAAU,CAAA,QAAA,KACxC,SACG,qBAAsB,CAAA;AAAA,MACrB,GAAK,EAAA,qBAAA;AAAA,MACL,eACE,EAAA,yDAAA;AAAA,KACH,CACA,CAAA,WAAA,GACA,GAAI,CAAA,CAAA,KAAA,KAAS,MAAM,KAAK,CAAA;AAAA,GAC7B,CAAA;AAEA,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,OAAQ,EAAA,MAAA,EAAA,EACX,CAAC,QAAY,oBAAA,KAAA,CAAA,aAAA,CAAC,MAAO,EAAA,EAAA,KAAA,EAAO,wBAAS,UAAY,EAAA,CAAA,kBACjD,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,QAAgB,CAC9B,CAAA,CAAA;AAEJ,EAAA;AAEA,mBAAoB,CAAA,cAAA,EAAgB,iBAAiB,IAAI,CAAA,CAAA;AAEzD,cAAA,CAAe,KAAQ,GAAA,KAAA;;;;"}
@@ -0,0 +1,26 @@
1
+ import { useOutlet } from 'react-router-dom';
2
+ import React from 'react';
3
+ import { DefaultSettingsPage } from '../DefaultSettingsPage/DefaultSettingsPage.esm.js';
4
+ import { useElementFilter } from '@backstage/core-plugin-api';
5
+ import { LAYOUT_DATA_KEY, LAYOUT_ROUTE_DATA_KEY } from '../SettingsLayout/SettingsLayout.esm.js';
6
+
7
+ const SettingsPage = (props) => {
8
+ const { providerSettings } = props;
9
+ const outlet = useOutlet();
10
+ const layout = useElementFilter(
11
+ outlet,
12
+ (elements) => elements.selectByComponentData({
13
+ key: LAYOUT_DATA_KEY
14
+ }).getElements()
15
+ );
16
+ const tabs = useElementFilter(
17
+ outlet,
18
+ (elements) => elements.selectByComponentData({
19
+ key: LAYOUT_ROUTE_DATA_KEY
20
+ }).getElements()
21
+ );
22
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, layout.length !== 0 && layout || /* @__PURE__ */ React.createElement(DefaultSettingsPage, { tabs, providerSettings }));
23
+ };
24
+
25
+ export { SettingsPage };
26
+ //# sourceMappingURL=SettingsPage.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SettingsPage.esm.js","sources":["../../../src/components/SettingsPage/SettingsPage.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 { useOutlet } from 'react-router-dom';\nimport React from 'react';\nimport { DefaultSettingsPage } from '../DefaultSettingsPage';\nimport { useElementFilter } from '@backstage/core-plugin-api';\nimport {\n SettingsLayoutProps,\n SettingsLayoutRouteProps,\n} from '../SettingsLayout';\nimport {\n LAYOUT_DATA_KEY,\n LAYOUT_ROUTE_DATA_KEY,\n} from '../SettingsLayout/SettingsLayout';\n\n/** @public */\nexport const SettingsPage = (props: { providerSettings?: JSX.Element }) => {\n const { providerSettings } = props;\n const outlet = useOutlet();\n const layout = useElementFilter(outlet, elements =>\n elements\n .selectByComponentData({\n key: LAYOUT_DATA_KEY,\n })\n .getElements<SettingsLayoutProps>(),\n );\n const tabs = useElementFilter(outlet, elements =>\n elements\n .selectByComponentData({\n key: LAYOUT_ROUTE_DATA_KEY,\n })\n .getElements<SettingsLayoutRouteProps>(),\n );\n\n return (\n <>\n {(layout.length !== 0 && layout) || (\n <DefaultSettingsPage tabs={tabs} providerSettings={providerSettings} />\n )}\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;AA6Ba,MAAA,YAAA,GAAe,CAAC,KAA8C,KAAA;AACzE,EAAM,MAAA,EAAE,kBAAqB,GAAA,KAAA,CAAA;AAC7B,EAAA,MAAM,SAAS,SAAU,EAAA,CAAA;AACzB,EAAA,MAAM,MAAS,GAAA,gBAAA;AAAA,IAAiB,MAAA;AAAA,IAAQ,CAAA,QAAA,KACtC,SACG,qBAAsB,CAAA;AAAA,MACrB,GAAK,EAAA,eAAA;AAAA,KACN,EACA,WAAiC,EAAA;AAAA,GACtC,CAAA;AACA,EAAA,MAAM,IAAO,GAAA,gBAAA;AAAA,IAAiB,MAAA;AAAA,IAAQ,CAAA,QAAA,KACpC,SACG,qBAAsB,CAAA;AAAA,MACrB,GAAK,EAAA,qBAAA;AAAA,KACN,EACA,WAAsC,EAAA;AAAA,GAC3C,CAAA;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,EACI,OAAO,MAAW,KAAA,CAAA,IAAK,0BACtB,KAAA,CAAA,aAAA,CAAA,mBAAA,EAAA,EAAoB,IAAY,EAAA,gBAAA,EAAoC,CAEzE,CAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,2 @@
1
+ export { SettingsPage } from './SettingsPage.esm.js';
2
+ //# sourceMappingURL=index.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { attachComponentData } from '@backstage/core-plugin-api';
3
+ import { LAYOUT_ROUTE_DATA_KEY, SettingsLayout } from '../SettingsLayout/SettingsLayout.esm.js';
4
+
5
+ const USER_SETTINGS_TAB_KEY = LAYOUT_ROUTE_DATA_KEY;
6
+ const UserSettingsTab = (props) => /* @__PURE__ */ React.createElement(SettingsLayout.Route, { path: props.path, title: props.title }, /* @__PURE__ */ React.createElement(React.Fragment, null, "props.children"));
7
+ attachComponentData(UserSettingsTab, USER_SETTINGS_TAB_KEY, "UserSettingsTab");
8
+
9
+ export { USER_SETTINGS_TAB_KEY, UserSettingsTab };
10
+ //# sourceMappingURL=UserSettingsTab.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UserSettingsTab.esm.js","sources":["../../../src/components/UserSettingsTab/UserSettingsTab.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 */\nimport React, { PropsWithChildren } from 'react';\nimport { attachComponentData } from '@backstage/core-plugin-api';\nimport {\n LAYOUT_ROUTE_DATA_KEY,\n SettingsLayout,\n} from '../SettingsLayout/SettingsLayout';\n\n/** @public @deprecated Use SettingsLayout.Route approach instead */\nexport const USER_SETTINGS_TAB_KEY = LAYOUT_ROUTE_DATA_KEY;\n\n/** @public @deprecated Use SettingsLayoutRouteProps instead */\nexport type UserSettingsTabProps = PropsWithChildren<{\n /**\n * The path to the tab in the settings route\n * @example `/settings/advanced`\n */\n path: string;\n /** The title of the tab. It will also reflect in the document title when the tab is active */\n title: string;\n}>;\n\n/**\n * Renders a tab inside the settings page\n * @param props - Component props\n * @public\n * @deprecated Use SettingsLayout.Route instead\n */\nexport const UserSettingsTab = (props: UserSettingsTabProps) => (\n <SettingsLayout.Route path={props.path} title={props.title}>\n <>props.children</>\n </SettingsLayout.Route>\n);\n\nattachComponentData(UserSettingsTab, USER_SETTINGS_TAB_KEY, 'UserSettingsTab');\n"],"names":[],"mappings":";;;;AAuBO,MAAM,qBAAwB,GAAA,sBAAA;AAmB9B,MAAM,eAAkB,GAAA,CAAC,KAC9B,qBAAA,KAAA,CAAA,aAAA,CAAC,eAAe,KAAf,EAAA,EAAqB,IAAM,EAAA,KAAA,CAAM,MAAM,KAAO,EAAA,KAAA,CAAM,KACnD,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,EAAE,gBAAc,CAClB,EAAA;AAGF,mBAAoB,CAAA,eAAA,EAAiB,uBAAuB,iBAAiB,CAAA;;;;"}
@@ -0,0 +1,39 @@
1
+ import { useApi, identityApiRef, alertApiRef } from '@backstage/core-plugin-api';
2
+ import { useEffect } from 'react';
3
+ import useAsync from 'react-use/esm/useAsync';
4
+
5
+ const useUserProfile = () => {
6
+ var _a;
7
+ const identityApi = useApi(identityApiRef);
8
+ const alertApi = useApi(alertApiRef);
9
+ const { value, loading, error } = useAsync(async () => {
10
+ return {
11
+ profile: await identityApi.getProfileInfo(),
12
+ identity: await identityApi.getBackstageIdentity()
13
+ };
14
+ }, []);
15
+ useEffect(() => {
16
+ if (error) {
17
+ alertApi.post({
18
+ message: `Failed to load user identity: ${error}`,
19
+ severity: "error"
20
+ });
21
+ }
22
+ }, [error, alertApi]);
23
+ if (loading || error) {
24
+ return {
25
+ profile: {},
26
+ displayName: "",
27
+ loading
28
+ };
29
+ }
30
+ return {
31
+ profile: value.profile,
32
+ backstageIdentity: value.identity,
33
+ displayName: (_a = value.profile.displayName) != null ? _a : value.identity.userEntityRef,
34
+ loading
35
+ };
36
+ };
37
+
38
+ export { useUserProfile };
39
+ //# sourceMappingURL=useUserProfileInfo.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useUserProfileInfo.esm.js","sources":["../../src/components/useUserProfileInfo.ts"],"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 {\n alertApiRef,\n identityApiRef,\n ProfileInfo,\n useApi,\n} from '@backstage/core-plugin-api';\nimport { useEffect } from 'react';\nimport useAsync from 'react-use/esm/useAsync';\n\n/** @public */\nexport const useUserProfile = () => {\n const identityApi = useApi(identityApiRef);\n const alertApi = useApi(alertApiRef);\n\n const { value, loading, error } = useAsync(async () => {\n return {\n profile: await identityApi.getProfileInfo(),\n identity: await identityApi.getBackstageIdentity(),\n };\n }, []);\n\n useEffect(() => {\n if (error) {\n alertApi.post({\n message: `Failed to load user identity: ${error}`,\n severity: 'error',\n });\n }\n }, [error, alertApi]);\n\n if (loading || error) {\n return {\n profile: {} as ProfileInfo,\n displayName: '',\n loading,\n };\n }\n\n return {\n profile: value!.profile,\n backstageIdentity: value!.identity,\n displayName: value!.profile.displayName ?? value!.identity.userEntityRef,\n loading,\n };\n};\n"],"names":[],"mappings":";;;;AA0BO,MAAM,iBAAiB,MAAM;AA1BpC,EAAA,IAAA,EAAA,CAAA;AA2BE,EAAM,MAAA,WAAA,GAAc,OAAO,cAAc,CAAA,CAAA;AACzC,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA,CAAA;AAEnC,EAAA,MAAM,EAAE,KAAO,EAAA,OAAA,EAAS,KAAM,EAAA,GAAI,SAAS,YAAY;AACrD,IAAO,OAAA;AAAA,MACL,OAAA,EAAS,MAAM,WAAA,CAAY,cAAe,EAAA;AAAA,MAC1C,QAAA,EAAU,MAAM,WAAA,CAAY,oBAAqB,EAAA;AAAA,KACnD,CAAA;AAAA,GACF,EAAG,EAAE,CAAA,CAAA;AAEL,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,KAAO,EAAA;AACT,MAAA,QAAA,CAAS,IAAK,CAAA;AAAA,QACZ,OAAA,EAAS,iCAAiC,KAAK,CAAA,CAAA;AAAA,QAC/C,QAAU,EAAA,OAAA;AAAA,OACX,CAAA,CAAA;AAAA,KACH;AAAA,GACC,EAAA,CAAC,KAAO,EAAA,QAAQ,CAAC,CAAA,CAAA;AAEpB,EAAA,IAAI,WAAW,KAAO,EAAA;AACpB,IAAO,OAAA;AAAA,MACL,SAAS,EAAC;AAAA,MACV,WAAa,EAAA,EAAA;AAAA,MACb,OAAA;AAAA,KACF,CAAA;AAAA,GACF;AAEA,EAAO,OAAA;AAAA,IACL,SAAS,KAAO,CAAA,OAAA;AAAA,IAChB,mBAAmB,KAAO,CAAA,QAAA;AAAA,IAC1B,cAAa,EAAO,GAAA,KAAA,CAAA,OAAA,CAAQ,WAAf,KAAA,IAAA,GAAA,EAAA,GAA8B,MAAO,QAAS,CAAA,aAAA;AAAA,IAC3D,OAAA;AAAA,GACF,CAAA;AACF;;;;"}
package/dist/index.esm.js CHANGED
@@ -1,200 +1,21 @@
1
- import { WebStorage } from '@backstage/core-app-api';
2
- import { ResponseError } from '@backstage/errors';
3
- import ObservableImpl from 'zen-observable';
4
- import { s as settingsRouteRef } from './esm/translation-CSRNIDi0.esm.js';
5
- export { U as UserSettingsPage, a as plugin, a as userSettingsPlugin } from './esm/translation-CSRNIDi0.esm.js';
6
- import React from 'react';
7
- import SettingsIcon from '@material-ui/icons/Settings';
8
- import { SidebarItem } from '@backstage/core-components';
9
- import { useRouteRef, attachComponentData } from '@backstage/core-plugin-api';
10
- import { L as LAYOUT_ROUTE_DATA_KEY, a as SettingsLayout } from './esm/SettingsPage-CeSuiezj.esm.js';
11
- export { D as DefaultProviderSettings, P as ProviderSettingsItem, S as Router, f as UserSettingsAppearanceCard, U as UserSettingsAuthProviders, k as UserSettingsFeatureFlags, b as UserSettingsGeneral, i as UserSettingsIdentityCard, j as UserSettingsLanguageToggle, d as UserSettingsMenu, h as UserSettingsPinToggle, c as UserSettingsProfileCard, e as UserSettingsSignInAvatar, g as UserSettingsThemeToggle, u as useUserProfile } from './esm/SettingsPage-CeSuiezj.esm.js';
12
- import '@backstage/core-plugin-api/alpha';
13
- import 'react-router-dom';
14
- import '@material-ui/core/List';
15
- import '@material-ui/core/Button';
16
- import '@material-ui/core/Typography';
17
- import '@material-ui/icons/Star';
18
- import '@material-ui/core/Grid';
19
- import '@material-ui/core/ListItem';
20
- import '@material-ui/core/ListItemIcon';
21
- import '@material-ui/core/ListItemSecondaryAction';
22
- import '@material-ui/core/ListItemText';
23
- import '@material-ui/core/Tooltip';
24
- import '@material-ui/core/Avatar';
25
- import '@material-ui/core/styles';
26
- import '@material-ui/core/TextField';
27
- import '@material-ui/core/IconButton';
28
- import '@material-ui/core/Switch';
29
- import '@material-ui/icons/Clear';
30
- import 'react-use/esm/useAsync';
31
- import '@material-ui/core/Menu';
32
- import '@material-ui/core/MenuItem';
33
- import '@material-ui/icons/MeetingRoom';
34
- import '@material-ui/icons/MoreVert';
35
- import 'react-use/esm/useObservable';
36
- import '@material-ui/icons/BrightnessAuto';
37
- import '@material-ui/lab/ToggleButton';
38
- import '@material-ui/lab/ToggleButtonGroup';
39
- import '@backstage/plugin-catalog-react';
40
-
41
- var __defProp = Object.defineProperty;
42
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
43
- var __publicField = (obj, key, value) => {
44
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
45
- return value;
46
- };
47
- const JSON_HEADERS = {
48
- "Content-Type": "application/json; charset=utf-8",
49
- Accept: "application/json"
50
- };
51
- const buckets = /* @__PURE__ */ new Map();
52
- class UserSettingsStorage {
53
- constructor(namespace, fetchApi, discoveryApi, errorApi, identityApi, fallback) {
54
- this.namespace = namespace;
55
- this.fetchApi = fetchApi;
56
- this.discoveryApi = discoveryApi;
57
- this.errorApi = errorApi;
58
- this.identityApi = identityApi;
59
- this.fallback = fallback;
60
- __publicField(this, "subscribers", /* @__PURE__ */ new Set());
61
- __publicField(this, "observables", /* @__PURE__ */ new Map());
62
- }
63
- static create(options) {
64
- var _a;
65
- return new UserSettingsStorage(
66
- (_a = options.namespace) != null ? _a : "default",
67
- options.fetchApi,
68
- options.discoveryApi,
69
- options.errorApi,
70
- options.identityApi,
71
- WebStorage.create({
72
- namespace: options.namespace,
73
- errorApi: options.errorApi
74
- })
75
- );
76
- }
77
- forBucket(name) {
78
- const bucketPath = `${this.namespace}.${name}`;
79
- if (!buckets.has(bucketPath)) {
80
- buckets.set(
81
- bucketPath,
82
- new UserSettingsStorage(
83
- bucketPath,
84
- this.fetchApi,
85
- this.discoveryApi,
86
- this.errorApi,
87
- this.identityApi,
88
- this.fallback
89
- )
90
- );
91
- }
92
- return buckets.get(bucketPath);
93
- }
94
- async remove(key) {
95
- const fetchUrl = await this.getFetchUrl(key);
96
- const response = await this.fetchApi.fetch(fetchUrl, {
97
- method: "DELETE"
98
- });
99
- if (!response.ok && response.status !== 404) {
100
- throw await ResponseError.fromResponse(response);
101
- }
102
- this.notifyChanges({ key, presence: "absent" });
103
- }
104
- async set(key, data) {
105
- if (!await this.isSignedIn()) {
106
- await this.fallback.set(key, data);
107
- this.notifyChanges({ key, presence: "present", value: data });
108
- return;
109
- }
110
- const fetchUrl = await this.getFetchUrl(key);
111
- const response = await this.fetchApi.fetch(fetchUrl, {
112
- method: "PUT",
113
- headers: JSON_HEADERS,
114
- body: JSON.stringify({ value: data })
115
- });
116
- if (!response.ok) {
117
- throw await ResponseError.fromResponse(response);
118
- }
119
- const { value } = await response.json();
120
- this.notifyChanges({ key, value, presence: "present" });
121
- }
122
- observe$(key) {
123
- if (!this.observables.has(key)) {
124
- this.observables.set(
125
- key,
126
- new ObservableImpl((subscriber) => {
127
- this.subscribers.add(subscriber);
128
- Promise.resolve().then(() => this.get(key)).then((snapshot) => subscriber.next(snapshot)).catch((error) => this.errorApi.post(error));
129
- return () => {
130
- this.subscribers.delete(subscriber);
131
- };
132
- }).filter(({ key: messageKey }) => messageKey === key)
133
- );
134
- }
135
- return this.observables.get(key);
136
- }
137
- snapshot(key) {
138
- return { key, presence: "unknown" };
139
- }
140
- async get(key) {
141
- if (!await this.isSignedIn()) {
142
- return this.fallback.snapshot(key);
143
- }
144
- const fetchUrl = await this.getFetchUrl(key);
145
- const response = await this.fetchApi.fetch(fetchUrl);
146
- if (response.status === 404) {
147
- return { key, presence: "absent" };
148
- }
149
- if (!response.ok) {
150
- throw await ResponseError.fromResponse(response);
151
- }
152
- try {
153
- const { value: rawValue } = await response.json();
154
- const value = JSON.parse(JSON.stringify(rawValue), (_key, val) => {
155
- if (typeof val === "object" && val !== null) {
156
- Object.freeze(val);
157
- }
158
- return val;
159
- });
160
- return { key, presence: "present", value };
161
- } catch {
162
- return { key, presence: "absent" };
163
- }
164
- }
165
- async getFetchUrl(key) {
166
- const baseUrl = await this.discoveryApi.getBaseUrl("user-settings");
167
- const encodedNamespace = encodeURIComponent(this.namespace);
168
- const encodedKey = encodeURIComponent(key);
169
- return `${baseUrl}/buckets/${encodedNamespace}/keys/${encodedKey}`;
170
- }
171
- async notifyChanges(snapshot) {
172
- for (const subscription of this.subscribers) {
173
- try {
174
- subscription.next(snapshot);
175
- } catch {
176
- }
177
- }
178
- }
179
- async isSignedIn() {
180
- try {
181
- const credentials = await this.identityApi.getCredentials();
182
- return (credentials == null ? void 0 : credentials.token) ? true : false;
183
- } catch {
184
- return false;
185
- }
186
- }
187
- }
188
-
189
- const Settings = (props) => {
190
- const routePath = useRouteRef(settingsRouteRef);
191
- const Icon = props.icon ? props.icon : SettingsIcon;
192
- return /* @__PURE__ */ React.createElement(SidebarItem, { text: "Settings", to: routePath(), icon: Icon });
193
- };
194
-
195
- const USER_SETTINGS_TAB_KEY = LAYOUT_ROUTE_DATA_KEY;
196
- const UserSettingsTab = (props) => /* @__PURE__ */ React.createElement(SettingsLayout.Route, { path: props.path, title: props.title }, /* @__PURE__ */ React.createElement(React.Fragment, null, "props.children"));
197
- attachComponentData(UserSettingsTab, USER_SETTINGS_TAB_KEY, "UserSettingsTab");
198
-
199
- export { Settings, SettingsLayout, USER_SETTINGS_TAB_KEY, UserSettingsStorage, UserSettingsTab };
1
+ export { UserSettingsStorage } from './apis/StorageApi/UserSettingsStorage.esm.js';
2
+ export { UserSettingsPage, userSettingsPlugin as plugin, userSettingsPlugin } from './plugin.esm.js';
3
+ export { Settings } from './components/Settings.esm.js';
4
+ export { SettingsPage as Router } from './components/SettingsPage/SettingsPage.esm.js';
5
+ export { UserSettingsAuthProviders } from './components/AuthProviders/UserSettingsAuthProviders.esm.js';
6
+ export { DefaultProviderSettings } from './components/AuthProviders/DefaultProviderSettings.esm.js';
7
+ export { ProviderSettingsItem } from './components/AuthProviders/ProviderSettingsItem.esm.js';
8
+ export { UserSettingsGeneral } from './components/General/UserSettingsGeneral.esm.js';
9
+ export { UserSettingsProfileCard } from './components/General/UserSettingsProfileCard.esm.js';
10
+ export { UserSettingsMenu } from './components/General/UserSettingsMenu.esm.js';
11
+ export { UserSettingsSignInAvatar } from './components/General/UserSettingsSignInAvatar.esm.js';
12
+ export { UserSettingsAppearanceCard } from './components/General/UserSettingsAppearanceCard.esm.js';
13
+ export { UserSettingsThemeToggle } from './components/General/UserSettingsThemeToggle.esm.js';
14
+ export { UserSettingsPinToggle } from './components/General/UserSettingsPinToggle.esm.js';
15
+ export { UserSettingsIdentityCard } from './components/General/UserSettingsIdentityCard.esm.js';
16
+ export { UserSettingsLanguageToggle } from './components/General/UserSettingsLanguageToggle.esm.js';
17
+ export { UserSettingsFeatureFlags } from './components/FeatureFlags/UserSettingsFeatureFlags.esm.js';
18
+ export { useUserProfile } from './components/useUserProfileInfo.esm.js';
19
+ export { USER_SETTINGS_TAB_KEY, UserSettingsTab } from './components/UserSettingsTab/UserSettingsTab.esm.js';
20
+ export { SettingsLayout } from './components/SettingsLayout/SettingsLayout.esm.js';
200
21
  //# sourceMappingURL=index.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":["../src/apis/StorageApi/UserSettingsStorage.ts","../src/components/Settings.tsx","../src/components/UserSettingsTab/UserSettingsTab.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 { WebStorage } from '@backstage/core-app-api';\nimport {\n DiscoveryApi,\n ErrorApi,\n FetchApi,\n IdentityApi,\n StorageApi,\n StorageValueSnapshot,\n} from '@backstage/core-plugin-api';\nimport { ResponseError } from '@backstage/errors';\nimport { JsonValue, Observable } from '@backstage/types';\nimport ObservableImpl from 'zen-observable';\n\nconst JSON_HEADERS = {\n 'Content-Type': 'application/json; charset=utf-8',\n Accept: 'application/json',\n};\n\nconst buckets = new Map<string, UserSettingsStorage>();\n\n/**\n * An implementation of the storage API, that uses the user-settings backend to\n * persist the data in the DB.\n *\n * @public\n */\nexport class UserSettingsStorage implements StorageApi {\n private subscribers = new Set<\n ZenObservable.SubscriptionObserver<StorageValueSnapshot<JsonValue>>\n >();\n\n private readonly observables = new Map<\n string,\n Observable<StorageValueSnapshot<JsonValue>>\n >();\n\n private constructor(\n private readonly namespace: string,\n private readonly fetchApi: FetchApi,\n private readonly discoveryApi: DiscoveryApi,\n private readonly errorApi: ErrorApi,\n private readonly identityApi: IdentityApi,\n private readonly fallback: WebStorage,\n ) {}\n\n static create(options: {\n fetchApi: FetchApi;\n discoveryApi: DiscoveryApi;\n errorApi: ErrorApi;\n identityApi: IdentityApi;\n namespace?: string;\n }): UserSettingsStorage {\n return new UserSettingsStorage(\n options.namespace ?? 'default',\n options.fetchApi,\n options.discoveryApi,\n options.errorApi,\n options.identityApi,\n WebStorage.create({\n namespace: options.namespace,\n errorApi: options.errorApi,\n }),\n );\n }\n\n forBucket(name: string): StorageApi {\n // use dot instead of slash separator to have nicer URLs\n const bucketPath = `${this.namespace}.${name}`;\n\n if (!buckets.has(bucketPath)) {\n buckets.set(\n bucketPath,\n new UserSettingsStorage(\n bucketPath,\n this.fetchApi,\n this.discoveryApi,\n this.errorApi,\n this.identityApi,\n this.fallback,\n ),\n );\n }\n\n return buckets.get(bucketPath)!;\n }\n\n async remove(key: string): Promise<void> {\n const fetchUrl = await this.getFetchUrl(key);\n\n const response = await this.fetchApi.fetch(fetchUrl, {\n method: 'DELETE',\n });\n\n if (!response.ok && response.status !== 404) {\n throw await ResponseError.fromResponse(response);\n }\n\n this.notifyChanges({ key, presence: 'absent' });\n }\n\n async set<T extends JsonValue>(key: string, data: T): Promise<void> {\n if (!(await this.isSignedIn())) {\n await this.fallback.set(key, data);\n this.notifyChanges({ key, presence: 'present', value: data });\n return;\n }\n\n const fetchUrl = await this.getFetchUrl(key);\n\n const response = await this.fetchApi.fetch(fetchUrl, {\n method: 'PUT',\n headers: JSON_HEADERS,\n body: JSON.stringify({ value: data }),\n });\n\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n }\n\n const { value } = await response.json();\n\n this.notifyChanges({ key, value, presence: 'present' });\n }\n\n observe$<T extends JsonValue>(\n key: string,\n ): Observable<StorageValueSnapshot<T>> {\n if (!this.observables.has(key)) {\n this.observables.set(\n key,\n new ObservableImpl<StorageValueSnapshot<JsonValue>>(subscriber => {\n this.subscribers.add(subscriber);\n\n // TODO(freben): Introduce server polling or similar, to ensure that different devices update when values change\n Promise.resolve()\n .then(() => this.get(key))\n .then(snapshot => subscriber.next(snapshot))\n .catch(error => this.errorApi.post(error));\n\n return () => {\n this.subscribers.delete(subscriber);\n };\n }).filter(({ key: messageKey }) => messageKey === key),\n );\n }\n\n return this.observables.get(key) as Observable<StorageValueSnapshot<T>>;\n }\n\n snapshot<T extends JsonValue>(key: string): StorageValueSnapshot<T> {\n return { key, presence: 'unknown' };\n }\n\n private async get<T extends JsonValue>(\n key: string,\n ): Promise<StorageValueSnapshot<T>> {\n if (!(await this.isSignedIn())) {\n // This explicitly uses WebStorage, which we know is synchronous and doesn't return presence: unknown\n return this.fallback.snapshot(key);\n }\n\n const fetchUrl = await this.getFetchUrl(key);\n const response = await this.fetchApi.fetch(fetchUrl);\n\n if (response.status === 404) {\n return { key, presence: 'absent' };\n }\n\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n }\n\n try {\n const { value: rawValue } = await response.json();\n const value = JSON.parse(JSON.stringify(rawValue), (_key, val) => {\n if (typeof val === 'object' && val !== null) {\n Object.freeze(val);\n }\n return val;\n });\n\n return { key, presence: 'present', value };\n } catch {\n // If the value is not valid JSON, we return an unknown presence. This should never happen\n return { key, presence: 'absent' };\n }\n }\n\n private async getFetchUrl(key: string) {\n const baseUrl = await this.discoveryApi.getBaseUrl('user-settings');\n const encodedNamespace = encodeURIComponent(this.namespace);\n const encodedKey = encodeURIComponent(key);\n return `${baseUrl}/buckets/${encodedNamespace}/keys/${encodedKey}`;\n }\n\n private async notifyChanges<T extends JsonValue>(\n snapshot: StorageValueSnapshot<T>,\n ) {\n for (const subscription of this.subscribers) {\n try {\n subscription.next(snapshot);\n } catch {\n // ignore\n }\n }\n }\n\n private async isSignedIn(): Promise<boolean> {\n try {\n const credentials = await this.identityApi.getCredentials();\n return credentials?.token ? true : false;\n } catch {\n return false;\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 React from 'react';\nimport SettingsIcon from '@material-ui/icons/Settings';\nimport { settingsRouteRef } from '../plugin';\nimport { SidebarItem } from '@backstage/core-components';\nimport { useRouteRef, IconComponent } from '@backstage/core-plugin-api';\n\n/** @public */\nexport const Settings = (props: { icon?: IconComponent }) => {\n const routePath = useRouteRef(settingsRouteRef);\n const Icon = props.icon ? props.icon : SettingsIcon;\n return <SidebarItem text=\"Settings\" to={routePath()} icon={Icon} />;\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 React, { PropsWithChildren } from 'react';\nimport { attachComponentData } from '@backstage/core-plugin-api';\nimport {\n LAYOUT_ROUTE_DATA_KEY,\n SettingsLayout,\n} from '../SettingsLayout/SettingsLayout';\n\n/** @public @deprecated Use SettingsLayout.Route approach instead */\nexport const USER_SETTINGS_TAB_KEY = LAYOUT_ROUTE_DATA_KEY;\n\n/** @public @deprecated Use SettingsLayoutRouteProps instead */\nexport type UserSettingsTabProps = PropsWithChildren<{\n /**\n * The path to the tab in the settings route\n * @example `/settings/advanced`\n */\n path: string;\n /** The title of the tab. It will also reflect in the document title when the tab is active */\n title: string;\n}>;\n\n/**\n * Renders a tab inside the settings page\n * @param props - Component props\n * @public\n * @deprecated Use SettingsLayout.Route instead\n */\nexport const UserSettingsTab = (props: UserSettingsTabProps) => (\n <SettingsLayout.Route path={props.path} title={props.title}>\n <>props.children</>\n </SettingsLayout.Route>\n);\n\nattachComponentData(UserSettingsTab, USER_SETTINGS_TAB_KEY, 'UserSettingsTab');\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAM,YAAe,GAAA;AAAA,EACnB,cAAgB,EAAA,iCAAA;AAAA,EAChB,MAAQ,EAAA,kBAAA;AACV,CAAA,CAAA;AAEA,MAAM,OAAA,uBAAc,GAAiC,EAAA,CAAA;AAQ9C,MAAM,mBAA0C,CAAA;AAAA,EAU7C,YACW,SACA,EAAA,QAAA,EACA,YACA,EAAA,QAAA,EACA,aACA,QACjB,EAAA;AANiB,IAAA,IAAA,CAAA,SAAA,GAAA,SAAA,CAAA;AACA,IAAA,IAAA,CAAA,QAAA,GAAA,QAAA,CAAA;AACA,IAAA,IAAA,CAAA,YAAA,GAAA,YAAA,CAAA;AACA,IAAA,IAAA,CAAA,QAAA,GAAA,QAAA,CAAA;AACA,IAAA,IAAA,CAAA,WAAA,GAAA,WAAA,CAAA;AACA,IAAA,IAAA,CAAA,QAAA,GAAA,QAAA,CAAA;AAfnB,IAAQ,aAAA,CAAA,IAAA,EAAA,aAAA,sBAAkB,GAExB,EAAA,CAAA,CAAA;AAEF,IAAiB,aAAA,CAAA,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BAAuB,iBAAiB,CAAA;;;;"}
1
+ {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,21 @@
1
+ import { createRouteRef, createPlugin, createRoutableExtension } from '@backstage/core-plugin-api';
2
+
3
+ const settingsRouteRef = createRouteRef({
4
+ id: "user-settings"
5
+ });
6
+ const userSettingsPlugin = createPlugin({
7
+ id: "user-settings",
8
+ routes: {
9
+ settingsPage: settingsRouteRef
10
+ }
11
+ });
12
+ const UserSettingsPage = userSettingsPlugin.provide(
13
+ createRoutableExtension({
14
+ name: "UserSettingsPage",
15
+ component: () => import('./components/SettingsPage/index.esm.js').then((m) => m.SettingsPage),
16
+ mountPoint: settingsRouteRef
17
+ })
18
+ );
19
+
20
+ export { UserSettingsPage, settingsRouteRef, userSettingsPlugin };
21
+ //# sourceMappingURL=plugin.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"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 {\n createPlugin,\n createRoutableExtension,\n createRouteRef,\n} from '@backstage/core-plugin-api';\n\nexport const settingsRouteRef = createRouteRef({\n id: 'user-settings',\n});\n\n/** @public */\nexport const userSettingsPlugin = createPlugin({\n id: 'user-settings',\n routes: {\n settingsPage: settingsRouteRef,\n },\n});\n\n/** @public */\nexport const UserSettingsPage = userSettingsPlugin.provide(\n createRoutableExtension({\n name: 'UserSettingsPage',\n component: () =>\n import('./components/SettingsPage').then(m => m.SettingsPage),\n mountPoint: settingsRouteRef,\n }),\n);\n"],"names":[],"mappings":";;AAsBO,MAAM,mBAAmB,cAAe,CAAA;AAAA,EAC7C,EAAI,EAAA,eAAA;AACN,CAAC,EAAA;AAGM,MAAM,qBAAqB,YAAa,CAAA;AAAA,EAC7C,EAAI,EAAA,eAAA;AAAA,EACJ,MAAQ,EAAA;AAAA,IACN,YAAc,EAAA,gBAAA;AAAA,GAChB;AACF,CAAC,EAAA;AAGM,MAAM,mBAAmB,kBAAmB,CAAA,OAAA;AAAA,EACjD,uBAAwB,CAAA;AAAA,IACtB,IAAM,EAAA,kBAAA;AAAA,IACN,SAAA,EAAW,MACT,OAAO,wCAA2B,EAAE,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,YAAY,CAAA;AAAA,IAC9D,UAAY,EAAA,gBAAA;AAAA,GACb,CAAA;AACH;;;;"}
@@ -0,0 +1,26 @@
1
+ import { createTranslationRef } from '@backstage/core-plugin-api/alpha';
2
+
3
+ const userSettingsTranslationRef = createTranslationRef({
4
+ id: "user-settings",
5
+ messages: {
6
+ languageToggle: {
7
+ title: "Language",
8
+ description: "Change the language",
9
+ select: "Select language {{language}}"
10
+ },
11
+ themeToggle: {
12
+ title: "Theme",
13
+ description: "Change the theme mode",
14
+ select: "Select theme {{theme}}",
15
+ selectAuto: "Select Auto Theme",
16
+ names: {
17
+ light: "Light",
18
+ dark: "Dark",
19
+ auto: "Auto"
20
+ }
21
+ }
22
+ }
23
+ });
24
+
25
+ export { userSettingsTranslationRef };
26
+ //# sourceMappingURL=translation.esm.js.map