@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.
Files changed (44) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/alpha/extensions/unreadNotificationsHomeWidget.esm.js.map +1 -1
  3. package/dist/alpha.esm.js.map +1 -1
  4. package/dist/api/NotificationsApi.esm.js.map +1 -1
  5. package/dist/api/NotificationsClient.esm.js.map +1 -1
  6. package/dist/components/NotificationsFilters/NotificationsFilters.esm.js.map +1 -1
  7. package/dist/components/NotificationsPage/NotificationsPage.esm.js +1 -1
  8. package/dist/components/NotificationsPage/NotificationsPage.esm.js.map +1 -1
  9. package/dist/components/NotificationsPage/index.esm.js +1 -1
  10. package/dist/components/NotificationsSideBarItem/NotificationsSideBarItem.esm.js.map +1 -1
  11. package/dist/components/NotificationsSideBarItem/NotificationsSideBarItem.module.css.esm.js.map +1 -1
  12. package/dist/components/NotificationsTable/BulkActions.esm.js.map +1 -1
  13. package/dist/components/NotificationsTable/DefaultNotificationDescription.esm.js.map +1 -1
  14. package/dist/components/NotificationsTable/NotificationDescription.esm.js.map +1 -1
  15. package/dist/components/NotificationsTable/NotificationIcon.esm.js.map +1 -1
  16. package/dist/components/NotificationsTable/NotificationsTable.esm.js.map +1 -1
  17. package/dist/components/NotificationsTable/NotificationsTable.module.css.esm.js.map +1 -1
  18. package/dist/components/NotificationsTable/SelectAll.esm.js.map +1 -1
  19. package/dist/components/NotificationsTable/SelectAll.module.css.esm.js.map +1 -1
  20. package/dist/components/NotificationsTable/SeverityIcon.esm.js.map +1 -1
  21. package/dist/components/NotificationsTable/SeverityIcon.module.css.esm.js.map +1 -1
  22. package/dist/components/UnreadNotificationsCard/UnreadNotificationsCard.esm.js.map +1 -1
  23. package/dist/components/UnreadNotificationsCard/UnreadNotificationsCard.module.css.esm.js.map +1 -1
  24. package/dist/components/UserNotificationSettingsCard/NoBorderTableCell.esm.js.map +1 -1
  25. package/dist/components/UserNotificationSettingsCard/NoBorderTableCell.module.css.esm.js.map +1 -1
  26. package/dist/components/UserNotificationSettingsCard/NotificationFormatContext.esm.js.map +1 -1
  27. package/dist/components/UserNotificationSettingsCard/OriginRow.esm.js.map +1 -1
  28. package/dist/components/UserNotificationSettingsCard/TopicRow.esm.js.map +1 -1
  29. package/dist/components/UserNotificationSettingsCard/UserNotificationSettingsCard.esm.js.map +1 -1
  30. package/dist/components/UserNotificationSettingsCard/UserNotificationSettingsPanel.esm.js.map +1 -1
  31. package/dist/components/UserNotificationSettingsCard/UserNotificationSettingsPanel.module.css.esm.js.map +1 -1
  32. package/dist/hooks/useNotificationsApi.esm.js.map +1 -1
  33. package/dist/hooks/useNotificationsRefresh.esm.js.map +1 -1
  34. package/dist/hooks/useTitleCounter.esm.js.map +1 -1
  35. package/dist/hooks/useWebNotifications.esm.js.map +1 -1
  36. package/dist/node_modules_dist/style-inject/dist/style-inject.es.esm.js.map +1 -1
  37. package/dist/plugin.esm.js.map +1 -1
  38. package/dist/plugins/notifications/package.json.esm.js +1 -1
  39. package/dist/plugins/notifications/package.json.esm.js.map +1 -1
  40. package/dist/routes.esm.js.map +1 -1
  41. package/dist/translation.esm.js.map +1 -1
  42. package/dist/utils/notificationLinks.esm.js.map +1 -1
  43. package/dist/utils/plainText.esm.js.map +1 -1
  44. package/package.json +14 -14
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @backstage/plugin-notifications
2
2
 
3
+ ## 0.6.1-next.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+ - @backstage/errors@1.3.2-next.0
9
+ - @backstage/core-components@0.18.15-next.0
10
+ - @backstage/core-plugin-api@1.12.11-next.0
11
+ - @backstage/frontend-plugin-api@0.18.2-next.0
12
+ - @backstage/plugin-notifications-common@0.2.5-next.0
13
+ - @backstage/plugin-home-react@0.1.43-next.0
14
+ - @backstage/plugin-signals-react@0.0.27-next.0
15
+
3
16
  ## 0.6.0
4
17
 
5
18
  ### Minor Changes
