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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/dist/alpha/extensions/unreadNotificationsHomeWidget.esm.js +57 -0
  3. package/dist/alpha/extensions/unreadNotificationsHomeWidget.esm.js.map +1 -0
  4. package/dist/alpha.d.ts +17 -0
  5. package/dist/alpha.esm.js +2 -1
  6. package/dist/alpha.esm.js.map +1 -1
  7. package/dist/api/NotificationsApi.esm.js.map +1 -1
  8. package/dist/api/NotificationsClient.esm.js.map +1 -1
  9. package/dist/components/NotificationsFilters/NotificationsFilters.esm.js.map +1 -1
  10. package/dist/components/NotificationsPage/NotificationsPage.esm.js +48 -4
  11. package/dist/components/NotificationsPage/NotificationsPage.esm.js.map +1 -1
  12. package/dist/components/NotificationsPage/index.esm.js +1 -1
  13. package/dist/components/NotificationsSideBarItem/NotificationsSideBarItem.esm.js +1 -1
  14. package/dist/components/NotificationsSideBarItem/NotificationsSideBarItem.esm.js.map +1 -1
  15. package/dist/components/NotificationsSideBarItem/NotificationsSideBarItem.module.css.esm.js.map +1 -1
  16. package/dist/components/NotificationsTable/BulkActions.esm.js.map +1 -1
  17. package/dist/components/NotificationsTable/DefaultNotificationDescription.esm.js.map +1 -1
  18. package/dist/components/NotificationsTable/NotificationDescription.esm.js.map +1 -1
  19. package/dist/components/NotificationsTable/NotificationIcon.esm.js +14 -8
  20. package/dist/components/NotificationsTable/NotificationIcon.esm.js.map +1 -1
  21. package/dist/components/NotificationsTable/NotificationsTable.esm.js +76 -41
  22. package/dist/components/NotificationsTable/NotificationsTable.esm.js.map +1 -1
  23. package/dist/components/NotificationsTable/NotificationsTable.module.css.esm.js +2 -2
  24. package/dist/components/NotificationsTable/NotificationsTable.module.css.esm.js.map +1 -1
  25. package/dist/components/NotificationsTable/SelectAll.esm.js.map +1 -1
  26. package/dist/components/NotificationsTable/SelectAll.module.css.esm.js.map +1 -1
  27. package/dist/components/NotificationsTable/SeverityIcon.esm.js.map +1 -1
  28. package/dist/components/NotificationsTable/SeverityIcon.module.css.esm.js.map +1 -1
  29. package/dist/components/UnreadNotificationsCard/UnreadNotificationsCard.esm.js +255 -0
  30. package/dist/components/UnreadNotificationsCard/UnreadNotificationsCard.esm.js.map +1 -0
  31. package/dist/components/UnreadNotificationsCard/UnreadNotificationsCard.module.css.esm.js +8 -0
  32. package/dist/components/UnreadNotificationsCard/UnreadNotificationsCard.module.css.esm.js.map +1 -0
  33. package/dist/components/UnreadNotificationsCard/index.esm.js +7 -0
  34. package/dist/components/UnreadNotificationsCard/index.esm.js.map +1 -0
  35. package/dist/components/UserNotificationSettingsCard/NoBorderTableCell.esm.js.map +1 -1
  36. package/dist/components/UserNotificationSettingsCard/NoBorderTableCell.module.css.esm.js.map +1 -1
  37. package/dist/components/UserNotificationSettingsCard/NotificationFormatContext.esm.js.map +1 -1
  38. package/dist/components/UserNotificationSettingsCard/OriginRow.esm.js +3 -3
  39. package/dist/components/UserNotificationSettingsCard/OriginRow.esm.js.map +1 -1
  40. package/dist/components/UserNotificationSettingsCard/TopicRow.esm.js +1 -3
  41. package/dist/components/UserNotificationSettingsCard/TopicRow.esm.js.map +1 -1
  42. package/dist/components/UserNotificationSettingsCard/UserNotificationSettingsCard.esm.js +1 -0
  43. package/dist/components/UserNotificationSettingsCard/UserNotificationSettingsCard.esm.js.map +1 -1
  44. package/dist/components/UserNotificationSettingsCard/UserNotificationSettingsPanel.esm.js.map +1 -1
  45. package/dist/components/UserNotificationSettingsCard/UserNotificationSettingsPanel.module.css.esm.js.map +1 -1
  46. package/dist/hooks/useNotificationsApi.esm.js.map +1 -1
  47. package/dist/hooks/useNotificationsRefresh.esm.js +24 -0
  48. package/dist/hooks/useNotificationsRefresh.esm.js.map +1 -0
  49. package/dist/hooks/useTitleCounter.esm.js.map +1 -1
  50. package/dist/hooks/useWebNotifications.esm.js.map +1 -1
  51. package/dist/index.d.ts +9 -1
  52. package/dist/index.esm.js +1 -0
  53. package/dist/index.esm.js.map +1 -1
  54. package/dist/node_modules_dist/style-inject/dist/style-inject.es.esm.js.map +1 -1
  55. package/dist/plugin.esm.js.map +1 -1
  56. package/dist/plugins/notifications/package.json.esm.js +2 -1
  57. package/dist/plugins/notifications/package.json.esm.js.map +1 -1
  58. package/dist/routes.esm.js.map +1 -1
  59. package/dist/translation.esm.js +9 -0
  60. package/dist/translation.esm.js.map +1 -1
  61. package/dist/utils/notificationLinks.esm.js +11 -0
  62. package/dist/utils/notificationLinks.esm.js.map +1 -0
  63. package/dist/utils/plainText.esm.js +30 -0
  64. package/dist/utils/plainText.esm.js.map +1 -0
  65. package/package.json +13 -12
