UNPKG

synapse-react-client

Version:

[![npm version](https://badge.fury.io/js/synapse-react-client.svg)](https://badge.fury.io/js/synapse-react-client) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettie

87 lines (86 loc) 3.52 kB
import { jsx as t, jsxs as h, Fragment as b } from "react/jsx-runtime"; import "../../synapse-client/SynapseClient.js"; import "@sage-bionetworks/synapse-client/generated/models/ErrorResponseCode"; import "@sage-bionetworks/synapse-client/generated/models/TwoFactorAuthErrorResponse"; import "@sage-bionetworks/synapse-client/util/SynapseClientError"; import "@sage-bionetworks/synapse-types"; import "../../utils/functions/EntityTypeUtils.js"; import "../../utils/SynapseConstants.js"; import "lodash-es"; import "@sage-bionetworks/synapse-client/util/synapseClientFetch"; import "@tanstack/react-query"; import "../../utils/PermissionLevelToAccessType.js"; import { useState as y, useMemo as m } from "react"; import "../../utils/context/SynapseContext.js"; import "use-deep-compare-effect"; import { Typography as i, Link as C } from "@mui/material"; import "../../utils/hooks/useCookiePreferences.js"; import "../../utils/hooks/useSourceAppConfigs.js"; import "universal-cookie"; import "../../utils/AppUtils/session/ApplicationSessionContext.js"; import "../../utils/context/FullContextProvider.js"; import "../../utils/context/DocumentMetadataContext.js"; import { SynapseSpinner as g } from "../LoadingScreen/LoadingScreen.js"; import "@tanstack/query-core"; import "lodash-es/isEmpty"; import "lodash-es/isEqual"; import "lodash-es/xorWith"; import "react-router"; import "@sage-bionetworks/synapse-client"; import "../../utils/types/IsType.js"; import { useIsCurrentUserACTMember as k } from "../../synapse-queries/user/useUserBundle.js"; import { useRevokeCertification as v } from "../../synapse-queries/user/useRevokeCertification.js"; import { displayToast as p } from "../ToastMessage/ToastMessage.js"; function to(c) { const { userId: n, buttonProps: e } = c, [s, r] = y(!1), { data: l } = k(), { mutate: a, isPending: o } = v({ onSettled: () => { r(!1); }, onSuccess: () => { p("User certification revoked", "success"); }, onError: (u) => { p(u.message, "danger"); } }), d = m( () => ({ children: "Revoke Certification", ...e, disabled: o || e.disabled, onClick: () => r(!0) }), [e, o] ), f = m( () => ({ title: "Revoke user certification?", onCancel: () => r(!1), open: s, content: /* @__PURE__ */ h(b, { children: [ /* @__PURE__ */ t(i, { variant: "body1", sx: { fontWeight: "bold", mb: 2.5 }, children: "This action can't be undone." }), /* @__PURE__ */ t(i, { variant: "body1", sx: { my: 2.5 }, children: "Revoking user certification means this user won’t be able to upload files or tables, or make new projects or folders. To become certified again, they’ll have to retake the certification quiz." }), /* @__PURE__ */ t(i, { variant: "body1", sx: { mt: 2.5 }, children: /* @__PURE__ */ t( C, { href: "https://help.synapse.org/docs/Synapse-User-Account-Types.2007072795.html#SynapseUserAccountTypes-CertifiedUser", children: "More about certified users" } ) }) ] }), onConfirm: () => { a(n); }, confirmButtonProps: { children: "Revoke", disabled: o, startIcon: o ? /* @__PURE__ */ t(g, {}) : null }, cancelButtonProps: { disabled: o } }), [o, a, s, n] ); return { showButton: l || !1, buttonProps: d, confirmationDialogProps: f }; } export { to as default }; //# sourceMappingURL=useRevokeCertificationUI.js.map