@atlaskit/focused-task-close-account
Version:
This package contains all of the UI components needed to assemble the focused tasks for deactivating and deleting users' accounts in accordance with the GDPR "Right to be forgotten".
137 lines • 10.5 kB
JavaScript
import _extends from "@babel/runtime/helpers/extends";
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
import _createClass from "@babel/runtime/helpers/createClass";
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
import _inherits from "@babel/runtime/helpers/inherits";
import _defineProperty from "@babel/runtime/helpers/defineProperty";
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
import React from 'react';
import { FormattedMessage } from 'react-intl-next';
import Button from '@atlaskit/button';
import SectionMessage from '@atlaskit/section-message';
import InfoIcon from '@atlaskit/icon/core/status-information';
import { fg } from '@atlaskit/platform-feature-flags';
// eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
import { Text } from '@atlaskit/primitives/compiled';
import { commonMessages, overviewMessages } from '../../messages';
import StatefulInlineDialog from '../StatefulInlineDialog';
import UserInfo from '../UserInfo';
import * as Styled from './styled';
import { DropdownList } from '../DropdownList';
import MessagesIntlProvider from '../MessagesIntlProvider';
export var DeleteUserOverviewScreen = /*#__PURE__*/function (_React$Component) {
function DeleteUserOverviewScreen() {
var _this;
_classCallCheck(this, DeleteUserOverviewScreen);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _callSuper(this, DeleteUserOverviewScreen, [].concat(args));
_defineProperty(_this, "selectAdminOrSelfCopy", function (adminCopy, selfCopy) {
return _this.props.isCurrentUser ? selfCopy : adminCopy;
});
_defineProperty(_this, "displayFirstListElement", function () {
var _this$props = _this.props,
accessibleSites = _this$props.accessibleSites,
user = _this$props.user,
isUserDeactivated = _this$props.isUserDeactivated;
if (isUserDeactivated) {
return null;
}
var hasAccessibleSites = accessibleSites && accessibleSites.length > 0;
return /*#__PURE__*/React.createElement("li", null, !hasAccessibleSites && /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, _this.selectAdminOrSelfCopy(overviewMessages.paragraphLoseAccessAdminNoSites, overviewMessages.paragraphLoseAccessSelfNoSites), {
values: {
fullName: user.fullName,
b: function b(s) {
return /*#__PURE__*/React.createElement("b", null, s);
}
}
})), hasAccessibleSites && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, _this.selectAdminOrSelfCopy(overviewMessages.paragraphLoseAccessAdmin, overviewMessages.paragraphLoseAccessSelf), {
values: {
fullName: user.fullName,
b: function b(s) {
return /*#__PURE__*/React.createElement("b", null, s);
}
},
tagName: 'p'
})), /*#__PURE__*/React.createElement(DropdownList, {
accessibleSites: accessibleSites
})));
});
_defineProperty(_this, "displaySecondListElement", function () {
return /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, _this.selectAdminOrSelfCopy(overviewMessages.paragraphPersonalDataWillBeDeletedAdmin, overviewMessages.paragraphPersonalDataWillBeDeletedSelf), {
values: {
b: function b(s) {
return /*#__PURE__*/React.createElement("b", null, s);
}
}
})), /*#__PURE__*/React.createElement(Styled.IconHoverWrapper, null, /*#__PURE__*/React.createElement(StatefulInlineDialog, {
placement: "auto-start",
content: /*#__PURE__*/React.createElement(Styled.InlineDialogContent, null, /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, _this.selectAdminOrSelfCopy(overviewMessages.inlineDialogDataWillBeDeletedP1Admin, overviewMessages.inlineDialogDataWillBeDeletedP1Self), {
tagName: "p"
})), /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, _this.selectAdminOrSelfCopy(overviewMessages.inlineDialogDataWillBeDeletedLi1Admin, overviewMessages.inlineDialogDataWillBeDeletedLi1Self), {
tagName: "li"
})), /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, _this.selectAdminOrSelfCopy(overviewMessages.inlineDialogDataWillBeDeletedLi2Admin, overviewMessages.inlineDialogDataWillBeDeletedLi2Self), {
tagName: "li"
})), /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, _this.selectAdminOrSelfCopy(overviewMessages.inlineDialogDataWillBeDeletedLi3Admin, overviewMessages.inlineDialogDataWillBeDeletedLi3Self), {
tagName: "li"
})), /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, _this.selectAdminOrSelfCopy(fg('product-terminology-refresh') ? overviewMessages.inlineDialogDataWillBeDeletedP2AdminAppify : overviewMessages.inlineDialogDataWillBeDeletedP2Admin, fg('product-terminology-refresh') ? overviewMessages.inlineDialogDataWillBeDeletedP2SelfAppify : overviewMessages.inlineDialogDataWillBeDeletedP2Self), {
tagName: "p"
})), /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, _this.selectAdminOrSelfCopy(overviewMessages.inlineDialogDataWillBeDeletedP3Admin, overviewMessages.inlineDialogDataWillBeDeletedP3Self), {
tagName: "p"
})))
}, /*#__PURE__*/React.createElement(InfoIcon, {
color: "currentColor",
label: ""
}))));
});
_defineProperty(_this, "displayThirdListElement", function () {
return /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement(FormattedMessage, _this.selectAdminOrSelfCopy(fg('product-terminology-refresh') ? overviewMessages.paragraphListOfAppsWithPersonalDataAdminAppify : overviewMessages.paragraphListOfAppsWithPersonalDataAdmin, fg('product-terminology-refresh') ? overviewMessages.paragraphListOfAppsWithPersonalDataSelfAppify : overviewMessages.paragraphListOfAppsWithPersonalDataSelf)), /*#__PURE__*/React.createElement(Styled.IconHoverWrapper, null, /*#__PURE__*/React.createElement(StatefulInlineDialog, {
placement: "auto-start",
content: /*#__PURE__*/React.createElement(FormattedMessage, _this.selectAdminOrSelfCopy(fg('product-terminology-refresh') ? overviewMessages.inlineDialogDataAppsAdminAppify : overviewMessages.inlineDialogDataAppsAdmin, fg('product-terminology-refresh') ? overviewMessages.inlineDialogDataAppsSelfAppify : overviewMessages.inlineDialogDataAppsSelf))
}, /*#__PURE__*/React.createElement(InfoIcon, {
color: "currentColor",
label: ""
}))));
});
_defineProperty(_this, "displayFourthListElement", function () {
return /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement(FormattedMessage, _this.selectAdminOrSelfCopy(overviewMessages.paragraphContentCreatedAdmin, overviewMessages.paragraphContentCreatedSelf)), /*#__PURE__*/React.createElement(Styled.IconHoverWrapper, null, /*#__PURE__*/React.createElement(StatefulInlineDialog, {
placement: "auto-start",
content: /*#__PURE__*/React.createElement(FormattedMessage, _this.selectAdminOrSelfCopy(fg('product-terminology-refresh') ? overviewMessages.inlineDialogContentCreatedAdminissuetermrefreshAppify : overviewMessages.inlineDialogContentCreatedAdminissuetermrefresh, fg('product-terminology-refresh') ? overviewMessages.inlineDialogContentCreatedSelfAppify : overviewMessages.inlineDialogContentCreatedSelf))
}, /*#__PURE__*/React.createElement(InfoIcon, {
color: "currentColor",
label: ""
}))));
});
return _this;
}
_inherits(DeleteUserOverviewScreen, _React$Component);
return _createClass(DeleteUserOverviewScreen, [{
key: "render",
value: function render() {
var _this$props2 = this.props,
user = _this$props2.user,
deactivateUserHandler = _this$props2.deactivateUserHandler,
isUserDeactivated = _this$props2.isUserDeactivated;
return /*#__PURE__*/React.createElement(MessagesIntlProvider, null, /*#__PURE__*/React.createElement(Styled.Screen, null, /*#__PURE__*/React.createElement(Styled.Title, null, /*#__PURE__*/React.createElement(FormattedMessage, this.selectAdminOrSelfCopy(overviewMessages.headingAdmin, overviewMessages.headingSelf))), /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, this.selectAdminOrSelfCopy(overviewMessages.firstLineAdmin, overviewMessages.firstLineSelf), {
tagName: "p"
})), /*#__PURE__*/React.createElement(UserInfo, {
user: user
}), /*#__PURE__*/React.createElement(FormattedMessage, this.selectAdminOrSelfCopy(overviewMessages.paragraphAboutToDeleteAdmin, overviewMessages.paragraphAboutToDeleteSelf)), /*#__PURE__*/React.createElement(Styled.MainInformationList, null, this.displayFirstListElement(), this.displaySecondListElement(), this.displayThirdListElement(), this.displayFourthListElement()), deactivateUserHandler && /*#__PURE__*/React.createElement(Styled.SectionMessageOuter, null, /*#__PURE__*/React.createElement(SectionMessage, {
appearance: "warning"
}, /*#__PURE__*/React.createElement(FormattedMessage, isUserDeactivated ? overviewMessages.warningSectionBodyDeactivated : overviewMessages.warningSectionBody), !isUserDeactivated && /*#__PURE__*/React.createElement(Text, {
as: "p"
}, /*#__PURE__*/React.createElement(Button, {
appearance: "link",
spacing: "none",
onClick: deactivateUserHandler
}, /*#__PURE__*/React.createElement(FormattedMessage, commonMessages.deactivateAccount)))))));
}
}]);
}(React.Component);
_defineProperty(DeleteUserOverviewScreen, "defaultProps", {
isCurrentUser: false
});
export default DeleteUserOverviewScreen;