package/CHANGELOG.md CHANGED
@@ -1,5 +1,37 @@
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
+
16
+ ## 0.6.0
17
+
18
+ ### Minor Changes
19
+
20
+ - cd4a9c7: Added an unread notifications home page card and NFS home widget.
21
+
22
+ ### Patch Changes
23
+
24
+ - 736d84e: Use locale-insensitive Unicode casing for consistent string handling across environments.
25
+ - b31afcf: Fixed circular dependency warnings when building the notification settings UI.
26
+ - Updated dependencies
27
+ - @backstage/core-components@0.18.14
28
+ - @backstage/ui@0.18.0
29
+ - @backstage/frontend-plugin-api@0.18.1
30
+ - @backstage/plugin-home-react@0.1.42
31
+ - @backstage/core-plugin-api@1.12.10
32
+ - @backstage/plugin-notifications-common@0.2.4
33
+ - @backstage/plugin-signals-react@0.0.26
34
+
3
35
  ## 0.5.21-next.2
4
36
 
5
37
  ### Patch Changes
@@ -0,0 +1,57 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { HomePageWidgetBlueprint } from '@backstage/plugin-home-react/alpha';
3
+
4
+ const defaultCardLayout = {
5
+ width: {
6
+ minColumns: 4,
7
+ maxColumns: 12,
8
+ defaultColumns: 6
9
+ },
10
+ height: {
11
+ minRows: 5,
12
+ maxRows: 14,
13
+ defaultRows: 10
14
+ }
15
+ };
16
+ function BorderlessHomeWidgetRenderer({ Content }) {
17
+ return /* @__PURE__ */ jsx(Content, {});
18
+ }
19
+ const unreadNotificationsHomeWidget = HomePageWidgetBlueprint.make({
20
+ name: "unread-notifications",
21
+ params: {
22
+ name: "UnreadNotifications",
23
+ description: "Shows the latest unread notifications",
24
+ layout: defaultCardLayout,
25
+ componentProps: {
26
+ Renderer: BorderlessHomeWidgetRenderer
27
+ },
28
+ components: () => import('../../components/UnreadNotificationsCard/index.esm.js').then((m) => ({
29
+ Content: m.UnreadNotificationsCardWithProvider
30
+ })),
31
+ settings: {
32
+ schema: {
33
+ title: "Unread notifications",
34
+ type: "object",
35
+ properties: {
36
+ maxMessages: {
37
+ title: "Maximum messages",
38
+ type: "number",
39
+ default: 5,
40
+ minimum: 1,
41
+ maximum: 20
42
+ },
43
+ charLimit: {
44
+ title: "Title character limit",
45
+ type: "number",
46
+ default: 80,
47
+ minimum: 20,
48
+ maximum: 200
49
+ }
50
+ }
51
+ }
52
+ }
53
+ }
54
+ });
55
+
56
+ export { unreadNotificationsHomeWidget };
57
+ //# sourceMappingURL=unreadNotificationsHomeWidget.esm.js.map
@@ -0,0 +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,EAAO;AAAA,IACL,UAAA,EAAY,CAAA;AAAA,IACZ,UAAA,EAAY,EAAA;AAAA,IACZ,cAAA,EAAgB;AAAA,GAClB;AAAA,EACA,MAAA,EAAQ;AAAA,IACN,OAAA,EAAS,CAAA;AAAA,IACT,OAAA,EAAS,EAAA;AAAA,IACT,WAAA,EAAa;AAAA;AAEjB,CAAA;AAEA,SAAS,4BAAA,CAA6B,EAAE,OAAA,EAAQ,EAAkB;AAChE,EAAA,2BAAQ,OAAA,EAAA,EAAQ,CAAA;AAClB;AAOO,MAAM,6BAAA,GAAgC,wBAAwB,IAAA,CAAK;AAAA,EACxE,IAAA,EAAM,sBAAA;AAAA,EACN,MAAA,EAAQ;AAAA,IACN,IAAA,EAAM,qBAAA;AAAA,IACN,WAAA,EAAa,uCAAA;AAAA,IACb,MAAA,EAAQ,iBAAA;AAAA,IACR,cAAA,EAAgB;AAAA,MACd,QAAA,EAAU;AAAA,KACZ;AAAA,IACA,YAAY,MACV,OAAO,uDAA0C,CAAA,CAAE,KAAK,CAAA,CAAA,MAAM;AAAA,MAC5D,SAAS,CAAA,CAAE;AAAA,KACb,CAAE,CAAA;AAAA,IACJ,QAAA,EAAU;AAAA,MACR,MAAA,EAAQ;AAAA,QACN,KAAA,EAAO,sBAAA;AAAA,QACP,IAAA,EAAM,QAAA;AAAA,QACN,UAAA,EAAY;AAAA,UACV,WAAA,EAAa;AAAA,YACX,KAAA,EAAO,kBAAA;AAAA,YACP,IAAA,EAAM,QAAA;AAAA,YACN,OAAA,EAAS,CAAA;AAAA,YACT,OAAA,EAAS,CAAA;AAAA,YACT,OAAA,EAAS;AAAA,WACX;AAAA,UACA,SAAA,EAAW;AAAA,YACT,KAAA,EAAO,uBAAA;AAAA,YACP,IAAA,EAAM,QAAA;AAAA,YACN,OAAA,EAAS,EAAA;AAAA,YACT,OAAA,EAAS,EAAA;AAAA,YACT,OAAA,EAAS;AAAA;AACX;AACF;AACF;AACF;AAEJ,CAAC;;"}
package/dist/alpha.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import * as react from 'react';
2
+ import * as _backstage_plugin_home_react_alpha from '@backstage/plugin-home-react/alpha';
2
3
  import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
