@backstage/plugin-notifications 0.6.0 → 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.
- package/CHANGELOG.md +13 -0
- package/dist/alpha/extensions/unreadNotificationsHomeWidget.esm.js.map +1 -1
- package/dist/alpha.esm.js.map +1 -1
- package/dist/api/NotificationsApi.esm.js.map +1 -1
- package/dist/api/NotificationsClient.esm.js.map +1 -1
- package/dist/components/NotificationsFilters/NotificationsFilters.esm.js.map +1 -1
- package/dist/components/NotificationsPage/NotificationsPage.esm.js +1 -1
- package/dist/components/NotificationsPage/NotificationsPage.esm.js.map +1 -1
- package/dist/components/NotificationsPage/index.esm.js +1 -1
- package/dist/components/NotificationsSideBarItem/NotificationsSideBarItem.esm.js.map +1 -1
- package/dist/components/NotificationsSideBarItem/NotificationsSideBarItem.module.css.esm.js.map +1 -1
- package/dist/components/NotificationsTable/BulkActions.esm.js.map +1 -1
- package/dist/components/NotificationsTable/DefaultNotificationDescription.esm.js.map +1 -1
- package/dist/components/NotificationsTable/NotificationDescription.esm.js.map +1 -1
- package/dist/components/NotificationsTable/NotificationIcon.esm.js.map +1 -1
- package/dist/components/NotificationsTable/NotificationsTable.esm.js.map +1 -1
- package/dist/components/NotificationsTable/NotificationsTable.module.css.esm.js.map +1 -1
- package/dist/components/NotificationsTable/SelectAll.esm.js.map +1 -1
- package/dist/components/NotificationsTable/SelectAll.module.css.esm.js.map +1 -1
- package/dist/components/NotificationsTable/SeverityIcon.esm.js.map +1 -1
- package/dist/components/NotificationsTable/SeverityIcon.module.css.esm.js.map +1 -1
- package/dist/components/UnreadNotificationsCard/UnreadNotificationsCard.esm.js.map +1 -1
- package/dist/components/UnreadNotificationsCard/UnreadNotificationsCard.module.css.esm.js.map +1 -1
- package/dist/components/UserNotificationSettingsCard/NoBorderTableCell.esm.js.map +1 -1
- package/dist/components/UserNotificationSettingsCard/NoBorderTableCell.module.css.esm.js.map +1 -1
- package/dist/components/UserNotificationSettingsCard/NotificationFormatContext.esm.js.map +1 -1
- package/dist/components/UserNotificationSettingsCard/OriginRow.esm.js.map +1 -1
- package/dist/components/UserNotificationSettingsCard/TopicRow.esm.js.map +1 -1
- package/dist/components/UserNotificationSettingsCard/UserNotificationSettingsCard.esm.js.map +1 -1
- package/dist/components/UserNotificationSettingsCard/UserNotificationSettingsPanel.esm.js.map +1 -1
- package/dist/components/UserNotificationSettingsCard/UserNotificationSettingsPanel.module.css.esm.js.map +1 -1
- package/dist/hooks/useNotificationsApi.esm.js.map +1 -1
- package/dist/hooks/useNotificationsRefresh.esm.js.map +1 -1
- package/dist/hooks/useTitleCounter.esm.js.map +1 -1
- package/dist/hooks/useWebNotifications.esm.js.map +1 -1
- package/dist/node_modules_dist/style-inject/dist/style-inject.es.esm.js.map +1 -1
- package/dist/plugin.esm.js.map +1 -1
- package/dist/plugins/notifications/package.json.esm.js +1 -1
- package/dist/plugins/notifications/package.json.esm.js.map +1 -1
- package/dist/routes.esm.js.map +1 -1
- package/dist/translation.esm.js.map +1 -1
- package/dist/utils/notificationLinks.esm.js.map +1 -1
- package/dist/utils/plainText.esm.js.map +1 -1
- package/package.json +14 -14
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectAll.esm.js","sources":["../../../src/components/NotificationsTable/SelectAll.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 */\nimport { Checkbox, Tooltip, TooltipTrigger } from '@backstage/ui';\nimport styles from './SelectAll.module.css';\n\nexport const SelectAll = ({\n count,\n totalCount,\n onSelectAll,\n}: {\n count: number;\n totalCount: number;\n onSelectAll: () => void;\n}) => {\n return (\n <TooltipTrigger>\n <Checkbox\n className={styles.label}\n aria-label=\"Select all\"\n isDisabled={!totalCount}\n isSelected={count > 0}\n isIndeterminate={count > 0 && totalCount !== count}\n onChange={() => onSelectAll()}\n >\n {count > 0 ? `(${count})` : undefined}\n </Checkbox>\n <Tooltip>Select all</Tooltip>\n </TooltipTrigger>\n );\n};\n"],"names":[],"mappings":";;;;AAkBO,MAAM,YAAY,CAAC;AAAA,EACxB,KAAA;AAAA,EACA,UAAA;AAAA,EACA;AACF,CAAA,KAIM;AACJ,EAAA,4BACG,cAAA,EAAA,EACC,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,QAAA;AAAA,MAAA;AAAA,QACC,WAAW,MAAA,CAAO,KAAA;AAAA,QAClB,YAAA,EAAW,YAAA;AAAA,QACX,YAAY,CAAC,UAAA;AAAA,QACb,YAAY,KAAA,GAAQ,CAAA;AAAA,QACpB,eAAA,EAAiB,KAAA,GAAQ,CAAA,IAAK,UAAA,KAAe,KAAA;AAAA,QAC7C,QAAA,EAAU,MAAM,WAAA,EAAY;AAAA,QAE3B,QAAA,EAAA,KAAA,GAAQ,CAAA,GAAI,CAAA,CAAA,EAAI,KAAK,CAAA,CAAA,CAAA,GAAM;AAAA;AAAA,KAC9B;AAAA,oBACA,GAAA,CAAC,WAAQ,QAAA,EAAA,YAAA,EAAU;AAAA,GAAA,EACrB,CAAA;AAEJ
|
|
1
|
+
{"version":3,"file":"SelectAll.esm.js","sources":["../../../src/components/NotificationsTable/SelectAll.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 */\nimport { Checkbox, Tooltip, TooltipTrigger } from '@backstage/ui';\nimport styles from './SelectAll.module.css';\n\nexport const SelectAll = ({\n count,\n totalCount,\n onSelectAll,\n}: {\n count: number;\n totalCount: number;\n onSelectAll: () => void;\n}) => {\n return (\n <TooltipTrigger>\n <Checkbox\n className={styles.label}\n aria-label=\"Select all\"\n isDisabled={!totalCount}\n isSelected={count > 0}\n isIndeterminate={count > 0 && totalCount !== count}\n onChange={() => onSelectAll()}\n >\n {count > 0 ? `(${count})` : undefined}\n </Checkbox>\n <Tooltip>Select all</Tooltip>\n </TooltipTrigger>\n );\n};\n"],"names":[],"mappings":";;;;AAkBO,MAAM,YAAY,CAAC;AAAA,EACxB,KAAA;AAAA,EACA,UAAA;AAAA,EACA;AACF,CAAA,KAIM;AACJ,EAAA,4BACG,cAAA,EAAA,EACC,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,QAAA;AAAA,MAAA;AAAA,QACC,WAAW,MAAA,CAAO,KAAA;AAAA,QAClB,YAAA,EAAW,YAAA;AAAA,QACX,YAAY,CAAC,UAAA;AAAA,QACb,YAAY,KAAA,GAAQ,CAAA;AAAA,QACpB,eAAA,EAAiB,KAAA,GAAQ,CAAA,IAAK,UAAA,KAAe,KAAA;AAAA,QAC7C,QAAA,EAAU,MAAM,WAAA,EAAY;AAAA,QAE3B,QAAA,EAAA,KAAA,GAAQ,CAAA,GAAI,CAAA,CAAA,EAAI,KAAK,CAAA,CAAA,CAAA,GAAM;AAAA;AAAA,KAC9B;AAAA,oBACA,GAAA,CAAC,WAAQ,QAAA,EAAA,YAAA,EAAU;AAAA,GAAA,EACrB,CAAA;AAEJ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectAll.module.css.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SelectAll.module.css.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SeverityIcon.esm.js","sources":["../../../src/components/NotificationsTable/SeverityIcon.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 */\nimport { NotificationSeverity } from '@backstage/plugin-notifications-common';\nimport {\n RiCheckLine,\n RiErrorWarningLine,\n RiAlertLine,\n RiInformationLine,\n} from '@remixicon/react';\nimport styles from './SeverityIcon.module.css';\n\nexport const SeverityIcon = ({\n severity,\n className,\n style,\n}: {\n severity?: NotificationSeverity;\n className?: string;\n style?: React.CSSProperties;\n}) => {\n switch (severity) {\n case 'critical':\n return (\n <RiErrorWarningLine\n size={20}\n className={[styles.critical, className].filter(Boolean).join(' ')}\n style={style}\n />\n );\n case 'high':\n return (\n <RiAlertLine\n size={20}\n className={[styles.high, className].filter(Boolean).join(' ')}\n style={style}\n />\n );\n case 'low':\n return (\n <RiInformationLine\n size={20}\n className={[styles.low, className].filter(Boolean).join(' ')}\n style={style}\n />\n );\n case 'normal':\n default:\n return (\n <RiCheckLine\n size={20}\n className={[styles.normal, className].filter(Boolean).join(' ')}\n style={style}\n />\n );\n }\n};\n"],"names":[],"mappings":";;;;AAwBO,MAAM,eAAe,CAAC;AAAA,EAC3B,QAAA;AAAA,EACA,SAAA;AAAA,EACA;AACF,CAAA,KAIM;AACJ,EAAA,QAAQ,QAAA;AAAU,IAChB,KAAK,UAAA;AACH,MAAA,uBACE,GAAA;AAAA,QAAC,kBAAA;AAAA,QAAA;AAAA,UACC,IAAA,EAAM,EAAA;AAAA,UACN,SAAA,EAAW,CAAC,MAAA,CAAO,QAAA,EAAU,SAAS,EAAE,MAAA,CAAO,OAAO,CAAA,CAAE,IAAA,CAAK,GAAG,CAAA;AAAA,UAChE;AAAA;AAAA,OACF;AAAA,IAEJ,KAAK,MAAA;AACH,MAAA,uBACE,GAAA;AAAA,QAAC,WAAA;AAAA,QAAA;AAAA,UACC,IAAA,EAAM,EAAA;AAAA,UACN,SAAA,EAAW,CAAC,MAAA,CAAO,IAAA,EAAM,SAAS,EAAE,MAAA,CAAO,OAAO,CAAA,CAAE,IAAA,CAAK,GAAG,CAAA;AAAA,UAC5D;AAAA;AAAA,OACF;AAAA,IAEJ,KAAK,KAAA;AACH,MAAA,uBACE,GAAA;AAAA,QAAC,iBAAA;AAAA,QAAA;AAAA,UACC,IAAA,EAAM,EAAA;AAAA,UACN,SAAA,EAAW,CAAC,MAAA,CAAO,GAAA,EAAK,SAAS,EAAE,MAAA,CAAO,OAAO,CAAA,CAAE,IAAA,CAAK,GAAG,CAAA;AAAA,UAC3D;AAAA;AAAA,OACF;AAAA,IAEJ,KAAK,QAAA;AAAA,IACL;AACE,MAAA,uBACE,GAAA;AAAA,QAAC,WAAA;AAAA,QAAA;AAAA,UACC,IAAA,EAAM,EAAA;AAAA,UACN,SAAA,EAAW,CAAC,MAAA,CAAO,MAAA,EAAQ,SAAS,EAAE,MAAA,CAAO,OAAO,CAAA,CAAE,IAAA,CAAK,GAAG,CAAA;AAAA,UAC9D;AAAA;AAAA,OACF;AAAA;AAGR
|
|
1
|
+
{"version":3,"file":"SeverityIcon.esm.js","sources":["../../../src/components/NotificationsTable/SeverityIcon.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 */\nimport { NotificationSeverity } from '@backstage/plugin-notifications-common';\nimport {\n RiCheckLine,\n RiErrorWarningLine,\n RiAlertLine,\n RiInformationLine,\n} from '@remixicon/react';\nimport styles from './SeverityIcon.module.css';\n\nexport const SeverityIcon = ({\n severity,\n className,\n style,\n}: {\n severity?: NotificationSeverity;\n className?: string;\n style?: React.CSSProperties;\n}) => {\n switch (severity) {\n case 'critical':\n return (\n <RiErrorWarningLine\n size={20}\n className={[styles.critical, className].filter(Boolean).join(' ')}\n style={style}\n />\n );\n case 'high':\n return (\n <RiAlertLine\n size={20}\n className={[styles.high, className].filter(Boolean).join(' ')}\n style={style}\n />\n );\n case 'low':\n return (\n <RiInformationLine\n size={20}\n className={[styles.low, className].filter(Boolean).join(' ')}\n style={style}\n />\n );\n case 'normal':\n default:\n return (\n <RiCheckLine\n size={20}\n className={[styles.normal, className].filter(Boolean).join(' ')}\n style={style}\n />\n );\n }\n};\n"],"names":[],"mappings":";;;;AAwBO,MAAM,eAAe,CAAC;AAAA,EAC3B,QAAA;AAAA,EACA,SAAA;AAAA,EACA;AACF,CAAA,KAIM;AACJ,EAAA,QAAQ,QAAA;AAAU,IAChB,KAAK,UAAA;AACH,MAAA,uBACE,GAAA;AAAA,QAAC,kBAAA;AAAA,QAAA;AAAA,UACC,IAAA,EAAM,EAAA;AAAA,UACN,SAAA,EAAW,CAAC,MAAA,CAAO,QAAA,EAAU,SAAS,EAAE,MAAA,CAAO,OAAO,CAAA,CAAE,IAAA,CAAK,GAAG,CAAA;AAAA,UAChE;AAAA;AAAA,OACF;AAAA,IAEJ,KAAK,MAAA;AACH,MAAA,uBACE,GAAA;AAAA,QAAC,WAAA;AAAA,QAAA;AAAA,UACC,IAAA,EAAM,EAAA;AAAA,UACN,SAAA,EAAW,CAAC,MAAA,CAAO,IAAA,EAAM,SAAS,EAAE,MAAA,CAAO,OAAO,CAAA,CAAE,IAAA,CAAK,GAAG,CAAA;AAAA,UAC5D;AAAA;AAAA,OACF;AAAA,IAEJ,KAAK,KAAA;AACH,MAAA,uBACE,GAAA;AAAA,QAAC,iBAAA;AAAA,QAAA;AAAA,UACC,IAAA,EAAM,EAAA;AAAA,UACN,SAAA,EAAW,CAAC,MAAA,CAAO,GAAA,EAAK,SAAS,EAAE,MAAA,CAAO,OAAO,CAAA,CAAE,IAAA,CAAK,GAAG,CAAA;AAAA,UAC3D;AAAA;AAAA,OACF;AAAA,IAEJ,KAAK,QAAA;AAAA,IACL;AACE,MAAA,uBACE,GAAA;AAAA,QAAC,WAAA;AAAA,QAAA;AAAA,UACC,IAAA,EAAM,EAAA;AAAA,UACN,SAAA,EAAW,CAAC,MAAA,CAAO,MAAA,EAAQ,SAAS,EAAE,MAAA,CAAO,OAAO,CAAA,CAAE,IAAA,CAAK,GAAG,CAAA;AAAA,UAC9D;AAAA;AAAA,OACF;AAAA;AAGR;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SeverityIcon.module.css.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SeverityIcon.module.css.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -1 +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 •\n </>\n )}\n {notification.payload.topic && (\n <>\n <span className={styles.notificationInfoRow}>\n {notification.payload.topic}\n </span>\n •\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,K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AA,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;;;;"}
|
|
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 •\n </>\n )}\n {notification.payload.topic && (\n <>\n <span className={styles.notificationInfoRow}>\n {notification.payload.topic}\n </span>\n •\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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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;;"}
|
package/dist/components/UnreadNotificationsCard/UnreadNotificationsCard.module.css.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnreadNotificationsCard.module.css.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"UnreadNotificationsCard.module.css.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;;"}
|
package/dist/components/UserNotificationSettingsCard/NoBorderTableCell.module.css.esm.js.map
CHANGED
|
@@ -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;;"}
|
|
@@ -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.toLowerCase()} notifications from ${formatOriginName(\n origin.id,\n )}`}</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,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,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
|
|
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,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,o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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;;"}
|
|
@@ -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.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
|
|
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;;"}
|
package/dist/components/UserNotificationSettingsCard/UserNotificationSettingsCard.esm.js.map
CHANGED
|
@@ -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,GAA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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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,MAAA,CAAO,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
|
+
{"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,EACA,SACA,OAAA,KACG;AACH,IAAA,MAAM,eAAA,GAAkB;AAAA,MACtB,QAAA,EAAU,QAAA,CAAS,QAAA,CAAS,GAAA,CAAI,CAAA,OAAA,KAAW;AACzC,QAAA,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EAAoB,SAAA,EAAW,OAAO,UAAA,EACrC,QAAA,kBAAA,GAAA;AAAA,QAAC,IAAA;AAAA,QAAA;AAAA,UACC,OAAA,EAAQ,eAAA;AAAA,UACR,KAAA,EAAO,EAAE,SAAA,EAAW,QAAA,EAAU,SAAS,OAAA,EAAQ;AAAA,UAE9C,QAAA,EAAA,OAAA,CAAQ;AAAA;AAAA,OACX,EAAA,EANO,OAAA,CAAQ,EAOjB,CACD;AAAA,KAAA,EACH,CAAA,EACF,CAAA;AAAA,oBACA,GAAA,CAAC,OAAA,EAAA,EACE,QAAA,EAAA,aAAA,CAAc,OAAA,CAAQ,CAAA,MAAA,KAAU;AAAA,sBAC/B,GAAA;AAAA,QAAC,SAAA;AAAA,QAAA;AAAA,UAEC,MAAA;AAAA,UACA,QAAA;AAAA,UACA,IAAA,EAAM,YAAA,CAAa,GAAA,CAAI,MAAA,CAAO,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;;"}
|
|
@@ -1 +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
|
+
{"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,GAAkB;AAChC,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,QAAA,CAAS,SAAS,KAAK,CAAA;AACjD,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,SAAS,CAAC,CAAA;AAEpC,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,MAAM,SAAA,GAAY,WAAW,KAAK,CAAA;AAClC,IAAA,MAAM,aAAa,CAAA,EAAG,SAAA,CAAU,KAAK,CAAC,GAAG,SAAS,CAAA,CAAA;AAClD,IAAA,IAAI,QAAA,CAAS,UAAU,UAAA,EAAY;AACjC,MAAA,iBAAA,CAAkB,UAAU,CAAA;AAAA,IAC9B;AACA,IAAA,OAAO,MAAM;AACX,MAAA,QAAA,CAAS,KAAA,GAAQ,WAAW,KAAK,CAAA;AAAA,IACnC,CAAA;AAAA,EACF,CAAA,EAAG,CAAC,KAAA,EAAO,KAAK,CAAC,CAAA;AAEjB,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,MAAM,YAAA,GAAe,QAAA,CAAS,aAAA,CAAc,OAAO,CAAA;AACnD,IAAA,IAAI,QAAA;AACJ,IAAA,IAAI,YAAA,EAAc;AAChB,MAAA,QAAA,GAAW,IAAI,iBAAiB,CAAA,SAAA,KAAa;AAC3C,QAAA,IAAI,SAAA,GAAY,CAAC,CAAA,EAAG,MAAA,EAAQ,WAAA,EAAa;AACvC,UAAA,QAAA,CAAS,SAAA,CAAU,CAAC,CAAA,CAAE,MAAA,CAAO,WAAW,CAAA;AAAA,QAC1C;AAAA,MACF,CAAC,CAAA;AACD,MAAA,QAAA,CAAS,QAAQ,YAAA,EAAc;AAAA,QAC7B,aAAA,EAAe,IAAA;AAAA,QACf,SAAA,EAAW;AAAA,OACZ,CAAA;AAAA,IACH;AACA,IAAA,OAAO,MAAM;AACX,MAAA,IAAI,QAAA,EAAU;AACZ,QAAA,QAAA,CAAS,UAAA,EAAW;AAAA,MACtB;AAAA,IACF,CAAA;AAAA,EACF,CAAA,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 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,GAAkB;AAChC,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,QAAA,CAAS,SAAS,KAAK,CAAA;AACjD,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,SAAS,CAAC,CAAA;AAEpC,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,MAAM,SAAA,GAAY,WAAW,KAAK,CAAA;AAClC,IAAA,MAAM,aAAa,CAAA,EAAG,SAAA,CAAU,KAAK,CAAC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 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, useState } from 'react';\nimport { useApi, useRouteRef } from '@backstage/core-plugin-api';\nimport { notificationsApiRef } from '../api';\nimport { rootRouteRef } from '../routes';\n\n/** @internal */\nexport function useWebNotifications(enabled: boolean) {\n const [webNotificationPermission, setWebNotificationPermission] =\n useState('default');\n const notificationsRoute = useRouteRef(rootRouteRef)();\n const notificationsApi = useApi(notificationsApiRef);\n\n const requestUserPermission = useCallback(() => {\n if (\n enabled &&\n 'Notification' in window &&\n webNotificationPermission === 'default'\n ) {\n window.Notification.requestPermission().then(permission => {\n setWebNotificationPermission(permission);\n });\n }\n }, [enabled, webNotificationPermission]);\n\n const sendWebNotification = useCallback(\n (options: {\n id: string;\n title: string;\n description: string;\n link?: string;\n }) => {\n if (webNotificationPermission !== 'granted') {\n return null;\n }\n\n const notification = new Notification(options.title, {\n body: options.description,\n tag: options.id, // Prevent duplicates from multiple tabs\n });\n\n notification.onclick = event => {\n event.preventDefault();\n if (options.link) {\n window.open(options.link, '_blank');\n notificationsApi.updateNotifications({\n ids: [options.id],\n read: true,\n });\n } else {\n window.open(notificationsRoute);\n }\n notification.close();\n };\n\n return notification;\n },\n [webNotificationPermission, notificationsApi, notificationsRoute],\n );\n\n return { sendWebNotification, requestUserPermission };\n}\n"],"names":[],"mappings":";;;;;;AAqBO,SAAS,oBAAoB,OAAA,EAAkB;AACpD,EAAA,MAAM,CAAC,yBAAA,EAA2B,4BAA4B,CAAA,GAC5D,SAAS,SAAS,CAAA;AACpB,EAAA,MAAM,kBAAA,GAAqB,WAAA,CAAY,YA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AAA,IACA,CAAC,yBAAA,EAA2B,gBAAA,EAAkB,kBAAkB;AAAA,GAClE;AAEA,EAAA,OAAO,EAAE,qBAAqB,qBAAA,EAAsB;AACtD
|
|
1
|
+
{"version":3,"file":"useWebNotifications.esm.js","sources":["../../src/hooks/useWebNotifications.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, useState } from 'react';\nimport { useApi, useRouteRef } from '@backstage/core-plugin-api';\nimport { notificationsApiRef } from '../api';\nimport { rootRouteRef } from '../routes';\n\n/** @internal */\nexport function useWebNotifications(enabled: boolean) {\n const [webNotificationPermission, setWebNotificationPermission] =\n useState('default');\n const notificationsRoute = useRouteRef(rootRouteRef)();\n const notificationsApi = useApi(notificationsApiRef);\n\n const requestUserPermission = useCallback(() => {\n if (\n enabled &&\n 'Notification' in window &&\n webNotificationPermission === 'default'\n ) {\n window.Notification.requestPermission().then(permission => {\n setWebNotificationPermission(permission);\n });\n }\n }, [enabled, webNotificationPermission]);\n\n const sendWebNotification = useCallback(\n (options: {\n id: string;\n title: string;\n description: string;\n link?: string;\n }) => {\n if (webNotificationPermission !== 'granted') {\n return null;\n }\n\n const notification = new Notification(options.title, {\n body: options.description,\n tag: options.id, // Prevent duplicates from multiple tabs\n });\n\n notification.onclick = event => {\n event.preventDefault();\n if (options.link) {\n window.open(options.link, '_blank');\n notificationsApi.updateNotifications({\n ids: [options.id],\n read: true,\n });\n } else {\n window.open(notificationsRoute);\n }\n notification.close();\n };\n\n return notification;\n },\n [webNotificationPermission, notificationsApi, notificationsRoute],\n );\n\n return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YAChB,IAAA,EAAM;AAAA,WACP,CAAA;AAAA,QACH,CAAA,MAAO;AACL,UAAA,MAAA,CAAO,KAAK,kBAAkB,CAAA;AAAA,QAChC;AACA,QAAA,YAAA,CAAa,KAAA,EAAM;AAAA,MACrB,CAAA;AAEA,MAAA,OAAO,YAAA;AAAA,IACT,CAAA;AAAA,IACA,CAAC,yBAAA,EAA2B,gBAAA,EAAkB,kBAAkB;AAAA,GAClE;AAEA,EAAA,OAAO,EAAE,qBAAqB,qBAAA,EAAsB;AACtD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style-inject.es.esm.js","sources":["../../../../../../node_modules/style-inject/dist/style-inject.es.js"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n"],"names":[],"mappings":"AAAA,SAAS,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE;AAC/B,EAAE,KAAK,GAAG,KAAK,MAAM,GAAG,GAAG,GAAG,EAAE;AAChC,EAAE,IAAI,QAAQ,GAAG,GAAG,CAAC,QAAQ;;AAE7B,EAAE,IAAI,CAAC,GAAG,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,EAAE,OAAO,CAAC;;AAEzD,EAAE,IAAI,IAAI,GAAG,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AACtE,EAAE,IAAI,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC;AAC7C,EAAE,KAAK,CAAC,IAAI,GAAG,UAAU;;AAEzB,EAAE,IAAI,QAAQ,KAAK,KAAK,EAAE;AAC1B,IAAI,IAAI,IAAI,CAAC,UAAU,EAAE;AACzB,MAAM,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC;AAC/C,IAAI,CAAC,MAAM;AACX,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;AAC7B,IAAI;AACJ,EAAE,CAAC,MAAM;AACT,IAAI,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;AAC3B,EAAE;;AAEF,EAAE,IAAI,KAAK,CAAC,UAAU,EAAE;AACxB,IAAI,KAAK,CAAC,UAAU,CAAC,OAAO,GAAG,GAAG;AAClC,EAAE,CAAC,MAAM;AACT,IAAI,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;AACnD,EAAE;AACF
|
|
1
|
+
{"version":3,"file":"style-inject.es.esm.js","sources":["../../../../../../node_modules/style-inject/dist/style-inject.es.js"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n"],"names":[],"mappings":"AAAA,SAAS,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE;AAC/B,EAAE,KAAK,GAAG,KAAK,MAAM,GAAG,GAAG,GAAG,EAAE;AAChC,EAAE,IAAI,QAAQ,GAAG,GAAG,CAAC,QAAQ;;AAE7B,EAAE,IAAI,CAAC,GAAG,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,EAAE,OAAO,CAAC;;AAEzD,EAAE,IAAI,IAAI,GAAG,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AACtE,EAAE,IAAI,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC;AAC7C,EAAE,KAAK,CAAC,IAAI,GAAG,UAAU;;AAEzB,EAAE,IAAI,QAAQ,KAAK,KAAK,EAAE;AAC1B,IAAI,IAAI,IAAI,CAAC,UAAU,EAAE;AACzB,MAAM,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC;AAC/C,IAAI,CAAC,MAAM;AACX,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;AAC7B,IAAI;AACJ,EAAE,CAAC,MAAM;AACT,IAAI,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;AAC3B,EAAE;;AAEF,EAAE,IAAI,KAAK,CAAC,UAAU,EAAE;AACxB,IAAI,KAAK,CAAC,UAAU,CAAC,OAAO,GAAG,GAAG;AAClC,EAAE,CAAC,MAAM;AACT,IAAI,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;AACnD,EAAE;AACF;;","x_google_ignoreList":[0]}
|
package/dist/plugin.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.esm.js","sources":["../src/plugin.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 */\nimport {\n createApiFactory,\n createPlugin,\n createRoutableExtension,\n discoveryApiRef,\n fetchApiRef,\n} from '@backstage/core-plugin-api';\n\nimport { rootRouteRef } from './routes';\nimport { notificationsApiRef } from './api/NotificationsApi';\nimport { NotificationsClient } from './api';\n\n/** @public */\nexport const notificationsPlugin = createPlugin({\n id: 'notifications',\n routes: {\n root: rootRouteRef,\n },\n apis: [\n createApiFactory({\n api: notificationsApiRef,\n deps: { discoveryApi: discoveryApiRef, fetchApi: fetchApiRef },\n factory: ({ discoveryApi, fetchApi }) =>\n new NotificationsClient({ discoveryApi, fetchApi }),\n }),\n ],\n});\n\n/** @public */\nexport const NotificationsPage = notificationsPlugin.provide(\n createRoutableExtension({\n name: 'NotificationsPage',\n component: () =>\n import('./components/NotificationsPage').then(m => m.NotificationsPage),\n mountPoint: rootRouteRef,\n }),\n);\n"],"names":[],"mappings":";;;;;AA4BO,MAAM,sBAAsB,YAAA,CAAa;AAAA,EAC9C,EAAA,EAAI,eAAA;AAAA,EACJ,MAAA,EAAQ;AAAA,IACN,IAAA,EAAM;AAAA,GACR;AAAA,EACA,IAAA,EAAM;AAAA,IACJ,gBAAA,CAAiB;AAAA,MACf,GAAA,EAAK,mBAAA;AAAA,MACL,IAAA,EAAM,EAAE,YAAA,EAAc,eAAA,EAAiB,UAAU,WAAA,EAAY;AAAA,MAC7D,OAAA,EAAS,CAAC,EAAE,YAAA,EAAc,QAAA,EAAS,KACjC,IAAI,mBAAA,CAAoB,EAAE,YAAA,EAAc,QAAA,EAAU;AAAA,KACrD;AAAA;AAEL,CAAC;AAGM,MAAM,oBAAoB,mBAAA,CAAoB,OAAA;AAAA,EACnD,uBAAA,CAAwB;AAAA,IACtB,IAAA,EAAM,mBAAA;AAAA,IACN,SAAA,EAAW,MACT,OAAO,6CAAgC,EAAE,IAAA,CAAK,CAAA,CAAA,KAAK,EAAE,iBAAiB,CAAA;AAAA,IACxE,UAAA,EAAY;AAAA,GACb;AACH
|
|
1
|
+
{"version":3,"file":"plugin.esm.js","sources":["../src/plugin.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 */\nimport {\n createApiFactory,\n createPlugin,\n createRoutableExtension,\n discoveryApiRef,\n fetchApiRef,\n} from '@backstage/core-plugin-api';\n\nimport { rootRouteRef } from './routes';\nimport { notificationsApiRef } from './api/NotificationsApi';\nimport { NotificationsClient } from './api';\n\n/** @public */\nexport const notificationsPlugin = createPlugin({\n id: 'notifications',\n routes: {\n root: rootRouteRef,\n },\n apis: [\n createApiFactory({\n api: notificationsApiRef,\n deps: { discoveryApi: discoveryApiRef, fetchApi: fetchApiRef },\n factory: ({ discoveryApi, fetchApi }) =>\n new NotificationsClient({ discoveryApi, fetchApi }),\n }),\n ],\n});\n\n/** @public */\nexport const NotificationsPage = notificationsPlugin.provide(\n createRoutableExtension({\n name: 'NotificationsPage',\n component: () =>\n import('./components/NotificationsPage').then(m => m.NotificationsPage),\n mountPoint: rootRouteRef,\n }),\n);\n"],"names":[],"mappings":";;;;;AA4BO,MAAM,sBAAsB,YAAA,CAAa;AAAA,EAC9C,EAAA,EAAI,eAAA;AAAA,EACJ,MAAA,EAAQ;AAAA,IACN,IAAA,EAAM;AAAA,GACR;AAAA,EACA,IAAA,EAAM;AAAA,IACJ,gBAAA,CAAiB;AAAA,MACf,GAAA,EAAK,mBAAA;AAAA,MACL,IAAA,EAAM,EAAE,YAAA,EAAc,eAAA,EAAiB,UAAU,WAAA,EAAY;AAAA,MAC7D,OAAA,EAAS,CAAC,EAAE,YAAA,EAAc,QAAA,EAAS,KACjC,IAAI,mBAAA,CAAoB,EAAE,YAAA,EAAc,QAAA,EAAU;AAAA,KACrD;AAAA;AAEL,CAAC;AAGM,MAAM,oBAAoB,mBAAA,CAAoB,OAAA;AAAA,EACnD,uBAAA,CAAwB;AAAA,IACtB,IAAA,EAAM,mBAAA;AAAA,IACN,SAAA,EAAW,MACT,OAAO,6CAAgC,EAAE,IAAA,CAAK,CAAA,CAAA,KAAK,EAAE,iBAAiB,CAAA;AAAA,IACxE,UAAA,EAAY;AAAA,GACb;AACH;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package.json.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"package.json.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/routes.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.esm.js","sources":["../src/routes.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 */\nimport { createRouteRef } from '@backstage/core-plugin-api';\n\nexport const rootRouteRef = createRouteRef({\n id: 'notifications',\n});\n"],"names":[],"mappings":";;AAiBO,MAAM,eAAe,cAAA,CAAe;AAAA,EACzC,EAAA,EAAI;AACN,CAAC
|
|
1
|
+
{"version":3,"file":"routes.esm.js","sources":["../src/routes.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 */\nimport { createRouteRef } from '@backstage/core-plugin-api';\n\nexport const rootRouteRef = createRouteRef({\n id: 'notifications',\n});\n"],"names":[],"mappings":";;AAiBO,MAAM,eAAe,cAAA,CAAe;AAAA,EACzC,EAAA,EAAI;AACN,CAAC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translation.esm.js","sources":["../src/translation.ts"],"sourcesContent":["/*\n * Copyright 2025 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 { createTranslationRef } from '@backstage/frontend-plugin-api';\n\n/** @public */\nexport const notificationsTranslationRef = createTranslationRef({\n id: 'plugin.notifications',\n messages: {\n notificationsPage: {\n title: 'Notifications',\n tableTitle: {\n all_one: 'All notifications ({{count}})',\n all_other: 'All notifications ({{count}})',\n saved_one: 'Saved notifications ({{count}})',\n saved_other: 'Saved notifications ({{count}})',\n unread_one: 'Unread notifications ({{count}})',\n unread_other: 'Unread notifications ({{count}})',\n read_one: 'Read notifications ({{count}})',\n read_other: 'Read notifications ({{count}})',\n },\n },\n filters: {\n title: 'Filters',\n view: {\n label: 'View',\n unread: 'Unread notifications',\n read: 'Read notifications',\n saved: 'Saved',\n all: 'All',\n },\n createdAfter: {\n label: 'Sent out',\n placeholder: 'Notifications since',\n last24h: 'Last 24h',\n lastWeek: 'Last week',\n anyTime: 'Any time',\n },\n sortBy: {\n label: 'Sort by',\n placeholder: 'Field to sort by',\n newest: 'Newest on top',\n oldest: 'Oldest on top',\n topic: 'Topic',\n origin: 'Origin',\n },\n severity: {\n label: 'Min severity',\n critical: 'Critical',\n high: 'High',\n normal: 'Normal',\n low: 'Low',\n },\n topic: {\n label: 'Topic',\n anyTopic: 'Any topic',\n },\n },\n table: {\n emptyMessage: 'No records to display',\n pagination: {\n firstTooltip: 'First Page',\n labelDisplayedRows: '{from}-{to} of {count}',\n labelRowsSelect: 'rows',\n lastTooltip: 'Last Page',\n nextTooltip: 'Next Page',\n previousTooltip: 'Previous Page',\n },\n bulkActions: {\n markAllRead: 'Mark all read',\n markSelectedAsRead: 'Mark selected as read',\n returnSelectedAmongUnread: 'Return selected among unread',\n saveSelectedForLater: 'Save selected for later',\n undoSaveForSelected: 'Undo save for selected',\n },\n confirmDialog: {\n title: 'Are you sure?',\n markAllReadDescription: 'Mark all notifications as read.',\n markAllReadConfirmation: 'Mark All',\n cancel: 'Cancel',\n },\n errors: {\n markAllReadFailed: 'Failed to mark all notifications as read',\n },\n },\n sidebar: {\n title: 'Notifications',\n errors: {\n markAsReadFailed: 'Failed to mark notification as read',\n fetchNotificationFailed: 'Failed to fetch notification',\n },\n },\n settings: {\n title: 'Notification settings',\n errorTitle: 'Failed to load settings',\n noSettingsAvailable:\n 'No notification settings available, check back later',\n table: {\n origin: 'Origin',\n topic: 'Topic',\n },\n errors: {\n useNotificationFormat:\n 'useNotificationFormat must be used within a NotificationFormatProvider',\n },\n },\n unreadCard: {\n title_one: 'Last unread notifications ({{count}})',\n title_other: 'Last unread notifications ({{count}})',\n viewAll: 'View All',\n emptyState: 'All caught up!',\n columnNotification: 'Notification',\n columnActions: 'Actions',\n resultsCount: '{{displayed}} results out of {{total}}',\n },\n },\n});\n"],"names":[],"m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AAa,uCAAA;AAAA,MACb,OAAA,EAAS,UAAA;AAAA,MACT,UAAA,EAAY,gBAAA;AAAA,MACZ,kBAAA,EAAoB,cAAA;AAAA,MACpB,aAAA,EAAe,SAAA;AAAA,MACf,YAAA,EAAc;AAAA;AAChB;AAEJ,CAAC
|
|
1
|
+
{"version":3,"file":"translation.esm.js","sources":["../src/translation.ts"],"sourcesContent":["/*\n * Copyright 2025 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 { createTranslationRef } from '@backstage/frontend-plugin-api';\n\n/** @public */\nexport const notificationsTranslationRef = createTranslationRef({\n id: 'plugin.notifications',\n messages: {\n notificationsPage: {\n title: 'Notifications',\n tableTitle: {\n all_one: 'All notifications ({{count}})',\n all_other: 'All notifications ({{count}})',\n saved_one: 'Saved notifications ({{count}})',\n saved_other: 'Saved notifications ({{count}})',\n unread_one: 'Unread notifications ({{count}})',\n unread_other: 'Unread notifications ({{count}})',\n read_one: 'Read notifications ({{count}})',\n read_other: 'Read notifications ({{count}})',\n },\n },\n filters: {\n title: 'Filters',\n view: {\n label: 'View',\n unread: 'Unread notifications',\n read: 'Read notifications',\n saved: 'Saved',\n all: 'All',\n },\n createdAfter: {\n label: 'Sent out',\n placeholder: 'Notifications since',\n last24h: 'Last 24h',\n lastWeek: 'Last week',\n anyTime: 'Any time',\n },\n sortBy: {\n label: 'Sort by',\n placeholder: 'Field to sort by',\n newest: 'Newest on top',\n oldest: 'Oldest on top',\n topic: 'Topic',\n origin: 'Origin',\n },\n severity: {\n label: 'Min severity',\n critical: 'Critical',\n high: 'High',\n normal: 'Normal',\n low: 'Low',\n },\n topic: {\n label: 'Topic',\n anyTopic: 'Any topic',\n },\n },\n table: {\n emptyMessage: 'No records to display',\n pagination: {\n firstTooltip: 'First Page',\n labelDisplayedRows: '{from}-{to} of {count}',\n labelRowsSelect: 'rows',\n lastTooltip: 'Last Page',\n nextTooltip: 'Next Page',\n previousTooltip: 'Previous Page',\n },\n bulkActions: {\n markAllRead: 'Mark all read',\n markSelectedAsRead: 'Mark selected as read',\n returnSelectedAmongUnread: 'Return selected among unread',\n saveSelectedForLater: 'Save selected for later',\n undoSaveForSelected: 'Undo save for selected',\n },\n confirmDialog: {\n title: 'Are you sure?',\n markAllReadDescription: 'Mark all notifications as read.',\n markAllReadConfirmation: 'Mark All',\n cancel: 'Cancel',\n },\n errors: {\n markAllReadFailed: 'Failed to mark all notifications as read',\n },\n },\n sidebar: {\n title: 'Notifications',\n errors: {\n markAsReadFailed: 'Failed to mark notification as read',\n fetchNotificationFailed: 'Failed to fetch notification',\n },\n },\n settings: {\n title: 'Notification settings',\n errorTitle: 'Failed to load settings',\n noSettingsAvailable:\n 'No notification settings available, check back later',\n table: {\n origin: 'Origin',\n topic: 'Topic',\n },\n errors: {\n useNotificationFormat:\n 'useNotificationFormat must be used within a NotificationFormatProvider',\n },\n },\n unreadCard: {\n title_one: 'Last unread notifications ({{count}})',\n title_other: 'Last unread notifications ({{count}})',\n viewAll: 'View All',\n emptyState: 'All caught up!',\n columnNotification: 'Notification',\n columnActions: 'Actions',\n resultsCount: '{{displayed}} results out of {{total}}',\n },\n },\n});\n"],"names":[],"mappings":";;AAmBO,MAAM,8BAA8B,oBAAA,CAAqB;AAAA,EAC9D,EAAA,EAAI,sBAAA;AAAA,EACJ,QAAA,EAAU;AAAA,IACR,iBAAA,EAAmB;AAAA,MACjB,KAAA,EAAO,eAAA;AAAA,MACP,UAAA,EAAY;AAAA,QACV,OAAA,EAAS,+BAAA;AAAA,QACT,SAAA,EAAW,+BAAA;AAAA,QACX,SAAA,EAAW,iCAAA;AAAA,QACX,W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Content":["/*\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/** @public */\nexport const NOTIFICATIONS_PAGE_PATH = '/notifications';\n\n/** @public */\nexport function getNotificationsPageLink(notificationId?: string): string {\n if (!notificationId) {\n return NOTIFICATIONS_PAGE_PATH;\n }\n\n const params = new URLSearchParams({ id: notificationId });\n return `${NOTIFICATIONS_PAGE_PATH}?${params.toString()}`;\n}\n"],"names":[],"mappings":"AAiBO,MAAM,uBAAA,GAA0B;AAGhC,SAAS,yBAAyB,cAAA,EAAiC;AACxE,EAAA,IAAI,CAAC,cAAA,EAAgB;AACnB,IAAA,OAAO,uBAAA;AAAA,EACT;AAEA,EAAA,MAAM,SAAS,IAAI,eAAA,CAAgB,EAAE,EAAA,EAAI,gBAAgB,CAAA;AACzD,EAAA,OAAO,CAAA,EAAG,uBAAuB,CAAA,CAAA,EAAI,MAAA,CAAO,UAAU,CAAA,CAAA;AACxD
|
|
1
|
+
{"version":3,"file":"notificationLinks.esm.js","sources":["../../src/utils/notificationLinks.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\n/** @public */\nexport const NOTIFICATIONS_PAGE_PATH = '/notifications';\n\n/** @public */\nexport function getNotificationsPageLink(notificationId?: string): string {\n if (!notificationId) {\n return NOTIFICATIONS_PAGE_PATH;\n }\n\n const params = new URLSearchParams({ id: notificationId });\n return `${NOTIFICATIONS_PAGE_PATH}?${params.toString()}`;\n}\n"],"names":[],"mappings":"AAiBO,MAAM,uBAAA,GAA0B;AAGhC,SAAS,yBAAyB,cAAA,EAAiC;AACxE,EAAA,IAAI,CAAC,cAAA,EAAgB;AACnB,IAAA,OAAO,uBAAA;AAAA,EACT;AAEA,EAAA,MAAM,SAAS,IAAI,eAAA,CAAgB,EAAE,EAAA,EAAI,gBAAgB,CAAA;AACzD,EAAA,OAAO,CAAA,EAAG,uBAAuB,CAAA,CAAA,EAAI,MAAA,CAAO,UAAU,CAAA,CAAA;AACxD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plainText.esm.js","sources":["../../src/utils/plainText.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\nconst HTML_ENTITY_MAP: Record<string, string> = {\n '&': '&',\n '<': '<',\n '>': '>',\n '"': '\"',\n ''': \"'\",\n ' ': ' ',\n};\n\n/** @public */\nexport function toPlainText(text: string): string {\n // Decode entities before stripping tags so encoded markup like\n // `<b>...</b>` does not reappear as HTML in the result.\n const withoutEntities = text.replace(\n /&(?:amp|lt|gt|quot|#39|nbsp);/g,\n entity => HTML_ENTITY_MAP[entity] ?? entity,\n );\n // Only strip real HTML tags (names starting with a letter), so text like\n // \"<3\" or placeholders is preserved after entity decoding.\n const withoutHtml = withoutEntities.replace(/<\\/?[a-zA-Z][^>]*>/g, ' ');\n\n return withoutHtml\n .replace(/!\\[([^\\]]*)\\]\\([^)]*\\)/g, '$1')\n .replace(/\\[([^\\]]+)\\]\\([^)]*\\)/g, '$1')\n .replace(/(\\*\\*|__)(.*?)\\1/g, '$2')\n .replace(/(\\*|_)(.*?)\\1/g, '$2')\n .replace(/`([^`]+)`/g, '$1')\n .replace(/^#{1,6}\\s+/gm, '')\n .replace(/\\s+/g, ' ')\n .trim();\n}\n\n/** @public */\nexport function truncateText(\n text: string,\n maxChars: number,\n): { display: string; truncated: boolean; full: string } {\n const full = toPlainText(text);\n\n if (full.length <= maxChars) {\n return { display: full, truncated: false, full };\n }\n\n return {\n display: `${full.slice(0, maxChars)}...`,\n truncated: true,\n full,\n };\n}\n"],"names":[],"mappings":"AAgBA,MAAM,eAAA,GAA0C;AAAA,EAC9C,OAAA,EAAS,GAAA;AAAA,EACT,MAAA,EAAQ,GAAA;AAAA,EACR,MAAA,EAAQ,GAAA;AAAA,EACR,QAAA,EAAU,GAAA;AAAA,EACV,OAAA,EAAS,GAAA;AAAA,EACT,QAAA,EAAU;AACZ,CAAA;AAGO,SAAS,YAAY,IAAA,EAAsB;AAGhD,EAAA,MAAM,kBAAkB,IAAA,CAAK,OAAA;AAAA,IAC3B,gCAAA;AAAA,IACA,CAAA,MAAA,KAAU,eAAA,CAAgB,MAAM,CAAA,IAAK;AAAA,GACvC;AAGA,EAAA,MAAM,WAAA,GAAc,eAAA,CAAgB,OAAA,CAAQ,qBAAA,EAAuB,GAAG,CAAA;AAEtE,EAAA,OAAO,WAAA,CACJ,OAAA,CAAQ,yBAAA,EAA2B,IAAI,CAAA,CACvC,OAAA,CAAQ,wBAAA,EAA0B,IAAI,CAAA,CACtC,OAAA,CAAQ,mBAAA,EAAqB,IAAI,CAAA,CACjC,OAAA,CAAQ,gBAAA,EAAkB,IAAI,CAAA,CAC9B,OAAA,CAAQ,YAAA,EAAc,IAAI,CAAA,CAC1B,OAAA,CAAQ,cAAA,EAAgB,EAAE,CAAA,CAC1B,OAAA,CAAQ,MAAA,EAAQ,GAAG,EACnB,IAAA,EAAK;AACV;AAGO,SAAS,YAAA,CACd,MACA,QAAA,EACuD;AACvD,EAAA,MAAM,IAAA,GAAO,YAAY,IAAI,CAAA;AAE7B,EAAA,IAAI,IAAA,CAAK,UAAU,QAAA,EAAU;AAC3B,IAAA,OAAO,EAAE,OAAA,EAAS,IAAA,EAAM,SAAA,EAAW,OAAO,IAAA,EAAK;AAAA,EACjD;AAEA,EAAA,OAAO;AAAA,IACL,SAAS,CAAA,EAAG,IAAA,CAAK,KAAA,CAAM,CAAA,EAAG,QAAQ,CAAC,CAAA,GAAA,CAAA;AAAA,IACnC,SAAA,EAAW,IAAA;AAAA,IACX;AAAA,GACF;AACF
|
|
1
|
+
{"version":3,"file":"plainText.esm.js","sources":["../../src/utils/plainText.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\nconst HTML_ENTITY_MAP: Record<string, string> = {\n '&': '&',\n '<': '<',\n '>': '>',\n '"': '\"',\n ''': \"'\",\n ' ': ' ',\n};\n\n/** @public */\nexport function toPlainText(text: string): string {\n // Decode entities before stripping tags so encoded markup like\n // `<b>...</b>` does not reappear as HTML in the result.\n const withoutEntities = text.replace(\n /&(?:amp|lt|gt|quot|#39|nbsp);/g,\n entity => HTML_ENTITY_MAP[entity] ?? entity,\n );\n // Only strip real HTML tags (names starting with a letter), so text like\n // \"<3\" or placeholders is preserved after entity decoding.\n const withoutHtml = withoutEntities.replace(/<\\/?[a-zA-Z][^>]*>/g, ' ');\n\n return withoutHtml\n .replace(/!\\[([^\\]]*)\\]\\([^)]*\\)/g, '$1')\n .replace(/\\[([^\\]]+)\\]\\([^)]*\\)/g, '$1')\n .replace(/(\\*\\*|__)(.*?)\\1/g, '$2')\n .replace(/(\\*|_)(.*?)\\1/g, '$2')\n .replace(/`([^`]+)`/g, '$1')\n .replace(/^#{1,6}\\s+/gm, '')\n .replace(/\\s+/g, ' ')\n .trim();\n}\n\n/** @public */\nexport function truncateText(\n text: string,\n maxChars: number,\n): { display: string; truncated: boolean; full: string } {\n const full = toPlainText(text);\n\n if (full.length <= maxChars) {\n return { display: full, truncated: false, full };\n }\n\n return {\n display: `${full.slice(0, maxChars)}...`,\n truncated: true,\n full,\n };\n}\n"],"names":[],"mappings":"AAgBA,MAAM,eAAA,GAA0C;AAAA,EAC9C,OAAA,EAAS,GAAA;AAAA,EACT,MAAA,EAAQ,GAAA;AAAA,EACR,MAAA,EAAQ,GAAA;AAAA,EACR,QAAA,EAAU,GAAA;AAAA,EACV,OAAA,EAAS,GAAA;AAAA,EACT,QAAA,EAAU;AACZ,CAAA;AAGO,SAAS,YAAY,IAAA,EAAsB;AAGhD,EAAA,MAAM,kBAAkB,IAAA,CAAK,OAAA;AAAA,IAC3B,gCAAA;AAAA,IACA,CAAA,MAAA,KAAU,eAAA,CAAgB,MAAM,CAAA,IAAK;AAAA,GACvC;AAGA,EAAA,MAAM,WAAA,GAAc,eAAA,CAAgB,OAAA,CAAQ,qBAAA,EAAuB,GAAG,CAAA;AAEtE,EAAA,OAAO,WAAA,CACJ,OAAA,CAAQ,yBAAA,EAA2B,IAAI,CAAA,CACvC,OAAA,CAAQ,wBAAA,EAA0B,IAAI,CAAA,CACtC,OAAA,CAAQ,mBAAA,EAAqB,IAAI,CAAA,CACjC,OAAA,CAAQ,gBAAA,EAAkB,IAAI,CAAA,CAC9B,OAAA,CAAQ,YAAA,EAAc,IAAI,CAAA,CAC1B,OAAA,CAAQ,cAAA,EAAgB,EAAE,CAAA,CAC1B,OAAA,CAAQ,MAAA,EAAQ,GAAG,EACnB,IAAA,EAAK;AACV;AAGO,SAAS,YAAA,CACd,MACA,QAAA,EACuD;AACvD,EAAA,MAAM,IAAA,GAAO,YAAY,IAAI,CAAA;AAE7B,EAAA,IAAI,IAAA,CAAK,UAAU,QAAA,EAAU;AAC3B,IAAA,OAAO,EAAE,OAAA,EAAS,IAAA,EAAM,SAAA,EAAW,OAAO,IAAA,EAAK;AAAA,EACjD;AAEA,EAAA,OAAO;AAAA,IACL,SAAS,CAAA,EAAG,IAAA,CAAK,KAAA,CAAM,CAAA,EAAG,QAAQ,CAAC,CAAA,GAAA,CAAA;AAAA,IACnC,SAAA,EAAW,IAAA;AAAA,IACX;AAAA,GACF;AACF;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-notifications",
|
|
3
|
-
"version": "0.6.0",
|
|
3
|
+
"version": "0.6.1-next.0",
|
|
4
4
|
"backstage": {
|
|
5
5
|
"role": "frontend-plugin",
|
|
6
6
|
"pluginId": "notifications",
|
|
@@ -63,15 +63,15 @@
|
|
|
63
63
|
"test": "backstage-cli package test"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@backstage/core-components": "
|
|
67
|
-
"@backstage/core-plugin-api": "
|
|
68
|
-
"@backstage/errors": "
|
|
69
|
-
"@backstage/frontend-plugin-api": "
|
|
70
|
-
"@backstage/plugin-home-react": "
|
|
71
|
-
"@backstage/plugin-notifications-common": "
|
|
72
|
-
"@backstage/plugin-signals-react": "
|
|
73
|
-
"@backstage/theme": "
|
|
74
|
-
"@backstage/ui": "
|
|
66
|
+
"@backstage/core-components": "0.18.15-next.0",
|
|
67
|
+
"@backstage/core-plugin-api": "1.12.11-next.0",
|
|
68
|
+
"@backstage/errors": "1.3.2-next.0",
|
|
69
|
+
"@backstage/frontend-plugin-api": "0.18.2-next.0",
|
|
70
|
+
"@backstage/plugin-home-react": "0.1.43-next.0",
|
|
71
|
+
"@backstage/plugin-notifications-common": "0.2.5-next.0",
|
|
72
|
+
"@backstage/plugin-signals-react": "0.0.27-next.0",
|
|
73
|
+
"@backstage/theme": "0.7.3",
|
|
74
|
+
"@backstage/ui": "0.18.0",
|
|
75
75
|
"@remixicon/react": ">=4.6.0 <4.9.0",
|
|
76
76
|
"lodash": "^4.17.21",
|
|
77
77
|
"notistack": "^3.0.1",
|
|
@@ -80,10 +80,10 @@
|
|
|
80
80
|
"react-use": "^17.2.4"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
|
-
"@backstage/cli": "
|
|
84
|
-
"@backstage/dev-utils": "
|
|
85
|
-
"@backstage/plugin-signals": "
|
|
86
|
-
"@backstage/test-utils": "
|
|
83
|
+
"@backstage/cli": "0.36.7-next.0",
|
|
84
|
+
"@backstage/dev-utils": "1.1.28-next.0",
|
|
85
|
+
"@backstage/plugin-signals": "0.0.36-next.0",
|
|
86
|
+
"@backstage/test-utils": "1.7.23-next.0",
|
|
87
87
|
"@testing-library/dom": "^10.0.0",
|
|
88
88
|
"@testing-library/jest-dom": "^6.0.0",
|
|
89
89
|
"@testing-library/react": "^16.0.0",
|