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

91 lines (90 loc) 2.85 kB
import { jsx as i } from "react/jsx-runtime"; import { useUpdateVerificationSubmission as T } from "../../synapse-queries/verificationSubmission/useVerificationSubmission.js"; import { REJECT_VALIDATION_CANNED_RESPONSES_TABLE as h } from "../../utils/SynapseConstants.js"; import { TextField as D } from "@mui/material"; import { VerificationStateEnum as e } from "@sage-bionetworks/synapse-types"; import { noop as b } from "lodash-es"; import { useState as P } from "react"; import { CannedRejectionDialog as C } from "../CannedRejectionDialog/CannedRejectionDialog.js"; import { displayToast as R } from "../ToastMessage/ToastMessage.js"; const A = "Thank you for submitting your Synapse profile for validation. Before we can accept your request:", g = ` If you have questions, do not respond to this email address. Instead, reply to: act@sagebionetworks.org`, j = "You may wish to reject the user's profile validation request for a specific reason. The list below contains some common rejection reasons. You will have a chance to edit the response before submitting it, including adding any rejection reason(s) not listed here."; function U(s) { const { verificationSubmissionId: a, tableId: c = h, open: u, onRejectionSubmittedSuccess: l = b, onClose: r, currentState: m } = s, [n, d] = P(""), { mutate: f, error: E } = T(); function p(t, S) { let o; switch (m) { case e.SUBMITTED: o = e.REJECTED; break; case e.APPROVED: o = e.SUSPENDED; break; case e.REJECTED: case e.SUSPENDED: console.error( "Cannot reject a request where the current state is already rejected or suspended" ), r(); return; } f( { id: a, verificationState: { state: o, reason: t, notes: S } }, { onSuccess: () => { l(), R( `Submission ${o === e.REJECTED ? "rejected" : "suspended"} and message sent to requester`, "info" ), r(); } } ); } return /* @__PURE__ */ i( C, { open: u, tableId: c, onConfirm: (t) => p(t, n), onClose: r, defaultMessagePrefix: A, defaultMessageAppend: g, rejectionFormPromptCopy: j, error: E, children: /* @__PURE__ */ i( D, { label: "ACT Internal Notes", fullWidth: !0, multiline: !0, rows: 3, sx: { mt: 2 }, value: n, onChange: (t) => d(t.target.value) } ) } ); } export { g as DEFAULT_MESSAGE_APPEND, A as DEFAULT_MESSAGE_PREPEND, j as REJECTION_FORM_PROMPT_COPY, U as RejectProfileValidationRequestModal, U as default }; //# sourceMappingURL=RejectProfileValidationRequestModal.js.map