@@ -1 +1 @@
1
- {"version":3,"file":"unreadNotificationsHomeWidget.esm.js","sources":["../../../src/alpha/extensions/unreadNotificationsHomeWidget.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 { type RendererProps } from '@backstage/plugin-home-react';\nimport { HomePageWidgetBlueprint } from '@backstage/plugin-home-react/alpha';\n\nconst defaultCardLayout = {\n width: {\n minColumns: 4,\n maxColumns: 12,\n defaultColumns: 6,\n },\n height: {\n minRows: 5,\n maxRows: 14,\n defaultRows: 10,\n },\n} as const;\n\nfunction BorderlessHomeWidgetRenderer({ Content }: RendererProps) {\n return <Content />;\n}\n\n/**\n * NFS home page widget for unread notifications.\n *\n * @alpha\n */\nexport const unreadNotificationsHomeWidget = HomePageWidgetBlueprint.make({\n name: 'unread-notifications',\n params: {\n name: 'UnreadNotifications',\n description: 'Shows the latest unread notifications',\n layout: defaultCardLayout,\n componentProps: {\n Renderer: BorderlessHomeWidgetRenderer,\n },\n components: () =>\n import('../../components/UnreadNotificationsCard').then(m => ({\n Content: m.UnreadNotificationsCardWithProvider,\n })),\n settings: {\n schema: {\n title: 'Unread notifications',\n type: 'object',\n properties: {\n maxMessages: {\n title: 'Maximum messages',\n type: 'number',\n default: 5,\n minimum: 1,\n maximum: 20,\n },\n charLimit: {\n title: 'Title character limit',\n type: 'number',\n default: 80,\n minimum: 20,\n maximum: 200,\n },\n },\n },\n },\n },\n});\n"],"names":[],"mappings":";;;AAmBA,MAAM,iBAAA,GAAoB;AAAA,EACxB,KAAA,EA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file":"unreadNotificationsHomeWidget.esm.js","sources":["../../../src/alpha/extensions/unreadNotificationsHomeWidget.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 { type RendererProps } from '@backstage/plugin-home-react';\nimport { HomePageWidgetBlueprint } from '@backstage/plugin-home-react/alpha';\n\nconst defaultCardLayout = {\n width: {\n minColumns: 4,\n maxColumns: 12,\n defaultColumns: 6,\n },\n height: {\n minRows: 5,\n maxRows: 14,\n defaultRows: 10,\n },\n} as const;\n\nfunction BorderlessHomeWidgetRenderer({ Content }: RendererProps) {\n return <Content />;\n}\n\n/**\n * NFS home page widget for unread notifications.\n *\n * @alpha\n */\nexport const unreadNotificationsHomeWidget = HomePageWidgetBlueprint.make({\n name: 'unread-notifications',\n params: {\n name: 'UnreadNotifications',\n description: 'Shows the latest unread notifications',\n layout: defaultCardLayout,\n componentProps: {\n Renderer: BorderlessHomeWidgetRenderer,\n },\n components: () =>\n import('../../components/UnreadNotificationsCard').then(m => ({\n Content: m.UnreadNotificationsCardWithProvider,\n })),\n settings: {\n schema: {\n title: 'Unread notifications',\n type: 'object',\n properties: {\n maxMessages: {\n title: 'Maximum messages',\n type: 'number',\n default: 5,\n minimum: 1,\n maximum: 20,\n },\n charLimit: {\n title: 'Title character limit',\n type: 'number',\n default: 80,\n minimum: 20,\n maximum: 200,\n },\n },\n },\n },\n },\n});\n"],"names":[],"mappings":";;;AAmBA,MAAM,iBAAA,GAAoB;AAAA,EACxB,KAAA,EAAO;AAAA,IACL,UAAA,EAAY,CAAA;AAAA,IACZ,UAAA,EAAY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/*\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 {\n ApiBlueprint,\n PageBlueprint,\n createFrontendPlugin,\n discoveryApiRef,\n fetchApiRef,\n} from '@backstage/frontend-plugin-api';\nimport { RiNotification3Line } from '@remixicon/react';\nimport { rootRouteRef } from './routes';\nimport { NotificationsClient, notificationsApiRef } from './api';\nimport { unreadNotificationsHomeWidget } from './alpha/extensions/unreadNotificationsHomeWidget';\n\nconst page = PageBlueprint.make({\n params: {\n path: '/notifications',\n routeRef: rootRouteRef,\n loader: () =>\n import('./components/NotificationsPage').then(m => (\n <m.NfsNotificationsPage />\n )),\n },\n});\n\nconst api = ApiBlueprint.make({\n params: defineParams =>\n defineParams({\n api: notificationsApiRef,\n deps: { discoveryApi: discoveryApiRef, fetchApi: fetchApiRef },\n factory: ({ discoveryApi, fetchApi }) =>\n new NotificationsClient({ discoveryApi, fetchApi }),\n }),\n});\n\n/** @alpha */\nexport default createFrontendPlugin({\n pluginId: 'notifications',\n title: 'Notifications',\n icon: <RiNotification3Line />,\n info: { packageJson: () => import('../package.json') },\n routes: {\n root: rootRouteRef,\n },\n // TODO(Rugvip): Nav item (i.e. NotificationsSidebarItem) currently needs to be installed manually\n extensions: [page, api, unreadNotificationsHomeWidget],\n});\n\nimport { notificationsTranslationRef as _notificationsTranslationRef } from './translation';\n\n/**\n * @alpha\n * @deprecated Import from `@backstage/plugin-notifications` instead.\n */\nexport const notificationsTranslationRef = _notificationsTranslationRef;\n"],"names":["_notificationsTranslationRef"],"mappings":";;;;;;;;;AA4BA,MAAM,IAAA,GAAO,cAAc,IAAA,CAAK;AAAA,EAC9B,MAAA,EAAQ;AAAA,IACN,IAAA,EAAM,gBAAA;AAAA,IACN,QAAA,EAAU,YAAA;AAAA,IACV,MAAA,EAAQ,MACN,OAAO,6CAAgC,CAAA,CAAE,IAAA,CAAK,CAAA,CAAA,qBAC5C,GAAA,CAAC,CAAA,CAAE,oBAAA,EAAF,EAAuB,CACzB;AAAA;AAEP,CAAC,CAAA;AAED,MAAM,GAAA,GAAM,aAAa,IAAA,CAAK;AAAA,EAC5B,MAAA,EAAQ,kBACN,YAAA,CAAa;AAAA,IACX,GAAA,EAAK,mBAAA;AAAA,IACL,IAAA,EAAM,EAAE,YAAA,EAAc,eAAA,EAAiB,UAAU,WAAA,EAAY;AAAA,IAC7D,OAAA,EAAS,CAAC,EAAE,YAAA,EAAc,QAAA,EAAS,KACjC,IAAI,mBAAA,CAAoB,EAAE,YAAA,EAAc,QAAA,EAAU;AAAA,GACrD;AACL,CAAC,CAAA;AAGD,YAAe,oBAAA,CAAqB;AAAA,EAClC,QAAA,EAAU,eAAA;AAAA,EACV,KAAA,EAAO,eAAA;AAAA,EACP,IAAA,sBAAO,mBAAA,EAAA,EAAoB,CAAA;AAAA,EAC3B,MAAM,EAAE,WAAA,EAAa,MAAM,OAAO,6CAAiB,CAAA,EAAE;AAAA,EACrD,MAAA,EAAQ;AAAA,IACN,IAAA,EAAM;AAAA,GACR;AAAA;AAAA,EAEA,UAAA,EAAY,CAAC,IAAA,EAAM,GAAA,EAAK,6BAA6B;AACvD,CAAC,CAAA;AAQM,MAAM,2BAAA,GAA8BA;;;;"}
1
+ {"version":3,"file":"alpha.esm.js","sources":["../src/alpha.tsx"],"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 {\n ApiBlueprint,\n PageBlueprint,\n createFrontendPlugin,\n discoveryApiRef,\n fetchApiRef,\n} from '@backstage/frontend-plugin-api';\nimport { RiNotification3Line } from '@remixicon/react';\nimport { rootRouteRef } from './routes';\nimport { NotificationsClient, notificationsApiRef } from './api';\nimport { unreadNotificationsHomeWidget } from './alpha/extensions/unreadNotificationsHomeWidget';\n\nconst page = PageBlueprint.make({\n params: {\n path: '/notifications',\n routeRef: rootRouteRef,\n loader: () =>\n import('./components/NotificationsPage').then(m => (\n <m.NfsNotificationsPage />\n )),\n },\n});\n\nconst api = ApiBlueprint.make({\n params: defineParams =>\n defineParams({\n api: notificationsApiRef,\n deps: { discoveryApi: discoveryApiRef, fetchApi: fetchApiRef },\n factory: ({ discoveryApi, fetchApi }) =>\n new NotificationsClient({ discoveryApi, fetchApi }),\n }),\n});\n\n/** @alpha */\nexport default createFrontendPlugin({\n pluginId: 'notifications',\n title: 'Notifications',\n icon: <RiNotification3Line />,\n info: { packageJson: () => import('../package.json') },\n routes: {\n root: rootRouteRef,\n },\n // TODO(Rugvip): Nav item (i.e. NotificationsSidebarItem) currently needs to be installed manually\n extensions: [page, api, unreadNotificationsHomeWidget],\n});\n\nimport { notificationsTranslationRef as _notificationsTranslationRef } from './translation';\n\n/**\n * @alpha\n * @deprecated Import from `@backstage/plugin-notifications` instead.\n */\nexport const notificationsTranslationRef = _notificationsTranslationRef;\n"],"names":["_notificationsTranslationRef"],"mappings":";;;;;;;;;AA4BA,MAAM,IAAA,GAAO,cAAc,IAAA,CAAK;AAAA,EAC9B,MAAA,EAAQ;AAAA,IACN,IAAA,EAAM,gBAAA;AAAA,IACN,QAAA,EAAU,YAAA;AAAA,IACV,MAAA,EAAQ,MACN,OAAO,6CAAgC,CAAA,CAAE,IAAA,CAAK,CAAA,CAAA,qBAC5C,GAAA,CAAC,CAAA,CAAE,oBAAA,EAAF,EAAuB,CACzB;AAAA;AAEP,CAAC,CAAA;AAED,MAAM,GAAA,GAAM,aAAa,IAAA,CAAK;AAAA,EAC5B,MAAA,EAAQ,kBACN,YAAA,CAAa;AAAA,IACX,GAAA,EAAK,mBAAA;AAAA,IACL,IAAA,EAAM,EAAE,YAAA,EAAc,eAAA,EAAiB,UAAU,WAAA,EAAY;AAAA,IAC7D,OAAA,EAAS,CAAC,EAAE,YAAA,EAAc,QAAA,EAAS,KACjC,IAAI,mBAAA,CAAoB,EAAE,YAAA,EAAc,QAAA,EAAU;AAAA,GACrD;AACL,CAAC,CAAA;AAGD,YAAe,oBAAA,CAAqB;AAAA,EAClC,QAAA,EAAU,eAAA;AAAA,EACV,KAAA,EAAO,eAAA;AAAA,EACP,IAAA,sBAAO,mBAAA,EAAA,EAAoB,CAAA;AAAA,EAC3B,MAAM,EAAE,WAAA,EAAa,MAAM,OAAO,6CAAiB,CAAA,EAAE;AAAA,EACrD,MAAA,EAAQ;AAAA,IACN,IAAA,EAAM;AAAA,GACR;AAAA;AAAA,EAEA,UAAA,EAAY,CAAC,IAAA,EAAM,GAAA,EAAK,6BAA6B;AACvD,CAAC,CAAA;AAQM,MAAM,2BAAA,GAA8BA;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationsApi.esm.js","sources":["../../src/api/NotificationsApi.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 { createApiRef } from '@backstage/core-plugin-api';\nimport {\n Notification,\n NotificationSettings,\n NotificationSeverity,\n NotificationStatus,\n} from '@backstage/plugin-notifications-common';\n\n/** @public */\nexport const notificationsApiRef = createApiRef<NotificationsApi>({\n id: 'plugin.notifications.service',\n});\n\n/** @public */\nexport type GetNotificationsCommonOptions = {\n search?: string;\n read?: boolean;\n saved?: boolean;\n createdAfter?: Date;\n minimumSeverity?: NotificationSeverity;\n};\n\n/** @public */\nexport type GetNotificationsOptions = GetNotificationsCommonOptions & {\n offset?: number;\n limit?: number;\n sort?: 'created' | 'topic' | 'origin';\n sortOrder?: 'asc' | 'desc';\n topic?: string;\n};\n\n/** @public */\nexport type GetTopicsOptions = GetNotificationsCommonOptions;\n\n/** @public */\nexport type UpdateNotificationsOptions = {\n ids: string[];\n read?: boolean;\n saved?: boolean;\n};\n\n/** @public */\nexport type GetNotificationsResponse = {\n notifications: Notification[];\n totalCount: number;\n};\n\n/** @public */\nexport type GetTopicsResponse = {\n topics: string[];\n};\n\n/** @public */\nexport interface NotificationsApi {\n getNotifications(\n options?: GetNotificationsOptions,\n ): Promise<GetNotificationsResponse>;\n\n getNotification(id: string): Promise<Notification>;\n\n getStatus(): Promise<NotificationStatus>;\n\n updateNotifications(\n options: UpdateNotificationsOptions,\n ): Promise<Notification[]>;\n\n getNotificationSettings(): Promise<NotificationSettings>;\n\n updateNotificationSettings(\n settings: NotificationSettings,\n ): Promise<NotificationSettings>;\n\n getTopics(options?: GetTopicsOptions): Promise<GetTopicsResponse>;\n}\n"],"names":[],"mappings":";;AAwBO,MAAM,sBAAsB,YAAA,CAA+B;AAAA,EAChE,EAAA,EAAI;AACN,CAAC;;;;"}
1
+ {"version":3,"file":"NotificationsApi.esm.js","sources":["../../src/api/NotificationsApi.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 { createApiRef } from '@backstage/core-plugin-api';\nimport {\n Notification,\n NotificationSettings,\n NotificationSeverity,\n NotificationStatus,\n} from '@backstage/plugin-notifications-common';\n\n/** @public */\nexport const notificationsApiRef = createApiRef<NotificationsApi>({\n id: 'plugin.notifications.service',\n});\n\n/** @public */\nexport type GetNotificationsCommonOptions = {\n search?: string;\n read?: boolean;\n saved?: boolean;\n createdAfter?: Date;\n minimumSeverity?: NotificationSeverity;\n};\n\n/** @public */\nexport type GetNotificationsOptions = GetNotificationsCommonOptions & {\n offset?: number;\n limit?: number;\n sort?: 'created' | 'topic' | 'origin';\n sortOrder?: 'asc' | 'desc';\n topic?: string;\n};\n\n/** @public */\nexport type GetTopicsOptions = GetNotificationsCommonOptions;\n\n/** @public */\nexport type UpdateNotificationsOptions = {\n ids: string[];\n read?: boolean;\n saved?: boolean;\n};\n\n/** @public */\nexport type GetNotificationsResponse = {\n notifications: Notification[];\n totalCount: number;\n};\n\n/** @public */\nexport type GetTopicsResponse = {\n topics: string[];\n};\n\n/** @public */\nexport interface NotificationsApi {\n getNotifications(\n options?: GetNotificationsOptions,\n ): Promise<GetNotificationsResponse>;\n\n getNotification(id: string): Promise<Notification>;\n\n getStatus(): Promise<NotificationStatus>;\n\n updateNotifications(\n options: UpdateNotificationsOptions,\n ): Promise<Notification[]>;\n\n getNotificationSettings(): Promise<NotificationSettings>;\n\n updateNotificationSettings(\n settings: NotificationSettings,\n ): Promise<NotificationSettings>;\n\n getTopics(options?: GetTopicsOptions): Promise<GetTopicsResponse>;\n}\n"],"names":[],"mappings":";;AAwBO,MAAM,sBAAsB,YAAA,CAA+B;AAAA,EAChE,EAAA,EAAI;AACN,CAAC;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationsClient.esm.js","sources":["../../src/api/NotificationsClient.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 GetNotificationsCommonOptions,\n GetNotificationsOptions,\n GetNotificationsResponse,\n GetTopicsOptions,\n GetTopicsResponse,\n NotificationsApi,\n UpdateNotificationsOptions,\n} from './NotificationsApi';\nimport { DiscoveryApi, FetchApi } from '@backstage/core-plugin-api';\nimport { ResponseError } from '@backstage/errors';\nimport {\n Notification,\n NotificationSettings,\n NotificationStatus,\n} from '@backstage/plugin-notifications-common';\n\n/** @public */\nexport class NotificationsClient implements NotificationsApi {\n private readonly discoveryApi: DiscoveryApi;\n private readonly fetchApi: FetchApi;\n\n public constructor(options: {\n discoveryApi: DiscoveryApi;\n fetchApi: FetchApi;\n }) {\n this.discoveryApi = options.discoveryApi;\n this.fetchApi = options.fetchApi;\n }\n\n async getNotifications(\n options?: GetNotificationsOptions,\n ): Promise<GetNotificationsResponse> {\n const queryString = new URLSearchParams();\n if (options?.limit !== undefined) {\n queryString.append('limit', options.limit.toString(10));\n }\n if (options?.offset !== undefined) {\n queryString.append('offset', options.offset.toString(10));\n }\n if (options?.sort !== undefined) {\n queryString.append(\n 'orderField',\n `${options.sort},${options?.sortOrder ?? 'desc'}`,\n );\n }\n\n this.appendCommonQueryStrings(queryString, options);\n\n if (options?.topic !== undefined) {\n queryString.append('topic', options.topic);\n }\n\n return await this.request<GetNotificationsResponse>(\n `/notifications?${queryString}`,\n );\n }\n\n async getNotification(id: string): Promise<Notification> {\n return await this.request<Notification>(\n `/notifications/${encodeURIComponent(id)}`,\n );\n }\n\n async getStatus(): Promise<NotificationStatus> {\n return await this.request<NotificationStatus>('/status');\n }\n\n async updateNotifications(\n options: UpdateNotificationsOptions,\n ): Promise<Notification[]> {\n return await this.request<Notification[]>('/notifications/update', {\n method: 'POST',\n body: JSON.stringify(options),\n headers: { 'Content-Type': 'application/json' },\n });\n }\n\n async getNotificationSettings(): Promise<NotificationSettings> {\n return await this.request<NotificationSettings>('/settings');\n }\n\n async updateNotificationSettings(\n settings: NotificationSettings,\n ): Promise<NotificationSettings> {\n return await this.request<NotificationSettings>('/settings', {\n method: 'POST',\n body: JSON.stringify(settings),\n headers: { 'Content-Type': 'application/json' },\n });\n }\n\n async getTopics(options?: GetTopicsOptions): Promise<GetTopicsResponse> {\n const queryString = new URLSearchParams();\n this.appendCommonQueryStrings(queryString, options);\n\n return await this.request<GetTopicsResponse>(`/topics?${queryString}`);\n }\n\n private appendCommonQueryStrings(\n queryString: URLSearchParams,\n options?: GetNotificationsCommonOptions,\n ) {\n if (options?.search) {\n queryString.append('search', options.search);\n }\n if (options?.read !== undefined) {\n queryString.append('read', options.read ? 'true' : 'false');\n }\n if (options?.saved !== undefined) {\n queryString.append('saved', options.saved ? 'true' : 'false');\n }\n if (options?.createdAfter !== undefined) {\n queryString.append('createdAfter', options.createdAfter.toISOString());\n }\n if (options?.minimumSeverity !== undefined) {\n queryString.append('minimumSeverity', options.minimumSeverity);\n }\n }\n\n private async request<T>(path: string, init?: RequestInit): Promise<T> {\n const baseUrl = await this.discoveryApi.getBaseUrl('notifications');\n const res = await this.fetchApi.fetch(`${baseUrl}${path}`, init);\n\n if (!res.ok) {\n throw await ResponseError.fromResponse(res);\n }\n\n return res.json() as Promise<T>;\n }\n}\n"],"names":[],"mappings":";;AAiCO,MAAM,mBAAA,CAAgD;AAAA,EAC1C,YAAA;AAAA,EACA,QAAA;AAAA,EAEV,YAAY,OAAA,EAGhB;AACD,IAAA,IAAA,CAAK,eAAe,OAAA,CAAQ,YAAA;AAC5B,IAAA,IAAA,CAAK,WAAW,OAAA,CAAQ,QAAA;AAAA,EAC1B;AAAA,EAEA,MAAM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,EAAS,OAAA,CAAQ,KAAA,GAAQ,SAAS,OAAO,CAAA;AAAA,IAC9D;AACA,IAAA,IAAI,OAAA,EAAS,iBAAiB,MAAA,EAAW;AACvC,MAAA,WAAA,CAAY,MAAA,CAAO,cAAA,EAAgB,OAAA,CAAQ,YAAA,CAAa,aAAa,CAAA;AAAA,IACvE;AACA,IAAA,IAAI,OAAA,EAAS,oBAAoB,MAAA,EAAW;AAC1C,MAAA,WAAA,CAAY,MAAA,CAAO,iBAAA,EAAmB,OAAA,CAAQ,eAAe,CAAA;AAAA,IAC/D;AAAA,EACF;AAAA,EAEA,MAAc,OAAA,CAAW,IAAA,EAAc,IAAA,EAAgC;AACrE,IAAA,MAAM,OAAA,GAAU,MAAM,IAAA,CAAK,YAAA,CAAa,WAAW,eAAe,CAAA;AAClE,IAAA,MAAM,GAAA,GAAM,MAAM,IAAA,CAAK,QAAA,CAAS,KAAA,CAAM,GAAG,OAAO,CAAA,EAAG,IAAI,CAAA,CAAA,EAAI,IAAI,CAAA;AAE/D,IAAA,IAAI,CAAC,IAAI,EAAA,EAAI;AACX,MAAA,MAAM,MAAM,aAAA,CAAc,YAAA,CAAa,GAAG,CAAA;AAAA,IAC5C;AAEA,IAAA,OAAO,IAAI,IAAA,EAAK;AAAA,EAClB;AACF;;;;"}
1
+ {"version":3,"file":"NotificationsClient.esm.js","sources":["../../src/api/NotificationsClient.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 GetNotificationsCommonOptions,\n GetNotificationsOptions,\n GetNotificationsResponse,\n GetTopicsOptions,\n GetTopicsResponse,\n NotificationsApi,\n UpdateNotificationsOptions,\n} from './NotificationsApi';\nimport { DiscoveryApi, FetchApi } from '@backstage/core-plugin-api';\nimport { ResponseError } from '@backstage/errors';\nimport {\n Notification,\n NotificationSettings,\n NotificationStatus,\n} from '@backstage/plugin-notifications-common';\n\n/** @public */\nexport class NotificationsClient implements NotificationsApi {\n private readonly discoveryApi: DiscoveryApi;\n private readonly fetchApi: FetchApi;\n\n public constructor(options: {\n discoveryApi: DiscoveryApi;\n fetchApi: FetchApi;\n }) {\n this.discoveryApi = options.discoveryApi;\n this.fetchApi = options.fetchApi;\n }\n\n async getNotifications(\n options?: GetNotificationsOptions,\n ): Promise<GetNotificationsResponse> {\n const queryString = new URLSearchParams();\n if (options?.limit !== undefined) {\n queryString.append('limit', options.limit.toString(10));\n }\n if (options?.offset !== undefined) {\n queryString.append('offset', options.offset.toString(10));\n }\n if (options?.sort !== undefined) {\n queryString.append(\n 'orderField',\n `${options.sort},${options?.sortOrder ?? 'desc'}`,\n );\n }\n\n this.appendCommonQueryStrings(queryString, options);\n\n if (options?.topic !== undefined) {\n queryString.append('topic', options.topic);\n }\n\n return await this.request<GetNotificationsResponse>(\n `/notifications?${queryString}`,\n );\n }\n\n async getNotification(id: string): Promise<Notification> {\n return await this.request<Notification>(\n `/notifications/${encodeURIComponent(id)}`,\n );\n }\n\n async getStatus(): Promise<NotificationStatus> {\n return await this.request<NotificationStatus>('/status');\n }\n\n async updateNotifications(\n options: UpdateNotificationsOptions,\n ): Promise<Notification[]> {\n return await this.request<Notification[]>('/notifications/update', {\n method: 'POST',\n body: JSON.stringify(options),\n headers: { 'Content-Type': 'application/json' },\n });\n }\n\n async getNotificationSettings(): Promise<NotificationSettings> {\n return await this.request<NotificationSettings>('/settings');\n }\n\n async updateNotificationSettings(\n settings: NotificationSettings,\n ): Promise<NotificationSettings> {\n return await this.request<NotificationSettings>('/settings', {\n method: 'POST',\n body: JSON.stringify(settings),\n headers: { 'Content-Type': 'application/json' },\n });\n }\n\n async getTopics(options?: GetTopicsOptions): Promise<GetTopicsResponse> {\n const queryString = new URLSearchParams();\n this.appendCommonQueryStrings(queryString, options);\n\n return await this.request<GetTopicsResponse>(`/topics?${queryString}`);\n }\n\n private appendCommonQueryStrings(\n queryString: URLSearchParams,\n options?: GetNotificationsCommonOptions,\n ) {\n if (options?.search) {\n queryString.append('search', options.search);\n }\n if (options?.read !== undefined) {\n queryString.append('read', options.read ? 'true' : 'false');\n }\n if (options?.saved !== undefined) {\n queryString.append('saved', options.saved ? 'true' : 'false');\n }\n if (options?.createdAfter !== undefined) {\n queryString.append('createdAfter', options.createdAfter.toISOString());\n }\n if (options?.minimumSeverity !== undefined) {\n queryString.append('minimumSeverity', options.minimumSeverity);\n }\n }\n\n private async request<T>(path: string, init?: RequestInit): Promise<T> {\n const baseUrl = await this.discoveryApi.getBaseUrl('notifications');\n const res = await this.fetchApi.fetch(`${baseUrl}${path}`, init);\n\n if (!res.ok) {\n throw await ResponseError.fromResponse(res);\n }\n\n return res.json() as Promise<T>;\n }\n}\n"],"names":[],"mappings":";;AAiCO,MAAM,mBAAA,CAAgD;AAAA,EAC1C,YAAA;AAAA,EACA,QAAA;AAAA,EAEV,YAAY,OAAA,EAGhB;AACD,IAAA,IAAA,CAAK,eAAe,OAAA,CAAQ,YAAA;AAC5B,IAAA,IAAA,CAAK,WAAW,OAAA,CAAQ,QAAA;AAAA,EAC1B;AAAA,EAEA,MAAM,iBACJ,OAAA,EACmC;AACnC,IAAA,MAAM,WAAA,GAAc,IAAI,eAAA,EAAgB;AACxC,IAAA,IAAI,OAAA,EAAS,UAAU,MAAA,EAAW;AAChC,MAAA,WAAA,CAAY,OAAO,OAAA,EAAS,OAAA,CAAQ,KAAA,CAAM,QAAA,CAAS,EAAE,CAAC,CAAA;AAAA,IACxD;AACA,IAAA,IAAI,OAAA,EAAS,WAAW,MAAA,EAAW;AACjC,MAAA,WAAA,CAAY,OAAO,QAAA,EAAU,OAAA,CAAQ,MAAA,CA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;AAAA,IAC/D;AAAA,EACF;AAAA,EAEA,MAAc,OAAA,CAAW,IAAA,EAAc,IAAA,EAAgC;AACrE,IAAA,MAAM,OAAA,GAAU,MAAM,IAAA,CAAK,YAAA,CAAa,WAAW,eAAe,CAAA;AAClE,IAAA,MAAM,GAAA,GAAM,MAAM,IAAA,CAAK,QAAA,CAAS,KAAA,CAAM,GAAG,OAAO,CAAA,EAAG,IAAI,CAAA,CAAA,EAAI,IAAI,CAAA;AAE/D,IAAA,IAAI,CAAC,IAAI,EAAA,EAAI;AACX,MAAA,MAAM,MAAM,aAAA,CAAc,YAAA,CAAa,GAAG,CAAA;AAAA,IAC5C;AAEA,IAAA,OAAO,IAAI,IAAA,EAAK;AAAA,EAClB;AACF;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationsFilters.esm.js","sources":["../../../src/components/NotificationsFilters/NotificationsFilters.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 { Select, Text, Flex } from '@backstage/ui';\nimport type { Key } from 'react-aria-components';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { notificationsTranslationRef } from '../../translation';\nimport { GetNotificationsOptions } from '../../api';\nimport { NotificationSeverity } from '@backstage/plugin-notifications-common';\n\nexport type SortBy = Required<\n Pick<GetNotificationsOptions, 'sort' | 'sortOrder'>\n>;\n\nexport type NotificationsFiltersProps = {\n unreadOnly?: boolean;\n onUnreadOnlyChanged: (checked: boolean | undefined) => void;\n createdAfter?: string;\n onCreatedAfterChanged: (value: string) => void;\n sorting: SortBy;\n onSortingChanged: (sortBy: SortBy) => void;\n saved?: boolean;\n onSavedChanged: (checked: boolean | undefined) => void;\n severity: NotificationSeverity;\n onSeverityChanged: (severity: NotificationSeverity) => void;\n topic?: string;\n onTopicChanged: (value: string | undefined) => void;\n allTopics?: string[];\n};\n\nconst ALL = '___all___';\n\ntype TranslationKey = keyof (typeof notificationsTranslationRef)['T'];\n\nexport const CreatedAfterOptions = {\n last24h: {\n labelKey: 'filters.createdAfter.last24h' satisfies TranslationKey,\n getDate: () => new Date(Date.now() - 24 * 3600 * 1000),\n },\n lastWeek: {\n labelKey: 'filters.createdAfter.lastWeek' satisfies TranslationKey,\n getDate: () => new Date(Date.now() - 7 * 24 * 3600 * 1000),\n },\n all: {\n labelKey: 'filters.createdAfter.anyTime' satisfies TranslationKey,\n getDate: () => new Date(0),\n },\n} as const;\n\nexport const SortByOptions = {\n newest: {\n labelKey: 'filters.sortBy.newest' satisfies TranslationKey,\n sortBy: {\n sort: 'created' as const,\n sortOrder: 'desc' as const,\n },\n },\n oldest: {\n labelKey: 'filters.sortBy.oldest' satisfies TranslationKey,\n sortBy: {\n sort: 'created' as const,\n sortOrder: 'asc' as const,\n },\n },\n topic: {\n labelKey: 'filters.sortBy.topic' satisfies TranslationKey,\n sortBy: {\n sort: 'topic' as const,\n sortOrder: 'asc' as const,\n },\n },\n origin: {\n labelKey: 'filters.sortBy.origin' satisfies TranslationKey,\n sortBy: {\n sort: 'origin' as const,\n sortOrder: 'asc' as const,\n },\n },\n} as const;\n\nconst getSortByText = (sortBy?: SortBy): string => {\n if (sortBy?.sort === 'created' && sortBy?.sortOrder === 'asc') {\n return 'oldest';\n }\n if (sortBy?.sort === 'topic') {\n return 'topic';\n }\n if (sortBy?.sort === 'origin') {\n return 'origin';\n }\n\n return 'newest';\n};\n\nexport const NotificationsFilters = ({\n sorting,\n onSortingChanged,\n unreadOnly,\n onUnreadOnlyChanged,\n createdAfter,\n onCreatedAfterChanged,\n saved,\n onSavedChanged,\n severity,\n onSeverityChanged,\n topic,\n onTopicChanged,\n allTopics,\n}: NotificationsFiltersProps) => {\n const { t } = useTranslationRef(notificationsTranslationRef);\n const sortByText = getSortByText(sorting);\n\n const handleOnCreatedAfterChanged = (key: Key | Key[] | null) => {\n if (key !== null && !Array.isArray(key))\n onCreatedAfterChanged(key as string);\n };\n\n const handleOnViewChanged = (key: Key | Key[] | null) => {\n const value = Array.isArray(key) ? key[0] : key;\n if (value === 'unread') {\n onUnreadOnlyChanged(true);\n onSavedChanged(undefined);\n } else if (value === 'read') {\n onUnreadOnlyChanged(false);\n onSavedChanged(undefined);\n } else if (value === 'saved') {\n onUnreadOnlyChanged(undefined);\n onSavedChanged(true);\n } else {\n // All\n onUnreadOnlyChanged(undefined);\n onSavedChanged(undefined);\n }\n };\n\n const handleOnSortByChanged = (key: Key | Key[] | null) => {\n const idx = (((Array.isArray(key) ? key[0] : key) as string) ||\n 'newest') as keyof typeof SortByOptions;\n const option = SortByOptions[idx];\n onSortingChanged({ ...option.sortBy });\n };\n\n let viewValue = 'all';\n if (saved) {\n viewValue = 'saved';\n } else if (unreadOnly) {\n viewValue = 'unread';\n } else if (unreadOnly === false) {\n viewValue = 'read';\n }\n\n const handleOnSeverityChanged = (key: Key | Key[] | null) => {\n const value: NotificationSeverity =\n ((Array.isArray(key) ? key[0] : key) as NotificationSeverity) || 'normal';\n onSeverityChanged(value);\n };\n\n const handleOnTopicChanged = (key: Key | Key[] | null) => {\n const value = (Array.isArray(key) ? key[0] : key) as string;\n onTopicChanged(value === ALL ? undefined : value);\n };\n\n const sortedAllTopics = [...(allTopics ?? [])].sort((a, b) =>\n a.localeCompare(b),\n );\n\n return (\n <Flex direction=\"column\" gap=\"4\">\n <div>\n <Text variant=\"title-x-small\">{t('filters.title')}</Text>\n </div>\n\n <Select\n label={t('filters.view.label')}\n value={viewValue}\n onChange={handleOnViewChanged}\n options={[\n { value: 'unread', label: t('filters.view.unread') },\n { value: 'read', label: t('filters.view.read') },\n { value: 'saved', label: t('filters.view.saved') },\n { value: 'all', label: t('filters.view.all') },\n ]}\n />\n\n <Select\n label={t('filters.createdAfter.label')}\n value={createdAfter}\n onChange={handleOnCreatedAfterChanged}\n options={Object.keys(CreatedAfterOptions).map((key: string) => ({\n value: key,\n label: t(\n CreatedAfterOptions[key as keyof typeof CreatedAfterOptions]\n .labelKey,\n ),\n }))}\n />\n\n <Select\n label={t('filters.sortBy.label')}\n value={sortByText}\n onChange={handleOnSortByChanged}\n options={Object.keys(SortByOptions).map((key: string) => ({\n value: key,\n label: t(SortByOptions[key as keyof typeof SortByOptions].labelKey),\n }))}\n />\n\n <Select\n label={t('filters.severity.label')}\n value={severity}\n onChange={handleOnSeverityChanged}\n options={(\n ['critical', 'high', 'normal', 'low'] as NotificationSeverity[]\n ).map(key => ({\n value: key,\n label: t(`filters.severity.${key}`),\n }))}\n />\n\n <Select\n label={t('filters.topic.label')}\n value={topic ?? ALL}\n onChange={handleOnTopicChanged}\n options={[\n { value: ALL, label: t('filters.topic.anyTopic') },\n ...sortedAllTopics.map((item: string) => ({\n value: item,\n label: item,\n })),\n ]}\n />\n </Flex>\n );\n};\n"],"names":[],"mappings":";;;;;AA0CA,MAAM,GAAA,GAAM,WAAA;AAIL,MAAM,mBAAA,GAAsB;AAAA,EACjC,OAAA,EAAS;AAAA,IACP,QAAA,EAAU,8BAAA;AAAA,IACV,OAAA,EAAS,MAAM,IAAI,IAAA,CAAK,KAAK,GAAA,EAAI,GAAI,EAAA,GAAK,IAAA,GAAO,GAAI;AAAA,GACvD;AAAA,EACA,QAAA,EAAU;AAAA,IACR,QAAA,EAAU,+BAAA;AAAA,IACV,OAAA,EAAS,MAAM,IAAI,IAAA,CAAK,IAAA,CAAK,KAAI,GAAI,CAAA,GAAI,EAAA,GAAK,IAAA,GAAO,GAAI;AAAA,GAC3D;AAAA,EACA,GAAA,EAAK;AAAA,IACH,QAAA,EAAU,8BAAA;AAAA,IACV,OAAA,EAAS,sBAAM,IAAI,IAAA,CAAK,CAAC;AAAA;AAE7B;A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,oBAEA,GAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,KAAA,EAAO,EAAE,wBAAwB,CAAA;AAAA,QACjC,KAAA,EAAO,QAAA;AAAA,QACP,QAAA,EAAU,uBAAA;AAAA,QACV,OAAA,EACE,CAAC,UAAA,EAAY,MAAA,EAAQ,UAAU,KAAK,CAAA,CACpC,IAAI,CAAA,GAAA,MAAQ;AAAA,UACZ,KAAA,EAAO,GAAA;AAAA,UACP,KAAA,EAAO,CAAA,CAAE,CAAA,iBAAA,EAAoB,GAAG,CAAA,CAAE;AAAA,SACpC,CAAE;AAAA;AAAA,KACJ;AAAA,oBAEA,GAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,KAAA,EAAO,EAAE,qBAAqB,CAAA;AAAA,QAC9B,OAAO,KAAA,IAAS,GAAA;AAAA,QAChB,QAAA,EAAU,oBAAA;AAAA,QACV,OAAA,EAAS;AAAA,UACP,EAAE,KAAA,EAAO,GAAA,EAAK,KAAA,EAAO,CAAA,CAAE,wBAAwB,CAAA,EAAE;AAAA,UACjD,GAAG,eAAA,CAAgB,GAAA,CAAI,CAAC,IAAA,MAAkB;AAAA,YACxC,KAAA,EAAO,IAAA;AAAA,YACP,KAAA,EAAO;AAAA,WACT,CAAE;AAAA;AACJ;AAAA;AACF,GAAA,EACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"NotificationsFilters.esm.js","sources":["../../../src/components/NotificationsFilters/NotificationsFilters.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 { Select, Text, Flex } from '@backstage/ui';\nimport type { Key } from 'react-aria-components';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { notificationsTranslationRef } from '../../translation';\nimport { GetNotificationsOptions } from '../../api';\nimport { NotificationSeverity } from '@backstage/plugin-notifications-common';\n\nexport type SortBy = Required<\n Pick<GetNotificationsOptions, 'sort' | 'sortOrder'>\n>;\n\nexport type NotificationsFiltersProps = {\n unreadOnly?: boolean;\n onUnreadOnlyChanged: (checked: boolean | undefined) => void;\n createdAfter?: string;\n onCreatedAfterChanged: (value: string) => void;\n sorting: SortBy;\n onSortingChanged: (sortBy: SortBy) => void;\n saved?: boolean;\n onSavedChanged: (checked: boolean | undefined) => void;\n severity: NotificationSeverity;\n onSeverityChanged: (severity: NotificationSeverity) => void;\n topic?: string;\n onTopicChanged: (value: string | undefined) => void;\n allTopics?: string[];\n};\n\nconst ALL = '___all___';\n\ntype TranslationKey = keyof (typeof notificationsTranslationRef)['T'];\n\nexport const CreatedAfterOptions = {\n last24h: {\n labelKey: 'filters.createdAfter.last24h' satisfies TranslationKey,\n getDate: () => new Date(Date.now() - 24 * 3600 * 1000),\n },\n lastWeek: {\n labelKey: 'filters.createdAfter.lastWeek' satisfies TranslationKey,\n getDate: () => new Date(Date.now() - 7 * 24 * 3600 * 1000),\n },\n all: {\n labelKey: 'filters.createdAfter.anyTime' satisfies TranslationKey,\n getDate: () => new Date(0),\n },\n} as const;\n\nexport const SortByOptions = {\n newest: {\n labelKey: 'filters.sortBy.newest' satisfies TranslationKey,\n sortBy: {\n sort: 'created' as const,\n sortOrder: 'desc' as const,\n },\n },\n oldest: {\n labelKey: 'filters.sortBy.oldest' satisfies TranslationKey,\n sortBy: {\n sort: 'created' as const,\n sortOrder: 'asc' as const,\n },\n },\n topic: {\n labelKey: 'filters.sortBy.topic' satisfies TranslationKey,\n sortBy: {\n sort: 'topic' as const,\n sortOrder: 'asc' as const,\n },\n },\n origin: {\n labelKey: 'filters.sortBy.origin' satisfies TranslationKey,\n sortBy: {\n sort: 'origin' as const,\n sortOrder: 'asc' as const,\n },\n },\n} as const;\n\nconst getSortByText = (sortBy?: SortBy): string => {\n if (sortBy?.sort === 'created' && sortBy?.sortOrder === 'asc') {\n return 'oldest';\n }\n if (sortBy?.sort === 'topic') {\n return 'topic';\n }\n if (sortBy?.sort === 'origin') {\n return 'origin';\n }\n\n return 'newest';\n};\n\nexport const NotificationsFilters = ({\n sorting,\n onSortingChanged,\n unreadOnly,\n onUnreadOnlyChanged,\n createdAfter,\n onCreatedAfterChanged,\n saved,\n onSavedChanged,\n severity,\n onSeverityChanged,\n topic,\n onTopicChanged,\n allTopics,\n}: NotificationsFiltersProps) => {\n const { t } = useTranslationRef(notificationsTranslationRef);\n const sortByText = getSortByText(sorting);\n\n const handleOnCreatedAfterChanged = (key: Key | Key[] | null) => {\n if (key !== null && !Array.isArray(key))\n onCreatedAfterChanged(key as string);\n };\n\n const handleOnViewChanged = (key: Key | Key[] | null) => {\n const value = Array.isArray(key) ? key[0] : key;\n if (value === 'unread') {\n onUnreadOnlyChanged(true);\n onSavedChanged(undefined);\n } else if (value === 'read') {\n onUnreadOnlyChanged(false);\n onSavedChanged(undefined);\n } else if (value === 'saved') {\n onUnreadOnlyChanged(undefined);\n onSavedChanged(true);\n } else {\n // All\n onUnreadOnlyChanged(undefined);\n onSavedChanged(undefined);\n }\n };\n\n const handleOnSortByChanged = (key: Key | Key[] | null) => {\n const idx = (((Array.isArray(key) ? key[0] : key) as string) ||\n 'newest') as keyof typeof SortByOptions;\n const option = SortByOptions[idx];\n onSortingChanged({ ...option.sortBy });\n };\n\n let viewValue = 'all';\n if (saved) {\n viewValue = 'saved';\n } else if (unreadOnly) {\n viewValue = 'unread';\n } else if (unreadOnly === false) {\n viewValue = 'read';\n }\n\n const handleOnSeverityChanged = (key: Key | Key[] | null) => {\n const value: NotificationSeverity =\n ((Array.isArray(key) ? key[0] : key) as NotificationSeverity) || 'normal';\n onSeverityChanged(value);\n };\n\n const handleOnTopicChanged = (key: Key | Key[] | null) => {\n const value = (Array.isArray(key) ? key[0] : key) as string;\n onTopicChanged(value === ALL ? undefined : value);\n };\n\n const sortedAllTopics = [...(allTopics ?? [])].sort((a, b) =>\n a.localeCompare(b),\n );\n\n return (\n <Flex direction=\"column\" gap=\"4\">\n <div>\n <Text variant=\"title-x-small\">{t('filters.title')}</Text>\n </div>\n\n <Select\n label={t('filters.view.label')}\n value={viewValue}\n onChange={handleOnViewChanged}\n options={[\n { value: 'unread', label: t('filters.view.unread') },\n { value: 'read', label: t('filters.view.read') },\n { value: 'saved', label: t('filters.view.saved') },\n { value: 'all', label: t('filters.view.all') },\n ]}\n />\n\n <Select\n label={t('filters.createdAfter.label')}\n value={createdAfter}\n onChange={handleOnCreatedAfterChanged}\n options={Object.keys(CreatedAfterOptions).map((key: string) => ({\n value: key,\n label: t(\n CreatedAfterOptions[key as keyof typeof CreatedAfterOptions]\n .labelKey,\n ),\n }))}\n />\n\n <Select\n label={t('filters.sortBy.label')}\n value={sortByText}\n onChange={handleOnSortByChanged}\n options={Object.keys(SortByOptions).map((key: string) => ({\n value: key,\n label: t(SortByOptions[key as keyof typeof SortByOptions].labelKey),\n }))}\n />\n\n <Select\n label={t('filters.severity.label')}\n value={severity}\n onChange={handleOnSeverityChanged}\n options={(\n ['critical', 'high', 'normal', 'low'] as NotificationSeverity[]\n ).map(key => ({\n value: key,\n label: t(`filters.severity.${key}`),\n }))}\n />\n\n <Select\n label={t('filters.topic.label')}\n value={topic ?? ALL}\n onChange={handleOnTopicChanged}\n options={[\n { value: ALL, label: t('filters.topic.anyTopic') },\n ...sortedAllTopics.map((item: string) => ({\n value: item,\n label: item,\n })),\n ]}\n />\n </Flex>\n );\n};\n"],"names":[],"mappings":";;;;;AA0CA,MAAM,GAAA,GAAM,WAAA;AAIL,MAAM,mBAAA,GAAsB;AAAA,EACjC,OAAA,EAAS;AAAA,IACP,QAAA,EAAU,8BAAA;AAAA,IACV,OAAA,EAAS,MAAM,IAAI,IAAA,CAAK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'../../api/NotificationsApi.esm.js';
15
15
  import '@backstage/errors';
16
16
  import '../../routes.esm.js';
17
17
  import '../../hooks/useTitleCounter.esm.js';
18
- import { SortByOptions, NotificationsFilters, CreatedAfterOptions } from '../NotificationsFilters/NotificationsFilters.esm.js';
18
+ import { SortByOptions, CreatedAfterOptions, NotificationsFilters } from '../NotificationsFilters/NotificationsFilters.esm.js';
19
19
 
20
20
  const TableTitleKeys = {
21
21
  all: "notificationsPage.tableTitle.all",
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationsPage.esm.js","sources":["../../../src/components/NotificationsPage/NotificationsPage.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useEffect, useMemo, useState } from 'react';\nimport throttle from 'lodash/throttle';\nimport {\n Content,\n PageWithHeader,\n ResponseErrorPanel,\n} from '@backstage/core-components';\nimport { Grid } from '@backstage/ui';\nimport { useSignal } from '@backstage/plugin-signals-react';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { useSearchParams } from 'react-router-dom';\nimport {\n Notification,\n NotificationSeverity,\n NotificationStatus,\n} from '@backstage/plugin-notifications-common';\nimport { notificationsTranslationRef } from '../../translation';\n\nconst TableTitleKeys = {\n all: 'notificationsPage.tableTitle.all',\n saved: 'notificationsPage.tableTitle.saved',\n unread: 'notificationsPage.tableTitle.unread',\n read: 'notificationsPage.tableTitle.read',\n} as const;\n\nimport { NotificationsTable } from '../NotificationsTable';\nimport { useNotificationsApi } from '../../hooks';\nimport {\n CreatedAfterOptions,\n NotificationsFilters,\n SortBy,\n SortByOptions,\n} from '../NotificationsFilters';\nimport {\n GetNotificationsOptions,\n GetNotificationsResponse,\n GetTopicsResponse,\n} from '../../api';\n\nconst ThrottleDelayMs = 2000;\n\n/** @public */\nexport type NotificationsPageProps = {\n /** Mark notification as read when opening the link it contains, defaults to false */\n markAsReadOnLinkOpen?: boolean;\n title?: string;\n themeId?: string;\n subtitle?: string;\n tooltip?: string;\n type?: string;\n typeLink?: string;\n};\n\nfunction NotificationsPageContent(\n props: NotificationsPageProps & { headerVariant: 'legacy' | 'bui' },\n) {\n const { t } = useTranslationRef(notificationsTranslationRef);\n const {\n title = t('notificationsPage.title'),\n themeId = 'tool',\n subtitle,\n tooltip,\n type,\n typeLink,\n markAsReadOnLinkOpen,\n headerVariant,\n } = props;\n\n const [refresh, setRefresh] = useState(false);\n // TODO: Reuse useNotificationsRefresh instead of duplicating signals +\n // polling refresh logic here.\n const { lastSignal } = useSignal('notifications');\n const [searchParams] = useSearchParams();\n const highlightedNotificationId = searchParams.get('id') || undefined;\n const [highlightedNotification, setHighlightedNotification] = useState<\n Notification | undefined\n >();\n const [unreadOnly, setUnreadOnly] = useState<boolean | undefined>(true);\n const [saved, setSaved] = useState<boolean | undefined>(undefined);\n const [pageNumber, setPageNumber] = useState(0);\n const [pageSize, setPageSize] = useState(5);\n const [containsText, setContainsText] = useState<string>();\n const [createdAfter, setCreatedAfter] = useState<string>('all');\n const [sorting, setSorting] = useState<SortBy>(SortByOptions.newest.sortBy);\n const [severity, setSeverity] = useState<NotificationSeverity>('low');\n const [topic, setTopic] = useState<string>();\n\n const { error, value, retry, loading } = useNotificationsApi<\n [GetNotificationsResponse, NotificationStatus, GetTopicsResponse]\n >(\n api => {\n const options: GetNotificationsOptions = {\n search: containsText,\n limit: pageSize,\n offset: pageNumber * pageSize,\n minimumSeverity: severity,\n ...(sorting || {}),\n };\n if (unreadOnly !== undefined) {\n options.read = !unreadOnly;\n }\n if (saved !== undefined) {\n options.saved = saved;\n }\n if (topic !== undefined) {\n options.topic = topic;\n }\n\n const createdAfterDate =\n CreatedAfterOptions[\n createdAfter as keyof typeof CreatedAfterOptions\n ].getDate();\n if (createdAfterDate.valueOf() > 0) {\n options.createdAfter = createdAfterDate;\n }\n\n return Promise.all([\n api.getNotifications(options),\n api.getStatus(),\n api.getTopics(options),\n ]);\n },\n [\n containsText,\n unreadOnly,\n createdAfter,\n pageNumber,\n pageSize,\n sorting,\n saved,\n severity,\n topic,\n ],\n );\n\n const throttledSetRefresh = useMemo(\n () => throttle(setRefresh, ThrottleDelayMs),\n [setRefresh],\n );\n\n useEffect(() => {\n if (refresh && !loading) {\n retry();\n setRefresh(false);\n }\n }, [refresh, setRefresh, retry, loading]);\n\n useEffect(() => {\n if (lastSignal && lastSignal.action) {\n throttledSetRefresh(true);\n }\n }, [lastSignal, throttledSetRefresh]);\n\n useEffect(() => {\n if (!highlightedNotificationId) {\n setHighlightedNotification(undefined);\n return;\n }\n\n setPageNumber(0);\n }, [highlightedNotificationId]);\n\n const { value: fetchedHighlightedNotification } = useNotificationsApi(\n api => {\n if (!highlightedNotificationId) {\n return Promise.resolve(undefined);\n }\n return api.getNotification(highlightedNotificationId);\n },\n [highlightedNotificationId],\n );\n\n useEffect(() => {\n if (!fetchedHighlightedNotification) {\n return;\n }\n\n setHighlightedNotification(fetchedHighlightedNotification);\n if (!fetchedHighlightedNotification.read) {\n setUnreadOnly(true);\n } else {\n setUnreadOnly(false);\n }\n }, [fetchedHighlightedNotification]);\n\n const onUpdate = () => {\n throttledSetRefresh(true);\n };\n\n const notifications = value?.[0]?.notifications;\n const displayedNotifications = useMemo(() => {\n if (\n !highlightedNotification ||\n notifications?.some(\n notification => notification.id === highlightedNotification.id,\n )\n ) {\n return notifications;\n }\n\n // Allow pageSize + 1 so a deep-linked notification can be injected\n // without silently dropping a row that belongs on this page.\n return [highlightedNotification, ...(notifications ?? [])];\n }, [notifications, highlightedNotification]);\n\n const injectedHighlightedNotification =\n highlightedNotification &&\n !notifications?.some(\n notification => notification.id === highlightedNotification.id,\n );\n const displayedPageSize = injectedHighlightedNotification\n ? pageSize + 1\n : pageSize;\n\n if (error) {\n return <ResponseErrorPanel error={error} />;\n }\n\n const totalCount = value?.[0]?.totalCount;\n const isUnread = !!value?.[1]?.unread;\n const allTopics = value?.[2]?.topics;\n\n let tableTitle: string = t(TableTitleKeys.all, {\n count: totalCount ?? 0,\n });\n if (saved) {\n tableTitle = t(TableTitleKeys.saved, {\n count: totalCount ?? 0,\n });\n } else if (unreadOnly === true) {\n tableTitle = t(TableTitleKeys.unread, {\n count: totalCount ?? 0,\n });\n } else if (unreadOnly === false) {\n tableTitle = t(TableTitleKeys.read, {\n count: totalCount ?? 0,\n });\n }\n\n const pageContent = (\n <Content>\n <Grid.Root columns=\"12\" gap=\"6\">\n <Grid.Item colSpan=\"2\">\n <NotificationsFilters\n unreadOnly={unreadOnly}\n onUnreadOnlyChanged={setUnreadOnly}\n createdAfter={createdAfter}\n onCreatedAfterChanged={setCreatedAfter}\n onSortingChanged={setSorting}\n sorting={sorting}\n saved={saved}\n onSavedChanged={setSaved}\n severity={severity}\n onSeverityChanged={setSeverity}\n topic={topic}\n onTopicChanged={setTopic}\n allTopics={allTopics}\n />\n </Grid.Item>\n <Grid.Item colSpan=\"10\">\n <NotificationsTable\n title={tableTitle}\n isLoading={loading}\n isUnread={isUnread}\n markAsReadOnLinkOpen={markAsReadOnLinkOpen}\n notifications={displayedNotifications}\n highlightedNotificationId={highlightedNotificationId}\n onUpdate={onUpdate}\n setContainsText={setContainsText}\n onPageChange={setPageNumber}\n onRowsPerPageChange={setPageSize}\n page={pageNumber}\n pageSize={displayedPageSize}\n totalCount={totalCount}\n />\n </Grid.Item>\n </Grid.Root>\n </Content>\n );\n\n if (headerVariant === 'bui') {\n return pageContent;\n }\n\n return (\n <PageWithHeader\n title={title}\n themeId={themeId}\n tooltip={tooltip}\n subtitle={subtitle}\n type={type}\n typeLink={typeLink}\n >\n {pageContent}\n </PageWithHeader>\n );\n}\n\nexport const NotificationsPage = (props?: NotificationsPageProps) => (\n <NotificationsPageContent {...(props ?? {})} headerVariant=\"legacy\" />\n);\n\nexport const NfsNotificationsPage = (props?: NotificationsPageProps) => (\n <NotificationsPageContent {...(props ?? {})} headerVariant=\"bui\" />\n);\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAkCA,MAAM,cAAA,GAAiB;AAAA,EACrB,GAAA,EAAK,kCAAA;AAAA,EACL,KAAA,EAAO,oCAAA;AAAA,EACP,MAAA,EAAQ,qCAAA;AAAA,EACR,IAAA,EAAM;AACR,CAAA;AAgBA,MAAM,eAAA,GAAkB,GAAA;AAcxB,SAAS,yBACP,KAAA,EACA;AACA,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,2BAA2B,CAAA;AAC3D,EAAA,MAAM;AAAA,IACJ,KAAA,GAAQ,EAAE,yBAAyB,CAAA;AAAA,IACnC,OAAA,GAAU,MAAA;AAAA,IACV,QAAA;AAAA,IACA,OAAA;AAAA,IACA,IAAA;AAAA,IACA,QAAA;AAAA,IACA,oBAAA;AAAA,IACA;AAAA,GACF,GAAI,KAAA;AAEJ,EAAA,MAAM,CAAC,OAAA,EAAS,UAAU,CAAA,GAAI,SAAS,KAAK,CAAA;AAG5C,EAAA,MAAM,EAAE,UAAA,EAAW,GAAI,SAAA,CAAU,eAAe,CAAA;AAChD,EAAA,MAAM,CAAC,YAAY,CAAA,GAAI,eAAA,EAAgB;AACvC,EAAA,MAAM,yBAAA,GAA4B,YAAA,CAAa,GAAA,CAAI,IAAI,CAAA,IAAK,MAAA;AAC5D,EAAA,MAAM,CAAC,uBAAA,EAAyB,0BAA0B,CAAA,GAAI,QAAA,EAE5D;AACF,EAAA,MAAM,CAAC,UAAA,EAAY,aAAa,CAAA,GAAI,SAA8B,IAAI,CAAA;AACtE,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,SAA8B,MAAS,CAAA;AACjE,EAAA,MAAM,CAAC,UAAA,EAAY,aAAa,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M,oBAAA,GAAuB,CAAC,KAAA,qBACnC,GAAA,CAAC,wBAAA,EAAA,EAA0B,GAAI,KAAA,IAAS,EAAC,EAAI,aAAA,EAAc,KAAA,EAAM;;;;"}
1
+ {"version":3,"file":"NotificationsPage.esm.js","sources":["../../../src/components/NotificationsPage/NotificationsPage.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useEffect, useMemo, useState } from 'react';\nimport throttle from 'lodash/throttle';\nimport {\n Content,\n PageWithHeader,\n ResponseErrorPanel,\n} from '@backstage/core-components';\nimport { Grid } from '@backstage/ui';\nimport { useSignal } from '@backstage/plugin-signals-react';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { useSearchParams } from 'react-router-dom';\nimport {\n Notification,\n NotificationSeverity,\n NotificationStatus,\n} from '@backstage/plugin-notifications-common';\nimport { notificationsTranslationRef } from '../../translation';\n\nconst TableTitleKeys = {\n all: 'notificationsPage.tableTitle.all',\n saved: 'notificationsPage.tableTitle.saved',\n unread: 'notificationsPage.tableTitle.unread',\n read: 'notificationsPage.tableTitle.read',\n} as const;\n\nimport { NotificationsTable } from '../NotificationsTable';\nimport { useNotificationsApi } from '../../hooks';\nimport {\n CreatedAfterOptions,\n NotificationsFilters,\n SortBy,\n SortByOptions,\n} from '../NotificationsFilters';\nimport {\n GetNotificationsOptions,\n GetNotificationsResponse,\n GetTopicsResponse,\n} from '../../api';\n\nconst ThrottleDelayMs = 2000;\n\n/** @public */\nexport type NotificationsPageProps = {\n /** Mark notification as read when opening the link it contains, defaults to false */\n markAsReadOnLinkOpen?: boolean;\n title?: string;\n themeId?: string;\n subtitle?: string;\n tooltip?: string;\n type?: string;\n typeLink?: string;\n};\n\nfunction NotificationsPageContent(\n props: NotificationsPageProps & { headerVariant: 'legacy' | 'bui' },\n) {\n const { t } = useTranslationRef(notificationsTranslationRef);\n const {\n title = t('notificationsPage.title'),\n themeId = 'tool',\n subtitle,\n tooltip,\n type,\n typeLink,\n markAsReadOnLinkOpen,\n headerVariant,\n } = props;\n\n const [refresh, setRefresh] = useState(false);\n // TODO: Reuse useNotificationsRefresh instead of duplicating signals +\n // polling refresh logic here.\n const { lastSignal } = useSignal('notifications');\n const [searchParams] = useSearchParams();\n const highlightedNotificationId = searchParams.get('id') || undefined;\n const [highlightedNotification, setHighlightedNotification] = useState<\n Notification | undefined\n >();\n const [unreadOnly, setUnreadOnly] = useState<boolean | undefined>(true);\n const [saved, setSaved] = useState<boolean | undefined>(undefined);\n const [pageNumber, setPageNumber] = useState(0);\n const [pageSize, setPageSize] = useState(5);\n const [containsText, setContainsText] = useState<string>();\n const [createdAfter, setCreatedAfter] = useState<string>('all');\n const [sorting, setSorting] = useState<SortBy>(SortByOptions.newest.sortBy);\n const [severity, setSeverity] = useState<NotificationSeverity>('low');\n const [topic, setTopic] = useState<string>();\n\n const { error, value, retry, loading } = useNotificationsApi<\n [GetNotificationsResponse, NotificationStatus, GetTopicsResponse]\n >(\n api => {\n const options: GetNotificationsOptions = {\n search: containsText,\n limit: pageSize,\n offset: pageNumber * pageSize,\n minimumSeverity: severity,\n ...(sorting || {}),\n };\n if (unreadOnly !== undefined) {\n options.read = !unreadOnly;\n }\n if (saved !== undefined) {\n options.saved = saved;\n }\n if (topic !== undefined) {\n options.topic = topic;\n }\n\n const createdAfterDate =\n CreatedAfterOptions[\n createdAfter as keyof typeof CreatedAfterOptions\n ].getDate();\n if (createdAfterDate.valueOf() > 0) {\n options.createdAfter = createdAfterDate;\n }\n\n return Promise.all([\n api.getNotifications(options),\n api.getStatus(),\n api.getTopics(options),\n ]);\n },\n [\n containsText,\n unreadOnly,\n createdAfter,\n pageNumber,\n pageSize,\n sorting,\n saved,\n severity,\n topic,\n ],\n );\n\n const throttledSetRefresh = useMemo(\n () => throttle(setRefresh, ThrottleDelayMs),\n [setRefresh],\n );\n\n useEffect(() => {\n if (refresh && !loading) {\n retry();\n setRefresh(false);\n }\n }, [refresh, setRefresh, retry, loading]);\n\n useEffect(() => {\n if (lastSignal && lastSignal.action) {\n throttledSetRefresh(true);\n }\n }, [lastSignal, throttledSetRefresh]);\n\n useEffect(() => {\n if (!highlightedNotificationId) {\n setHighlightedNotification(undefined);\n return;\n }\n\n setPageNumber(0);\n }, [highlightedNotificationId]);\n\n const { value: fetchedHighlightedNotification } = useNotificationsApi(\n api => {\n if (!highlightedNotificationId) {\n return Promise.resolve(undefined);\n }\n return api.getNotification(highlightedNotificationId);\n },\n [highlightedNotificationId],\n );\n\n useEffect(() => {\n if (!fetchedHighlightedNotification) {\n return;\n }\n\n setHighlightedNotification(fetchedHighlightedNotification);\n if (!fetchedHighlightedNotification.read) {\n setUnreadOnly(true);\n } else {\n setUnreadOnly(false);\n }\n }, [fetchedHighlightedNotification]);\n\n const onUpdate = () => {\n throttledSetRefresh(true);\n };\n\n const notifications = value?.[0]?.notifications;\n const displayedNotifications = useMemo(() => {\n if (\n !highlightedNotification ||\n notifications?.some(\n notification => notification.id === highlightedNotification.id,\n )\n ) {\n return notifications;\n }\n\n // Allow pageSize + 1 so a deep-linked notification can be injected\n // without silently dropping a row that belongs on this page.\n return [highlightedNotification, ...(notifications ?? [])];\n }, [notifications, highlightedNotification]);\n\n const injectedHighlightedNotification =\n highlightedNotification &&\n !notifications?.some(\n notification => notification.id === highlightedNotification.id,\n );\n const displayedPageSize = injectedHighlightedNotification\n ? pageSize + 1\n : pageSize;\n\n if (error) {\n return <ResponseErrorPanel error={error} />;\n }\n\n const totalCount = value?.[0]?.totalCount;\n const isUnread = !!value?.[1]?.unread;\n const allTopics = value?.[2]?.topics;\n\n let tableTitle: string = t(TableTitleKeys.all, {\n count: totalCount ?? 0,\n });\n if (saved) {\n tableTitle = t(TableTitleKeys.saved, {\n count: totalCount ?? 0,\n });\n } else if (unreadOnly === true) {\n tableTitle = t(TableTitleKeys.unread, {\n count: totalCount ?? 0,\n });\n } else if (unreadOnly === false) {\n tableTitle = t(TableTitleKeys.read, {\n count: totalCount ?? 0,\n });\n }\n\n const pageContent = (\n <Content>\n <Grid.Root columns=\"12\" gap=\"6\">\n <Grid.Item colSpan=\"2\">\n <NotificationsFilters\n unreadOnly={unreadOnly}\n onUnreadOnlyChanged={setUnreadOnly}\n createdAfter={createdAfter}\n onCreatedAfterChanged={setCreatedAfter}\n onSortingChanged={setSorting}\n sorting={sorting}\n saved={saved}\n onSavedChanged={setSaved}\n severity={severity}\n onSeverityChanged={setSeverity}\n topic={topic}\n onTopicChanged={setTopic}\n allTopics={allTopics}\n />\n </Grid.Item>\n <Grid.Item colSpan=\"10\">\n <NotificationsTable\n title={tableTitle}\n isLoading={loading}\n isUnread={isUnread}\n markAsReadOnLinkOpen={markAsReadOnLinkOpen}\n notifications={displayedNotifications}\n highlightedNotificationId={highlightedNotificationId}\n onUpdate={onUpdate}\n setContainsText={setContainsText}\n onPageChange={setPageNumber}\n onRowsPerPageChange={setPageSize}\n page={pageNumber}\n pageSize={displayedPageSize}\n totalCount={totalCount}\n />\n </Grid.Item>\n </Grid.Root>\n </Content>\n );\n\n if (headerVariant === 'bui') {\n return pageContent;\n }\n\n return (\n <PageWithHeader\n title={title}\n themeId={themeId}\n tooltip={tooltip}\n subtitle={subtitle}\n type={type}\n typeLink={typeLink}\n >\n {pageContent}\n </PageWithHeader>\n );\n}\n\nexport const NotificationsPage = (props?: NotificationsPageProps) => (\n <NotificationsPageContent {...(props ?? {})} headerVariant=\"legacy\" />\n);\n\nexport const NfsNotificationsPage = (props?: NotificationsPageProps) => (\n <NotificationsPageContent {...(props ?? {})} headerVariant=\"bui\" />\n);\n"],"names":[],"mappings":";;;;;;;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otificationsPage.esm.js';
1
+ import { NfsNotificationsPage, NotificationsPage } from './NotificationsPage.esm.js';
2
2
 
3
3
 
4
4
 
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationsSideBarItem.esm.js","sources":["../../../src/components/NotificationsSideBarItem/NotificationsSideBarItem.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { forwardRef, useCallback, useEffect, useMemo, useState } from 'react';\nimport { useNotificationsApi } from '../../hooks';\nimport { SidebarItem } from '@backstage/core-components';\nimport { IconComponent, useApi, useRouteRef } from '@backstage/core-plugin-api';\nimport { toastApiRef } from '@backstage/frontend-plugin-api';\nimport { rootRouteRef } from '../../routes';\nimport { useSignal } from '@backstage/plugin-signals-react';\nimport {\n Notification,\n NotificationSeverity,\n NotificationSignal,\n} from '@backstage/plugin-notifications-common';\nimport { useWebNotifications } from '../../hooks/useWebNotifications';\nimport { useTitleCounter } from '../../hooks/useTitleCounter';\nimport { notificationsApiRef } from '../../api';\nimport {\n closeSnackbar,\n enqueueSnackbar,\n MaterialDesignContent,\n OptionsWithExtraProps,\n SnackbarKey,\n SnackbarProvider,\n VariantType,\n} from 'notistack';\nimport { SeverityIcon } from '../NotificationsTable/SeverityIcon';\nimport { ButtonIcon, Flex, Tag, TagGroup } from '@backstage/ui';\nimport {\n RiExternalLinkLine,\n RiCheckboxCircleLine,\n RiNotification2Line,\n} from '@remixicon/react';\nimport styles from './NotificationsSideBarItem.module.css';\n\nconst NotificationsIcon: IconComponent = props => {\n let size = 24;\n if (props.fontSize === 'large') {\n size = 32;\n } else if (props.fontSize === 'small') {\n size = 16;\n }\n return <RiNotification2Line size={size} />;\n};\n\nconst StyledMaterialDesignContent = forwardRef<HTMLDivElement, any>(\n (props: any, ref: React.Ref<HTMLDivElement>) => (\n <MaterialDesignContent\n {...props}\n ref={ref}\n className={[props.className, styles.snackbarContent]\n .filter(Boolean)\n .join(' ')}\n />\n ),\n);\n\ndeclare module 'notistack' {\n interface VariantOverrides {\n // Custom variants for the snackbar\n low: true;\n normal: true;\n high: true;\n critical: true;\n }\n}\n\n/**\n * @public\n */\nexport type NotificationSnackbarProperties = {\n enabled?: boolean;\n autoHideDuration?: number | null;\n anchorOrigin?: {\n vertical: 'top' | 'bottom';\n horizontal: 'left' | 'center' | 'right';\n };\n dense?: boolean;\n maxSnack?: number;\n snackStyle?: React.CSSProperties;\n iconVariant?: Partial<Record<NotificationSeverity, React.ReactNode>>;\n Components?: {\n [key in NotificationSeverity]: React.JSXElementConstructor<any>;\n };\n};\n\n/**\n * Props passed to the custom renderItem function\n * @public\n */\nexport type NotificationsRenderItemProps = {\n /** Current unread notification count */\n unreadCount: number;\n /** Route path to the notifications page */\n to: string;\n /** Click handler that requests web notification permission */\n onClick: () => void;\n};\n\n/**\n * @public\n */\nexport type NotificationsSideBarItemProps = {\n webNotificationsEnabled?: boolean;\n titleCounterEnabled?: boolean;\n /**\n * @deprecated Use `snackbarProps` instead.\n */\n snackbarEnabled?: boolean;\n /**\n * @deprecated Use `snackbarProps` instead.\n */\n snackbarAutoHideDuration?: number | null;\n snackbarProps?: NotificationSnackbarProperties;\n className?: string;\n icon?: IconComponent;\n text?: string;\n disableHighlight?: boolean;\n noTrack?: boolean;\n /**\n * Optional render function to provide custom UI instead of the default SidebarItem.\n */\n renderItem?: (props: NotificationsRenderItemProps) => React.ReactNode;\n};\n\n/** @public */\nexport const NotificationsSidebarItem = (\n props?: NotificationsSideBarItemProps,\n) => {\n const {\n webNotificationsEnabled = false,\n titleCounterEnabled = true,\n snackbarEnabled = true,\n snackbarAutoHideDuration = 15000,\n icon = NotificationsIcon,\n text = 'Notifications',\n ...restProps\n } = props ?? {\n webNotificationsEnabled: false,\n titleCounterEnabled: true,\n snackbarProps: {\n enabled: true,\n autoHideDuration: 15000,\n },\n };\n\n const snackbarProps = useMemo(\n () =>\n props?.snackbarProps ?? {\n enabled: snackbarEnabled,\n autoHideDuration: snackbarAutoHideDuration,\n },\n [props?.snackbarProps, snackbarAutoHideDuration, snackbarEnabled],\n );\n\n const { loading, error, value, retry } = useNotificationsApi(api =>\n api.getStatus(),\n );\n const notificationsApi = useApi(notificationsApiRef);\n const toastApi = useApi(toastApiRef);\n const [unreadCount, setUnreadCount] = useState(0);\n const notificationsRoute = useRouteRef(rootRouteRef)();\n // TODO: Do we want to add long polling in case signals are not available\n const { lastSignal } = useSignal<NotificationSignal>('notifications');\n const { sendWebNotification, requestUserPermission } = useWebNotifications(\n webNotificationsEnabled,\n );\n const [refresh, setRefresh] = useState(false);\n const { setNotificationCount } = useTitleCounter();\n\n const getSnackbarProperties = useCallback(\n (notification: Notification) => {\n const action = (snackBarId: SnackbarKey) => (\n <Flex gap=\"1\">\n <ButtonIcon\n aria-label=\"open notification\"\n icon={<RiExternalLinkLine size={16} />}\n variant=\"secondary\"\n onPress={() => {\n const link = notification.payload.link ?? notificationsRoute;\n window.open(link, '_blank', 'noopener,noreferrer');\n if (notification.payload.link) {\n notificationsApi\n .updateNotifications({\n ids: [notification.id],\n read: true,\n })\n .catch(() => {\n toastApi.post({\n title: 'Failed to mark notification as read',\n status: 'danger',\n });\n });\n }\n closeSnackbar(snackBarId);\n }}\n />\n <ButtonIcon\n aria-label=\"mark as read\"\n icon={<RiCheckboxCircleLine size={16} />}\n variant=\"secondary\"\n onPress={() => {\n notificationsApi\n .updateNotifications({\n ids: [notification.id],\n read: true,\n })\n .then(() => {\n closeSnackbar(snackBarId);\n })\n .catch(() => {\n toastApi.post({\n title: 'Failed to mark notification as read',\n status: 'danger',\n });\n });\n }}\n />\n </Flex>\n );\n\n return { action };\n },\n [notificationsRoute, notificationsApi, toastApi],\n );\n\n useEffect(() => {\n if (refresh) {\n retry();\n setRefresh(false);\n }\n }, [refresh, retry]);\n\n useEffect(() => {\n const handleNotificationSignal = (signal: NotificationSignal) => {\n if (\n (!webNotificationsEnabled && !snackbarProps.enabled) ||\n signal.action !== 'new_notification'\n ) {\n return;\n }\n notificationsApi\n .getNotification(signal.notification_id)\n .then(notification => {\n if (!notification) {\n return;\n }\n if (webNotificationsEnabled) {\n sendWebNotification({\n id: notification.id,\n title: notification.payload.title,\n description: notification.payload.description ?? '',\n link: notification.payload.link,\n });\n }\n if (snackbarProps.enabled) {\n const { action } = getSnackbarProperties(notification);\n const snackBarText =\n notification.payload.title.length > 50\n ? `${notification.payload.title.substring(0, 50)}...`\n : notification.payload.title;\n enqueueSnackbar(snackBarText, {\n key: notification.id,\n style: snackbarProps.snackStyle,\n variant: notification.payload.severity,\n anchorOrigin: snackbarProps.anchorOrigin ?? {\n vertical: 'bottom',\n horizontal: 'right',\n },\n action,\n autoHideDuration: snackbarProps.autoHideDuration,\n } as OptionsWithExtraProps<VariantType>);\n }\n })\n .catch(() => {\n toastApi.post({\n title: 'Failed to fetch notification',\n status: 'danger',\n });\n });\n };\n\n if (lastSignal && lastSignal.action) {\n handleNotificationSignal(lastSignal);\n setRefresh(true);\n }\n }, [\n lastSignal,\n sendWebNotification,\n webNotificationsEnabled,\n notificationsApi,\n toastApi,\n getSnackbarProperties,\n snackbarProps,\n ]);\n\n useEffect(() => {\n if (!loading && !error && value) {\n setUnreadCount(value.unread);\n }\n }, [loading, error, value]);\n\n useEffect(() => {\n if (titleCounterEnabled) {\n setNotificationCount(unreadCount);\n }\n }, [titleCounterEnabled, unreadCount, setNotificationCount]);\n\n const count = !error && !!unreadCount ? unreadCount : undefined;\n\n const handleClick = useCallback(() => {\n requestUserPermission();\n }, [requestUserPermission]);\n\n // Props to pass to custom renderItem function\n const renderItemProps: NotificationsRenderItemProps = useMemo(\n () => ({\n unreadCount,\n to: notificationsRoute,\n onClick: handleClick,\n }),\n [unreadCount, notificationsRoute, handleClick],\n );\n\n return (\n <>\n {snackbarEnabled && (\n <SnackbarProvider\n iconVariant={{\n normal: snackbarProps?.iconVariant?.normal ?? (\n <SeverityIcon severity=\"normal\" className={styles.snackbarIcon} />\n ),\n critical: snackbarProps?.iconVariant?.critical ?? (\n <SeverityIcon\n severity=\"critical\"\n className={styles.snackbarIcon}\n />\n ),\n high: snackbarProps?.iconVariant?.high ?? (\n <SeverityIcon severity=\"high\" className={styles.snackbarIcon} />\n ),\n low: snackbarProps?.iconVariant?.low ?? (\n <SeverityIcon severity=\"low\" className={styles.snackbarIcon} />\n ),\n }}\n dense={snackbarProps?.dense}\n maxSnack={snackbarProps?.maxSnack}\n Components={{\n normal:\n snackbarProps?.Components?.normal ?? StyledMaterialDesignContent,\n critical:\n snackbarProps?.Components?.critical ??\n StyledMaterialDesignContent,\n high:\n snackbarProps?.Components?.high ?? StyledMaterialDesignContent,\n low: snackbarProps?.Components?.low ?? StyledMaterialDesignContent,\n }}\n />\n )}\n {props?.renderItem ? (\n props.renderItem(renderItemProps)\n ) : (\n <SidebarItem\n to={notificationsRoute}\n onClick={handleClick}\n text={text}\n icon={icon}\n {...restProps}\n >\n {count && (\n <TagGroup aria-label=\"Unread notifications\">\n <Tag size=\"small\">{count > 99 ? '99+' : count}</Tag>\n </TagGroup>\n )}\n </SidebarItem>\n )}\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAgDA,MAAM,oBAAmC,CAAA,KAAA,KAAS;AAChD,EAAA,IAAI,IAAA,GAAO,EAAA;AACX,EAAA,IAAI,KAAA,CAAM,aAAa,OAAA,EAAS;AAC9B,IAAA,IAAA,GAAO,EAAA;AAAA,EACT,CAAA,MAAA,IAAW,KAAA,CAAM,QAAA,KAAa,OAAA,EAAS;AACrC,IAAA,IAAA,GAAO,EAAA;AAAA,EACT;AACA,EAAA,uBAAO,GAAA,CAAC,uBAAoB,IAAA,EAAY,C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C,WAAA;AAAA,MAAA;AAAA,QACC,EAAA,EAAI,kBAAA;AAAA,QACJ,OAAA,EAAS,WAAA;AAAA,QACT,IAAA;AAAA,QACA,IAAA;AAAA,QACC,GAAG,SAAA;AAAA,QAEH,QAAA,EAAA,KAAA,oBACC,GAAA,CAAC,QAAA,EAAA,EAAS,YAAA,EAAW,sBAAA,EACnB,QAAA,kBAAA,GAAA,CAAC,GAAA,EAAA,EAAI,IAAA,EAAK,OAAA,EAAS,QAAA,EAAA,KAAA,GAAQ,EAAA,GAAK,KAAA,GAAQ,OAAM,CAAA,EAChD;AAAA;AAAA;AAEJ,GAAA,EAEJ,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"NotificationsSideBarItem.esm.js","sources":["../../../src/components/NotificationsSideBarItem/NotificationsSideBarItem.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { forwardRef, useCallback, useEffect, useMemo, useState } from 'react';\nimport { useNotificationsApi } from '../../hooks';\nimport { SidebarItem } from '@backstage/core-components';\nimport { IconComponent, useApi, useRouteRef } from '@backstage/core-plugin-api';\nimport { toastApiRef } from '@backstage/frontend-plugin-api';\nimport { rootRouteRef } from '../../routes';\nimport { useSignal } from '@backstage/plugin-signals-react';\nimport {\n Notification,\n NotificationSeverity,\n NotificationSignal,\n} from '@backstage/plugin-notifications-common';\nimport { useWebNotifications } from '../../hooks/useWebNotifications';\nimport { useTitleCounter } from '../../hooks/useTitleCounter';\nimport { notificationsApiRef } from '../../api';\nimport {\n closeSnackbar,\n enqueueSnackbar,\n MaterialDesignContent,\n OptionsWithExtraProps,\n SnackbarKey,\n SnackbarProvider,\n VariantType,\n} from 'notistack';\nimport { SeverityIcon } from '../NotificationsTable/SeverityIcon';\nimport { ButtonIcon, Flex, Tag, TagGroup } from '@backstage/ui';\nimport {\n RiExternalLinkLine,\n RiCheckboxCircleLine,\n RiNotification2Line,\n} from '@remixicon/react';\nimport styles from './NotificationsSideBarItem.module.css';\n\nconst NotificationsIcon: IconComponent = props => {\n let size = 24;\n if (props.fontSize === 'large') {\n size = 32;\n } else if (props.fontSize === 'small') {\n size = 16;\n }\n return <RiNotification2Line size={size} />;\n};\n\nconst StyledMaterialDesignContent = forwardRef<HTMLDivElement, any>(\n (props: any, ref: React.Ref<HTMLDivElement>) => (\n <MaterialDesignContent\n {...props}\n ref={ref}\n className={[props.className, styles.snackbarContent]\n .filter(Boolean)\n .join(' ')}\n />\n ),\n);\n\ndeclare module 'notistack' {\n interface VariantOverrides {\n // Custom variants for the snackbar\n low: true;\n normal: true;\n high: true;\n critical: true;\n }\n}\n\n/**\n * @public\n */\nexport type NotificationSnackbarProperties = {\n enabled?: boolean;\n autoHideDuration?: number | null;\n anchorOrigin?: {\n vertical: 'top' | 'bottom';\n horizontal: 'left' | 'center' | 'right';\n };\n dense?: boolean;\n maxSnack?: number;\n snackStyle?: React.CSSProperties;\n iconVariant?: Partial<Record<NotificationSeverity, React.ReactNode>>;\n Components?: {\n [key in NotificationSeverity]: React.JSXElementConstructor<any>;\n };\n};\n\n/**\n * Props passed to the custom renderItem function\n * @public\n */\nexport type NotificationsRenderItemProps = {\n /** Current unread notification count */\n unreadCount: number;\n /** Route path to the notifications page */\n to: string;\n /** Click handler that requests web notification permission */\n onClick: () => void;\n};\n\n/**\n * @public\n */\nexport type NotificationsSideBarItemProps = {\n webNotificationsEnabled?: boolean;\n titleCounterEnabled?: boolean;\n /**\n * @deprecated Use `snackbarProps` instead.\n */\n snackbarEnabled?: boolean;\n /**\n * @deprecated Use `snackbarProps` instead.\n */\n snackbarAutoHideDuration?: number | null;\n snackbarProps?: NotificationSnackbarProperties;\n className?: string;\n icon?: IconComponent;\n text?: string;\n disableHighlight?: boolean;\n noTrack?: boolean;\n /**\n * Optional render function to provide custom UI instead of the default SidebarItem.\n */\n renderItem?: (props: NotificationsRenderItemProps) => React.ReactNode;\n};\n\n/** @public */\nexport const NotificationsSidebarItem = (\n props?: NotificationsSideBarItemProps,\n) => {\n const {\n webNotificationsEnabled = false,\n titleCounterEnabled = true,\n snackbarEnabled = true,\n snackbarAutoHideDuration = 15000,\n icon = NotificationsIcon,\n text = 'Notifications',\n ...restProps\n } = props ?? {\n webNotificationsEnabled: false,\n titleCounterEnabled: true,\n snackbarProps: {\n enabled: true,\n autoHideDuration: 15000,\n },\n };\n\n const snackbarProps = useMemo(\n () =>\n props?.snackbarProps ?? {\n enabled: snackbarEnabled,\n autoHideDuration: snackbarAutoHideDuration,\n },\n [props?.snackbarProps, snackbarAutoHideDuration, snackbarEnabled],\n );\n\n const { loading, error, value, retry } = useNotificationsApi(api =>\n api.getStatus(),\n );\n const notificationsApi = useApi(notificationsApiRef);\n const toastApi = useApi(toastApiRef);\n const [unreadCount, setUnreadCount] = useState(0);\n const notificationsRoute = useRouteRef(rootRouteRef)();\n // TODO: Do we want to add long polling in case signals are not available\n const { lastSignal } = useSignal<NotificationSignal>('notifications');\n const { sendWebNotification, requestUserPermission } = useWebNotifications(\n webNotificationsEnabled,\n );\n const [refresh, setRefresh] = useState(false);\n const { setNotificationCount } = useTitleCounter();\n\n const getSnackbarProperties = useCallback(\n (notification: Notification) => {\n const action = (snackBarId: SnackbarKey) => (\n <Flex gap=\"1\">\n <ButtonIcon\n aria-label=\"open notification\"\n icon={<RiExternalLinkLine size={16} />}\n variant=\"secondary\"\n onPress={() => {\n const link = notification.payload.link ?? notificationsRoute;\n window.open(link, '_blank', 'noopener,noreferrer');\n if (notification.payload.link) {\n notificationsApi\n .updateNotifications({\n ids: [notification.id],\n read: true,\n })\n .catch(() => {\n toastApi.post({\n title: 'Failed to mark notification as read',\n status: 'danger',\n });\n });\n }\n closeSnackbar(snackBarId);\n }}\n />\n <ButtonIcon\n aria-label=\"mark as read\"\n icon={<RiCheckboxCircleLine size={16} />}\n variant=\"secondary\"\n onPress={() => {\n notificationsApi\n .updateNotifications({\n ids: [notification.id],\n read: true,\n })\n .then(() => {\n closeSnackbar(snackBarId);\n })\n .catch(() => {\n toastApi.post({\n title: 'Failed to mark notification as read',\n status: 'danger',\n });\n });\n }}\n />\n </Flex>\n );\n\n return { action };\n },\n [notificationsRoute, notificationsApi, toastApi],\n );\n\n useEffect(() => {\n if (refresh) {\n retry();\n setRefresh(false);\n }\n }, [refresh, retry]);\n\n useEffect(() => {\n const handleNotificationSignal = (signal: NotificationSignal) => {\n if (\n (!webNotificationsEnabled && !snackbarProps.enabled) ||\n signal.action !== 'new_notification'\n ) {\n return;\n }\n notificationsApi\n .getNotification(signal.notification_id)\n .then(notification => {\n if (!notification) {\n return;\n }\n if (webNotificationsEnabled) {\n sendWebNotification({\n id: notification.id,\n title: notification.payload.title,\n description: notification.payload.description ?? '',\n link: notification.payload.link,\n });\n }\n if (snackbarProps.enabled) {\n const { action } = getSnackbarProperties(notification);\n const snackBarText =\n notification.payload.title.length > 50\n ? `${notification.payload.title.substring(0, 50)}...`\n : notification.payload.title;\n enqueueSnackbar(snackBarText, {\n key: notification.id,\n style: snackbarProps.snackStyle,\n variant: notification.payload.severity,\n anchorOrigin: snackbarProps.anchorOrigin ?? {\n vertical: 'bottom',\n horizontal: 'right',\n },\n action,\n autoHideDuration: snackbarProps.autoHideDuration,\n } as OptionsWithExtraProps<VariantType>);\n }\n })\n .catch(() => {\n toastApi.post({\n title: 'Failed to fetch notification',\n status: 'danger',\n });\n });\n };\n\n if (lastSignal && lastSignal.action) {\n handleNotificationSignal(lastSignal);\n setRefresh(true);\n }\n }, [\n lastSignal,\n sendWebNotification,\n webNotificationsEnabled,\n notificationsApi,\n toastApi,\n getSnackbarProperties,\n snackbarProps,\n ]);\n\n useEffect(() => {\n if (!loading && !error && value) {\n setUnreadCount(value.unread);\n }\n }, [loading, error, value]);\n\n useEffect(() => {\n if (titleCounterEnabled) {\n setNotificationCount(unreadCount);\n }\n }, [titleCounterEnabled, unreadCount, setNotificationCount]);\n\n const count = !error && !!unreadCount ? unreadCount : undefined;\n\n const handleClick = useCallback(() => {\n requestUserPermission();\n }, [requestUserPermission]);\n\n // Props to pass to custom renderItem function\n const renderItemProps: NotificationsRenderItemProps = useMemo(\n () => ({\n unreadCount,\n to: notificationsRoute,\n onClick: handleClick,\n }),\n [unreadCount, notificationsRoute, handleClick],\n );\n\n return (\n <>\n {snackbarEnabled && (\n <SnackbarProvider\n iconVariant={{\n normal: snackbarProps?.iconVariant?.normal ?? (\n <SeverityIcon severity=\"normal\" className={styles.snackbarIcon} />\n ),\n critical: snackbarProps?.iconVariant?.critical ?? (\n <SeverityIcon\n severity=\"critical\"\n className={styles.snackbarIcon}\n />\n ),\n high: snackbarProps?.iconVariant?.high ?? (\n <SeverityIcon severity=\"high\" className={styles.snackbarIcon} />\n ),\n low: snackbarProps?.iconVariant?.low ?? (\n <SeverityIcon severity=\"low\" className={styles.snackbarIcon} />\n ),\n }}\n dense={snackbarProps?.dense}\n maxSnack={snackbarProps?.maxSnack}\n Components={{\n normal:\n snackbarProps?.Components?.normal ?? StyledMaterialDesignContent,\n critical:\n snackbarProps?.Components?.critical ??\n StyledMaterialDesignContent,\n high:\n snackbarProps?.Components?.high ?? StyledMaterialDesignContent,\n low: snackbarProps?.Components?.low ?? StyledMaterialDesignContent,\n }}\n />\n )}\n {props?.renderItem ? (\n props.renderItem(renderItemProps)\n ) : (\n <SidebarItem\n to={notificationsRoute}\n onClick={handleClick}\n text={text}\n icon={icon}\n {...restProps}\n >\n {count && (\n <TagGroup aria-label=\"Unread notifications\">\n <Tag size=\"small\">{count > 99 ? '99+' : count}</Tag>\n </TagGroup>\n )}\n </SidebarItem>\n )}\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;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2BAAA;AAAA,UACvC,QAAA,EACE,aAAA,EAAe,UAAA,EAAY,QAAA,IAC3B,2BAAA;AAAA,UACF,IAAA,EACE,aAAA,EAAe,UAAA,EAAY,IAAA,IAAQ,2BAAA;AAAA,UACrC,GAAA,EAAK,aAAA,EAAe,UAAA,EAAY,GAAA,IAAO;AAAA;AACzC;AAAA,KACF;AAAA,IAED,KAAA,EAAO,UAAA,GACN,KAAA,CAAM,UAAA,CAAW,eAAe,CAAA,mBAEhC,GAAA;AAAA,MAAC,WAAA;AAAA,MAAA;AAAA,QACC,EAAA,EAAI,kBAAA;AAAA,QACJ,OAAA,EAAS,WAAA;AAAA,QACT,IAAA;AAAA,QACA,IAAA;AAAA,QACC,GAAG,SAAA;AAAA,QAEH,QAAA,EAAA,KAAA,oBACC,GAAA,CAAC,QAAA,EAAA,EAAS,YAAA,EAAW,sBAAA,EACnB,QAAA,kBAAA,GAAA,CAAC,GAAA,EAAA,EAAI,IAAA,EAAK,OAAA,EAAS,QAAA,EAAA,KAAA,GAAQ,EAAA,GAAK,KAAA,GAAQ,OAAM,CAAA,EAChD;AAAA;AAAA;AAEJ,GAAA,EAEJ,CAAA;AAEJ;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationsSideBarItem.module.css.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
1
+ {"version":3,"file":"NotificationsSideBarItem.module.css.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"BulkActions.esm.js","sources":["../../../src/components/NotificationsTable/BulkActions.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 { Notification } from '@backstage/plugin-notifications-common';\nimport { ButtonIcon, Flex, Tooltip, TooltipTrigger } from '@backstage/ui';\nimport {\n RiCheckDoubleLine,\n RiBookmarkLine,\n RiBookmark3Line,\n RiCheckboxCircleLine,\n RiMailLine,\n} from '@remixicon/react';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { notificationsTranslationRef } from '../../translation';\n\nexport const BulkActions = ({\n selectedNotifications,\n notifications,\n isUnread,\n onSwitchReadStatus,\n onSwitchSavedStatus,\n onMarkAllRead,\n}: {\n selectedNotifications: Set<Notification['id']>;\n notifications: Notification[];\n isUnread?: boolean;\n onSwitchReadStatus: (ids: Notification['id'][], newStatus: boolean) => void;\n onSwitchSavedStatus: (ids: Notification['id'][], newStatus: boolean) => void;\n onMarkAllRead?: () => void;\n}) => {\n const { t } = useTranslationRef(notificationsTranslationRef);\n const isDisabled = selectedNotifications.size === 0;\n const bulkNotifications = notifications.filter(notification =>\n selectedNotifications.has(notification.id),\n );\n\n const isOneRead = !!bulkNotifications.find(\n (notification: Notification) => !!notification.read,\n );\n const isOneSaved = !!bulkNotifications.find(\n (notification: Notification) => !!notification.saved,\n );\n\n const markAsReadText = isOneRead\n ? t('table.bulkActions.returnSelectedAmongUnread')\n : t('table.bulkActions.markSelectedAsRead');\n const ReadIcon = isOneRead ? RiMailLine : RiCheckboxCircleLine;\n\n const markAsSavedText = isOneSaved\n ? t('table.bulkActions.undoSaveForSelected')\n : t('table.bulkActions.saveSelectedForLater');\n const SavedIcon = isOneSaved ? RiBookmark3Line : RiBookmarkLine;\n const markAllReadText = t('table.bulkActions.markAllRead');\n\n return (\n <Flex gap=\"1\">\n {onMarkAllRead ? (\n <TooltipTrigger>\n <ButtonIcon\n aria-label={markAllReadText}\n isDisabled={!isUnread}\n onPress={onMarkAllRead}\n icon={<RiCheckDoubleLine size={16} />}\n variant=\"secondary\"\n />\n <Tooltip>{markAllReadText}</Tooltip>\n </TooltipTrigger>\n ) : (\n <div />\n )}\n\n <TooltipTrigger>\n <ButtonIcon\n aria-label={markAsSavedText}\n isDisabled={isDisabled}\n onPress={() => {\n onSwitchSavedStatus([...selectedNotifications], !isOneSaved);\n }}\n icon={<SavedIcon size={16} />}\n variant=\"secondary\"\n />\n <Tooltip>{markAsSavedText}</Tooltip>\n </TooltipTrigger>\n\n <TooltipTrigger>\n <ButtonIcon\n aria-label={markAsReadText}\n isDisabled={isDisabled}\n onPress={() => {\n onSwitchReadStatus([...selectedNotifications], !isOneRead);\n }}\n icon={<ReadIcon size={16} />}\n variant=\"secondary\"\n />\n <Tooltip>{markAsReadText}</Tooltip>\n </TooltipTrigger>\n </Flex>\n );\n};\n"],"names":[],"mappings":";;;;;;AA2BO,MAAM,cAAc,CAAC;AAAA,EAC1B,qBAAA;AAAA,EACA,aAAA;AAAA,EACA,QAAA;AAAA,EACA,kBAAA;AAAA,EACA,mBAAA;AAAA,EACA;AACF,CAAA,KAOM;AACJ,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,2BAA2B,CAAA;AAC3D,EAAA,MAAM,UAAA,GAAa,sBAAsB,IAAA,KAAS,CAAA;AAClD,EAAA,MAAM,oBAAoB,aAAA,CAAc,MAAA;AAAA,IAAO,CAAA,YAAA,KAC7C,qBAAA,CAAsB,GAAA,CAAI,YAAA,CAAa,EAAE;AAAA,GAC3C;AAEA,EAAA,MAAM,SAAA,GAAY,CAAC,CAAC,iBAAA,CAAkB,IAAA;AAAA,IACpC,CAAC,YAAA,KAA+B,CAAC,CAAC,YAAA,CAAa;AAAA,GACjD;AACA,EAAA,MAAM,UAAA,GAAa,CAAC,CAAC,iBAAA,CAAkB,IAAA;AAAA,IACrC,CAAC,YAAA,KAA+B,CAAC,CAAC,YAAA,CAAa;AAAA,GACjD;AAEA,EAAA,MAAM,iBAAiB,SAAA,GACnB,CAAA,CAAE,6CAA6C,CAAA,GAC/C,E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AAA,KAAA,EAC5B,CAAA;AAAA,yBAEC,cAAA,EAAA,EACC,QAAA,EAAA;AAAA,sBAAA,GAAA;AAAA,QAAC,UAAA;AAAA,QAAA;AAAA,UACC,YAAA,EAAY,cAAA;AAAA,UACZ,UAAA;AAAA,UACA,SAAS,MAAM;AACb,YAAA,kBAAA,CAAmB,CAAC,GAAG,qBAAqB,CAAA,EAAG,CAAC,SAAS,CAAA;AAAA,UAC3D,CAAA;AAAA,UACA,IAAA,kBAAM,GAAA,CAAC,QAAA,EAAA,EAAS,IAAA,EAAM,EAAA,EAAI,CAAA;AAAA,UAC1B,OAAA,EAAQ;AAAA;AAAA,OACV;AAAA,sBACA,GAAA,CAAC,WAAS,QAAA,EAAA,cAAA,EAAe;AAAA,KAAA,EAC3B;AAAA,GAAA,EACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"BulkActions.esm.js","sources":["../../../src/components/NotificationsTable/BulkActions.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 { Notification } from '@backstage/plugin-notifications-common';\nimport { ButtonIcon, Flex, Tooltip, TooltipTrigger } from '@backstage/ui';\nimport {\n RiCheckDoubleLine,\n RiBookmarkLine,\n RiBookmark3Line,\n RiCheckboxCircleLine,\n RiMailLine,\n} from '@remixicon/react';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { notificationsTranslationRef } from '../../translation';\n\nexport const BulkActions = ({\n selectedNotifications,\n notifications,\n isUnread,\n onSwitchReadStatus,\n onSwitchSavedStatus,\n onMarkAllRead,\n}: {\n selectedNotifications: Set<Notification['id']>;\n notifications: Notification[];\n isUnread?: boolean;\n onSwitchReadStatus: (ids: Notification['id'][], newStatus: boolean) => void;\n onSwitchSavedStatus: (ids: Notification['id'][], newStatus: boolean) => void;\n onMarkAllRead?: () => void;\n}) => {\n const { t } = useTranslationRef(notificationsTranslationRef);\n const isDisabled = selectedNotifications.size === 0;\n const bulkNotifications = notifications.filter(notification =>\n selectedNotifications.has(notification.id),\n );\n\n const isOneRead = !!bulkNotifications.find(\n (notification: Notification) => !!notification.read,\n );\n const isOneSaved = !!bulkNotifications.find(\n (notification: Notification) => !!notification.saved,\n );\n\n const markAsReadText = isOneRead\n ? t('table.bulkActions.returnSelectedAmongUnread')\n : t('table.bulkActions.markSelectedAsRead');\n const ReadIcon = isOneRead ? RiMailLine : RiCheckboxCircleLine;\n\n const markAsSavedText = isOneSaved\n ? t('table.bulkActions.undoSaveForSelected')\n : t('table.bulkActions.saveSelectedForLater');\n const SavedIcon = isOneSaved ? RiBookmark3Line : RiBookmarkLine;\n const markAllReadText = t('table.bulkActions.markAllRead');\n\n return (\n <Flex gap=\"1\">\n {onMarkAllRead ? (\n <TooltipTrigger>\n <ButtonIcon\n aria-label={markAllReadText}\n isDisabled={!isUnread}\n onPress={onMarkAllRead}\n icon={<RiCheckDoubleLine size={16} />}\n variant=\"secondary\"\n />\n <Tooltip>{markAllReadText}</Tooltip>\n </TooltipTrigger>\n ) : (\n <div />\n )}\n\n <TooltipTrigger>\n <ButtonIcon\n aria-label={markAsSavedText}\n isDisabled={isDisabled}\n onPress={() => {\n onSwitchSavedStatus([...selectedNotifications], !isOneSaved);\n }}\n icon={<SavedIcon size={16} />}\n variant=\"secondary\"\n />\n <Tooltip>{markAsSavedText}</Tooltip>\n </TooltipTrigger>\n\n <TooltipTrigger>\n <ButtonIcon\n aria-label={markAsReadText}\n isDisabled={isDisabled}\n onPress={() => {\n onSwitchReadStatus([...selectedNotifications], !isOneRead);\n }}\n icon={<ReadIcon size={16} />}\n variant=\"secondary\"\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AAA,sBACA,GAAA,CAAC,WAAS,QAAA,EAAA,cAAA,EAAe;AAAA,KAAA,EAC3B;AAAA,GAAA,EACF,CAAA;AAEJ;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"DefaultNotificationDescription.esm.js","sources":["../../../src/components/NotificationsTable/DefaultNotificationDescription.tsx"],"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 */\nimport { Text, Button } from '@backstage/ui';\nimport { useState } from 'react';\nimport type { NotificationDescriptionProps } from './NotificationDescription';\n\nconst MAX_LENGTH = 100;\n\nexport const DefaultNotificationDescription = (\n props: NotificationDescriptionProps,\n) => {\n const { description } = props;\n const [shown, setShown] = useState(false);\n const isLong = description.length > MAX_LENGTH;\n\n if (!isLong) {\n return <Text variant=\"body-small\">{description}</Text>;\n }\n\n if (shown) {\n return (\n <Text variant=\"body-small\">\n {description}{' '}\n <Button\n variant=\"tertiary\"\n onPress={() => {\n setShown(false);\n }}\n >\n Show less\n </Button>\n </Text>\n );\n }\n return (\n <Text variant=\"body-small\">\n {description.substring(0, MAX_LENGTH)}...{' '}\n <Button\n variant=\"tertiary\"\n onPress={() => {\n setShown(true);\n }}\n >\n Show more\n </Button>\n </Text>\n );\n};\n"],"names":[],"mappings":";;;;AAmBA,MAAM,UAAA,GAAa,GAAA;AAEZ,MAAM,8BAAA,GAAiC,CAC5C,KAAA,KACG;AACH,EAAA,MAAM,EAAE,aAAY,GAAI,KAAA;AACxB,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,SAAS,KAAK,CAAA;AACxC,EAAA,MAAM,MAAA,GAAS,YAAY,MAAA,GAAS,UAAA;AAEpC,EAAA,IAAI,CAAC,MAAA,EAAQ;AACX,IAAA,uBAAO,GAAA,CAAC,IAAA,EAAA,EAAK,OAAA,EAAQ,YAAA,EAAc,QAAA,EAAA,WAAA,EAAY,CAAA;AAAA,EACjD;AAEA,EAAA,IAAI,KAAA,EAAO;AACT,IAAA,uBACE,IAAA,CAAC,IAAA,EAAA,EAAK,OAAA,EAAQ,YAAA,EACX,QAAA,EAAA;AAAA,MAAA,WAAA;AAAA,MAAa,GAAA;AAAA,sBACd,GAAA;AAAA,QAAC,MAAA;AAAA,QAAA;AAAA,UACC,OAAA,EAAQ,UAAA;AAAA,UACR,SAAS,MAAM;AACb,YAAA,QAAA,CAAS,KAAK,CAAA;AAAA,UAChB,CAAA;AAAA,UACD,QAAA,EAAA;AAAA;AAAA;AAED,KAAA,EACF,CAAA;AAAA,EAEJ;AACA,EAAA,uBACE,IAAA,CAAC,IAAA,EAAA,EAAK,OAAA,EAAQ,YAAA,EACX,QAAA,EAAA;AAAA,IAAA,WAAA,CAAY,SAAA,CAAU,GAAG,UAAU,CAAA;AAAA,IAAE,KAAA;AAAA,IAAI,GAAA;AAAA,oBAC1C,GAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,OAAA,EAAQ,UAAA;AAAA,QACR,SAAS,MAAM;AACb,UAAA,QAAA,CAAS,IAAI,CAAA;AAAA,QACf,CAAA;AAAA,QACD,QAAA,EAAA;AAAA;AAAA;AAED,GAAA,EACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"DefaultNotificationDescription.esm.js","sources":["../../../src/components/NotificationsTable/DefaultNotificationDescription.tsx"],"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 */\nimport { Text, Button } from '@backstage/ui';\nimport { useState } from 'react';\nimport type { NotificationDescriptionProps } from './NotificationDescription';\n\nconst MAX_LENGTH = 100;\n\nexport const DefaultNotificationDescription = (\n props: NotificationDescriptionProps,\n) => {\n const { description } = props;\n const [shown, setShown] = useState(false);\n const isLong = description.length > MAX_LENGTH;\n\n if (!isLong) {\n return <Text variant=\"body-small\">{description}</Text>;\n }\n\n if (shown) {\n return (\n <Text variant=\"body-small\">\n {description}{' '}\n <Button\n variant=\"tertiary\"\n onPress={() => {\n setShown(false);\n }}\n >\n Show less\n </Button>\n </Text>\n );\n }\n return (\n <Text variant=\"body-small\">\n {description.substring(0, MAX_LENGTH)}...{' '}\n <Button\n variant=\"tertiary\"\n onPress={() => {\n setShown(true);\n }}\n >\n Show more\n </Button>\n </Text>\n );\n};\n"],"names":[],"mappings":";;;;AAmBA,MAAM,UAAA,GAAa,GAAA;AAEZ,MAAM,8BAAA,GAAiC,CAC5C,KAAA,KACG;AACH,EAAA,MAAM,EAAE,aAAY,GAAI,KAAA;AACxB,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,SAAS,KAAK,CAAA;AACxC,EAAA,MAAM,MAAA,GAAS,YAAY,MAAA,GAAS,UAAA;AAEpC,EAAA,IAAI,CAAC,MAAA,EAAQ;AACX,IAAA,uBAAO,GAAA,CAAC,IAAA,EAAA,EAAK,OAAA,EAAQ,YAAA,EAAc,QAAA,EAAA,WAAA,EAAY,CAAA;AAAA,EACjD;AAEA,EAAA,IAAI,KAAA,EAAO;AACT,IAAA,uBACE,IAAA,CAAC,IAAA,EAAA,EAAK,OAAA,EAAQ,YAAA,EACX,QAAA,EAAA;AAAA,MAAA,WAAA;AAAA,MAAa,GAAA;AAAA,sBACd,GAAA;AAAA,QAAC,MAAA;AAAA,QAAA;AAAA,UACC,OAAA,EAAQ,UAAA;AAAA,UACR,SAAS,MAAM;AACb,YAAA,QAAA,CAAS,KAAK,CAAA;AAAA,UAChB,CAAA;AAAA,UACD,QAAA,EAAA;AAAA;AAAA;AAED,KAAA,EACF,CAAA;AAAA,EAEJ;AACA,EAAA,uBACE,IAAA,CAAC,IAAA,EAAA,EAAK,OAAA,EAAQ,YAAA,EACX,QAAA,EAAA;AAAA,IAAA,WAAA,CAAY,SAAA,CAAU,GAAG,UAAU,CAAA;AAAA,IAAE,KAAA;AAAA,IAAI,GAAA;AAAA,oBAC1C,GAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,OAAA,EAAQ,UAAA;AAAA,QACR,SAAS,MAAM;AACb,UAAA,QAAA,CAAS,IAAI,CAAA;AAAA,QACf,CAAA;AAAA,QACD,QAAA,EAAA;AAAA;AAAA;AAED,GAAA,EACF,CAAA;AAEJ;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationDescription.esm.js","sources":["../../../src/components/NotificationsTable/NotificationDescription.tsx"],"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 */\nimport { createSwappableComponent } from '@backstage/frontend-plugin-api';\n\n/**\n * Props for the {@link NotificationDescription} swappable component.\n *\n * @public\n */\nexport interface NotificationDescriptionProps {\n /**\n * The plain-text description of the notification.\n */\n description: string;\n}\n\n/**\n * Swappable component that renders the description of a notification in the\n * notifications table. Apps can override this to customize how descriptions\n * are displayed.\n *\n * @public\n */\nexport const NotificationDescription =\n createSwappableComponent<NotificationDescriptionProps>({\n id: 'notifications.notification-description',\n loader: () =>\n import('./DefaultNotificationDescription').then(\n m => m.DefaultNotificationDescription,\n ),\n });\n"],"names":[],"mappings":";;AAoCO,MAAM,0BACX,wBAAA,CAAuD;AAAA,EACrD,EAAA,EAAI,wCAAA;AAAA,EACJ,MAAA,EAAQ,MACN,OAAO,yCAAkC,CAAA,CAAE,IAAA;AAAA,IACzC,OAAK,CAAA,CAAE;AAAA;AAEb,CAAC;;;;"}
1
+ {"version":3,"file":"NotificationDescription.esm.js","sources":["../../../src/components/NotificationsTable/NotificationDescription.tsx"],"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 */\nimport { createSwappableComponent } from '@backstage/frontend-plugin-api';\n\n/**\n * Props for the {@link NotificationDescription} swappable component.\n *\n * @public\n */\nexport interface NotificationDescriptionProps {\n /**\n * The plain-text description of the notification.\n */\n description: string;\n}\n\n/**\n * Swappable component that renders the description of a notification in the\n * notifications table. Apps can override this to customize how descriptions\n * are displayed.\n *\n * @public\n */\nexport const NotificationDescription =\n createSwappableComponent<NotificationDescriptionProps>({\n id: 'notifications.notification-description',\n loader: () =>\n import('./DefaultNotificationDescription').then(\n m => m.DefaultNotificationDescription,\n ),\n });\n"],"names":[],"mappings":";;AAoCO,MAAM,0BACX,wBAAA,CAAuD;AAAA,EACrD,EAAA,EAAI,wCAAA;AAAA,EACJ,MAAA,EAAQ,MACN,OAAO,yCAAkC,CAAA,CAAE,IAAA;AAAA,IACzC,OAAK,CAAA,CAAE;AAAA;AAEb,CAAC;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationIcon.esm.js","sources":["../../../src/components/NotificationsTable/NotificationIcon.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 { Notification } from '@backstage/plugin-notifications-common';\nimport { iconsApiRef, useApi } from '@backstage/frontend-plugin-api';\nimport { SeverityIcon } from './SeverityIcon';\n\nfunction NotificationIconWithCustomIcon({\n notification,\n}: {\n notification: Notification;\n}) {\n const iconsApi = useApi(iconsApiRef);\n const Icon = iconsApi.getIcon(notification.payload.icon!);\n if (Icon) {\n return <Icon />;\n }\n return <SeverityIcon severity={notification.payload.severity} />;\n}\n\nexport const NotificationIcon = ({\n notification,\n}: {\n notification: Notification;\n}) => {\n if (!notification.payload.icon) {\n return <SeverityIcon severity={notification.payload.severity} />;\n }\n\n return <NotificationIconWithCustomIcon notification={notification} />;\n};\n"],"names":[],"mappings":";;;;AAmBA,SAAS,8BAAA,CAA+B;AAAA,EACtC;AACF,CAAA,EAEG;AACD,EAAA,MAAM,QAAA,GAAW,OAAO,WAAW,CAAA;AACnC,EAAA,MAAM,IAAA,GAAO,QAAA,CAAS,OAAA,CAAQ,YAAA,CAAa,QAAQ,IAAK,CAAA;AACxD,EAAA,IAAI,IAAA,EAAM;AACR,IAAA,2BAAQ,IAAA,EAAA,EAAK,CAAA;AAAA,EACf;AACA,EAAA,uBAAO,GAAA,CAAC,YAAA,EAAA,EAAa,QAAA,EAAU,YAAA,CAAa,QAAQ,QAAA,EAAU,CAAA;AAChE;AAEO,MAAM,mBAAmB,CAAC;AAAA,EAC/B;AACF,CAAA,KAEM;AACJ,EAAA,IAAI,CAAC,YAAA,CAAa,OAAA,CAAQ,IAAA,EAAM;AAC9B,IAAA,uBAAO,GAAA,CAAC,YAAA,EAAA,EAAa,QAAA,EAAU,YAAA,CAAa,QAAQ,QAAA,EAAU,CAAA;AAAA,EAChE;AAEA,EAAA,uBAAO,GAAA,CAAC,kCAA+B,YAAA,EAA4B,CAAA;AACrE;;;;"}
1
+ {"version":3,"file":"NotificationIcon.esm.js","sources":["../../../src/components/NotificationsTable/NotificationIcon.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 { Notification } from '@backstage/plugin-notifications-common';\nimport { iconsApiRef, useApi } from '@backstage/frontend-plugin-api';\nimport { SeverityIcon } from './SeverityIcon';\n\nfunction NotificationIconWithCustomIcon({\n notification,\n}: {\n notification: Notification;\n}) {\n const iconsApi = useApi(iconsApiRef);\n const Icon = iconsApi.getIcon(notification.payload.icon!);\n if (Icon) {\n return <Icon />;\n }\n return <SeverityIcon severity={notification.payload.severity} />;\n}\n\nexport const NotificationIcon = ({\n notification,\n}: {\n notification: Notification;\n}) => {\n if (!notification.payload.icon) {\n return <SeverityIcon severity={notification.payload.severity} />;\n }\n\n return <NotificationIconWithCustomIcon notification={notification} />;\n};\n"],"names":[],"mappings":";;;;AAmBA,SAAS,8BAAA,CAA+B;AAAA,EACtC;AACF,CAAA,EAEG;AACD,EAAA,MAAM,QAAA,GAAW,OAAO,WAAW,CAAA;AACnC,EAAA,MAAM,IAAA,GAAO,QAAA,CAAS,OAAA,CAAQ,YAAA,CAAa,QAAQ,IAAK,CAAA;AACxD,EAAA,IAAI,IAAA,EAAM;AACR,IAAA,2BAAQ,IAAA,EAAA,EAAK,CAAA;AAAA,EACf;AACA,EAAA,uBAAO,GAAA,CAAC,YAAA,EAAA,EAAa,QAAA,EAAU,YAAA,CAAa,QAAQ,QAAA,EAAU,CAAA;AAChE;AAEO,MAAM,mBAAmB,CAAC;AAAA,EAC/B;AACF,CAAA,KAEM;AACJ,EAAA,IAAI,CAAC,YAAA,CAAa,OAAA,CAAQ,IAAA,EAAM;AAC9B,IAAA,uBAAO,GAAA,CAAC,YAAA,EAAA,EAAa,QAAA,EAAU,YAAA,CAAa,QAAQ,QAAA,EAAU,CAAA;AAAA,EAChE;AAEA,EAAA,uBAAO,GAAA,CAAC,kCAA+B,YAAA,EAA4B,CAAA;AACrE;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationsTable.esm.js","sources":["../../../src/components/NotificationsTable/NotificationsTable.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport throttle from 'lodash/throttle';\n// @ts-ignore\nimport RelativeTime from 'react-relative-time';\nimport { Notification } from '@backstage/plugin-notifications-common';\nimport {\n Button,\n Checkbox,\n Dialog,\n DialogBody,\n DialogFooter,\n DialogHeader,\n Flex,\n Text,\n} from '@backstage/ui';\nimport { RiRssFill } from '@remixicon/react';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { toastApiRef } from '@backstage/frontend-plugin-api';\nimport {\n Link,\n Table,\n TableColumn,\n TableProps,\n} from '@backstage/core-components';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { notificationsTranslationRef } from '../../translation';\n\nimport { notificationsApiRef } from '../../api';\nimport { SelectAll } from './SelectAll';\nimport { BulkActions } from './BulkActions';\nimport { NotificationIcon } from './NotificationIcon';\nimport { NotificationDescription } from './NotificationDescription';\n\nimport styles from './NotificationsTable.module.css';\n\nconst ThrottleDelayMs = 1000;\n\n/** @public */\nexport type NotificationsTableProps = Pick<\n TableProps,\n 'onPageChange' | 'onRowsPerPageChange' | 'page' | 'totalCount' | 'title'\n> & {\n markAsReadOnLinkOpen?: boolean;\n isLoading?: boolean;\n isUnread: boolean;\n notifications?: Notification[];\n highlightedNotificationId?: string;\n onUpdate: () => void;\n setContainsText: (search: string) => void;\n pageSize: number;\n};\n\n/** @public */\nexport const NotificationsTable = ({\n title,\n markAsReadOnLinkOpen,\n isLoading,\n notifications = [],\n highlightedNotificationId,\n isUnread,\n onUpdate,\n setContainsText,\n onPageChange,\n onRowsPerPageChange,\n page,\n pageSize,\n totalCount,\n}: NotificationsTableProps) => {\n const { t } = useTranslationRef(notificationsTranslationRef);\n const notificationsApi = useApi(notificationsApiRef);\n const toastApi = useApi(toastApiRef);\n const [confirmDialogOpen, setConfirmDialogOpen] = useState(false);\n\n const [selectedNotifications, setSelectedNotifications] = useState(\n new Set<Notification['id']>(),\n );\n\n const onNotificationsSelectChange = useCallback(\n (ids: Notification['id'][], checked: boolean) => {\n let newSelect: Set<Notification['id']>;\n if (checked) {\n newSelect = new Set([...selectedNotifications, ...ids]);\n } else {\n newSelect = new Set(selectedNotifications);\n ids.forEach(id => newSelect.delete(id));\n }\n setSelectedNotifications(newSelect);\n },\n [selectedNotifications, setSelectedNotifications],\n );\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 const doMarkAllRead = useCallback(async () => {\n setConfirmDialogOpen(false);\n try {\n const result = await notificationsApi.getNotifications({ read: false });\n const ids =\n result.notifications?.map(notification => notification.id) ?? [];\n if (ids.length === 0) return;\n await notificationsApi.updateNotifications({ ids, read: true });\n onUpdate();\n } catch {\n toastApi.post({\n title: t('table.errors.markAllReadFailed'),\n status: 'danger',\n });\n }\n }, [notificationsApi, onUpdate, toastApi, t]);\n\n const onMarkAllRead = useCallback(() => {\n setConfirmDialogOpen(true);\n }, []);\n\n const throttledContainsTextHandler = useMemo(\n () => throttle(setContainsText, ThrottleDelayMs),\n [setContainsText],\n );\n\n useEffect(() => {\n const allShownIds = new Set(notifications.map(n => n.id));\n const intersect = [...selectedNotifications].filter(id =>\n allShownIds.has(id),\n );\n if (selectedNotifications.size !== intersect.length) {\n setSelectedNotifications(new Set(intersect));\n }\n }, [notifications, selectedNotifications]);\n\n const focusedHighlightedIdRef = useRef<string | undefined>(undefined);\n\n useEffect(() => {\n if (!highlightedNotificationId) {\n focusedHighlightedIdRef.current = undefined;\n return;\n }\n\n // Only scroll/focus once per deep-linked id so refreshes don't steal focus.\n if (focusedHighlightedIdRef.current === highlightedNotificationId) {\n return;\n }\n\n const highlightedElement = document.getElementById(\n `notification-${highlightedNotificationId}`,\n );\n if (!highlightedElement) {\n return;\n }\n\n if (typeof highlightedElement.scrollIntoView === 'function') {\n highlightedElement.scrollIntoView({\n behavior: 'smooth',\n block: 'center',\n });\n }\n highlightedElement.focus({ preventScroll: true });\n focusedHighlightedIdRef.current = highlightedNotificationId;\n }, [highlightedNotificationId, notifications]);\n\n const compactColumns = useMemo((): TableColumn<Notification>[] => {\n const showToolbar = notifications.length > 0;\n return [\n {\n /* selection column */\n width: '1rem',\n cellStyle: { paddingRight: '2.5rem' },\n title: showToolbar ? (\n <SelectAll\n count={selectedNotifications.size}\n totalCount={notifications.length}\n onSelectAll={() =>\n onNotificationsSelectChange(\n notifications.map(notification => notification.id),\n selectedNotifications.size !== notifications.length,\n )\n }\n />\n ) : undefined,\n render: (notification: Notification) => (\n <Checkbox\n aria-label=\"Select notification\"\n isSelected={selectedNotifications.has(notification.id)}\n onChange={checked =>\n onNotificationsSelectChange([notification.id], checked)\n }\n />\n ),\n },\n {\n /* compact-data column */\n customFilterAndSearch: () =>\n true /* Keep sorting&filtering on backend due to pagination. */,\n cellStyle: { paddingLeft: 0 },\n render: (notification: Notification) => {\n const isHighlighted = highlightedNotificationId === notification.id;\n // Compact content\n return (\n <div\n id={`notification-${notification.id}`}\n tabIndex={isHighlighted ? -1 : undefined}\n className={\n isHighlighted ? styles.highlightedNotification : undefined\n }\n >\n <Flex gap=\"4\" align=\"center\">\n <div className={styles.severityItem}>\n <NotificationIcon notification={notification} />\n </div>\n <Flex direction=\"column\" gap=\"1\">\n <Text variant=\"body-medium\">\n {notification.payload.link ? (\n <Link\n to={notification.payload.link}\n onClick={() => {\n if (markAsReadOnLinkOpen && !notification.read) {\n onSwitchReadStatus([notification.id], true);\n }\n }}\n >\n {notification.payload.title}\n </Link>\n ) : (\n notification.payload.title\n )}\n </Text>\n {notification.payload.description ? (\n <NotificationDescription\n description={notification.payload.description}\n />\n ) : null}\n\n <Text variant=\"body-small\" color=\"secondary\">\n {!notification.user && (\n <RiRssFill size={14} className={styles.broadcastIcon} />\n )}\n {notification.origin && (\n <>\n <span className={styles.notificationInfoRow}>\n {notification.origin}\n </span>\n &bull;\n </>\n )}\n {notification.payload.topic && (\n <>\n <span className={styles.notificationInfoRow}>\n {notification.payload.topic}\n </span>\n &bull;\n </>\n )}\n {notification.created && (\n <RelativeTime\n value={notification.created}\n className={styles.notificationInfoRow}\n />\n )}\n </Text>\n </Flex>\n </Flex>\n </div>\n );\n },\n },\n {\n /* actions column */\n width: '1rem',\n title: showToolbar ? (\n <BulkActions\n notifications={notifications}\n selectedNotifications={selectedNotifications}\n isUnread={isUnread}\n onSwitchReadStatus={onSwitchReadStatus}\n onSwitchSavedStatus={onSwitchSavedStatus}\n onMarkAllRead={onMarkAllRead}\n />\n ) : undefined,\n render: (notification: Notification) => (\n <BulkActions\n notifications={[notification]}\n selectedNotifications={new Set([notification.id])}\n onSwitchReadStatus={onSwitchReadStatus}\n onSwitchSavedStatus={onSwitchSavedStatus}\n />\n ),\n },\n ];\n }, [\n notifications,\n selectedNotifications,\n isUnread,\n onSwitchReadStatus,\n onSwitchSavedStatus,\n onMarkAllRead,\n onNotificationsSelectChange,\n markAsReadOnLinkOpen,\n highlightedNotificationId,\n ]);\n\n return (\n <>\n <Table<Notification>\n isLoading={isLoading}\n options={{\n padding: 'dense',\n search: true,\n paging: true,\n pageSize,\n header: true,\n sorting: false,\n }}\n title={title}\n onPageChange={onPageChange}\n onRowsPerPageChange={onRowsPerPageChange}\n page={page}\n totalCount={totalCount}\n onSearchChange={throttledContainsTextHandler}\n data={notifications}\n columns={compactColumns}\n localization={{\n body: {\n emptyDataSourceMessage: t('table.emptyMessage'),\n },\n pagination: {\n firstTooltip: t('table.pagination.firstTooltip'),\n labelDisplayedRows: t('table.pagination.labelDisplayedRows'),\n labelRowsSelect: t('table.pagination.labelRowsSelect'),\n lastTooltip: t('table.pagination.lastTooltip'),\n nextTooltip: t('table.pagination.nextTooltip'),\n previousTooltip: t('table.pagination.previousTooltip'),\n },\n }}\n />\n <Dialog\n isOpen={confirmDialogOpen}\n onOpenChange={setConfirmDialogOpen}\n isDismissable\n >\n <DialogHeader>{t('table.confirmDialog.title')}</DialogHeader>\n <DialogBody>\n <Text variant=\"body-medium\">\n {t('table.confirmDialog.markAllReadDescription')}\n </Text>\n </DialogBody>\n <DialogFooter>\n <Button variant=\"primary\" onPress={doMarkAllRead}>\n {t('table.confirmDialog.markAllReadConfirmation')}\n </Button>\n <Button variant=\"secondary\" slot=\"close\">\n {t('table.confirmDialog.cancel')}\n </Button>\n </DialogFooter>\n </Dialog>\n </>\n );\n};\n"],"names":[],"mapp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AAE,8BAA8B,CAAA;AAAA,YAC7C,WAAA,EAAa,EAAE,8BAA8B,CAAA;AAAA,YAC7C,eAAA,EAAiB,EAAE,kCAAkC;AAAA;AACvD;AACF;AAAA,KACF;AAAA,oBACA,IAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,MAAA,EAAQ,iBAAA;AAAA,QACR,YAAA,EAAc,oBAAA;AAAA,QACd,aAAA,EAAa,IAAA;AAAA,QAEb,QAAA,EAAA;AAAA,0BAAA,GAAA,CAAC,YAAA,EAAA,EAAc,QAAA,EAAA,CAAA,CAAE,2BAA2B,CAAA,EAAE,CAAA;AAAA,0BAC9C,GAAA,CAAC,cACC,QAAA,kBAAA,GAAA,CAAC,IAAA,EAAA,EAAK,SAAQ,aAAA,EACX,QAAA,EAAA,CAAA,CAAE,4CAA4C,CAAA,EACjD,CAAA,EACF,CAAA;AAAA,+BACC,YAAA,EAAA,EACC,QAAA,EAAA;AAAA,4BAAA,GAAA,CAAC,UAAO,OAAA,EAAQ,SAAA,EAAU,SAAS,aAAA,EAChC,QAAA,EAAA,CAAA,CAAE,6CAA6C,CAAA,EAClD,CAAA;AAAA,4BACA,GAAA,CAAC,UAAO,OAAA,EAAQ,WAAA,EAAY,MAAK,OAAA,EAC9B,QAAA,EAAA,CAAA,CAAE,4BAA4B,CAAA,EACjC;AAAA,WAAA,EACF;AAAA;AAAA;AAAA;AACF,GAAA,EACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"NotificationsTable.esm.js","sources":["../../../src/components/NotificationsTable/NotificationsTable.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport throttle from 'lodash/throttle';\n// @ts-ignore\nimport RelativeTime from 'react-relative-time';\nimport { Notification } from '@backstage/plugin-notifications-common';\nimport {\n Button,\n Checkbox,\n Dialog,\n DialogBody,\n DialogFooter,\n DialogHeader,\n Flex,\n Text,\n} from '@backstage/ui';\nimport { RiRssFill } from '@remixicon/react';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { toastApiRef } from '@backstage/frontend-plugin-api';\nimport {\n Link,\n Table,\n TableColumn,\n TableProps,\n} from '@backstage/core-components';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { notificationsTranslationRef } from '../../translation';\n\nimport { notificationsApiRef } from '../../api';\nimport { SelectAll } from './SelectAll';\nimport { BulkActions } from './BulkActions';\nimport { NotificationIcon } from './NotificationIcon';\nimport { NotificationDescription } from './NotificationDescription';\n\nimport styles from './NotificationsTable.module.css';\n\nconst ThrottleDelayMs = 1000;\n\n/** @public */\nexport type NotificationsTableProps = Pick<\n TableProps,\n 'onPageChange' | 'onRowsPerPageChange' | 'page' | 'totalCount' | 'title'\n> & {\n markAsReadOnLinkOpen?: boolean;\n isLoading?: boolean;\n isUnread: boolean;\n notifications?: Notification[];\n highlightedNotificationId?: string;\n onUpdate: () => void;\n setContainsText: (search: string) => void;\n pageSize: number;\n};\n\n/** @public */\nexport const NotificationsTable = ({\n title,\n markAsReadOnLinkOpen,\n isLoading,\n notifications = [],\n highlightedNotificationId,\n isUnread,\n onUpdate,\n setContainsText,\n onPageChange,\n onRowsPerPageChange,\n page,\n pageSize,\n totalCount,\n}: NotificationsTableProps) => {\n const { t } = useTranslationRef(notificationsTranslationRef);\n const notificationsApi = useApi(notificationsApiRef);\n const toastApi = useApi(toastApiRef);\n const [confirmDialogOpen, setConfirmDialogOpen] = useState(false);\n\n const [selectedNotifications, setSelectedNotifications] = useState(\n new Set<Notification['id']>(),\n );\n\n const onNotificationsSelectChange = useCallback(\n (ids: Notification['id'][], checked: boolean) => {\n let newSelect: Set<Notification['id']>;\n if (checked) {\n newSelect = new Set([...selectedNotifications, ...ids]);\n } else {\n newSelect = new Set(selectedNotifications);\n ids.forEach(id => newSelect.delete(id));\n }\n setSelectedNotifications(newSelect);\n },\n [selectedNotifications, setSelectedNotifications],\n );\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 const doMarkAllRead = useCallback(async () => {\n setConfirmDialogOpen(false);\n try {\n const result = await notificationsApi.getNotifications({ read: false });\n const ids =\n result.notifications?.map(notification => notification.id) ?? [];\n if (ids.length === 0) return;\n await notificationsApi.updateNotifications({ ids, read: true });\n onUpdate();\n } catch {\n toastApi.post({\n title: t('table.errors.markAllReadFailed'),\n status: 'danger',\n });\n }\n }, [notificationsApi, onUpdate, toastApi, t]);\n\n const onMarkAllRead = useCallback(() => {\n setConfirmDialogOpen(true);\n }, []);\n\n const throttledContainsTextHandler = useMemo(\n () => throttle(setContainsText, ThrottleDelayMs),\n [setContainsText],\n );\n\n useEffect(() => {\n const allShownIds = new Set(notifications.map(n => n.id));\n const intersect = [...selectedNotifications].filter(id =>\n allShownIds.has(id),\n );\n if (selectedNotifications.size !== intersect.length) {\n setSelectedNotifications(new Set(intersect));\n }\n }, [notifications, selectedNotifications]);\n\n const focusedHighlightedIdRef = useRef<string | undefined>(undefined);\n\n useEffect(() => {\n if (!highlightedNotificationId) {\n focusedHighlightedIdRef.current = undefined;\n return;\n }\n\n // Only scroll/focus once per deep-linked id so refreshes don't steal focus.\n if (focusedHighlightedIdRef.current === highlightedNotificationId) {\n return;\n }\n\n const highlightedElement = document.getElementById(\n `notification-${highlightedNotificationId}`,\n );\n if (!highlightedElement) {\n return;\n }\n\n if (typeof highlightedElement.scrollIntoView === 'function') {\n highlightedElement.scrollIntoView({\n behavior: 'smooth',\n block: 'center',\n });\n }\n highlightedElement.focus({ preventScroll: true });\n focusedHighlightedIdRef.current = highlightedNotificationId;\n }, [highlightedNotificationId, notifications]);\n\n const compactColumns = useMemo((): TableColumn<Notification>[] => {\n const showToolbar = notifications.length > 0;\n return [\n {\n /* selection column */\n width: '1rem',\n cellStyle: { paddingRight: '2.5rem' },\n title: showToolbar ? (\n <SelectAll\n count={selectedNotifications.size}\n totalCount={notifications.length}\n onSelectAll={() =>\n onNotificationsSelectChange(\n notifications.map(notification => notification.id),\n selectedNotifications.size !== notifications.length,\n )\n }\n />\n ) : undefined,\n render: (notification: Notification) => (\n <Checkbox\n aria-label=\"Select notification\"\n isSelected={selectedNotifications.has(notification.id)}\n onChange={checked =>\n onNotificationsSelectChange([notification.id], checked)\n }\n />\n ),\n },\n {\n /* compact-data column */\n customFilterAndSearch: () =>\n true /* Keep sorting&filtering on backend due to pagination. */,\n cellStyle: { paddingLeft: 0 },\n render: (notification: Notification) => {\n const isHighlighted = highlightedNotificationId === notification.id;\n // Compact content\n return (\n <div\n id={`notification-${notification.id}`}\n tabIndex={isHighlighted ? -1 : undefined}\n className={\n isHighlighted ? styles.highlightedNotification : undefined\n }\n >\n <Flex gap=\"4\" align=\"center\">\n <div className={styles.severityItem}>\n <NotificationIcon notification={notification} />\n </div>\n <Flex direction=\"column\" gap=\"1\">\n <Text variant=\"body-medium\">\n {notification.payload.link ? (\n <Link\n to={notification.payload.link}\n onClick={() => {\n if (markAsReadOnLinkOpen && !notification.read) {\n onSwitchReadStatus([notification.id], true);\n }\n }}\n >\n {notification.payload.title}\n </Link>\n ) : (\n notification.payload.title\n )}\n </Text>\n {notification.payload.description ? (\n <NotificationDescription\n description={notification.payload.description}\n />\n ) : null}\n\n <Text variant=\"body-small\" color=\"secondary\">\n {!notification.user && (\n <RiRssFill size={14} className={styles.broadcastIcon} />\n )}\n {notification.origin && (\n <>\n <span className={styles.notificationInfoRow}>\n {notification.origin}\n </span>\n &bull;\n </>\n )}\n {notification.payload.topic && (\n <>\n <span className={styles.notificationInfoRow}>\n {notification.payload.topic}\n </span>\n &bull;\n </>\n )}\n {notification.created && (\n <RelativeTime\n value={notification.created}\n className={styles.notificationInfoRow}\n />\n )}\n </Text>\n </Flex>\n </Flex>\n </div>\n );\n },\n },\n {\n /* actions column */\n width: '1rem',\n title: showToolbar ? (\n <BulkActions\n notifications={notifications}\n selectedNotifications={selectedNotifications}\n isUnread={isUnread}\n onSwitchReadStatus={onSwitchReadStatus}\n onSwitchSavedStatus={onSwitchSavedStatus}\n onMarkAllRead={onMarkAllRead}\n />\n ) : undefined,\n render: (notification: Notification) => (\n <BulkActions\n notifications={[notification]}\n selectedNotifications={new Set([notification.id])}\n onSwitchReadStatus={onSwitchReadStatus}\n onSwitchSavedStatus={onSwitchSavedStatus}\n />\n ),\n },\n ];\n }, [\n notifications,\n selectedNotifications,\n isUnread,\n onSwitchReadStatus,\n onSwitchSavedStatus,\n onMarkAllRead,\n onNotificationsSelectChange,\n markAsReadOnLinkOpen,\n highlightedNotificationId,\n ]);\n\n return (\n <>\n <Table<Notification>\n isLoading={isLoading}\n options={{\n padding: 'dense',\n search: true,\n paging: true,\n pageSize,\n header: true,\n sorting: false,\n }}\n title={title}\n onPageChange={onPageChange}\n onRowsPerPageChange={onRowsPerPageChange}\n page={page}\n totalCount={totalCount}\n onSearchChange={throttledContainsTextHandler}\n data={notifications}\n columns={compactColumns}\n localization={{\n body: {\n emptyDataSourceMessage: t('table.emptyMessage'),\n },\n pagination: {\n firstTooltip: t('table.pagination.firstTooltip'),\n labelDisplayedRows: t('table.pagination.labelDisplayedRows'),\n labelRowsSelect: t('table.pagination.labelRowsSelect'),\n lastTooltip: t('table.pagination.lastTooltip'),\n nextTooltip: t('table.pagination.nextTooltip'),\n previousTooltip: t('table.pagination.previousTooltip'),\n },\n }}\n />\n <Dialog\n isOpen={confirmDialogOpen}\n onOpenChange={setConfirmDialogOpen}\n isDismissable\n >\n <DialogHeader>{t('table.confirmDialog.title')}</DialogHeader>\n <DialogBody>\n <Text variant=\"body-medium\">\n {t('table.confirmDialog.markAllReadDescription')}\n </Text>\n </DialogBody>\n <DialogFooter>\n <Button variant=\"primary\" onPress={doMarkAllRead}>\n {t('table.confirmDialog.markAllReadConfirmation')}\n </Button>\n <Button variant=\"secondary\" slot=\"close\">\n {t('table.confirmDialog.cancel')}\n </Button>\n </DialogFooter>\n </Dialog>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAkDA,MAAM,eAAA,GAAkB,GAAA;AAkBjB,MAAM,qBAAqB,CAAC;AAAA,EACjC,KAAA;AAAA,EACA,oBAAA;AAAA,EACA,SAAA;AAAA,EACA,gBAAgB,EAAC;AAAA,EACjB,yBAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,eAAA;AAAA,EACA,YAAA;AAAA,EACA,mBAAA;AAAA,EACA,IAAA;AAAA,EACA,QAAA;AAAA,EACA;AACF,CAAA,KAA+B;AAC7B,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,2BAA2B,CAAA;AAC3D,EAAA,MAAM,gBAAA,GAAmB,OAAO,mBAAmB,CAAA;AACnD,EAAA,MAAM,QAAA,GAAW,OAAO,WAAW,CAAA;AACnC,EAAA,MAAM,CAAC,iBAAA,EAAmB,oBAAoB,CAAA,GAAI,SAAS,KAAK,CAAA;AAEhE,EAAA,MAAM,CAAC,qBAAA,EAAuB,wBAAwB,CAAA,GAAI,QAAA;AAAA,wBACpD,GAAA;AAAwB,GAC9B;AAEA,EAAA,MAAM,2BAAA,GAA8B,WAAA;AAAA,IAClC,CAAC,KAA2B,OAAA,KAAqB;AAC/C,MAAA,IAAI,SAAA;AACJ,MAAA,IAAI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CAAE,4BAA4B,CAAA,EACjC;AAAA,WAAA,EACF;AAAA;AAAA;AAAA;AACF,GAAA,EACF,CAAA;AAEJ;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationsTable.module.css.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
1
+ {"version":3,"file":"NotificationsTable.module.css.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}