synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
90 lines (89 loc) • 3.32 kB
JavaScript
import { jsxs as d, jsx as i } 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 { convertToEntityType as x, getEntityTypeFromHeader as v } from "../utils/functions/EntityTypeUtils.js";
import { getEndpoint as I, BackendDestinationEnum as b } 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 "react";
import "../utils/context/SynapseContext.js";
import "use-deep-compare-effect";
import { Link as L, Skeleton as N } 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 { useGetEntity as $ } from "../synapse-queries/entity/useEntity.js";
import { useGetEntityHeader as C } from "../synapse-queries/entity/useGetEntityHeaders.js";
import { EntityTypeIcon as u } from "./EntityIcon.js";
import { ErrorBanner as D } from "./error/ErrorBanner.js";
import F from "./error/ErrorChip.js";
const lt = (E) => {
const {
entity: e,
className: y,
versionNumber: o,
displayTextField: c = "name",
link: p = !0,
showIcon: a = !0,
onEntityIdClicked: f
} = E;
let r = "";
typeof e == "string" && (r = e);
const l = !!r && typeof e == "string", { data: m, isLoading: g } = C(
r,
o,
{
enabled: l
}
), h = l && m == null && !g, { error: s } = $(r, o, {
enabled: h
});
if (m || typeof e != "string") {
const t = m ?? e;
let n;
"concreteType" in t ? n = x(t.concreteType) : n = v(t);
const T = typeof p == "string" ? p : `${I(
b.PORTAL_ENDPOINT
)}Synapse:${t.id}${o ? `.${o}` : ""}`;
return p ? /* @__PURE__ */ d(
L,
{
className: y,
target: "_blank",
rel: "noopener noreferrer",
onClick: f ? (k) => {
k.preventDefault(), f(t.id);
} : void 0,
href: T,
children: [
a && /* @__PURE__ */ i(u, { type: n, style: { marginRight: "6px" } }),
t[c]
]
}
) : /* @__PURE__ */ d("p", { className: y, children: [
a && /* @__PURE__ */ i(u, { type: n, style: { marginRight: "6px" } }),
t[c]
] });
} else return s ? r ? /* @__PURE__ */ i(F, { chipText: r, error: s }) : /* @__PURE__ */ i(D, { error: s }) : /* @__PURE__ */ i(N, { variant: "rectangular", width: "100" });
};
export {
lt as EntityLink
};
//# sourceMappingURL=EntityLink.js.map