@backstage/plugin-notifications 0.5.21-next.2 → 0.6.1-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/dist/alpha/extensions/unreadNotificationsHomeWidget.esm.js +57 -0
  3. package/dist/alpha/extensions/unreadNotificationsHomeWidget.esm.js.map +1 -0
  4. package/dist/alpha.d.ts +17 -0
  5. package/dist/alpha.esm.js +2 -1
  6. package/dist/alpha.esm.js.map +1 -1
  7. package/dist/api/NotificationsApi.esm.js.map +1 -1
  8. package/dist/api/NotificationsClient.esm.js.map +1 -1
  9. package/dist/components/NotificationsFilters/NotificationsFilters.esm.js.map +1 -1
  10. package/dist/components/NotificationsPage/NotificationsPage.esm.js +48 -4
  11. package/dist/components/NotificationsPage/NotificationsPage.esm.js.map +1 -1
  12. package/dist/components/NotificationsPage/index.esm.js +1 -1
  13. package/dist/components/NotificationsSideBarItem/NotificationsSideBarItem.esm.js +1 -1
  14. package/dist/components/NotificationsSideBarItem/NotificationsSideBarItem.esm.js.map +1 -1
  15. package/dist/components/NotificationsSideBarItem/NotificationsSideBarItem.module.css.esm.js.map +1 -1
  16. package/dist/components/NotificationsTable/BulkActions.esm.js.map +1 -1
  17. package/dist/components/NotificationsTable/DefaultNotificationDescription.esm.js.map +1 -1
  18. package/dist/components/NotificationsTable/NotificationDescription.esm.js.map +1 -1
  19. package/dist/components/NotificationsTable/NotificationIcon.esm.js +14 -8
  20. package/dist/components/NotificationsTable/NotificationIcon.esm.js.map +1 -1
  21. package/dist/components/NotificationsTable/NotificationsTable.esm.js +76 -41
  22. package/dist/components/NotificationsTable/NotificationsTable.esm.js.map +1 -1
  23. package/dist/components/NotificationsTable/NotificationsTable.module.css.esm.js +2 -2
  24. package/dist/components/NotificationsTable/NotificationsTable.module.css.esm.js.map +1 -1
  25. package/dist/components/NotificationsTable/SelectAll.esm.js.map +1 -1
  26. package/dist/components/NotificationsTable/SelectAll.module.css.esm.js.map +1 -1
  27. package/dist/components/NotificationsTable/SeverityIcon.esm.js.map +1 -1
  28. package/dist/components/NotificationsTable/SeverityIcon.module.css.esm.js.map +1 -1
  29. package/dist/components/UnreadNotificationsCard/UnreadNotificationsCard.esm.js +255 -0
  30. package/dist/components/UnreadNotificationsCard/UnreadNotificationsCard.esm.js.map +1 -0
  31. package/dist/components/UnreadNotificationsCard/UnreadNotificationsCard.module.css.esm.js +8 -0
  32. package/dist/components/UnreadNotificationsCard/UnreadNotificationsCard.module.css.esm.js.map +1 -0
  33. package/dist/components/UnreadNotificationsCard/index.esm.js +7 -0
  34. package/dist/components/UnreadNotificationsCard/index.esm.js.map +1 -0
  35. package/dist/components/UserNotificationSettingsCard/NoBorderTableCell.esm.js.map +1 -1
  36. package/dist/components/UserNotificationSettingsCard/NoBorderTableCell.module.css.esm.js.map +1 -1
  37. package/dist/components/UserNotificationSettingsCard/NotificationFormatContext.esm.js.map +1 -1
  38. package/dist/components/UserNotificationSettingsCard/OriginRow.esm.js +3 -3
  39. package/dist/components/UserNotificationSettingsCard/OriginRow.esm.js.map +1 -1
  40. package/dist/components/UserNotificationSettingsCard/TopicRow.esm.js +1 -3
  41. package/dist/components/UserNotificationSettingsCard/TopicRow.esm.js.map +1 -1
  42. package/dist/components/UserNotificationSettingsCard/UserNotificationSettingsCard.esm.js +1 -0
  43. package/dist/components/UserNotificationSettingsCard/UserNotificationSettingsCard.esm.js.map +1 -1
  44. package/dist/components/UserNotificationSettingsCard/UserNotificationSettingsPanel.esm.js.map +1 -1
  45. package/dist/components/UserNotificationSettingsCard/UserNotificationSettingsPanel.module.css.esm.js.map +1 -1
  46. package/dist/hooks/useNotificationsApi.esm.js.map +1 -1
  47. package/dist/hooks/useNotificationsRefresh.esm.js +24 -0
  48. package/dist/hooks/useNotificationsRefresh.esm.js.map +1 -0
  49. package/dist/hooks/useTitleCounter.esm.js.map +1 -1
  50. package/dist/hooks/useWebNotifications.esm.js.map +1 -1
  51. package/dist/index.d.ts +9 -1
  52. package/dist/index.esm.js +1 -0
  53. package/dist/index.esm.js.map +1 -1
  54. package/dist/node_modules_dist/style-inject/dist/style-inject.es.esm.js.map +1 -1
  55. package/dist/plugin.esm.js.map +1 -1
  56. package/dist/plugins/notifications/package.json.esm.js +2 -1
  57. package/dist/plugins/notifications/package.json.esm.js.map +1 -1
  58. package/dist/routes.esm.js.map +1 -1
  59. package/dist/translation.esm.js +9 -0
  60. package/dist/translation.esm.js.map +1 -1
  61. package/dist/utils/notificationLinks.esm.js +11 -0
  62. package/dist/utils/notificationLinks.esm.js.map +1 -0
  63. package/dist/utils/plainText.esm.js +30 -0
  64. package/dist/utils/plainText.esm.js.map +1 -0
  65. package/package.json +13 -12
