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

102 lines (101 loc) 3.99 kB
import { jsx as t, jsxs as I, Fragment as l } 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 { PRODUCTION_ENDPOINT_CONFIG as k } from "../../../utils/functions/getEndpoint.js"; import "lodash-es"; import "@sage-bionetworks/synapse-client/util/synapseClientFetch"; import "@tanstack/react-query"; import "../../../utils/PermissionLevelToAccessType.js"; import "../../../utils/SynapseConstants.js"; import { useState as S } from "react"; import { useSynapseContext as b } from "../../../utils/context/SynapseContext.js"; import "use-deep-compare-effect"; import { Typography as O, Link as j, Box as P } 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 { useGetAccessRequirementStatus as v, useGetAccessRequirementWikiPageKey as x } from "../../../synapse-queries/dataaccess/useAccessRequirements.js"; import { Markdown as f } from "../../Markdown/MarkdownSynapse.js"; import { RequirementItemStatus as a } from "../AccessApprovalCheckMark.js"; import L from "./RequirementItem.js"; function ft(w) { const { accessRequirement: e, subjectId: m, subjectType: p, onHide: n } = w, { isAuthenticated: g } = b(), { data: A, isLoading: C } = v(String(e.id)), { data: o } = x( e.id.toString() // ACT ARs may have the contact info embedded in the AR or may have an associated Wiki. ), r = A?.isApproved, [s, y] = S(!1); let c = ""; typeof window < "u" && (window.location.hostname === "www.synapse.org" || window.location.hostname === "staging.synapse.org") ? c = "Request access" : c = "Request access via Synapse.org"; const T = () => { const h = p ? `&TYPE=${p}` : "", q = m ? `&ID=${m}` : ""; window.open( `${k.PORTAL}AccessRequirement:AR_ID=${e.id}${h}${q}` ); }, R = () => { T(), n && n(); }, d = e.actContactInfo; let u; g && !r && (u = [ { variant: "outlined", onClick: R, children: c }, { variant: "text", onClick: n, children: "I do not accept" } ]); let i = /* @__PURE__ */ t(l, {}); return d ? i = /* @__PURE__ */ t(f, { markdown: d }) : o && (i = /* @__PURE__ */ t( f, { wikiId: o?.wikiPageId, ownerId: o?.ownerObjectId, objectType: o?.ownerObjectType } )), /* @__PURE__ */ t( L, { "data-testid": "UnmanagedACTAccessRequirementItem", status: C ? a.LOADING : r ? a.COMPLETE : a.LOCKED, actions: u, children: r ? /* @__PURE__ */ I(l, { children: [ /* @__PURE__ */ I(O, { variant: "body1", children: [ "Your data access request has been approved.", " ", /* @__PURE__ */ t( j, { role: "button", onClick: () => y( !s ), children: s ? "Hide Instructions" : "View Instructions" } ) ] }), s && /* @__PURE__ */ t(P, { sx: { my: 1 }, children: i }) ] }) : i } ); } export { ft as default }; //# sourceMappingURL=UnmanagedACTAccessRequirementItem.js.map