synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
230 lines (229 loc) • 7.56 kB
JavaScript
import { jsxs as s, Fragment as u, jsx as t } from "react/jsx-runtime";
import { ReactComponent as b } from "../../assets/icons/error_page/maintenance.svg.js";
import { ReactComponent as v } from "../../assets/icons/error_page/no-access.svg.js";
import { ReactComponent as w } from "../../assets/icons/error_page/unavailable.svg.js";
import "../../utils/PermissionLevelToAccessType.js";
import "../../utils/SynapseConstants.js";
import { useState as k, useMemo as a, useCallback as F } from "react";
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 "lodash-es";
import "@sage-bionetworks/synapse-client/util/synapseClientFetch";
import { useSynapseContext as M } from "../../utils/context/SynapseContext.js";
import "use-deep-compare-effect";
import "@tanstack/react-query";
import "@tanstack/query-core";
import "lodash-es/isEmpty";
import "lodash-es/isEqual";
import "lodash-es/xorWith";
import { Box as c, Typography as m, Link as U } from "@mui/material";
import "@sage-bionetworks/synapse-client";
import "../../utils/types/IsType.js";
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 "react-router";
import E from "./SynapseObjectDOIInfo.js";
import L from "./SendMessageToEntityOwnerDialog.js";
import { DoiObjectType as R } from "@sage-bionetworks/synapse-client/generated/models/DoiObjectType";
const W = "Synapse is down for maintenance.", j = "You don’t have permission to view this.", P = "This page isn’t available.", G = "Log in to Synapse", Y = "Contact us for more information", ke = "Contact the Administrator", K = "Try logging in. If you still see this message after logging in, you have not been granted access to view this resource.", X = "This account has not been granted access to view this resource.", z = "The link you followed may be broken, or the page may have been removed.", H = "A Synapse account is free, and lets you view public resources.", Fe = "Write a message to the owner of the resource asking for permission to view.";
var $ = /* @__PURE__ */ ((o) => (o.DOWN = "DOWN", o.ACCESS_DENIED = "ACCESS_DENIED", o.NOT_FOUND = "NOT_FOUND", o))($ || {});
const B = (o) => {
switch (o) {
case "DOWN":
return /* @__PURE__ */ t(
b,
{
role: "img",
"aria-label": "Synapse is Down image",
title: "DOWN"
/* DOWN */
}
);
case "ACCESS_DENIED":
return /* @__PURE__ */ t(
v,
{
role: "img",
"aria-label": "Access denied image",
title: "ACCESS_DENIED"
/* ACCESS_DENIED */
}
);
case "NOT_FOUND":
return /* @__PURE__ */ t(
w,
{
role: "img",
"aria-label": "Resource not found image",
title: "NOT_FOUND"
/* NOT_FOUND */
}
);
default:
return /* @__PURE__ */ t(u, {});
}
}, V = (o) => {
switch (o) {
case "DOWN":
return W;
case "ACCESS_DENIED":
return j;
case "NOT_FOUND":
return P;
default:
return "";
}
};
function Me(o) {
const {
type: i,
entityId: n = "",
entityVersion: D,
message: p,
gotoPlace: l,
id: d,
version: S,
objectType: g,
portalId: f
} = o, [C, T] = k(!1), { isAuthenticated: r } = M(), _ = a(() => B(i), [i]), h = a(() => V(i), [i]), O = a(() => {
const e = [];
switch (i) {
case "ACCESS_DENIED":
r ? e.push(X) : e.push(K);
break;
case "NOT_FOUND":
e.push(z);
break;
}
return p && e.push(p), e;
}, [i, r, p]), I = a(() => {
const e = [];
return i === "ACCESS_DENIED" && (r ? n && e.push({
linkText: Y,
onClick: () => window.open(
"https://sagebionetworks.jira.com/servicedesk/customer/portals",
"_blank"
),
description: ""
}) : e.push({
linkText: G,
onClick: () => l("/LoginPlace:0"),
description: H
})), e;
}, [i, r, n, l]), x = F(
() => T(!1),
[]
);
return /* @__PURE__ */ s(u, { children: [
/* @__PURE__ */ s(
c,
{
sx: {
display: { xs: "flex", lg: "grid" },
columnGap: "80px",
flexDirection: { xs: "column", lg: void 0 },
gridTemplateColumns: { lg: "40% 60%" }
},
children: [
/* @__PURE__ */ t(
c,
{
sx: {
justifySelf: "end",
alignSelf: "center",
"& svg": {
height: "360px",
maxWidth: "300px"
},
pt: "50px",
pb: "50px"
},
children: _
}
),
/* @__PURE__ */ s(
c,
{
sx: {
justifySelf: "start",
alignSelf: "center",
display: "flex",
flexDirection: "column",
gap: "20px",
m: { xs: "15px", lg: void 0 },
mr: { lg: "100px" }
},
children: [
/* @__PURE__ */ t(
m,
{
sx: { fontSize: "30px", fontWeight: 700, lineHeight: "36px" },
children: h
}
),
O.map((e) => /* @__PURE__ */ t(m, { variant: "body1", children: e }, e)),
I.map((e) => {
const { onClick: A, linkText: N, description: y } = e;
return /* @__PURE__ */ s(c, { children: [
/* @__PURE__ */ t(U, { sx: { fontSize: "16px" }, onClick: A, children: N }),
/* @__PURE__ */ t(m, { variant: "body1", children: y })
] }, N);
}),
n && /* @__PURE__ */ t(
E,
{
id: n,
version: D,
type: R.ENTITY
}
),
d && g && /* @__PURE__ */ t(
E,
{
id: d,
version: S,
type: g,
portalId: f
}
)
]
}
)
]
}
),
n && /* @__PURE__ */ t(
L,
{
isOpen: C,
onHide: x,
entityId: n
}
)
] });
}
export {
H as ACCESS_DENIED_ANONYMOUS_ACTION_DESCRIPTION,
K as ACCESS_DENIED_ANONYMOUS_MESSAGE,
Fe as ACCESS_DENIED_CONTACT_ADMIN_ACTION_DESCRIPTION,
X as ACCESS_DENIED_MESSAGE,
j as ACCESS_DENIED_TITLE,
ke as CONTACT_ADMIN_LINK_TEXT,
Y as CONTACT_US_LINK_TEXT,
G as LOG_IN_LINK_TEXT,
z as NOT_FOUND_MESSAGE,
P as NOT_FOUND_TITLE,
W as SYNAPSE_DOWN_TITLE,
$ as SynapseErrorType,
Me as default
};
//# sourceMappingURL=ErrorPage.js.map