@@ -0,0 +1,255 @@
1
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
+ import { useState, useMemo, useEffect, useCallback } from 'react';
3
+ import throttle from 'lodash/throttle';
4
+ import RelativeTime from 'react-relative-time';
5
+ import { RiCheckDoubleLine, RiRssFill } from '@remixicon/react';
6
+ import { InfoCard, Progress, ErrorPanel, LinkButton, Link } from '@backstage/core-components';
7
+ import { Text } from '@backstage/ui';
8
+ import { useApi } from '@backstage/core-plugin-api';
9
+ import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
10
+ import { notificationsApiRef } from '../../api/NotificationsApi.esm.js';
11
+ import '@backstage/errors';
12
+ import { useNotificationsApi } from '../../hooks/useNotificationsApi.esm.js';
13
+ import { useNotificationsRefresh } from '../../hooks/useNotificationsRefresh.esm.js';
14
+ import '../../routes.esm.js';
15
+ import '../../hooks/useTitleCounter.esm.js';
16
+ import { notificationsTranslationRef } from '../../translation.esm.js';
17
+ import { getNotificationsPageLink } from '../../utils/notificationLinks.esm.js';
18
+ import { truncateText } from '../../utils/plainText.esm.js';
19
+ import { BulkActions } from '../NotificationsTable/BulkActions.esm.js';
20
+ import { NotificationIcon } from '../NotificationsTable/NotificationIcon.esm.js';
21
+ import styles from './UnreadNotificationsCard.module.css.esm.js';
22
+
23
+ const ThrottleDelayMs = 2e3;
24
+ const resolveMaxMessages = ({
25
+ maxMessages,
26
+ initialCount
27
+ }) => maxMessages ?? initialCount ?? 5;
28
+ const resolveCharLimit = ({
29
+ charLimit,
30
+ maxChars
31
+ }) => charLimit ?? maxChars ?? 80;
32
+ const NotificationListItem = ({
33
+ notification,
34
+ maxChars,
35
+ descriptionMaxChars,
36
+ onSwitchReadStatus,
37
+ onSwitchSavedStatus
38
+ }) => {
39
+ const {
40
+ display: titleDisplay,
41
+ truncated: titleTruncated,
42
+ full: titleFull
43
+ } = truncateText(notification.payload.title, maxChars);
44
+ const description = notification.payload.description ? truncateText(notification.payload.description, descriptionMaxChars) : void 0;
45
+ return /* @__PURE__ */ jsxs("div", { className: styles.notificationRow, children: [
46
+ /* @__PURE__ */ jsxs("div", { className: styles.notificationContent, children: [
47
+ /* @__PURE__ */ jsx("div", { className: styles.severityItem, children: /* @__PURE__ */ jsx(NotificationIcon, { notification }) }),
48
+ /* @__PURE__ */ jsxs("div", { className: styles.notificationText, children: [
49
+ /* @__PURE__ */ jsx(Text, { variant: "body-medium", className: styles.notificationTitle, children: /* @__PURE__ */ jsx(
50
+ Link,
51
+ {
52
+ to: getNotificationsPageLink(notification.id),
53
+ title: titleTruncated ? titleFull : void 0,
54
+ children: titleDisplay
55
+ }
56
+ ) }),
57
+ description ? /* @__PURE__ */ jsx(
58
+ Text,
59
+ {
60
+ variant: "body-small",
61
+ color: "secondary",
62
+ className: styles.notificationDescription,
63
+ title: description.truncated ? description.full : void 0,
64
+ children: description.display
65
+ }
66
+ ) : null,
67
+ /* @__PURE__ */ jsxs(
68
+ Text,
69
+ {
70
+ variant: "body-small",
71
+ color: "secondary",
72
+ className: styles.metaRow,
73
+ children: [
74
+ !notification.user && /* @__PURE__ */ jsx(RiRssFill, { size: 14, className: styles.broadcastIcon }),
75
+ notification.origin && /* @__PURE__ */ jsxs(Fragment, { children: [
76
+ /* @__PURE__ */ jsx("span", { className: styles.notificationInfoRow, children: notification.origin }),
77
+ "\u2022"
78
+ ] }),
79
+ notification.payload.topic && /* @__PURE__ */ jsxs(Fragment, { children: [
80
+ /* @__PURE__ */ jsx("span", { className: styles.notificationInfoRow, children: notification.payload.topic }),
81
+ "\u2022"
82
+ ] }),
83
+ notification.created && /* @__PURE__ */ jsx(
84
+ RelativeTime,
85
+ {
86
+ value: notification.created,
87
+ className: styles.notificationInfoRow
88
+ }
89
+ )
90
+ ]
91
+ }
92
+ )
93
+ ] })
94
+ ] }),
95
+ /* @__PURE__ */ jsx("div", { className: styles.actionsColumn, children: /* @__PURE__ */ jsx(
96
+ BulkActions,
97
+ {
98
+ notifications: [notification],
99
+ selectedNotifications: /* @__PURE__ */ new Set([notification.id]),
100
+ onSwitchReadStatus,
101
+ onSwitchSavedStatus
102
+ }
103
+ ) })
104
+ ] });
105
+ };
106
+ const UnreadNotificationsCard = ({
107
+ maxMessages,
108
+ charLimit,
109
+ initialCount,
110
+ maxChars,
111
+ descriptionMaxChars = 120
112
+ }) => {
113
+ const { t } = useTranslationRef(notificationsTranslationRef);
114
+ const resolvedMaxMessages = resolveMaxMessages({ maxMessages, initialCount });
115
+ const resolvedCharLimit = resolveCharLimit({ charLimit, maxChars });
116
+ const [refresh, setRefresh] = useState(false);
117
+ const { lastSignal, pollTick } = useNotificationsRefresh();
118
+ const notificationsApi = useApi(notificationsApiRef);
119
+ const { error, value, retry, loading } = useNotificationsApi(
120
+ (api) => api.getNotifications({
121
+ limit: resolvedMaxMessages,
122
+ read: false,
123
+ sort: "created",
124
+ sortOrder: "desc"
125
+ }),
126
+ [resolvedMaxMessages]
127
+ );
128
+ const throttledSetRefresh = useMemo(
129
+ () => throttle(() => setRefresh(true), ThrottleDelayMs),
130
+ []
131
+ );
132
+ useEffect(() => {
133
+ return () => {
134
+ throttledSetRefresh.cancel();
135
+ };
136
+ }, [throttledSetRefresh]);
137
+ const onUpdate = useCallback(() => {
138
+ retry();
139
+ }, [retry]);
140
+ const onSwitchReadStatus = useCallback(
141
+ (ids, newStatus) => {
142
+ notificationsApi.updateNotifications({
143
+ ids,
144
+ read: newStatus
145
+ }).then(onUpdate);
146
+ },
147
+ [notificationsApi, onUpdate]
148
+ );
149
+ const onSwitchSavedStatus = useCallback(
150
+ (ids, newStatus) => {
151
+ notificationsApi.updateNotifications({
152
+ ids,
153
+ saved: newStatus
154
+ }).then(onUpdate);
155
+ },
156
+ [notificationsApi, onUpdate]
157
+ );
158
+ useEffect(() => {
159
+ if (refresh && !loading) {
160
+ retry();
161
+ setRefresh(false);
162
+ }
163
+ }, [refresh, retry, loading]);
164
+ useEffect(() => {
165
+ if (!lastSignal?.action) {
166
+ return;
167
+ }
168
+ if (lastSignal.action === "new_notification" || lastSignal.action === "notification_read" || lastSignal.action === "notification_unread") {
169
+ throttledSetRefresh();
170
+ }
171
+ }, [lastSignal, throttledSetRefresh]);
172
+ useEffect(() => {
173
+ if (pollTick > 0) {
174
+ throttledSetRefresh();
175
+ }
176
+ }, [pollTick, throttledSetRefresh]);
177
+ useEffect(() => {
178
+ const handleVisibilityChange = () => {
179
+ if (document.visibilityState === "visible") {
180
+ throttledSetRefresh();
181
+ }
182
+ };
183
+ document.addEventListener("visibilitychange", handleVisibilityChange);
184
+ return () => {
185
+ document.removeEventListener("visibilitychange", handleVisibilityChange);
186
+ };
187
+ }, [throttledSetRefresh]);
188
+ const notifications = value?.notifications ?? [];
189
+ const totalCount = value?.totalCount ?? notifications.length;
190
+ const displayedCount = notifications.length;
191
+ return /* @__PURE__ */ jsx(
192
+ InfoCard,
193
+ {
194
+ title: t("unreadCard.title", { count: totalCount }),
195
+ action: /* @__PURE__ */ jsx(LinkButton, { to: getNotificationsPageLink(), color: "primary", children: t("unreadCard.viewAll") }),
196
+ variant: "gridItem",
197
+ children: /* @__PURE__ */ jsxs("div", { className: styles.content, children: [
198
+ loading && /* @__PURE__ */ jsx(Progress, {}),
199
+ error && /* @__PURE__ */ jsx(ErrorPanel, { error }),
200
+ !loading && !error && /* @__PURE__ */ jsx(Fragment, { children: notifications.length === 0 ? /* @__PURE__ */ jsxs("div", { className: styles.emptyState, children: [
201
+ /* @__PURE__ */ jsx(
202
+ RiCheckDoubleLine,
203
+ {
204
+ size: 32,
205
+ className: styles.emptyStateIcon,
206
+ "aria-hidden": true,
207
+ "data-testid": "unread-notifications-empty-icon"
208
+ }
209
+ ),
210
+ /* @__PURE__ */ jsx(Text, { variant: "body-medium", children: t("unreadCard.emptyState") })
211
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
212
+ /* @__PURE__ */ jsxs("div", { className: styles.columnHeader, children: [
213
+ /* @__PURE__ */ jsx(Text, { variant: "body-x-small", color: "secondary", children: t("unreadCard.columnNotification") }),
214
+ /* @__PURE__ */ jsx(
215
+ Text,
216
+ {
217
+ variant: "body-x-small",
218
+ color: "secondary",
219
+ className: styles.columnHeaderActions,
220
+ children: t("unreadCard.columnActions")
221
+ }
222
+ )
223
+ ] }),
224
+ notifications.map((notification) => /* @__PURE__ */ jsx(
225
+ NotificationListItem,
226
+ {
227
+ notification,
228
+ maxChars: resolvedCharLimit,
229
+ descriptionMaxChars,
230
+ onSwitchReadStatus,
231
+ onSwitchSavedStatus
232
+ },
233
+ notification.id
234
+ )),
235
+ /* @__PURE__ */ jsx(
236
+ Text,
237
+ {
238
+ variant: "body-small",
239
+ color: "secondary",
240
+ className: styles.resultsCount,
241
+ children: t("unreadCard.resultsCount", {
242
+ displayed: String(displayedCount),
243
+ total: String(totalCount)
244
+ })
245
+ }
246
+ )
247
+ ] }) })
248
+ ] })
249
+ }
250
+ );
251
+ };
252
+ const UnreadNotificationsCardWithProvider = (props) => /* @__PURE__ */ jsx(UnreadNotificationsCard, { ...props });
253
+
254
+ export { UnreadNotificationsCard, UnreadNotificationsCardWithProvider };
255
+ //# sourceMappingURL=UnreadNotificationsCard.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UnreadNotificationsCard.esm.js","sources":["../../../src/components/UnreadNotificationsCard/UnreadNotificationsCard.tsx"],"sourcesContent":["/*\n * Copyright 2026 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 { useCallback, useEffect, useMemo, useState } from 'react';\nimport throttle from 'lodash/throttle';\n// @ts-ignore\nimport RelativeTime from 'react-relative-time';\nimport { RiCheckDoubleLine, RiRssFill } from '@remixicon/react';\nimport { Notification } from '@backstage/plugin-notifications-common';\nimport {\n ErrorPanel,\n InfoCard,\n Link,\n LinkButton,\n Progress,\n} from '@backstage/core-components';\nimport { Text } from '@backstage/ui';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\n\nimport { notificationsApiRef } from '../../api';\nimport { useNotificationsApi, useNotificationsRefresh } from '../../hooks';\nimport { notificationsTranslationRef } from '../../translation';\nimport { getNotificationsPageLink } from '../../utils/notificationLinks';\nimport { truncateText } from '../../utils/plainText';\nimport { BulkActions } from '../NotificationsTable/BulkActions';\nimport { NotificationIcon } from '../NotificationsTable/NotificationIcon';\nimport styles from './UnreadNotificationsCard.module.css';\n\nconst ThrottleDelayMs = 2000;\n\n/** @internal */\nexport type UnreadNotificationsCardProps = {\n /** Maximum number of unread notifications to fetch and display */\n maxMessages?: number;\n /** Maximum number of plain-text characters to show per notification title */\n charLimit?: number;\n /**\n * @deprecated Use `maxMessages` instead.\n */\n initialCount?: number;\n /**\n * @deprecated Use `charLimit` instead.\n */\n maxChars?: number;\n /** Maximum number of plain-text characters to show per notification description */\n descriptionMaxChars?: number;\n};\n\nconst resolveMaxMessages = ({\n maxMessages,\n initialCount,\n}: Pick<UnreadNotificationsCardProps, 'maxMessages' | 'initialCount'>) =>\n maxMessages ?? initialCount ?? 5;\n\nconst resolveCharLimit = ({\n charLimit,\n maxChars,\n}: Pick<UnreadNotificationsCardProps, 'charLimit' | 'maxChars'>) =>\n charLimit ?? maxChars ?? 80;\n\nconst NotificationListItem = ({\n notification,\n maxChars,\n descriptionMaxChars,\n onSwitchReadStatus,\n onSwitchSavedStatus,\n}: {\n notification: Notification;\n maxChars: number;\n descriptionMaxChars: number;\n onSwitchReadStatus: (ids: Notification['id'][], newStatus: boolean) => void;\n onSwitchSavedStatus: (ids: Notification['id'][], newStatus: boolean) => void;\n}) => {\n const {\n display: titleDisplay,\n truncated: titleTruncated,\n full: titleFull,\n } = truncateText(notification.payload.title, maxChars);\n const description = notification.payload.description\n ? truncateText(notification.payload.description, descriptionMaxChars)\n : undefined;\n\n return (\n <div className={styles.notificationRow}>\n <div className={styles.notificationContent}>\n <div className={styles.severityItem}>\n <NotificationIcon notification={notification} />\n </div>\n <div className={styles.notificationText}>\n <Text variant=\"body-medium\" className={styles.notificationTitle}>\n <Link\n to={getNotificationsPageLink(notification.id)}\n title={titleTruncated ? titleFull : undefined}\n >\n {titleDisplay}\n </Link>\n </Text>\n {description ? (\n <Text\n variant=\"body-small\"\n color=\"secondary\"\n className={styles.notificationDescription}\n title={description.truncated ? description.full : undefined}\n >\n {description.display}\n </Text>\n ) : null}\n <Text\n variant=\"body-small\"\n color=\"secondary\"\n className={styles.metaRow}\n >\n {!notification.user && (\n <RiRssFill size={14} className={styles.broadcastIcon} />\n )}\n {notification.origin && (\n <>\n <span className={styles.notificationInfoRow}>\n {notification.origin}\n </span>\n &bull;\n </>\n )}\n {notification.payload.topic && (\n <>\n <span className={styles.notificationInfoRow}>\n {notification.payload.topic}\n </span>\n &bull;\n </>\n )}\n {notification.created && (\n <RelativeTime\n value={notification.created}\n className={styles.notificationInfoRow}\n />\n )}\n </Text>\n </div>\n </div>\n <div className={styles.actionsColumn}>\n <BulkActions\n notifications={[notification]}\n selectedNotifications={new Set([notification.id])}\n onSwitchReadStatus={onSwitchReadStatus}\n onSwitchSavedStatus={onSwitchSavedStatus}\n />\n </div>\n </div>\n );\n};\n\n/** @internal */\nexport const UnreadNotificationsCard = ({\n maxMessages,\n charLimit,\n initialCount,\n maxChars,\n descriptionMaxChars = 120,\n}: UnreadNotificationsCardProps) => {\n const { t } = useTranslationRef(notificationsTranslationRef);\n const resolvedMaxMessages = resolveMaxMessages({ maxMessages, initialCount });\n const resolvedCharLimit = resolveCharLimit({ charLimit, maxChars });\n const [refresh, setRefresh] = useState(false);\n const { lastSignal, pollTick } = useNotificationsRefresh();\n const notificationsApi = useApi(notificationsApiRef);\n\n const { error, value, retry, loading } = useNotificationsApi(\n api =>\n api.getNotifications({\n limit: resolvedMaxMessages,\n read: false,\n sort: 'created',\n sortOrder: 'desc',\n }),\n [resolvedMaxMessages],\n );\n\n const throttledSetRefresh = useMemo(\n () => throttle(() => setRefresh(true), ThrottleDelayMs),\n [],\n );\n\n useEffect(() => {\n return () => {\n throttledSetRefresh.cancel();\n };\n }, [throttledSetRefresh]);\n\n const onUpdate = useCallback(() => {\n retry();\n }, [retry]);\n\n const onSwitchReadStatus = useCallback(\n (ids: Notification['id'][], newStatus: boolean) => {\n notificationsApi\n .updateNotifications({\n ids,\n read: newStatus,\n })\n .then(onUpdate);\n },\n [notificationsApi, onUpdate],\n );\n\n const onSwitchSavedStatus = useCallback(\n (ids: Notification['id'][], newStatus: boolean) => {\n notificationsApi\n .updateNotifications({\n ids,\n saved: newStatus,\n })\n .then(onUpdate);\n },\n [notificationsApi, onUpdate],\n );\n\n useEffect(() => {\n if (refresh && !loading) {\n retry();\n setRefresh(false);\n }\n }, [refresh, retry, loading]);\n\n useEffect(() => {\n if (!lastSignal?.action) {\n return;\n }\n\n if (\n lastSignal.action === 'new_notification' ||\n lastSignal.action === 'notification_read' ||\n lastSignal.action === 'notification_unread'\n ) {\n throttledSetRefresh();\n }\n }, [lastSignal, throttledSetRefresh]);\n\n useEffect(() => {\n if (pollTick > 0) {\n throttledSetRefresh();\n }\n }, [pollTick, throttledSetRefresh]);\n\n useEffect(() => {\n const handleVisibilityChange = () => {\n if (document.visibilityState === 'visible') {\n throttledSetRefresh();\n }\n };\n\n document.addEventListener('visibilitychange', handleVisibilityChange);\n return () => {\n document.removeEventListener('visibilitychange', handleVisibilityChange);\n };\n }, [throttledSetRefresh]);\n\n const notifications = value?.notifications ?? [];\n const totalCount = value?.totalCount ?? notifications.length;\n const displayedCount = notifications.length;\n\n return (\n <InfoCard\n title={t('unreadCard.title', { count: totalCount })}\n action={\n <LinkButton to={getNotificationsPageLink()} color=\"primary\">\n {t('unreadCard.viewAll')}\n </LinkButton>\n }\n variant=\"gridItem\"\n >\n <div className={styles.content}>\n {loading && <Progress />}\n {error && <ErrorPanel error={error} />}\n {!loading && !error && (\n <>\n {notifications.length === 0 ? (\n <div className={styles.emptyState}>\n <RiCheckDoubleLine\n size={32}\n className={styles.emptyStateIcon}\n aria-hidden\n data-testid=\"unread-notifications-empty-icon\"\n />\n <Text variant=\"body-medium\">{t('unreadCard.emptyState')}</Text>\n </div>\n ) : (\n <>\n <div className={styles.columnHeader}>\n <Text variant=\"body-x-small\" color=\"secondary\">\n {t('unreadCard.columnNotification')}\n </Text>\n <Text\n variant=\"body-x-small\"\n color=\"secondary\"\n className={styles.columnHeaderActions}\n >\n {t('unreadCard.columnActions')}\n </Text>\n </div>\n {notifications.map(notification => (\n <NotificationListItem\n key={notification.id}\n notification={notification}\n maxChars={resolvedCharLimit}\n descriptionMaxChars={descriptionMaxChars}\n onSwitchReadStatus={onSwitchReadStatus}\n onSwitchSavedStatus={onSwitchSavedStatus}\n />\n ))}\n <Text\n variant=\"body-small\"\n color=\"secondary\"\n className={styles.resultsCount}\n >\n {t('unreadCard.resultsCount', {\n displayed: String(displayedCount),\n total: String(totalCount),\n })}\n </Text>\n </>\n )}\n </>\n )}\n </div>\n </InfoCard>\n );\n};\n\n/**\n * UnreadNotificationsCard used by the NFS home page widget.\n *\n * @internal\n */\nexport const UnreadNotificationsCardWithProvider = (\n props: UnreadNotificationsCardProps,\n) => <UnreadNotificationsCard {...props} />;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA0CA,MAAM,eAAA,GAAkB,GAAA;AAoBxB,MAAM,qBAAqB,CAAC;AAAA,EAC1B,WAAA;AAAA,EACA;AACF,CAAA,KACE,eAAe,YAAA,IAAgB,CAAA;AAEjC,MAAM,mBAAmB,CAAC;AAAA,EACxB,SAAA;AAAA,EACA;AACF,CAAA,KACE,aAAa,QAAA,IAAY,EAAA;AAE3B,MAAM,uBAAuB,CAAC;AAAA,EAC5B,YAAA;AAAA,EACA,QAAA;AAAA,EACA,mBAAA;AAAA,EACA,kBAAA;AAAA,EACA;AACF,CAAA,KAMM;AACJ,EAAA,MAAM;AAAA,IACJ,OAAA,EAAS,YAAA;AAAA,IACT,SAAA,EAAW,cAAA;AAAA,IACX,IAAA,EAAM;AAAA,GACR,GAAI,YAAA,CAAa,YAAA,CAAa,OAAA,CAAQ,OAAO,QAAQ,CAAA;AACrD,EAAA,MAAM,WAAA,GAAc,aAAa,OAAA,CAAQ,WAAA,GACrC,aAAa,YAAA,CAAa,OAAA,CAAQ,WAAA,EAAa,mBAAmB,CAAA,GAClE,MAAA;AAEJ,EAAA,uBACE,IAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,MAAA,CAAO,eAAA,EACrB,QAAA,EAAA;AAAA,oBAAA,IAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,MAAA,CAAO,mBAAA,EACrB,QAAA,EAAA;AAAA,sBAAA,GAAA,CAAC,SAAI,SAAA,EAAW,MAAA,CAAO,cACrB,QAAA,kBAAA,GAAA,CAAC,gBAAA,EAAA,EAAiB,cAA4B,CAAA,EAChD,CAAA;AAAA,sBACA,IAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,MAAA,CAAO,gBAAA,EACrB,QAAA,EAAA;AAAA,wBAA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AAK,OAAA,EAAQ,cAAA,EAAe,OAAM,WAAA,EAChC,QAAA,EAAA,CAAA,CAAE,+BAA+B,CAAA,EACpC,CAAA;AAAA,4BACA,GAAA;AAAA,cAAC,IAAA;AAAA,cAAA;AAAA,gBACC,OAAA,EAAQ,cAAA;AAAA,gBACR,KAAA,EAAM,WAAA;AAAA,gBACN,WAAW,MAAA,CAAO,mBAAA;AAAA,gBAEjB,YAAE,0BAA0B;AAAA;AAAA;AAC/B,WAAA,EACF,CAAA;AAAA,UACC,aAAA,CAAc,IAAI,CAAA,YAAA,qBACjB,GAAA;AAAA,YAAC,oBAAA;AAAA,YAAA;AAAA,cAEC,YAAA;AAAA,cACA,QAAA,EAAU,iBAAA;AAAA,cACV,mBAAA;AAAA,cACA,kBAAA;AAAA,cACA;AAAA,aAAA;AAAA,YALK,YAAA,CAAa;AAAA,WAOrB,CAAA;AAAA,0BACD,GAAA;AAAA,YAAC,IAAA;AAAA,YAAA;AAAA,cACC,OAAA,EAAQ,YAAA;AAAA,cACR,KAAA,EAAM,WAAA;AAAA,cACN,WAAW,MAAA,CAAO,YAAA;AAAA,cAEjB,YAAE,yBAAA,EAA2B;AAAA,gBAC5B,SAAA,EAAW,OAAO,cAAc,CAAA;AAAA,gBAChC,KAAA,EAAO,OAAO,UAAU;AAAA,eACzB;AAAA;AAAA;AACH,SAAA,EACF,CAAA,EAEJ;AAAA,OAAA,EAEJ;AAAA;AAAA,GACF;AAEJ;AAOO,MAAM,sCAAsC,CACjD,KAAA,qBACG,GAAA,CAAC,uBAAA,EAAA,EAAyB,GAAG,KAAA,EAAO;;"}
@@ -0,0 +1,8 @@
1
+ import styleInject from '../../node_modules_dist/style-inject/dist/style-inject.es.esm.js';
2
+
3
+ var css_248z = "/*\n * Copyright 2026 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\n@layer components {\n .UnreadNotificationsCard_content__55d55e8dda {\n min-height: 9rem;\n display: flex;\n flex-direction: column;\n }\n\n .UnreadNotificationsCard_columnHeader__55d55e8dda {\n display: flex;\n align-items: center;\n justify-content: space-between;\n background-color: var(--bui-color-bg-surface-hover, rgba(0, 0, 0, 0.04));\n border-radius: var(--bui-radius-2, 4px);\n padding: var(--bui-space-2, 8px) var(--bui-space-5, 24px)\n var(--bui-space-2, 8px) var(--bui-space-7, 36px);\n margin-bottom: var(--bui-space-2, 8px);\n color: var(--bui-color-fg-secondary, rgba(0, 0, 0, 0.54));\n font-size: 0.75rem;\n text-transform: uppercase;\n }\n\n .UnreadNotificationsCard_columnHeaderActions__55d55e8dda {\n min-width: 5rem;\n text-align: right;\n }\n\n .UnreadNotificationsCard_notificationRow__55d55e8dda {\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n gap: var(--bui-space-2, 8px);\n padding: var(--bui-space-3, 12px) 0;\n border-bottom: 1px solid var(--bui-color-border, rgba(0, 0, 0, 0.12));\n }\n\n .UnreadNotificationsCard_notificationRow__55d55e8dda:last-child {\n border-bottom: none;\n }\n\n .UnreadNotificationsCard_notificationContent__55d55e8dda {\n display: flex;\n flex: 1;\n min-width: 0;\n gap: var(--bui-space-3, 12px);\n }\n\n .UnreadNotificationsCard_severityItem__55d55e8dda {\n align-content: center;\n flex-shrink: 0;\n display: flex;\n align-items: center;\n }\n\n .UnreadNotificationsCard_notificationText__55d55e8dda {\n min-width: 0;\n }\n\n .UnreadNotificationsCard_notificationTitle__55d55e8dda {\n font-weight: 500;\n font-size: 0.875rem;\n line-height: 1.43;\n }\n\n .UnreadNotificationsCard_notificationDescription__55d55e8dda {\n color: var(--bui-color-fg-secondary, rgba(0, 0, 0, 0.54));\n font-size: 0.875rem;\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n }\n\n .UnreadNotificationsCard_metaRow__55d55e8dda {\n color: var(--bui-color-fg-secondary, rgba(0, 0, 0, 0.54));\n font-size: 0.75rem;\n }\n\n .UnreadNotificationsCard_notificationInfoRow__55d55e8dda {\n margin-left: var(--bui-space-1, 4px);\n margin-right: var(--bui-space-1, 4px);\n }\n\n .UnreadNotificationsCard_broadcastIcon__55d55e8dda {\n vertical-align: text-bottom;\n }\n\n .UnreadNotificationsCard_actionsColumn__55d55e8dda {\n flex-shrink: 0;\n }\n\n .UnreadNotificationsCard_emptyState__55d55e8dda {\n flex: 1;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n text-align: center;\n padding: var(--bui-space-8, 32px) 0;\n gap: var(--bui-space-2, 8px);\n }\n\n .UnreadNotificationsCard_emptyStateIcon__55d55e8dda {\n color: var(--bui-color-fg-disabled, rgba(0, 0, 0, 0.38));\n }\n\n .UnreadNotificationsCard_resultsCount__55d55e8dda {\n margin-top: var(--bui-space-4, 16px);\n text-align: right;\n color: var(--bui-color-fg-secondary, rgba(0, 0, 0, 0.54));\n font-size: 0.875rem;\n }\n}\n";
4
+ var styles = {"content":"UnreadNotificationsCard_content__55d55e8dda","columnHeader":"UnreadNotificationsCard_columnHeader__55d55e8dda","columnHeaderActions":"UnreadNotificationsCard_columnHeaderActions__55d55e8dda","notificationRow":"UnreadNotificationsCard_notificationRow__55d55e8dda","notificationContent":"UnreadNotificationsCard_notificationContent__55d55e8dda","severityItem":"UnreadNotificationsCard_severityItem__55d55e8dda","notificationText":"UnreadNotificationsCard_notificationText__55d55e8dda","notificationTitle":"UnreadNotificationsCard_notificationTitle__55d55e8dda","notificationDescription":"UnreadNotificationsCard_notificationDescription__55d55e8dda","metaRow":"UnreadNotificationsCard_metaRow__55d55e8dda","notificationInfoRow":"UnreadNotificationsCard_notificationInfoRow__55d55e8dda","broadcastIcon":"UnreadNotificationsCard_broadcastIcon__55d55e8dda","actionsColumn":"UnreadNotificationsCard_actionsColumn__55d55e8dda","emptyState":"UnreadNotificationsCard_emptyState__55d55e8dda","emptyStateIcon":"UnreadNotificationsCard_emptyStateIcon__55d55e8dda","resultsCount":"UnreadNotificationsCard_resultsCount__55d55e8dda"};
5
+ styleInject(css_248z);
6
+
7
+ export { styles as default };
8
+ //# sourceMappingURL=UnreadNotificationsCard.module.css.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UnreadNotificationsCard.module.css.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
@@ -0,0 +1,7 @@
1
+ import { UnreadNotificationsCardWithProvider } from './UnreadNotificationsCard.esm.js';
2
+ export { UnreadNotificationsCard } from './UnreadNotificationsCard.esm.js';
3
+
4
+
5
+
6
+ export { UnreadNotificationsCardWithProvider };
7
+ //# sourceMappingURL=index.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"NoBorderTableCell.esm.js","sources":["../../../src/components/UserNotificationSettingsCard/NoBorderTableCell.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ReactNode } from 'react';\nimport styles from './NoBorderTableCell.module.css';\n\nexport const NoBorderTableCell = ({\n children,\n align,\n}: {\n children?: ReactNode;\n align?: 'left' | 'center' | 'right';\n}) => (\n <td className={styles.cell} style={align ? { textAlign: align } : undefined}>\n {children}\n </td>\n);\n"],"names":[],"mappings":";;;AAmBO,MAAM,oBAAoB,CAAC;AAAA,EAChC,QAAA;AAAA,EACA;AACF,CAAA,qBAIE,GAAA,CAAC,IAAA,EAAA,EAAG,SAAA,EAAW,MAAA,CAAO,IAAA,EAAM,KAAA,EAAO,KAAA,GAAQ,EAAE,SAAA,EAAW,KAAA,EAAM,GAAI,MAAA,EAC/D,QAAA,EACH;;;;"}
1
+ {"version":3,"file":"NoBorderTableCell.esm.js","sources":["../../../src/components/UserNotificationSettingsCard/NoBorderTableCell.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ReactNode } from 'react';\nimport styles from './NoBorderTableCell.module.css';\n\nexport const NoBorderTableCell = ({\n children,\n align,\n}: {\n children?: ReactNode;\n align?: 'left' | 'center' | 'right';\n}) => (\n <td className={styles.cell} style={align ? { textAlign: align } : undefined}>\n {children}\n </td>\n);\n"],"names":[],"mappings":";;;AAmBO,MAAM,oBAAoB,CAAC;AAAA,EAChC,QAAA;AAAA,EACA;AACF,CAAA,qBAIE,GAAA,CAAC,IAAA,EAAA,EAAG,SAAA,EAAW,MAAA,CAAO,IAAA,EAAM,KAAA,EAAO,KAAA,GAAQ,EAAE,SAAA,EAAW,KAAA,EAAM,GAAI,MAAA,EAC/D,QAAA,EACH;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"NoBorderTableCell.module.css.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
1
+ {"version":3,"file":"NoBorderTableCell.module.css.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationFormatContext.esm.js","sources":["../../../src/components/UserNotificationSettingsCard/NotificationFormatContext.tsx"],"sourcesContent":["/*\n * Copyright 2026 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 { createContext, ReactNode, useContext } from 'react';\nimport { capitalize } from 'lodash';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { notificationsTranslationRef } from '../../translation';\n\ntype FormatContextType = {\n formatOriginName: (id: string) => string;\n formatTopicName: (id: string) => string;\n};\n\nconst NotificationFormatContext = createContext<FormatContextType | undefined>(\n undefined,\n);\n\nexport const useNotificationFormat = () => {\n const { t } = useTranslationRef(notificationsTranslationRef);\n const context = useContext(NotificationFormatContext);\n if (!context) throw new Error(t('settings.errors.useNotificationFormat'));\n return context;\n};\n\nexport const NotificationFormatProvider = ({\n children,\n originMap,\n topicMap,\n}: {\n children: ReactNode;\n originMap: Record<string, string> | undefined;\n topicMap: Record<string, string> | undefined;\n}) => {\n const formatName = (\n id: string,\n nameMap: Record<string, string> | undefined,\n ) => {\n if (nameMap && id in nameMap) {\n return nameMap[id];\n }\n return capitalize(id.replaceAll(/[-_:]/g, ' '));\n };\n\n const formatOriginName = (originId: string) => {\n return formatName(originId, originMap);\n };\n\n const formatTopicName = (topicId: string) => {\n return formatName(topicId, topicMap);\n };\n\n return (\n <NotificationFormatContext.Provider\n value={{ formatOriginName, formatTopicName }}\n >\n {children}\n </NotificationFormatContext.Provider>\n );\n};\n"],"names":[],"mappings":";;;;;;AA0BA,MAAM,yBAAA,GAA4B,aAAA;AAAA,EAChC;AACF,CAAA;AAEO,MAAM,wBAAwB,MAAM;AACzC,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,2BAA2B,CAAA;AAC3D,EAAA,MAAM,OAAA,GAAU,WAAW,yBAAyB,CAAA;AACpD,EAAA,IAAI,CAAC,OAAA,EAAS,MAAM,IAAI,KAAA,CAAM,CAAA,CAAE,uCAAuC,CAAC,CAAA;AACxE,EAAA,OAAO,OAAA;AACT;AAEO,MAAM,6BAA6B,CAAC;AAAA,EACzC,QAAA;AAAA,EACA,SAAA;AAAA,EACA;AACF,CAAA,KAIM;AACJ,EAAA,MAAM,UAAA,GAAa,CACjB,EAAA,EACA,OAAA,KACG;AACH,IAAA,IAAI,OAAA,IAAW,MAAM,OAAA,EAAS;AAC5B,MAAA,OAAO,QAAQ,EAAE,CAAA;AAAA,IACnB;AACA,IAAA,OAAO,UAAA,CAAW,EAAA,CAAG,UAAA,CAAW,QAAA,EAAU,GAAG,CAAC,CAAA;AAAA,EAChD,CAAA;AAEA,EAAA,MAAM,gBAAA,GAAmB,CAAC,QAAA,KAAqB;AAC7C,IAAA,OAAO,UAAA,CAAW,UAAU,SAAS,CAAA;AAAA,EACvC,CAAA;AAEA,EAAA,MAAM,eAAA,GAAkB,CAAC,OAAA,KAAoB;AAC3C,IAAA,OAAO,UAAA,CAAW,SAAS,QAAQ,CAAA;AAAA,EACrC,CAAA;AAEA,EAAA,uBACE,GAAA;AAAA,IAAC,yBAAA,CAA0B,QAAA;AAAA,IAA1B;AAAA,MACC,KAAA,EAAO,EAAE,gBAAA,EAAkB,eAAA,EAAgB;AAAA,MAE1C;AAAA;AAAA,GACH;AAEJ;;;;"}
1
+ {"version":3,"file":"NotificationFormatContext.esm.js","sources":["../../../src/components/UserNotificationSettingsCard/NotificationFormatContext.tsx"],"sourcesContent":["/*\n * Copyright 2026 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 { createContext, ReactNode, useContext } from 'react';\nimport { capitalize } from 'lodash';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { notificationsTranslationRef } from '../../translation';\n\ntype FormatContextType = {\n formatOriginName: (id: string) => string;\n formatTopicName: (id: string) => string;\n};\n\nconst NotificationFormatContext = createContext<FormatContextType | undefined>(\n undefined,\n);\n\nexport const useNotificationFormat = () => {\n const { t } = useTranslationRef(notificationsTranslationRef);\n const context = useContext(NotificationFormatContext);\n if (!context) throw new Error(t('settings.errors.useNotificationFormat'));\n return context;\n};\n\nexport const NotificationFormatProvider = ({\n children,\n originMap,\n topicMap,\n}: {\n children: ReactNode;\n originMap: Record<string, string> | undefined;\n topicMap: Record<string, string> | undefined;\n}) => {\n const formatName = (\n id: string,\n nameMap: Record<string, string> | undefined,\n ) => {\n if (nameMap && id in nameMap) {\n return nameMap[id];\n }\n return capitalize(id.replaceAll(/[-_:]/g, ' '));\n };\n\n const formatOriginName = (originId: string) => {\n return formatName(originId, originMap);\n };\n\n const formatTopicName = (topicId: string) => {\n return formatName(topicId, topicMap);\n };\n\n return (\n <NotificationFormatContext.Provider\n value={{ formatOriginName, formatTopicName }}\n >\n {children}\n </NotificationFormatContext.Provider>\n );\n};\n"],"names":[],"mappings":";;;;;;AA0BA,MAAM,yBAAA,GAA4B,aAAA;AAAA,EAChC;AACF,CAAA;AAEO,MAAM,wBAAwB,MAAM;AACzC,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,2BAA2B,CAAA;AAC3D,EAAA,MAAM,OAAA,GAAU,WAAW,yBAAyB,CAAA;AACpD,EAAA,IAAI,CAAC,OAAA,EAAS,MAAM,IAAI,KAAA,CAAM,CAAA,CAAE,uCAAuC,CAAC,CAAA;AACxE,EAAA,OAAO,OAAA;AACT;AAEO,MAAM,6BAA6B,CAAC;AAAA,EACzC,QAAA;AAAA,EACA,SAAA;AAAA,EACA;AACF,CAAA,KAIM;AACJ,EAAA,MAAM,UAAA,GAAa,CACjB,EAAA,EACA,OAAA,KACG;AACH,IAAA,IAAI,OAAA,IAAW,MAAM,OAAA,EAAS;AAC5B,MAAA,OAAO,QAAQ,EAAE,CAAA;AAAA,IACnB;AACA,IAAA,OAAO,UAAA,CAAW,EAAA,CAAG,UAAA,CAAW,QAAA,EAAU,GAAG,CAAC,CAAA;AAAA,EAChD,CAAA;AAEA,EAAA,MAAM,gBAAA,GAAmB,CAAC,QAAA,KAAqB;AAC7C,IAAA,OAAO,UAAA,CAAW,UAAU,SAAS,CAAA;AAAA,EACvC,CAAA;AAEA,EAAA,MAAM,eAAA,GAAkB,CAAC,OAAA,KAAoB;AAC3C,IAAA,OAAO,UAAA,CAAW,SAAS,QAAQ,CAAA;AAAA,EACrC,CAAA;AAEA,EAAA,uBACE,GAAA;AAAA,IAAC,yBAAA,CAA0B,QAAA;AAAA,IAA1B;AAAA,MACC,KAAA,EAAO,EAAE,gBAAA,EAAkB,eAAA,EAAgB;AAAA,MAE1C;AAAA;AAAA,GACH;AAEJ;;"}
@@ -40,9 +40,9 @@ const OriginRow = (props) => {
40
40
  }
41
41
  }