3
4
  import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
4
5
 
@@ -15,6 +16,15 @@ declare const _default: _backstage_frontend_plugin_api.OverridableFrontendPlugin
15
16
  inputs: {};
16
17
  params: <TApi, TImpl extends TApi, TDeps extends { [name in string]: unknown; }>(params: _backstage_frontend_plugin_api.ApiFactory<TApi, TImpl, TDeps>) => _backstage_frontend_plugin_api.ExtensionBlueprintParams<_backstage_frontend_plugin_api.AnyApiFactory>;
17
18
  }>;
19
+ "home-page-widget:notifications/unread-notifications": _backstage_frontend_plugin_api.OverridableExtensionDefinition<{
20
+ kind: "home-page-widget";
21
+ name: "unread-notifications";
22
+ config: {};
23
+ configInput: {};
24
+ output: _backstage_frontend_plugin_api.ExtensionDataRef<_backstage_plugin_home_react_alpha.HomePageWidgetData, "home.widget.data", {}>;
25
+ inputs: {};
26
+ params: _backstage_plugin_home_react_alpha.HomePageWidgetBlueprintParams;
27
+ }>;
18
28
  "page:notifications": _backstage_frontend_plugin_api.OverridableExtensionDefinition<{
19
29
  kind: "page";
20
30
  name: undefined;
@@ -121,6 +131,13 @@ declare const notificationsTranslationRef: _backstage_frontend_plugin_api.Transl
121
131
  readonly "notificationsPage.tableTitle.unread_other": "Unread notifications ({{count}})";
122
132
  readonly "notificationsPage.tableTitle.read_one": "Read notifications ({{count}})";
123
133
  readonly "notificationsPage.tableTitle.read_other": "Read notifications ({{count}})";
134
+ readonly "unreadCard.emptyState": "All caught up!";
135
+ readonly "unreadCard.title_one": "Last unread notifications ({{count}})";
136
+ readonly "unreadCard.title_other": "Last unread notifications ({{count}})";
137
+ readonly "unreadCard.viewAll": "View All";
138
+ readonly "unreadCard.columnNotification": "Notification";
139
+ readonly "unreadCard.columnActions": "Actions";
140
+ readonly "unreadCard.resultsCount": "{{displayed}} results out of {{total}}";
124
141
  }>;
