@backstage/plugin-user-settings 0.8.5 → 0.8.6-next.1

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 +25 -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 +10 -10
  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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # @backstage/plugin-user-settings
2
2
 
3
+ ## 0.8.6-next.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+ - @backstage/core-components@0.14.6-next.1
9
+ - @backstage/plugin-catalog-react@1.11.4-next.1
10
+ - @backstage/frontend-plugin-api@0.6.5-next.1
11
+ - @backstage/core-compat-api@0.2.5-next.1
12
+
13
+ ## 0.8.6-next.0
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies
18
+ - @backstage/core-compat-api@0.2.5-next.0
19
+ - @backstage/theme@0.5.4-next.0
20
+ - @backstage/core-components@0.14.5-next.0
21
+ - @backstage/plugin-catalog-react@1.11.4-next.0
22
+ - @backstage/core-app-api@1.12.4
23
+ - @backstage/core-plugin-api@1.9.2
24
+ - @backstage/errors@1.2.4
25
+ - @backstage/frontend-plugin-api@0.6.5-next.0
26
+ - @backstage/types@1.1.1
27
+
3
28
  ## 0.8.5
4
29
 
5
30
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-user-settings",
3
- "version": "0.8.5",
3
+ "version": "0.8.6-next.1",
4
4
  "main": "../dist/alpha.esm.js",
5
5
  "module": "../dist/alpha.esm.js",
6
6
  "types": "../dist/alpha.d.ts"
package/dist/alpha.esm.js CHANGED
@@ -1,11 +1,9 @@
1
1
  import { createPageExtension, createExtensionInput, coreExtensionData, createNavItemExtension, createPlugin } from '@backstage/frontend-plugin-api';
2
2
  import { convertLegacyRouteRef, compatWrapper, convertLegacyRouteRefs } from '@backstage/core-compat-api';
3
3
  import SettingsIcon from '@material-ui/icons/Settings';
4
- import { s as settingsRouteRef } from './esm/translation-CSRNIDi0.esm.js';
5
- export { u as userSettingsTranslationRef } from './esm/translation-CSRNIDi0.esm.js';
4
+ import { settingsRouteRef } from './plugin.esm.js';
6
5
  import React from 'react';
7
- import '@backstage/core-plugin-api';
8
- import '@backstage/core-plugin-api/alpha';
6
+ export { userSettingsTranslationRef } from './translation.esm.js';
9
7
 