42
42
  ),
43
- /* @__PURE__ */ jsx(Tooltip, { children: `Enable or disable ${ch.id.toLocaleLowerCase(
44
- "en-US"
45
- )} notifications from ${formatOriginName(origin.id)}` })
43
+ /* @__PURE__ */ jsx(Tooltip, { children: `Enable or disable ${ch.id.toLowerCase()} notifications from ${formatOriginName(
44
+ origin.id
45
+ )}` })
46
46
  ] }) }, ch.id))
47
47
  ] });
48
48
  };
@@ -1 +1 @@
1
- {"version":3,"file":"OriginRow.esm.js","sources":["../../../src/components/UserNotificationSettingsCard/OriginRow.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 isNotificationsEnabledFor,\n NotificationSettings,\n OriginSetting,\n} from '@backstage/plugin-notifications-common';\nimport { ButtonIcon, Switch, Tooltip, TooltipTrigger } from '@backstage/ui';\nimport { RiArrowDownSLine, RiArrowUpSLine } from '@remixicon/react';\nimport { NoBorderTableCell } from './NoBorderTableCell';\nimport { useNotificationFormat } from './NotificationFormatContext';\n\nexport const OriginRow = (props: {\n origin: OriginSetting;\n settings: NotificationSettings;\n handleChange: (\n channel: string,\n origin: string,\n topic: string | null,\n enabled: boolean,\n ) => void;\n open: boolean;\n handleRowToggle: (originId: string) => void;\n}) => {\n const { origin, settings, handleChange, open, handleRowToggle } = props;\n const { formatOriginName } = useNotificationFormat();\n return (\n <tr>\n <NoBorderTableCell>\n {origin.topics && origin.topics.length > 0 && (\n <TooltipTrigger>\n <ButtonIcon\n aria-label=\"expand row\"\n onPress={() => handleRowToggle(origin.id)}\n icon={\n open ? (\n <RiArrowUpSLine size={16} />\n ) : (\n <RiArrowDownSLine size={16} />\n )\n }\n variant=\"secondary\"\n />\n <Tooltip>{`Show Topics for the ${formatOriginName(\n origin.id,\n )} origin`}</Tooltip>\n </TooltipTrigger>\n )}\n </NoBorderTableCell>\n <NoBorderTableCell>{formatOriginName(origin.id)}</NoBorderTableCell>\n <NoBorderTableCell>all</NoBorderTableCell>\n {settings.channels.map(ch => (\n <NoBorderTableCell key={ch.id} align=\"center\">\n <TooltipTrigger>\n <Switch\n isSelected={isNotificationsEnabledFor(\n settings,\n ch.id,\n origin.id,\n null,\n )}\n onChange={(isSelected: boolean) => {\n handleChange(ch.id, origin.id, null, isSelected);\n }}\n />\n <Tooltip>{`Enable or disable ${ch.id.toLocaleLowerCase(\n 'en-US',\n )} notifications from ${formatOriginName(origin.id)}`}</Tooltip>\n </TooltipTrigger>\n </NoBorderTableCell>\n ))}\n </tr>\n );\n};\n"],"names":[],"mappings":";;;;;;;AA0BO,MAAM,SAAA,GAAY,CAAC,KAAA,KAWpB;AACJ,EAAA,MAAM,EAAE,MAAA,EAAQ,QAAA,EAAU,YAAA,EAAc,IAAA,EAAM,iBAAgB,GAAI,KAAA;AAClE,EAAA,MAAM,EAAE,gBAAA,EAAiB,GAAI,qBAAA,EAAsB;AACnD,EAAA,4BACG,IAAA,EAAA,EACC,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,iBAAA,EAAA,EACE,iBAAO,MAAA,IAAU,MAAA,CAAO,OAAO,MAAA,GAAS,CAAA,yBACtC,cAAA,EAAA,EACC,QAAA,EAAA;AAAA,sBAAA,GAAA;AAAA,QAAC,UAAA;AAAA,QAAA;AAAA,UACC,YAAA,EAAW,YAAA;AAAA,UACX,OAAA,EAAS,MAAM,eAAA,CAAgB,MAAA,CAAO,EAAE,CAAA;AAAA,UACxC,IAAA,EACE,IAAA,mBACE,GAAA,CAAC,cAAA,EAAA,EAAe,IAAA,EAAM,IAAI,CAAA,mBAE1B,GAAA,CAAC,gBAAA,EAAA,EAAiB,IAAA,EAAM,EAAA,EAAI,CAAA;AAAA,UAGhC,OAAA,EAAQ;AAAA;AAAA,OACV;AAAA,sBACA,GAAA,CAAC,WAAS,QAAA,EAAA,CAAA,oBAAA,EAAuB,gBAAA;AAAA,QAC/B,MAAA,CAAO;AAAA,OACR,CAAA,OAAA,CAAA,EAAU;AAAA,KAAA,EACb,CAAA,EAEJ,CAAA;AAAA,oBACA,GAAA,CAAC,iBAAA,EAAA,EAAmB,QAAA,EAAA,gBAAA,CAAiB,MAAA,CAAO,EAAE,CAAA,EAAE,CAAA;AAAA,oBAChD,GAAA,CAAC,qBAAkB,QAAA,EAAA,KAAA,EAAG,CAAA;AAAA,IACrB,QAAA,CAAS,SAAS,GAAA,CAAI,CAAA,EAAA,yBACpB,iBAAA,EAAA,EAA8B,KAAA,EAAM,QAAA,EACnC,QAAA,kBAAA,IAAA,CAAC,cAAA,EAAA,EACC,QAAA,EAAA;AAAA,sBAAA,GAAA;AAAA,QAAC,MAAA;AAAA,QAAA;AAAA,UACC,UAAA,EAAY,yBAAA;AAAA,YACV,QAAA;AAAA,YACA,EAAA,CAAG,EAAA;AAAA,YACH,MAAA,CAAO,EAAA;AAAA,YACP;AAAA,WACF;AAAA,UACA,QAAA,EAAU,CAAC,UAAA,KAAwB;AACjC,YAAA,YAAA,CAAa,EAAA,CAAG,EAAA,EAAI,MAAA,CAAO,EAAA,EAAI,MAAM,UAAU,CAAA;AAAA,UACjD;AAAA;AAAA,OACF;AAAA,sBACA,GAAA,CAAC,OAAA,EAAA,EAAS,QAAA,EAAA,CAAA,kBAAA,EAAqB,EAAA,CAAG,EAAA,CAAG,iBAAA;AAAA,QACnC;AAAA,OACD,CAAA,oBAAA,EAAuB,gBAAA,CAAiB,MAAA,CAAO,EAAE,CAAC,CAAA,CAAA,EAAG;AAAA,KAAA,EACxD,CAAA,EAAA,EAhBsB,EAAA,CAAG,EAiB3B,CACD;AAAA,GAAA,EACH,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"OriginRow.esm.js","sources":["../../../src/components/UserNotificationSettingsCard/OriginRow.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 isNotificationsEnabledFor,\n NotificationSettings,\n OriginSetting,\n} from '@backstage/plugin-notifications-common';\nimport { ButtonIcon, Switch, Tooltip, TooltipTrigger } from '@backstage/ui';\nimport { RiArrowDownSLine, RiArrowUpSLine } from '@remixicon/react';\nimport { NoBorderTableCell } from './NoBorderTableCell';\nimport { useNotificationFormat } from './NotificationFormatContext';\n\nexport const OriginRow = (props: {\n origin: OriginSetting;\n settings: NotificationSettings;\n handleChange: (\n channel: string,\n origin: string,\n topic: string | null,\n enabled: boolean,\n ) => void;\n open: boolean;\n handleRowToggle: (originId: string) => void;\n}) => {\n const { origin, settings, handleChange, open, handleRowToggle } = props;\n const { formatOriginName } = useNotificationFormat();\n return (\n <tr>\n <NoBorderTableCell>\n {origin.topics && origin.topics.length > 0 && (\n <TooltipTrigger>\n <ButtonIcon\n aria-label=\"expand row\"\n onPress={() => handleRowToggle(origin.id)}\n icon={\n open ? (\n <RiArrowUpSLine size={16} />\n ) : (\n <RiArrowDownSLine size={16} />\n )\n }\n variant=\"secondary\"\n />\n <Tooltip>{`Show Topics for the ${formatOriginName(\n origin.id,\n )} origin`}</Tooltip>\n </TooltipTrigger>\n )}\n </NoBorderTableCell>\n <NoBorderTableCell>{formatOriginName(origin.id)}</NoBorderTableCell>\n <NoBorderTableCell>all</NoBorderTableCell>\n {settings.channels.map(ch => (\n <NoBorderTableCell key={ch.id} align=\"center\">\n <TooltipTrigger>\n <Switch\n isSelected={isNotificationsEnabledFor(\n settings,\n ch.id,\n origin.id,\n null,\n )}\n onChange={(isSelected: boolean) => {\n handleChange(ch.id, origin.id, null, isSelected);\n }}\n />\n <Tooltip>{`Enable or disable ${ch.id.toLowerCase()} notifications from ${formatOriginName(\n origin.id,\n )}`}</Tooltip>\n </TooltipTrigger>\n </NoBorderTableCell>\n ))}\n </tr>\n );\n};\n"],"names":[],"mappings":";;;;;;;AA0BO,MAAM,SAAA,GAAY,CAAC,KAAA,KAWpB;AACJ,EAAA,MAAM,EAA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AAA;AAAA,YACV,QAAA;AAAA,YACA,EAAA,CAAG,EAAA;AAAA,YACH,MAAA,CAAO,EAAA;AAAA,YACP;AAAA,WACF;AAAA,UACA,QAAA,EAAU,CAAC,UAAA,KAAwB;AACjC,YAAA,YAAA,CAAa,EAAA,CAAG,EAAA,EAAI,MAAA,CAAO,EAAA,EAAI,MAAM,UAAU,CAAA;AAAA,UACjD;AAAA;AAAA,OACF;AAAA,0BACC,OAAA,EAAA,EAAS,QAAA,EAAA,CAAA,kBAAA,EAAqB,GAAG,EAAA,CAAG,WAAA,EAAa,CAAA,oBAAA,EAAuB,gBAAA;AAAA,QACvE,MAAA,CAAO;AAAA,OACR,CAAA,CAAA,EAAG;AAAA,KAAA,EACN,CAAA,EAAA,EAhBsB,EAAA,CAAG,EAiB3B,CACD;AAAA,GAAA,EACH,CAAA;AAEJ;;"}
@@ -26,9 +26,7 @@ const TopicRow = (props) => {
26
26
  }
27
27
  }
28
28
  ),