125
142
 
126
143
  export { _default as default, notificationsTranslationRef };
package/dist/alpha.esm.js CHANGED
@@ -4,6 +4,7 @@ import { RiNotification3Line } from '@remixicon/react';
4
4
  import { rootRouteRef } from './routes.esm.js';
5
5
  import { notificationsApiRef } from './api/NotificationsApi.esm.js';
6
6
  import { NotificationsClient } from './api/NotificationsClient.esm.js';
7
+ import { unreadNotificationsHomeWidget } from './alpha/extensions/unreadNotificationsHomeWidget.esm.js';
7
8
  import { notificationsTranslationRef as notificationsTranslationRef$1 } from './translation.esm.js';
8
9
 
9
10
  const page = PageBlueprint.make({
@@ -29,7 +30,7 @@ var alpha = createFrontendPlugin({
29
30
  root: rootRouteRef
30
31
  },
31
32
  // TODO(Rugvip): Nav item (i.e. NotificationsSidebarItem) currently needs to be installed manually
32
- extensions: [page, api]
33
+ extensions: [page, api, unreadNotificationsHomeWidget]
33
34
  });
34
35
  const notificationsTranslationRef = notificationsTranslationRef$1;
35
36
 
@@ -1 +1 @@
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';\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],\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":";;;;;;;;AA2BA,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,GAAG;AACxB,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,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,CAAO,QAAA,CAAS,EAAE,CAAC,CAAA;AAAA,IAC1D;AACA,IAAA,IAAI,OAAA,EAAS,SAAS,MAAA,EAAW;AAC/B,MAAA,WAAA,CAAY,MAAA;AAAA,QACV,YAAA;AAAA,QACA,GAAG,OAAA,CAAQ,IAAI,CAAA,CAAA,EAAI,OAAA,EAAS,aAAa,MAAM,CAAA;AAAA,OACjD;AAAA,IACF;AAEA,IAAA,IAAA,CAAK,wBAAA,CAAyB,aAAa,OAAO,CAAA;AAElD,IAAA,IAAI,OAAA,EAAS,UAAU,MAAA,EAAW;AAChC,MAAA,WAAA,CAAY,MAAA,CAAO,OAAA,EAAS,OAAA,CAAQ,KAAK,CAAA;AAAA,IAC3C;AAEA,IAAA,OAAO,MAAM,IAAA,CAAK,OAAA;AAAA,MAChB,kBAAkB,WAAW,CAAA;AAAA,KAC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],"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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A,WAAA,CAAY,MAAA,CAAO,OAAA,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 +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,CAA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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;AAEO,MAAM,aAAA,GAAgB;AAAA,EAC3B,MAAA,EAAQ;AAAA,IACN,QAAA,EAAU,uBAAA;AAAA,IACV,MAAA,EAAQ;AAAA,MACN,IAAA,EAAM,SAAA;AAAA,MACN,SAAA,EAAW;AAAA;AACb,GACF;AAAA,EACA,MAAA,EAAQ;AAAA,IACN,QAAA,EAAU,uBAAA;AAAA,IACV,MAAA,EAAQ;AAAA,MACN,IAAA,EAAM,SAAA;AAAA,MACN,SAAA,EAAW;AAAA;AACb,GACF;AAAA,EACA,KAAA,EAAO;AAAA,IACL,QAAA,EAAU,sBAAA;AAAA,IACV,MAAA,EAAQ;AAAA,MACN,IAAA,EAAM,OAAA;AAAA,MACN,SAAA,EAAW;AAAA;AACb,GACF;AAAA,EACA,MAAA,EAAQ;AAAA,IAC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,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;;"}
@@ -5,6 +5,7 @@ import { ResponseErrorPanel, Content, PageWithHeader } from '@backstage/core-com
5
5
  import { Grid } from '@backstage/ui';
6
6
  import { useSignal } from '@backstage/plugin-signals-react';
7
7
  import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
8
+ import { useSearchParams } from 'react-router-dom';
8
9
  import { notificationsTranslationRef } from '../../translation.esm.js';
9
10
  import { NotificationsTable } from '../NotificationsTable/NotificationsTable.esm.js';
10
11
  import '../NotificationsTable/NotificationDescription.esm.js';
@@ -14,7 +15,7 @@ import '../../api/NotificationsApi.esm.js';
14
15
  import '@backstage/errors';
15
16
  import '../../routes.esm.js';
16
17
  import '../../hooks/useTitleCounter.esm.js';
17
- import { SortByOptions, NotificationsFilters, CreatedAfterOptions } from '../NotificationsFilters/NotificationsFilters.esm.js';
18
+ import { SortByOptions, CreatedAfterOptions, NotificationsFilters } from '../NotificationsFilters/NotificationsFilters.esm.js';
18
19
 
19
20
  const TableTitleKeys = {
20
21
  all: "notificationsPage.tableTitle.all",
@@ -37,6 +38,9 @@ function NotificationsPageContent(props) {
37
38
  } = props;
38
39
  const [refresh, setRefresh] = useState(false);
39
40
  const { lastSignal } = useSignal("notifications");
41
+ const [searchParams] = useSearchParams();
42
+ const highlightedNotificationId = searchParams.get("id") || void 0;
43
+ const [highlightedNotification, setHighlightedNotification] = useState();
40
44
  const [unreadOnly, setUnreadOnly] = useState(true);
41
45
  const [saved, setSaved] = useState(void 0);
42
46
  const [pageNumber, setPageNumber] = useState(0);
@@ -101,13 +105,52 @@ function NotificationsPageContent(props) {
101
105
  throttledSetRefresh(true);
102
106
  }
103
107
  }, [lastSignal, throttledSetRefresh]);
