@blocklet/pages-kit 0.2.344 → 0.2.345

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,10 @@
1
1
  import { useSessionContext } from '../../../session';
2
+ const ADMIN_ROLES = ['admin', 'owner'];
2
3
  export function useIsAgentAdmin(agent) {
3
4
  const { session } = useSessionContext();
4
5
  if (!session.user)
5
6
  return false;
7
+ if (ADMIN_ROLES.includes(session.user.role))
8
+ return true;
6
9
  return session.user.did === agent.createdBy;
7
10
  }
@@ -14,6 +14,7 @@ import { Stack, Typography } from '@mui/material';
14
14
  import { Suspense, memo } from 'react';
15
15
  import Balancer from 'react-wrap-balancer';
16
16
  import CustomComponentRenderer from '../../../../../components/CustomComponentRenderer';
17
+ import { AgentErrorView } from '../../components/AgentErrorBoundary';
17
18
  import SimpleHeader from '../../components/Header/SimpleHeader';
18
19
  import SimpleLayout from '../../components/Layout/SimpleLayout';
19
20
  import { useActiveAgent } from '../../contexts/ActiveAgent';
@@ -42,5 +43,5 @@ const OutputItemView = memo(({ message }) => {
42
43
  const { appearanceOutput } = useAppearances({ agentId: message.agentId });
43
44
  if (!(appearanceOutput === null || appearanceOutput === void 0 ? void 0 : appearanceOutput.componentId))
44
45
  return null;
45
- return (_jsx(CurrentAgentProvider, { agentId: message.agentId, children: _jsx(CurrentMessageProvider, { message: message, children: _jsx(Suspense, { children: _jsx(CustomComponentRenderer, { componentId: appearanceOutput.componentId, properties: appearanceOutput.componentProperties }) }) }) }));
46
+ return (_jsx(CurrentAgentProvider, { agentId: message.agentId, children: _jsx(CurrentMessageProvider, { message: message, children: _jsx(Suspense, { children: _jsx(CustomComponentRenderer, { componentId: appearanceOutput.componentId, properties: appearanceOutput.componentProperties, fallbackRender: AgentErrorView }) }) }) }));
46
47
  });