29
- /* @__PURE__ */ jsx(Tooltip, { children: `Enable or disable ${ch.id.toLocaleLowerCase(
30
- "en-US"
31
- )} notifications for the ${formatTopicName(
29
+ /* @__PURE__ */ jsx(Tooltip, { children: `Enable or disable ${ch.id.toLowerCase()} notifications for the ${formatTopicName(
32
30
  topic.id
33
31
  )} topic from ${formatOriginName(origin.id)}` })
34
32
  ] }) }, `${ch.id}-${topic.id}`))
@@ -1 +1 @@
1
- {"version":3,"file":"TopicRow.esm.js","sources":["../../../src/components/UserNotificationSettingsCard/TopicRow.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 isNotificationsEnabledFor,\n NotificationSettings,\n OriginSetting,\n TopicSetting,\n} from '@backstage/plugin-notifications-common';\nimport { Switch, Tooltip, TooltipTrigger } from '@backstage/ui';\nimport { NoBorderTableCell } from './NoBorderTableCell';\nimport { useNotificationFormat } from './NotificationFormatContext';\n\nexport const TopicRow = (props: {\n topic: TopicSetting;\n origin: OriginSetting;\n settings: NotificationSettings;\n handleChange: (\n channel: string,\n origin: string,\n topic: string | null,\n enabled: boolean,\n ) => void;\n}) => {\n const { topic, origin, settings, handleChange } = props;\n const { formatOriginName, formatTopicName } = useNotificationFormat();\n return (\n <tr>\n <NoBorderTableCell />\n <NoBorderTableCell />\n <NoBorderTableCell>{formatTopicName(topic.id)}</NoBorderTableCell>\n {settings.channels.map(ch => (\n <NoBorderTableCell key={`${ch.id}-${topic.id}`} align=\"center\">\n <TooltipTrigger>\n <Switch\n isSelected={isNotificationsEnabledFor(\n settings,\n ch.id,\n origin.id,\n topic.id,\n )}\n onChange={(isSelected: boolean) => {\n handleChange(ch.id, origin.id, topic.id, isSelected);\n }}\n />\n <Tooltip>{`Enable or disable ${ch.id.toLocaleLowerCase(\n 'en-US',\n )} notifications for the ${formatTopicName(\n topic.id,\n )} topic from ${formatOriginName(origin.id)}`}</Tooltip>\n </TooltipTrigger>\n </NoBorderTableCell>\n ))}\n </tr>\n );\n};\n"],"names":[],"mappings":";;;;;;AA0BO,MAAM,QAAA,GAAW,CAAC,KAAA,KAUnB;AACJ,EAAA,MAAM,EAAE,KAAA,EAAO,MAAA,EAAQ,QAAA,EAAU,cAAa,GAAI,KAAA;AAClD,EAAA,MAAM,EAAE,gBAAA,EAAkB,eAAA,EAAgB,GAAI,qBAAA,EAAsB;AACpE,EAAA,4BACG,IAAA,EAAA,EACC,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,iBAAA,EAAA,EAAkB,CAAA;AAAA,wBAClB,iBAAA,EAAA,EAAkB,CAAA;AAAA,oBACnB,GAAA,CAAC,iBAAA,EAAA,EAAmB,QAAA,EAAA,eAAA,CAAgB,KAAA,CAAM,EAAE,CAAA,EAAE,CAAA;AAAA,IAC7C,QAAA,CAAS,SAAS,GAAA,CAAI,CAAA,EAAA,yBACpB,iBAAA,EAAA,EAA+C,KAAA,EAAM,QAAA,EACpD,QAAA,kBAAA,IAAA,CAAC,cAAA,EAAA,EACC,QAAA,EAAA;AAAA,sBAAA,GAAA;AAAA,QAAC,MAAA;AAAA,QAAA;AAAA,UACC,UAAA,EAAY,yBAAA;AAAA,YACV,QAAA;AAAA,YACA,EAAA,CAAG,EAAA;AAAA,YACH,MAAA,CAAO,EAAA;AAAA,YACP,KAAA,CAAM;AAAA,WACR;AAAA,UACA,QAAA,EAAU,CAAC,UAAA,KAAwB;AACjC,YAAA,YAAA,CAAa,GAAG,EAAA,EAAI,MAAA,CAAO,EAAA,EAAI,KAAA,CAAM,IAAI,UAAU,CAAA;AAAA,UACrD;AAAA;AAAA,OACF;AAAA,sBACA,GAAA,CAAC,OAAA,EAAA,EAAS,QAAA,EAAA,CAAA,kBAAA,EAAqB,EAAA,CAAG,EAAA,CAAG,iBAAA;AAAA,QACnC;AAAA,OACD,CAAA,uBAAA,EAA0B,eAAA;AAAA,QACzB,KAAA,CAAM;AAAA,OACP,CAAA,YAAA,EAAe,gBAAA,CAAiB,MAAA,CAAO,EAAE,CAAC,CAAA,CAAA,EAAG;AAAA,KAAA,EAChD,CAAA,EAAA,EAlBsB,GAAG,EAAA,CAAG,EAAE,IAAI,KAAA,CAAM,EAAE,EAmB5C,CACD;AAAA,GAAA,EACH,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"TopicRow.esm.js","sources":["../../../src/components/UserNotificationSettingsCard/TopicRow.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 isNotificationsEnabledFor,\n NotificationSettings,\n OriginSetting,\n TopicSetting,\n} from '@backstage/plugin-notifications-common';\nimport { Switch, Tooltip, TooltipTrigger } from '@backstage/ui';\nimport { NoBorderTableCell } from './NoBorderTableCell';\nimport { useNotificationFormat } from './NotificationFormatContext';\n\nexport const TopicRow = (props: {\n topic: TopicSetting;\n origin: OriginSetting;\n settings: NotificationSettings;\n handleChange: (\n channel: string,\n origin: string,\n topic: string | null,\n enabled: boolean,\n ) => void;\n}) => {\n const { topic, origin, settings, handleChange } = props;\n const { formatOriginName, formatTopicName } = useNotificationFormat();\n return (\n <tr>\n <NoBorderTableCell />\n <NoBorderTableCell />\n <NoBorderTableCell>{formatTopicName(topic.id)}</NoBorderTableCell>\n {settings.channels.map(ch => (\n <NoBorderTableCell key={`${ch.id}-${topic.id}`} align=\"center\">\n <TooltipTrigger>\n <Switch\n isSelected={isNotificationsEnabledFor(\n settings,\n ch.id,\n origin.id,\n topic.id,\n )}\n onChange={(isSelected: boolean) => {\n handleChange(ch.id, origin.id, topic.id, isSelected);\n }}\n />\n <Tooltip>{`Enable or disable ${ch.id.toLowerCase()} notifications for the ${formatTopicName(\n topic.id,\n )} topic from ${formatOriginName(origin.id)}`}</Tooltip>\n </TooltipTrigger>\n </NoBorderTableCell>\n ))}\n </tr>\n );\n};\n"],"names":[],"mappings":";;;;;;AA0BO,MAAM,QAAA,GAAW,CAAC,KAAA,KAUnB;AACJ,EAAA,MAAM,EAAE,KAAA,EAAO,MAAA,EAAQ,QAAA,EAAU,cAAa,GAAI,KAAA;AAClD,EAAA,MAAM,EAAE,gBAAA,EAAkB,eAAA,EAAgB,GAAI,qBAAA,EAAsB;AACpE,EAAA,4BACG,IAAA,EAAA,EACC,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,iBAAA,EAAA,EAAkB,CAAA;AAAA,wBAClB,iBAAA,EAAA,EAAkB,CAAA;AAAA,oBACnB,GAAA,CAAC,iBAAA,EAAA,EAAmB,QAAA,EAAA,eAAA,CAAgB,KAAA,CAAM,EAAE,CAAA,EAAE,CAAA;AAAA,IAC7C,QAAA,CAAS,SAAS,GAAA,CAAI,CAAA,EAAA,yBACpB,iBAAA,EAAA,EAA+C,KAAA,EAAM,QAAA,EACpD,QAAA,kBAAA,IAAA,CAAC,cAAA,EAAA,EACC,QAAA,EAAA;AAAA,sBAAA,GAAA;AAAA,QAAC,MAAA;AAAA,QAAA;AAAA,UACC,UAAA,EAAY,yBAAA;AAAA,YACV,QAAA;AAAA,YACA,EAAA,CAAG,EAAA;AAAA,YACH,MAAA,CAAO,EAAA;AAAA,YACP,KAAA,CAAM;AAAA,WACR;AAAA,UACA,QAAA,EAAU,CAAC,UAAA,KAAwB;AACjC,YAAA,YAAA,CAAa,GAAG,EAAA,EAAI,MAAA,CAAO,EAAA,EAAI,KAAA,CAAM,IAAI,UAAU,CAAA;AAAA,UACrD;AAAA;AAAA,OACF;AAAA,0BACC,OAAA,EAAA,EAAS,QAAA,EAAA,CAAA,kBAAA,EAAqB,GAAG,EAAA,CAAG,WAAA,EAAa,CAAA,uBAAA,EAA0B,eAAA;AAAA,QAC1E,KAAA,CAAM;AAAA,OACP,CAAA,YAAA,EAAe,gBAAA,CAAiB,MAAA,CAAO,EAAE,CAAC,CAAA,CAAA,EAAG;AAAA,KAAA,EAChD,CAAA,EAAA,EAhBsB,GAAG,EAAA,CAAG,EAAE,IAAI,KAAA,CAAM,EAAE,EAiB5C,CACD;AAAA,GAAA,EACH,CAAA;AAEJ;;"}
@@ -2,6 +2,7 @@ import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import { useState, useEffect } from 'react';
3
3
  import { InfoCard, Progress, ErrorPanel } from '@backstage/core-components';
4
4
  import { useNotificationsApi } from '../../hooks/useNotificationsApi.esm.js';
5
+ import '@backstage/plugin-signals-react';
5
6
  import { useApi } from '@backstage/core-plugin-api';
6
7
  import { notificationsApiRef } from '../../api/NotificationsApi.esm.js';
7
8
  import '@backstage/errors';
@@ -1 +1 @@
1
- {"version":3,"file":"UserNotificationSettingsCard.esm.js","sources":["../../../src/components/UserNotificationSettingsCard/UserNotificationSettingsCard.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 { useState, useEffect } from 'react';\nimport { ErrorPanel, InfoCard, Progress } from '@backstage/core-components';\nimport { useNotificationsApi } from '../../hooks';\nimport { NotificationSettings } from '@backstage/plugin-notifications-common';\nimport { notificationsApiRef } from '../../api';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { notificationsTranslationRef } from '../../translation';\nimport { UserNotificationSettingsPanel } from './UserNotificationSettingsPanel';\nimport { NotificationFormatProvider } from './NotificationFormatContext';\n\n/** @public */\nexport const UserNotificationSettingsCard = (props: {\n originNames?: Record<string, string>;\n topicNames?: Record<string, string>;\n}) => {\n const { t } = useTranslationRef(notificationsTranslationRef);\n const [settings, setNotificationSettings] = useState<\n NotificationSettings | undefined\n >(undefined);\n\n const client = useApi(notificationsApiRef);\n const { error, value, loading } = useNotificationsApi(api => {\n return api.getNotificationSettings();\n });\n\n useEffect(() => {\n if (!loading && !error) {\n setNotificationSettings(value);\n }\n }, [loading, value, error]);\n\n const onUpdate = (newSettings: NotificationSettings) => {\n client\n .updateNotificationSettings(newSettings)\n .then(updatedSettings => setNotificationSettings(updatedSettings));\n };\n\n return (\n <InfoCard title={t('settings.title')} variant=\"gridItem\">\n {loading && <Progress />}\n {error && <ErrorPanel title={t('settings.errorTitle')} error={error} />}\n {settings && (\n <NotificationFormatProvider\n originMap={props.originNames}\n topicMap={props.topicNames}\n >\n <UserNotificationSettingsPanel\n settings={settings}\n onChange={onUpdate}\n />\n </NotificationFormatProvider>\n )}\n </InfoCard>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;AA4BO,MAAM,4BAAA,GAA+B,CAAC,KAAA,KAGvC;AACJ,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,2BAA2B,CAAA;AAC3D,EAAA,MAAM,CAAC,QAAA,EAAU,uBAAuB,CAAA,GAAI,SAE1C,MAAS,CAAA;AAEX,EAAA,MAAM,MAAA,GAAS,OAAO,mBAAmB,CAAA;AACzC,EAAA,MAAM,EAAE,KAAA,EAAO,KAAA,EAAO,OAAA,EAAQ,GAAI,oBAAoB,CAAA,GAAA,KAAO;AAC3D,IAAA,OAAO,IAAI,uBAAA,EAAwB;AAAA,EACrC,CAAC,CAAA;AAED,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,CAAC,OAAA,IAAW,CAAC,KAAA,EAAO;AACtB,MAAA,uBAAA,CAAwB,KAAK,CAAA;AAAA,IAC/B;AAAA,EACF,CAAA,EAAG,CAAC,OAAA,EAAS,KAAA,EAAO,KAAK,CAAC,CAAA;AAE1B,EAAA,MAAM,QAAA,GAAW,CAAC,WAAA,KAAsC;AACtD,IAAA,MAAA,CACG,2BAA2B,WAAW,CAAA,CACtC,KAAK,CAAA,eAAA,KAAmB,uBAAA,CAAwB,eAAe,CAAC,CAAA;AAAA,EACrE,CAAA;AAEA,EAAA,4BACG,QAAA,EAAA,EAAS,KAAA,EAAO,EAAE,gBAAgB,CAAA,EAAG,SAAQ,UAAA,EAC3C,QAAA,EAAA;AAAA,IAAA,OAAA,wBAAY,QAAA,EAAA,EAAS,CAAA;AAAA,IACrB,yBAAS,GAAA,CAAC,UAAA,EAAA,EAAW,OAAO,CAAA,CAAE,qBAAqB,GAAG,KAAA,EAAc,CAAA;AAAA,IACpE,QAAA,oBACC,GAAA;AAAA,MAAC,0BAAA;AAAA,MAAA;AAAA,QACC,WAAW,KAAA,CAAM,WAAA;AAAA,QACjB,UAAU,KAAA,CAAM,UAAA;AAAA,QAEhB,QAAA,kBAAA,GAAA;AAAA,UAAC,6BAAA;AAAA,UAAA;AAAA,YACC,QAAA;AAAA,YACA,QAAA,EAAU;AAAA;AAAA;AACZ;AAAA;AACF,GAAA,EAEJ,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"UserNotificationSettingsCard.esm.js","sources":["../../../src/components/UserNotificationSettingsCard/UserNotificationSettingsCard.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 { useState, useEffect } from 'react';\nimport { ErrorPanel, InfoCard, Progress } from '@backstage/core-components';\nimport { useNotificationsApi } from '../../hooks';\nimport { NotificationSettings } from '@backstage/plugin-notifications-common';\nimport { notificationsApiRef } from '../../api';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { notificationsTranslationRef } from '../../translation';\nimport { UserNotificationSettingsPanel } from './UserNotificationSettingsPanel';\nimport { NotificationFormatProvider } from './NotificationFormatContext';\n\n/** @public */\nexport const UserNotificationSettingsCard = (props: {\n originNames?: Record<string, string>;\n topicNames?: Record<string, string>;\n}) => {\n const { t } = useTranslationRef(notificationsTranslationRef);\n const [settings, setNotificationSettings] = useState<\n NotificationSettings | undefined\n >(undefined);\n\n const client = useApi(notificationsApiRef);\n const { error, value, loading } = useNotificationsApi(api => {\n return api.getNotificationSettings();\n });\n\n useEffect(() => {\n if (!loading && !error) {\n setNotificationSettings(value);\n }\n }, [loading, value, error]);\n\n const onUpdate = (newSettings: NotificationSettings) => {\n client\n .updateNotificationSettings(newSettings)\n .then(updatedSettings => setNotificationSettings(updatedSettings));\n };\n\n return (\n <InfoCard title={t('settings.title')} variant=\"gridItem\">\n {loading && <Progress />}\n {error && <ErrorPanel title={t('settings.errorTitle')} error={error} />}\n {settings && (\n <NotificationFormatProvider\n originMap={props.originNames}\n topicMap={props.topicNames}\n >\n <UserNotificationSettingsPanel\n settings={settings}\n onChange={onUpdate}\n />\n </NotificationFormatProvider>\n )}\n </InfoCard>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AA4BO,MAAM,4BAAA,GAA+B,CAAC,KAAA,KAGvC;AACJ,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,2BAA2B,CAAA;AAC3D,EAAA,MAAM,CAAC,QAAA,EAAU,uBAAuB,CAAA,GAAI,SAE1C,MAAS,CAAA;AAEX,EAAA,MAAM,MAAA,GAAS,OAAO,mBAAmB,CAAA;AACzC,EAAA,MAAM,EAAE,KAAA,EAAO,KAAA,EAAO,OAAA,EAAQ,GAAI,oBAAoB,CAAA,GAAA,KAAO;AAC3D,IAAA,OAAO,IAAI,uBAAA,EAAwB;AAAA,EACrC,CAAC,CAAA;AAED,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,CAAC,OAAA,IAAW,CAAC,KAAA,EAAO;AACtB,MAAA,uBAAA,CAAwB,KAAK,CAAA;AAAA,IAC/B;AAAA,EACF,CAAA,EAAG,CAAC,OAAA,EAAS,KAAA,EAAO,KAAK,CAAC,CAAA;AAE1B,EAAA,MAAM,QAAA,GAAW,CAAC,WAAA,KAAsC;AACtD,IAAA,MAAA,CACG,2BAA2B,WAAW,CAAA,CACtC,KAAK,CAAA,eAAA,KAAmB,uBAAA,CAAwB,eAAe,CAAC,CAAA;AAAA,EACrE,CAAA;AAEA,EAAA,4BACG,QAAA,EAAA,EAAS,KAAA,EAAO,EAAE,gBAAgB,CAAA,EAAG,SAAQ,UAAA,EAC3C,QAAA,EAAA;AAAA,IAAA,OAAA,wBAAY,QAAA,EAAA,EAAS,CAAA;AAAA,IACrB,yBAAS,GAAA,CAAC,UAAA,EAAA,EAAW,OAAO,CAAA,CAAE,qBAAqB,GAAG,KAAA,EAAc,CAAA;AAAA,IACpE,QAAA,oBACC,GAAA;AAAA,MAAC,0BAAA;AAAA,MAAA;AAAA,QACC,WAAW,KAAA,CAAM,WAAA;AAAA,QACjB,UAAU,KAAA,CAAM,UAAA;AAAA,QAEhB,QAAA,kBAAA,GAAA;AAAA,UAAC,6BAAA;AAAA,UAAA;AAAA,YACC,QAAA;AAAA,YACA,QAAA,EAAU;AAAA;AAAA;AACZ;AAAA;AACF,GAAA,EAEJ,CAAA;AAEJ;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"UserNotificationSettingsPanel.esm.js","sources":["../../../src/components/UserNotificationSettingsCard/UserNotificationSettingsPanel.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 { useState } from 'react';\nimport {\n NotificationSettings,\n OriginSetting,\n} from '@backstage/plugin-notifications-common';\nimport { Text } from '@backstage/ui';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { notificationsTranslationRef } from '../../translation';\nimport { TopicRow } from './TopicRow';\nimport { OriginRow } from './OriginRow';\nimport styles from './UserNotificationSettingsPanel.module.css';\n\nexport const UserNotificationSettingsPanel = (props: {\n settings: NotificationSettings;\n onChange: (settings: NotificationSettings) => void;\n originNames?: Record<string, string>;\n topicNames?: Record<string, string>;\n}) => {\n const { settings, onChange } = props;\n const { t } = useTranslationRef(notificationsTranslationRef);\n const [expandedRows, setExpandedRows] = useState<Set<string>>(new Set());\n\n const handleRowToggle = (originId: string) => {\n setExpandedRows(prevState => {\n const newExpandedRows = new Set(prevState);\n if (newExpandedRows.has(originId)) {\n newExpandedRows.delete(originId);\n } else {\n newExpandedRows.add(originId);\n }\n return newExpandedRows;\n });\n };\n const handleChange = (\n channelId: string,\n originId: string,\n topicId: string | null,\n enabled: boolean,\n ) => {\n const updatedSettings = {\n channels: settings.channels.map(channel => {\n if (channel.id !== channelId) {\n return channel;\n }\n return {\n ...channel,\n origins: channel.origins.map(origin => {\n if (origin.id !== originId) {\n return origin;\n }\n\n if (topicId === null) {\n return {\n ...origin,\n enabled,\n topics:\n origin.topics?.map(topic => {\n return { ...topic, enabled };\n }) ?? [],\n };\n }\n\n return {\n ...origin,\n topics:\n origin.topics?.map(topic => {\n if (topic.id === topicId) {\n return {\n ...topic,\n enabled: origin.enabled ? enabled : origin.enabled,\n };\n }\n return topic;\n }) ?? [],\n };\n }),\n };\n }),\n };\n onChange(updatedSettings);\n };\n\n if (settings.channels.length === 0) {\n return (\n <Text variant=\"body-medium\">{t('settings.noSettingsAvailable')}</Text>\n );\n }\n\n const uniqueOriginsMap = settings.channels\n .flatMap(channel => channel.origins)\n .reduce((map, origin) => {\n if (!map.has(origin.id)) {\n map.set(origin.id, origin);\n }\n return map;\n }, new Map<string, OriginSetting>())\n .values();\n\n const uniqueOrigins = Array.from(uniqueOriginsMap);\n\n return (\n <table className={styles.table}>\n <thead>\n <tr>\n <th className={styles.headerCell} />\n <th className={styles.headerCell}>\n <Text variant=\"title-x-small\">{t('settings.table.origin')}</Text>\n </th>\n <th className={styles.headerCell}>\n <Text variant=\"title-x-small\">{t('settings.table.topic')}</Text>\n </th>\n {settings.channels.map(channel => (\n <th key={channel.id} className={styles.headerCell}>\n <Text\n variant=\"title-x-small\"\n style={{ textAlign: 'center', display: 'block' }}\n >\n {channel.id}\n </Text>\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {uniqueOrigins.flatMap(origin => [\n <OriginRow\n key={origin.id}\n origin={origin}\n settings={settings}\n open={expandedRows.has(origin.id)}\n handleChange={handleChange}\n handleRowToggle={handleRowToggle}\n />,\n ...(expandedRows.has(origin.id)\n ? origin.topics?.map(topic => (\n <TopicRow\n key={`${origin.id}-${topic.id}`}\n topic={topic}\n origin={origin}\n settings={settings}\n handleChange={handleChange}\n />\n )) || []\n : []),\n ])}\n </tbody>\n </table>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AA4BO,MAAM,6BAAA,GAAgC,CAAC,KAAA,KAKxC;AACJ,EAAA,MAAM,EAAE,QAAA,EAAU,QAAA,EAAS,GAAI,KAAA;AAC/B,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,2BAA2B,CAAA;AAC3D,EAAA,MAAM,CAAC,YAAA,EAAc,eAAe,IAAI,QAAA,iBAAsB,IAAI,KAAK,CAAA;AAEvE,EAAA,MAAM,eAAA,GAAkB,CAAC,QAAA,KAAqB;AAC5C,IAAA,eAAA,CAAgB,CAAA,SAAA,KAAa;AAC3B,MAAA,MAAM,eAAA,GAAkB,IAAI,GAAA,CAAI,SAAS,CAAA;AACzC,MAAA,IAAI,eAAA,CAAgB,GAAA,CAAI,QAAQ,CAAA,EAAG;AACjC,QAAA,eAAA,CAAgB,OAAO,QAAQ,CAAA;AAAA,MACjC,CAAA,MAAO;AACL,QAAA,eAAA,CAAgB,IAAI,QAAQ,CAAA;AAAA,MAC9B;AACA,MAAA,OAAO,eAAA;AAAA,IACT,CAAC,CAAA;AAAA,EACH,CAAA;AACA,EAAA,MAAM,YAAA,GAAe,CACnB,SAAA,EACA,QAAA,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":["../../../src/components/UserNotificationSettingsCard/UserNotificationSettingsPanel.tsx"],"sourcesContent":["/*\n * Copyright 2024 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 { useState } from 'react';\nimport {\n NotificationSettings,\n OriginSetting,\n} from '@backstage/plugin-notifications-common';\nimport { Text } from '@backstage/ui';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { notificationsTranslationRef } from '../../translation';\nimport { TopicRow } from './TopicRow';\nimport { OriginRow } from './OriginRow';\nimport styles from './UserNotificationSettingsPanel.module.css';\n\nexport const UserNotificationSettingsPanel = (props: {\n settings: NotificationSettings;\n onChange: (settings: NotificationSettings) => void;\n originNames?: Record<string, string>;\n topicNames?: Record<string, string>;\n}) => {\n const { settings, onChange } = props;\n const { t } = useTranslationRef(notificationsTranslationRef);\n const [expandedRows, setExpandedRows] = useState<Set<string>>(new Set());\n\n const handleRowToggle = (originId: string) => {\n setExpandedRows(prevState => {\n const newExpandedRows = new Set(prevState);\n if (newExpandedRows.has(originId)) {\n newExpandedRows.delete(originId);\n } else {\n newExpandedRows.add(originId);\n }\n return newExpandedRows;\n });\n };\n const handleChange = (\n channelId: string,\n originId: string,\n topicId: string | null,\n enabled: boolean,\n ) => {\n const updatedSettings = {\n channels: settings.channels.map(channel => {\n if (channel.id !== channelId) {\n return channel;\n }\n return {\n ...channel,\n origins: channel.origins.map(origin => {\n if (origin.id !== originId) {\n return origin;\n }\n\n if (topicId === null) {\n return {\n ...origin,\n enabled,\n topics:\n origin.topics?.map(topic => {\n return { ...topic, enabled };\n }) ?? [],\n };\n }\n\n return {\n ...origin,\n topics:\n origin.topics?.map(topic => {\n if (topic.id === topicId) {\n return {\n ...topic,\n enabled: origin.enabled ? enabled : origin.enabled,\n };\n }\n return topic;\n }) ?? [],\n };\n }),\n };\n }),\n };\n onChange(updatedSettings);\n };\n\n if (settings.channels.length === 0) {\n return (\n <Text variant=\"body-medium\">{t('settings.noSettingsAvailable')}</Text>\n );\n }\n\n const uniqueOriginsMap = settings.channels\n .flatMap(channel => channel.origins)\n .reduce((map, origin) => {\n if (!map.has(origin.id)) {\n map.set(origin.id, origin);\n }\n return map;\n }, new Map<string, OriginSetting>())\n .values();\n\n const uniqueOrigins = Array.from(uniqueOriginsMap);\n\n return (\n <table className={styles.table}>\n <thead>\n <tr>\n <th className={styles.headerCell} />\n <th className={styles.headerCell}>\n <Text variant=\"title-x-small\">{t('settings.table.origin')}</Text>\n </th>\n <th className={styles.headerCell}>\n <Text variant=\"title-x-small\">{t('settings.table.topic')}</Text>\n </th>\n {settings.channels.map(channel => (\n <th key={channel.id} className={styles.headerCell}>\n <Text\n variant=\"title-x-small\"\n style={{ textAlign: 'center', display: 'block' }}\n >\n {channel.id}\n </Text>\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {uniqueOrigins.flatMap(origin => [\n <OriginRow\n key={origin.id}\n origin={origin}\n settings={settings}\n open={expandedRows.has(origin.id)}\n handleChange={handleChange}\n handleRowToggle={handleRowToggle}\n />,\n ...(expandedRows.has(origin.id)\n ? origin.topics?.map(topic => (\n <TopicRow\n key={`${origin.id}-${topic.id}`}\n topic={topic}\n origin={origin}\n settings={settings}\n handleChange={handleChange}\n />\n )) || []\n : []),\n ])}\n </tbody>\n </table>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AA4BO,MAAM,6BAAA,GAAgC,CAAC,KAAA,KAKxC;AACJ,EAAA,MAAM,EAAE,QAAA,EAAU,QAAA,EAAS,GAAI,KAAA;AAC/B,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,2BAA2B,CAAA;A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AAO,EAAE,CAAA;AAAA,UAChC,YAAA;AAAA,UACA;AAAA,SAAA;AAAA,QALK,MAAA,CAAO;AAAA,OAMd;AAAA,MACA,GAAI,aAAa,GAAA,CAAI,MAAA,CAAO,EAAE,CAAA,GAC1B,MAAA,CAAO,MAAA,EAAQ,GAAA,CAAI,CAAA,KAAA,qBACjB,GAAA;AAAA,QAAC,QAAA;AAAA,QAAA;AAAA,UAEC,KAAA;AAAA,UACA,MAAA;AAAA,UACA,QAAA;AAAA,UACA;AAAA,SAAA;AAAA,QAJK,CAAA,EAAG,MAAA,CAAO,EAAE,CAAA,CAAA,EAAI,MAAM,EAAE,CAAA;AAAA,OAMhC,CAAA,IAAK,EAAC,GACP;AAAC,KACN,CAAA,EACH;AAAA,GAAA,EACF,CAAA;AAEJ;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"UserNotificationSettingsPanel.module.css.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
1
+ {"version":3,"file":"UserNotificationSettingsPanel.module.css.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useNotificationsApi.esm.js","sources":["../../src/hooks/useNotificationsApi.ts"],"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 */\n\nimport { NotificationsApi, notificationsApiRef } from '../api';\nimport { useApi } from '@backstage/core-plugin-api';\nimport useAsyncRetry from 'react-use/esm/useAsyncRetry';\n\n/** @public */\nexport function useNotificationsApi<T>(\n f: (api: NotificationsApi) => Promise<T>,\n deps: any[] = [],\n) {\n const notificationsApi = useApi(notificationsApiRef);\n\n return useAsyncRetry(async () => {\n return await f(notificationsApi);\n }, deps);\n}\n"],"names":[],"mappings":";;;;;AAqBO,SAAS,mBAAA,CACd,CAAA,EACA,IAAA,GAAc,EAAC,EACf;AACA,EAAA,MAAM,gBAAA,GAAmB,OAAO,mBAAmB,CAAA;AAEnD,EAAA,OAAO,cAAc,YAAY;AAC/B,IAAA,OAAO,MAAM,EAAE,gBAAgB,CAAA;AAAA,EACjC,GAAG,IAAI,CAAA;AACT;;;;"}
1
+ {"version":3,"file":"useNotificationsApi.esm.js","sources":["../../src/hooks/useNotificationsApi.ts"],"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 */\n\nimport { NotificationsApi, notificationsApiRef } from '../api';\nimport { useApi } from '@backstage/core-plugin-api';\nimport useAsyncRetry from 'react-use/esm/useAsyncRetry';\n\n/** @public */\nexport function useNotificationsApi<T>(\n f: (api: NotificationsApi) => Promise<T>,\n deps: any[] = [],\n) {\n const notificationsApi = useApi(notificationsApiRef);\n\n return useAsyncRetry(async () => {\n return await f(notificationsApi);\n }, deps);\n}\n"],"names":[],"mappings":";;;;;AAqBO,SAAS,mBAAA,CACd,CAAA,EACA,IAAA,GAAc,EAAC,EACf;AACA,EAAA,MAAM,gBAAA,GAAmB,OAAO,mBAAmB,CAAA;AAEnD,EAAA,OAAO,cAAc,YAAY;AAC/B,IAAA,OAAO,MAAM,EAAE,gBAAgB,CAAA;AAAA,EACjC,GAAG,IAAI,CAAA;AACT;;"}
@@ -0,0 +1,24 @@
1
+ import { useState, useEffect } from 'react';
2
+ import { useSignal } from '@backstage/plugin-signals-react';
3
+
4
+ const DefaultPollIntervalMs = 3e4;
5
+ function useNotificationsRefresh(options) {
6
+ const { lastSignal, isSignalsAvailable } = useSignal("notifications");
7
+ const [pollTick, setPollTick] = useState(0);
8
+ const pollIntervalMs = DefaultPollIntervalMs;
9
+ useEffect(() => {
10
+ if (isSignalsAvailable) {
11
+ return void 0;
12
+ }
13
+ const interval = setInterval(() => {
14
+ if (document.visibilityState === "visible") {
15
+ setPollTick((tick) => tick + 1);
16
+ }
17
+ }, pollIntervalMs);
18
+ return () => clearInterval(interval);
19
+ }, [isSignalsAvailable, pollIntervalMs]);
20
+ return { lastSignal, isSignalsAvailable, pollTick };
21
+ }
22
+
23
+ export { useNotificationsRefresh };
24
+ //# sourceMappingURL=useNotificationsRefresh.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useNotificationsRefresh.esm.js","sources":["../../src/hooks/useNotificationsRefresh.ts"],"sourcesContent":["/*\n * Copyright 2026 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 { useEffect, useState } from 'react';\nimport { useSignal } from '@backstage/plugin-signals-react';\nimport { NotificationSignal } from '@backstage/plugin-notifications-common';\n\nconst DefaultPollIntervalMs = 30_000;\n\n/**\n * Listens for notification signals and falls back to polling when the signals\n * plugin is unavailable (for example in module federation remotes without a\n * shared signals API).\n *\n * @internal\n */\nexport function useNotificationsRefresh(options?: { pollIntervalMs?: number }) {\n const { lastSignal, isSignalsAvailable } =\n useSignal<NotificationSignal>('notifications');\n const [pollTick, setPollTick] = useState(0);\n const pollIntervalMs = options?.pollIntervalMs ?? DefaultPollIntervalMs;\n\n useEffect(() => {\n if (isSignalsAvailable) {\n return undefined;\n }\n\n const interval = setInterval(() => {\n if (document.visibilityState === 'visible') {\n setPollTick(tick => tick + 1);\n }\n }, pollIntervalMs);\n\n return () => clearInterval(interval);\n }, [isSignalsAvailable, pollIntervalMs]);\n\n return { lastSignal, isSignalsAvailable, pollTick };\n}\n"],"names":[],"mappings":";;;AAoBA,MAAM,qBAAA,GAAwB,GAAA;AASvB,SAAS,wBAAwB,OAAA,EAAuC;AAC7E,EAAA,MAAM,EAAE,UAAA,EAAY,kBAAA,EAAmB,GACrC,UAA8B,eAAe,CAAA;AAC/C,EAAA,MAAM,CAAC,QAAA,EAAU,WAAW,CAAA,GAAI,SAAS,CAAC,CAAA;AAC1C,EAAA,MAAM,cAAA,GAA4C,qBAAA;AAElD,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,kBAAA,EAAoB;AACtB,MAAA,OAAO,MAAA;AAAA,IACT;AAEA,IAAA,MAAM,QAAA,GAAW,YAAY,MAAM;AACjC,MAAA,IAAI,QAAA,CAAS,oBAAoB,SAAA,EAAW;AAC1C,QAAA,WAAA,CAAY,CAAA,IAAA,KAAQ,OAAO,CAAC,CAAA;AAAA,MAC9B;AAAA,IACF,GAAG,cAAc,CAAA;AAEjB,IAAA,OAAO,MAAM,cAAc,QAAQ,CAAA;AAAA,EACrC,CAAA,EAAG,CAAC,kBAAA,EAAoB,cAAc,CAAC,CAAA;AAEvC,EAAA,OAAO,EAAE,UAAA,EAAY,kBAAA,EAAoB,QAAA,EAAS;AACpD;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useTitleCounter.esm.js","sources":["../../src/hooks/useTitleCounter.ts"],"sourcesContent":["/*\n * Copyright 2024 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 { useCallback, useEffect, useState } from 'react';\nimport throttle from 'lodash/throttle';\n\nconst getPrefix = (value: number) => (value === 0 ? '' : `(${value}) `);\n\nconst cleanTitle = (currentTitle: string) =>\n currentTitle.replace(/^\\(\\d+\\)\\s/, '');\n\nconst throttledSetTitle = throttle((shownTitle: string) => {\n document.title = shownTitle;\n}, 100);\n\n/** @internal */\nexport function useTitleCounter() {\n const [title, setTitle] = useState(document.title);\n const [count, setCount] = useState(0);\n\n useEffect(() => {\n const baseTitle = cleanTitle(title);\n const shownTitle = `${getPrefix(count)}${baseTitle}`;\n if (document.title !== shownTitle) {\n throttledSetTitle(shownTitle);\n }\n return () => {\n document.title = cleanTitle(title);\n };\n }, [count, title]);\n\n useEffect(() => {\n const titleElement = document.querySelector('title');\n let observer: MutationObserver | undefined;\n if (titleElement) {\n observer = new MutationObserver(mutations => {\n if (mutations?.[0]?.target?.textContent) {\n setTitle(mutations[0].target.textContent);\n }\n });\n observer.observe(titleElement, {\n characterData: true,\n childList: true,\n });\n }\n return () => {\n if (observer) {\n observer.disconnect();\n }\n };\n }, []);\n\n const setNotificationCount = useCallback(\n (newCount: number) => setCount(newCount),\n [],\n );\n\n return { setNotificationCount };\n}\n"],"names":[],"mappings":";;;AAkBA,MAAM,YAAY,CAAC,KAAA,KAAmB,UAAU,CAAA,GAAI,EAAA,GAAK,IAAI,KAAK,CAAA,EAAA,CAAA;AAElE,MAAM,aAAa,CAAC,YAAA,KAClB,YAAA,CAAa,OAAA,CAAQ,cAAc,EAAE,CAAA;AAEvC,MAAM,iBAAA,GAAoB,QAAA,CAAS,CAAC,UAAA,KAAuB;AACzD,EAAA,QAAA,CAAS,KAAA,GAAQ,UAAA;AACnB,CAAA,EAAG,GAAG,CAAA;AAGC,SAAS,eAAA,GAAk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EAAG,EAAE,CAAA;AAEL,EAAA,MAAM,oBAAA,GAAuB,WAAA;AAAA,IAC3B,CAAC,QAAA,KAAqB,QAAA,CAAS,QAAQ,CAAA;AAAA,IACvC;AAAC,GACH;AAEA,EAAA,OAAO,EAAE,oBAAA,EAAqB;AAChC;;;;"}
1
+ {"version":3,"file":"useTitleCounter.esm.js","sources":["../../src/hooks/useTitleCounter.ts"],"sourcesContent":["/*\n * Copyright 2024 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 { useCallback, useEffect, useState } from 'react';\nimport throttle from 'lodash/throttle';\n\nconst getPrefix = (value: number) => (value === 0 ? '' : `(${value}) `);\n\nconst cleanTitle = (currentTitle: string) =>\n currentTitle.replace(/^\\(\\d+\\)\\s/, '');\n\nconst throttledSetTitle = throttle((shownTitle: string) => {\n document.title = shownTitle;\n}, 100);\n\n/** @internal */\nexport function useTitleCounter() {\n const [title, setTitle] = useState(document.title);\n const [count, setCount] = useState(0);\n\n useEffect(() => {\n const baseTitle = cleanTitle(title);\n const shownTitle = `${getPrefix(count)}${baseTitle}`;\n if (document.title !== shownTitle) {\n throttledSetTitle(shownTitle);\n }\n return () => {\n document.title = cleanTitle(title);\n };\n }, [count, title]);\n\n useEffect(() => {\n const titleElement = document.querySelector('title');\n let observer: MutationObserver | undefined;\n if (titleElement) {\n observer = new MutationObserver(mutations => {\n if (mutations?.[0]?.target?.textContent) {\n setTitle(mutations[0].target.textContent);\n }\n });\n observer.observe(titleElement, {\n characterData: true,\n childList: true,\n });\n }\n return () => {\n if (observer) {\n observer.disconnect();\n }\n };\n }, []);\n\n const setNotificationC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