@gooddata/sdk-ui-ext 10.18.0-alpha.30 → 10.18.0-alpha.32
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/NOTICE +3 -3
- package/esm/index.d.ts +12 -2
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +10 -2
- package/esm/index.js.map +1 -1
- package/esm/notificationsPanel/@staging/OrganizationContext/OrganizationContext.d.ts +12 -0
- package/esm/notificationsPanel/@staging/OrganizationContext/OrganizationContext.d.ts.map +1 -1
- package/esm/notificationsPanel/@staging/OrganizationContext/OrganizationContext.js +10 -1
- package/esm/notificationsPanel/@staging/OrganizationContext/OrganizationContext.js.map +1 -1
- package/esm/notificationsPanel/@staging/OrganizationContext/useFetchOrganization.d.ts +6 -4
- package/esm/notificationsPanel/@staging/OrganizationContext/useFetchOrganization.d.ts.map +1 -1
- package/esm/notificationsPanel/@staging/OrganizationContext/useFetchOrganization.js +1 -1
- package/esm/notificationsPanel/@staging/OrganizationContext/useFetchOrganization.js.map +1 -1
- package/esm/notificationsPanel/Notification/AlertNotification.d.ts +2 -2
- package/esm/notificationsPanel/Notification/AlertNotification.d.ts.map +1 -1
- package/esm/notificationsPanel/Notification/AlertNotification.js +3 -3
- package/esm/notificationsPanel/Notification/AlertNotification.js.map +1 -1
- package/esm/notificationsPanel/Notification/DefaultNotification.d.ts +17 -4
- package/esm/notificationsPanel/Notification/DefaultNotification.d.ts.map +1 -1
- package/esm/notificationsPanel/Notification/DefaultNotification.js +6 -4
- package/esm/notificationsPanel/Notification/DefaultNotification.js.map +1 -1
- package/esm/notificationsPanel/NotificationTriggersDetail/NotificationTriggersDetail.d.ts +4 -1
- package/esm/notificationsPanel/NotificationTriggersDetail/NotificationTriggersDetail.d.ts.map +1 -1
- package/esm/notificationsPanel/NotificationTriggersDetail/NotificationTriggersDetail.js +1 -1
- package/esm/notificationsPanel/NotificationTriggersDetail/NotificationTriggersDetail.js.map +1 -1
- package/esm/notificationsPanel/NotificationTriggersDetail/NotificationTriggersDetailDialog.d.ts +4 -1
- package/esm/notificationsPanel/NotificationTriggersDetail/NotificationTriggersDetailDialog.d.ts.map +1 -1
- package/esm/notificationsPanel/NotificationTriggersDetail/NotificationTriggersDetailDialog.js +1 -1
- package/esm/notificationsPanel/NotificationTriggersDetail/NotificationTriggersDetailDialog.js.map +1 -1
- package/esm/notificationsPanel/NotificationsList/DefaultNotificationsList.d.ts +66 -4
- package/esm/notificationsPanel/NotificationsList/DefaultNotificationsList.d.ts.map +1 -1
- package/esm/notificationsPanel/NotificationsList/DefaultNotificationsList.js +17 -35
- package/esm/notificationsPanel/NotificationsList/DefaultNotificationsList.js.map +1 -1
- package/esm/notificationsPanel/NotificationsList/DefaultNotificationsListEmptyState.d.ts +9 -2
- package/esm/notificationsPanel/NotificationsList/DefaultNotificationsListEmptyState.d.ts.map +1 -1
- package/esm/notificationsPanel/NotificationsList/DefaultNotificationsListEmptyState.js +4 -2
- package/esm/notificationsPanel/NotificationsList/DefaultNotificationsListEmptyState.js.map +1 -1
- package/esm/notificationsPanel/NotificationsList/DefaultNotificationsListErrorState.d.ts +9 -2
- package/esm/notificationsPanel/NotificationsList/DefaultNotificationsListErrorState.d.ts.map +1 -1
- package/esm/notificationsPanel/NotificationsList/DefaultNotificationsListErrorState.js +4 -2
- package/esm/notificationsPanel/NotificationsList/DefaultNotificationsListErrorState.js.map +1 -1
- package/esm/notificationsPanel/NotificationsList/DefaultSkeletonItem.d.ts +19 -0
- package/esm/notificationsPanel/NotificationsList/DefaultSkeletonItem.d.ts.map +1 -0
- package/esm/notificationsPanel/NotificationsList/DefaultSkeletonItem.js +9 -0
- package/esm/notificationsPanel/NotificationsList/DefaultSkeletonItem.js.map +1 -0
- package/esm/notificationsPanel/NotificationsPanel/DefaultNotificationsPanel.d.ts +95 -5
- package/esm/notificationsPanel/NotificationsPanel/DefaultNotificationsPanel.d.ts.map +1 -1
- package/esm/notificationsPanel/NotificationsPanel/DefaultNotificationsPanel.js +7 -5
- package/esm/notificationsPanel/NotificationsPanel/DefaultNotificationsPanel.js.map +1 -1
- package/esm/notificationsPanel/NotificationsPanel/{DefaultOpenNotificationsPanelButton.d.ts → DefaultNotificationsPanelButton.d.ts} +8 -6
- package/esm/notificationsPanel/NotificationsPanel/DefaultNotificationsPanelButton.d.ts.map +1 -0
- package/esm/notificationsPanel/NotificationsPanel/{DefaultOpenNotificationsPanelButton.js → DefaultNotificationsPanelButton.js} +4 -4
- package/esm/notificationsPanel/NotificationsPanel/DefaultNotificationsPanelButton.js.map +1 -0
- package/esm/notificationsPanel/NotificationsPanel/DefaultNotificationsPanelHeader.d.ts +8 -4
- package/esm/notificationsPanel/NotificationsPanel/DefaultNotificationsPanelHeader.d.ts.map +1 -1
- package/esm/notificationsPanel/NotificationsPanel/DefaultNotificationsPanelHeader.js +6 -4
- package/esm/notificationsPanel/NotificationsPanel/DefaultNotificationsPanelHeader.js.map +1 -1
- package/esm/notificationsPanel/NotificationsPanel/NotificationsPanel.d.ts +73 -13
- package/esm/notificationsPanel/NotificationsPanel/NotificationsPanel.d.ts.map +1 -1
- package/esm/notificationsPanel/NotificationsPanel/NotificationsPanel.js +21 -11
- package/esm/notificationsPanel/NotificationsPanel/NotificationsPanel.js.map +1 -1
- package/esm/notificationsPanel/bem.d.ts +5 -0
- package/esm/notificationsPanel/bem.d.ts.map +1 -1
- package/esm/notificationsPanel/bem.js +6 -1
- package/esm/notificationsPanel/bem.js.map +1 -1
- package/esm/notificationsPanel/data/NotificationsContext.d.ts +16 -1
- package/esm/notificationsPanel/data/NotificationsContext.d.ts.map +1 -1
- package/esm/notificationsPanel/data/NotificationsContext.js +9 -3
- package/esm/notificationsPanel/data/NotificationsContext.js.map +1 -1
- package/esm/notificationsPanel/data/useFetchNotifications.d.ts +10 -8
- package/esm/notificationsPanel/data/useFetchNotifications.d.ts.map +1 -1
- package/esm/notificationsPanel/data/useFetchNotifications.js +10 -7
- package/esm/notificationsPanel/data/useFetchNotifications.js.map +1 -1
- package/esm/notificationsPanel/data/useNotificationFiltersDetail.d.ts.map +1 -1
- package/esm/notificationsPanel/data/useNotificationFiltersDetail.js +7 -8
- package/esm/notificationsPanel/data/useNotificationFiltersDetail.js.map +1 -1
- package/esm/notificationsPanel/data/useNotifications.d.ts +23 -3
- package/esm/notificationsPanel/data/useNotifications.d.ts.map +1 -1
- package/esm/notificationsPanel/data/useNotifications.js +9 -5
- package/esm/notificationsPanel/data/useNotifications.js.map +1 -1
- package/esm/notificationsPanel/types.d.ts +3 -1
- package/esm/notificationsPanel/types.d.ts.map +1 -1
- package/esm/notificationsPanel/types.js +1 -1
- package/esm/notificationsPanel/types.js.map +1 -1
- package/esm/sdk-ui-ext.d.ts +395 -54
- package/package.json +18 -18
- package/src/notificationsPanel/NotificationsPanel/DefaultNotificationsPanel.scss +4 -6
- package/src/notificationsPanel/NotificationsPanel/{DefaultOpenNotificationsPanelButton.scss → DefaultNotificationsPanelButton.scss} +2 -2
- package/src/notificationsPanel/NotificationsPanel/DefaultNotificationsPanelHeader.scss +3 -1
- package/src/notificationsPanel/notificationPanel.scss +8 -3
- package/styles/css/main.css +500 -36
- package/styles/css/main.css.map +1 -1
- package/esm/notificationsPanel/NotificationsPanel/DefaultOpenNotificationsPanelButton.d.ts.map +0 -1
- package/esm/notificationsPanel/NotificationsPanel/DefaultOpenNotificationsPanelButton.js.map +0 -1
- package/esm/notificationsPanel/components/VirtualList.d.ts +0 -15
- package/esm/notificationsPanel/components/VirtualList.d.ts.map +0 -1
- package/esm/notificationsPanel/components/VirtualList.js +0 -78
- package/esm/notificationsPanel/components/VirtualList.js.map +0 -1
- package/src/notificationsPanel/components/VirtualList.scss +0 -32
|
@@ -1,41 +1,46 @@
|
|
|
1
1
|
import React, { useCallback, useMemo, useRef, useState } from "react";
|
|
2
2
|
import { assertNever } from "@gooddata/sdk-model";
|
|
3
|
+
import { Overlay, alignConfigToAlignPoint } from "@gooddata/sdk-ui-kit";
|
|
4
|
+
import { invariant } from "ts-invariant";
|
|
3
5
|
import { NotificationsProvider, useNotificationsContext } from "../data/NotificationsContext.js";
|
|
4
6
|
import { OrganizationProvider } from "../@staging/OrganizationContext/OrganizationContext.js";
|
|
5
7
|
import { IntlWrapper } from "../localization/IntlWrapper.js";
|
|
6
8
|
import { DefaultNotificationsPanelHeader, } from "./DefaultNotificationsPanelHeader.js";
|
|
7
9
|
import { DefaultNotificationsPanel } from "./DefaultNotificationsPanel.js";
|
|
8
|
-
import { Overlay, alignConfigToAlignPoint } from "@gooddata/sdk-ui-kit";
|
|
9
10
|
import { DefaultNotificationsList, } from "../NotificationsList/DefaultNotificationsList.js";
|
|
10
11
|
import { DefaultNotificationsListEmptyState, } from "../NotificationsList/DefaultNotificationsListEmptyState.js";
|
|
11
12
|
import { DefaultNotificationsListErrorState, } from "../NotificationsList/DefaultNotificationsListErrorState.js";
|
|
12
13
|
import { DefaultNotification } from "../Notification/DefaultNotification.js";
|
|
14
|
+
import { DefaultNotificationSkeletonItem, } from "../NotificationsList/DefaultSkeletonItem.js";
|
|
13
15
|
const ALIGN_POINTS = [
|
|
14
16
|
alignConfigToAlignPoint({ triggerAlignPoint: "bottom-right", overlayAlignPoint: "top-right" }),
|
|
17
|
+
alignConfigToAlignPoint({ triggerAlignPoint: "bottom-left", overlayAlignPoint: "top-left" }),
|
|
18
|
+
alignConfigToAlignPoint({ triggerAlignPoint: "top-right", overlayAlignPoint: "bottom-right" }),
|
|
19
|
+
alignConfigToAlignPoint({ triggerAlignPoint: "top-left", overlayAlignPoint: "bottom-left" }),
|
|
15
20
|
];
|
|
16
21
|
/**
|
|
17
22
|
* 10 minutes in milliseconds.
|
|
18
23
|
*/
|
|
19
24
|
const TEN_MINUTES = 1000 * 60 * 10;
|
|
20
25
|
/**
|
|
21
|
-
* @
|
|
26
|
+
* @public
|
|
22
27
|
*/
|
|
23
28
|
export function NotificationsPanel(props) {
|
|
24
|
-
const { locale, refreshInterval = TEN_MINUTES, backend, workspace } = props;
|
|
29
|
+
const { locale, refreshInterval = TEN_MINUTES, itemsPerPage = 50, backend, workspace } = props;
|
|
25
30
|
return (React.createElement(OrganizationProvider, null,
|
|
26
|
-
React.createElement(NotificationsProvider, { backend: backend, workspace: workspace, refreshInterval: refreshInterval },
|
|
31
|
+
React.createElement(NotificationsProvider, { backend: backend, workspace: workspace, refreshInterval: refreshInterval, itemsPerPage: itemsPerPage },
|
|
27
32
|
React.createElement(IntlWrapper, { locale: locale },
|
|
28
33
|
React.createElement(NotificationsPanelController, { ...props })))));
|
|
29
34
|
}
|
|
30
35
|
/**
|
|
31
36
|
* @internal
|
|
32
37
|
*/
|
|
33
|
-
function NotificationsPanelController({
|
|
38
|
+
function NotificationsPanelController({ NotificationsPanelButton, NotificationsPanel = DefaultNotificationsPanel, NotificationsPanelHeader = DefaultNotificationsPanelHeader, NotificationsList = DefaultNotificationsList, NotificationsListEmptyState = DefaultNotificationsListEmptyState, NotificationsListErrorState = DefaultNotificationsListErrorState, Notification = DefaultNotification, NotificationSkeletonItem = DefaultNotificationSkeletonItem, onNotificationClick, renderInline = false, itemHeight = 52, maxWidth = 370, maxListHeight = 527, itemsGap = 10, itemPadding = 15, skeletonItemsCount = 5, }) {
|
|
34
39
|
const { buttonRef, isOpen, openNotificationsPanel, closeNotificationsPanel, toggleNotificationsPanel,
|
|
35
40
|
//
|
|
36
41
|
activeView, changeActiveView,
|
|
37
42
|
//
|
|
38
|
-
markNotificationAsRead, markAllNotificationsAsRead, unreadNotificationsCount, activeNotifications,
|
|
43
|
+
markNotificationAsRead, markAllNotificationsAsRead, unreadNotificationsCount, hasUnreadNotifications, activeNotifications,
|
|
39
44
|
//
|
|
40
45
|
status, error, loadNextPage, hasNextPage, } = useNotificationsPanelController();
|
|
41
46
|
const handleNotificationClick = useCallback((notification) => {
|
|
@@ -43,17 +48,20 @@ function NotificationsPanelController({ OpenNotificationsPanelButton, Notificati
|
|
|
43
48
|
closeNotificationsPanel();
|
|
44
49
|
onNotificationClick?.(notification);
|
|
45
50
|
}, [markNotificationAsRead, closeNotificationsPanel, onNotificationClick]);
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
51
|
+
const notificationsPanel = (React.createElement(NotificationsPanel, { NotificationsPanelHeader: NotificationsPanelHeader, NotificationsList: NotificationsList, NotificationsListEmptyState: NotificationsListEmptyState, NotificationsListErrorState: NotificationsListErrorState, Notification: Notification, NotificationSkeletonItem: NotificationSkeletonItem, toggleNotificationsPanel: toggleNotificationsPanel, openNotificationsPanel: openNotificationsPanel, closeNotificationsPanel: closeNotificationsPanel, activeView: activeView, changeActiveView: changeActiveView, markNotificationAsRead: markNotificationAsRead, markAllNotificationsAsRead: markAllNotificationsAsRead, unreadNotificationsCount: unreadNotificationsCount, hasUnreadNotifications: hasUnreadNotifications, activeNotifications: activeNotifications, onNotificationClick: handleNotificationClick, status: status, error: error, loadNextPage: loadNextPage, hasNextPage: hasNextPage, itemHeight: itemHeight, itemsGap: itemsGap, itemPadding: itemPadding, skeletonItemsCount: skeletonItemsCount, maxListHeight: renderInline ? undefined : maxListHeight }));
|
|
52
|
+
if (renderInline) {
|
|
53
|
+
return notificationsPanel;
|
|
54
|
+
}
|
|
55
|
+
invariant(NotificationsPanelButton, "If renderInline is not enabled, NotificationsPanelButton is required.");
|
|
56
|
+
return (React.createElement(React.Fragment, null,
|
|
57
|
+
React.createElement(NotificationsPanelButton, { buttonRef: buttonRef, isNotificationPanelOpen: isOpen, toggleNotificationPanel: toggleNotificationsPanel, openNotificationPanel: openNotificationsPanel, closeNotificationPanel: closeNotificationsPanel, hasUnreadNotifications: hasUnreadNotifications }),
|
|
58
|
+
isOpen ? (React.createElement(Overlay, { isModal: false, alignTo: buttonRef.current, alignPoints: ALIGN_POINTS, closeOnEscape: true, closeOnOutsideClick: true, closeOnParentScroll: false, closeOnMouseDrag: false, onClose: closeNotificationsPanel, width: "100%", maxWidth: maxWidth }, notificationsPanel)) : null));
|
|
50
59
|
}
|
|
51
60
|
function useNotificationsPanelController() {
|
|
52
61
|
const [isOpen, setIsOpen] = useState(false);
|
|
53
62
|
const openNotificationsPanel = useCallback(() => setIsOpen(true), []);
|
|
54
63
|
const closeNotificationsPanel = useCallback(() => setIsOpen(false), []);
|
|
55
64
|
const toggleNotificationsPanel = useCallback(() => setIsOpen((x) => !x), []);
|
|
56
|
-
//
|
|
57
65
|
const changeActiveView = useCallback((view) => setActiveView(view), []);
|
|
58
66
|
const [activeView, setActiveView] = useState("unread");
|
|
59
67
|
const buttonRef = useRef(null);
|
|
@@ -73,6 +81,7 @@ function useNotificationsPanelController() {
|
|
|
73
81
|
const error = activeView === "unread" ? unreadNotificationsError : notificationsError;
|
|
74
82
|
const loadNextPage = activeView === "unread" ? unreadNotificationsLoadNextPage : notificationsLoadNextPage;
|
|
75
83
|
const hasNextPage = activeView === "unread" ? unreadNotificationsHasNextPage : notificationsHasNextPage;
|
|
84
|
+
const hasUnreadNotifications = unreadNotificationsCount > 0;
|
|
76
85
|
return {
|
|
77
86
|
buttonRef,
|
|
78
87
|
isOpen,
|
|
@@ -85,6 +94,7 @@ function useNotificationsPanelController() {
|
|
|
85
94
|
//
|
|
86
95
|
markNotificationAsRead,
|
|
87
96
|
markAllNotificationsAsRead,
|
|
97
|
+
hasUnreadNotifications,
|
|
88
98
|
unreadNotificationsCount,
|
|
89
99
|
activeNotifications,
|
|
90
100
|
//
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationsPanel.js","sourceRoot":"","sources":["../../../src/notificationsPanel/NotificationsPanel/NotificationsPanel.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEtE,OAAO,EAAE,WAAW,EAAiB,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AACjG,OAAO,EAAE,oBAAoB,EAAE,MAAM,wDAAwD,CAAC;AAC9F,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAE7D,OAAO,EAEH,+BAA+B,GAClC,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EAAE,yBAAyB,EAAqC,MAAM,gCAAgC,CAAC;AAC9G,OAAO,
|
|
1
|
+
{"version":3,"file":"NotificationsPanel.js","sourceRoot":"","sources":["../../../src/notificationsPanel/NotificationsPanel/NotificationsPanel.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEtE,OAAO,EAAE,WAAW,EAAiB,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AACjG,OAAO,EAAE,oBAAoB,EAAE,MAAM,wDAAwD,CAAC;AAC9F,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAE7D,OAAO,EAEH,+BAA+B,GAClC,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EAAE,yBAAyB,EAAqC,MAAM,gCAAgC,CAAC;AAC9G,OAAO,EACH,wBAAwB,GAE3B,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EACH,kCAAkC,GAErC,MAAM,4DAA4D,CAAC;AACpE,OAAO,EACH,kCAAkC,GAErC,MAAM,4DAA4D,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAA+B,MAAM,wCAAwC,CAAC;AAC1G,OAAO,EACH,+BAA+B,GAElC,MAAM,6CAA6C,CAAC;AAErD,MAAM,YAAY,GAAG;IACjB,uBAAuB,CAAC,EAAE,iBAAiB,EAAE,cAAc,EAAE,iBAAiB,EAAE,WAAW,EAAE,CAAC;IAC9F,uBAAuB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AAC,8BAA8B,CAAC,CAAC,CAAC,wBAAwB,CAAC;IAExG,MAAM,sBAAsB,GAAG,wBAAwB,GAAG,CAAC,CAAC;IAE5D,OAAO;QACH,SAAS;QACT,MAAM;QACN,sBAAsB;QACtB,uBAAuB;QACvB,wBAAwB;QACxB,EAAE;QACF,UAAU;QACV,gBAAgB;QAChB,EAAE;QACF,sBAAsB;QACtB,0BAA0B;QAC1B,sBAAsB;QACtB,wBAAwB;QACxB,mBAAmB;QACnB,EAAE;QACF,MAAM;QACN,KAAK;QACL,YAAY;QACZ,WAAW;KACd,CAAC;AACN,CAAC"}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BEM factory for sdk-ui-ext
|
|
3
|
+
*
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
1
6
|
export declare const bem: (block: `gd-ui-ext-${string}`) => {
|
|
2
7
|
b: (props?: import("@gooddata/sdk-ui-kit").StyleProps) => string;
|
|
3
8
|
e: (element: string, props?: import("@gooddata/sdk-ui-kit").StyleProps) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bem.d.ts","sourceRoot":"","sources":["../../src/notificationsPanel/bem.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,GAAG,UAAW,aAAa,MAAM,EAAE;;;CAAmC,CAAC"}
|
|
1
|
+
{"version":3,"file":"bem.d.ts","sourceRoot":"","sources":["../../src/notificationsPanel/bem.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,eAAO,MAAM,GAAG,UAAW,aAAa,MAAM,EAAE;;;CAAmC,CAAC"}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
// (C) 2024 GoodData Corporation
|
|
1
|
+
// (C) 2024-2025 GoodData Corporation
|
|
2
2
|
import { bemFactory } from "@gooddata/sdk-ui-kit";
|
|
3
|
+
/**
|
|
4
|
+
* BEM factory for sdk-ui-ext
|
|
5
|
+
*
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
3
8
|
export const bem = (block) => bemFactory(block);
|
|
4
9
|
//# sourceMappingURL=bem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bem.js","sourceRoot":"","sources":["../../src/notificationsPanel/bem.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"bem.js","sourceRoot":"","sources":["../../src/notificationsPanel/bem.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD;;;;GAIG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,KAA4B,EAAE,EAAE,CAAC,UAAU,CAAc,KAAK,CAAC,CAAC"}
|
|
@@ -1,27 +1,42 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { IAnalyticalBackend } from "@gooddata/sdk-backend-spi";
|
|
3
3
|
import { useNotifications } from "./useNotifications.js";
|
|
4
|
+
/**
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
4
7
|
export type INotificationsContext = ReturnType<typeof useNotifications>;
|
|
8
|
+
/**
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
5
11
|
export declare const useNotificationsContext: () => {
|
|
6
12
|
notifications: import("@gooddata/sdk-model").INotification[];
|
|
7
13
|
notificationsStatus: "error" | "loading" | "pending" | "success";
|
|
8
14
|
notificationsError: import("@gooddata/sdk-ui").GoodDataSdkError;
|
|
9
15
|
notificationsHasNextPage: boolean;
|
|
10
16
|
notificationsLoadNextPage: () => void;
|
|
17
|
+
notificationsReset: () => void;
|
|
11
18
|
unreadNotifications: import("@gooddata/sdk-model").INotification[];
|
|
12
19
|
unreadNotificationsStatus: "error" | "loading" | "pending" | "success";
|
|
13
20
|
unreadNotificationsError: import("@gooddata/sdk-ui").GoodDataSdkError;
|
|
14
21
|
unreadNotificationsHasNextPage: boolean;
|
|
15
22
|
unreadNotificationsLoadNextPage: () => void;
|
|
23
|
+
unreadNotificationsReset: () => void;
|
|
16
24
|
unreadNotificationsCount: number;
|
|
17
25
|
markNotificationAsRead: (notificationId: string) => Promise<void>;
|
|
18
26
|
markAllNotificationsAsRead: () => Promise<void>;
|
|
19
27
|
};
|
|
28
|
+
/**
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
20
31
|
export interface INotificationsProviderProps {
|
|
21
32
|
backend?: IAnalyticalBackend;
|
|
22
33
|
workspace?: string;
|
|
23
34
|
children?: React.ReactNode;
|
|
24
|
-
refreshInterval
|
|
35
|
+
refreshInterval: number;
|
|
36
|
+
itemsPerPage: number;
|
|
25
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* @internal
|
|
40
|
+
*/
|
|
26
41
|
export declare const NotificationsProvider: React.FC<INotificationsProviderProps>;
|
|
27
42
|
//# sourceMappingURL=NotificationsContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationsContext.d.ts","sourceRoot":"","sources":["../../../src/notificationsPanel/data/NotificationsContext.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAGzD,MAAM,MAAM,qBAAqB,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAKxE,eAAO,MAAM,uBAAuB
|
|
1
|
+
{"version":3,"file":"NotificationsContext.d.ts","sourceRoot":"","sources":["../../../src/notificationsPanel/data/NotificationsContext.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAGzD;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAKxE;;GAEG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;CAMnC,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,2BAA2B;IACxC,OAAO,CAAC,EAAE,kBAAkB,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAAE,CAAC,2BAA2B,CAUvE,CAAC"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
// (C) 2019-
|
|
1
|
+
// (C) 2019-2025 GoodData Corporation
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { useNotifications } from "./useNotifications.js";
|
|
4
4
|
import { UnexpectedSdkError } from "@gooddata/sdk-ui";
|
|
5
5
|
const NotificationsContext = React.createContext(null);
|
|
6
6
|
NotificationsContext.displayName = "NotificationsContext";
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
7
10
|
export const useNotificationsContext = () => {
|
|
8
11
|
const context = React.useContext(NotificationsContext);
|
|
9
12
|
if (!context) {
|
|
@@ -11,8 +14,11 @@ export const useNotificationsContext = () => {
|
|
|
11
14
|
}
|
|
12
15
|
return context;
|
|
13
16
|
};
|
|
14
|
-
|
|
15
|
-
|
|
17
|
+
/**
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
export const NotificationsProvider = ({ children, backend, workspace, refreshInterval, itemsPerPage, }) => {
|
|
21
|
+
const notifications = useNotifications({ backend, workspace, refreshInterval, itemsPerPage });
|
|
16
22
|
return React.createElement(NotificationsContext.Provider, { value: notifications }, children);
|
|
17
23
|
};
|
|
18
24
|
//# sourceMappingURL=NotificationsContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationsContext.js","sourceRoot":"","sources":["../../../src/notificationsPanel/data/NotificationsContext.tsx"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"NotificationsContext.js","sourceRoot":"","sources":["../../../src/notificationsPanel/data/NotificationsContext.tsx"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAOtD,MAAM,oBAAoB,GAAG,KAAK,CAAC,aAAa,CAA+B,IAAI,CAAC,CAAC;AACrF,oBAAoB,CAAC,WAAW,GAAG,sBAAsB,CAAC;AAE1D;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,EAAE;IACxC,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;IACvD,IAAI,CAAC,OAAO,EAAE,CAAC;QACX,MAAM,IAAI,kBAAkB,CAAC,qEAAqE,CAAC,CAAC;IACxG,CAAC;IACD,OAAO,OAAO,CAAC;AACnB,CAAC,CAAC;AAaF;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAA0C,CAAC,EACzE,QAAQ,EACR,OAAO,EACP,SAAS,EACT,eAAe,EACf,YAAY,GACf,EAAE,EAAE;IACD,MAAM,aAAa,GAAG,gBAAgB,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,YAAY,EAAE,CAAC,CAAC;IAE9F,OAAO,oBAAC,oBAAoB,CAAC,QAAQ,IAAC,KAAK,EAAE,aAAa,IAAG,QAAQ,CAAiC,CAAC;AAC3G,CAAC,CAAC"}
|
|
@@ -1,34 +1,36 @@
|
|
|
1
1
|
import { GoodDataSdkError } from "@gooddata/sdk-ui";
|
|
2
2
|
import { INotification } from "@gooddata/sdk-model";
|
|
3
3
|
/**
|
|
4
|
-
* @
|
|
4
|
+
* @internal
|
|
5
5
|
*/
|
|
6
6
|
export interface IUseFetchNotificationsProps {
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
* If not provided, it will be taken from the WorkspaceProvider context.
|
|
8
|
+
* Filter notifications by workspace.
|
|
10
9
|
*/
|
|
11
10
|
workspace?: string;
|
|
12
11
|
/**
|
|
13
12
|
* Filter notifications by status.
|
|
14
|
-
* If not provided, all notifications will be fetched.
|
|
15
13
|
*/
|
|
16
14
|
readStatus?: "unread" | "read";
|
|
17
15
|
/**
|
|
18
16
|
* Refresh interval in milliseconds.
|
|
19
17
|
*/
|
|
20
18
|
refreshInterval: number;
|
|
19
|
+
/**
|
|
20
|
+
* Number of items to fetch per page.
|
|
21
|
+
*/
|
|
22
|
+
itemsPerPage: number;
|
|
21
23
|
}
|
|
22
24
|
/**
|
|
23
|
-
* @
|
|
25
|
+
* @internal
|
|
24
26
|
*/
|
|
25
|
-
export declare function useFetchNotifications({ workspace, readStatus, refreshInterval, }: IUseFetchNotificationsProps): {
|
|
26
|
-
notifications: INotification[];
|
|
27
|
+
export declare function useFetchNotifications({ workspace, readStatus, refreshInterval, itemsPerPage, }: IUseFetchNotificationsProps): {
|
|
27
28
|
status: "error" | "loading" | "pending" | "success";
|
|
28
29
|
error: GoodDataSdkError;
|
|
29
30
|
hasNextPage: boolean;
|
|
30
|
-
|
|
31
|
+
notifications: INotification[];
|
|
31
32
|
totalNotificationsCount: number;
|
|
33
|
+
loadNextPage: () => void;
|
|
32
34
|
reset: () => void;
|
|
33
35
|
};
|
|
34
36
|
//# sourceMappingURL=useFetchNotifications.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFetchNotifications.d.ts","sourceRoot":"","sources":["../../../src/notificationsPanel/data/useFetchNotifications.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAsC,MAAM,kBAAkB,CAAC;AAExF,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAIpD;;GAEG;AACH,MAAM,WAAW,2BAA2B;IACxC
|
|
1
|
+
{"version":3,"file":"useFetchNotifications.d.ts","sourceRoot":"","sources":["../../../src/notificationsPanel/data/useFetchNotifications.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAsC,MAAM,kBAAkB,CAAC;AAExF,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAIpD;;GAEG;AACH,MAAM,WAAW,2BAA2B;IACxC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,UAAU,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;IAE/B;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,EAClC,SAAS,EACT,UAAU,EACV,eAAe,EACf,YAAY,GACf,EAAE,2BAA2B;;;;;;;;EAkF7B"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
// (C) 2024 GoodData Corporation
|
|
1
|
+
// (C) 2024-2025 GoodData Corporation
|
|
2
2
|
import { useCancelablePromise, useWorkspace } from "@gooddata/sdk-ui";
|
|
3
3
|
import { useOrganization } from "../@staging/OrganizationContext/OrganizationContext.js";
|
|
4
4
|
import { useCallback, useEffect, useState } from "react";
|
|
5
5
|
/**
|
|
6
|
-
* @
|
|
6
|
+
* @internal
|
|
7
7
|
*/
|
|
8
|
-
export function useFetchNotifications({ workspace, readStatus, refreshInterval, }) {
|
|
8
|
+
export function useFetchNotifications({ workspace, readStatus, refreshInterval, itemsPerPage, }) {
|
|
9
9
|
const effectiveWorkspace = useWorkspace(workspace);
|
|
10
10
|
const { result: organizationService } = useOrganization();
|
|
11
11
|
const [page, setPage] = useState(0);
|
|
@@ -30,10 +30,13 @@ export function useFetchNotifications({ workspace, readStatus, refreshInterval,
|
|
|
30
30
|
promise: !organizationService
|
|
31
31
|
? null
|
|
32
32
|
: async () => {
|
|
33
|
-
let query = organizationService.notifications().getNotificationsQuery()
|
|
33
|
+
let query = organizationService.notifications().getNotificationsQuery();
|
|
34
34
|
if (effectiveWorkspace) {
|
|
35
35
|
query = query.withWorkspace(effectiveWorkspace);
|
|
36
36
|
}
|
|
37
|
+
if (itemsPerPage) {
|
|
38
|
+
query = query.withSize(itemsPerPage);
|
|
39
|
+
}
|
|
37
40
|
if (page) {
|
|
38
41
|
query = query.withPage(page);
|
|
39
42
|
}
|
|
@@ -43,7 +46,7 @@ export function useFetchNotifications({ workspace, readStatus, refreshInterval,
|
|
|
43
46
|
return query.query();
|
|
44
47
|
},
|
|
45
48
|
onSuccess: (result) => {
|
|
46
|
-
const hasNextPage = result.totalCount > (page + 1) *
|
|
49
|
+
const hasNextPage = result.totalCount > (page + 1) * itemsPerPage;
|
|
47
50
|
setHasNextPage(hasNextPage);
|
|
48
51
|
setNotifications((prev) => [...prev, ...result.items]);
|
|
49
52
|
setTotalNotificationsCount(result.totalCount);
|
|
@@ -62,12 +65,12 @@ export function useFetchNotifications({ workspace, readStatus, refreshInterval,
|
|
|
62
65
|
setInvalidationId((x) => x + 1);
|
|
63
66
|
}, []);
|
|
64
67
|
return {
|
|
65
|
-
notifications,
|
|
66
68
|
status,
|
|
67
69
|
error,
|
|
68
70
|
hasNextPage,
|
|
69
|
-
|
|
71
|
+
notifications,
|
|
70
72
|
totalNotificationsCount,
|
|
73
|
+
loadNextPage,
|
|
71
74
|
reset,
|
|
72
75
|
};
|
|
73
76
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFetchNotifications.js","sourceRoot":"","sources":["../../../src/notificationsPanel/data/useFetchNotifications.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"useFetchNotifications.js","sourceRoot":"","sources":["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AE,IAAI,EAAE,cAAc,CAAC,CAClE,CAAC;IAEF,MAAM,YAAY,GAAG,WAAW,CAAC,GAAG,EAAE;QAClC,IAAI,MAAM,KAAK,SAAS,IAAI,WAAW,EAAE,CAAC;YACtC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QAC1B,CAAC;IACL,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;IAE1B,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE;QAC3B,OAAO,CAAC,CAAC,CAAC,CAAC;QACX,gBAAgB,CAAC,EAAE,CAAC,CAAC;QACrB,cAAc,CAAC,KAAK,CAAC,CAAC;QACtB,0BAA0B,CAAC,CAAC,CAAC,CAAC;QAC9B,iBAAiB,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACpC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO;QACH,MAAM;QACN,KAAK;QACL,WAAW;QACX,aAAa;QACb,uBAAuB;QACvB,YAAY;QACZ,KAAK;KACR,CAAC;AACN,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNotificationFiltersDetail.d.ts","sourceRoot":"","sources":["../../../src/notificationsPanel/data/useNotificationFiltersDetail.tsx"],"names":[],"mappings":"AACA,OAAO,EAQH,kBAAkB,EAMrB,MAAM,qBAAqB,CAAC;AAoC7B,wBAAgB,4BAA4B,CAAC,YAAY,EAAE,kBAAkB;;
|
|
1
|
+
{"version":3,"file":"useNotificationFiltersDetail.d.ts","sourceRoot":"","sources":["../../../src/notificationsPanel/data/useNotificationFiltersDetail.tsx"],"names":[],"mappings":"AACA,OAAO,EAQH,kBAAkB,EAMrB,MAAM,qBAAqB,CAAC;AAoC7B,wBAAgB,4BAA4B,CAAC,YAAY,EAAE,kBAAkB;;eA0GpC,MAAM;kBAAY,MAAM;;;;;;;EAIhE"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
// (C) 2024 GoodData Corporation
|
|
1
|
+
// (C) 2024-2025 GoodData Corporation
|
|
2
2
|
import { areObjRefsEqual, filterObjRef, isAttributeFilter, isDateFilter, isPositiveAttributeFilter, idRef, filterLocalIdentifier, } from "@gooddata/sdk-model";
|
|
3
|
-
import { useBackendStrict, useCancelablePromise
|
|
3
|
+
import { useBackendStrict, useCancelablePromise } from "@gooddata/sdk-ui";
|
|
4
4
|
import { useMemo } from "react";
|
|
5
5
|
import { translateAttributeFilter } from "./attributeFilterNaming.js";
|
|
6
6
|
import { defineMessages, useIntl } from "react-intl";
|
|
@@ -30,15 +30,14 @@ function fetchLabels(backend, workspaceId, filterDisplayFormsRefs) {
|
|
|
30
30
|
return backend.workspace(workspaceId).attributes().getAttributeDisplayForms(filterDisplayFormsRefs);
|
|
31
31
|
}
|
|
32
32
|
export function useNotificationsFilterDetail(notification) {
|
|
33
|
-
const workspaceId = useWorkspaceStrict(undefined, "NotificationTriggerDetails");
|
|
34
33
|
const backend = useBackendStrict(undefined, "NotificationTriggerDetails");
|
|
35
34
|
const intl = useIntl();
|
|
36
35
|
const automationPromise = useCancelablePromise({
|
|
37
36
|
promise: async () => {
|
|
38
|
-
if (!notification.automationId) {
|
|
37
|
+
if (!notification.automationId || !notification.workspaceId) {
|
|
39
38
|
return null;
|
|
40
39
|
}
|
|
41
|
-
const automation = await fetchAutomation(backend, workspaceId, notification.automationId);
|
|
40
|
+
const automation = await fetchAutomation(backend, notification.workspaceId, notification.automationId);
|
|
42
41
|
const automationAlert = automation?.alert;
|
|
43
42
|
if (!automationAlert) {
|
|
44
43
|
return null;
|
|
@@ -60,13 +59,13 @@ export function useNotificationsFilterDetail(notification) {
|
|
|
60
59
|
.filter(Boolean);
|
|
61
60
|
const dashboardId = automation?.dashboard;
|
|
62
61
|
const dashboardPromise = dashboardId
|
|
63
|
-
? fetchDashboard(backend, workspaceId, dashboardId)
|
|
62
|
+
? fetchDashboard(backend, notification.workspaceId, dashboardId)
|
|
64
63
|
: Promise.resolve(null);
|
|
65
|
-
const labelsPromise = fetchLabels(backend, workspaceId, filterDisplayFormsRefs);
|
|
64
|
+
const labelsPromise = fetchLabels(backend, notification.workspaceId, filterDisplayFormsRefs);
|
|
66
65
|
const [dashboard, labels] = await Promise.all([dashboardPromise, labelsPromise]);
|
|
67
66
|
return { automation, dashboard, labels };
|
|
68
67
|
},
|
|
69
|
-
}, [notification.automationId, workspaceId]);
|
|
68
|
+
}, [notification.automationId, notification.workspaceId]);
|
|
70
69
|
const filtersInfo = useMemo(() => {
|
|
71
70
|
if (!automationPromise.result) {
|
|
72
71
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNotificationFiltersDetail.js","sourceRoot":"","sources":["../../../src/notificationsPanel/data/useNotificationFiltersDetail.tsx"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"useNotificationFiltersDetail.js","sourceRoot":"","sources":["../../../src/notificationsPanel/data/useNotificationFiltersDetail.tsx"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,EACH,eAAe,EACf,YAAY,EAEZ,iBAAiB,EACjB,YAAY,EACZ,yBAAyB,EAIzB,KAAK,EAGL,qBAAqB,GACxB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAsB,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE9E,MAAM,QAAQ,GAAG,cAAc,CAAC;IAC5B,KAAK,EAAE;QACH,EAAE,EAAE,oCAAoC;K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AK,EAAE,QAAQ,EAAE,CAAC;QAC/B,CAAC,CAAC;aACD,MAAM,CAAC,OAAO,CAA0C,CAAC;IAClE,CAAC,EAAE,CAAC,iBAAiB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;IAErC,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,CAAC;AAC9C,CAAC"}
|
|
@@ -1,26 +1,46 @@
|
|
|
1
1
|
import { IAnalyticalBackend } from "@gooddata/sdk-backend-spi";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Hook for fetching all and unread notifications.
|
|
4
|
+
*
|
|
5
|
+
* @public
|
|
4
6
|
*/
|
|
5
7
|
export interface IUseNotificationsProps {
|
|
8
|
+
/**
|
|
9
|
+
* Workspace to fetch notifications from.
|
|
10
|
+
*
|
|
11
|
+
* - If not provided, the workspace from WorkspaceProvider is used.
|
|
12
|
+
* - If not provided and there is no WorkspaceProvider, notifications will be loaded from all workspaces.
|
|
13
|
+
*/
|
|
6
14
|
workspace?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Backend to fetch notifications from.
|
|
17
|
+
*/
|
|
7
18
|
backend?: IAnalyticalBackend;
|
|
19
|
+
/**
|
|
20
|
+
* Refresh interval in milliseconds.
|
|
21
|
+
*/
|
|
8
22
|
refreshInterval: number;
|
|
23
|
+
/**
|
|
24
|
+
* Number of items per page.
|
|
25
|
+
*/
|
|
26
|
+
itemsPerPage: number;
|
|
9
27
|
}
|
|
10
28
|
/**
|
|
11
|
-
* @
|
|
29
|
+
* @public
|
|
12
30
|
*/
|
|
13
|
-
export declare function useNotifications({ workspace, refreshInterval }: IUseNotificationsProps): {
|
|
31
|
+
export declare function useNotifications({ workspace, refreshInterval, itemsPerPage }: IUseNotificationsProps): {
|
|
14
32
|
notifications: import("@gooddata/sdk-model").INotification[];
|
|
15
33
|
notificationsStatus: "error" | "loading" | "pending" | "success";
|
|
16
34
|
notificationsError: import("@gooddata/sdk-ui").GoodDataSdkError;
|
|
17
35
|
notificationsHasNextPage: boolean;
|
|
18
36
|
notificationsLoadNextPage: () => void;
|
|
37
|
+
notificationsReset: () => void;
|
|
19
38
|
unreadNotifications: import("@gooddata/sdk-model").INotification[];
|
|
20
39
|
unreadNotificationsStatus: "error" | "loading" | "pending" | "success";
|
|
21
40
|
unreadNotificationsError: import("@gooddata/sdk-ui").GoodDataSdkError;
|
|
22
41
|
unreadNotificationsHasNextPage: boolean;
|
|
23
42
|
unreadNotificationsLoadNextPage: () => void;
|
|
43
|
+
unreadNotificationsReset: () => void;
|
|
24
44
|
unreadNotificationsCount: number;
|
|
25
45
|
markNotificationAsRead: (notificationId: string) => Promise<void>;
|
|
26
46
|
markAllNotificationsAsRead: () => Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNotifications.d.ts","sourceRoot":"","sources":["../../../src/notificationsPanel/data/useNotifications.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAO/D
|
|
1
|
+
{"version":3,"file":"useNotifications.d.ts","sourceRoot":"","sources":["../../../src/notificationsPanel/data/useNotifications.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAO/D;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACnC;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,OAAO,CAAC,EAAE,kBAAkB,CAAC;IAE7B;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,YAAY,EAAE,EAAE,sBAAsB;;;;;;;;;;;;;;6CAmCtE,MAAM;;EAyFpC"}
|
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
// (C) 2024 GoodData Corporation
|
|
2
|
-
import { UnexpectedSdkError,
|
|
1
|
+
// (C) 2024-2025 GoodData Corporation
|
|
2
|
+
import { UnexpectedSdkError, useWorkspace } from "@gooddata/sdk-ui";
|
|
3
3
|
import { useCallback, useMemo, useState } from "react";
|
|
4
4
|
import { useOrganization } from "../@staging/OrganizationContext/OrganizationContext.js";
|
|
5
5
|
import { useFetchNotifications } from "./useFetchNotifications.js";
|
|
6
6
|
/**
|
|
7
|
-
* @
|
|
7
|
+
* @public
|
|
8
8
|
*/
|
|
9
|
-
export function useNotifications({ workspace, refreshInterval }) {
|
|
10
|
-
const effectiveWorkspace =
|
|
9
|
+
export function useNotifications({ workspace, refreshInterval, itemsPerPage }) {
|
|
10
|
+
const effectiveWorkspace = useWorkspace(workspace);
|
|
11
11
|
const { notifications, hasNextPage: notificationsHasNextPage, error: notificationsError, loadNextPage: notificationsLoadNextPage, status: notificationsStatus, reset: notificationsReset, } = useFetchNotifications({
|
|
12
12
|
workspace: effectiveWorkspace,
|
|
13
13
|
refreshInterval,
|
|
14
|
+
itemsPerPage,
|
|
14
15
|
});
|
|
15
16
|
const { error: unreadNotificationsError, hasNextPage: unreadNotificationsHasNextPage, loadNextPage: unreadNotificationsLoadNextPage, notifications: unreadNotifications, status: unreadNotificationsStatus, totalNotificationsCount: unreadNotificationsCount, reset: unreadNotificationsReset, } = useFetchNotifications({
|
|
16
17
|
workspace: effectiveWorkspace,
|
|
17
18
|
readStatus: "unread",
|
|
18
19
|
refreshInterval,
|
|
20
|
+
itemsPerPage,
|
|
19
21
|
});
|
|
20
22
|
const { result: organizationService, status: organizationStatus } = useOrganization();
|
|
21
23
|
const [markedAsReadNotifications, setMarkedAsReadNotifications] = useState([]);
|
|
@@ -82,11 +84,13 @@ export function useNotifications({ workspace, refreshInterval }) {
|
|
|
82
84
|
notificationsError,
|
|
83
85
|
notificationsHasNextPage,
|
|
84
86
|
notificationsLoadNextPage,
|
|
87
|
+
notificationsReset,
|
|
85
88
|
unreadNotifications: effectiveUnreadNotifications,
|
|
86
89
|
unreadNotificationsStatus: unreadNotificationsStatus,
|
|
87
90
|
unreadNotificationsError: unreadNotificationsError,
|
|
88
91
|
unreadNotificationsHasNextPage: unreadNotificationsHasNextPage,
|
|
89
92
|
unreadNotificationsLoadNextPage: unreadNotificationsLoadNextPage,
|
|
93
|
+
unreadNotificationsReset,
|
|
90
94
|
unreadNotificationsCount: Math.max(0, unreadNotificationsCount - markedAsReadNotifications.length),
|
|
91
95
|
markNotificationAsRead,
|
|
92
96
|
markAllNotificationsAsRead,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNotifications.js","sourceRoot":"","sources":["../../../src/notificationsPanel/data/useNotifications.tsx"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"useNotifications.js","sourceRoot":"","sources":["../../../src/notificationsPanel/data/useNotifications.tsx"],"names":[],"mappings":"AAAA,qCAAqC;AAGrC,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEpE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,wDAAwD,CAAC;AACzF,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAgCnE;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,YAAY,EAA0B;IACjG,MAAM,kBAAkB,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC;IAEnD,MAAM,EACF,aAAa,EACb,WAAW,EAAE,wBAAwB,EACrC,KAAK,EAAE,kBAAkB,EACzB,YAAY,EAAE,yBAAyB,EACvC,MAAM,EAAE,mBAAmB,EAC3B,KAAK,EAAE,kBAAkB,GAC5B,GAAG,qBAAqB,CAAC;QACtB,SAAS,EAAE,kBAAkB;QAC7B,eAAe;QACf,YAAY;KACf,CAAC,CAAC;IACH,MAAM,EACF,KAAK,EAAE,wBAAwB,EAC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,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,EAAE,CAAC;gBACtD,OAAO,EAAE,GAAG,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;YAC7C,CAAC;YACD,OAAO,YAAY,CAAC;QACxB,CAAC,CAAC;aACD,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC,EAAE,CAAC,mBAAmB,EAAE,yBAAyB,CAAC,CAAC,CAAC;IAErD,OAAO;QACH,aAAa,EAAE,sBAAsB;QACrC,mBAAmB;QACnB,kBAAkB;QAClB,wBAAwB;QACxB,yBAAyB;QACzB,kBAAkB;QAClB,mBAAmB,EAAE,4BAA4B;QACjD,yBAAyB,EAAE,yBAAyB;QACpD,wBAAwB,EAAE,wBAAwB;QAClD,8BAA8B,EAAE,8BAA8B;QAC9D,+BAA+B,EAAE,+BAA+B;QAChE,wBAAwB;QACxB,wBAAwB,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,wBAAwB,GAAG,yBAAyB,CAAC,MAAM,CAAC;QAClG,sBAAsB;QACtB,0BAA0B;KAC7B,CAAC;AACN,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/notificationsPanel/types.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/notificationsPanel/types.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,GAAG,KAAK,GAAG,QAAQ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/notificationsPanel/types.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/notificationsPanel/types.ts"],"names":[],"mappings":"AAAA,qCAAqC"}
|