10
8
  const userSettingsPage = createPageExtension({
11
9
  defaultPath: "/settings",
@@ -18,7 +16,7 @@ const userSettingsPage = createPageExtension({
18
16
  { singleton: true, optional: true }
19
17
  )
20
18
  },
21
- loader: ({ inputs }) => import('./esm/index-Cq4DqL_j.esm.js').then(
19
+ loader: ({ inputs }) => import('./components/SettingsPage/index.esm.js').then(
22
20
  (m) => {
23
21
  var _a;
24
22
  return compatWrapper(
@@ -1 +1 @@
1
- {"version":3,"file":"alpha.esm.js","sources":["../src/alpha.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 {\n coreExtensionData,\n createExtensionInput,\n createNavItemExtension,\n createPageExtension,\n createPlugin,\n} from '@backstage/frontend-plugin-api';\nimport {\n convertLegacyRouteRef,\n convertLegacyRouteRefs,\n compatWrapper,\n} from '@backstage/core-compat-api';\nimport SettingsIcon from '@material-ui/icons/Settings';\nimport { settingsRouteRef } from './plugin';\n\nimport React from 'react';\n\nexport * from './translation';\n\nconst userSettingsPage = createPageExtension({\n defaultPath: '/settings',\n routeRef: convertLegacyRouteRef(settingsRouteRef),\n inputs: {\n providerSettings: createExtensionInput(\n {\n element: coreExtensionData.reactElement,\n },\n { singleton: true, optional: true },\n ),\n },\n loader: ({ inputs }) =>\n import('./components/SettingsPage').then(m =>\n compatWrapper(\n <m.SettingsPage\n providerSettings={inputs.providerSettings?.output.element}\n />,\n ),\n ),\n});\n\n/** @alpha */\nexport const settingsNavItem = createNavItemExtension({\n routeRef: convertLegacyRouteRef(settingsRouteRef),\n title: 'Settings',\n icon: SettingsIcon,\n});\n\n/**\n * @alpha\n */\nexport default createPlugin({\n id: 'user-settings',\n extensions: [userSettingsPage, settingsNavItem],\n routes: convertLegacyRouteRefs({\n root: settingsRouteRef,\n }),\n});\n"],"names":[],"mappings":";;;;;;;;;AAkCA,MAAM,mBAAmB,mBAAoB,CAAA;AAAA,EAC3C,WAAa,EAAA,WAAA;AAAA,EACb,QAAA,EAAU,sBAAsB,gBAAgB,CAAA;AAAA,EAChD,MAAQ,EAAA;AAAA,IACN,gBAAkB,EAAA,oBAAA;AAAA,MAChB;AAAA,QACE,SAAS,iBAAkB,CAAA,YAAA;AAAA,OAC7B;AAAA,MACA,EAAE,SAAA,EAAW,IAAM,EAAA,QAAA,EAAU,IAAK,EAAA;AAAA,KACpC;AAAA,GACF;AAAA,EACA,QAAQ,CAAC,EAAE,QACT,KAAA,OAAO,6BAA2B,CAAE,CAAA,IAAA;AAAA,IAAK,CAAE,CAAA,KAAA;AA9C/C,MAAA,IAAA,EAAA,CAAA;AA+CM,MAAA,OAAA,aAAA;AAAA,wBACE,KAAA,CAAA,aAAA;AAAA,UAAC,CAAE,CAAA,YAAA;AAAA,UAAF;AAAA,YACC,gBAAkB,EAAA,CAAA,EAAA,GAAA,MAAA,CAAO,gBAAP,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAyB,MAAO,CAAA,OAAA;AAAA,WAAA;AAAA,SACpD;AAAA,OACF,CAAA;AAAA,KAAA;AAAA,GACF;AACJ,CAAC,CAAA,CAAA;AAGM,MAAM,kBAAkB,sBAAuB,CAAA;AAAA,EACpD,QAAA,EAAU,sBAAsB,gBAAgB,CAAA;AAAA,EAChD,KAAO,EAAA,UAAA;AAAA,EACP,IAAM,EAAA,YAAA;AACR,CAAC,EAAA;AAKD,YAAe,YAAa,CAAA;AAAA,EAC1B,EAAI,EAAA,eAAA;AAAA,EACJ,UAAA,EAAY,CAAC,gBAAA,EAAkB,eAAe,CAAA;AAAA,EAC9C,QAAQ,sBAAuB,CAAA;AAAA,IAC7B,IAAM,EAAA,gBAAA;AAAA,GACP,CAAA;AACH,CAAC,CAAA;;;;"}
1
+ {"version":3,"file":"alpha.esm.js","sources":["../src/alpha.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 {\n coreExtensionData,\n createExtensionInput,\n createNavItemExtension,\n createPageExtension,\n createPlugin,\n} from '@backstage/frontend-plugin-api';\nimport {\n convertLegacyRouteRef,\n convertLegacyRouteRefs,\n compatWrapper,\n} from '@backstage/core-compat-api';\nimport SettingsIcon from '@material-ui/icons/Settings';\nimport { settingsRouteRef } from './plugin';\n\nimport React from 'react';\n\nexport * from './translation';\n\nconst userSettingsPage = createPageExtension({\n defaultPath: '/settings',\n routeRef: convertLegacyRouteRef(settingsRouteRef),\n inputs: {\n providerSettings: createExtensionInput(\n {\n element: coreExtensionData.reactElement,\n },\n { singleton: true, optional: true },\n ),\n },\n loader: ({ inputs }) =>\n import('./components/SettingsPage').then(m =>\n compatWrapper(\n <m.SettingsPage\n providerSettings={inputs.providerSettings?.output.element}\n />,\n ),\n ),\n});\n\n/** @alpha */\nexport const settingsNavItem = createNavItemExtension({\n routeRef: convertLegacyRouteRef(settingsRouteRef),\n title: 'Settings',\n icon: SettingsIcon,\n});\n\n/**\n * @alpha\n */\nexport default createPlugin({\n id: 'user-settings',\n extensions: [userSettingsPage, settingsNavItem],\n routes: convertLegacyRouteRefs({\n root: settingsRouteRef,\n }),\n});\n"],"names":[],"mappings":";;;;;;;AAkCA,MAAM,mBAAmB,mBAAoB,CAAA;AAAA,EAC3C,WAAa,EAAA,WAAA;AAAA,EACb,QAAA,EAAU,sBAAsB,gBAAgB,CAAA;AAAA,EAChD,MAAQ,EAAA;AAAA,IACN,gBAAkB,EAAA,oBAAA;AAAA,MAChB;AAAA,QACE,SAAS,iBAAkB,CAAA,YAAA;AAAA,OAC7B;AAAA,MACA,EAAE,SAAA,EAAW,IAAM,EAAA,QAAA,EAAU,IAAK,EAAA;AAAA,KACpC;AAAA,GACF;AAAA,EACA,QAAQ,CAAC,EAAE,QACT,KAAA,OAAO,wCAA2B,CAAE,CAAA,IAAA;AAAA,IAAK,CAAE,CAAA,KAAA;AA9C/C,MAAA,IAAA,EAAA,CAAA;AA+CM,MAAA,OAAA,aAAA;AAAA,wBACE,KAAA,CAAA,aAAA;AAAA,UAAC,CAAE,CAAA,YAAA;AAAA,UAAF;AAAA,YACC,gBAAkB,EAAA,CAAA,EAAA,GAAA,MAAA,CAAO,gBAAP,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAyB,MAAO,CAAA,OAAA;AAAA,WAAA;AAAA,SACpD;AAAA,OACF,CAAA;AAAA,KAAA;AAAA,GACF;AACJ,CAAC,CAAA,CAAA;AAGM,MAAM,kBAAkB,sBAAuB,CAAA;AAAA,EACpD,QAAA,EAAU,sBAAsB,gBAAgB,CAAA;AAAA,EAChD,KAAO,EAAA,UAAA;AAAA,EACP,IAAM,EAAA,YAAA;AACR,CAAC,EAAA;AAKD,YAAe,YAAa,CAAA;AAAA,EAC1B,EAAI,EAAA,eAAA;AAAA,EACJ,UAAA,EAAY,CAAC,gBAAA,EAAkB,eAAe,CAAA;AAAA,EAC9C,QAAQ,sBAAuB,CAAA;AAAA,IAC7B,IAAM,EAAA,gBAAA;AAAA,GACP,CAAA;AACH,CAAC,CAAA;;;;"}
@@ -0,0 +1,154 @@
1
+ import { WebStorage } from '@backstage/core-app-api';
2
+ import { ResponseError } from '@backstage/errors';
3
+ import ObservableImpl from 'zen-observable';
4
+
5
+ var __defProp = Object.defineProperty;
6
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7
+ var __publicField = (obj, key, value) => {
8
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
9
+ return value;
10
+ };
11
+ const JSON_HEADERS = {
12
+ "Content-Type": "application/json; charset=utf-8",
13
+ Accept: "application/json"
14
+ };
15
+ const buckets = /* @__PURE__ */ new Map();
16
+ class UserSettingsStorage {
17
+ constructor(namespace, fetchApi, discoveryApi, errorApi, identityApi, fallback) {
18
+ this.namespace = namespace;
19
+ this.fetchApi = fetchApi;
20
+ this.discoveryApi = discoveryApi;
21
+ this.errorApi = errorApi;
22
+ this.identityApi = identityApi;
23
+ this.fallback = fallback;
24
+ __publicField(this, "subscribers", /* @__PURE__ */ new Set());
25
+ __publicField(this, "observables", /* @__PURE__ */ new Map());
26
+ }
27
+ static create(options) {
28
+ var _a;
29
+ return new UserSettingsStorage(
30
+ (_a = options.namespace) != null ? _a : "default",
31
+ options.fetchApi,
32
+ options.discoveryApi,
33
+ options.errorApi,
34
+ options.identityApi,
35
+ WebStorage.create({
36
+ namespace: options.namespace,
37
+ errorApi: options.errorApi
38
+ })
39
+ );
40
+ }
41
+ forBucket(name) {
42
+ const bucketPath = `${this.namespace}.${name}`;
43
+ if (!buckets.has(bucketPath)) {
44
+ buckets.set(
45
+ bucketPath,
46
+ new UserSettingsStorage(
47
+ bucketPath,
48
+ this.fetchApi,
49
+ this.discoveryApi,
50
+ this.errorApi,
51
+ this.identityApi,
52
+ this.fallback
53
+ )
54
+ );
55
+ }
56
+ return buckets.get(bucketPath);
57
+ }
58
+ async remove(key) {
59
+ const fetchUrl = await this.getFetchUrl(key);
60
+ const response = await this.fetchApi.fetch(fetchUrl, {
61
+ method: "DELETE"
62
+ });
63
+ if (!response.ok && response.status !== 404) {
64
+ throw await ResponseError.fromResponse(response);
65
+ }
66
+ this.notifyChanges({ key, presence: "absent" });
67
+ }
68
+ async set(key, data) {
69
+ if (!await this.isSignedIn()) {
70
+ await this.fallback.set(key, data);
71
+ this.notifyChanges({ key, presence: "present", value: data });
72
+ return;
73
+ }
74
+ const fetchUrl = await this.getFetchUrl(key);
75
+ const response = await this.fetchApi.fetch(fetchUrl, {
76
+ method: "PUT",
77
+ headers: JSON_HEADERS,
78
+ body: JSON.stringify({ value: data })
79
+ });
80
+ if (!response.ok) {
81
+ throw await ResponseError.fromResponse(response);
82
+ }
83
+ const { value } = await response.json();
84
+ this.notifyChanges({ key, value, presence: "present" });
85
+ }
86
+ observe$(key) {
87
+ if (!this.observables.has(key)) {
88
+ this.observables.set(
89
+ key,
90
+ new ObservableImpl((subscriber) => {
91
+ this.subscribers.add(subscriber);
92
+ Promise.resolve().then(() => this.get(key)).then((snapshot) => subscriber.next(snapshot)).catch((error) => this.errorApi.post(error));
93
+ return () => {
94
+ this.subscribers.delete(subscriber);
95
+ };
96
+ }).filter(({ key: messageKey }) => messageKey === key)
97
+ );
98
+ }
99
+ return this.observables.get(key);
100
+ }
101
+ snapshot(key) {
102
+ return { key, presence: "unknown" };
103
+ }
104
+ async get(key) {
105
+ if (!await this.isSignedIn()) {
106
+ return this.fallback.snapshot(key);
107
+ }
108
+ const fetchUrl = await this.getFetchUrl(key);
109
+ const response = await this.fetchApi.fetch(fetchUrl);
110
+ if (response.status === 404) {
111
+ return { key, presence: "absent" };
112
+ }
113
+ if (!response.ok) {
114
+ throw await ResponseError.fromResponse(response);
115
+ }
116
+ try {
117
+ const { value: rawValue } = await response.json();
118
+ const value = JSON.parse(JSON.stringify(rawValue), (_key, val) => {
119
+ if (typeof val === "object" && val !== null) {
120
+ Object.freeze(val);
121
+ }
122
+ return val;
123
+ });
124
+ return { key, presence: "present", value };
125
+ } catch {
126
+ return { key, presence: "absent" };
127
+ }
128
+ }
129
+ async getFetchUrl(key) {
130
+ const baseUrl = await this.discoveryApi.getBaseUrl("user-settings");
131
+ const encodedNamespace = encodeURIComponent(this.namespace);
132
+ const encodedKey = encodeURIComponent(key);
133
+ return `${baseUrl}/buckets/${encodedNamespace}/keys/${encodedKey}`;
134
+ }
135
+ async notifyChanges(snapshot) {
136
+ for (const subscription of this.subscribers) {
137
+ try {
138
+ subscription.next(snapshot);
139
+ } catch {
140
+ }
141
+ }
142
+ }
143
+ async isSignedIn() {
144
+ try {
145
+ const credentials = await this.identityApi.getCredentials();
146
+ return (credentials == null ? void 0 : credentials.token) ? true : false;
147
+ } catch {
148
+ return false;
149
+ }
150
+ }
151
+ }
152
+
153
+ export { UserSettingsStorage };
154
+ //# sourceMappingURL=UserSettingsStorage.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UserSettingsStorage.esm.js","sources":["../../../src/apis/StorageApi/UserSettingsStorage.ts"],"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"],"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,IAAA,EAAA,aAAA,sBAAkB,GAGjC,EAAA,CAAA,CAAA;AAAA,GASC;AAA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AAc,cACZ,QACA,EAAA;AACA,IAAW,KAAA,MAAA,YAAA,IAAgB,KAAK,WAAa,EAAA;AAC3C,MAAI,IAAA;AACF,QAAA,YAAA,CAAa,KAAK,QAAQ,CAAA,CAAA;AAAA,OACpB,CAAA,MAAA;AAAA,OAER;AAAA,KACF;AAAA,GACF;AAAA,EAEA,MAAc,UAA+B,GAAA;AAC3C,IAAI,IAAA;AACF,MAAA,MAAM,WAAc,GAAA,MAAM,IAAK,CAAA,WAAA,CAAY,cAAe,EAAA,CAAA;AAC1D,MAAO,OAAA,CAAA,WAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,WAAA,CAAa,SAAQ,IAAO,GAAA,KAAA,CAAA;AAAA,KAC7B,CAAA,MAAA;AACN,MAAO,OAAA,KAAA,CAAA;AAAA,KACT;AAAA,GACF;AACF;;;;"}
@@ -0,0 +1,84 @@
1
+ import Star from '@material-ui/icons/Star';
2
+ import React from 'react';
3
+ import { ProviderSettingsItem } from './ProviderSettingsItem.esm.js';
4
+ import { googleAuthApiRef, microsoftAuthApiRef, githubAuthApiRef, gitlabAuthApiRef, oktaAuthApiRef, bitbucketAuthApiRef, oneloginAuthApiRef, atlassianAuthApiRef, bitbucketServerAuthApiRef } from '@backstage/core-plugin-api';
5
+
6
+ const DefaultProviderSettings = (props) => {
7
+ const { configuredProviders } = props;
8
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, configuredProviders.includes("google") && /* @__PURE__ */ React.createElement(
9
+ ProviderSettingsItem,
10
+ {
11
+ title: "Google",
12
+ description: "Provides authentication towards Google APIs and identities",
13
+ apiRef: googleAuthApiRef,
14
+ icon: Star
15
+ }
16
+ ), configuredProviders.includes("microsoft") && /* @__PURE__ */ React.createElement(
17
+ ProviderSettingsItem,
18
+ {
19
+ title: "Microsoft",
20
+ description: "Provides authentication towards Microsoft APIs and identities",
21
+ apiRef: microsoftAuthApiRef,
22
+ icon: Star
23
+ }
24
+ ), configuredProviders.includes("github") && /* @__PURE__ */ React.createElement(
25
+ ProviderSettingsItem,
26
+ {
27
+ title: "GitHub",
28
+ description: "Provides authentication towards GitHub APIs",
29
+ apiRef: githubAuthApiRef,
30
+ icon: Star
31
+ }
32
+ ), configuredProviders.includes("gitlab") && /* @__PURE__ */ React.createElement(
33
+ ProviderSettingsItem,
34
+ {
35
+ title: "GitLab",
36
+ description: "Provides authentication towards GitLab APIs",
37
+ apiRef: gitlabAuthApiRef,
38
+ icon: Star
39
+ }
40
+ ), configuredProviders.includes("okta") && /* @__PURE__ */ React.createElement(
41
+ ProviderSettingsItem,
42
+ {
43
+ title: "Okta",
44
+ description: "Provides authentication towards Okta APIs",
45
+ apiRef: oktaAuthApiRef,
46
+ icon: Star
47
+ }
48
+ ), configuredProviders.includes("bitbucket") && /* @__PURE__ */ React.createElement(
49
+ ProviderSettingsItem,
50
+ {
51
+ title: "Bitbucket",
52
+ description: "Provides authentication towards Bitbucket APIs",
53
+ apiRef: bitbucketAuthApiRef,
54
+ icon: Star
55
+ }
56
+ ), configuredProviders.includes("onelogin") && /* @__PURE__ */ React.createElement(
57
+ ProviderSettingsItem,
58
+ {
59
+ title: "OneLogin",
60
+ description: "Provides authentication towards OneLogin APIs",
61
+ apiRef: oneloginAuthApiRef,
62
+ icon: Star
63
+ }
64
+ ), configuredProviders.includes("atlassian") && /* @__PURE__ */ React.createElement(
65
+ ProviderSettingsItem,
66
+ {
67
+ title: "Atlassian",
68
+ description: "Provides authentication towards Atlassian APIs",
69
+ apiRef: atlassianAuthApiRef,
70
+ icon: Star
71
+ }
72
+ ), configuredProviders.includes("bitbucketServer") && /* @__PURE__ */ React.createElement(
73
+ ProviderSettingsItem,
74
+ {
75
+ title: "Bitbucket Server",
76
+ description: "Provides authentication towards Bitbucket Server APIs",
77
+ apiRef: bitbucketServerAuthApiRef,
78
+ icon: Star
79
+ }
80
+ ));
81
+ };
82
+
83
+ export { DefaultProviderSettings };
84
+ //# sourceMappingURL=DefaultProviderSettings.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DefaultProviderSettings.esm.js","sources":["../../../src/components/AuthProviders/DefaultProviderSettings.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 Star from '@material-ui/icons/Star';\nimport React from 'react';\nimport { ProviderSettingsItem } from './ProviderSettingsItem';\nimport {\n githubAuthApiRef,\n gitlabAuthApiRef,\n googleAuthApiRef,\n oktaAuthApiRef,\n microsoftAuthApiRef,\n bitbucketAuthApiRef,\n bitbucketServerAuthApiRef,\n atlassianAuthApiRef,\n oneloginAuthApiRef,\n} from '@backstage/core-plugin-api';\n\n/** @public */\nexport const DefaultProviderSettings = (props: {\n configuredProviders: string[];\n}) => {\n const { configuredProviders } = props;\n return (\n <>\n {configuredProviders.includes('google') && (\n <ProviderSettingsItem\n title=\"Google\"\n description=\"Provides authentication towards Google APIs and identities\"\n apiRef={googleAuthApiRef}\n icon={Star}\n />\n )}\n {configuredProviders.includes('microsoft') && (\n <ProviderSettingsItem\n title=\"Microsoft\"\n description=\"Provides authentication towards Microsoft APIs and identities\"\n apiRef={microsoftAuthApiRef}\n icon={Star}\n />\n )}\n {configuredProviders.includes('github') && (\n <ProviderSettingsItem\n title=\"GitHub\"\n description=\"Provides authentication towards GitHub APIs\"\n apiRef={githubAuthApiRef}\n icon={Star}\n />\n )}\n {configuredProviders.includes('gitlab') && (\n <ProviderSettingsItem\n title=\"GitLab\"\n description=\"Provides authentication towards GitLab APIs\"\n apiRef={gitlabAuthApiRef}\n icon={Star}\n />\n )}\n {configuredProviders.includes('okta') && (\n <ProviderSettingsItem\n title=\"Okta\"\n description=\"Provides authentication towards Okta APIs\"\n apiRef={oktaAuthApiRef}\n icon={Star}\n />\n )}\n {configuredProviders.includes('bitbucket') && (\n <ProviderSettingsItem\n title=\"Bitbucket\"\n description=\"Provides authentication towards Bitbucket APIs\"\n apiRef={bitbucketAuthApiRef}\n icon={Star}\n />\n )}\n {configuredProviders.includes('onelogin') && (\n <ProviderSettingsItem\n title=\"OneLogin\"\n description=\"Provides authentication towards OneLogin APIs\"\n apiRef={oneloginAuthApiRef}\n icon={Star}\n />\n )}\n {configuredProviders.includes('atlassian') && (\n <ProviderSettingsItem\n title=\"Atlassian\"\n description=\"Provides authentication towards Atlassian APIs\"\n apiRef={atlassianAuthApiRef}\n icon={Star}\n />\n )}\n {configuredProviders.includes('bitbucketServer') && (\n <ProviderSettingsItem\n title=\"Bitbucket Server\"\n description=\"Provides authentication towards Bitbucket Server APIs\"\n apiRef={bitbucketServerAuthApiRef}\n icon={Star}\n />\n )}\n </>\n );\n};\n"],"names":[],"mappings":";;;;;AAgCa,MAAA,uBAAA,GAA0B,CAAC,KAElC,KAAA;AACJ,EAAM,MAAA,EAAE,qBAAwB,GAAA,KAAA,CAAA;AAChC,EAAA,uBAEK,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,EAAA,mBAAA,CAAoB,QAAS,CAAA,QAAQ,CACpC,oBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,oBAAA;AAAA,IAAA;AAAA,MACC,KAAM,EAAA,QAAA;AAAA,MACN,WAAY,EAAA,4DAAA;AAAA,MACZ,MAAQ,EAAA,gBAAA;AAAA,MACR,IAAM,EAAA,IAAA;AAAA,KAAA;AAAA,GAGT,EAAA,mBAAA,CAAoB,QAAS,CAAA,WAAW,CACvC,oBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,oBAAA;AAAA,IAAA;AAAA,MACC,KAAM,EAAA,WAAA;AAAA,MACN,WAAY,EAAA,+DAAA;AAAA,MACZ,MAAQ,EAAA,m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A;AAAA,MACR,IAAM,EAAA,IAAA;AAAA,KAAA;AAAA,GAGT,EAAA,mBAAA,CAAoB,QAAS,CAAA,WAAW,CACvC,oBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,oBAAA;AAAA,IAAA;AAAA,MACC,KAAM,EAAA,WAAA;AAAA,MACN,WAAY,EAAA,gDAAA;AAAA,MACZ,MAAQ,EAAA,mBAAA;AAAA,MACR,IAAM,EAAA,IAAA;AAAA,KAAA;AAAA,GAGT,EAAA,mBAAA,CAAoB,QAAS,CAAA,iBAAiB,CAC7C,oBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,oBAAA;AAAA,IAAA;AAAA,MACC,KAAM,EAAA,kBAAA;AAAA,MACN,WAAY,EAAA,uDAAA;AAAA,MACZ,MAAQ,EAAA,yBAAA;AAAA,MACR,IAAM,EAAA,IAAA;AAAA,KAAA;AAAA,GAGZ,CAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,41 @@
1
+ import React from 'react';
2
+ import Button from '@material-ui/core/Button';
3
+ import Typography from '@material-ui/core/Typography';
4
+ import { EmptyState, CodeSnippet } from '@backstage/core-components';
5
+
6
+ const EXAMPLE = `auth:
7
+ providers:
8
+ google:
9
+ development:
10
+ clientId: \${AUTH_GOOGLE_CLIENT_ID}
11
+ clientSecret: \${AUTH_GOOGLE_CLIENT_SECRET}
12
+ `;
13
+ const EmptyProviders = () => /* @__PURE__ */ React.createElement(
14
+ EmptyState,
15
+ {
16
+ missing: "content",
17
+ title: "No Authentication Providers",
18
+ description: "You can add Authentication Providers to Backstage which allows you to use these providers to authenticate yourself.",
19
+ action: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Typography, { variant: "body1" }, "Open ", /* @__PURE__ */ React.createElement("code", null, "app-config.yaml"), " and make the changes as highlighted below:"), /* @__PURE__ */ React.createElement(
20
+ CodeSnippet,
21
+ {
22
+ text: EXAMPLE,
23
+ language: "yaml",
24
+ showLineNumbers: true,
25
+ highlightedNumbers: [3, 4, 5, 6, 7, 8],
26
+ customStyle: { background: "inherit", fontSize: "115%" }
27
+ }
28
+ ), /* @__PURE__ */ React.createElement(
29
+ Button,
30
+ {
31
+ variant: "contained",
32
+ color: "primary",
33
+ href: "https://backstage.io/docs/auth/add-auth-provider"
34
+ },
35
+ "Read More"
36
+ ))
37
+ }
38
+ );
39
+
40
+ export { EmptyProviders };
41
+ //# sourceMappingURL=EmptyProviders.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EmptyProviders.esm.js","sources":["../../../src/components/AuthProviders/EmptyProviders.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 Button from '@material-ui/core/Button';\nimport Typography from '@material-ui/core/Typography';\nimport { CodeSnippet, EmptyState } from '@backstage/core-components';\n\nconst EXAMPLE = `auth:\n providers:\n google:\n development:\n clientId: \\${AUTH_GOOGLE_CLIENT_ID}\n clientSecret: \\${AUTH_GOOGLE_CLIENT_SECRET}\n`;\n\nexport const EmptyProviders = () => (\n <EmptyState\n missing=\"content\"\n title=\"No Authentication Providers\"\n description=\"You can add Authentication Providers to Backstage which allows you to use these providers to authenticate yourself.\"\n action={\n <>\n <Typography variant=\"body1\">\n Open <code>app-config.yaml</code> and make the changes as highlighted\n below:\n </Typography>\n <CodeSnippet\n text={EXAMPLE}\n language=\"yaml\"\n showLineNumbers\n highlightedNumbers={[3, 4, 5, 6, 7, 8]}\n customStyle={{ background: 'inherit', fontSize: '115%' }}\n />\n <Button\n variant=\"contained\"\n color=\"primary\"\n href=\"https://backstage.io/docs/auth/add-auth-provider\"\n >\n Read More\n </Button>\n </>\n }\n />\n);\n"],"names":[],"mappings":";;;;;AAqBA,MAAM,OAAU,GAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA,CAAA;AAQT,MAAM,iBAAiB,sBAC5B,KAAA,CAAA,aAAA;AAAA,EAAC,UAAA;AAAA,EAAA;AAAA,IACC,OAAQ,EAAA,SAAA;AAAA,IACR,KAAM,EAAA,6BAAA;AAAA,IACN,WAAY,EAAA,qHAAA;AAAA,IACZ,MACE,kBAAA,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,kBACG,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,OAAA,EAAA,EAAQ,OACrB,kBAAA,KAAA,CAAA,aAAA,CAAC,MAAK,EAAA,IAAA,EAAA,iBAAe,CAAO,EAAA,6CAEnC,CACA,kBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,WAAA;AAAA,MAAA;AAAA,QACC,IAAM,EAAA,OAAA;AAAA,QACN,QAAS,EAAA,MAAA;AAAA,QACT,eAAe,EAAA,IAAA;AAAA,QACf,oBAAoB,CAAC,CAAA,EAAG,GAAG,CAAG,EAAA,CAAA,EAAG,GAAG,CAAC,CAAA;AAAA,QACrC,WAAa,EAAA,EAAE,UAAY,EAAA,SAAA,EAAW,UAAU,MAAO,EAAA;AAAA,OAAA;AAAA,KAEzD,kBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,OAAQ,EAAA,WAAA;AAAA,QACR,KAAM,EAAA,SAAA;AAAA,QACN,IAAK,EAAA,kDAAA;AAAA,OAAA;AAAA,MACN,WAAA;AAAA,KAGH,CAAA;AAAA,GAAA;AAEJ;;;;"}
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import Avatar from '@material-ui/core/Avatar';
3
+ import { makeStyles } from '@material-ui/core/styles';
4
+ import { sidebarConfig } from '@backstage/core-components';
5
+
6
+ const useStyles = makeStyles((theme) => ({
7
+ avatar: {
8
+ width: ({ size }) => size,
9
+ height: ({ size }) => size,
10
+ fontSize: ({ size }) => size * 0.7,
11
+ border: `1px solid ${theme.palette.textSubtle}`
12
+ }
13
+ }));
14
+ const ProviderSettingsAvatar = ({ size, picture }) => {
15
+ const { iconSize } = sidebarConfig;
16
+ const classes = useStyles(size ? { size } : { size: iconSize });
17
+ return /* @__PURE__ */ React.createElement(Avatar, { src: picture, className: classes.avatar });
18
+ };
19
+
20
+ export { ProviderSettingsAvatar };
21
+ //# sourceMappingURL=ProviderSettingsAvatar.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProviderSettingsAvatar.esm.js","sources":["../../../src/components/AuthProviders/ProviderSettingsAvatar.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 Avatar from '@material-ui/core/Avatar';\nimport { makeStyles, Theme } from '@material-ui/core/styles';\nimport { sidebarConfig } from '@backstage/core-components';\n\nconst useStyles = makeStyles<Theme, { size: number }>(theme => ({\n avatar: {\n width: ({ size }) => size,\n height: ({ size }) => size,\n fontSize: ({ size }) => size * 0.7,\n border: `1px solid ${theme.palette.textSubtle}`,\n },\n}));\n\ntype Props = { size?: number; picture: string | undefined };\n\nexport const ProviderSettingsAvatar = ({ size, picture }: Props) => {\n const { iconSize } = sidebarConfig;\n const classes = useStyles(size ? { size } : { size: iconSize });\n\n return <Avatar src={picture} className={classes.avatar} />;\n};\n"],"names":[],"mappings":";;;;;AAqBA,MAAM,SAAA,GAAY,WAAoC,CAAU,KAAA,MAAA;AAAA,EAC9D,MAAQ,EAAA;AAAA,IACN,KAAO,EAAA,CAAC,EAAE,IAAA,EAAW,KAAA,IAAA;AAAA,IACrB,MAAQ,EAAA,CAAC,EAAE,IAAA,EAAW,KAAA,IAAA;AAAA,IACtB,QAAU,EAAA,CAAC,EAAE,IAAA,OAAW,IAAO,GAAA,GAAA;AAAA,IAC/B,MAAQ,EAAA,CAAA,UAAA,EAAa,KAAM,CAAA,OAAA,CAAQ,UAAU,CAAA,CAAA;AAAA,GAC/C;AACF,CAAE,CAAA,CAAA,CAAA;AAIK,MAAM,sBAAyB,GAAA,CAAC,EAAE,IAAA,EAAM,SAAqB,KAAA;AAClE,EAAM,MAAA,EAAE,UAAa,GAAA,aAAA,CAAA;AACrB,EAAM,MAAA,OAAA,GAAU,UAAU,IAAO,GAAA,EAAE,MAAS,GAAA,EAAE,IAAM,EAAA,QAAA,EAAU,CAAA,CAAA;AAE9D,EAAA,2CAAQ,MAAO,EAAA,EAAA,GAAA,EAAK,OAAS,EAAA,SAAA,EAAW,QAAQ,MAAQ,EAAA,CAAA,CAAA;AAC1D;;;;"}
@@ -0,0 +1,83 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import Button from '@material-ui/core/Button';
3
+ import Grid from '@material-ui/core/Grid';
4
+ import ListItem from '@material-ui/core/ListItem';
5
+ import ListItemIcon from '@material-ui/core/ListItemIcon';
6
+ import ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction';
7
+ import ListItemText from '@material-ui/core/ListItemText';
8
+ import Tooltip from '@material-ui/core/Tooltip';
9
+ import Typography from '@material-ui/core/Typography';
10
+ import { useApi, errorApiRef, SessionState } from '@backstage/core-plugin-api';
11
+ import { ProviderSettingsAvatar } from './ProviderSettingsAvatar.esm.js';
12
+
13
+ const emptyProfile = {};
14
+ const ProviderSettingsItem = (props) => {
15
+ const { title, description, icon: Icon, apiRef } = props;
16
+ const api = useApi(apiRef);
17
+ const errorApi = useApi(errorApiRef);
18
+ const [signedIn, setSignedIn] = useState(false);
19
+ const [profile, setProfile] = useState(emptyProfile);
20
+ useEffect(() => {
21
+ let didCancel = false;
22
+ const subscription = api.sessionState$().subscribe((sessionState) => {
23
+ if (sessionState !== SessionState.SignedIn) {
24
+ setProfile(emptyProfile);
25
+ setSignedIn(false);
26
+ }
27
+ if (!didCancel) {
28
+ api.getProfile({ optional: true }).then((profileResponse) => {
29
+ if (!didCancel) {
30
+ if (sessionState === SessionState.SignedIn) {
31
+ setSignedIn(true);
32
+ }
33
+ if (profileResponse) {
34
+ setProfile(profileResponse);
35
+ }
36
+ }
37
+ });
38
+ }
39
+ });
40
+ return () => {
41
+ didCancel = true;
42
+ subscription.unsubscribe();
43
+ };
44
+ }, [api]);
45
+ return /* @__PURE__ */ React.createElement(ListItem, null, /* @__PURE__ */ React.createElement(ListItemIcon, null, /* @__PURE__ */ React.createElement(Icon, null)), /* @__PURE__ */ React.createElement(
46
+ ListItemText,
47
+ {
48
+ primary: title,
49
+ secondary: /* @__PURE__ */ React.createElement(Tooltip, { placement: "top", arrow: true, title: description }, /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 6 }, /* @__PURE__ */ React.createElement(Grid, { item: true }, /* @__PURE__ */ React.createElement(ProviderSettingsAvatar, { size: 48, picture: profile.picture })), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12, sm: true, container: true }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: true, container: true, direction: "column", spacing: 2 }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: true }, profile.displayName && /* @__PURE__ */ React.createElement(
50
+ Typography,
51
+ {
52
+ variant: "subtitle1",
53
+ color: "textPrimary",
54
+ gutterBottom: true
55
+ },
56
+ profile.displayName
57
+ ), profile.email && /* @__PURE__ */ React.createElement(Typography, { variant: "body2", color: "textSecondary" }, profile.email), /* @__PURE__ */ React.createElement(Typography, { variant: "body2", color: "textSecondary" }, description)))))),
58
+ secondaryTypographyProps: { noWrap: true, style: { width: "80%" } }
59
+ }
60
+ ), /* @__PURE__ */ React.createElement(ListItemSecondaryAction, null, /* @__PURE__ */ React.createElement(
61
+ Tooltip,
62
+ {
63
+ placement: "top",
64
+ arrow: true,
65
+ title: signedIn ? `Sign out from ${title}` : `Sign in to ${title}`
66
+ },
67
+ /* @__PURE__ */ React.createElement(
68
+ Button,
69
+ {
70
+ variant: "outlined",
71
+ color: "primary",
72
+ onClick: () => {
73
+ const action = signedIn ? api.signOut() : api.signIn();
74
+ action.catch((error) => errorApi.post(error));
75
+ }
76
+ },
77
+ signedIn ? `Sign out` : `Sign in`
78
+ )
79
+ )));
80
+ };
81
+
82
+ export { ProviderSettingsItem };
83
+ //# sourceMappingURL=ProviderSettingsItem.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProviderSettingsItem.esm.js","sources":["../../../src/components/AuthProviders/ProviderSettingsItem.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, { useEffect, useState } from 'react';\nimport Button from '@material-ui/core/Button';\nimport Grid from '@material-ui/core/Grid';\nimport ListItem from '@material-ui/core/ListItem';\nimport ListItemIcon from '@material-ui/core/ListItemIcon';\nimport ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction';\nimport ListItemText from '@material-ui/core/ListItemText';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport Typography from '@material-ui/core/Typography';\nimport {\n ApiRef,\n SessionApi,\n SessionState,\n ProfileInfoApi,\n ProfileInfo,\n useApi,\n errorApiRef,\n IconComponent,\n} from '@backstage/core-plugin-api';\nimport { ProviderSettingsAvatar } from './ProviderSettingsAvatar';\n\nconst emptyProfile: ProfileInfo = {};\n\n/** @public */\nexport const ProviderSettingsItem = (props: {\n title: string;\n description: string;\n icon: IconComponent;\n apiRef: ApiRef<ProfileInfoApi & SessionApi>;\n}) => {\n const { title, description, icon: Icon, apiRef } = props;\n\n const api = useApi(apiRef);\n const errorApi = useApi(errorApiRef);\n const [signedIn, setSignedIn] = useState(false);\n const [profile, setProfile] = useState<ProfileInfo>(emptyProfile);\n\n useEffect(() => {\n let didCancel = false;\n\n const subscription = api\n .sessionState$()\n .subscribe((sessionState: SessionState) => {\n if (sessionState !== SessionState.SignedIn) {\n setProfile(emptyProfile);\n setSignedIn(false);\n }\n if (!didCancel) {\n api\n .getProfile({ optional: true })\n .then((profileResponse: ProfileInfo | undefined) => {\n if (!didCancel) {\n if (sessionState === SessionState.SignedIn) {\n setSignedIn(true);\n }\n if (profileResponse) {\n setProfile(profileResponse);\n }\n }\n });\n }\n });\n\n return () => {\n didCancel = true;\n subscription.unsubscribe();\n };\n }, [api]);\n\n return (\n <ListItem>\n <ListItemIcon>\n <Icon />\n </ListItemIcon>\n <ListItemText\n primary={title}\n secondary={\n <Tooltip placement=\"top\" arrow title={description}>\n <Grid container spacing={6}>\n <Grid item>\n <ProviderSettingsAvatar size={48} picture={profile.picture} />\n </Grid>\n <Grid item xs={12} sm container>\n <Grid item xs container direction=\"column\" spacing={2}>\n <Grid item xs>\n {profile.displayName && (\n <Typography\n variant=\"subtitle1\"\n color=\"textPrimary\"\n gutterBottom\n >\n {profile.displayName}\n </Typography>\n )}\n {profile.email && (\n <Typography variant=\"body2\" color=\"textSecondary\">\n {profile.email}\n </Typography>\n )}\n <Typography variant=\"body2\" color=\"textSecondary\">\n {description}\n </Typography>\n </Grid>\n </Grid>\n </Grid>\n </Grid>\n </Tooltip>\n }\n secondaryTypographyProps={{ noWrap: true, style: { width: '80%' } }}\n />\n <ListItemSecondaryAction>\n <Tooltip\n placement=\"top\"\n arrow\n title={signedIn ? `Sign out from ${title}` : `Sign in to ${title}`}\n >\n <Button\n variant=\"outlined\"\n color=\"primary\"\n onClick={() => {\n const action = signedIn ? api.signOut() : api.signIn();\n action.catch(error => errorApi.post(error));\n }}\n >\n {signedIn ? `Sign out` : `Sign in`}\n </Button>\n </Tooltip>\n </ListItemSecondaryAction>\n </ListItem>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AAqCA,MAAM,eAA4B,EAAC,CAAA;AAGtB,MAAA,oBAAA,GAAuB,CAAC,KAK/B,KAAA;AACJ,EAAA,MAAM,EAAE,KAAO,EAAA,WAAA,EAAa,IAAM,EAAA,IAAA,EAAM,QAAW,GAAA,KAAA,CAAA;AAEnD,EAAM,MAAA,GAAA,GAAM,OAAO,MAAM,CAAA,CAAA;AACzB,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA,CAAA;AACnC,EAAA,MAAM,CAAC,QAAA,EAAU,WAAW,CAAA,GAAI,SAAS,KAAK,CAAA,CAAA;AAC9C,EAAA,MAAM,CAAC,OAAA,EAAS,UAAU,CAAA,GAAI,SAAsB,YAAY,CAAA,CAAA;AAEhE,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,SAAY,GAAA,KAAA,CAAA;AAEhB,IAAA,MAAM,eAAe,GAClB,CAAA,aAAA,EACA,CAAA,SAAA,CAAU,CAAC,YAA+B,KAAA;AACzC,MAAI,IAAA,YAAA,KAAiB,aAAa,QAAU,EAAA;AAC1C,QAAA,UAAA,CAAW,YAAY,CAAA,CAAA;AACvB,QAAA,WAAA,CAAY,KAAK,CAAA,CAAA;AAAA,OACnB;AACA,MAAA,IAAI,CAAC,SAAW,EAAA;AACd,QACG,GAAA,CAAA,UAAA,CAAW,EAAE,QAAU,EAAA,IAAA,EAAM,CAC7B,CAAA,IAAA,CAAK,CAAC,eAA6C,KAAA;AAClD,UAAA,IAAI,CAAC,SAAW,EAAA;AACd,YAAI,IAAA,YAAA,KAAiB,aAAa,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,EAAA,GAAI,IAAI,MAAO,EAAA,CAAA;AACrD,UAAA,MAAA,CAAO,KAAM,CAAA,CAAA,KAAA,KAAS,QAAS,CAAA,IAAA,CAAK,KAAK,CAAC,CAAA,CAAA;AAAA,SAC5C;AAAA,OAAA;AAAA,MAEC,WAAW,CAAa,QAAA,CAAA,GAAA,CAAA,OAAA,CAAA;AAAA,KAC3B;AAAA,GAEJ,CACF,CAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import List from '@material-ui/core/List';
3
+ import { EmptyProviders } from './EmptyProviders.esm.js';
4
+ import { DefaultProviderSettings } from './DefaultProviderSettings.esm.js';
5
+ import { useApi, configApiRef } from '@backstage/core-plugin-api';
6
+ import { InfoCard } from '@backstage/core-components';
7
+
8
+ const UserSettingsAuthProviders = (props) => {
9
+ const { providerSettings } = props;
10
+ const configApi = useApi(configApiRef);
11
+ const providersConfig = configApi.getOptionalConfig("auth.providers");
12
+ const configuredProviders = (providersConfig == null ? void 0 : providersConfig.keys()) || [];
13
+ const providers = providerSettings != null ? providerSettings : /* @__PURE__ */ React.createElement(DefaultProviderSettings, { configuredProviders });
14
+ if (!providerSettings && !(configuredProviders == null ? void 0 : configuredProviders.length)) {
15
+ return /* @__PURE__ */ React.createElement(EmptyProviders, null);
16
+ }
17
+ return /* @__PURE__ */ React.createElement(InfoCard, { title: "Available Providers" }, /* @__PURE__ */ React.createElement(List, { dense: true }, providers));
18
+ };
19
+
20
+ export { UserSettingsAuthProviders };
21
+ //# sourceMappingURL=UserSettingsAuthProviders.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UserSettingsAuthProviders.esm.js","sources":["../../../src/components/AuthProviders/UserSettingsAuthProviders.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 List from '@material-ui/core/List';\nimport { EmptyProviders } from './EmptyProviders';\nimport { DefaultProviderSettings } from './DefaultProviderSettings';\nimport { configApiRef, useApi } from '@backstage/core-plugin-api';\nimport { InfoCard } from '@backstage/core-components';\n\n/** @public */\nexport const UserSettingsAuthProviders = (props: {\n providerSettings?: JSX.Element;\n}) => {\n const { providerSettings } = props;\n const configApi = useApi(configApiRef);\n const providersConfig = configApi.getOptionalConfig('auth.providers');\n const configuredProviders = providersConfig?.keys() || [];\n const providers = providerSettings ?? (\n <DefaultProviderSettings configuredProviders={configuredProviders} />\n );\n\n if (!providerSettings && !configuredProviders?.length) {\n return <EmptyProviders />;\n }\n\n return (\n <InfoCard title=\"Available Providers\">\n <List dense>{providers}</List>\n </InfoCard>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAwBa,MAAA,yBAAA,GAA4B,CAAC,KAEpC,KAAA;AACJ,EAAM,MAAA,EAAE,kBAAqB,GAAA,KAAA,CAAA;AAC7B,EAAM,MAAA,SAAA,GAAY,OAAO,YAAY,CAAA,CAAA;AACrC,EAAM,MAAA,eAAA,GAAkB,SAAU,CAAA,iBAAA,CAAkB,gBAAgB,CAAA,CAAA;AACpE,EAAM,MAAA,mBAAA,GAAA,CAAsB,eAAiB,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,eAAA,CAAA,IAAA,EAAA,KAAU,EAAC,CAAA;AACxD,EAAA,MAAM,SAAY,GAAA,gBAAA,IAAA,IAAA,GAAA,gBAAA,mBACf,KAAA,CAAA,aAAA,CAAA,uBAAA,EAAA,EAAwB,mBAA0C,EAAA,CAAA,CAAA;AAGrE,EAAA,IAAI,CAAC,gBAAA,IAAoB,EAAC,mBAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,mBAAA,CAAqB,MAAQ,CAAA,EAAA;AACrD,IAAA,2CAAQ,cAAe,EAAA,IAAA,CAAA,CAAA;AAAA,GACzB;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,YAAS,KAAM,EAAA,qBAAA,EAAA,sCACb,IAAK,EAAA,EAAA,KAAA,EAAK,IAAE,EAAA,EAAA,SAAU,CACzB,CAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,44 @@
1
+ import React from 'react';
2
+ import { UserSettingsAuthProviders } from '../AuthProviders/UserSettingsAuthProviders.esm.js';
3
+ import '@material-ui/icons/Star';
4
+ import '@material-ui/core/Button';
5
+ import '@material-ui/core/Grid';
6
+ import '@material-ui/core/ListItem';
7
+ import '@material-ui/core/ListItemIcon';
8
+ import '@material-ui/core/ListItemSecondaryAction';
9
+ import '@material-ui/core/ListItemText';
10
+ import '@material-ui/core/Tooltip';
11
+ import '@material-ui/core/Typography';
12
+ import '@backstage/core-plugin-api';
13
+ import '../AuthProviders/ProviderSettingsAvatar.esm.js';
14
+ import { UserSettingsFeatureFlags } from '../FeatureFlags/UserSettingsFeatureFlags.esm.js';
15
+ import { UserSettingsGeneral } from '../General/UserSettingsGeneral.esm.js';
16
+ import '../General/UserSettingsSignInAvatar.esm.js';
17
+ import '@material-ui/core/IconButton';
18
+ import '@material-ui/core/Menu';
19
+ import '@material-ui/core/MenuItem';
20
+ import '@material-ui/icons/MeetingRoom';
21
+ import '@material-ui/icons/MoreVert';
22
+ import 'react-use/esm/useAsync';
23
+ import '@backstage/core-components';
24
+ import '@material-ui/core/List';
25
+ import '@material-ui/core/Switch';
26
+ import '../General/UserSettingsThemeToggle.esm.js';
27
+ import '../General/UserSettingsLanguageToggle.esm.js';
28
+ import '@backstage/plugin-catalog-react';
29
+ import { SettingsLayout } from '../SettingsLayout/SettingsLayout.esm.js';
30
+
31
+ const DefaultSettingsPage = (props) => {
32
+ const { providerSettings, tabs } = props;
33
+ return /* @__PURE__ */ React.createElement(SettingsLayout, null, /* @__PURE__ */ React.createElement(SettingsLayout.Route, { path: "general", title: "General" }, /* @__PURE__ */ React.createElement(UserSettingsGeneral, null)), /* @__PURE__ */ React.createElement(
34
+ SettingsLayout.Route,
35
+ {
36
+ path: "auth-providers",
37
+ title: "Authentication Providers"
38
+ },
39
+ /* @__PURE__ */ React.createElement(UserSettingsAuthProviders, { providerSettings })
40
+ ), /* @__PURE__ */ React.createElement(SettingsLayout.Route, { path: "feature-flags", title: "Feature Flags" }, /* @__PURE__ */ React.createElement(UserSettingsFeatureFlags, null)), tabs);
41
+ };
42
+
43
+ export { DefaultSettingsPage };
44
+ //# sourceMappingURL=DefaultSettingsPage.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DefaultSettingsPage.esm.js","sources":["../../../src/components/DefaultSettingsPage/DefaultSettingsPage.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 { UserSettingsAuthProviders } from '../AuthProviders';\nimport { UserSettingsFeatureFlags } from '../FeatureFlags';\nimport { UserSettingsGeneral } from '../General';\nimport { SettingsLayout, SettingsLayoutRouteProps } from '../SettingsLayout';\n\n/**\n * @public\n */\nexport const DefaultSettingsPage = (props: {\n tabs?: React.ReactElement<SettingsLayoutRouteProps>[];\n providerSettings?: JSX.Element;\n}) => {\n const { providerSettings, tabs } = props;\n\n return (\n <SettingsLayout>\n <SettingsLayout.Route path=\"general\" title=\"General\">\n <UserSettingsGeneral />\n </SettingsLayout.Route>\n <SettingsLayout.Route\n path=\"auth-providers\"\n title=\"Authentication Providers\"\n >\n <UserSettingsAuthProviders providerSettings={providerSettings} />\n </SettingsLayout.Route>\n <SettingsLayout.Route path=\"feature-flags\" title=\"Feature Flags\">\n <UserSettingsFeatureFlags />\n </SettingsLayout.Route>\n {tabs}\n </SettingsLayout>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBa,MAAA,mBAAA,GAAsB,CAAC,KAG9B,KAAA;AACJ,EAAM,MAAA,EAAE,gBAAkB,EAAA,IAAA,EAAS,GAAA,KAAA,CAAA;AAEnC,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,cAAA,EAAA,IAAA,kBACE,KAAA,CAAA,aAAA,CAAA,cAAA,CAAe,KAAf,EAAA,EAAqB,IAAK,EAAA,SAAA,EAAU,KAAM,EAAA,SAAA,EAAA,kBACxC,KAAA,CAAA,aAAA,CAAA,mBAAA,EAAA,IAAoB,CACvB,CACA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,cAAe,CAAA,KAAA;AAAA,IAAf;AAAA,MACC,IAAK,EAAA,gBAAA;AAAA,MACL,KAAM,EAAA,0BAAA;AAAA,KAAA;AAAA,oBAEN,KAAA,CAAA,aAAA,CAAC,6BAA0B,gBAAoC,EAAA,CAAA;AAAA,GAEjE,kBAAA,KAAA,CAAA,aAAA,CAAC,cAAe,CAAA,KAAA,EAAf,EAAqB,IAAA,EAAK,eAAgB,EAAA,KAAA,EAAM,eAC/C,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,wBAAyB,EAAA,IAAA,CAC5B,GACC,IACH,CAAA,CAAA;AAEJ;;;;"}