@boomerang-io/carbon-addons-boomerang-react 4.6.14-beta.9 → 4.6.15-beta.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/README.md +162 -162
- package/dist/cjs/components/AboutPlatform/AboutPlatform.js +50 -50
- package/dist/cjs/components/AdvantageSideNav/AdvantageSideNav.js +221 -221
- package/dist/cjs/components/AutoSuggest/AutoSuggest.js +101 -101
- package/dist/cjs/components/Avatar/Avatar.js +18 -18
- package/dist/cjs/components/CheckboxList/CheckboxList.js +34 -34
- package/dist/cjs/components/ComboBox/ComboBox.js +103 -103
- package/dist/cjs/components/ComboBoxMultiSelect/ComboBoxMultiSelect.js +32 -32
- package/dist/cjs/components/ComboBoxMultiSelect/MultiSelect.js +208 -208
- package/dist/cjs/components/ComposedModal/ComposedModal.js +80 -80
- package/dist/cjs/components/ConfirmModal/ConfirmModal.js +43 -43
- package/dist/cjs/components/Creatable/Creatable.js +137 -137
- package/dist/cjs/components/DataDrivenInput/DataDrivenInput.js +226 -226
- package/dist/cjs/components/DateInput/DateInput.js +35 -35
- package/dist/cjs/components/DecisionButtons/DecisionButtons.js +61 -61
- package/dist/cjs/components/DelayedRender/DelayedRender.js +17 -17
- package/dist/cjs/components/DynamicFormik/DynamicFormik.js +578 -578
- package/dist/cjs/components/Error403/Error403.js +13 -13
- package/dist/cjs/components/Error403/ForbiddenErrorBackground.js +113 -113
- package/dist/cjs/components/Error403/GraphicWrangler/GraphicWrangler.js +62 -62
- package/dist/cjs/components/Error404/Error404.js +13 -13
- package/dist/cjs/components/Error404/GraphicLoch/GraphicLoch.js +17 -17
- package/dist/cjs/components/Error404/NotFoundErrorBackground.js +129 -129
- package/dist/cjs/components/ErrorBoundary/ErrorBoundary.js +32 -32
- package/dist/cjs/components/ErrorDragon/ErrorDragon.js +13 -13
- package/dist/cjs/components/ErrorDragon/assets/ErrorGraphic.js +35 -35
- package/dist/cjs/components/ErrorFullPage/ErrorFullPage.js +10 -10
- package/dist/cjs/components/ErrorMessage/ErrorMessage.js +22 -22
- package/dist/cjs/components/ErrorPage/ErrorPage.js +11 -11
- package/dist/cjs/components/ErrorPageCore/ErrorPageCore.js +15 -15
- package/dist/cjs/components/ErrorPageCore/GenericErrorBackground.js +124 -124
- package/dist/cjs/components/FeatureHeader/FeatureHeader.js +29 -29
- package/dist/cjs/components/FeatureNavTab/FeatureNavTab.js +12 -12
- package/dist/cjs/components/FeatureNavTabs/FeatureNavTabs.js +12 -12
- package/dist/cjs/components/FeatureSideNav/FeatureSideNav.js +12 -12
- package/dist/cjs/components/FeatureSideNav/FeatureSideNavFooter.js +8 -8
- package/dist/cjs/components/FeatureSideNav/FeatureSideNavHeader.js +8 -8
- package/dist/cjs/components/FeatureSideNav/FeatureSideNavLinks.js +14 -14
- package/dist/cjs/components/FeatureSideNavLink/FeatureSideNavLink.js +12 -12
- package/dist/cjs/components/Feedback/Feedback.js +38 -38
- package/dist/cjs/components/FlowModal/FlowModal.js +141 -141
- package/dist/cjs/components/FlowModal/FlowModalForm.js +12 -12
- package/dist/cjs/components/Header/Header.js +187 -187
- package/dist/cjs/components/Header/HeaderAppSwitcher.js +94 -94
- package/dist/cjs/components/Header/HeaderMenu.js +7 -7
- package/dist/cjs/components/Header/HeaderMenuItem.js +51 -51
- package/dist/cjs/components/Header/HeaderTeamSwitcher.js +329 -332
- package/dist/cjs/components/Header/UserRequests.js +29 -29
- package/dist/cjs/components/ImageModal/ImageModal.js +17 -17
- package/dist/cjs/components/Loading/Loading.js +8 -8
- package/dist/cjs/components/MemberBar/MemberBar.js +20 -20
- package/dist/cjs/components/Modal/Modal.js +20 -20
- package/dist/cjs/components/ModalConfirmEdit/ModalConfirmArray.js +14 -14
- package/dist/cjs/components/ModalConfirmEdit/ModalConfirmDetails.js +11 -11
- package/dist/cjs/components/ModalConfirmEdit/ModalConfirmEdit.js +17 -17
- package/dist/cjs/components/ModalForm/ModalForm.js +9 -9
- package/dist/cjs/components/Notifications/NotificationsContainer.js +22 -22
- package/dist/cjs/components/Notifications/ToastNotification.js +21 -21
- package/dist/cjs/components/Notifications/notify.js +17 -17
- package/dist/cjs/components/PlatformBanner/PlatformBanner.js +8 -8
- package/dist/cjs/components/PlatformNotifications/PlatformNotification.js +17 -17
- package/dist/cjs/components/PlatformNotifications/PlatformNotificationsContainer.js +136 -136
- package/dist/cjs/components/Portal/Portal.js +14 -14
- package/dist/cjs/components/PrivacyRedirect/PrivacyRedirect.js +30 -30
- package/dist/cjs/components/PrivacyStatement/PrivacyStatement.js +90 -90
- package/dist/cjs/components/ProfileSettings/ProfileSettings.js +124 -142
- package/dist/cjs/components/ProtectedRoute/ProtectedRoute.js +13 -13
- package/dist/cjs/components/RadioGroup/RadioGroup.js +33 -33
- package/dist/cjs/components/RichTextArea/RichTextArea.js +142 -142
- package/dist/cjs/components/SignOut/SignOut.js +27 -27
- package/dist/cjs/components/SupportCenter/SupportCenter.js +65 -65
- package/dist/cjs/components/TextArea/TextArea.js +16 -16
- package/dist/cjs/components/TextInput/TextInput.js +13 -13
- package/dist/cjs/components/Toggle/Toggle.js +22 -22
- package/dist/cjs/components/TooltipHover/TooltipHover.js +39 -39
- package/dist/cjs/components/UIShell/UIShell.js +95 -95
- package/dist/cjs/config/servicesConfig.js +22 -22
- package/dist/cjs/constants/DataDrivenInputTypes.js +74 -74
- package/dist/cjs/constants/UserType.js +13 -13
- package/dist/cjs/hooks/useHeaderMenu.js +49 -49
- package/dist/cjs/hooks/usePortal.js +74 -74
- package/dist/cjs/hooks/useWindowSize.js +33 -33
- package/dist/cjs/internal/ListBox/ListBox.js +41 -41
- package/dist/cjs/internal/ListBox/ListBoxField.js +19 -19
- package/dist/cjs/internal/ListBox/ListBoxMenu.js +19 -19
- package/dist/cjs/internal/ListBox/ListBoxMenuIcon.js +31 -31
- package/dist/cjs/internal/ListBox/ListBoxMenuItem.js +38 -38
- package/dist/cjs/internal/ListBox/ListBoxSelection.js +64 -64
- package/dist/cjs/internal/ListBox/index.js +10 -10
- package/dist/cjs/internal/keyboard/keys.js +16 -16
- package/dist/cjs/internal/keyboard/match.js +67 -67
- package/dist/cjs/internal/settings.js +5 -5
- package/dist/cjs/tools/accessibility.js +13 -13
- package/dist/cjs/tools/createPropAdapter.js +44 -44
- package/dist/cjs/tools/isUrl.js +39 -39
- package/dist/cjs/tools/setupGetInstanceId.js +20 -20
- package/dist/cjs/tools/useSetState.js +12 -12
- package/dist/cjs/tools/yupAst/astGenerator.js +212 -212
- package/dist/cjs/tools/yupAst/customValidators.js +17 -17
- package/dist/esm/components/AboutPlatform/AboutPlatform.js +50 -50
- package/dist/esm/components/AdvantageSideNav/AdvantageSideNav.js +221 -221
- package/dist/esm/components/AutoSuggest/AutoSuggest.js +101 -101
- package/dist/esm/components/Avatar/Avatar.js +18 -18
- package/dist/esm/components/CheckboxList/CheckboxList.js +34 -34
- package/dist/esm/components/ComboBox/ComboBox.js +103 -103
- package/dist/esm/components/ComboBoxMultiSelect/ComboBoxMultiSelect.js +32 -32
- package/dist/esm/components/ComboBoxMultiSelect/MultiSelect.js +208 -208
- package/dist/esm/components/ComposedModal/ComposedModal.js +80 -80
- package/dist/esm/components/ConfirmModal/ConfirmModal.js +43 -43
- package/dist/esm/components/Creatable/Creatable.js +137 -137
- package/dist/esm/components/DataDrivenInput/DataDrivenInput.js +226 -226
- package/dist/esm/components/DateInput/DateInput.js +35 -35
- package/dist/esm/components/DecisionButtons/DecisionButtons.js +61 -61
- package/dist/esm/components/DelayedRender/DelayedRender.js +17 -17
- package/dist/esm/components/DynamicFormik/DynamicFormik.js +578 -578
- package/dist/esm/components/Error403/Error403.js +13 -13
- package/dist/esm/components/Error403/ForbiddenErrorBackground.js +113 -113
- package/dist/esm/components/Error403/GraphicWrangler/GraphicWrangler.js +62 -62
- package/dist/esm/components/Error404/Error404.js +13 -13
- package/dist/esm/components/Error404/GraphicLoch/GraphicLoch.js +17 -17
- package/dist/esm/components/Error404/NotFoundErrorBackground.js +129 -129
- package/dist/esm/components/ErrorBoundary/ErrorBoundary.js +32 -32
- package/dist/esm/components/ErrorDragon/ErrorDragon.js +13 -13
- package/dist/esm/components/ErrorDragon/assets/ErrorGraphic.js +35 -35
- package/dist/esm/components/ErrorFullPage/ErrorFullPage.js +10 -10
- package/dist/esm/components/ErrorMessage/ErrorMessage.js +22 -22
- package/dist/esm/components/ErrorPage/ErrorPage.js +11 -11
- package/dist/esm/components/ErrorPageCore/ErrorPageCore.js +15 -15
- package/dist/esm/components/ErrorPageCore/GenericErrorBackground.js +124 -124
- package/dist/esm/components/FeatureHeader/FeatureHeader.js +29 -29
- package/dist/esm/components/FeatureNavTab/FeatureNavTab.js +12 -12
- package/dist/esm/components/FeatureNavTabs/FeatureNavTabs.js +12 -12
- package/dist/esm/components/FeatureSideNav/FeatureSideNav.js +12 -12
- package/dist/esm/components/FeatureSideNav/FeatureSideNavFooter.js +8 -8
- package/dist/esm/components/FeatureSideNav/FeatureSideNavHeader.js +8 -8
- package/dist/esm/components/FeatureSideNav/FeatureSideNavLinks.js +14 -14
- package/dist/esm/components/FeatureSideNavLink/FeatureSideNavLink.js +12 -12
- package/dist/esm/components/Feedback/Feedback.js +38 -38
- package/dist/esm/components/FlowModal/FlowModal.js +141 -141
- package/dist/esm/components/FlowModal/FlowModalForm.js +12 -12
- package/dist/esm/components/Header/Header.js +187 -187
- package/dist/esm/components/Header/HeaderAppSwitcher.js +94 -94
- package/dist/esm/components/Header/HeaderMenu.js +7 -7
- package/dist/esm/components/Header/HeaderMenuItem.js +51 -51
- package/dist/esm/components/Header/HeaderTeamSwitcher.js +329 -332
- package/dist/esm/components/Header/UserRequests.js +29 -29
- package/dist/esm/components/ImageModal/ImageModal.js +17 -17
- package/dist/esm/components/Loading/Loading.js +8 -8
- package/dist/esm/components/MemberBar/MemberBar.js +20 -20
- package/dist/esm/components/Modal/Modal.js +20 -20
- package/dist/esm/components/ModalConfirmEdit/ModalConfirmArray.js +14 -14
- package/dist/esm/components/ModalConfirmEdit/ModalConfirmDetails.js +11 -11
- package/dist/esm/components/ModalConfirmEdit/ModalConfirmEdit.js +17 -17
- package/dist/esm/components/ModalForm/ModalForm.js +9 -9
- package/dist/esm/components/Notifications/NotificationsContainer.js +22 -22
- package/dist/esm/components/Notifications/ToastNotification.js +21 -21
- package/dist/esm/components/Notifications/notify.js +17 -17
- package/dist/esm/components/PlatformBanner/PlatformBanner.js +8 -8
- package/dist/esm/components/PlatformNotifications/PlatformNotification.js +17 -17
- package/dist/esm/components/PlatformNotifications/PlatformNotificationsContainer.js +136 -136
- package/dist/esm/components/Portal/Portal.js +14 -14
- package/dist/esm/components/PrivacyRedirect/PrivacyRedirect.js +30 -30
- package/dist/esm/components/PrivacyStatement/PrivacyStatement.js +90 -90
- package/dist/esm/components/ProfileSettings/ProfileSettings.js +124 -142
- package/dist/esm/components/ProtectedRoute/ProtectedRoute.js +13 -13
- package/dist/esm/components/RadioGroup/RadioGroup.js +33 -33
- package/dist/esm/components/RichTextArea/RichTextArea.js +142 -142
- package/dist/esm/components/SignOut/SignOut.js +27 -27
- package/dist/esm/components/SupportCenter/SupportCenter.js +65 -65
- package/dist/esm/components/TextArea/TextArea.js +16 -16
- package/dist/esm/components/TextInput/TextInput.js +13 -13
- package/dist/esm/components/Toggle/Toggle.js +22 -22
- package/dist/esm/components/TooltipHover/TooltipHover.js +39 -39
- package/dist/esm/components/UIShell/UIShell.js +95 -95
- package/dist/esm/config/servicesConfig.js +22 -22
- package/dist/esm/constants/DataDrivenInputTypes.js +74 -74
- package/dist/esm/constants/UserType.js +13 -13
- package/dist/esm/hooks/useHeaderMenu.js +49 -49
- package/dist/esm/hooks/usePortal.js +74 -74
- package/dist/esm/hooks/useWindowSize.js +33 -33
- package/dist/esm/internal/ListBox/ListBox.js +41 -41
- package/dist/esm/internal/ListBox/ListBoxField.js +19 -19
- package/dist/esm/internal/ListBox/ListBoxMenu.js +19 -19
- package/dist/esm/internal/ListBox/ListBoxMenuIcon.js +31 -31
- package/dist/esm/internal/ListBox/ListBoxMenuItem.js +38 -38
- package/dist/esm/internal/ListBox/ListBoxSelection.js +64 -64
- package/dist/esm/internal/ListBox/index.js +10 -10
- package/dist/esm/internal/keyboard/keys.js +16 -16
- package/dist/esm/internal/keyboard/match.js +67 -67
- package/dist/esm/internal/settings.js +5 -5
- package/dist/esm/tools/accessibility.js +13 -13
- package/dist/esm/tools/createPropAdapter.js +44 -44
- package/dist/esm/tools/isUrl.js +39 -39
- package/dist/esm/tools/setupGetInstanceId.js +20 -20
- package/dist/esm/tools/useSetState.js +12 -12
- package/dist/esm/tools/yupAst/astGenerator.js +212 -212
- package/dist/esm/tools/yupAst/customValidators.js +17 -17
- package/dist/types/index.d.ts +1359 -1360
- package/package.json +167 -167
- package/scss/components/AboutPlatform/_aboutPlatform.scss +139 -139
- package/scss/components/AdvantageSideNav/_advantageSideNav.scss +272 -272
- package/scss/components/AutoSuggest/_autoSuggest.scss +62 -62
- package/scss/components/Avatar/_avatar.scss +32 -32
- package/scss/components/CheckboxList/_checkboxList.scss +26 -26
- package/scss/components/ComboBox/_combobox.scss +23 -23
- package/scss/components/ComboBoxMultiSelect/_comboBoxMultiSelect.scss +53 -53
- package/scss/components/ConfirmModal/_confirmModal.scss +12 -12
- package/scss/components/Creatable/_creatable.scss +48 -48
- package/scss/components/DateInput/_dateInput.scss +36 -36
- package/scss/components/DecisionButtons/_decisionButtons.scss +132 -132
- package/scss/components/DynamicFormik/_dynamicFormik.scss +17 -17
- package/scss/components/ErrorBoundary/_errorBoundary.scss +12 -12
- package/scss/components/ErrorDragon/_errorDragon.scss +55 -55
- package/scss/components/ErrorMessage/_errorMessage.scss +43 -43
- package/scss/components/ErrorPage/_errorPage.scss +66 -66
- package/scss/components/ErrorPageCore/_errorPageCore.scss +73 -73
- package/scss/components/FeatureHeader/_featureHeader.scss +67 -67
- package/scss/components/FeatureNavTab/_featureNavTab.scss +27 -27
- package/scss/components/FeatureSideNav/_featureSideNav.scss +76 -76
- package/scss/components/FeatureSideNavLink/_featureSideNavLink.scss +49 -49
- package/scss/components/Feedback/_feedback.scss +50 -50
- package/scss/components/Header/_header.scss +179 -179
- package/scss/components/Header/_headerAppSwitcher.scss +117 -117
- package/scss/components/Header/_headerMenu.scss +30 -30
- package/scss/components/Header/_headerMenuItem.scss +65 -65
- package/scss/components/Header/_headerTeamSwitcher.scss +222 -222
- package/scss/components/Header/_userRequests.scss +36 -36
- package/scss/components/ImageModal/_imageModal.scss +51 -51
- package/scss/components/MemberBar/_memberBar.scss +99 -99
- package/scss/components/Modal/_modal.scss +163 -163
- package/scss/components/ModalConfirmEdit/_modalConfirmEdit.scss +113 -113
- package/scss/components/Notifications/_notifications.scss +57 -57
- package/scss/components/PlatformBanner/_platformBanner.scss +30 -30
- package/scss/components/PlatformNotifications/_platformNotifications.scss +230 -230
- package/scss/components/PrivacyRedirect/_privacyRedirect.scss +43 -43
- package/scss/components/PrivacyStatement/_privacyStatement.scss +137 -137
- package/scss/components/ProfileSettings/_profileSettings.scss +117 -117
- package/scss/components/ProtectedRoute/_protectedRoute.scss +32 -32
- package/scss/components/RadioGroup/_radioGroup.scss +46 -46
- package/scss/components/RichTextArea/_richTextArea.scss +82 -82
- package/scss/components/SignOut/_signOut.scss +51 -51
- package/scss/components/SupportCenter/_supportCenter.scss +16 -16
- package/scss/components/TextArea/_textArea.scss +19 -19
- package/scss/components/TextInput/_textInput.scss +26 -26
- package/scss/components/Toggle/_toggle.scss +80 -80
- package/scss/components/TooltipHover/_tooltip.scss +48 -48
- package/scss/global/_config.scss +14 -14
- package/scss/global/_tippy.scss +49 -49
- package/scss/global/index.scss +401 -401
- package/scss/global/themes/_boomerang.scss +184 -184
- package/scss/global/themes/_default.scss +79 -79
- package/scss/global/themes/_shell-tokens.scss +42 -42
- package/scss/global/utils/_animations.scss +15 -15
- package/scss/global/utils/_mixins.scss +67 -67
- package/scss/global/utils/index.scss +10 -10
|
@@ -13,142 +13,142 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
|
13
13
|
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
14
14
|
var cx__default = /*#__PURE__*/_interopDefault(cx);
|
|
15
15
|
|
|
16
|
-
/*
|
|
17
|
-
IBM Confidential
|
|
18
|
-
694970X, 69497O0
|
|
19
|
-
© Copyright IBM Corp. 2022, 2024
|
|
20
|
-
*/
|
|
21
|
-
class PlatformNotificationsContainer extends React__default.default.Component {
|
|
22
|
-
ws;
|
|
23
|
-
articleRef = React__default.default.createRef();
|
|
24
|
-
state = {
|
|
25
|
-
error: false,
|
|
26
|
-
currentNotifications: this.props.initialNotifications ?? [],
|
|
27
|
-
numNotifications: this.props.initialNotifications?.length ?? 0,
|
|
28
|
-
};
|
|
29
|
-
componentDidMount() {
|
|
30
|
-
const brokerURL = `${this.props.baseServicesUrl}/notifications/ws`
|
|
31
|
-
.replace("https://", "wss://")
|
|
32
|
-
.replace("http://", "ws://");
|
|
33
|
-
this.ws = new stompjs.Client({
|
|
34
|
-
brokerURL,
|
|
35
|
-
reconnectDelay: 10000,
|
|
36
|
-
});
|
|
37
|
-
this.ws.onConnect = this.connect;
|
|
38
|
-
this.ws.activate();
|
|
39
|
-
}
|
|
40
|
-
connect = () => {
|
|
41
|
-
this.ws.subscribe("/user/queue/notifications", this.receiveNewNotifications);
|
|
42
|
-
this.ws.subscribe("/user/queue/reply", this.replyRead);
|
|
43
|
-
this.ws.subscribe("/user/queue/all", this.recieveAllUnreadNotifications);
|
|
44
|
-
this.ws.publish({ destination: "/app/all", body: {} });
|
|
45
|
-
};
|
|
46
|
-
componentWillUnmount() {
|
|
47
|
-
this.ws.deactivate();
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* recieve x amount of new notifications and pass them into state of current notifications
|
|
51
|
-
*
|
|
52
|
-
*/
|
|
53
|
-
receiveNewNotifications = (incomingNotifications) => {
|
|
54
|
-
if (incomingNotifications.body) {
|
|
55
|
-
const data = [JSON.parse(incomingNotifications.body)];
|
|
56
|
-
if (data.length > 0) {
|
|
57
|
-
this.props.setHasNewNotifications(true);
|
|
58
|
-
}
|
|
59
|
-
this.setState((prevState) => ({
|
|
60
|
-
currentNotifications: [...data, ...prevState.currentNotifications],
|
|
61
|
-
numNotifications: prevState.numNotifications + data.length,
|
|
62
|
-
}), () => {
|
|
63
|
-
this.props.setNotificationsCount(this.state.numNotifications);
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
this.setState({
|
|
68
|
-
error: true, // TOOD something here related to the error
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
/**
|
|
73
|
-
* overwrite current notifications, the param represents all unread notifications
|
|
74
|
-
*/
|
|
75
|
-
recieveAllUnreadNotifications = (incomingNotifications) => {
|
|
76
|
-
if (incomingNotifications.body) {
|
|
77
|
-
const jsonData = JSON.parse(incomingNotifications.body);
|
|
78
|
-
const data = jsonData.records;
|
|
79
|
-
if (data.length > 0) {
|
|
80
|
-
this.props.setHasNewNotifications(true);
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
// This has to be declared because this function can be triggered from the notification page in Launchpad
|
|
84
|
-
this.props.setHasNewNotifications(false);
|
|
85
|
-
}
|
|
86
|
-
this.setState({
|
|
87
|
-
currentNotifications: data,
|
|
88
|
-
numNotifications: data.length,
|
|
89
|
-
}, () => {
|
|
90
|
-
this.props.setNotificationsCount(this.state.numNotifications);
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
this.setState({
|
|
95
|
-
error: true, // TOOD something here related to the error
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
/**
|
|
100
|
-
* @param {Object} readResponse - list of notificationIds that have been read
|
|
101
|
-
* the function removes the notifications from current state that are returned as "read"
|
|
102
|
-
*/
|
|
103
|
-
replyRead = (readResponse) => {
|
|
104
|
-
const readIdList = JSON.parse(readResponse.body);
|
|
105
|
-
this.setState((prevState) => ({
|
|
106
|
-
currentNotifications: prevState.currentNotifications.filter((el) => readIdList.indexOf(el.id) === -1),
|
|
107
|
-
numNotifications: prevState.numNotifications - readIdList.length,
|
|
108
|
-
}), () => {
|
|
109
|
-
if (this.state.numNotifications === 0) {
|
|
110
|
-
this.props.setHasNewNotifications(false);
|
|
111
|
-
this.props.setNotificationsCount(0);
|
|
112
|
-
// when we clear out notifications, check to to see if there are new notifications available
|
|
113
|
-
this.ws.publish({ destination: "/app/all", body: {} });
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
};
|
|
117
|
-
/**
|
|
118
|
-
* notificationId - a single notification that the user has marked as read
|
|
119
|
-
* @returns {Function} - makes network request, then after waiting for it to return, setState is called to update currentNotifications and numNotifications
|
|
120
|
-
*/
|
|
121
|
-
handleReadNotification(notificationId) {
|
|
122
|
-
this.ws.publish({
|
|
123
|
-
destination: "/app/read",
|
|
124
|
-
body: JSON.stringify([notificationId]),
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* @returns {Function} - makes network request with all remaining notification IDs, then after waiting for it to return, setState is called to empty out currentNotifications and numNotifications
|
|
129
|
-
*/
|
|
130
|
-
handleReadAllNotifications() {
|
|
131
|
-
const idList = this.state.currentNotifications.map((notification) => notification.id);
|
|
132
|
-
this.ws.publish({ destination: "/app/read", body: JSON.stringify(idList) });
|
|
133
|
-
}
|
|
134
|
-
renderNotifications() {
|
|
135
|
-
return this.state.currentNotifications.slice(0, 5).map((notification) => (React__default.default.createElement("li", { key: notification.id, "data-testid": "header-notification" },
|
|
136
|
-
React__default.default.createElement(PlatformNotification.default, { readNotification: this.handleReadNotification.bind(this), data: notification }))));
|
|
137
|
-
}
|
|
138
|
-
render() {
|
|
139
|
-
const { numNotifications, currentNotifications } = this.state;
|
|
140
|
-
const { baseEnvUrl } = this.props;
|
|
141
|
-
return (React__default.default.createElement("div", { "aria-labelledby": this.props["aria-labelledby"], className: cx__default.default(`${settings.prefix}--bmrg-notifications`, {
|
|
142
|
-
"--is-active": this.props.isOpen,
|
|
143
|
-
}), "data-testid": "header-notifications", id: this.props.id, role: "dialog" },
|
|
144
|
-
React__default.default.createElement("div", { className: `${settings.prefix}--bmrg-notifications-header` },
|
|
145
|
-
React__default.default.createElement("h1", { className: `${settings.prefix}--bmrg-notifications-header__newNotifications` }, `${numNotifications} new notification${numNotifications !== 1 ? "s" : ""}`),
|
|
146
|
-
React__default.default.createElement("button", { className: `${settings.prefix}--bmrg-notifications-header__clear`, "data-testid": "header-notifications-all-read", disabled: !currentNotifications.length, onClick: this.handleReadAllNotifications.bind(this), "aria-label": "Mark all read" }, "Mark All Read")),
|
|
147
|
-
React__default.default.createElement("ul", { className: `${settings.prefix}--bmrg-notifications__collection` }, currentNotifications.length ? (this.renderNotifications()) : (React__default.default.createElement("div", { className: `${settings.prefix}--bmrg-notifications-empty` },
|
|
148
|
-
React__default.default.createElement("h1", { className: `${settings.prefix}--bmrg-notifications-empty__no-news` }, "No news is good news, right?")))),
|
|
149
|
-
React__default.default.createElement("div", { className: `${settings.prefix}--bmrg-notifications__notifications-footer` },
|
|
150
|
-
React__default.default.createElement("a", { "aria-label": "Link for notification center", href: `${baseEnvUrl}/launchpad/notifications`, className: `${settings.prefix}--bmrg-notifications__notifications-redirect-link`, "data-testid": "header-notifications-center-link" }, "Open Notification Center"))));
|
|
151
|
-
}
|
|
16
|
+
/*
|
|
17
|
+
IBM Confidential
|
|
18
|
+
694970X, 69497O0
|
|
19
|
+
© Copyright IBM Corp. 2022, 2024
|
|
20
|
+
*/
|
|
21
|
+
class PlatformNotificationsContainer extends React__default.default.Component {
|
|
22
|
+
ws;
|
|
23
|
+
articleRef = React__default.default.createRef();
|
|
24
|
+
state = {
|
|
25
|
+
error: false,
|
|
26
|
+
currentNotifications: this.props.initialNotifications ?? [],
|
|
27
|
+
numNotifications: this.props.initialNotifications?.length ?? 0,
|
|
28
|
+
};
|
|
29
|
+
componentDidMount() {
|
|
30
|
+
const brokerURL = `${this.props.baseServicesUrl}/notifications/ws`
|
|
31
|
+
.replace("https://", "wss://")
|
|
32
|
+
.replace("http://", "ws://");
|
|
33
|
+
this.ws = new stompjs.Client({
|
|
34
|
+
brokerURL,
|
|
35
|
+
reconnectDelay: 10000,
|
|
36
|
+
});
|
|
37
|
+
this.ws.onConnect = this.connect;
|
|
38
|
+
this.ws.activate();
|
|
39
|
+
}
|
|
40
|
+
connect = () => {
|
|
41
|
+
this.ws.subscribe("/user/queue/notifications", this.receiveNewNotifications);
|
|
42
|
+
this.ws.subscribe("/user/queue/reply", this.replyRead);
|
|
43
|
+
this.ws.subscribe("/user/queue/all", this.recieveAllUnreadNotifications);
|
|
44
|
+
this.ws.publish({ destination: "/app/all", body: {} });
|
|
45
|
+
};
|
|
46
|
+
componentWillUnmount() {
|
|
47
|
+
this.ws.deactivate();
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* recieve x amount of new notifications and pass them into state of current notifications
|
|
51
|
+
*
|
|
52
|
+
*/
|
|
53
|
+
receiveNewNotifications = (incomingNotifications) => {
|
|
54
|
+
if (incomingNotifications.body) {
|
|
55
|
+
const data = [JSON.parse(incomingNotifications.body)];
|
|
56
|
+
if (data.length > 0) {
|
|
57
|
+
this.props.setHasNewNotifications(true);
|
|
58
|
+
}
|
|
59
|
+
this.setState((prevState) => ({
|
|
60
|
+
currentNotifications: [...data, ...prevState.currentNotifications],
|
|
61
|
+
numNotifications: prevState.numNotifications + data.length,
|
|
62
|
+
}), () => {
|
|
63
|
+
this.props.setNotificationsCount(this.state.numNotifications);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
this.setState({
|
|
68
|
+
error: true, // TOOD something here related to the error
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* overwrite current notifications, the param represents all unread notifications
|
|
74
|
+
*/
|
|
75
|
+
recieveAllUnreadNotifications = (incomingNotifications) => {
|
|
76
|
+
if (incomingNotifications.body) {
|
|
77
|
+
const jsonData = JSON.parse(incomingNotifications.body);
|
|
78
|
+
const data = jsonData.records;
|
|
79
|
+
if (data.length > 0) {
|
|
80
|
+
this.props.setHasNewNotifications(true);
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
// This has to be declared because this function can be triggered from the notification page in Launchpad
|
|
84
|
+
this.props.setHasNewNotifications(false);
|
|
85
|
+
}
|
|
86
|
+
this.setState({
|
|
87
|
+
currentNotifications: data,
|
|
88
|
+
numNotifications: data.length,
|
|
89
|
+
}, () => {
|
|
90
|
+
this.props.setNotificationsCount(this.state.numNotifications);
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
this.setState({
|
|
95
|
+
error: true, // TOOD something here related to the error
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* @param {Object} readResponse - list of notificationIds that have been read
|
|
101
|
+
* the function removes the notifications from current state that are returned as "read"
|
|
102
|
+
*/
|
|
103
|
+
replyRead = (readResponse) => {
|
|
104
|
+
const readIdList = JSON.parse(readResponse.body);
|
|
105
|
+
this.setState((prevState) => ({
|
|
106
|
+
currentNotifications: prevState.currentNotifications.filter((el) => readIdList.indexOf(el.id) === -1),
|
|
107
|
+
numNotifications: prevState.numNotifications - readIdList.length,
|
|
108
|
+
}), () => {
|
|
109
|
+
if (this.state.numNotifications === 0) {
|
|
110
|
+
this.props.setHasNewNotifications(false);
|
|
111
|
+
this.props.setNotificationsCount(0);
|
|
112
|
+
// when we clear out notifications, check to to see if there are new notifications available
|
|
113
|
+
this.ws.publish({ destination: "/app/all", body: {} });
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* notificationId - a single notification that the user has marked as read
|
|
119
|
+
* @returns {Function} - makes network request, then after waiting for it to return, setState is called to update currentNotifications and numNotifications
|
|
120
|
+
*/
|
|
121
|
+
handleReadNotification(notificationId) {
|
|
122
|
+
this.ws.publish({
|
|
123
|
+
destination: "/app/read",
|
|
124
|
+
body: JSON.stringify([notificationId]),
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* @returns {Function} - makes network request with all remaining notification IDs, then after waiting for it to return, setState is called to empty out currentNotifications and numNotifications
|
|
129
|
+
*/
|
|
130
|
+
handleReadAllNotifications() {
|
|
131
|
+
const idList = this.state.currentNotifications.map((notification) => notification.id);
|
|
132
|
+
this.ws.publish({ destination: "/app/read", body: JSON.stringify(idList) });
|
|
133
|
+
}
|
|
134
|
+
renderNotifications() {
|
|
135
|
+
return this.state.currentNotifications.slice(0, 5).map((notification) => (React__default.default.createElement("li", { key: notification.id, "data-testid": "header-notification" },
|
|
136
|
+
React__default.default.createElement(PlatformNotification.default, { readNotification: this.handleReadNotification.bind(this), data: notification }))));
|
|
137
|
+
}
|
|
138
|
+
render() {
|
|
139
|
+
const { numNotifications, currentNotifications } = this.state;
|
|
140
|
+
const { baseEnvUrl } = this.props;
|
|
141
|
+
return (React__default.default.createElement("div", { "aria-labelledby": this.props["aria-labelledby"], className: cx__default.default(`${settings.prefix}--bmrg-notifications`, {
|
|
142
|
+
"--is-active": this.props.isOpen,
|
|
143
|
+
}), "data-testid": "header-notifications", id: this.props.id, role: "dialog" },
|
|
144
|
+
React__default.default.createElement("div", { className: `${settings.prefix}--bmrg-notifications-header` },
|
|
145
|
+
React__default.default.createElement("h1", { className: `${settings.prefix}--bmrg-notifications-header__newNotifications` }, `${numNotifications} new notification${numNotifications !== 1 ? "s" : ""}`),
|
|
146
|
+
React__default.default.createElement("button", { className: `${settings.prefix}--bmrg-notifications-header__clear`, "data-testid": "header-notifications-all-read", disabled: !currentNotifications.length, onClick: this.handleReadAllNotifications.bind(this), "aria-label": "Mark all read" }, "Mark All Read")),
|
|
147
|
+
React__default.default.createElement("ul", { className: `${settings.prefix}--bmrg-notifications__collection` }, currentNotifications.length ? (this.renderNotifications()) : (React__default.default.createElement("div", { className: `${settings.prefix}--bmrg-notifications-empty` },
|
|
148
|
+
React__default.default.createElement("h1", { className: `${settings.prefix}--bmrg-notifications-empty__no-news` }, "No news is good news, right?")))),
|
|
149
|
+
React__default.default.createElement("div", { className: `${settings.prefix}--bmrg-notifications__notifications-footer` },
|
|
150
|
+
React__default.default.createElement("a", { "aria-label": "Link for notification center", href: `${baseEnvUrl}/launchpad/notifications`, className: `${settings.prefix}--bmrg-notifications__notifications-redirect-link`, "data-testid": "header-notifications-center-link" }, "Open Notification Center"))));
|
|
151
|
+
}
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
exports.default = PlatformNotificationsContainer;
|
|
@@ -5,20 +5,20 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var reactDom = require('react-dom');
|
|
6
6
|
var usePortal = require('../../hooks/usePortal.js');
|
|
7
7
|
|
|
8
|
-
/*
|
|
9
|
-
IBM Confidential
|
|
10
|
-
694970X, 69497O0
|
|
11
|
-
© Copyright IBM Corp. 2022, 2024
|
|
12
|
-
*/
|
|
13
|
-
/**
|
|
14
|
-
* @example
|
|
15
|
-
* <Portal>
|
|
16
|
-
* <p>Thinking with portals</p>
|
|
17
|
-
* </Portal>
|
|
18
|
-
*/
|
|
19
|
-
const Portal = ({ id, children }) => {
|
|
20
|
-
const target = usePortal.default(id);
|
|
21
|
-
return reactDom.createPortal(children, target);
|
|
8
|
+
/*
|
|
9
|
+
IBM Confidential
|
|
10
|
+
694970X, 69497O0
|
|
11
|
+
© Copyright IBM Corp. 2022, 2024
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* @example
|
|
15
|
+
* <Portal>
|
|
16
|
+
* <p>Thinking with portals</p>
|
|
17
|
+
* </Portal>
|
|
18
|
+
*/
|
|
19
|
+
const Portal = ({ id, children }) => {
|
|
20
|
+
const target = usePortal.default(id);
|
|
21
|
+
return reactDom.createPortal(children, target);
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
exports.default = Portal;
|
|
@@ -10,36 +10,36 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
|
10
10
|
|
|
11
11
|
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
12
12
|
|
|
13
|
-
/*
|
|
14
|
-
IBM Confidential
|
|
15
|
-
694970X, 69497O0
|
|
16
|
-
© Copyright IBM Corp. 2022, 2024
|
|
17
|
-
*/
|
|
18
|
-
function PrivacyRedirect(props) {
|
|
19
|
-
const { baseEnvUrl, isOpen = false, user, platformName = "the platform" } = props;
|
|
20
|
-
const handleOnSubmit = () => {
|
|
21
|
-
const pendingDeletion = user?.status === "pending_deletion";
|
|
22
|
-
if (pendingDeletion) {
|
|
23
|
-
window.location.assign(`${baseEnvUrl}/launchpad`); // There is no marketing site so TBD where this links to
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
window.location.assign(`${baseEnvUrl}/launchpad?rd=${document.URL}`);
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
const pendingDeletion = user?.status === "pending_deletion";
|
|
30
|
-
const contentText = pendingDeletion
|
|
31
|
-
? `We’re working on removing your account and personal information from ${platformName}. Please allow up to 1 month (as mandated by GDPR regulations) for us to complete your request.`
|
|
32
|
-
: "Before continuing, we need you to consent to the Privacy Statement.";
|
|
33
|
-
const buttonText = pendingDeletion ? "Go to Launchpad" : "View Privacy Statement";
|
|
34
|
-
return (React__default.default.createElement("div", { className: `${settings.prefix}--bmrg-redirect-container ${settings.prefix}--bmrg-header-modal` },
|
|
35
|
-
React__default.default.createElement(react.ComposedModal, { "aria-label": "GDPR Modal", open: isOpen, onClose: () => {
|
|
36
|
-
return false;
|
|
37
|
-
} },
|
|
38
|
-
React__default.default.createElement(react.ModalHeader, { title: "Our Privacy Statement" }),
|
|
39
|
-
React__default.default.createElement(react.ModalBody, null,
|
|
40
|
-
React__default.default.createElement("span", { className: `${settings.prefix}--bmrg-redirect__body` }, contentText)),
|
|
41
|
-
React__default.default.createElement(react.ModalFooter, null,
|
|
42
|
-
React__default.default.createElement(react.Button, { "data-modal-primary-focus": true, kind: "primary", onClick: handleOnSubmit }, buttonText)))));
|
|
13
|
+
/*
|
|
14
|
+
IBM Confidential
|
|
15
|
+
694970X, 69497O0
|
|
16
|
+
© Copyright IBM Corp. 2022, 2024
|
|
17
|
+
*/
|
|
18
|
+
function PrivacyRedirect(props) {
|
|
19
|
+
const { baseEnvUrl, isOpen = false, user, platformName = "the platform" } = props;
|
|
20
|
+
const handleOnSubmit = () => {
|
|
21
|
+
const pendingDeletion = user?.status === "pending_deletion";
|
|
22
|
+
if (pendingDeletion) {
|
|
23
|
+
window.location.assign(`${baseEnvUrl}/launchpad`); // There is no marketing site so TBD where this links to
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
window.location.assign(`${baseEnvUrl}/launchpad?rd=${document.URL}`);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const pendingDeletion = user?.status === "pending_deletion";
|
|
30
|
+
const contentText = pendingDeletion
|
|
31
|
+
? `We’re working on removing your account and personal information from ${platformName}. Please allow up to 1 month (as mandated by GDPR regulations) for us to complete your request.`
|
|
32
|
+
: "Before continuing, we need you to consent to the Privacy Statement.";
|
|
33
|
+
const buttonText = pendingDeletion ? "Go to Launchpad" : "View Privacy Statement";
|
|
34
|
+
return (React__default.default.createElement("div", { className: `${settings.prefix}--bmrg-redirect-container ${settings.prefix}--bmrg-header-modal` },
|
|
35
|
+
React__default.default.createElement(react.ComposedModal, { "aria-label": "GDPR Modal", open: isOpen, onClose: () => {
|
|
36
|
+
return false;
|
|
37
|
+
} },
|
|
38
|
+
React__default.default.createElement(react.ModalHeader, { title: "Our Privacy Statement" }),
|
|
39
|
+
React__default.default.createElement(react.ModalBody, null,
|
|
40
|
+
React__default.default.createElement("span", { className: `${settings.prefix}--bmrg-redirect__body` }, contentText)),
|
|
41
|
+
React__default.default.createElement(react.ModalFooter, null,
|
|
42
|
+
React__default.default.createElement(react.Button, { "data-modal-primary-focus": true, kind: "primary", onClick: handleOnSubmit }, buttonText)))));
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
exports.default = PrivacyRedirect;
|
|
@@ -20,96 +20,96 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
|
20
20
|
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
21
21
|
var dompurify__default = /*#__PURE__*/_interopDefault(dompurify);
|
|
22
22
|
|
|
23
|
-
/*
|
|
24
|
-
IBM Confidential
|
|
25
|
-
694970X, 69497O0
|
|
26
|
-
© Copyright IBM Corp. 2022, 2024
|
|
27
|
-
*/
|
|
28
|
-
function formatDateTimestamp(timestamp) {
|
|
29
|
-
return new Date(timestamp).toLocaleDateString("en-us", {
|
|
30
|
-
year: "numeric",
|
|
31
|
-
month: "long",
|
|
32
|
-
day: "numeric",
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
function PrivacyStatement({ baseServicesUrl, closeModal, isOpen, organization = "the platform", platformEmail = "isesupp@us.ibm.com", }) {
|
|
36
|
-
const [resetKey, setResetKey] = React__default.default.useState(0);
|
|
37
|
-
const [isConfirmModalOpen, setIsConfirmModalOpen] = React__default.default.useState(false);
|
|
38
|
-
const statementUrl = servicesConfig.serviceUrl.getStatement({ baseServicesUrl });
|
|
39
|
-
const statementQuery = reactQuery.useQuery({
|
|
40
|
-
queryKey: statementUrl,
|
|
41
|
-
queryFn: servicesConfig.resolver.query(statementUrl),
|
|
42
|
-
});
|
|
43
|
-
const { mutateAsync, error: mutateUserConsentError } = reactQuery.useMutation(servicesConfig.resolver.putUserConsent);
|
|
44
|
-
function closeConfirmModal() {
|
|
45
|
-
setIsConfirmModalOpen(false);
|
|
46
|
-
}
|
|
47
|
-
function handleClose() {
|
|
48
|
-
closeModal();
|
|
49
|
-
closeConfirmModal();
|
|
50
|
-
setResetKey(resetKey + 1);
|
|
51
|
-
}
|
|
52
|
-
async function handleSubmit() {
|
|
53
|
-
const body = {
|
|
54
|
-
hasConsented: false,
|
|
55
|
-
version: statementQuery.data?.version,
|
|
56
|
-
};
|
|
57
|
-
try {
|
|
58
|
-
await mutateAsync({ baseServicesUrl, body });
|
|
59
|
-
notify.default(React__default.default.createElement(ToastNotification.default, { subtitle: "Successfully requested account deletion", title: "Delete Account", kind: "success" }), { containerId: `${settings.prefix}--bmrg-header-notifications` });
|
|
60
|
-
closeConfirmModal();
|
|
61
|
-
closeModal();
|
|
62
|
-
if (window.location) {
|
|
63
|
-
window.location.reload();
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
catch (e) {
|
|
67
|
-
closeConfirmModal();
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return (React__default.default.createElement(react.ComposedModal, { "aria-label": "Privacy Statement", className: `${settings.prefix}--bmrg-privacy-statement-container ${settings.prefix}--bmrg-header-modal`, onClose: handleClose, open: isOpen, preventCloseOnClickOutside: isConfirmModalOpen },
|
|
71
|
-
React__default.default.createElement(react.ModalHeader, { closeModal: handleClose, label: `Effective as of ${statementQuery.data ? formatDateTimestamp(statementQuery.data.effectiveDate) : ""}`, title: "Privacy Statement" }),
|
|
72
|
-
React__default.default.createElement(react.ModalBody, { key: resetKey },
|
|
73
|
-
React__default.default.createElement("div", { className: `${settings.prefix}--bmrg-privacy-statement` },
|
|
74
|
-
React__default.default.createElement(React__default.default.Fragment, null,
|
|
75
|
-
statementQuery.isLoading ? (React__default.default.createElement(Loading.default, null)) : statementQuery.error ? (React__default.default.createElement(ErrorMessage.default, { style: { color: "#F2F4F8" } })) : (statementQuery.data &&
|
|
76
|
-
statementQuery.data.formContent?.sections?.length > 0 && (React__default.default.createElement(React__default.default.Fragment, null,
|
|
77
|
-
React__default.default.createElement(react.Accordion, null, statementQuery.data.formContent.sections.map((section) => {
|
|
78
|
-
return (React__default.default.createElement(react.AccordionItem, { title: section.title, key: section.title },
|
|
79
|
-
React__default.default.createElement("p", { className: `${settings.prefix}--bmrg-privacy-statement__content`, dangerouslySetInnerHTML: {
|
|
80
|
-
__html: dompurify__default.default.sanitize(section.content),
|
|
81
|
-
} })));
|
|
82
|
-
})),
|
|
83
|
-
React__default.default.createElement("p", { className: `${settings.prefix}--bmrg-privacy-statement__message` },
|
|
84
|
-
`For any questions or concerns about business and personal information captured on
|
|
85
|
-
${organization}, please contact${" "}`,
|
|
86
|
-
React__default.default.createElement("a", { href: `mailto:${platformEmail}?subject=${organization} Privacy Statement` }, platformEmail),
|
|
87
|
-
".")))),
|
|
88
|
-
mutateUserConsentError && (React__default.default.createElement("p", { className: `${settings.prefix}--bmrg-privacy-statement__error` }, "Failed to receive deletion request. Please try again."))))),
|
|
89
|
-
React__default.default.createElement(react.ModalFooter, null,
|
|
90
|
-
React__default.default.createElement(react.Button, { "data-modal-primary-focus": true, kind: "secondary", onClick: handleClose }, "Close"),
|
|
91
|
-
React__default.default.createElement(react.Button, { kind: "danger", onClick: () => setIsConfirmModalOpen(true) }, "Request account deletion"),
|
|
92
|
-
React__default.default.createElement("div", { className: `${settings.prefix}--bmrg-privacy-statement-delete` },
|
|
93
|
-
React__default.default.createElement(react.ComposedModal, { onClose: closeConfirmModal, open: isConfirmModalOpen },
|
|
94
|
-
React__default.default.createElement(react.ModalHeader, { closeModal: closeConfirmModal, label: "Delete Account", title: "Request account deletion" }),
|
|
95
|
-
React__default.default.createElement(react.ModalBody, null,
|
|
96
|
-
React__default.default.createElement("p", { className: `${settings.prefix}--bmrg-privacy-statement-delete__desc` }, "By selecting to delete your account, your account will be deleted along with all of your user data from our system and we will notify your team(s) that you are no longer a memeber of the platform. Are you sure you want to delete your account?")),
|
|
97
|
-
React__default.default.createElement(react.ModalFooter, null,
|
|
98
|
-
React__default.default.createElement(react.Button, { "data-modal-primary-focus": true, kind: "secondary", onClick: closeConfirmModal }, "No, go back to Privacy Statement"),
|
|
99
|
-
React__default.default.createElement(react.Button, { kind: "danger", type: "submit", onClick: handleSubmit }, "Yes, delete my account")))))));
|
|
100
|
-
}
|
|
101
|
-
function PrivacyStatementMenuItem(props) {
|
|
102
|
-
const menuItemRef = React__default.default.useRef(null);
|
|
103
|
-
const [isOpen, setIsOpen] = React__default.default.useState(false);
|
|
104
|
-
const handleClose = () => {
|
|
105
|
-
setIsOpen(false);
|
|
106
|
-
setTimeout(() => {
|
|
107
|
-
menuItemRef.current?.focus();
|
|
108
|
-
}, 0);
|
|
109
|
-
};
|
|
110
|
-
return (React__default.default.createElement(React__default.default.Fragment, null,
|
|
111
|
-
React__default.default.createElement(HeaderMenuItem.default, { icon: React__default.default.createElement(icons.Locked, null), onClick: () => setIsOpen(!isOpen), ref: menuItemRef, text: "Privacy Statement", type: "button" }),
|
|
112
|
-
React__default.default.createElement(PrivacyStatement, { isOpen: isOpen, closeModal: handleClose, ...props })));
|
|
23
|
+
/*
|
|
24
|
+
IBM Confidential
|
|
25
|
+
694970X, 69497O0
|
|
26
|
+
© Copyright IBM Corp. 2022, 2024
|
|
27
|
+
*/
|
|
28
|
+
function formatDateTimestamp(timestamp) {
|
|
29
|
+
return new Date(timestamp).toLocaleDateString("en-us", {
|
|
30
|
+
year: "numeric",
|
|
31
|
+
month: "long",
|
|
32
|
+
day: "numeric",
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function PrivacyStatement({ baseServicesUrl, closeModal, isOpen, organization = "the platform", platformEmail = "isesupp@us.ibm.com", }) {
|
|
36
|
+
const [resetKey, setResetKey] = React__default.default.useState(0);
|
|
37
|
+
const [isConfirmModalOpen, setIsConfirmModalOpen] = React__default.default.useState(false);
|
|
38
|
+
const statementUrl = servicesConfig.serviceUrl.getStatement({ baseServicesUrl });
|
|
39
|
+
const statementQuery = reactQuery.useQuery({
|
|
40
|
+
queryKey: statementUrl,
|
|
41
|
+
queryFn: servicesConfig.resolver.query(statementUrl),
|
|
42
|
+
});
|
|
43
|
+
const { mutateAsync, error: mutateUserConsentError } = reactQuery.useMutation(servicesConfig.resolver.putUserConsent);
|
|
44
|
+
function closeConfirmModal() {
|
|
45
|
+
setIsConfirmModalOpen(false);
|
|
46
|
+
}
|
|
47
|
+
function handleClose() {
|
|
48
|
+
closeModal();
|
|
49
|
+
closeConfirmModal();
|
|
50
|
+
setResetKey(resetKey + 1);
|
|
51
|
+
}
|
|
52
|
+
async function handleSubmit() {
|
|
53
|
+
const body = {
|
|
54
|
+
hasConsented: false,
|
|
55
|
+
version: statementQuery.data?.version,
|
|
56
|
+
};
|
|
57
|
+
try {
|
|
58
|
+
await mutateAsync({ baseServicesUrl, body });
|
|
59
|
+
notify.default(React__default.default.createElement(ToastNotification.default, { subtitle: "Successfully requested account deletion", title: "Delete Account", kind: "success" }), { containerId: `${settings.prefix}--bmrg-header-notifications` });
|
|
60
|
+
closeConfirmModal();
|
|
61
|
+
closeModal();
|
|
62
|
+
if (window.location) {
|
|
63
|
+
window.location.reload();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
catch (e) {
|
|
67
|
+
closeConfirmModal();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return (React__default.default.createElement(react.ComposedModal, { "aria-label": "Privacy Statement", className: `${settings.prefix}--bmrg-privacy-statement-container ${settings.prefix}--bmrg-header-modal`, onClose: handleClose, open: isOpen, preventCloseOnClickOutside: isConfirmModalOpen },
|
|
71
|
+
React__default.default.createElement(react.ModalHeader, { closeModal: handleClose, label: `Effective as of ${statementQuery.data ? formatDateTimestamp(statementQuery.data.effectiveDate) : ""}`, title: "Privacy Statement" }),
|
|
72
|
+
React__default.default.createElement(react.ModalBody, { key: resetKey },
|
|
73
|
+
React__default.default.createElement("div", { className: `${settings.prefix}--bmrg-privacy-statement` },
|
|
74
|
+
React__default.default.createElement(React__default.default.Fragment, null,
|
|
75
|
+
statementQuery.isLoading ? (React__default.default.createElement(Loading.default, null)) : statementQuery.error ? (React__default.default.createElement(ErrorMessage.default, { style: { color: "#F2F4F8" } })) : (statementQuery.data &&
|
|
76
|
+
statementQuery.data.formContent?.sections?.length > 0 && (React__default.default.createElement(React__default.default.Fragment, null,
|
|
77
|
+
React__default.default.createElement(react.Accordion, null, statementQuery.data.formContent.sections.map((section) => {
|
|
78
|
+
return (React__default.default.createElement(react.AccordionItem, { title: section.title, key: section.title },
|
|
79
|
+
React__default.default.createElement("p", { className: `${settings.prefix}--bmrg-privacy-statement__content`, dangerouslySetInnerHTML: {
|
|
80
|
+
__html: dompurify__default.default.sanitize(section.content),
|
|
81
|
+
} })));
|
|
82
|
+
})),
|
|
83
|
+
React__default.default.createElement("p", { className: `${settings.prefix}--bmrg-privacy-statement__message` },
|
|
84
|
+
`For any questions or concerns about business and personal information captured on
|
|
85
|
+
${organization}, please contact${" "}`,
|
|
86
|
+
React__default.default.createElement("a", { href: `mailto:${platformEmail}?subject=${organization} Privacy Statement` }, platformEmail),
|
|
87
|
+
".")))),
|
|
88
|
+
mutateUserConsentError && (React__default.default.createElement("p", { className: `${settings.prefix}--bmrg-privacy-statement__error` }, "Failed to receive deletion request. Please try again."))))),
|
|
89
|
+
React__default.default.createElement(react.ModalFooter, null,
|
|
90
|
+
React__default.default.createElement(react.Button, { "data-modal-primary-focus": true, kind: "secondary", onClick: handleClose }, "Close"),
|
|
91
|
+
React__default.default.createElement(react.Button, { kind: "danger", onClick: () => setIsConfirmModalOpen(true) }, "Request account deletion"),
|
|
92
|
+
React__default.default.createElement("div", { className: `${settings.prefix}--bmrg-privacy-statement-delete` },
|
|
93
|
+
React__default.default.createElement(react.ComposedModal, { onClose: closeConfirmModal, open: isConfirmModalOpen },
|
|
94
|
+
React__default.default.createElement(react.ModalHeader, { closeModal: closeConfirmModal, label: "Delete Account", title: "Request account deletion" }),
|
|
95
|
+
React__default.default.createElement(react.ModalBody, null,
|
|
96
|
+
React__default.default.createElement("p", { className: `${settings.prefix}--bmrg-privacy-statement-delete__desc` }, "By selecting to delete your account, your account will be deleted along with all of your user data from our system and we will notify your team(s) that you are no longer a memeber of the platform. Are you sure you want to delete your account?")),
|
|
97
|
+
React__default.default.createElement(react.ModalFooter, null,
|
|
98
|
+
React__default.default.createElement(react.Button, { "data-modal-primary-focus": true, kind: "secondary", onClick: closeConfirmModal }, "No, go back to Privacy Statement"),
|
|
99
|
+
React__default.default.createElement(react.Button, { kind: "danger", type: "submit", onClick: handleSubmit }, "Yes, delete my account")))))));
|
|
100
|
+
}
|
|
101
|
+
function PrivacyStatementMenuItem(props) {
|
|
102
|
+
const menuItemRef = React__default.default.useRef(null);
|
|
103
|
+
const [isOpen, setIsOpen] = React__default.default.useState(false);
|
|
104
|
+
const handleClose = () => {
|
|
105
|
+
setIsOpen(false);
|
|
106
|
+
setTimeout(() => {
|
|
107
|
+
menuItemRef.current?.focus();
|
|
108
|
+
}, 0);
|
|
109
|
+
};
|
|
110
|
+
return (React__default.default.createElement(React__default.default.Fragment, null,
|
|
111
|
+
React__default.default.createElement(HeaderMenuItem.default, { icon: React__default.default.createElement(icons.Locked, null), onClick: () => setIsOpen(!isOpen), ref: menuItemRef, text: "Privacy Statement", type: "button" }),
|
|
112
|
+
React__default.default.createElement(PrivacyStatement, { isOpen: isOpen, closeModal: handleClose, ...props })));
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
exports.PrivacyStatementMenuItem = PrivacyStatementMenuItem;
|