import { useRouteParameter, useAtLeastOnePermission } from '@rocket.chat/ui-contexts'; import React, { useMemo } from 'react'; import NotAuthorizedPage from '../../notAuthorized/NotAuthorizedPage'; import IntegrationsPage from './IntegrationsPage'; import EditIntegrationsPage from './edit/EditIntegrationsPage'; import OutgoingWebhookHistoryPage from './edit/OutgoingWebhookHistoryPage'; import NewIntegrationsPage from './new/NewIntegrationsPage'; function IntegrationsRoute() { const canViewIntegrationsPage = useAtLeastOnePermission( useMemo( () => [ 'manage-incoming-integrations', 'manage-outgoing-integrations', 'manage-own-incoming-integrations', 'manage-own-outgoing-integrations', ], [], ), ); const context = useRouteParameter('context'); if (!canViewIntegrationsPage) { return ; } if (context === 'new') { return ; } if (context === 'edit') { return ; } if (context === 'history') { return ; } return ; } export default IntegrationsRoute;