UNPKG

@datalayer/core

Version:
31 lines (30 loc) 1.83 kB
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime"; /* * Copyright (c) 2023-2025 Datalayer, Inc. * Distributed under the terms of the Modified BSD License. */ import { useCallback } from 'react'; import { Button, Text } from '@primer/react'; import { useCoreStore, useIAMStore } from '../../state'; import { useNavigate, useAuthorization } from '../../hooks'; import { FlashClosable } from '../../components/flashes'; import { CONTACT_ROUTE } from '../../routes'; export const FlashGuest = () => { const { configuration } = useCoreStore(); const { user, logout } = useIAMStore(); const { checkIsPlatformMember } = useAuthorization(); const isPlatformMember = checkIsPlatformMember(user); const navigate = useNavigate(); const onRefreshPermission = useCallback(() => { logout(); navigate('/jupyter/kernels/login'); }, []); const onContactSupport = useCallback(() => { navigate(CONTACT_ROUTE); }, []); return (_jsx(_Fragment, { children: !isPlatformMember && _jsx(FlashClosable, { variant: "warning", actions: _jsxs(_Fragment, { children: [_jsx(Button, { onClick: onRefreshPermission, title: 'If your roles have recently been updated, you need to refresh your browser.', children: "Refresh permissions" }), _jsx(Button, { onClick: onContactSupport, title: 'Contact the support to request the needed role.', children: configuration?.whiteLabel ? 'Contact the support' : 'Datalayer support' })] }), children: _jsx(Text, { children: "We appreciate your interest in joining Datalayer with a guest role. The platform administrator has been notified and will reach out to you to confirm the granting of your access." }) }) })); }; export default FlashGuest;