@gooddata/sdk-ui-ext 10.18.0-alpha.1 → 10.18.0-alpha.11
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 +102 -3
- package/esm/index.d.ts +11 -0
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +2 -0
- package/esm/index.js.map +1 -1
- package/esm/internal/translations/en-US.json +80 -0
- package/esm/notificationsPanel/@staging/OrganizationContext/OrganizationContext.d.ts +12 -0
- package/esm/notificationsPanel/@staging/OrganizationContext/OrganizationContext.d.ts.map +1 -0
- package/esm/notificationsPanel/@staging/OrganizationContext/OrganizationContext.js +18 -0
- package/esm/notificationsPanel/@staging/OrganizationContext/OrganizationContext.js.map +1 -0
- package/esm/notificationsPanel/@staging/OrganizationContext/useFetchOrganization.d.ts +22 -0
- package/esm/notificationsPanel/@staging/OrganizationContext/useFetchOrganization.d.ts.map +1 -0
- package/esm/notificationsPanel/@staging/OrganizationContext/useFetchOrganization.js +15 -0
- package/esm/notificationsPanel/@staging/OrganizationContext/useFetchOrganization.js.map +1 -0
- package/esm/notificationsPanel/Notification/AlertNotification.d.ts +15 -0
- package/esm/notificationsPanel/Notification/AlertNotification.d.ts.map +1 -0
- package/esm/notificationsPanel/Notification/AlertNotification.js +74 -0
- package/esm/notificationsPanel/Notification/AlertNotification.js.map +1 -0
- package/esm/notificationsPanel/Notification/DefaultNotification.d.ts +15 -0
- package/esm/notificationsPanel/Notification/DefaultNotification.d.ts.map +1 -0
- package/esm/notificationsPanel/Notification/DefaultNotification.js +26 -0
- package/esm/notificationsPanel/Notification/DefaultNotification.js.map +1 -0
- package/esm/notificationsPanel/NotificationFiltersDetail/NotificationFiltersDetail.d.ts +13 -0
- package/esm/notificationsPanel/NotificationFiltersDetail/NotificationFiltersDetail.d.ts.map +1 -0
- package/esm/notificationsPanel/NotificationFiltersDetail/NotificationFiltersDetail.js +37 -0
- package/esm/notificationsPanel/NotificationFiltersDetail/NotificationFiltersDetail.js.map +1 -0
- package/esm/notificationsPanel/NotificationFiltersDetail/NotificationFiltersDetailDialog.d.ts +14 -0
- package/esm/notificationsPanel/NotificationFiltersDetail/NotificationFiltersDetailDialog.d.ts.map +1 -0
- package/esm/notificationsPanel/NotificationFiltersDetail/NotificationFiltersDetailDialog.js +24 -0
- package/esm/notificationsPanel/NotificationFiltersDetail/NotificationFiltersDetailDialog.js.map +1 -0
- package/esm/notificationsPanel/NotificationTriggersDetail/NotificationTriggersDetail.d.ts +10 -0
- package/esm/notificationsPanel/NotificationTriggersDetail/NotificationTriggersDetail.d.ts.map +1 -0
- package/esm/notificationsPanel/NotificationTriggersDetail/NotificationTriggersDetail.js +42 -0
- package/esm/notificationsPanel/NotificationTriggersDetail/NotificationTriggersDetail.js.map +1 -0
- package/esm/notificationsPanel/NotificationTriggersDetail/NotificationTriggersDetailDialog.d.ts +12 -0
- package/esm/notificationsPanel/NotificationTriggersDetail/NotificationTriggersDetailDialog.d.ts.map +1 -0
- package/esm/notificationsPanel/NotificationTriggersDetail/NotificationTriggersDetailDialog.js +27 -0
- package/esm/notificationsPanel/NotificationTriggersDetail/NotificationTriggersDetailDialog.js.map +1 -0
- package/esm/notificationsPanel/NotificationsList/DefaultNotificationsList.d.ts +28 -0
- package/esm/notificationsPanel/NotificationsList/DefaultNotificationsList.d.ts.map +1 -0
- package/esm/notificationsPanel/NotificationsList/DefaultNotificationsList.js +23 -0
- package/esm/notificationsPanel/NotificationsList/DefaultNotificationsList.js.map +1 -0
- package/esm/notificationsPanel/NotificationsList/DefaultNotificationsListEmptyState.d.ts +13 -0
- package/esm/notificationsPanel/NotificationsList/DefaultNotificationsListEmptyState.d.ts.map +1 -0
- package/esm/notificationsPanel/NotificationsList/DefaultNotificationsListEmptyState.js +23 -0
- package/esm/notificationsPanel/NotificationsList/DefaultNotificationsListEmptyState.js.map +1 -0
- package/esm/notificationsPanel/NotificationsList/DefaultNotificationsListErrorState.d.ts +13 -0
- package/esm/notificationsPanel/NotificationsList/DefaultNotificationsListErrorState.d.ts.map +1 -0
- package/esm/notificationsPanel/NotificationsList/DefaultNotificationsListErrorState.js +18 -0
- package/esm/notificationsPanel/NotificationsList/DefaultNotificationsListErrorState.js.map +1 -0
- package/esm/notificationsPanel/NotificationsPanel/DefaultNotificationsPanel.d.ts +38 -0
- package/esm/notificationsPanel/NotificationsPanel/DefaultNotificationsPanel.d.ts.map +1 -0
- package/esm/notificationsPanel/NotificationsPanel/DefaultNotificationsPanel.js +13 -0
- package/esm/notificationsPanel/NotificationsPanel/DefaultNotificationsPanel.js.map +1 -0
- package/esm/notificationsPanel/NotificationsPanel/DefaultNotificationsPanelHeader.d.ts +32 -0
- package/esm/notificationsPanel/NotificationsPanel/DefaultNotificationsPanelHeader.d.ts.map +1 -0
- package/esm/notificationsPanel/NotificationsPanel/DefaultNotificationsPanelHeader.js +41 -0
- package/esm/notificationsPanel/NotificationsPanel/DefaultNotificationsPanelHeader.js.map +1 -0
- package/esm/notificationsPanel/NotificationsPanel/DefaultOpenNotificationsPanelButton.d.ts +35 -0
- package/esm/notificationsPanel/NotificationsPanel/DefaultOpenNotificationsPanelButton.d.ts.map +1 -0
- package/esm/notificationsPanel/NotificationsPanel/DefaultOpenNotificationsPanelButton.js +16 -0
- package/esm/notificationsPanel/NotificationsPanel/DefaultOpenNotificationsPanelButton.js.map +1 -0
- package/esm/notificationsPanel/NotificationsPanel/NotificationsPanel.d.ts +76 -0
- package/esm/notificationsPanel/NotificationsPanel/NotificationsPanel.d.ts.map +1 -0
- package/esm/notificationsPanel/NotificationsPanel/NotificationsPanel.js +97 -0
- package/esm/notificationsPanel/NotificationsPanel/NotificationsPanel.js.map +1 -0
- package/esm/notificationsPanel/bem.d.ts +5 -0
- package/esm/notificationsPanel/bem.d.ts.map +1 -0
- package/esm/notificationsPanel/bem.js +4 -0
- package/esm/notificationsPanel/bem.js.map +1 -0
- package/esm/notificationsPanel/components/DetailsDialog.d.ts +9 -0
- package/esm/notificationsPanel/components/DetailsDialog.d.ts.map +1 -0
- package/esm/notificationsPanel/components/DetailsDialog.js +23 -0
- package/esm/notificationsPanel/components/DetailsDialog.js.map +1 -0
- package/esm/notificationsPanel/components/Skeleton.d.ts +8 -0
- package/esm/notificationsPanel/components/Skeleton.d.ts.map +1 -0
- package/esm/notificationsPanel/components/Skeleton.js +11 -0
- package/esm/notificationsPanel/components/Skeleton.js.map +1 -0
- package/esm/notificationsPanel/components/Tooltip.d.ts +6 -0
- package/esm/notificationsPanel/components/Tooltip.d.ts.map +1 -0
- package/esm/notificationsPanel/components/Tooltip.js +10 -0
- package/esm/notificationsPanel/components/Tooltip.js.map +1 -0
- package/esm/notificationsPanel/components/VirtualList.d.ts +15 -0
- package/esm/notificationsPanel/components/VirtualList.d.ts.map +1 -0
- package/esm/notificationsPanel/components/VirtualList.js +77 -0
- package/esm/notificationsPanel/components/VirtualList.js.map +1 -0
- package/esm/notificationsPanel/data/NotificationsContext.d.ts +27 -0
- package/esm/notificationsPanel/data/NotificationsContext.d.ts.map +1 -0
- package/esm/notificationsPanel/data/NotificationsContext.js +18 -0
- package/esm/notificationsPanel/data/NotificationsContext.js.map +1 -0
- package/esm/notificationsPanel/data/attributeFilterNaming.d.ts +4 -0
- package/esm/notificationsPanel/data/attributeFilterNaming.d.ts.map +1 -0
- package/esm/notificationsPanel/data/attributeFilterNaming.js +9 -0
- package/esm/notificationsPanel/data/attributeFilterNaming.js.map +1 -0
- package/esm/notificationsPanel/data/dateFilterNaming.d.ts +4 -0
- package/esm/notificationsPanel/data/dateFilterNaming.d.ts.map +1 -0
- package/esm/notificationsPanel/data/dateFilterNaming.js +15 -0
- package/esm/notificationsPanel/data/dateFilterNaming.js.map +1 -0
- package/esm/notificationsPanel/data/useFetchNotifications.d.ts +33 -0
- package/esm/notificationsPanel/data/useFetchNotifications.d.ts.map +1 -0
- package/esm/notificationsPanel/data/useFetchNotifications.js +66 -0
- package/esm/notificationsPanel/data/useFetchNotifications.js.map +1 -0
- package/esm/notificationsPanel/data/useNotificationFiltersDetail.d.ts +12 -0
- package/esm/notificationsPanel/data/useNotificationFiltersDetail.d.ts.map +1 -0
- package/esm/notificationsPanel/data/useNotificationFiltersDetail.js +96 -0
- package/esm/notificationsPanel/data/useNotificationFiltersDetail.js.map +1 -0
- package/esm/notificationsPanel/data/useNotifications.d.ts +28 -0
- package/esm/notificationsPanel/data/useNotifications.d.ts.map +1 -0
- package/esm/notificationsPanel/data/useNotifications.js +94 -0
- package/esm/notificationsPanel/data/useNotifications.js.map +1 -0
- package/esm/notificationsPanel/localization/IntlWrapper.d.ts +13 -0
- package/esm/notificationsPanel/localization/IntlWrapper.d.ts.map +1 -0
- package/esm/notificationsPanel/localization/IntlWrapper.js +32 -0
- package/esm/notificationsPanel/localization/IntlWrapper.js.map +1 -0
- package/esm/notificationsPanel/types.d.ts +5 -0
- package/esm/notificationsPanel/types.d.ts.map +1 -0
- package/esm/notificationsPanel/types.js +3 -0
- package/esm/notificationsPanel/types.js.map +1 -0
- package/esm/sdk-ui-ext.d.ts +201 -0
- package/package.json +20 -16
- package/src/notificationsPanel/Notification/DefaultNotification.scss +134 -0
- package/src/notificationsPanel/NotificationFiltersDetail/NotificationFiltersDetailDialog.scss +29 -0
- package/src/notificationsPanel/NotificationTriggersDetail/NotificationTriggersDetailDialog.scss +72 -0
- package/src/notificationsPanel/NotificationsList/DefaultNotificationsList.scss +7 -0
- package/src/notificationsPanel/NotificationsList/DefaultNotificationsListEmptyState.scss +21 -0
- package/src/notificationsPanel/NotificationsList/DefaultNotificationsListErrorState.scss +21 -0
- package/src/notificationsPanel/NotificationsPanel/DefaultNotificationsPanel.scss +18 -0
- package/src/notificationsPanel/NotificationsPanel/DefaultNotificationsPanelHeader.scss +28 -0
- package/src/notificationsPanel/NotificationsPanel/DefaultOpenNotificationsPanelButton.scss +34 -0
- package/src/notificationsPanel/components/DetailsDialog.scss +51 -0
- package/src/notificationsPanel/components/Skeleton.scss +25 -0
- package/src/notificationsPanel/components/VirtualList.scss +26 -0
- package/src/notificationsPanel/notificationPanel.scss +19 -0
- package/styles/css/main.css +407 -0
- package/styles/css/main.css.map +1 -1
- package/styles/scss/main.scss +1 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
// (C) 2024 GoodData Corporation
|
|
2
|
+
import { areObjRefsEqual, filterObjRef, isAttributeFilter, isDateFilter, isPositiveAttributeFilter, } from "@gooddata/sdk-model";
|
|
3
|
+
import { useBackendStrict, useCancelablePromise, useWorkspaceStrict } from "@gooddata/sdk-ui";
|
|
4
|
+
import { useMemo } from "react";
|
|
5
|
+
import { translateAttributeFilter } from "./attributeFilterNaming.js";
|
|
6
|
+
import { defineMessages, useIntl } from "react-intl";
|
|
7
|
+
import { translateDateFilter } from "./dateFilterNaming.js";
|
|
8
|
+
const messages = defineMessages({
|
|
9
|
+
title: {
|
|
10
|
+
id: "notifications.filters.dialog.title",
|
|
11
|
+
},
|
|
12
|
+
dateRange: {
|
|
13
|
+
id: "notifications.filters.dialog.dateRange",
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
function getObjRefInScopeLocalId(attributeFilter) {
|
|
17
|
+
if (isPositiveAttributeFilter(attributeFilter)) {
|
|
18
|
+
return attributeFilter.positiveAttributeFilter.displayForm.localIdentifier;
|
|
19
|
+
}
|
|
20
|
+
return attributeFilter.negativeAttributeFilter.displayForm.localIdentifier;
|
|
21
|
+
}
|
|
22
|
+
export function useNotificationsFilterDetail(notification) {
|
|
23
|
+
const workspaceId = useWorkspaceStrict(undefined, "NotificationTriggerDetails");
|
|
24
|
+
const backend = useBackendStrict(undefined, "NotificationTriggerDetails");
|
|
25
|
+
const intl = useIntl();
|
|
26
|
+
const automationPromise = useCancelablePromise({
|
|
27
|
+
promise: async () => {
|
|
28
|
+
if (!notification.automationId) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
const automation = await backend
|
|
32
|
+
.workspace(workspaceId)
|
|
33
|
+
.automations()
|
|
34
|
+
.getAutomation(notification.automationId);
|
|
35
|
+
const automationAlert = automation?.alert;
|
|
36
|
+
if (!automationAlert) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
const filterDisplayFormsRefs = automationAlert.execution.filters
|
|
40
|
+
.filter((f) => isAttributeFilter(f))
|
|
41
|
+
.map((filter) => {
|
|
42
|
+
const ref = filterObjRef(filter);
|
|
43
|
+
if (!ref) {
|
|
44
|
+
const attribute = automationAlert.execution.attributes.find((a) => a.attribute.localIdentifier ===
|
|
45
|
+
getObjRefInScopeLocalId(filter));
|
|
46
|
+
if (!attribute) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
return attribute.attribute.displayForm;
|
|
50
|
+
}
|
|
51
|
+
return filterObjRef(filter);
|
|
52
|
+
})
|
|
53
|
+
.filter(Boolean);
|
|
54
|
+
const labels = await backend
|
|
55
|
+
.workspace(workspaceId)
|
|
56
|
+
.attributes()
|
|
57
|
+
.getAttributeDisplayForms(filterDisplayFormsRefs);
|
|
58
|
+
return { automation, labels };
|
|
59
|
+
},
|
|
60
|
+
}, [notification.automationId, workspaceId]);
|
|
61
|
+
const filtersInfo = useMemo(() => {
|
|
62
|
+
if (!automationPromise.result) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
const { automation, labels } = automationPromise.result;
|
|
66
|
+
const alert = automation?.alert;
|
|
67
|
+
if (!alert) {
|
|
68
|
+
return [];
|
|
69
|
+
}
|
|
70
|
+
return alert.execution.filters
|
|
71
|
+
.map((filter) => {
|
|
72
|
+
let ref = filterObjRef(filter);
|
|
73
|
+
let subtitle = "";
|
|
74
|
+
let title = "";
|
|
75
|
+
if (isAttributeFilter(filter)) {
|
|
76
|
+
const attribute = alert.execution.attributes.find((a) => a.attribute.localIdentifier === getObjRefInScopeLocalId(filter));
|
|
77
|
+
if (attribute) {
|
|
78
|
+
ref = attribute.attribute.displayForm;
|
|
79
|
+
}
|
|
80
|
+
subtitle = translateAttributeFilter(intl, filter);
|
|
81
|
+
title = labels.find((l) => areObjRefsEqual(l.ref, ref))?.title ?? "";
|
|
82
|
+
}
|
|
83
|
+
else if (isDateFilter(filter)) {
|
|
84
|
+
subtitle = translateDateFilter(intl, filter, "MM/dd/yyyy");
|
|
85
|
+
title = intl.formatMessage(messages.dateRange);
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
return { title, subtitle };
|
|
91
|
+
})
|
|
92
|
+
.filter(Boolean);
|
|
93
|
+
}, [automationPromise.result, intl]);
|
|
94
|
+
return { filtersInfo, automationPromise };
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=useNotificationFiltersDetail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useNotificationFiltersDetail.js","sourceRoot":"","sources":["../../../src/notificationsPanel/data/useNotificationFiltersDetail.tsx"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,OAAO,EACH,eAAe,EACf,YAAY,EAEZ,iBAAiB,EACjB,YAAY,EACZ,yBAAyB,GAI5B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC9F,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;AAE5D,MAAM,QAAQ,GAAG,cAAc,CAAC;IAC5B,KAAK,EAAE;QACH,EAAE,EAAE,oCAAoC;KAC3C;IACD,SAAS,EAAE;QACP,EAAE,EAAE,wCAAwC;KAC/C;CACJ,CAAC,CAAC;AAEH,SAAS,uBAAuB,CAAC,eAAiC;IAC9D,IAAI,yBAAyB,CAAC,eAAe,CAAC,EAAE,CAAC;QAC7C,OAAQ,eAAe,CAAC,u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AC,MAAM,CAAC,CACzE,CAAC;gBACF,IAAI,SAAS,EAAE,CAAC;oBACZ,GAAG,GAAG,SAAS,CAAC,SAAS,CAAC,WAAW,CAAC;gBAC1C,CAAC;gBAED,QAAQ,GAAG,wBAAwB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;gBAClD,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,EAAE,KAAK,IAAI,EAAE,CAAC;YACzE,CAAC;iBAAM,IAAI,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC;gBAC9B,QAAQ,GAAG,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;gBAC3D,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;YACnD,CAAC;iBAAM,CAAC;gBACJ,OAAO,IAAI,CAAC;YAChB,CAAC;YAED,OAAO,EAAE,KAAK,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"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { IAnalyticalBackend } from "@gooddata/sdk-backend-spi";
|
|
2
|
+
/**
|
|
3
|
+
* @alpha
|
|
4
|
+
*/
|
|
5
|
+
export interface IUseNotificationsProps {
|
|
6
|
+
workspace?: string;
|
|
7
|
+
backend?: IAnalyticalBackend;
|
|
8
|
+
refreshInterval?: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* @alpha
|
|
12
|
+
*/
|
|
13
|
+
export declare function useNotifications({ workspace, refreshInterval }: IUseNotificationsProps): {
|
|
14
|
+
notifications: import("@gooddata/sdk-model").INotification[];
|
|
15
|
+
notificationsStatus: "error" | "loading" | "pending" | "success";
|
|
16
|
+
notificationsError: import("@gooddata/sdk-ui").GoodDataSdkError;
|
|
17
|
+
notificationsHasNextPage: boolean;
|
|
18
|
+
notificationsLoadNextPage: () => void;
|
|
19
|
+
unreadNotifications: import("@gooddata/sdk-model").INotification[];
|
|
20
|
+
unreadNotificationsStatus: "error" | "loading" | "pending" | "success";
|
|
21
|
+
unreadNotificationsError: import("@gooddata/sdk-ui").GoodDataSdkError;
|
|
22
|
+
unreadNotificationsHasNextPage: boolean;
|
|
23
|
+
unreadNotificationsLoadNextPage: () => void;
|
|
24
|
+
unreadNotificationsCount: number;
|
|
25
|
+
markNotificationAsRead: (notificationId: string) => Promise<void>;
|
|
26
|
+
markAllNotificationsAsRead: () => Promise<void>;
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=useNotifications.d.ts.map
|
|
@@ -0,0 +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;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,kBAAkB,CAAC;IAC7B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,EAAE,sBAAsB;;;;;;;;;;;;6CA8BxD,MAAM;;EAsFpC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// (C) 2024 GoodData Corporation
|
|
2
|
+
import { UnexpectedSdkError, useWorkspaceStrict } from "@gooddata/sdk-ui";
|
|
3
|
+
import { useCallback, useMemo, useState } from "react";
|
|
4
|
+
import { useOrganization } from "../@staging/OrganizationContext/OrganizationContext.js";
|
|
5
|
+
import { useFetchNotifications } from "./useFetchNotifications.js";
|
|
6
|
+
/**
|
|
7
|
+
* @alpha
|
|
8
|
+
*/
|
|
9
|
+
export function useNotifications({ workspace, refreshInterval }) {
|
|
10
|
+
const effectiveWorkspace = useWorkspaceStrict(workspace, "useNotifications");
|
|
11
|
+
const { notifications, hasNextPage: notificationsHasNextPage, error: notificationsError, loadNextPage: notificationsLoadNextPage, status: notificationsStatus, } = useFetchNotifications({
|
|
12
|
+
workspace: effectiveWorkspace,
|
|
13
|
+
refreshInterval,
|
|
14
|
+
});
|
|
15
|
+
const { error: unreadNotificationsError, hasNextPage: unreadNotificationsHasNextPage, loadNextPage: unreadNotificationsLoadNextPage, notifications: unreadNotifications, status: unreadNotificationsStatus, totalNotificationsCount: unreadNotificationsCount, } = useFetchNotifications({
|
|
16
|
+
workspace: effectiveWorkspace,
|
|
17
|
+
readStatus: "unread",
|
|
18
|
+
refreshInterval,
|
|
19
|
+
});
|
|
20
|
+
const { result: organizationService, status: organizationStatus } = useOrganization();
|
|
21
|
+
const [markedAsReadNotifications, setMarkedAsReadNotifications] = useState([]);
|
|
22
|
+
const markNotificationAsRead = useCallback(async (notificationId) => {
|
|
23
|
+
if (organizationStatus === "error") {
|
|
24
|
+
throw new UnexpectedSdkError("Cannot call markAsRead - organization load failed.");
|
|
25
|
+
}
|
|
26
|
+
if (organizationStatus === "pending" || organizationStatus === "loading") {
|
|
27
|
+
throw new UnexpectedSdkError("Cannot call markAsRead - organization is not initialized.");
|
|
28
|
+
}
|
|
29
|
+
await organizationService.notifications().markNotificationAsRead(notificationId);
|
|
30
|
+
setMarkedAsReadNotifications((prev) => [...prev, notificationId]);
|
|
31
|
+
}, [organizationStatus, organizationService, setMarkedAsReadNotifications]);
|
|
32
|
+
const markAllNotificationsAsRead = useCallback(async () => {
|
|
33
|
+
if (organizationStatus === "error") {
|
|
34
|
+
throw new UnexpectedSdkError("Cannot call markAllAsRead - organization load failed.");
|
|
35
|
+
}
|
|
36
|
+
if (organizationStatus === "pending" || organizationStatus === "loading") {
|
|
37
|
+
throw new UnexpectedSdkError("Cannot call markAllAsRead - organization is not initialized.");
|
|
38
|
+
}
|
|
39
|
+
if (notificationsStatus === "error") {
|
|
40
|
+
throw new UnexpectedSdkError("Cannot call markAllAsRead - notifications load failed.");
|
|
41
|
+
}
|
|
42
|
+
if (notificationsStatus === "pending" || notificationsStatus === "loading") {
|
|
43
|
+
throw new UnexpectedSdkError("Cannot call markAllAsRead - notifications are not initialized.");
|
|
44
|
+
}
|
|
45
|
+
await organizationService.notifications().markAllNotificationsAsRead();
|
|
46
|
+
setMarkedAsReadNotifications(notifications.map((notification) => notification.id) ?? []);
|
|
47
|
+
}, [
|
|
48
|
+
organizationService,
|
|
49
|
+
organizationStatus,
|
|
50
|
+
notifications,
|
|
51
|
+
notificationsStatus,
|
|
52
|
+
setMarkedAsReadNotifications,
|
|
53
|
+
]);
|
|
54
|
+
const effectiveNotifications = useMemo(() => {
|
|
55
|
+
if (!notifications) {
|
|
56
|
+
return notifications;
|
|
57
|
+
}
|
|
58
|
+
return notifications.map((notification) => {
|
|
59
|
+
if (markedAsReadNotifications.includes(notification.id)) {
|
|
60
|
+
return { ...notification, isRead: true };
|
|
61
|
+
}
|
|
62
|
+
return notification;
|
|
63
|
+
});
|
|
64
|
+
}, [notifications, markedAsReadNotifications]);
|
|
65
|
+
const effectiveUnreadNotifications = useMemo(() => {
|
|
66
|
+
if (!unreadNotifications) {
|
|
67
|
+
return unreadNotifications;
|
|
68
|
+
}
|
|
69
|
+
return unreadNotifications
|
|
70
|
+
.map((notification) => {
|
|
71
|
+
if (markedAsReadNotifications.includes(notification.id)) {
|
|
72
|
+
return { ...notification, isRead: true };
|
|
73
|
+
}
|
|
74
|
+
return notification;
|
|
75
|
+
})
|
|
76
|
+
.filter((x) => !x.isRead);
|
|
77
|
+
}, [unreadNotifications, markedAsReadNotifications]);
|
|
78
|
+
return {
|
|
79
|
+
notifications: effectiveNotifications,
|
|
80
|
+
notificationsStatus,
|
|
81
|
+
notificationsError,
|
|
82
|
+
notificationsHasNextPage,
|
|
83
|
+
notificationsLoadNextPage,
|
|
84
|
+
unreadNotifications: effectiveUnreadNotifications,
|
|
85
|
+
unreadNotificationsStatus: unreadNotificationsStatus,
|
|
86
|
+
unreadNotificationsError: unreadNotificationsError,
|
|
87
|
+
unreadNotificationsHasNextPage: unreadNotificationsHasNextPage,
|
|
88
|
+
unreadNotificationsLoadNextPage: unreadNotificationsLoadNextPage,
|
|
89
|
+
unreadNotificationsCount: Math.max(0, unreadNotificationsCount - markedAsReadNotifications.length),
|
|
90
|
+
markNotificationAsRead,
|
|
91
|
+
markAllNotificationsAsRead,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=useNotifications.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useNotifications.js","sourceRoot":"","sources":["../../../src/notificationsPanel/data/useNotifications.tsx"],"names":[],"mappings":"AAAA,gCAAgC;AAGhC,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE1E,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;AAWnE;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,EAAE,SAAS,EAAE,eAAe,EAA0B;IACnF,MAAM,kBAAkB,GAAG,kBAAkB,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC;IAC7E,MAAM,EACF,aAAa,EACb,WAAW,EAAE,wBAAwB,EACrC,KAAK,EAAE,kBAAkB,EACzB,YAAY,EAAE,yBAAyB,EACvC,MAAM,EAAE,mBAAmB,GAC9B,GAAG,qBAAqB,CAAC;QACtB,SAAS,EAAE,kBAAkB;QAC7B,eAA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/B,CAAC;QAED,OAAO,mBAAmB;aACrB,GAAG,CAAC,CAAC,YAAY,EAAE,EAAE;YAClB,IAAI,yBAAyB,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,mBAAmB,EAAE,4BAA4B;QACjD,yBAAyB,EAAE,yBAAyB;QACpD,wBAAwB,EAAE,wBAAwB;QAClD,8BAA8B,EAAE,8BAA8B;QAC9D,+BAA+B,EAAE,+BAA+B;QAChE,wBAAwB,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,wBAAwB,GAAG,yBAAyB,CAAC,MAAM,CAAC;QAClG,sBAAsB;QACtB,0BAA0B;KAC7B,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
export interface IIntlWrapperProps {
|
|
6
|
+
locale?: string;
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export declare const IntlWrapper: React.FC<IIntlWrapperProps>;
|
|
13
|
+
//# sourceMappingURL=IntlWrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IntlWrapper.d.ts","sourceRoot":"","sources":["../../../src/notificationsPanel/localization/IntlWrapper.tsx"],"names":[],"mappings":"AACA,OAAO,KAAsB,MAAM,OAAO,CAAC;AA+B3C;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC9B;AAED;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAenD,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// (C) 2007-2024 GoodData Corporation
|
|
2
|
+
import React, { useCallback } from "react";
|
|
3
|
+
import { IntlProvider } from "react-intl";
|
|
4
|
+
import { DefaultLocale, TranslationsCustomizationProvider, resolveLocaleDefaultMessages, } from "@gooddata/sdk-ui";
|
|
5
|
+
import { translations } from "../../internal/utils/translations.js";
|
|
6
|
+
const formats = {
|
|
7
|
+
time: {
|
|
8
|
+
hhmm: {
|
|
9
|
+
hour: "numeric",
|
|
10
|
+
minute: "numeric",
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
date: {
|
|
14
|
+
shortWithoutYear: {
|
|
15
|
+
day: "numeric",
|
|
16
|
+
month: "short",
|
|
17
|
+
},
|
|
18
|
+
shortWithYear: {
|
|
19
|
+
day: "numeric",
|
|
20
|
+
month: "short",
|
|
21
|
+
year: "numeric",
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
export const IntlWrapper = ({ children, locale = DefaultLocale }) => {
|
|
29
|
+
const render = useCallback((modifiedTranslations) => (React.createElement(IntlProvider, { locale: locale, messages: modifiedTranslations, formats: formats }, children)), [locale, children]);
|
|
30
|
+
return (React.createElement(TranslationsCustomizationProvider, { translations: resolveLocaleDefaultMessages(locale, translations), render: render }));
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=IntlWrapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IntlWrapper.js","sourceRoot":"","sources":["../../../src/notificationsPanel/localization/IntlWrapper.tsx"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAiB,YAAY,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,EACH,aAAa,EAEb,iCAAiC,EACjC,4BAA4B,GAC/B,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAEpE,MAAM,OAAO,GAAkB;IAC3B,IAAI,EAAE;QACF,IAAI,EAAE;YACF,IAAI,EAAE,SAAS;YACf,MAAM,EAAE,SAAS;SACpB;KACJ;IACD,IAAI,EAAE;QACF,gBAAgB,EAAE;YACd,GAAG,EAAE,SAAS;YACd,KAAK,EAAE,OAAO;SACjB;QACD,aAAa,EAAE;YACX,GAAG,EAAE,SAAS;YACd,KAAK,EAAE,OAAO;YACd,IAAI,EAAE,SAAS;SAClB;KACJ;CACJ,CAAC;AAUF;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAgC,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,aAAa,EAAE,EAAE,EAAE;IAC7F,MAAM,MAAM,GAAG,WAAW,CACtB,CAAC,oBAAoB,EAAE,EAAE,CAAC,CACtB,oBAAC,YAAY,IAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,oBAAoB,EAAE,OAAO,EAAE,OAAO,IACzE,QAAQ,CACE,CAClB,EACD,CAAC,MAAM,EAAE,QAAQ,CAAC,CACrB,CAAC;IACF,OAAO,CACH,oBAAC,iCAAiC,IAC9B,YAAY,EAAE,4BAA4B,CAAC,MAAM,EAAE,YAAY,CAAC,EAChE,MAAM,EAAE,MAAM,GAChB,CACL,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/notificationsPanel/types.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,KAAK,GAAG,QAAQ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/notificationsPanel/types.ts"],"names":[],"mappings":"AAAA,gCAAgC"}
|
package/esm/sdk-ui-ext.d.ts
CHANGED
|
@@ -31,6 +31,7 @@ import { IInsight } from '@gooddata/sdk-model';
|
|
|
31
31
|
import { IInsightDefinition } from '@gooddata/sdk-model';
|
|
32
32
|
import { ILoadingProps } from '@gooddata/sdk-ui';
|
|
33
33
|
import { ILocale } from '@gooddata/sdk-ui';
|
|
34
|
+
import { INotification } from '@gooddata/sdk-model';
|
|
34
35
|
import { IPivotTableConfig } from '@gooddata/sdk-ui-pivot';
|
|
35
36
|
import { ISettings } from '@gooddata/sdk-model';
|
|
36
37
|
import { ITheme } from '@gooddata/sdk-model';
|
|
@@ -40,6 +41,8 @@ import { LocalIdRef } from '@gooddata/sdk-model';
|
|
|
40
41
|
import { ObjRef } from '@gooddata/sdk-model';
|
|
41
42
|
import { OnError } from '@gooddata/sdk-ui';
|
|
42
43
|
import { default as React_2 } from 'react';
|
|
44
|
+
import { RefObject } from 'react';
|
|
45
|
+
import { UseCancelablePromiseStatus } from '@gooddata/sdk-ui';
|
|
43
46
|
import { WithIntlProps } from 'react-intl';
|
|
44
47
|
import { WrappedComponentProps } from 'react-intl';
|
|
45
48
|
|
|
@@ -126,6 +129,11 @@ export declare type DataSourcePermission = "USE" | "MANAGE";
|
|
|
126
129
|
*/
|
|
127
130
|
export declare type DataSourcePermissionSubject = "user" | "userGroup";
|
|
128
131
|
|
|
132
|
+
/**
|
|
133
|
+
* @internal
|
|
134
|
+
*/
|
|
135
|
+
export declare function DefaultOpenNotificationsPanelButton({ buttonRef, isNotificationPanelOpen, toggleNotificationPanel, hasUnreadNotifications, }: IOpenNotificationsPanelButtonComponentProps): React_2.JSX.Element;
|
|
136
|
+
|
|
129
137
|
/**
|
|
130
138
|
* @internal
|
|
131
139
|
*/
|
|
@@ -531,6 +539,164 @@ export declare interface ILayoutDescriptor {
|
|
|
531
539
|
type: LayoutType;
|
|
532
540
|
}
|
|
533
541
|
|
|
542
|
+
/**
|
|
543
|
+
* @alpha
|
|
544
|
+
*/
|
|
545
|
+
export declare interface INotificationComponentProps {
|
|
546
|
+
notification: INotification;
|
|
547
|
+
markAsRead: (id: string) => void;
|
|
548
|
+
onNotificationClick: (notification: INotification) => void;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
/**
|
|
552
|
+
* @alpha
|
|
553
|
+
*/
|
|
554
|
+
export declare interface INotificationsListComponentProps {
|
|
555
|
+
NotificationsListEmptyState: React_2.ComponentType<INotificationsListEmptyStateComponentProps>;
|
|
556
|
+
NotificationsListErrorState: React_2.ComponentType<INotificationsListErrorStateComponentProps>;
|
|
557
|
+
Notification: React_2.ComponentType<INotificationComponentProps>;
|
|
558
|
+
activeView: INotificationsPanelView;
|
|
559
|
+
status: UseCancelablePromiseStatus;
|
|
560
|
+
error?: GoodDataSdkError;
|
|
561
|
+
notifications?: INotification[];
|
|
562
|
+
markNotificationAsRead: (notificationId: string) => Promise<void>;
|
|
563
|
+
onNotificationClick: (notification: INotification) => void;
|
|
564
|
+
hasNextPage: boolean;
|
|
565
|
+
loadNextPage: () => void;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
/**
|
|
569
|
+
* @alpha
|
|
570
|
+
*/
|
|
571
|
+
export declare interface INotificationsListEmptyStateComponentProps {
|
|
572
|
+
activeView: INotificationsPanelView;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
/**
|
|
576
|
+
* @alpha
|
|
577
|
+
*/
|
|
578
|
+
export declare interface INotificationsListErrorStateComponentProps {
|
|
579
|
+
error?: GoodDataSdkError;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
/**
|
|
583
|
+
* @alpha
|
|
584
|
+
*/
|
|
585
|
+
export declare interface INotificationsPanelComponentProps {
|
|
586
|
+
NotificationsPanelHeader: React_2.ComponentType<INotificationsPanelHeaderComponentProps>;
|
|
587
|
+
NotificationsList: React_2.ComponentType<INotificationsListComponentProps>;
|
|
588
|
+
NotificationsListEmptyState: React_2.ComponentType<INotificationsListEmptyStateComponentProps>;
|
|
589
|
+
NotificationsListErrorState: React_2.ComponentType<INotificationsListErrorStateComponentProps>;
|
|
590
|
+
Notification: React_2.ComponentType<INotificationComponentProps>;
|
|
591
|
+
toggleNotificationsPanel: () => void;
|
|
592
|
+
openNotificationsPanel: () => void;
|
|
593
|
+
closeNotificationsPanel: () => void;
|
|
594
|
+
activeView: INotificationsPanelView;
|
|
595
|
+
changeActiveView: (view: INotificationsPanelView) => void;
|
|
596
|
+
markNotificationAsRead: (notificationId: string) => Promise<void>;
|
|
597
|
+
markAllNotificationsAsRead: () => Promise<void>;
|
|
598
|
+
unreadNotificationsCount: number;
|
|
599
|
+
activeNotifications: INotification[];
|
|
600
|
+
onNotificationClick: (notification: INotification) => void;
|
|
601
|
+
status: UseCancelablePromiseStatus;
|
|
602
|
+
error?: GoodDataSdkError;
|
|
603
|
+
loadNextPage: () => void;
|
|
604
|
+
hasNextPage: boolean;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
/**
|
|
608
|
+
* @alpha
|
|
609
|
+
*/
|
|
610
|
+
export declare interface INotificationsPanelCustomComponentsProps {
|
|
611
|
+
/**
|
|
612
|
+
* Custom open notifications panel button component.
|
|
613
|
+
*/
|
|
614
|
+
OpenNotificationsPanelButton: React_2.ComponentType<IOpenNotificationsPanelButtonComponentProps>;
|
|
615
|
+
/**
|
|
616
|
+
* Custom notifications panel component.
|
|
617
|
+
*/
|
|
618
|
+
NotificationsPanel?: React_2.ComponentType<INotificationsPanelComponentProps>;
|
|
619
|
+
/**
|
|
620
|
+
* Custom notifications panel header component.
|
|
621
|
+
*/
|
|
622
|
+
NotificationsPanelHeader?: React_2.ComponentType<INotificationsPanelHeaderComponentProps>;
|
|
623
|
+
/**
|
|
624
|
+
* Custom notifications list component.
|
|
625
|
+
*/
|
|
626
|
+
NotificationsList?: React_2.ComponentType<INotificationsListComponentProps>;
|
|
627
|
+
/**
|
|
628
|
+
* Custom notifications list empty state component.
|
|
629
|
+
*/
|
|
630
|
+
NotificationsListEmptyState?: React_2.ComponentType<INotificationsListEmptyStateComponentProps>;
|
|
631
|
+
/**
|
|
632
|
+
* Custom notifications list error state component.
|
|
633
|
+
*/
|
|
634
|
+
NotificationsListErrorState?: React_2.ComponentType<INotificationsListErrorStateComponentProps>;
|
|
635
|
+
/**
|
|
636
|
+
* Custom notification component.
|
|
637
|
+
*/
|
|
638
|
+
Notification?: React_2.ComponentType<INotificationComponentProps>;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
/**
|
|
642
|
+
* @alpha
|
|
643
|
+
*/
|
|
644
|
+
export declare interface INotificationsPanelHeaderComponentProps {
|
|
645
|
+
/**
|
|
646
|
+
* The currently active view of the notifications panel.
|
|
647
|
+
*/
|
|
648
|
+
activeView: INotificationsPanelView;
|
|
649
|
+
/**
|
|
650
|
+
* The callback to change the active view.
|
|
651
|
+
*/
|
|
652
|
+
changeActiveView: (view: INotificationsPanelView) => void;
|
|
653
|
+
/**
|
|
654
|
+
* Indicates if there are unread notifications.
|
|
655
|
+
*/
|
|
656
|
+
hasUnreadNotifications: boolean;
|
|
657
|
+
/**
|
|
658
|
+
* The number of unread notifications.
|
|
659
|
+
*/
|
|
660
|
+
unreadNotificationsCount: number;
|
|
661
|
+
/**
|
|
662
|
+
* The callback to mark all notifications as read.
|
|
663
|
+
*/
|
|
664
|
+
markAllAsRead: () => void;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
/**
|
|
668
|
+
* @alpha
|
|
669
|
+
*/
|
|
670
|
+
export declare interface INotificationsPanelProps extends INotificationsPanelCustomComponentsProps {
|
|
671
|
+
/**
|
|
672
|
+
* Backend to use.
|
|
673
|
+
*/
|
|
674
|
+
backend?: IAnalyticalBackend;
|
|
675
|
+
/**
|
|
676
|
+
* Workspace ID to use.
|
|
677
|
+
*/
|
|
678
|
+
workspace?: string;
|
|
679
|
+
/**
|
|
680
|
+
* Refresh interval in milliseconds.
|
|
681
|
+
* Default is 10 minutes.
|
|
682
|
+
* If set to 0, notifications will not be refreshed automatically.
|
|
683
|
+
*/
|
|
684
|
+
refreshInterval?: number;
|
|
685
|
+
/**
|
|
686
|
+
* Locale to use.
|
|
687
|
+
*/
|
|
688
|
+
locale?: ILocale;
|
|
689
|
+
/**
|
|
690
|
+
* Handler for notification click.
|
|
691
|
+
*/
|
|
692
|
+
onNotificationClick: (notification: INotification) => void;
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
/**
|
|
696
|
+
* @alpha
|
|
697
|
+
*/
|
|
698
|
+
export declare type INotificationsPanelView = "all" | "unread";
|
|
699
|
+
|
|
534
700
|
/**
|
|
535
701
|
* @internal
|
|
536
702
|
*/
|
|
@@ -569,6 +735,36 @@ export declare class InsightView extends React_2.Component<IInsightViewProps> {
|
|
|
569
735
|
render(): React_2.JSX.Element;
|
|
570
736
|
}
|
|
571
737
|
|
|
738
|
+
/**
|
|
739
|
+
* @alpha
|
|
740
|
+
*/
|
|
741
|
+
export declare interface IOpenNotificationsPanelButtonComponentProps {
|
|
742
|
+
/**
|
|
743
|
+
* Ref to the button element - is required for proper alignment of the notification panel.
|
|
744
|
+
*/
|
|
745
|
+
buttonRef: RefObject<HTMLElement | null>;
|
|
746
|
+
/**
|
|
747
|
+
* Opens the notification panel.
|
|
748
|
+
*/
|
|
749
|
+
openNotificationPanel: () => void;
|
|
750
|
+
/**
|
|
751
|
+
* Closes the notification panel.
|
|
752
|
+
*/
|
|
753
|
+
closeNotificationPanel: () => void;
|
|
754
|
+
/**
|
|
755
|
+
* Toggles the notification panel.
|
|
756
|
+
*/
|
|
757
|
+
toggleNotificationPanel: () => void;
|
|
758
|
+
/**
|
|
759
|
+
* Indicates whether the notification panel is open.
|
|
760
|
+
*/
|
|
761
|
+
isNotificationPanelOpen: boolean;
|
|
762
|
+
/**
|
|
763
|
+
* Indicates whether there are unread notifications.
|
|
764
|
+
*/
|
|
765
|
+
hasUnreadNotifications: boolean;
|
|
766
|
+
}
|
|
767
|
+
|
|
572
768
|
/**
|
|
573
769
|
* Type-guard testing whether the provided object is an instance of {@link IDrillDownDefinition}.
|
|
574
770
|
* @beta
|
|
@@ -721,6 +917,11 @@ export declare type LayoutType = "fluid";
|
|
|
721
917
|
*/
|
|
722
918
|
export declare const MIN_VISUALIZATION_WIDTH = 2;
|
|
723
919
|
|
|
920
|
+
/**
|
|
921
|
+
* @alpha
|
|
922
|
+
*/
|
|
923
|
+
export declare function NotificationsPanel(props: INotificationsPanelProps): React_2.JSX.Element;
|
|
924
|
+
|
|
724
925
|
/**
|
|
725
926
|
* @alpha
|
|
726
927
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gooddata/sdk-ui-ext",
|
|
3
|
-
"version": "10.18.0-alpha.
|
|
3
|
+
"version": "10.18.0-alpha.11",
|
|
4
4
|
"description": "GoodData.UI SDK - Extensions",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -30,10 +30,12 @@
|
|
|
30
30
|
"esm/**/*.d.ts",
|
|
31
31
|
"esm/**/*.map",
|
|
32
32
|
"esm/**/*.svg",
|
|
33
|
+
"src/**/*.scss",
|
|
33
34
|
"styles",
|
|
34
35
|
"NOTICE"
|
|
35
36
|
],
|
|
36
37
|
"dependencies": {
|
|
38
|
+
"@tanstack/react-virtual": "^3.11.1",
|
|
37
39
|
"classnames": "^2.3.1",
|
|
38
40
|
"codemirror": "^5.54.0",
|
|
39
41
|
"date-fns": "^2.22.1",
|
|
@@ -46,6 +48,7 @@
|
|
|
46
48
|
"lru-cache": "^10.0.1",
|
|
47
49
|
"react-intl": "^6.4.1",
|
|
48
50
|
"react-lines-ellipsis": "^0.15.0",
|
|
51
|
+
"react-loading-skeleton": "^3.4.0",
|
|
49
52
|
"react-measure": "^2.5.2",
|
|
50
53
|
"react-select": "^5.7.3",
|
|
51
54
|
"react-select-async-paginate": "^0.7.3",
|
|
@@ -53,18 +56,19 @@
|
|
|
53
56
|
"ts-invariant": "^0.7.5",
|
|
54
57
|
"tslib": "^2.5.0",
|
|
55
58
|
"uuid": "^8.3.2",
|
|
56
|
-
"@gooddata/sdk-backend-base": "10.18.0-alpha.
|
|
57
|
-
"@gooddata/sdk-backend-spi": "10.18.0-alpha.
|
|
58
|
-
"@gooddata/sdk-
|
|
59
|
-
"@gooddata/sdk-
|
|
60
|
-
"@gooddata/sdk-
|
|
61
|
-
"@gooddata/sdk-ui-
|
|
62
|
-
"@gooddata/sdk-ui-
|
|
63
|
-
"@gooddata/sdk-ui-geo": "10.18.0-alpha.
|
|
64
|
-
"@gooddata/sdk-ui-
|
|
65
|
-
"@gooddata/sdk-ui-theme-provider": "10.18.0-alpha.
|
|
66
|
-
"@gooddata/sdk-ui-
|
|
67
|
-
"@gooddata/
|
|
59
|
+
"@gooddata/sdk-backend-base": "10.18.0-alpha.11",
|
|
60
|
+
"@gooddata/sdk-backend-spi": "10.18.0-alpha.11",
|
|
61
|
+
"@gooddata/sdk-model": "10.18.0-alpha.11",
|
|
62
|
+
"@gooddata/sdk-embedding": "10.18.0-alpha.11",
|
|
63
|
+
"@gooddata/sdk-ui": "10.18.0-alpha.11",
|
|
64
|
+
"@gooddata/sdk-ui-filters": "10.18.0-alpha.11",
|
|
65
|
+
"@gooddata/sdk-ui-charts": "10.18.0-alpha.11",
|
|
66
|
+
"@gooddata/sdk-ui-geo": "10.18.0-alpha.11",
|
|
67
|
+
"@gooddata/sdk-ui-kit": "10.18.0-alpha.11",
|
|
68
|
+
"@gooddata/sdk-ui-theme-provider": "10.18.0-alpha.11",
|
|
69
|
+
"@gooddata/sdk-ui-pivot": "10.18.0-alpha.11",
|
|
70
|
+
"@gooddata/sdk-ui-vis-commons": "10.18.0-alpha.11",
|
|
71
|
+
"@gooddata/util": "10.18.0-alpha.11"
|
|
68
72
|
},
|
|
69
73
|
"peerDependencies": {
|
|
70
74
|
"react": "^16.10.0 || ^17.0.0 || ^18.0.0",
|
|
@@ -121,9 +125,9 @@
|
|
|
121
125
|
"@types/json-stable-stringify": "^1.0.32",
|
|
122
126
|
"@types/codemirror": "^5.60.7",
|
|
123
127
|
"@types/js-yaml": "^4.0.9",
|
|
124
|
-
"@gooddata/i18n-toolkit": "10.18.0-alpha.
|
|
125
|
-
"@gooddata/
|
|
126
|
-
"@gooddata/
|
|
128
|
+
"@gooddata/i18n-toolkit": "10.18.0-alpha.11",
|
|
129
|
+
"@gooddata/reference-workspace": "10.18.0-alpha.11",
|
|
130
|
+
"@gooddata/sdk-backend-mockingbird": "10.18.0-alpha.11"
|
|
127
131
|
},
|
|
128
132
|
"scripts": {
|
|
129
133
|
"clean": "rm -rf ci dist esm coverage *.log styles/css tsconfig.tsbuildinfo",
|