@backstage/plugin-notifications 0.2.0 → 0.2.1-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/dist/api/NotificationsApi.esm.js +8 -0
- package/dist/api/NotificationsApi.esm.js.map +1 -0
- package/dist/api/NotificationsClient.esm.js +74 -0
- package/dist/api/NotificationsClient.esm.js.map +1 -0
- package/dist/{esm/index-D44DlZtS.esm.js → components/NotificationsFilters/NotificationsFilters.esm.js} +4 -124
- package/dist/components/NotificationsFilters/NotificationsFilters.esm.js.map +1 -0
- package/dist/components/NotificationsPage/NotificationsPage.esm.js +138 -0
- package/dist/components/NotificationsPage/NotificationsPage.esm.js.map +1 -0
- package/dist/components/NotificationsPage/index.esm.js +2 -0
- package/dist/components/NotificationsPage/index.esm.js.map +1 -0
- package/dist/components/NotificationsSideBarItem/NotificationsSideBarItem.esm.js +193 -0
- package/dist/components/NotificationsSideBarItem/NotificationsSideBarItem.esm.js.map +1 -0
- package/dist/components/NotificationsTable/BulkActions.esm.js +55 -0
- package/dist/components/NotificationsTable/BulkActions.esm.js.map +1 -0
- package/dist/components/NotificationsTable/NotificationsTable.esm.js +219 -0
- package/dist/components/NotificationsTable/NotificationsTable.esm.js.map +1 -0
- package/dist/components/NotificationsTable/SelectAll.esm.js +41 -0
- package/dist/components/NotificationsTable/SelectAll.esm.js.map +1 -0
- package/dist/components/NotificationsTable/SeverityIcon.esm.js +40 -0
- package/dist/components/NotificationsTable/SeverityIcon.esm.js.map +1 -0
- package/dist/hooks/useNotificationsApi.esm.js +14 -0
- package/dist/hooks/useNotificationsApi.esm.js.map +1 -0
- package/dist/hooks/useTitleCounter.esm.js +57 -0
- package/dist/hooks/useTitleCounter.esm.js.map +1 -0
- package/dist/hooks/useWebNotifications.esm.js +44 -0
- package/dist/hooks/useWebNotifications.esm.js.map +1 -0
- package/dist/index.d.ts +34 -5
- package/dist/index.esm.js +8 -524
- package/dist/index.esm.js.map +1 -1
- package/dist/plugin.esm.js +28 -0
- package/dist/plugin.esm.js.map +1 -0
- package/dist/routes.esm.js +8 -0
- package/dist/routes.esm.js.map +1 -0
- package/package.json +9 -6
- package/dist/esm/index-D44DlZtS.esm.js.map +0 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { notificationsApiRef } from '../api/NotificationsApi.esm.js';
|
|
2
|
+
import '@backstage/errors';
|
|
3
|
+
import { useApi } from '@backstage/core-plugin-api';
|
|
4
|
+
import useAsyncRetry from 'react-use/esm/useAsyncRetry';
|
|
5
|
+
|
|
6
|
+
function useNotificationsApi(f, deps = []) {
|
|
7
|
+
const notificationsApi = useApi(notificationsApiRef);
|
|
8
|
+
return useAsyncRetry(async () => {
|
|
9
|
+
return await f(notificationsApi);
|
|
10
|
+
}, deps);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { useNotificationsApi };
|
|
14
|
+
//# sourceMappingURL=useNotificationsApi.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useNotificationsApi.esm.js","sources":["../../src/hooks/useNotificationsApi.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { NotificationsApi, notificationsApiRef } from '../api';\nimport { useApi } from '@backstage/core-plugin-api';\nimport useAsyncRetry from 'react-use/esm/useAsyncRetry';\n\n/** @public */\nexport function useNotificationsApi<T>(\n f: (api: NotificationsApi) => Promise<T>,\n deps: any[] = [],\n) {\n const notificationsApi = useApi(notificationsApiRef);\n\n return useAsyncRetry(async () => {\n return await f(notificationsApi);\n }, deps);\n}\n"],"names":[],"mappings":";;;;;AAqBO,SAAS,mBACd,CAAA,CAAA,EACA,IAAc,GAAA,EACd,EAAA;AACA,EAAM,MAAA,gBAAA,GAAmB,OAAO,mBAAmB,CAAA,CAAA;AAEnD,EAAA,OAAO,cAAc,YAAY;AAC/B,IAAO,OAAA,MAAM,EAAE,gBAAgB,CAAA,CAAA;AAAA,KAC9B,IAAI,CAAA,CAAA;AACT;;;;"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { useState, useRef, useEffect, useCallback } from 'react';
|
|
2
|
+
|
|
3
|
+
function useTitleCounter() {
|
|
4
|
+
const [title, setTitle] = useState(document.title);
|
|
5
|
+
const [count, setCount] = useState(0);
|
|
6
|
+
const titleTimer = useRef(void 0);
|
|
7
|
+
const getPrefix = (value) => {
|
|
8
|
+
return value === 0 ? "" : `(${value}) `;
|
|
9
|
+
};
|
|
10
|
+
const cleanTitle = (currentTitle) => {
|
|
11
|
+
return currentTitle.replace(/^\(\d+\)\s/, "");
|
|
12
|
+
};
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
const baseTitle = cleanTitle(title);
|
|
15
|
+
const shownTitle = `${getPrefix(count)}${baseTitle}`;
|
|
16
|
+
if (document.title !== shownTitle) {
|
|
17
|
+
window.clearTimeout(titleTimer.current);
|
|
18
|
+
document.title = shownTitle;
|
|
19
|
+
titleTimer.current = window.setTimeout(() => {
|
|
20
|
+
document.title = shownTitle;
|
|
21
|
+
}, 50);
|
|
22
|
+
}
|
|
23
|
+
return () => {
|
|
24
|
+
window.clearTimeout(titleTimer.current);
|
|
25
|
+
document.title = cleanTitle(title);
|
|
26
|
+
};
|
|
27
|
+
}, [title, count]);
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
const titleElement = document.querySelector("title");
|
|
30
|
+
let observer;
|
|
31
|
+
if (titleElement) {
|
|
32
|
+
observer = new MutationObserver((mutations) => {
|
|
33
|
+
var _a, _b;
|
|
34
|
+
if ((_b = (_a = mutations == null ? void 0 : mutations[0]) == null ? void 0 : _a.target) == null ? void 0 : _b.textContent) {
|
|
35
|
+
setTitle(mutations[0].target.textContent);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
observer.observe(titleElement, {
|
|
39
|
+
characterData: true,
|
|
40
|
+
childList: true
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
return () => {
|
|
44
|
+
if (observer) {
|
|
45
|
+
observer.disconnect();
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}, []);
|
|
49
|
+
const setNotificationCount = useCallback(
|
|
50
|
+
(newCount) => setCount(newCount),
|
|
51
|
+
[]
|
|
52
|
+
);
|
|
53
|
+
return { setNotificationCount };
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export { useTitleCounter };
|
|
57
|
+
//# sourceMappingURL=useTitleCounter.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTitleCounter.esm.js","sources":["../../src/hooks/useTitleCounter.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useCallback, useEffect, useRef, useState } from 'react';\n\n/** @public */\nexport function useTitleCounter() {\n const [title, setTitle] = useState(document.title);\n const [count, setCount] = useState(0);\n const titleTimer = useRef<undefined | number>(undefined);\n\n const getPrefix = (value: number) => {\n return value === 0 ? '' : `(${value}) `;\n };\n\n const cleanTitle = (currentTitle: string) => {\n return currentTitle.replace(/^\\(\\d+\\)\\s/, '');\n };\n\n useEffect(() => {\n const baseTitle = cleanTitle(title);\n const shownTitle = `${getPrefix(count)}${baseTitle}`;\n if (document.title !== shownTitle) {\n window.clearTimeout(titleTimer.current);\n document.title = shownTitle;\n // Need to do this in timeout as the React Helmet overrides the title after this effect\n titleTimer.current = window.setTimeout(() => {\n document.title = shownTitle;\n }, 50);\n }\n return () => {\n window.clearTimeout(titleTimer.current);\n document.title = cleanTitle(title);\n };\n }, [title, count]);\n\n useEffect(() => {\n const titleElement = document.querySelector('title');\n let observer: MutationObserver | undefined;\n if (titleElement) {\n observer = new MutationObserver(mutations => {\n if (mutations?.[0]?.target?.textContent) {\n setTitle(mutations[0].target.textContent);\n }\n });\n observer.observe(titleElement, {\n characterData: true,\n childList: true,\n });\n }\n return () => {\n if (observer) {\n observer.disconnect();\n }\n };\n }, []);\n\n const setNotificationCount = useCallback(\n (newCount: number) => setCount(newCount),\n [],\n );\n\n return { setNotificationCount };\n}\n"],"names":[],"mappings":";;AAkBO,SAAS,eAAkB,GAAA;AAChC,EAAA,MAAM,CAAC,KAAO,EAAA,QAAQ,CAAI,GAAA,QAAA,CAAS,SAAS,KAAK,CAAA,CAAA;AACjD,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,SAAS,CAAC,CAAA,CAAA;AACpC,EAAM,MAAA,UAAA,GAAa,OAA2B,KAAS,CAAA,CAAA,CAAA;AAEvD,EAAM,MAAA,SAAA,GAAY,CAAC,KAAkB,KAAA;AACnC,IAAA,OAAO,KAAU,KAAA,CAAA,GAAI,EAAK,GAAA,CAAA,CAAA,EAAI,KAAK,CAAA,EAAA,CAAA,CAAA;AAAA,GACrC,CAAA;AAEA,EAAM,MAAA,UAAA,GAAa,CAAC,YAAyB,KAAA;AAC3C,IAAO,OAAA,YAAA,CAAa,OAAQ,CAAA,YAAA,EAAc,EAAE,CAAA,CAAA;AAAA,GAC9C,CAAA;AAEA,EAAA,SAAA,CAAU,MAAM;AACd,IAAM,MAAA,SAAA,GAAY,WAAW,KAAK,CAAA,CAAA;AAClC,IAAA,MAAM,aAAa,CAAG,EAAA,SAAA,CAAU,KAAK,CAAC,GAAG,SAAS,CAAA,CAAA,CAAA;AAClD,IAAI,IAAA,QAAA,CAAS,UAAU,UAAY,EAAA;AACjC,MAAO,MAAA,CAAA,YAAA,CAAa,WAAW,OAAO,CAAA,CAAA;AACtC,MAAA,QAAA,CAAS,KAAQ,GAAA,UAAA,CAAA;AAEjB,MAAW,UAAA,CAAA,OAAA,GAAU,MAAO,CAAA,UAAA,CAAW,MAAM;AAC3C,QAAA,QAAA,CAAS,KAAQ,GAAA,UAAA,CAAA;AAAA,SAChB,EAAE,CAAA,CAAA;AAAA,KACP;AACA,IAAA,OAAO,MAAM;AACX,MAAO,MAAA,CAAA,YAAA,CAAa,WAAW,OAAO,CAAA,CAAA;AACtC,MAAS,QAAA,CAAA,KAAA,GAAQ,WAAW,KAAK,CAAA,CAAA;AAAA,KACnC,CAAA;AAAA,GACC,EAAA,CAAC,KAAO,EAAA,KAAK,CAAC,CAAA,CAAA;AAEjB,EAAA,SAAA,CAAU,MAAM;AACd,IAAM,MAAA,YAAA,GAAe,QAAS,CAAA,aAAA,CAAc,OAAO,CAAA,CAAA;AACnD,IAAI,IAAA,QAAA,CAAA;AACJ,IAAA,IAAI,YAAc,EAAA;AAChB,MAAW,QAAA,GAAA,IAAI,iBAAiB,CAAa,SAAA,KAAA;AApDnD,QAAA,IAAA,EAAA,EAAA,EAAA,CAAA;AAqDQ,QAAA,IAAA,CAAI,EAAY,GAAA,CAAA,EAAA,GAAA,SAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,SAAA,CAAA,CAAA,CAAA,KAAZ,IAAgB,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,MAAA,KAAhB,mBAAwB,WAAa,EAAA;AACvC,UAAA,QAAA,CAAS,SAAU,CAAA,CAAC,CAAE,CAAA,MAAA,CAAO,WAAW,CAAA,CAAA;AAAA,SAC1C;AAAA,OACD,CAAA,CAAA;AACD,MAAA,QAAA,CAAS,QAAQ,YAAc,EAAA;AAAA,QAC7B,aAAe,EAAA,IAAA;AAAA,QACf,SAAW,EAAA,IAAA;AAAA,OACZ,CAAA,CAAA;AAAA,KACH;AACA,IAAA,OAAO,MAAM;AACX,MAAA,IAAI,QAAU,EAAA;AACZ,QAAA,QAAA,CAAS,UAAW,EAAA,CAAA;AAAA,OACtB;AAAA,KACF,CAAA;AAAA,GACF,EAAG,EAAE,CAAA,CAAA;AAEL,EAAA,MAAM,oBAAuB,GAAA,WAAA;AAAA,IAC3B,CAAC,QAAqB,KAAA,QAAA,CAAS,QAAQ,CAAA;AAAA,IACvC,EAAC;AAAA,GACH,CAAA;AAEA,EAAA,OAAO,EAAE,oBAAqB,EAAA,CAAA;AAChC;;;;"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { useState, useEffect, useCallback } from 'react';
|
|
2
|
+
import { rootRouteRef } from '../routes.esm.js';
|
|
3
|
+
import { useRouteRef } from '@backstage/core-plugin-api';
|
|
4
|
+
import { useNavigate } from 'react-router-dom';
|
|
5
|
+
|
|
6
|
+
function useWebNotifications(enabled) {
|
|
7
|
+
const [webNotificationPermission, setWebNotificationPermission] = useState("default");
|
|
8
|
+
const notificationsRoute = useRouteRef(rootRouteRef);
|
|
9
|
+
const navigate = useNavigate();
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
if (enabled && "Notification" in window && webNotificationPermission === "default") {
|
|
12
|
+
window.Notification.requestPermission().then((permission) => {
|
|
13
|
+
setWebNotificationPermission(permission);
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}, [enabled, webNotificationPermission]);
|
|
17
|
+
const sendWebNotification = useCallback(
|
|
18
|
+
(options) => {
|
|
19
|
+
if (webNotificationPermission !== "granted") {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
const notification = new Notification(options.title, {
|
|
23
|
+
body: options.description,
|
|
24
|
+
tag: options.id
|
|
25
|
+
// Prevent duplicates from multiple tabs
|
|
26
|
+
});
|
|
27
|
+
notification.onclick = (event) => {
|
|
28
|
+
event.preventDefault();
|
|
29
|
+
if (options.link) {
|
|
30
|
+
window.open(options.link, "_blank");
|
|
31
|
+
} else {
|
|
32
|
+
navigate(notificationsRoute());
|
|
33
|
+
}
|
|
34
|
+
notification.close();
|
|
35
|
+
};
|
|
36
|
+
return notification;
|
|
37
|
+
},
|
|
38
|
+
[webNotificationPermission, navigate, notificationsRoute]
|
|
39
|
+
);
|
|
40
|
+
return { sendWebNotification };
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export { useWebNotifications };
|
|
44
|
+
//# sourceMappingURL=useWebNotifications.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useWebNotifications.esm.js","sources":["../../src/hooks/useWebNotifications.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useCallback, useEffect, useState } from 'react';\nimport { rootRouteRef } from '../routes';\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport { useNavigate } from 'react-router-dom';\n\n/** @public */\nexport function useWebNotifications(enabled: boolean) {\n const [webNotificationPermission, setWebNotificationPermission] =\n useState('default');\n const notificationsRoute = useRouteRef(rootRouteRef);\n const navigate = useNavigate();\n\n useEffect(() => {\n if (\n enabled &&\n 'Notification' in window &&\n webNotificationPermission === 'default'\n ) {\n window.Notification.requestPermission().then(permission => {\n setWebNotificationPermission(permission);\n });\n }\n }, [enabled, webNotificationPermission]);\n\n const sendWebNotification = useCallback(\n (options: {\n id: string;\n title: string;\n description: string;\n link?: string;\n }) => {\n if (webNotificationPermission !== 'granted') {\n return null;\n }\n\n const notification = new Notification(options.title, {\n body: options.description,\n tag: options.id, // Prevent duplicates from multiple tabs\n });\n\n notification.onclick = event => {\n event.preventDefault();\n if (options.link) {\n window.open(options.link, '_blank');\n } else {\n navigate(notificationsRoute());\n }\n notification.close();\n };\n\n return notification;\n },\n [webNotificationPermission, navigate, notificationsRoute],\n );\n\n return { sendWebNotification };\n}\n"],"names":[],"mappings":";;;;;AAqBO,SAAS,oBAAoB,OAAkB,EAAA;AACpD,EAAA,MAAM,CAAC,yBAAA,EAA2B,4BAA4B,CAAA,GAC5D,SAAS,SAAS,CAAA,CAAA;AACpB,EAAM,MAAA,kBAAA,GAAqB,YAAY,YAAY,CAAA,CAAA;AACnD,EAAA,MAAM,WAAW,WAAY,EAAA,CAAA;AAE7B,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IACE,OACA,IAAA,cAAA,IAAkB,MAClB,IAAA,yBAAA,KAA8B,SAC9B,EAAA;AACA,MAAA,MAAA,CAAO,YAAa,CAAA,iBAAA,EAAoB,CAAA,IAAA,CAAK,CAAc,UAAA,KAAA;AACzD,QAAA,4BAAA,CAA6B,UAAU,CAAA,CAAA;AAAA,OACxC,CAAA,CAAA;AAAA,KACH;AAAA,GACC,EAAA,CAAC,OAAS,EAAA,yBAAyB,CAAC,CAAA,CAAA;AAEvC,EAAA,MAAM,mBAAsB,GAAA,WAAA;AAAA,IAC1B,CAAC,OAKK,KAAA;AACJ,MAAA,IAAI,8BAA8B,SAAW,EAAA;AAC3C,QAAO,OAAA,IAAA,CAAA;AAAA,OACT;AAEA,MAAA,MAAM,YAAe,GAAA,IAAI,YAAa,CAAA,OAAA,CAAQ,KAAO,EAAA;AAAA,QACnD,MAAM,OAAQ,CAAA,WAAA;AAAA,QACd,KAAK,OAAQ,CAAA,EAAA;AAAA;AAAA,OACd,CAAA,CAAA;AAED,MAAA,YAAA,CAAa,UAAU,CAAS,KAAA,KAAA;AAC9B,QAAA,KAAA,CAAM,cAAe,EAAA,CAAA;AACrB,QAAA,IAAI,QAAQ,IAAM,EAAA;AAChB,UAAO,MAAA,CAAA,IAAA,CAAK,OAAQ,CAAA,IAAA,EAAM,QAAQ,CAAA,CAAA;AAAA,SAC7B,MAAA;AACL,UAAA,QAAA,CAAS,oBAAoB,CAAA,CAAA;AAAA,SAC/B;AACA,QAAA,YAAA,CAAa,KAAM,EAAA,CAAA;AAAA,OACrB,CAAA;AAEA,MAAO,OAAA,YAAA,CAAA;AAAA,KACT;AAAA,IACA,CAAC,yBAA2B,EAAA,QAAA,EAAU,kBAAkB,CAAA;AAAA,GAC1D,CAAA;AAEA,EAAA,OAAO,EAAE,mBAAoB,EAAA,CAAA;AAC/B;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,16 +2,28 @@
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import React__default from 'react';
|
|
4
4
|
import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
|
|
5
|
-
import { DiscoveryApi, FetchApi } from '@backstage/core-plugin-api';
|
|
5
|
+
import { DiscoveryApi, FetchApi, IconComponent } from '@backstage/core-plugin-api';
|
|
6
6
|
import { NotificationSeverity, Notification as Notification$1, NotificationStatus } from '@backstage/plugin-notifications-common';
|
|
7
7
|
import { TableProps } from '@backstage/core-components';
|
|
8
8
|
|
|
9
|
+
/** @public */
|
|
10
|
+
type NotificationsPageProps = {
|
|
11
|
+
/** Mark notification as read when opening the link it contains, defaults to false */
|
|
12
|
+
markAsReadOnLinkOpen?: boolean;
|
|
13
|
+
title?: string;
|
|
14
|
+
themeId?: string;
|
|
15
|
+
subtitle?: string;
|
|
16
|
+
tooltip?: string;
|
|
17
|
+
type?: string;
|
|
18
|
+
typeLink?: string;
|
|
19
|
+
};
|
|
20
|
+
|
|
9
21
|
/** @public */
|
|
10
22
|
declare const notificationsPlugin: _backstage_core_plugin_api.BackstagePlugin<{
|
|
11
23
|
root: _backstage_core_plugin_api.RouteRef<undefined>;
|
|
12
24
|
}, {}>;
|
|
13
25
|
/** @public */
|
|
14
|
-
declare const NotificationsPage: () => React.JSX.Element;
|
|
26
|
+
declare const NotificationsPage: (props?: NotificationsPageProps | undefined) => React.JSX.Element;
|
|
15
27
|
|
|
16
28
|
/** @public */
|
|
17
29
|
declare const notificationsApiRef: _backstage_core_plugin_api.ApiRef<NotificationsApi>;
|
|
@@ -85,8 +97,9 @@ declare function useNotificationsApi<T>(f: (api: NotificationsApi) => Promise<T>
|
|
|
85
97
|
};
|
|
86
98
|
|
|
87
99
|
/** @public */
|
|
88
|
-
declare function useWebNotifications(): {
|
|
100
|
+
declare function useWebNotifications(enabled: boolean): {
|
|
89
101
|
sendWebNotification: (options: {
|
|
102
|
+
id: string;
|
|
90
103
|
title: string;
|
|
91
104
|
description: string;
|
|
92
105
|
link?: string;
|
|
@@ -98,21 +111,37 @@ declare function useTitleCounter(): {
|
|
|
98
111
|
setNotificationCount: (newCount: number) => void;
|
|
99
112
|
};
|
|
100
113
|
|
|
114
|
+
declare module 'notistack' {
|
|
115
|
+
interface VariantOverrides {
|
|
116
|
+
low: true;
|
|
117
|
+
normal: true;
|
|
118
|
+
high: true;
|
|
119
|
+
critical: true;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
101
122
|
/** @public */
|
|
102
123
|
declare const NotificationsSidebarItem: (props?: {
|
|
103
124
|
webNotificationsEnabled?: boolean;
|
|
104
125
|
titleCounterEnabled?: boolean;
|
|
126
|
+
snackbarEnabled?: boolean;
|
|
127
|
+
className?: string;
|
|
128
|
+
icon?: IconComponent;
|
|
129
|
+
text?: string;
|
|
130
|
+
disableHighlight?: boolean;
|
|
131
|
+
noTrack?: boolean;
|
|
105
132
|
}) => React__default.JSX.Element;
|
|
106
133
|
|
|
107
134
|
/** @public */
|
|
108
135
|
type NotificationsTableProps = Pick<TableProps, 'onPageChange' | 'onRowsPerPageChange' | 'page' | 'totalCount'> & {
|
|
136
|
+
markAsReadOnLinkOpen?: boolean;
|
|
109
137
|
isLoading?: boolean;
|
|
138
|
+
isUnread: boolean;
|
|
110
139
|
notifications?: Notification$1[];
|
|
111
140
|
onUpdate: () => void;
|
|
112
141
|
setContainsText: (search: string) => void;
|
|
113
142
|
pageSize: number;
|
|
114
143
|
};
|
|
115
144
|
/** @public */
|
|
116
|
-
declare const NotificationsTable: ({ isLoading, notifications, onUpdate, setContainsText, onPageChange, onRowsPerPageChange, page, pageSize, totalCount, }: NotificationsTableProps) => React__default.JSX.Element;
|
|
145
|
+
declare const NotificationsTable: ({ markAsReadOnLinkOpen, isLoading, notifications, isUnread, onUpdate, setContainsText, onPageChange, onRowsPerPageChange, page, pageSize, totalCount, }: NotificationsTableProps) => React__default.JSX.Element;
|
|
117
146
|
|
|
118
|
-
export { type GetNotificationsOptions, type GetNotificationsResponse, type NotificationsApi, NotificationsClient, NotificationsPage, NotificationsSidebarItem, NotificationsTable, type NotificationsTableProps, type UpdateNotificationsOptions, notificationsApiRef, notificationsPlugin, useNotificationsApi, useTitleCounter, useWebNotifications };
|
|
147
|
+
export { type GetNotificationsOptions, type GetNotificationsResponse, type NotificationsApi, NotificationsClient, NotificationsPage, type NotificationsPageProps, NotificationsSidebarItem, NotificationsTable, type NotificationsTableProps, type UpdateNotificationsOptions, notificationsApiRef, notificationsPlugin, useNotificationsApi, useTitleCounter, useWebNotifications };
|