108
+ useEffect(() => {
109
+ if (!highlightedNotificationId) {
110
+ setHighlightedNotification(void 0);
111
+ return;
112
+ }
113
+ setPageNumber(0);
114
+ }, [highlightedNotificationId]);
115
+ const { value: fetchedHighlightedNotification } = useNotificationsApi(
116
+ (api) => {
117
+ if (!highlightedNotificationId) {
118
+ return Promise.resolve(void 0);
119
+ }
120
+ return api.getNotification(highlightedNotificationId);
121
+ },
122
+ [highlightedNotificationId]
123
+ );
124
+ useEffect(() => {
125
+ if (!fetchedHighlightedNotification) {
126
+ return;
127
+ }
128
+ setHighlightedNotification(fetchedHighlightedNotification);
129
+ if (!fetchedHighlightedNotification.read) {
130
+ setUnreadOnly(true);
131
+ } else {
132
+ setUnreadOnly(false);
133
+ }
134
+ }, [fetchedHighlightedNotification]);
104
135
  const onUpdate = () => {
105
136
  throttledSetRefresh(true);
106
137
  };
138
+ const notifications = value?.[0]?.notifications;
139
+ const displayedNotifications = useMemo(() => {
140
+ if (!highlightedNotification || notifications?.some(
141
+ (notification) => notification.id === highlightedNotification.id
142
+ )) {
143
+ return notifications;
144
+ }
145
+ return [highlightedNotification, ...notifications ?? []];
146
+ }, [notifications, highlightedNotification]);
147
+ const injectedHighlightedNotification = highlightedNotification && !notifications?.some(
148
+ (notification) => notification.id === highlightedNotification.id
149
+ );
150
+ const displayedPageSize = injectedHighlightedNotification ? pageSize + 1 : pageSize;
107
151
  if (error) {
108
152
  return /* @__PURE__ */ jsx(ResponseErrorPanel, { error });
109
153
  }
