synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
105 lines (103 loc) • 4.13 kB
JavaScript
import { jsx as t, jsxs as f, Fragment as y } 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 b, useCallback as T } from "react";
import "../../utils/context/SynapseContext.js";
import "use-deep-compare-effect";
import { Typography as i, TextField as w } 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 '../../style/components/_spinner.css';/* empty css */
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 { useSendMessageToEntityOwner as C } from "../../synapse-queries/message/useMessage.js";
import { useGetCurrentUserProfile as v } from "../../synapse-queries/user/useUserBundle.js";
import { ConfirmationDialog as x } from "../ConfirmationDialog/ConfirmationDialog.js";
import { displayToast as p } from "../ToastMessage/ToastMessage.js";
const M = "Contact the Administrator";
function ie(d) {
const { onHide: n, entityId: r, isOpen: l } = d, [o, a] = b(""), { data: s, isLoading: u } = v(), { mutate: m } = C({
onSuccess: () => {
n(), a(""), p("Message successfully sent");
},
onError: (e) => {
p(`Message could not be sent: ${e.reason}`, "danger");
}
}), c = T(() => {
if (u) {
console.error(
"Attempted to send message before user profile was loaded. This should never happen."
);
return;
}
if (!s) {
console.error(
"Attempted to send message without a user profile. This should never happen."
);
return;
}
const { firstName: e, lastName: h, userName: g } = s;
m({
entityId: r,
subject: `${e} ${h} (@${g}) Requested Access to ${r}`,
body: `Requesting access to https://www.synapse.org/Synapse:${r}
${o}`
});
}, [o, s, m]);
return /* @__PURE__ */ t(
x,
{
maxWidth: "md",
open: l,
title: M,
content: /* @__PURE__ */ f(y, { children: [
/* @__PURE__ */ t(i, { variant: "body1", children: "Please explain in your message why you believe you should be given VIEW access to the requested resource." }),
/* @__PURE__ */ t(i, { variant: "body1", children: "Your message will be sent to the administrator. Your real email address, and the real email address of the administrator, will be hidden." }),
/* @__PURE__ */ t(i, { variant: "body1", children: "Granting access to this resource is at the discretion of the resource administrator. The operators of this website (Sage Bionetworks) cannot grant access on their behalf." }),
/* @__PURE__ */ t(
w,
{
fullWidth: !0,
margin: "normal",
label: "Text of your message",
id: "messageText",
name: "messageText",
multiline: !0,
rows: 5,
onChange: (e) => a(e.target.value),
value: o
}
)
] }),
onCancel: n,
onConfirm: c,
confirmButtonProps: {
children: "Send",
disabled: !o
}
}
);
}
export {
M as CONTACT_ADMIN_DIALOG_TITLE,
ie as default
};
//# sourceMappingURL=SendMessageToEntityOwnerDialog.js.map