synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
33 lines (32 loc) • 906 B
JavaScript
import { useGetDOIAssociation as c } from "../../../synapse-queries/doi/useDOI.js";
import { useGetUserPortalPermissions as l } from "../../../synapse-queries/portal/usePortal.js";
function D(t) {
const { portalId: e, resourceId: o } = t, { data: n } = c(
{
id: o,
portalId: e,
type: "PORTAL_RESOURCE"
},
{ enabled: !!(e && o) }
), { data: r } = l(e, {
enabled: !!e,
select: (i) => i.canMintDoi
});
return !!(n || r);
}
function b(t) {
const { portalDoiConfiguration: e, data: o } = t;
if (!e)
return;
const { resourceType: n, resourceIdKeyColumns: r, serializeDoiString: i } = e, s = r?.reduce((a, d) => {
const u = o[d];
return u != null && (a[d] = u), a;
}, {});
if (!(!s || Object.keys(s).length === 0))
return i(n, s);
}
export {
b as getCandidateDoiId,
D as useShowDoiCardLabel
};
//# sourceMappingURL=PortalDOIUtils.js.map