@boomerang-io/carbon-addons-boomerang-react
Version:
Carbon Addons for Boomerang apps
38 lines (35 loc) • 1.99 kB
JavaScript
import React from 'react';
import { ComposedModal, ModalHeader, ModalBody, ModalFooter, Button } from '@carbon/react';
import { prefix } from '../../internal/settings.js';
/*
IBM Confidential
694970X, 69497O0
© Copyright IBM Corp. 2022, 2024
*/
function PrivacyRedirect(props) {
const { baseEnvUrl, isOpen = false, user, platformName = "the platform" } = props;
const handleOnSubmit = () => {
const pendingDeletion = user?.status === "pending_deletion";
if (pendingDeletion) {
window.location.assign(`${baseEnvUrl}/launchpad`); // There is no marketing site so TBD where this links to
}
else {
window.location.assign(`${baseEnvUrl}/launchpad?rd=${document.URL}`);
}
};
const pendingDeletion = user?.status === "pending_deletion";
const contentText = pendingDeletion
? `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.`
: "Before continuing, we need you to consent to the Privacy Statement.";
const buttonText = pendingDeletion ? "Go to Launchpad" : "View Privacy Statement";
return (React.createElement("div", { className: `${prefix}--bmrg-redirect-container ${prefix}--bmrg-header-modal` },
React.createElement(ComposedModal, { "aria-label": "GDPR Modal", open: isOpen, onClose: () => {
return false;
} },
React.createElement(ModalHeader, { title: "Our Privacy Statement" }),
React.createElement(ModalBody, null,
React.createElement("span", { className: `${prefix}--bmrg-redirect__body` }, contentText)),
React.createElement(ModalFooter, null,
React.createElement(Button, { "data-modal-primary-focus": true, kind: "primary", onClick: handleOnSubmit }, buttonText)))));
}
export { PrivacyRedirect as default };