diff --git a/src/pages/ProviderEServiceDetailsPage/components/ProviderEServiceDetailsTab/ProviderEServiceDescriptorAttributes.tsx b/src/pages/ProviderEServiceDetailsPage/components/ProviderEServiceDetailsTab/ProviderEServiceDescriptorAttributes.tsx index be3ddc714..a461a2b39 100644 --- a/src/pages/ProviderEServiceDetailsPage/components/ProviderEServiceDetailsTab/ProviderEServiceDescriptorAttributes.tsx +++ b/src/pages/ProviderEServiceDetailsPage/components/ProviderEServiceDetailsTab/ProviderEServiceDescriptorAttributes.tsx @@ -10,10 +10,13 @@ import { useTranslation } from 'react-i18next' import EditIcon from '@mui/icons-material/Edit' import type { AttributeKey } from '@/types/attribute.types' import { ProviderEServiceUpdateDescriptorAttributesDrawer } from './ProviderEServiceUpdateDescriptorAttributesDrawer' +import { AuthHooks } from '@/api/auth' +import { useGetDelegationUserRole } from '@/hooks/useGetDelegationUserRole' export const ProviderEServiceDescriptorAttributes: React.FC = () => { const { t } = useTranslation('eservice', { keyPrefix: 'read.sections.attributes' }) const { t: tCommon } = useTranslation('common') + const { jwt } = AuthHooks.useJwt() const { eserviceId, descriptorId } = useParams<'PROVIDE_ESERVICE_MANAGE'>() const { data: descriptorAttributes } = useSuspenseQuery({ @@ -21,13 +24,18 @@ export const ProviderEServiceDescriptorAttributes: React.FC = () => { select: (d) => d.attributes, }) + const { isDelegator } = useGetDelegationUserRole({ + eserviceId, + organizationId: jwt?.organizationId, + }) + const [editAttributeDrawerState, setEditAttributeDrawerState] = useState<{ kind: AttributeKey isOpen: boolean }>({ isOpen: false, kind: 'certified' }) const getAttributeSectionActions = (kind: AttributeKey): Array | undefined => { - if (descriptorAttributes[kind].length === 0) return + if (descriptorAttributes[kind].length === 0 || isDelegator) return return [ { diff --git a/src/pages/ProviderEServiceDetailsPage/components/ProviderEServiceDetailsTab/ProviderEServiceGeneralInfoSection/ProviderEServiceGeneralInfoSection.tsx b/src/pages/ProviderEServiceDetailsPage/components/ProviderEServiceDetailsTab/ProviderEServiceGeneralInfoSection/ProviderEServiceGeneralInfoSection.tsx index 6088e1fa3..7c2324622 100644 --- a/src/pages/ProviderEServiceDetailsPage/components/ProviderEServiceDetailsTab/ProviderEServiceGeneralInfoSection/ProviderEServiceGeneralInfoSection.tsx +++ b/src/pages/ProviderEServiceDetailsPage/components/ProviderEServiceDetailsTab/ProviderEServiceGeneralInfoSection/ProviderEServiceGeneralInfoSection.tsx @@ -12,18 +12,26 @@ import { EServiceVersionSelectorDrawer } from '@/components/shared/EServiceVersi import EditIcon from '@mui/icons-material/Edit' import { ProviderEServiceUpdateDescriptionDrawer } from './ProviderEServiceUpdateDescriptionDrawer' import { useSuspenseQuery } from '@tanstack/react-query' +import { useGetDelegationUserRole } from '@/hooks/useGetDelegationUserRole' +import { AuthHooks } from '@/api/auth' export const ProviderEServiceGeneralInfoSection: React.FC = () => { const { t } = useTranslation('eservice', { keyPrefix: 'read.sections.generalInformations', }) const { t: tCommon } = useTranslation('common') + const { jwt } = AuthHooks.useJwt() const { eserviceId, descriptorId } = useParams<'PROVIDE_ESERVICE_MANAGE'>() const { data: descriptor } = useSuspenseQuery( EServiceQueries.getDescriptorProvider(eserviceId, descriptorId) ) + const { isDelegator } = useGetDelegationUserRole({ + eserviceId, + organizationId: jwt?.organizationId, + }) + const downloadConsumerList = EServiceDownloads.useDownloadConsumerList() const exportVersion = EServiceDownloads.useExportVersion() @@ -94,13 +102,17 @@ export const ProviderEServiceGeneralInfoSection: React.FC = () => { innerSection title={t('eserviceDescription.label')} titleTypographyProps={{ variant: 'body1', fontWeight: 600 }} - topSideActions={[ - { - action: openEServiceUpdateDescriptionDrawer, - label: tCommon('actions.edit'), - icon: EditIcon, - }, - ]} + topSideActions={ + isDelegator + ? [] + : [ + { + action: openEServiceUpdateDescriptionDrawer, + label: tCommon('actions.edit'), + icon: EditIcon, + }, + ] + } > {descriptor.eservice.description} diff --git a/src/pages/ProviderEServiceDetailsPage/components/ProviderEServiceDetailsTab/ProviderEServiceTechnicalInfoSection/ProviderEServiceDocumentationSection.tsx b/src/pages/ProviderEServiceDetailsPage/components/ProviderEServiceDetailsTab/ProviderEServiceTechnicalInfoSection/ProviderEServiceDocumentationSection.tsx index 673f51603..f2bf541a8 100644 --- a/src/pages/ProviderEServiceDetailsPage/components/ProviderEServiceDetailsTab/ProviderEServiceTechnicalInfoSection/ProviderEServiceDocumentationSection.tsx +++ b/src/pages/ProviderEServiceDetailsPage/components/ProviderEServiceDetailsTab/ProviderEServiceTechnicalInfoSection/ProviderEServiceDocumentationSection.tsx @@ -11,6 +11,8 @@ import AttachFileIcon from '@mui/icons-material/AttachFile' import { EServiceDownloads } from '@/api/eservice' import { getDownloadDocumentName } from '@/utils/eservice.utils' import { ProviderEServiceUpdateDocumentationDrawer } from './ProviderEServiceUpdateDocumentationDrawer' +import { AuthHooks } from '@/api/auth' +import { useGetDelegationUserRole } from '@/hooks/useGetDelegationUserRole' type ProviderEServiceDocumentationSectionProps = { descriptor: ProducerEServiceDescriptor @@ -24,6 +26,13 @@ export const ProviderEServiceDocumentationSection: React.FC< }) const { t: tCommon } = useTranslation('common') + const { jwt } = AuthHooks.useJwt() + + const { isDelegator } = useGetDelegationUserRole({ + eserviceId: descriptor.eservice.id, + organizationId: jwt?.organizationId, + }) + const docs = [descriptor.interface, ...descriptor.docs] const { isOpen, openDrawer, closeDrawer } = useDrawerState() @@ -50,13 +59,17 @@ export const ProviderEServiceDocumentationSection: React.FC< { const signalHubFlagDisabledStage: PagoPAEnvVars['STAGE'][] = ['PROD', 'UAT'] diff --git a/src/pages/ProviderEServiceDetailsPage/components/ProviderEServiceDetailsTab/ProviderEServiceTechnicalInfoSection/ProviderEServiceThresholdsSection.tsx b/src/pages/ProviderEServiceDetailsPage/components/ProviderEServiceDetailsTab/ProviderEServiceTechnicalInfoSection/ProviderEServiceThresholdsSection.tsx index de70b4544..a0c7c5a4a 100644 --- a/src/pages/ProviderEServiceDetailsPage/components/ProviderEServiceDetailsTab/ProviderEServiceTechnicalInfoSection/ProviderEServiceThresholdsSection.tsx +++ b/src/pages/ProviderEServiceDetailsPage/components/ProviderEServiceDetailsTab/ProviderEServiceTechnicalInfoSection/ProviderEServiceThresholdsSection.tsx @@ -8,6 +8,8 @@ import { InformationContainer } from '@pagopa/interop-fe-commons' import { formatThousands, secondsToMinutes } from '@/utils/format.utils' import { useDrawerState } from '@/hooks/useDrawerState' import { ProviderEServiceUpdateThresholdsDrawer } from './ProviderEServiceUpdateThresholdsDrawer' +import { AuthHooks } from '@/api/auth' +import { useGetDelegationUserRole } from '@/hooks/useGetDelegationUserRole' type ProviderEServiceThresholdsSectionProps = { descriptor: ProducerEServiceDescriptor @@ -21,6 +23,13 @@ export const ProviderEServiceThresholdsSection: React.FC< }) const { t: tCommon } = useTranslation('common') + const { jwt } = AuthHooks.useJwt() + + const { isDelegator } = useGetDelegationUserRole({ + eserviceId: descriptor.eservice.id, + organizationId: jwt?.organizationId, + }) + const voucherLifespan = secondsToMinutes(descriptor.voucherLifespan) const { isOpen, openDrawer, closeDrawer } = useDrawerState() @@ -34,13 +43,17 @@ export const ProviderEServiceThresholdsSection: React.FC<