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

82 lines (81 loc) 3.09 kB
import { jsxs as l, Fragment as f, jsx as o } from "react/jsx-runtime"; import { WideButton as A } from "../styled/WideButton.js"; 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 { EASY_DIFFICULTY as I } from "../../utils/SynapseConstants.js"; import "lodash-es"; import "@sage-bionetworks/synapse-client/util/synapseClientFetch"; import "@tanstack/react-query"; import "../../utils/PermissionLevelToAccessType.js"; import { useState as R } from "react"; import "../../utils/context/SynapseContext.js"; import "use-deep-compare-effect"; import "@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 { useGetTwoFactorEnrollmentStatus as F } from "../../synapse-queries/auth/useTwoFactorEnrollment.js"; import "react-router"; import "@sage-bionetworks/synapse-client"; import "../../utils/types/IsType.js"; import { useGetAccessRequirements as b } from "../../synapse-queries/dataaccess/useAccessRequirements.js"; import "@tanstack/query-core"; import "lodash-es/isEmpty"; import "lodash-es/isEqual"; import "lodash-es/xorWith"; import E from "../AccessRequirementList/AccessRequirementList.js"; import { ActionRequiredCard as h } from "./ActionRequiredCard/ActionRequiredCard.js"; const j = "Requires Two-Factor Authentication"; function it(m) { const { accessRequirementId: n, count: r } = m, { data: t, isLoading: c } = b( n, { throwOnError: !0 } ), { data: p } = F(), e = p?.status === "ENABLED", [a, i] = R(!1), s = t?.subjectIds && t?.subjectIds.length > 0, u = s ? t?.subjectIds[0].id : void 0, d = s ? t?.subjectIds[0].type : void 0; return /* @__PURE__ */ l(f, { children: [ /* @__PURE__ */ o( h, { isLoading: c, title: j, iconType: I, description: t?.name ?? "", count: r, actionNode: /* @__PURE__ */ o( A, { variant: "contained", onClick: () => i(!0), disabled: e, children: e ? "Complete" : "Start" } ) } ), a && t && /* @__PURE__ */ o( E, { subjectId: u, subjectType: d, accessRequirementFromProps: [t], renderAsModal: !0, numberOfFilesAffected: r, onHide: () => i(!1) } ) ] }); } export { it as EnableTwoFaRequirementCard, j as REQUIRES_2FA_CARD_TITLE }; //# sourceMappingURL=EnableTwoFaRequirementCard.js.map