110
- const notifications = value?.[0]?.notifications;
111
154
  const totalCount = value?.[0]?.totalCount;
112
155
  const isUnread = !!value?.[1]?.unread;
113
156
  const allTopics = value?.[2]?.topics;
@@ -153,13 +196,14 @@ function NotificationsPageContent(props) {
153
196
  isLoading: loading,
154
197
  isUnread,
155
198
  markAsReadOnLinkOpen,
156
- notifications,
199
+ notifications: displayedNotifications,
200
+ highlightedNotificationId,
157
201
  onUpdate,
158
202
  setContainsText,
159
203
  onPageChange: setPageNumber,
160
204
  onRowsPerPageChange: setPageSize,
161
205
  page: pageNumber,
162
- pageSize,
206
+ pageSize: displayedPageSize,
163
207
  totalCount
164
208
  }
165
209
  ) })
@@ -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 { 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';\nimport {\n NotificationSeverity,\n NotificationStatus,\n} from '@backstage/plugin-notifications-common';\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 const { lastSignal } = useSignal('notifications');\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 const onUpdate = () => {\n throttledSetRefresh(true);\n };\n\n if (error) {\n return <ResponseErrorPanel error={error} />;\n }\n\n const notifications = value?.[0]?.notifications;\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={notifications}\n onUpdate={onUpdate}\n setContainsText={setContainsText}\n onPageChange={setPageNumber}\n onRowsPerPageChange={setPageSize}\n page={pageNumber}\n pageSize={pageSize}\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":";;;;;;;;;;;;;;;;;;AA4BA,MAAM,cAAA,GAAiB;AAAA,EACrB,GAAA,EAAK,kCAAA;AAAA,EACL,KAAA,EAAO,oCAAA;AAAA,EACP,MAAA,EAAQ,qCAAA;AAAA,EACR,IAAA,EAAM;AACR,CAAA;AAoBA,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;AAC5C,EAAA,MAAM,EAAE,UAAA,EAAW,GAAI,SAAA,CAAU,eAAe,CAAA;AAChD,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,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AAA,EAAgB,QAAA;AAAA,QAChB,QAAA;AAAA,QACA,iBAAA,EAAmB,WAAA;AAAA,QACnB,KAAA;AAAA,QACA,cAAA,EAAgB,QAAA;AAAA,QAChB;AAAA;AAAA,KACF,EACF,CAAA;AAAA,oBACA,GAAA,CAAC,IAAA,CAAK,IAAA,EAAL,EAAU,SAAQ,IAAA,EACjB,QAAA,kBAAA,GAAA;AAAA,MAAC,kBAAA;AAAA,MAAA;AAAA,QACC,KAAA,EAAO,UAAA;AAAA,QACP,SAAA,EAAW,OAAA;AAAA,QACX,QAAA;AAAA,QACA,oBAAA;AAAA,QACA,aAAA;AAAA,QACA,QAAA;AAAA,QACA,eAAA;AAAA,QACA,YAAA,EAAc,aAAA;AAAA,QACd,mBAAA,EAAqB,WAAA;AAAA,QACrB,IAAA,EAAM,UAAA;AAAA,QACN,QAAA;AAAA,QACA;AAAA;AAAA,KACF,EACF;AAAA,GAAA,EACF,CAAA,EACF,CAAA;AAGF,EAAA,IAAI,kBAAkB,KAAA,EAAO;AAC3B,IAAA,OAAO,WAAA;AAAA,EACT;AAEA,EAAA,uBACE,GAAA;AAAA,IAAC,cAAA;AAAA,IAAA;AAAA,MACC,KAAA;AAAA,MACA,OAAA;AAAA,MACA,OAAA;AAAA,MACA,QAAA;AAAA,MACA,IAAA;AAAA,MACA,QAAA;AAAA,MAEC,QAAA,EAAA;AAAA;AAAA,GACH;AAEJ;AAEO,MAAM,iBAAA,GAAoB,CAAC,KAAA,qBAChC,GAAA,CAAC,wBAAA,EAAA,EAA0B,GAAI,KAAA,IAAS,EAAC,EAAI,aAAA,EAAc,QAAA,EAAS;AAG/D,MAAM,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":";;;;;;;;;;;;;;;;;;;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,yB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ACjB,QAAA,kBAAA,GAAA;AAAA,MAAC,kBAAA;AAAA,MAAA;AAAA,QACC,KAAA,EAAO,UAAA;AAAA,QACP,SAAA,EAAW,OAAA;AAAA,QACX,QAAA;AAAA,QACA,oBAAA;AAAA,QACA,aAAA,EAAe,sBAAA;AAAA,QACf,yBAAA;AAAA,QACA,QAAA;AAAA,QACA,eAAA;AAAA,QACA,YAAA,EAAc,aAAA;AAAA,QACd,mBAAA,EAAqB,WAAA;AAAA,QACrB,IAAA,EAAM,UAAA;AAAA,QACN,QAAA,EAAU,iBAAA;AAAA,QACV;AAAA;AAAA,KACF,EACF;AAAA,GAAA,EACF,CAAA,EACF,CAAA;AAGF,EAAA,IAAI,kBAAkB,KAAA,EAAO;AAC3B,IAAA,OAAO,WAAA;AAAA,EACT;AAEA,EAAA,uBACE,GAAA;AAAA,IAAC,cAAA;AAAA,IAAA;AAAA,MACC,KAAA;AAAA,MACA,OAAA;AAAA,MACA,OAAA;AAAA,MACA,QAAA;AAAA,MACA,IAAA;AAAA,MACA,QAAA;AAAA,MAEC,QAAA,EAAA;AAAA;AAAA,GACH;AAEJ;AAEO,MAAM,iBAAA,GAAoB,CAAC,KAAA,qBAChC,GAAA,CAAC,wBAAA,EAAA,EAA0B,GAAI,KAAA,IAAS,EAAC,EAAI,aAAA,EAAc,QAAA,EAAS;AAG/D,MAAM,oBAAA,GAAuB,CAAC,KAAA,qBACnC,GAAA,CAAC,wBAAA,EAAA,EAA0B,GAAI,KAAA,IAAS,EAAC,EAAI,aAAA,EAAc,KAAA,EAAM;;"}
@@ -1,4 +1,4 @@
1
- import { NotificationsPage, NfsNotificationsPage } from './NotificationsPage.esm.js';
1
+ import { NfsNotificationsPage, NotificationsPage } from './NotificationsPage.esm.js';
2
2
 
3
3
 
4
4
 
@@ -1,13 +1,13 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import { forwardRef, useMemo, useState, useCallback, useEffect } from 'react';
3
3
  import { useNotificationsApi } from '../../hooks/useNotificationsApi.esm.js';
4
+ import { useSignal } from '@backstage/plugin-signals-react';
4
5
  import { useWebNotifications } from '../../hooks/useWebNotifications.esm.js';
5
6
  import { useTitleCounter } from '../../hooks/useTitleCounter.esm.js';
6
7
  import { SidebarItem } from '@backstage/core-components';
7
8
  import { useApi, useRouteRef } from '@backstage/core-plugin-api';
8
9
  import { toastApiRef } from '@backstage/frontend-plugin-api';
9
10
  import { rootRouteRef } from '../../routes.esm.js';
10
- import { useSignal } from '@backstage/plugin-signals-react';
11
11
  import { notificationsApiRef } from '../../api/NotificationsApi.esm.js';
12
12
  import '@backstage/errors';
13
13
  import { MaterialDesignContent, SnackbarProvider, closeSnackbar, enqueueSnackbar } from 'notistack';
@@ -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 )}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AA,EACE,aAAA,EAAe,UAAA,EAAY,MAAA,IAAU,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
+ {"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,CAAA;AAC1C,CAAA;AAEA,MAAM,2BAAA,GAA8B,UAAA;AAAA,EAClC,CAAC,OAAY,GAAA,qBACX,GAAA;AAAA,IAAC,qBAAA;AAAA,IAAA;AAAA,MACE,GAAG,KAAA;AAAA,MACJ,GAAA;AAAA,MACA,SAAA,EAAW,CAAC,KAAA,CAAM,SAAA,EAAW,MAAA,CAAO,eAAe,CAAA,CAChD,MAAA,CAAO,OAAO,CAAA,CACd,IAAA,CAAK,GAAG;AAAA;AAAA;AAGjB,CAAA;AAuEO,MAAM,wBAAA,GAA2B,CACtC,KAAA,KACG;AACH,EAAA,MAAM;AAAA,IACJ,uBAAA,GAA0B,KAAA;AAAA,IAC1B,mBAAA,GAAsB,IAAA;AAAA,IACtB,eAAA,GAAkB,IAAA;AAAA,IAClB,wBAAA,GAA2B,IAAA;AAAA,IAC3B,IAAA,GAAO,iBAAA;AAAA,IAC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AAA,EAAO,SAAA,EAAW,MAAA,CAAO,YAAA,EAAc,CAAA;AAAA,UAEhE,GAAA,EAAK,aAAA,EAAe,WAAA,EAAa,GAAA,oBAC/B,GAAA,CAAC,gBAAa,QAAA,EAAS,KAAA,EAAM,SAAA,EAAW,MAAA,CAAO,YAAA,EAAc;AAAA,SAEjE;AAAA,QACA,OAAO,aAAA,EAAe,KAAA;AAAA,QACtB,UAAU,aAAA,EAAe,QAAA;AAAA,QACzB,UAAA,EAAY;AAAA,UACV,MAAA,EACE,aAAA,EAAe,UAAA,EAAY,MAAA,IAAU,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":";;;;;;"}