import { Button, Link, styled } from '@mui/material'; import { SidebarModal } from 'component/common/SidebarModal/SidebarModal'; import { IIncomingWebhook } from 'interfaces/incomingWebhook'; import { useIncomingWebhookEvents } from 'hooks/api/getters/useIncomingWebhookEvents/useIncomingWebhookEvents'; import { Suspense, lazy } from 'react'; import FormTemplate from 'component/common/FormTemplate/FormTemplate'; import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig'; import { SidePanelList } from 'component/common/SidePanelList/SidePanelList'; import { formatDateYMDHMS } from 'utils/formatDate'; import { useLocationSettings } from 'hooks/useLocationSettings'; import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender'; const LazyReactJSONEditor = lazy( () => import('component/common/ReactJSONEditor/ReactJSONEditor'), ); const StyledHeader = styled('div')(({ theme }) => ({ display: 'flex', flexDirection: 'column', marginBottom: theme.fontSizes.mainHeader, })); const StyledHeaderRow = styled('div')({ display: 'flex', justifyContent: 'space-between', alignItems: 'center', width: '100%', }); const StyledHeaderSubtitle = styled('div')(({ theme }) => ({ display: 'flex', flexDirection: 'column', marginTop: theme.spacing(2), fontSize: theme.fontSizes.smallBody, })); const StyledDescription = styled('p')(({ theme }) => ({ color: theme.palette.text.secondary, })); const StyledTitle = styled('h1')({ fontWeight: 'normal', }); const StyledForm = styled('form')({ display: 'flex', flexDirection: 'column', height: '100%', }); const StyledButtonContainer = styled('div')(({ theme }) => ({ marginTop: 'auto', display: 'flex', justifyContent: 'flex-end', paddingTop: theme.spacing(4), })); interface IIncomingWebhooksEventsModalProps { incomingWebhook?: IIncomingWebhook; open: boolean; setOpen: React.Dispatch>; onOpenConfiguration: () => void; } export const IncomingWebhooksEventsModal = ({ incomingWebhook, open, setOpen, onOpenConfiguration, }: IIncomingWebhooksEventsModalProps) => { const { uiConfig } = useUiConfig(); const { locationSettings } = useLocationSettings(); const { incomingWebhookEvents, hasMore, loadMore, loading } = useIncomingWebhookEvents(incomingWebhook?.id, 20, { refreshInterval: 5000, }); if (!incomingWebhook) { return null; } const title = `Events: ${incomingWebhook.name}`; return ( { setOpen(false); }} label={title} > {title} View configuration

{uiConfig.unleashUrl}/api/incoming-webhook/ {incomingWebhook.name}

{incomingWebhook.description}
formatDateYMDHMS( event.createdAt, locationSettings?.locale, ), }, { header: 'Token', maxWidth: 350, cell: (event) => event.tokenName, }, ]} sidePanelHeader='Payload' renderContent={(event) => ( )} listEnd={ Load more } /> } /> No events have been received for this incoming webhook.

} />
); };